[PATCH] xbmc: port to FFmpeg-0.8 API

Dominik 'Rathann' Mierzejewski dominik at greysector.net
Fri Sep 9 18:57:21 CEST 2011


Hi,
it seems that I forgot about xbmc. However, I have now managed to port
it to the new FFmpeg API and it builds fine. I'm not sure the patch
is 100% correct, but upstream should be able to improve upon it.

By the way, how is the unbundling effort coming along?
I can still see a ton of bundled libraries:
liba52
libdts
libdvdnav
flac
nofrendo
libsidplay/utils, resid
snesapu
StSoundLibrary
ASAP
timidity
vgmstream
libvorbis
libogg
unrar
cmyth
cximage
libupnp
libopendaap (modified)
apetaglib
libexif
libhts
libid3tag
libscrobbler
squish
sqlite

Regards,
Dominik

-- 
Fedora http://fedoraproject.org/wiki/User:Rathann
RPMFusion http://rpmfusion.org | MPlayer http://mplayerhq.hu
"Faith manages."
        -- Delenn to Lennier in Babylon 5:"Confessions and Lamentations"
-------------- next part --------------
diff -up xbmc-10.1/xbmc/cdrip/EncoderFFmpeg.cpp.ffmpeg xbmc-10.1/xbmc/cdrip/EncoderFFmpeg.cpp
--- xbmc-10.1/xbmc/cdrip/EncoderFFmpeg.cpp.ffmpeg	2011-03-05 04:33:37.000000000 +0100
+++ xbmc-10.1/xbmc/cdrip/EncoderFFmpeg.cpp	2011-09-09 16:33:20.000000000 +0200
@@ -98,7 +98,9 @@ bool CEncoderFFmpeg::Init(const char* st
   memset(&params, 0, sizeof(params));
   params.channels       = iInChannels;
   params.sample_rate    = iInRate;
+#if FF_API_PARAMETERS_CODEC_ID
   params.audio_codec_id = codec->id;
+#endif
   params.channel        = 0;
   if (m_dllAvFormat.av_set_parameters(m_Format, &params) != 0)
   {
@@ -121,7 +123,11 @@ bool CEncoderFFmpeg::Init(const char* st
   /* set the stream's parameters */
   m_CodecCtx                 = m_Stream->codec;
   m_CodecCtx->codec_id       = codec->id;
+#if LIBAVCODEC_VERSION_MAJOR < 53
   m_CodecCtx->codec_type     = CODEC_TYPE_AUDIO;
+#else
+  m_CodecCtx->codec_type     = AVMEDIA_TYPE_AUDIO;
+#endif
   m_CodecCtx->bit_rate       = m_Format->bit_rate;
   m_CodecCtx->sample_rate    = iInRate;
   m_CodecCtx->channels       = iInChannels;
diff -up xbmc-10.1/xbmc/cores/dvdplayer/Codecs/DllAvCodec.h.ffmpeg xbmc-10.1/xbmc/cores/dvdplayer/Codecs/DllAvCodec.h
--- xbmc-10.1/xbmc/cores/dvdplayer/Codecs/DllAvCodec.h.ffmpeg	2011-03-05 04:33:37.000000000 +0100
+++ xbmc-10.1/xbmc/cores/dvdplayer/Codecs/DllAvCodec.h	2011-09-09 17:28:59.000000000 +0200
@@ -48,6 +48,7 @@ extern "C" {
     #if (defined AVPACKET_IN_AVFORMAT)
       #include <libavformat/avformat.h>
     #endif
+    #include <libavutil/opt.h>
   #elif (defined HAVE_FFMPEG_AVCODEC_H)
     #include <ffmpeg/avcodec.h>
     #include <ffmpeg/crc.h>
@@ -105,7 +106,11 @@ public:
   virtual void avpicture_free(AVPicture *picture)=0;
   virtual void av_free_packet(AVPacket *pkt)=0;
   virtual int avpicture_alloc(AVPicture *picture, PixelFormat pix_fmt, int width, int height)=0;
+#if FF_API_SET_STRING_OLD
   virtual AVOption *av_set_string(void *obj, const char *name, const char *val)=0;
+#else
+  virtual const AVOption *av_set_string(void *obj, const char *name, const char *val)=0;
+#endif
   virtual enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat *fmt)=0;
   virtual int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic)=0;
   virtual void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)=0;
@@ -157,9 +162,42 @@ public:
   }
   virtual AVFrame *avcodec_alloc_frame() { return ::avcodec_alloc_frame(); }
   virtual int avpicture_fill(AVPicture *picture, uint8_t *ptr, PixelFormat pix_fmt, int width, int height) { return ::avpicture_fill(picture, ptr, pix_fmt, width, height); }
