$OpenBSD: patch-src_plugins_avcodec_avcodec_compat_h,v 1.1 2014/04/06 20:13:11 brad Exp $

Deal with newer FFmpeg API.

--- src/plugins/avcodec/avcodec_compat.h.orig	Thu Mar 27 01:42:51 2014
+++ src/plugins/avcodec/avcodec_compat.h	Thu Mar 27 01:46:20 2014
@@ -21,47 +21,16 @@
 # include "avcodec.h"
 #endif
 
-/* Map avcodec_decode_audio2 into the deprecated version
- * avcodec_decode_audio in versions earlier than 51.28 */
-#if LIBAVCODEC_VERSION_INT < 0x331c00
-# define avcodec_decode_audio2 avcodec_decode_audio
+/* Map avcodec_free_frame to av_freep if the former doesn't exist.
+ * (This is in versions earlier than 54.28.0 (libav) or 54.59.100 (ffmpeg)) */
+#if ! HAVE_AVCODEC_FREE_FRAME
+# define avcodec_free_frame av_freep
 #endif
 
-/* Handle API change that happened in libavcodec 52.00 */
-#if LIBAVCODEC_VERSION_INT < 0x340000
-# define CONTEXT_BPS(codecctx) (codecctx)->bits_per_sample
-#else
-# define CONTEXT_BPS(codecctx) (codecctx)->bits_per_coded_sample
+/* Map av_frame_alloc, av_frame_unref, av_frame_free into their
+ * deprecated versions in versions earlier than 55.28.1 */
+#if LIBAVCODEC_VERSION_INT < 0x371c01
+# define av_frame_alloc avcodec_alloc_frame
+# define av_frame_unref avcodec_get_frame_defaults
+# define av_frame_free avcodec_free_frame
 #endif
-
-/* Before 52.23 AVPacket was defined in avformat.h which we
- * do not want to depend on, so we define part of it manually
- * on versions smaller than 52.23 (this makes me cry) */
-#if LIBAVCODEC_VERSION_INT < 0x341700
-typedef struct AVPacket {
-        uint8_t *data;
-        int size;
-} AVPacket;
-#endif
-
-/* Same thing as above for av_init_packet and version 52.25 */
-#if LIBAVCODEC_VERSION_INT < 0x341900
-# define av_init_packet(pkt) do { \
-    (pkt)->data = NULL; \
-    (pkt)->size = 0; \
-  } while(0)
-#endif
-
-/* Map avcodec_decode_audio3 into the deprecated version
- * avcodec_decode_audio2 in versions earlier than 52.26 */
-#if LIBAVCODEC_VERSION_INT < 0x341a00
-# define avcodec_decode_audio3(avctx, samples, frame_size_ptr, avpkt) \
-    avcodec_decode_audio2(avctx, samples, frame_size_ptr, \
-                          (avpkt)->data, (avpkt)->size)
-#endif
-
-/* Handle API change that happened in libavcodec 52.64 */
-#if LIBAVCODEC_VERSION_INT < 0x344000
-# define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
-#endif
-
