$ git clone http://tcclient.ion.nu/tc_client.git
commit 784e652a2962669e780584fb31539daa6487f273
Author: Alicia <...>
Date: Wed May 4 10:58:09 2016 +0200
tc_client-gtk: if we failed to open the camera, just give a grey screen.
diff --git a/ChangeLog b/ChangeLog
index 0a4fc33..52865e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ tc_client-gtk: added postprocessing options for cams upon right-click, starting
tc_client-gtk: moved encoding out of the cam thread, allowing postprocessing to be applied to the broadcasted frame.
tc_client-gtk: added horizontal and vertical flip as postprocessing options.
tc_client-gtk: reallocate frame when camera input size changes.
+tc_client-gtk: if we failed to open the camera, just give a grey screen.
tc_client-gtk and camviewer: fixed compatibility with newer libavutil.
0.38:
Handle multi-line messages.
diff --git a/utilities/gtk/media.c b/utilities/gtk/media.c
index dea6514..7ec5b2b 100644
--- a/utilities/gtk/media.c
+++ b/utilities/gtk/media.c
@@ -277,19 +277,24 @@ GIOChannel* camthread(const char* name, AVCodec* vencoder, unsigned int delay)
int campipe[2];
#ifndef _WIN32
CAM* cam=cam_open(name); // Opening here in case of GUI callbacks
- cam_resolution(cam, &camsize_out.width, &camsize_out.height);
+ if(cam){cam_resolution(cam, &camsize_out.width, &camsize_out.height);}
pipe(campipe);
camproc=fork();
if(!camproc)
{
close(campipe[0]);
- if(!cam){_exit(1);}
+ unsigned char img[camsize_out.width*camsize_out.height*3];
+ if(!cam) // If it failed to open, just give some grey before quitting
+ {
+ memset(img, 0x7f, camsize_out.width*camsize_out.height*3);
+ write(campipe[1], img, camsize_out.width*camsize_out.height*3);
+ _exit(1);
+ }
#ifndef _WIN32
prctl(PR_SET_PDEATHSIG, SIGHUP);
camthread_delay=&delay;
signal(SIGUSR1, camthread_resetdelay);
#endif
- unsigned char img[camsize_out.width*camsize_out.height*3];
while(1)
{
usleep(delay);