+#if FF_API_VIDEO_OLD
   virtual int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, uint8_t *buf, int buf_size) { return ::avcodec_decode_video(avctx, picture, got_picture_ptr, buf, buf_size); }
+#else
+  virtual int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, uint8_t *buf, int buf_size)
+  {
+    AVPacket avpkt;
+    av_init_packet(&avpkt);
+    avpkt.data = buf;
+    avpkt.size = buf_size;
+    return ::avcodec_decode_video2(avctx, picture, got_picture_ptr, &avpkt);
+  }
+#endif
+#if FF_API_AUDIO_OLD
   virtual int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, uint8_t *buf, int buf_size) { return ::avcodec_decode_audio2(avctx, samples, frame_size_ptr, buf, buf_size); }
+#else
+  virtual int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, uint8_t *buf, int buf_size)
+  {
+    AVPacket avpkt;
+    av_init_packet(&avpkt);
+    avpkt.data = buf;
+    avpkt.size = buf_size;
+    return ::avcodec_decode_audio3(avctx, samples, frame_size_ptr, &avpkt);
+  }
+#endif
+#if FF_API_SUBTITLE_OLD
   virtual int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const uint8_t *buf, int buf_size) { return ::avcodec_decode_subtitle(avctx, sub, got_sub_ptr, buf, buf_size); }
+#else
+  virtual int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const uint8_t *buf, int buf_size)
+  {
+    AVPacket avpkt;
+    av_init_packet(&avpkt);
+    avpkt.data = (uint8_t *)buf;
+    avpkt.size = buf_size;
+    return ::avcodec_decode_subtitle2(avctx, sub, got_sub_ptr, &avpkt);
+  }
+#endif
   virtual int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples) { return ::avcodec_encode_audio(avctx, buf, buf_size, samples); }
   virtual int avpicture_get_size(PixelFormat pix_fmt, int width, int height) { return ::avpicture_get_size(pix_fmt, width, height); }
   virtual AVCodecContext *avcodec_alloc_context() { return ::avcodec_alloc_context(); }
@@ -169,13 +207,27 @@ public:
   virtual AVCodecParserContext *av_parser_init(int codec_id) { return ::av_parser_init(codec_id); }
   virtual int av_parser_parse(AVCodecParserContext *s,AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size,
                     const uint8_t *buf, int buf_size,
+#if LIBAVCODEC_VERSION_MAJOR < 53
                     int64_t pts, int64_t dts) { return ::av_parser_parse(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts); }
+#else
+                    int64_t pts, int64_t dts) { return ::av_parser_parse2(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts, AV_NOPTS_VALUE); }
+#endif
   virtual void av_parser_close(AVCodecParserContext *s) { ::av_parser_close(s); }
 
   virtual void avpicture_free(AVPicture *picture) { ::avpicture_free(picture); }
   virtual void av_free_packet(AVPacket *pkt) { ::av_free_packet(pkt); }
   virtual int avpicture_alloc(AVPicture *picture, PixelFormat pix_fmt, int width, int height) { return ::avpicture_alloc(picture, pix_fmt, width, height); }
+#if FF_API_SET_STRING_OLD
   virtual AVOption *av_set_string(void *obj, const char *name, const char *val) { return ::av_set_string(obj, name, val); }
