summaryrefslogtreecommitdiff
path: root/recordmydesktop/src/rmd_opendev.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-07-11 15:36:20 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-07-11 16:17:32 -0700
commit522d52b58f6a8c29efa915bb1b119f49212e89ee (patch)
treeceec0dad2ac6532e64a3348f9ae1cd6516601597 /recordmydesktop/src/rmd_opendev.c
parenteb1a698e750cbb8c7503c93e291942986364aa31 (diff)
*: more formatting cleanups
Nothing functionally changed
Diffstat (limited to 'recordmydesktop/src/rmd_opendev.c')
-rw-r--r--recordmydesktop/src/rmd_opendev.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/recordmydesktop/src/rmd_opendev.c b/recordmydesktop/src/rmd_opendev.c
index c196c5a..37fb33c 100644
--- a/recordmydesktop/src/rmd_opendev.c
+++ b/recordmydesktop/src/rmd_opendev.c
@@ -52,35 +52,35 @@ snd_pcm_t *rmdOpenDev( const char *pcm_dev,
snd_pcm_t *mhandle;
snd_pcm_hw_params_t *hwparams;
- unsigned int periods=2;
+ unsigned int periods = 2;
unsigned int exactrate = *frequency;
// The compiler might warn us because the expansion starts with
// assert(&hwparams)
snd_pcm_hw_params_alloca(&hwparams);
- if (snd_pcm_open(&mhandle,pcm_dev,SND_PCM_STREAM_CAPTURE,SND_PCM_ASYNC)<0) {
+ if (snd_pcm_open(&mhandle, pcm_dev, SND_PCM_STREAM_CAPTURE, SND_PCM_ASYNC) < 0) {
fprintf(stderr, "Couldn't open PCM device %s\n", pcm_dev);
return NULL;
} else
fprintf(stderr, "Opened PCM device %s\n", pcm_dev);
- if (snd_pcm_hw_params_any(mhandle, hwparams)<0) {
+ if (snd_pcm_hw_params_any(mhandle, hwparams) < 0) {
fprintf(stderr, "Couldn't configure PCM device.\n");
return NULL;
}
- if (snd_pcm_hw_params_set_access(mhandle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)<0) {
+ if (snd_pcm_hw_params_set_access(mhandle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0) {
fprintf(stderr, "Couldn't set access.\n");
return NULL;
}
- if (snd_pcm_hw_params_set_format(mhandle, hwparams, SND_PCM_FORMAT_S16_LE)<0) {
+ if (snd_pcm_hw_params_set_format(mhandle, hwparams, SND_PCM_FORMAT_S16_LE) < 0) {
fprintf(stderr, "Couldn't set format.\n");
return NULL;
}
- if (snd_pcm_hw_params_set_rate_near(mhandle, hwparams, &exactrate, 0)<0) {
+ if (snd_pcm_hw_params_set_rate_near(mhandle, hwparams, &exactrate, 0) < 0) {
fprintf(stderr, "Couldn't set frequency.\n");
return NULL;
}
@@ -90,48 +90,48 @@ snd_pcm_t *rmdOpenDev( const char *pcm_dev,
"Using %dHz instead.\n",
*frequency, exactrate);
- *frequency=exactrate;
+ *frequency = exactrate;
}
- if (snd_pcm_hw_params_set_channels_near(mhandle, hwparams, channels)<0) {
+ if (snd_pcm_hw_params_set_channels_near(mhandle, hwparams, channels) < 0) {
fprintf(stderr, "Couldn't set channels number.\n");
return NULL;
}
if (*channels>2) {
- fprintf(stderr,"Channels number should be 1(mono) or 2(stereo).\n");
+ fprintf(stderr, "Channels number should be 1(mono) or 2(stereo).\n");
return NULL;
}
- if (snd_pcm_hw_params_set_periods_near(mhandle,hwparams,&periods,0)<0) {
+ if (snd_pcm_hw_params_set_periods_near(mhandle, hwparams, &periods, 0) < 0) {
fprintf(stderr, "Couldn't set periods.\n");
return NULL;
}
- if (snd_pcm_hw_params_set_buffer_size_near(mhandle,hwparams,buffsize)<0) {
+ if (snd_pcm_hw_params_set_buffer_size_near(mhandle, hwparams, buffsize) < 0) {
fprintf(stderr, "Couldn't set buffer size.\n");
return NULL;
}
- if (snd_pcm_hw_params(mhandle,hwparams)<0) {
+ if (snd_pcm_hw_params(mhandle, hwparams) < 0) {
fprintf(stderr, "Couldn't set hardware parameters.\n");
return NULL;
}
- if (hard_pause!=NULL) {
+ if (hard_pause != NULL) {
if (!snd_pcm_hw_params_can_pause(hwparams))
- *hard_pause=1;
+ *hard_pause = 1;
}
- if (periodsize!=NULL)
- snd_pcm_hw_params_get_period_size(hwparams,periodsize,0);
+ if (periodsize != NULL)
+ snd_pcm_hw_params_get_period_size(hwparams, periodsize, 0);
- if (periodtime!=NULL)
- snd_pcm_hw_params_get_period_time(hwparams,periodtime,0);
+ if (periodtime != NULL)
+ snd_pcm_hw_params_get_period_time(hwparams, periodtime, 0);
fprintf(stderr,
"Recording on device %s is set to:\n%d channels at %dHz\n",
- pcm_dev,*channels,*frequency);
+ pcm_dev, *channels, *frequency);
snd_pcm_prepare(mhandle);
@@ -144,43 +144,43 @@ int rmdOpenDev(const char *pcm_dev, unsigned int channels, unsigned int frequenc
int fd ;
unsigned int value;
- fd=open(pcm_dev,O_RDONLY);
+ fd = open(pcm_dev, O_RDONLY);
if (fd < 0)
return -1;
- if (ioctl(fd,SNDCTL_DSP_GETFMTS,&value)<0) {
- fprintf(stderr,"Couldn't get audio format list\n");
+ if (ioctl(fd, SNDCTL_DSP_GETFMTS, &value) < 0) {
+ fprintf(stderr, "Couldn't get audio format list\n");
return -1;
}
if (value & AFMT_S16_LE) {
- value=AFMT_S16_LE;
+ value = AFMT_S16_LE;
} else if (value & AFMT_S16_BE) {
- value=AFMT_S16_BE;
+ value = AFMT_S16_BE;
} else {
- fprintf(stderr,"Soundcard doesn't support signed 16-bit-data\n");
+ fprintf(stderr, "Soundcard doesn't support signed 16-bit-data\n");
return -1;
}
- if (ioctl(fd,SNDCTL_DSP_SETFMT,&value)<0) {
- fprintf(stderr,"Couldn't set audio format\n" );
+ if (ioctl(fd, SNDCTL_DSP_SETFMT, &value) < 0) {
+ fprintf(stderr, "Couldn't set audio format\n" );
return -1;
}
value = channels;
- if (ioctl(fd,SNDCTL_DSP_CHANNELS,&value)<0) {
- fprintf(stderr,"Cannot set the number of channels\n" );
+ if (ioctl(fd, SNDCTL_DSP_CHANNELS, &value) < 0) {
+ fprintf(stderr, "Cannot set the number of channels\n" );
return -1;
}
value = frequency;
- if (ioctl(fd,SNDCTL_DSP_SPEED,&value)<0) {
- fprintf(stderr,"Couldn't set audio frequency\n" );
+ if (ioctl(fd, SNDCTL_DSP_SPEED, &value) < 0) {
+ fprintf(stderr, "Couldn't set audio frequency\n" );
return -1;
}
- if (fcntl(fd,F_SETFL,fcntl(fd,F_GETFL) & ~O_NONBLOCK)<0) {
- fprintf(stderr,"Couldn't set audio blocking mode\n" );
+ if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_NONBLOCK) < 0) {
+ fprintf(stderr, "Couldn't set audio blocking mode\n" );
return -1;
}
© All Rights Reserved