$ git clone http://tcclient.ion.nu/tc_client.git
commit 1be3979c09d7bf32df5b44258da0eaa54ef8af0b
Author: Alicia <...>
Date:   Wed May 4 11:46:51 2016 +0200

    tc_client-gtk and camviewer: added compatibility fallbacks for av_image_get_buffer_size() and av_packet_unref()

diff --git a/ChangeLog b/ChangeLog
index 971c9f0..2f4b0b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ 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.
+tc_client-gtk and camviewer: added compatibility fallbacks for av_image_get_buffer_size() and av_packet_unref()
 libcamera(v4l2): if we failed to read the frame, give grey instead.
 0.38:
 Handle multi-line messages.
diff --git a/utilities/camviewer/camviewer.c b/utilities/camviewer/camviewer.c
index 84c3707..e4a1040 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(AV_PIX_FMT_RGB24, cam->frame->width, cam->frame->height);
+  unsigned int bufsize=av_image_get_buffer_size(AV_PIX_FMT_RGB24, cam->frame->width, cam->frame->height, 1);
   unsigned char buf[bufsize];
   cam->dstframe->data[0]=buf;
   cam->dstframe->linesize[0]=cam->frame->width*3;
@@ -469,7 +469,7 @@ packet.size=0;
       write(campipe[1], &frameinfo, 1);
       write(campipe[1], packet.data, packet.size);
 
-      av_free_packet(&packet);
+      av_packet_unref(&packet);
     }
     sws_freeContext(swsctx);
     _exit(0);
diff --git a/utilities/compat.h b/utilities/compat.h
index 5c86103..52f25fe 100644
--- a/utilities/compat.h
+++ b/utilities/compat.h
@@ -58,3 +58,9 @@
     av_freep(x); \
   }
 #endif
+#if LIBAVCODEC_VERSION_MAJOR<54 || (LIBAVCODEC_VERSION_MAJOR==54 && LIBAVCODEC_VERSION_MINOR<6)
+  #define av_image_get_buffer_size(a,b,c,d) avpicture_get_size(a,b,c)
+#endif
+#if LIBAVCODEC_VERSION_MAJOR<55 || (LIBAVCODEC_VERSION_MAJOR==55 && LIBAVCODEC_VERSION_MINOR<16)
+  #define av_packet_unref av_free_packet
+#endif