summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-07-09 21:52:26 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-07-11 13:36:41 -0700
commit2ed7cf4206cbbbf00137099d048774406adbe40d (patch)
treea9ea27637fc747cf444f1406f81f5e55150a11b2
parentcc31c9c0b8e7e1d5d75c13d621cbfd2eba90cb4e (diff)
*: more random minor cleanups
Nothing significant
-rw-r--r--recordmydesktop/src/rmd_capture_sound.c55
-rw-r--r--recordmydesktop/src/rmd_get_frame.c8
-rw-r--r--recordmydesktop/src/rmd_poll_events.c1
-rw-r--r--recordmydesktop/src/rmd_rectinsert.c3
4 files changed, 31 insertions, 36 deletions
diff --git a/recordmydesktop/src/rmd_capture_sound.c b/recordmydesktop/src/rmd_capture_sound.c
index 4ea26fb..2d02aee 100644
--- a/recordmydesktop/src/rmd_capture_sound.c
+++ b/recordmydesktop/src/rmd_capture_sound.c
@@ -87,10 +87,9 @@ 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 =
- rmdOpenDev(pdata->args.device,
- pdata->args.channels,
- pdata->args.frequency);
+ 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");
pdata->running = FALSE;
@@ -103,47 +102,45 @@ void *rmdCaptureSound(ProgData *pdata) {
//create new buffer
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;
//read data into new buffer
#ifdef HAVE_LIBASOUND
while (sret<frames) {
- int temp_sret=snd_pcm_readi(pdata->sound_handle,
- newbuf->data+pdata->sound_framesize*sret,
- frames-sret);
- if (temp_sret==-EPIPE) {
- fprintf(stderr,"%s: Overrun occurred.\n",
- snd_strerror(temp_sret));
+ int temp_sret = snd_pcm_readi( pdata->sound_handle,
+ newbuf->data + pdata->sound_framesize * sret,
+ frames-sret);
+ if (temp_sret == -EPIPE) {
+ fprintf(stderr, "%s: Overrun occurred.\n",
+ snd_strerror(temp_sret));
snd_pcm_prepare(pdata->sound_handle);
- } else if (temp_sret<0) {
- fprintf(stderr,"An error occured while reading sound data:\n"
- " %s\n",
- snd_strerror(temp_sret));
+ } else if (temp_sret < 0) {
+ fprintf(stderr, "An error occured while reading sound data:\n"
+ " %s\n",
+ snd_strerror(temp_sret));
snd_pcm_prepare(pdata->sound_handle);
} else
sret += temp_sret;
}
#else
- sret=0;
+ sret = 0;
//oss recording loop
do {
- int temp_sret=read(pdata->sound_handle,
- &newbuf->data[sret],
- ((pdata->args.buffsize<<1)*
- pdata->args.channels)-sret);
- if (temp_sret<0) {
- fprintf(stderr,"An error occured while reading from soundcard"
- "%s\n"
- "Error description:\n"
- "%s\n",pdata->args.device,strerror(errno));
+ int temp_sret = read( pdata->sound_handle,
+ &newbuf->data[sret],
+ (pdata->args.buffsize << 1) *
+ pdata->args.channels)-sret;
+ if (temp_sret < 0) {
+ fprintf(stderr, "An error occured while reading from soundcard"
+ "%s\nError description:\n%s\n",
+ pdata->args.device, strerror(errno));
} else
- sret+=temp_sret;
- } while (sret<((pdata->args.buffsize<<1)*
- pdata->args.channels));
+ sret += temp_sret;
+ } while (sret < (pdata->args.buffsize << 1) * pdata->args.channels);
#endif
//queue the new buffer
pthread_mutex_lock(&pdata->sound_buffer_mutex);
diff --git a/recordmydesktop/src/rmd_get_frame.c b/recordmydesktop/src/rmd_get_frame.c
index fb4d6df..cec2c80 100644
--- a/recordmydesktop/src/rmd_get_frame.c
+++ b/recordmydesktop/src/rmd_get_frame.c
@@ -148,7 +148,7 @@ static int rmdFirstFrame(ProgData *pdata, XImage **image, XShmSegmentInfo *shmin
IPC_CREAT|0777);
if ((*shminfo).shmid == -1) {
- fprintf(stderr,"Failed to obtain Shared Memory segment!\n");
+ fprintf(stderr, "Failed to obtain Shared Memory segment!\n");
return 12;
}
@@ -156,7 +156,7 @@ static int rmdFirstFrame(ProgData *pdata, XImage **image, XShmSegmentInfo *shmin
(*shminfo).readOnly = False;
if (!XShmAttach(pdata->dpy, shminfo)) {
- fprintf(stderr,"Failed to attach shared memory to proccess.\n");
+ fprintf(stderr, "Failed to attach shared memory to proccess.\n");
return 12;
}
@@ -264,7 +264,7 @@ void *rmdGetFrame(ProgData *pdata) {
if (remove(pdata->args.filename)) {
perror("Error while removing file:\n");
} else {
- fprintf(stderr, "SIGABRT received,file %s removed\n",
+ fprintf(stderr, "SIGABRT received, file %s removed\n",
pdata->args.filename);
}
} else {
@@ -280,7 +280,7 @@ void *rmdGetFrame(ProgData *pdata) {
if (remove(pdata->args.filename)) {
perror("Error while removing file:\n");
} else{
- fprintf(stderr, "SIGABRT received,file %s removed\n",
+ fprintf(stderr, "SIGABRT received, file %s removed\n",
pdata->args.filename);
}
} else {
diff --git a/recordmydesktop/src/rmd_poll_events.c b/recordmydesktop/src/rmd_poll_events.c
index a53f5bd..349aeba 100644
--- a/recordmydesktop/src/rmd_poll_events.c
+++ b/recordmydesktop/src/rmd_poll_events.c
@@ -202,6 +202,5 @@ void rmdEventLoop(ProgData *pdata) {
inserts += rmdRectInsert(&pdata->rect_root,&xrect);
}
}
-
}
}
diff --git a/recordmydesktop/src/rmd_rectinsert.c b/recordmydesktop/src/rmd_rectinsert.c
index a929807..1352047 100644
--- a/recordmydesktop/src/rmd_rectinsert.c
+++ b/recordmydesktop/src/rmd_rectinsert.c
@@ -387,8 +387,7 @@ int rmdRectInsert(RectArea **root,XRectangle *xrect) {
total_insertions--;
temp->next->prev=temp->prev;
temp->prev->next=temp->next;
- total_insertions+=rmdRectInsert(&temp->next,
- xrect);
+ total_insertions+=rmdRectInsert(&temp->next, xrect);
}
free(temp);
}
© All Rights Reserved