ff_compatibility

Torsten Jager <[email protected]> Thu, 11 Apr 2013 16:51:51 +0200
Newsgroups gmane.comp.video.xine.devel
Message-ID <[email protected]>
Hello!

Maybe this helps with some recent ff versions.

[av_rebuild_codec_lists.diff]
ff decoder: rebuild codec lists after ff update

[av_codec_id.diff]
ff decoder: use AV_CODEC_ID_* where available

[av_pix_fmt.diff]
ff video decoder: use AV_PIX_FMT_* where available

[av_sub_id.diff]
ff video decoder: made use of AVCodecContext.sub_id conditional

PS: I am using Thunderbird now. Please report any mail
     delivery problems.

PS2: What happened to my previous patches??

Torsten

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

_______________________________________________
xine-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-devel
av_rebuild_codec_lists.diff (text/x-patch, 1 KB)
--- xine-lib-1.2-20130318/src/combined/ffmpeg/Makefile.am	2013-03-18 13:25:00.000000000 +0100
+++ xine-lib-1.2-20130318/src/combined/ffmpeg/Makefile.am	2013-04-10 19:19:21.000000000 +0200
@@ -33,11 +33,16 @@ xineplug_decode_ff_la_LDFLAGS = $(AM_LDF
 
 AV_CPP = $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AVUTIL_CFLAGS)
 
+avhpath.txt:
+# Locate the avcodec.h file
+	$(AM_V_GEN)echo '#include "$(srcdir)/ffmpeg_decoder.h"' | $(AV_CPP) -M - |\
+	sed -e 's/ \+/\n/g;' | sed -n -e '/avcodec\.h/p;' > avhpath.txt
+
 # Extract some CODEC_ID_* from avcodec.h. Requires some sed mangling.
 avcodec_audio.list: AV_CODECS:=/CODEC_ID_PCM_S16LE/,/CODEC_ID_DVD_SUBTITLE/
 avcodec_video.list: AV_CODECS:=/CODEC_ID_MPEG1VIDEO/,/CODEC_ID_PCM_S16LE/
 
-avcodec_audio.list avcodec_video.list:
+avcodec_audio.list avcodec_video.list: avhpath.txt $(shell cat avhpath.txt)
 	$(AM_V_GEN)echo '#include "$(srcdir)/ffmpeg_decoder.h"' | $(AV_CPP) - |\
 	  sed -e $(AV_CODECS)'! d; s/^[ \t]*//; s/[=,].*//; /^$$/ d' >$@
av_codec_id.diff (text/x-patch, 1.4 KB)
--- xine-lib-1.2-20130318/src/combined/ffmpeg/ffmpeg_decoder.h	2013-03-18 13:25:00.000000000 +0100
+++ xine-lib-1.2-20130318/src/combined/ffmpeg/ffmpeg_decoder.h	2013-04-10 21:32:25.000000000 +0200
@@ -33,7 +33,11 @@
 
 typedef struct ff_codec_s {
   uint32_t          type;
+#if defined LIBAVCODEC_VERSION_INT && LIBAVCODEC_VERSION_INT >= ((54<<16)|(25<<8))
+  enum AVCodecID    id;
+#else
   enum CodecID      id;
+#endif
   const char       *name;
 } ff_codec_t;
 
--- xine-lib-1.2-20130318/src/combined/ffmpeg/mkcodeclist.pl	2013-03-18 13:25:00.000000000 +0100
+++ xine-lib-1.2-20130318/src/combined/ffmpeg/mkcodeclist.pl	2013-04-10 19:58:45.000000000 +0200
@@ -13,9 +13,13 @@ my $line;
 my %codecs;
 open LIST, "< $ffmpeg" or die $!;
 $line = <LIST>;
+my $ff_prefix = 'CODEC_ID_';
+if (substr ($line, 0, 12) eq 'AV_CODEC_ID_') {
+  $ff_prefix = 'AV_CODEC_ID_';
+}
 while (defined $line) {
   chomp $line;
-  $line =~ s/^CODEC_ID_//o;
+  $line =~ s/^$ff_prefix//o;
   $codecs{$line} = 0;
   $line = <LIST>;
 }
