$ git clone http://tcclient.ion.nu/tc_client.git
commit 61c230e7c87a875af091a171b8d46b2e03c504d0
Author: Alicia <...>
Date: Wed May 4 10:10:40 2016 +0200
tc_client-gtk: reallocate frame when camera input size changes.
diff --git a/ChangeLog b/ChangeLog
index 2c63734..0a4fc33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@ tc_client-gtk: handle only one sendmessage event at a time, and don't send empty
tc_client-gtk: added postprocessing options for cams upon right-click, starting with brightness adjustment.
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 and camviewer: fixed compatibility with newer libavutil.
0.38:
Handle multi-line messages.
diff --git a/utilities/gtk/camviewer.c b/utilities/gtk/camviewer.c
index 4c7d336..778669f 100644
--- a/utilities/gtk/camviewer.c
+++ b/utilities/gtk/camviewer.c
@@ -486,6 +486,8 @@ gboolean handledata(GIOChannel* iochannel, GIOCondition condition, gpointer data
cam->vctx->height=camsize_out.height;
avcodec_open2(cam->vctx, data->vencoder, 0);
cam->frame->data[0]=0;
+ cam->frame->width=0;
+ cam->frame->height=0;
cam->dstframe->data[0]=0;
cam->actx=0;
diff --git a/utilities/gtk/media.c b/utilities/gtk/media.c
index 5135f3c..dea6514 100644
--- a/utilities/gtk/media.c
+++ b/utilities/gtk/media.c
@@ -213,12 +213,13 @@ gboolean cam_encode(GIOChannel* iochannel, GIOCondition condition, gpointer data
av_image_alloc(cam->dstframe->data, cam->dstframe->linesize, camsize_out.width, camsize_out.height, cam->dstframe->format, 1);
}
}
- if(!cam->frame->data[0])
+ if(cam->frame->width!=camsize_out.width || cam->frame->height!=camsize_out.height)
{
cam->frame->format=AV_PIX_FMT_RGB24;
cam->frame->width=camsize_out.width;
cam->frame->height=camsize_out.height;
cam->frame->linesize[0]=cam->frame->width*3;
+ av_freep(cam->frame->data);
av_image_alloc(cam->frame->data, cam->frame->linesize, camsize_out.width, camsize_out.height, cam->frame->format, 1);
}
g_io_channel_read_chars(iochannel, (void*)cam->frame->data[0], camsize_out.width*camsize_out.height*3, 0, 0);