diff options
author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-10-23 03:58:32 +0000 |
---|---|---|
committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-10-23 03:58:32 +0000 |
commit | 5401be358f1501e9981f63ea6368978b522fedad (patch) | |
tree | 1a515c9a97dcd04f5b57419af9065b77cc4d7aaf | |
parent | 51e1ec5f589862ddfd9322daf5bcd684698fb48f (diff) |
reopen device handling
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@107 f606c939-3180-4ac9-a4b8-4b8779d57d0a
-rw-r--r-- | recordmydesktop/src/capture_sound.c | 4 | ||||
-rw-r--r-- | recordmydesktop/src/recordmydesktop.c | 14 |
2 files changed, 13 insertions, 5 deletions
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; } |