@@ -68,7 +72,7 @@ if ($w) {
   foreach $line (@known) {
     next if $line->[0] eq '!';
     next unless defined $codecs{$line->[1]};
-    print LIST "  { BUF_${Type}_$line->[0], CODEC_ID_$line->[1], \"$line->[2] (ffmpeg)\" },\n" or die $!;
+    print LIST "  { BUF_${Type}_$line->[0], $ff_prefix$line->[1], \"$line->[2] (ffmpeg)\" },\n" or die $!;
   }
   print LIST "};\n\nstatic uint32_t supported_${type}_types[] = {\n" or die $!;
   foreach $line (@known) {
av_pix_fmt.diff (text/x-patch, 1.2 KB)
--- xine-lib-1.2-20130318/src/combined/ffmpeg/ffmpeg_compat.h	2013-03-18 13:25:00.000000000 +0100
+++ xine-lib-1.2-20130318/src/combined/ffmpeg/ffmpeg_compat.h	2013-04-10 23:25:02.000000000 +0200
@@ -116,4 +116,25 @@
 #  define AVPALETTE 2
 #endif
 
+#if defined LIBAVUTIL_VERSION_MAJOR && LIBAVUTIL_VERSION_MAJOR >= 52
+#  define PIX_FMT_NONE      AV_PIX_FMT_NONE
+#  define PIX_FMT_YUV420P   AV_PIX_FMT_YUV420P
+#  define PIX_FMT_YUVJ420P  AV_PIX_FMT_YUVJ420P
+#  define PIX_FMT_YUV444P   AV_PIX_FMT_YUV444P
+#  define PIX_FMT_YUVJ444P  AV_PIX_FMT_YUVJ444P
+#  define PIX_FMT_YUV410P   AV_PIX_FMT_YUV410P
+#  define PIX_FMT_YUV411P   AV_PIX_FMT_YUV411P
+#  define PIX_FMT_VAAPI_VLD AV_PIX_FMT_VAAPI_VLD
+#  define PIX_FMT_ARGB      AV_PIX_FMT_ARGB
+#  define PIX_FMT_BGRA      AV_PIX_FMT_BGRA
+#  define PIX_FMT_RGB24     AV_PIX_FMT_RGB24
+#  define PIX_FMT_BGR24     AV_PIX_FMT_BGR24
+#  define PIX_FMT_RGB555BE  AV_PIX_FMT_RGB555BE
+#  define PIX_FMT_RGB555LE  AV_PIX_FMT_RGB555LE
+#  define PIX_FMT_RGB565BE  AV_PIX_FMT_RGB565BE
+#  define PIX_FMT_RGB565LE  AV_PIX_FMT_RGB565LE
+#  define PIX_FMT_PAL8      AV_PIX_FMT_PAL8
+#  define PixelFormat       AVPixelFormat
+#endif
+
 #endif /* XINE_AVCODEC_COMPAT_H */
av_sub_id.diff (text/x-patch, 1.1 KB)
--- xine-lib-1.2-20130318/src/combined/ffmpeg/ffmpeg_compat.h	2013-03-18 13:25:00.000000000 +0100
+++ xine-lib-1.2-20130318/src/combined/ffmpeg/ffmpeg_compat.h	2013-04-11 14:00:47.000000000 +0200
@@ -53,6 +53,11 @@
 # define AVCODEC_HAS_COLORSPACE
 #endif
 
+/* "unused" as of v54 */
+#if LIBAVCODEC_VERSION_MAJOR < 54
+# define AVCODEC_HAS_SUB_ID
+#endif
+
 /**/
 #if LIBAVCODEC_VERSION_MAJOR > 53 || (LIBAVCODEC_VERSION_MAJOR == 53 && LIBAVCODEC_VERSION_MINOR >= 8)
 #  define avcodec_init() do {} while(0)
--- xine-lib-1.2-20130318/src/combined/ffmpeg/ff_video_decoder.c	2013-03-18 13:25:00.000000000 +0100
+++ xine-lib-1.2-20130318/src/combined/ffmpeg/ff_video_decoder.c	2013-04-11 14:02:46.000000000 +0200
@@ -1135,9 +1164,9 @@ static void ff_handle_header_buffer (ff_
       case BUF_VIDEO_RV40:
         this->bih.biWidth  = _X_BE_16(&this->buf[12]);
         this->bih.biHeight = _X_BE_16(&this->buf[14]);
-
+#ifdef AVCODEC_HAS_SUB_ID
         this->context->sub_id = _X_BE_32(&this->buf[30]);
-
+#endif
         this->context->slice_offset = calloc(SLICE_OFFSET_SIZE, sizeof(int));
         this->slice_offset_size = SLICE_OFFSET_SIZE;