$ git clone http://tcclient.ion.nu/tc_client.git
commit fef9e0fe4ebec4727f0060393dacdbd19d1bd44e
Author: Alicia <...>
Date: Mon Jun 15 14:56:52 2015 +0200
tc_client-gtk and camviewer: added some compatibility macros for older libav versions.
diff --git a/ChangeLog b/ChangeLog
index 2c816c2..9c5dd2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
0.34:
tc_client-gtk: fixed windows compatibility (w32_runcmd and strndup)
+tc_client-gtk and camviewer: added some compatibility macros for older libav versions.
0.33:
Fixed the /forgive command (by name) which would previously fail unless the target was found in the first 'banlist' AMF0 packet.
Added a /version remote command to give the client name and version number, making /userinfo conform to the flash client's behaviour instead, and send the response with the two separate privacy field options 'n' and 'b'.
diff --git a/utilities/compat.h b/utilities/compat.h
index f635886..eb1503f 100644
--- a/utilities/compat.h
+++ b/utilities/compat.h
@@ -27,3 +27,27 @@ extern size_t dprintf(int fd, const char* fmt, ...);
#if GLIB_MAJOR_VERSION<2 || (GLIB_MAJOR_VERSION==2 && GLIB_MINOR_VERSION<2)
#define g_io_channel_read_chars(a,b,c,d,e) g_io_channel_read(a,b,c,d)
#endif
+#if LIBAVCODEC_VERSION_MAJOR<54 || (LIBAVCODEC_VERSION_MAJOR==54 && LIBAVCODEC_VERSION_MINOR<25)
+ #define AV_CODEC_ID_FLV1 CODEC_ID_FLV1
+ #define AV_CODEC_ID_NELLYMOSER CODEC_ID_NELLYMOSER
+#endif
+#if LIBAVUTIL_VERSION_MAJOR<51 || (LIBAVUTIL_VERSION_MAJOR==51 && LIBAVUTIL_VERSION_MINOR<42)
+ #define AV_PIX_FMT_RGB24 PIX_FMT_RGB24
+#endif
+#if LIBAVUTIL_VERSION_MAJOR<52
+ #define av_frame_alloc avcodec_alloc_frame
+ #if LIBAVCODEC_VERSION_MAJOR<54 || (LIBAVCODEC_VERSION_MAJOR==54 && LIBAVCODEC_VERSION_MINOR<28)
+ #define av_frame_free av_free
+ #else
+ #define av_frame_free avcodec_free_frame
+ #endif
+#endif
+#if LIBAVCODEC_VERSION_MAJOR<55 || (LIBAVCODEC_VERSION_MAJOR==55 && LIBAVCODEC_VERSION_MINOR<52)
+ #define avcodec_free_context(x) \
+ { \
+ avcodec_close(*x); \
+ av_freep(&(*x)->extradata); \
+ av_freep(&(*x)->subtitle_header); \
+ av_freep(x); \
+ }
+#endif
diff --git a/utilities/gtk/media.c b/utilities/gtk/media.c
index d8b103d..52d61a0 100644
--- a/utilities/gtk/media.c
+++ b/utilities/gtk/media.c
@@ -18,6 +18,7 @@
#include <string.h>
#include <gtk/gtk.h>
#include <libavcodec/avcodec.h>
+#include "../compat.h"
#include "media.h"
struct camera* cams=0;
unsigned int camcount=0;