$ git clone http://tcclient.ion.nu/tc_client.git
commit 1b4ea8857eb48f6ce34256d3c4fa3f0205720744
Author: Alicia <...>
Date: Wed Apr 27 11:12:22 2016 +0200
tc_client-gtk and camviewer: fixed compatibility with newer libavutil.
diff --git a/ChangeLog b/ChangeLog
index 7d13954..dcc870a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
0.39:
modbot: only use youtube-dl's 'ytsearch:' for --get-id, and only if it doesn't appear to be an ID already.
tc_client-gtk: handle only one sendmessage event at a time, and don't send empty lines.
+tc_client-gtk and camviewer: fixed compatibility with newer libavutil.
0.38:
Handle multi-line messages.
Added option --hexcolors to print hex color codes instead of ANSI color escape codes.
diff --git a/utilities/camviewer/camviewer.c b/utilities/camviewer/camviewer.c
index 1df934a..84c3707 100644
--- a/utilities/camviewer/camviewer.c
+++ b/utilities/camviewer/camviewer.c
@@ -351,7 +351,7 @@ gboolean handledata(GIOChannel* channel, GIOCondition condition, gpointer datap)
if(!gotframe){return 1;}
// Convert to RGB24 format
- unsigned int bufsize=avpicture_get_size(PIX_FMT_RGB24, cam->frame->width, cam->frame->height);
+ unsigned int bufsize=avpicture_get_size(AV_PIX_FMT_RGB24, cam->frame->width, cam->frame->height);
unsigned char buf[bufsize];
cam->dstframe->data[0]=buf;
cam->dstframe->linesize[0]=cam->frame->width*3;
@@ -424,12 +424,12 @@ void togglecam(GtkButton* button, struct viddata* data)
ctx->width=320;
ctx->height=240;
cam_resolution(cam, (unsigned int*)&ctx->width, (unsigned int*)&ctx->height);
- ctx->pix_fmt=PIX_FMT_YUV420P;
+ ctx->pix_fmt=AV_PIX_FMT_YUV420P;
ctx->time_base.num=1;
ctx->time_base.den=10;
avcodec_open2(ctx, data->vencoder, 0);
AVFrame* frame=av_frame_alloc();
- frame->format=PIX_FMT_RGB24;
+ frame->format=AV_PIX_FMT_RGB24;
frame->width=ctx->width;
frame->height=ctx->height;
av_image_alloc(frame->data, frame->linesize, ctx->width, ctx->height, frame->format, 1);
@@ -447,7 +447,7 @@ void togglecam(GtkButton* button, struct viddata* data)
dstframe->height=ctx->height;
av_image_alloc(dstframe->data, dstframe->linesize, ctx->width, ctx->height, ctx->pix_fmt, 1);
- struct SwsContext* swsctx=sws_getContext(frame->width, frame->height, PIX_FMT_RGB24, frame->width, frame->height, AV_PIX_FMT_YUV420P, 0, 0, 0, 0);
+ struct SwsContext* swsctx=sws_getContext(frame->width, frame->height, AV_PIX_FMT_RGB24, frame->width, frame->height, AV_PIX_FMT_YUV420P, 0, 0, 0, 0);
while(1)
{
diff --git a/utilities/compat.h b/utilities/compat.h
index 77129fc..5c86103 100644
--- a/utilities/compat.h
+++ b/utilities/compat.h
@@ -39,6 +39,7 @@
#endif
#if LIBAVUTIL_VERSION_MAJOR<51 || (LIBAVUTIL_VERSION_MAJOR==51 && LIBAVUTIL_VERSION_MINOR<42)
#define AV_PIX_FMT_RGB24 PIX_FMT_RGB24
+ #define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
#endif
#if LIBAVUTIL_VERSION_MAJOR<52
#define av_frame_alloc avcodec_alloc_frame
diff --git a/utilities/gtk/camviewer.c b/utilities/gtk/camviewer.c
index ef4f4c9..2d1b096 100644
--- a/utilities/gtk/camviewer.c
+++ b/utilities/gtk/camviewer.c
@@ -601,7 +601,7 @@ gboolean handledata(GIOChannel* iochannel, GIOCondition condition, gpointer data
if(!gotframe){return 1;}
// Scale and convert to RGB24 format
- unsigned int bufsize=avpicture_get_size(PIX_FMT_RGB24, scalewidth, scaleheight);
+ unsigned int bufsize=avpicture_get_size(AV_PIX_FMT_RGB24, scalewidth, scaleheight);
unsigned char* buf=malloc(bufsize);
cam->dstframe->data[0]=buf;
cam->dstframe->linesize[0]=scalewidth*3;
diff --git a/utilities/gtk/media.c b/utilities/gtk/media.c
index 0b487c9..948c622 100644
--- a/utilities/gtk/media.c
+++ b/utilities/gtk/media.c
@@ -197,12 +197,12 @@ GIOChannel* camthread(const char* name, AVCodec* vencoder, unsigned int delay)
ctx->width=320;
ctx->height=240;
cam_resolution(cam, (unsigned int*)&ctx->width, (unsigned int*)&ctx->height);
- ctx->pix_fmt=PIX_FMT_YUV420P;
+ ctx->pix_fmt=AV_PIX_FMT_YUV420P;
ctx->time_base.num=1;
ctx->time_base.den=10;
avcodec_open2(ctx, vencoder, 0);
AVFrame* frame=av_frame_alloc();
- frame->format=PIX_FMT_RGB24;
+ frame->format=AV_PIX_FMT_RGB24;
frame->width=ctx->width;
frame->height=ctx->height;
av_image_alloc(frame->data, frame->linesize, ctx->width, ctx->height, frame->format, 1);
@@ -220,7 +220,7 @@ GIOChannel* camthread(const char* name, AVCodec* vencoder, unsigned int delay)
dstframe->height=ctx->height;
av_image_alloc(dstframe->data, dstframe->linesize, ctx->width, ctx->height, ctx->pix_fmt, 1);
- struct SwsContext* swsctx=sws_getContext(frame->width, frame->height, PIX_FMT_RGB24, frame->width, frame->height, AV_PIX_FMT_YUV420P, 0, 0, 0, 0);
+ struct SwsContext* swsctx=sws_getContext(frame->width, frame->height, AV_PIX_FMT_RGB24, frame->width, frame->height, AV_PIX_FMT_YUV420P, 0, 0, 0, 0);
while(1)
{