diff options
author | Joakim Plate <elupus@ecce.se> | 2013-06-26 22:11:09 +0200 |
---|---|---|
committer | Joakim Plate <elupus@ecce.se> | 2013-08-01 16:59:05 +0200 |
commit | 48b9b96d35f7da9f4a565d88162d08bdbab96a99 (patch) | |
tree | ba87fdb2fb105ba441c9d2d8cf990f0a50e3d9d0 | |
parent | 4eb82f66384cb20165a156dfdd8244fb65f8c906 (diff) |
dvdplayer: look for stereo_mode metadata in frames to update stereo mode
-rw-r--r-- | lib/DllAvCodec.h | 4 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 1 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 7 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 4 |
4 files changed, 16 insertions, 0 deletions
diff --git a/lib/DllAvCodec.h b/lib/DllAvCodec.h index a71f9cfac3..d1360608c1 100644 --- a/lib/DllAvCodec.h +++ b/lib/DllAvCodec.h @@ -98,6 +98,7 @@ public: virtual int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, enum AVSampleFormat sample_fmt, const uint8_t *buf, int buf_size, int align) = 0; virtual void avcodec_free_frame(AVFrame **frame)=0; virtual int av_codec_is_decoder(const AVCodec *codec)=0; + virtual AVDictionary* av_frame_get_metadata(const AVFrame* frame)=0; }; #if (defined USE_EXTERNAL_FFMPEG) || (defined TARGET_DARWIN) @@ -167,6 +168,7 @@ public: virtual int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, enum AVSampleFormat sample_fmt, const uint8_t *buf, int buf_size, int align) { return ::avcodec_fill_audio_frame(frame, nb_channels, sample_fmt, buf, buf_size, align); } virtual void avcodec_free_frame(AVFrame **frame) { return ::avcodec_free_frame(frame); }; virtual int av_codec_is_decoder(const AVCodec *codec) { return ::av_codec_is_decoder(codec); } + virtual AVDictionary* av_frame_get_metadata(const AVFrame* frame) { return ::av_frame_get_metadata(frame); } // DLL faking. virtual bool ResolveExports() { return true; } @@ -217,6 +219,7 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface DEFINE_METHOD1(void, avcodec_free_frame, (AVFrame **p1)) DEFINE_METHOD1(AVCodec*, av_codec_next, (AVCodec *p1)) DEFINE_METHOD1(int, av_codec_is_decoder, (const AVCodec *p1)) + DEFINE_METHOD1(AVDictionary*, av_frame_get_metadata, (const AVFrame* p1)) BEGIN_METHOD_RESOLVE() RESOLVE_METHOD(avcodec_flush_buffers) @@ -251,6 +254,7 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface RESOLVE_METHOD(avcodec_fill_audio_frame) RESOLVE_METHOD(avcodec_free_frame) RESOLVE_METHOD(av_codec_is_decoder) + RESOLVE_METHOD(av_frame_get_metadata) END_METHOD_RESOLVE() /* dependencies of libavcodec */ diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h index c29204c386..8fc76b7246 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h @@ -89,6 +89,7 @@ struct DVDVideoPicture unsigned int color_primaries; unsigned int color_transfer; unsigned int extended_format; + char stereo_mode[32]; int8_t* qscale_table; // Quantization parameters, primarily used by filters int qscale_stride; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp index 4040f38493..5820dfebeb 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -605,6 +605,13 @@ bool CDVDVideoCodecFFmpeg::GetPictureCommon(DVDVideoPicture* pDvdVideoPicture) if (!m_pFrame) return false; + AVDictionaryEntry * entry = m_dllAvUtil.av_dict_get(m_dllAvCodec.av_frame_get_metadata(m_pFrame), "stereo_mode", NULL, 0); + if(entry && entry->value) + { + strncpy(pDvdVideoPicture->stereo_mode, (const char*)entry->value, sizeof(pDvdVideoPicture->stereo_mode)); + pDvdVideoPicture->stereo_mode[sizeof(pDvdVideoPicture->stereo_mode)-1] = '\0'; + } + pDvdVideoPicture->iRepeatPicture = 0.5 * m_pFrame->repeat_pict; pDvdVideoPicture->iFlags = DVP_FLAG_ALLOCATED; pDvdVideoPicture->iFlags |= m_pFrame->interlaced_frame ? DVP_FLAG_INTERLACED : 0; diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp index 54e5aca729..51caa05b2e 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -1022,6 +1022,10 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts) DVDVideoPicture picture(*src); DVDVideoPicture* pPicture = &picture; + /* grab stereo mode from image if available */ + if(src->stereo_mode[0]) + m_hints.stereo_mode = src->stereo_mode; + /* figure out steremode expected based on user settings and hints */ unsigned int stereo_flags = GetStereoModeFlags(GetStereoMode()); |