From 5401be358f1501e9981f63ea6368978b522fedad Mon Sep 17 00:00:00 2001 From: iovar Date: Mon, 23 Oct 2006 03:58:32 +0000 Subject: reopen device handling git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@107 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/capture_sound.c | 4 +++- recordmydesktop/src/recordmydesktop.c | 14 ++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'recordmydesktop/src') diff --git a/recordmydesktop/src/capture_sound.c b/recordmydesktop/src/capture_sound.c index f28ba26..3bda596 100644 --- a/recordmydesktop/src/capture_sound.c +++ b/recordmydesktop/src/capture_sound.c @@ -57,7 +57,9 @@ void *CaptureSound(void *pdata){ NULL//let's hope that the device capabilities didn't magically change ); if(((ProgData *)pdata)->sound_handle==NULL){ - fprintf(stderr,"Couldn't reopen sound device.\nThere will be no sound data from this point on.\n"); + fprintf(stderr,"Couldn't reopen sound device.Exiting\n"); + ((ProgData *)pdata)->running=0; + errno=3; pthread_exit(&errno); } } diff --git a/recordmydesktop/src/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c index 5b7e32b..6b9e003 100644 --- a/recordmydesktop/src/recordmydesktop.c +++ b/recordmydesktop/src/recordmydesktop.c @@ -30,7 +30,7 @@ int main(int argc,char **argv){ ProgData pdata; - + int exit_status=0; if(XInitThreads ()==0){ fprintf(stderr,"Couldn't initialize thread support!\n"); exit(7); @@ -207,9 +207,15 @@ int main(int argc,char **argv){ pthread_join(image_encode_t,NULL); fprintf(stderr,"."); if(!pdata.args.nosound){ - pthread_join(sound_capture_t,NULL); + int *snd_exit; + pthread_join(sound_capture_t,(&snd_exit)); fprintf(stderr,"."); - pthread_join(sound_encode_t,NULL); + if(!(*snd_exit)) + pthread_join(sound_encode_t,NULL); + else{ + pthread_cancel(sound_encode_t); + exit_status=*snd_exit; + } fprintf(stderr,"."); } else @@ -240,7 +246,7 @@ int main(int argc,char **argv){ else fprintf(stderr,"Goodbye!\n"); } - return 0; + return exit_status; } -- cgit v1.2.1