summaryrefslogtreecommitdiff
path: root/recordmydesktop/src/rmd_capture_sound.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-07-01 19:42:17 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-07-11 13:36:41 -0700
commitbbd22c084923065a74e8aae774eb0e4e611454cd (patch)
treef006749cf5eca710cf5670682b8f689732fda42b /recordmydesktop/src/rmd_capture_sound.c
parent03d4c4f006bc16594b10f05a64e1c542eba9e327 (diff)
*: more random cleanups mostly formatting
nothing functionally different
Diffstat (limited to 'recordmydesktop/src/rmd_capture_sound.c')
-rw-r--r--recordmydesktop/src/rmd_capture_sound.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/recordmydesktop/src/rmd_capture_sound.c b/recordmydesktop/src/rmd_capture_sound.c
index c1faa44..4ea26fb 100644
--- a/recordmydesktop/src/rmd_capture_sound.c
+++ b/recordmydesktop/src/rmd_capture_sound.c
@@ -43,14 +43,14 @@
void *rmdCaptureSound(ProgData *pdata) {
#ifdef HAVE_LIBASOUND
- int frames=pdata->periodsize;
+ int frames = pdata->periodsize;
#endif
//start capturing only after first frame is taken
usleep(pdata->frametime);
while (pdata->running) {
- int sret=0;
- SndBuffer *newbuf,*tmp;
+ int sret = 0;
+ SndBuffer *newbuf, *tmp;
if (pdata->paused) {
#ifdef HAVE_LIBASOUND
@@ -65,7 +65,7 @@ void *rmdCaptureSound(ProgData *pdata) {
pthread_mutex_lock(&pdata->pause_mutex);
pthread_cond_wait(&pdata->pause_cond, &pdata->pause_mutex);
pthread_mutex_unlock(&pdata->pause_mutex);
- pdata->sound_handle=
+ pdata->sound_handle =
rmdOpenDev(pdata->args.device,
&pdata->args.channels,
&pdata->args.frequency,
@@ -75,10 +75,10 @@ void *rmdCaptureSound(ProgData *pdata) {
NULL//let's hope that the device capabilities
//didn't magically change
);
- if (pdata->sound_handle==NULL) {
- fprintf(stderr,"Couldn't reopen sound device.Exiting\n");
+ if (pdata->sound_handle == NULL) {
+ fprintf(stderr, "Couldn't reopen sound device.Exiting\n");
pdata->running = FALSE;
- errno=3;
+ errno = 3;
pthread_exit(&errno);
}
}
@@ -87,28 +87,27 @@ void *rmdCaptureSound(ProgData *pdata) {
pthread_mutex_lock(&pdata->pause_mutex);
pthread_cond_wait(&pdata->pause_cond, &pdata->pause_mutex);
pthread_mutex_unlock(&pdata->pause_mutex);
- pdata->sound_handle=
+ pdata->sound_handle =
rmdOpenDev(pdata->args.device,
pdata->args.channels,
pdata->args.frequency);
- if (pdata->sound_handle<0) {
- fprintf(stderr,"Couldn't reopen sound device.Exiting\n");
+ if (pdata->sound_handle < 0) {
+ fprintf(stderr,"Couldn't reopen sound device. Exiting\n");
pdata->running = FALSE;
- errno=3;
+ errno = 3;
pthread_exit(&errno);
}
#endif
}
//create new buffer
- newbuf=(SndBuffer *)malloc(sizeof(SndBuffer));
+ newbuf = (SndBuffer *)malloc(sizeof(SndBuffer));
#ifdef HAVE_LIBASOUND
- newbuf->data=(signed char *)malloc(frames*pdata->sound_framesize);
+ newbuf->data = (signed char *)malloc(frames*pdata->sound_framesize);
#else
- newbuf->data=(signed char *)malloc(((pdata->args.buffsize<<1)*
- pdata->args.channels));
+ newbuf->data = (signed char *)malloc(((pdata->args.buffsize<<1) * pdata->args.channels));
#endif
- newbuf->next=NULL;
+ newbuf->next = NULL;
//read data into new buffer
#ifdef HAVE_LIBASOUND
@@ -126,7 +125,7 @@ void *rmdCaptureSound(ProgData *pdata) {
snd_strerror(temp_sret));
snd_pcm_prepare(pdata->sound_handle);
} else
- sret+=temp_sret;
+ sret += temp_sret;
}
#else
sret=0;
© All Rights Reserved