+#else
+  virtual const AVOption *av_set_string(void *obj, const char *name, const char *val)
+  {
+    const AVOption *o;
+    if (av_set_string3(obj, name, val, 0, &o) < 0)
+        return NULL;
+    return o;
+  }
+#endif
   virtual int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic) { return ::avcodec_default_get_buffer(s, pic); }
   virtual void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic) { ::avcodec_default_release_buffer(s, pic); }
   virtual enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat *fmt) { return ::avcodec_default_get_format(s, fmt); }
diff -up xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp.ffmpeg xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
--- xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp.ffmpeg	2011-03-05 04:33:37.000000000 +0100
+++ xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp	2011-09-09 16:36:13.000000000 +0200
@@ -98,7 +98,11 @@ bool CDVDAudioCodecFFmpeg::Open(CDVDStre
   }
 
   // set acceleration
+#if FF_API_MM_FLAGS
   m_pCodecContext->dsp_mask = FF_MM_FORCE | FF_MM_MMX | FF_MM_MMXEXT | FF_MM_SSE;
+#else
+  m_pCodecContext->dsp_mask = AV_CPU_FLAG_FORCE | AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMX2 | AV_CPU_FLAG_SSE;
+#endif
 
   if (m_dllAvCodec.avcodec_open(m_pCodecContext, pCodec) < 0)
   {
diff -up xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp.ffmpeg xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp
--- xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp.ffmpeg	2011-03-05 04:33:37.000000000 +0100
+++ xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp	2011-09-09 16:37:53.000000000 +0200
@@ -119,7 +119,9 @@ bool CDVDAudioCodecPassthroughFFmpeg::Se
   memset(&params, 0, sizeof(params));
   params.channels       = hints.channels;
   params.sample_rate    = hints.samplerate;
+#if FF_API_PARAMETERS_CODEC_ID
   params.audio_codec_id = hints.codec;
+#endif
   params.channel        = 0;
   if (m_dllAvFormat.av_set_parameters(muxer.m_pFormat, &params) != 0)
   {
@@ -146,7 +148,11 @@ bool CDVDAudioCodecPassthroughFFmpeg::Se
     m_SampleRate = 48000;
 
   AVCodecContext *codec = muxer.m_pStream->codec;
+#if LIBAVCODEC_VERSION_MAJOR < 53
   codec->codec_type     = CODEC_TYPE_AUDIO;
+#else
+  codec->codec_type     = AVMEDIA_TYPE_AUDIO;
+#endif
   codec->codec_id       = hints.codec;
   codec->sample_rate    = m_SampleRate;
   codec->sample_fmt     = SAMPLE_FMT_S16;
diff -up xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp.ffmpeg xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
--- xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp.ffmpeg	2011-03-05 04:33:37.000000000 +0100
+++ xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp	2011-09-09 16:41:29.000000000 +0200
@@ -53,7 +53,11 @@ bool CDVDOverlayCodecFFmpeg::Open(CDVDSt
   m_pCodecContext->debug_mv = 0;
   m_pCodecContext->debug = 0;
   m_pCodecContext->workaround_bugs = FF_BUG_AUTODETECT;
+#if FF_API_MM_FLAGS
   m_pCodecContext->dsp_mask = FF_MM_FORCE | FF_MM_MMX | FF_MM_MMXEXT | FF_MM_SSE;
+#else
+  m_pCodecContext->dsp_mask = AV_CPU_FLAG_FORCE | AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMX2 | AV_CPU_FLAG_SSE;
+#endif
   m_pCodecContext->sub_id = hints.identifier;
   m_pCodecContext->codec_tag = hints.codec_tag;
 
diff -up xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp.ffmpeg xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
--- xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp.ffmpeg	2011-03-05 04:33:37.000000000 +0100
+++ xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp	2011-09-09 16:45:32.000000000 +0200
@@ -182,7 +182,11 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStre
       if(pCodec->id == hints.codec
       && pCodec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
       {
+#if LIBAVCODEC_VERSION_MAJOR < 53
         if ((pCodec->id == CODEC_ID_MPEG4 || pCodec->id == CODEC_ID_XVID) && !g_advancedSettings.m_videoAllowMpeg4VDPAU)
+#else
+        if ((pCodec->id == CODEC_ID_MPEG4) && !g_advancedSettings.m_videoAllowMpeg4VDPAU)
+#endif
           continue;
 
         CLog::Log(LOGNOTICE,"CDVDVideoCodecFFmpeg::Open() Creating VDPAU(%ix%i, %d)",hints.width, hints.height, hints.codec);
@@ -325,20 +329,23 @@ void CDVDVideoCodecFFmpeg::SetDropState(
     //  2 seem to be to high.. it causes video to be ruined on following images
     if( bDrop )
     {
-      // TODO: 'hurry_up' has been deprecated in favor of the skip_* variables
-      // Use those instead.
-
+#if FF_API_HURRY_UP
       m_pCodecContext->hurry_up = 1;
-      //m_pCodecContext->skip_frame = AVDISCARD_NONREF;
-      //m_pCodecContext->skip_idct = AVDISCARD_NONREF;
-      //m_pCodecContext->skip_loop_filter = AVDISCARD_NONREF;
+#else
+      m_pCodecContext->skip_frame = AVDISCARD_NONREF;
+      m_pCodecContext->skip_idct = AVDISCARD_NONREF;
+      m_pCodecContext->skip_loop_filter = AVDISCARD_NONREF;
+#endif
     }
     else
     {
+#if FF_API_HURRY_UP
       m_pCodecContext->hurry_up = 0;
-      //m_pCodecContext->skip_frame = AVDISCARD_DEFAULT;
-      //m_pCodecContext->skip_idct = AVDISCARD_DEFAULT;
-      //m_pCodecContext->skip_loop_filter = AVDISCARD_DEFAULT;
+#else
+      m_pCodecContext->skip_frame = AVDISCARD_DEFAULT;
+      m_pCodecContext->skip_idct = AVDISCARD_DEFAULT;
+      m_pCodecContext->skip_loop_filter = AVDISCARD_DEFAULT;
+#endif
     }
   }
 }
@@ -404,7 +411,11 @@ int CDVDVideoCodecFFmpeg::Decode(BYTE* p
     return VC_ERROR;
   }
 
+#if FF_API_HURRY_UP
   if (len != iSize && !m_pCodecContext->hurry_up)
+#else
+  if (len != iSize && !(m_pCodecContext->skip_frame || m_pCodecContext->skip_idct || m_pCodecContext->skip_loop_filter))
+#endif
     CLog::Log(LOGWARNING, "%s - avcodec_decode_video didn't consume the full packet. size: %d, consumed: %d", __FUNCTION__, iSize, len);
 
   if (!iGotPicture)
diff -up xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp.ffmpeg xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
--- xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp.ffmpeg	2011-03-05 04:33:37.000000000 +0100
+++ xbmc-10.1/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp	2011-09-09 16:47:25.000000000 +0200
@@ -1164,7 +1164,11 @@ int CVDPAU::Decode(AVCodecContext *avctx
     {
       if(method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF
       || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF
+#if FF_API_HURRY_UP
       || avctx->hurry_up)
+#else
+      || avctx->skip_frame || avctx->skip_idct)
+#endif
         m_mixerstep = 0;
       else
         m_mixerstep = 1;
@@ -1184,7 +1188,11 @@ int CVDPAU::Decode(AVCodecContext *avctx
   else if(m_mixerstep == 1)
   { // no new frame given, output second field of old frame
 
+#if FF_API_HURRY_UP
     if(avctx->hurry_up)
+#else
+    if(avctx->skip_frame || avctx->skip_idct)
+#endif
     {
       ClearUsedForRender(&past[1]);
       return VC_BUFFER;
diff -up xbmc-10.1/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp.ffmpeg xbmc-10.1/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
--- xbmc-10.1/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp.ffmpeg	2011-03-05 04:33:37.000000000 +0100
+++ xbmc-10.1/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp	2011-09-09 16:55:18.000000000 +0200
@@ -726,7 +726,11 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
         if(pkt.pts == 0)
           pkt.pts = AV_NOPTS_VALUE;
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
         if(m_bMatroska && stream->codec && stream->codec->codec_type == CODEC_TYPE_VIDEO)
+#else
+        if(m_bMatroska && stream->codec && stream->codec->codec_type == AVMEDIA_TYPE_VIDEO)
+#endif
         { // matroska can store different timestamps
           // for different formats, for native stored
           // stuff it is pts, but for ms compatibility
@@ -743,7 +747,11 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
         if(m_bMatroska && stream->codec->codec_id == CODEC_ID_TEXT && pkt.convergence_duration != 0)
             pkt.duration = pkt.convergence_duration;
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
         if(m_bAVI && stream->codec && stream->codec->codec_type == CODEC_TYPE_VIDEO)
+#else
+        if(m_bAVI && stream->codec && stream->codec->codec_type == AVMEDIA_TYPE_VIDEO)
+#endif
         {
           // AVI's always have borked pts, specially if m_pFormatContext->flags includes
           // AVFMT_FLAG_GENPTS so always use dts
@@ -966,7 +974,11 @@ void CDVDDemuxFFmpeg::AddStream(int iId)
 
     switch (pStream->codec->codec_type)
     {
+#if LIBAVCODEC_VERSION_MAJOR < 53
     case CODEC_TYPE_AUDIO:
+#else
+    case AVMEDIA_TYPE_AUDIO:
+#endif
       {
         CDemuxStreamAudioFFmpeg* st = new CDemuxStreamAudioFFmpeg(this, pStream);
         m_streams[iId] = st;
@@ -981,7 +993,11 @@ void CDVDDemuxFFmpeg::AddStream(int iId)
 
         break;
       }
+#if LIBAVCODEC_VERSION_MAJOR < 53
     case CODEC_TYPE_VIDEO:
+#else
+    case AVMEDIA_TYPE_VIDEO:
+#endif
       {
         CDemuxStreamVideoFFmpeg* st = new CDemuxStreamVideoFFmpeg(this, pStream);
         m_streams[iId] = st;
@@ -1035,13 +1051,21 @@ void CDVDDemuxFFmpeg::AddStream(int iId)
         }
         break;
       }
+#if LIBAVCODEC_VERSION_MAJOR < 53
     case CODEC_TYPE_DATA:
+#else
+    case AVMEDIA_TYPE_DATA:
+#endif
       {
         m_streams[iId] = new CDemuxStream();
         m_streams[iId]->type = STREAM_DATA;
         break;
       }
+#if LIBAVCODEC_VERSION_MAJOR < 53
     case CODEC_TYPE_SUBTITLE:
+#else
+    case AVMEDIA_TYPE_SUBTITLE:
+#endif
       {
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,38,1)
         if (pStream->codec->codec_id == CODEC_ID_DVB_TELETEXT && g_guiSettings.GetBool("videoplayer.teletextenabled"))
@@ -1065,13 +1089,21 @@ void CDVDDemuxFFmpeg::AddStream(int iId)
           break;
         }
       }
+#if LIBAVCODEC_VERSION_MAJOR < 53
     case CODEC_TYPE_ATTACHMENT:
+#else
+    case AVMEDIA_TYPE_ATTACHMENT:
+#endif
       { //mkv attachments. Only bothering with fonts for now.
         if(pStream->codec->codec_id == CODEC_ID_TTF)
         {
           std::string fileName = "special://temp/fonts/";
           XFILE::CDirectory::Create(fileName);
+#if FF_API_OLD_METADATA
           fileName += pStream->filename;
+#else
+          fileName += av_metadata_get(pStream->metadata,"filename",NULL,0)->value;
+#endif
           XFILE::CFile file;
           if(pStream->codec->extradata && file.OpenForWrite(fileName))
           {
@@ -1110,7 +1142,11 @@ void CDVDDemuxFFmpeg::AddStream(int iId)
     m_streams[iId]->pPrivate = pStream;
     m_streams[iId]->flags = (CDemuxStream::EFlags)pStream->disposition;
 
+#if FF_API_OLD_METADATA
     strcpy( m_streams[iId]->language, pStream->language );
+#else
+    strcpy( m_streams[iId]->language, av_metadata_get(pStream->metadata,"filename",NULL,0)->value );
+#endif
 
     if( pStream->codec->extradata && pStream->codec->extradata_size > 0 )
     {
diff -up xbmc-10.1/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h.ffmpeg xbmc-10.1/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h
--- xbmc-10.1/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h.ffmpeg	2011-03-05 04:33:37.000000000 +0100
+++ xbmc-10.1/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h	2011-09-07 20:14:30.000000000 +0200
@@ -123,7 +123,9 @@ protected:
   void UpdateCurrentPTS();
 
   CRITICAL_SECTION m_critSection;
-  // #define MAX_STREAMS 42 // from avformat.h
+#if !FF_API_MAX_STREAMS
+#define MAX_STREAMS 42 // from avformat.h
+#endif
   CDemuxStream* m_streams[MAX_STREAMS]; // maximum number of streams that ffmpeg can handle
 
   ByteIOContext* m_ioContext;
diff -up xbmc-10.1/xbmc/cores/dvdplayer/DVDFileInfo.cpp.ffmpeg xbmc-10.1/xbmc/cores/dvdplayer/DVDFileInfo.cpp
--- xbmc-10.1/xbmc/cores/dvdplayer/DVDFileInfo.cpp.ffmpeg	2011-03-05 04:33:37.000000000 +0100
+++ xbmc-10.1/xbmc/cores/dvdplayer/DVDFileInfo.cpp	2011-09-09 16:27:29.000000000 +0200
@@ -308,6 +308,7 @@ void CDVDFileInfo::GetFileMetaData(const
     pItem->SetProperty("duration-msec", strDuration);
     strDuration.Format("%02d:%02d:%02d", nHours, nMinutes, nSec);
     pItem->SetProperty("duration-str", strDuration);
+#if FF_API_OLD_METADATA
     pItem->SetProperty("title", pContext->title);
     pItem->SetProperty("author", pContext->author);
     pItem->SetProperty("copyright", pContext->copyright);
@@ -318,6 +319,18 @@ void CDVDFileInfo::GetFileMetaData(const
     strDuration.Format("%d", pContext->track);
     pItem->SetProperty("track", strDuration);
     pItem->SetProperty("genre", pContext->genre);
+#else
+    pItem->SetProperty("title",     av_metadata_get(pContext->streams[0]->metadata,"title",NULL,0)->value);
+    pItem->SetProperty("author",    av_metadata_get(pContext->streams[0]->metadata,"author",NULL,0)->value);
+    pItem->SetProperty("copyright", av_metadata_get(pContext->streams[0]->metadata,"copyright",NULL,0)->value);
+    pItem->SetProperty("comment",   av_metadata_get(pContext->streams[0]->metadata,"comment",NULL,0)->value);
+    pItem->SetProperty("album",     av_metadata_get(pContext->streams[0]->metadata,"album",NULL,0)->value);
+    strDuration.Format("%d",        av_metadata_get(pContext->streams[0]->metadata,"year",NULL,0)->value);
+    pItem->SetProperty("year", strDuration);
+    strDuration.Format("%d",        av_metadata_get(pContext->streams[0]->metadata,"track",NULL,0)->value);
+    pItem->SetProperty("track", strDuration);
+    pItem->SetProperty("genre",     av_metadata_get(pContext->streams[0]->metadata,"genre",NULL,0)->value);
+#endif
   }
 
   delete pDemuxer;


More information about the rpmfusion-developers mailing list