void-packages/srcpkgs/xbmc/patches/130_all_av_metadata.patch

180 lines
9.7 KiB
Diff
Raw Normal View History

commit 2528bd0db7331f98167c7e18dafddb568840c471
Author: Alexis Ballier <aballier@gentoo.org>
Date: Thu Mar 1 10:48:46 2012 -0300
Replace av_metadata_(get/set2) by av_dict_(get/set).
The former is deprecated and gone in ffmpeg git.
diff --git a/lib/DllAvFormat.h b/lib/DllAvFormat.h
index 0671fee..4f9a60d 100644
--- a/lib/DllAvFormat.h
+++ b/lib/DllAvFormat.h
@@ -63,7 +63,6 @@ public:
virtual void av_register_all_dont_call(void)=0;
virtual AVInputFormat *av_find_input_format(const char *short_name)=0;
virtual int url_feof(AVIOContext *s)=0;
- virtual AVDictionaryEntry *av_metadata_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)=0;
virtual void av_close_input_file(AVFormatContext *s)=0;
virtual void av_close_input_stream(AVFormatContext *s)=0;
virtual int av_read_frame(AVFormatContext *s, AVPacket *pkt)=0;
@@ -105,7 +104,6 @@ public:
virtual int avformat_write_header (AVFormatContext *s, AVDictionary **options)=0;
virtual int av_write_trailer(AVFormatContext *s)=0;
virtual int av_write_frame (AVFormatContext *s, AVPacket *pkt)=0;
- virtual int av_metadata_set2(AVDictionary **pm, const char *key, const char *value, int flags)=0;
};
#if (defined USE_EXTERNAL_FFMPEG)
@@ -123,7 +121,6 @@ public:
virtual void av_register_all_dont_call() { *(int* )0x0 = 0; }
virtual AVInputFormat *av_find_input_format(const char *short_name) { return ::av_find_input_format(short_name); }
virtual int url_feof(AVIOContext *s) { return ::url_feof(s); }
- virtual AVDictionaryEntry *av_metadata_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags){ return ::av_metadata_get(m, key, prev, flags); }
virtual void av_close_input_file(AVFormatContext *s) { ::av_close_input_file(s); }
virtual void av_close_input_stream(AVFormatContext *s) { ::av_close_input_stream(s); }
virtual int av_read_frame(AVFormatContext *s, AVPacket *pkt) { return ::av_read_frame(s, pkt); }
@@ -168,7 +165,6 @@ public:
virtual int avformat_write_header (AVFormatContext *s, AVDictionary **options) { return ::avformat_write_header (s, options); }
virtual int av_write_trailer(AVFormatContext *s) { return ::av_write_trailer(s); }
virtual int av_write_frame (AVFormatContext *s, AVPacket *pkt) { return ::av_write_frame(s, pkt); }
- virtual int av_metadata_set2(AVDictionary **pm, const char *key, const char *value, int flags) { return ::av_metadata_set2(pm, key, value, flags); }
// DLL faking.
virtual bool ResolveExports() { return true; }
@@ -190,7 +186,6 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface
DEFINE_METHOD0(void, av_register_all_dont_call)
DEFINE_METHOD1(AVInputFormat*, av_find_input_format, (const char *p1))
DEFINE_METHOD1(int, url_feof, (AVIOContext *p1))
- DEFINE_METHOD4(AVDictionaryEntry*, av_metadata_get, (AVDictionary *p1, const char *p2, const AVDictionaryEntry *p3, int p4))
DEFINE_METHOD1(void, av_close_input_file, (AVFormatContext *p1))
DEFINE_METHOD1(void, av_close_input_stream, (AVFormatContext *p1))
DEFINE_METHOD1(int, av_read_play, (AVFormatContext *p1))
@@ -230,12 +225,10 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface
DEFINE_METHOD2(int, avformat_write_header , (AVFormatContext *p1, AVDictionary **p2))
DEFINE_METHOD1(int, av_write_trailer, (AVFormatContext *p1))
DEFINE_METHOD2(int, av_write_frame , (AVFormatContext *p1, AVPacket *p2))
- DEFINE_METHOD4(int, av_metadata_set2, (AVDictionary **p1, const char *p2, const char *p3, int p4));
BEGIN_METHOD_RESOLVE()
RESOLVE_METHOD_RENAME(av_register_all, av_register_all_dont_call)
RESOLVE_METHOD(av_find_input_format)
RESOLVE_METHOD(url_feof)
- RESOLVE_METHOD(av_metadata_get)
RESOLVE_METHOD(av_close_input_file)
RESOLVE_METHOD(av_close_input_stream)
RESOLVE_METHOD(av_read_frame)
@@ -269,7 +262,6 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface
RESOLVE_METHOD(avformat_write_header)
RESOLVE_METHOD(av_write_trailer)
RESOLVE_METHOD(av_write_frame)
- RESOLVE_METHOD(av_metadata_set2)
END_METHOD_RESOLVE()
/* dependencies of libavformat */
diff --git a/lib/DllAvUtil.h b/lib/DllAvUtil.h
index f907834..0a293f9 100644
--- a/lib/DllAvUtil.h
+++ b/lib/DllAvUtil.h
@@ -99,6 +99,8 @@ public:
virtual int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)) = 0;
virtual char *av_strdup(const char *s)=0;
virtual int av_get_bits_per_sample_fmt(enum AVSampleFormat p1) = 0;
+ virtual AVDictionaryEntry *av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags) = 0;
+ virtual int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)=0;
};
#if (defined USE_EXTERNAL_FFMPEG)
@@ -136,6 +138,8 @@ public:
virtual char *av_strdup(const char *s) { return ::av_strdup(s); }
virtual int av_get_bits_per_sample_fmt(enum AVSampleFormat p1)
{ return ::av_get_bits_per_sample_fmt(p1); }
+ virtual AVDictionaryEntry *av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags){ return ::av_dict_get(m, key, prev, flags); }
+ virtual int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags) { return ::av_dict_set(pm, key, value, flags); }
// DLL faking.
virtual bool ResolveExports() { return true; }
@@ -173,6 +177,8 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface
DEFINE_METHOD4(int, av_fifo_generic_write, (AVFifoBuffer *p1, void *p2, int p3, int (*p4)(void*, void*, int)))
DEFINE_METHOD1(char*, av_strdup, (const char *p1))
DEFINE_METHOD1(int, av_get_bits_per_sample_fmt, (enum AVSampleFormat p1))
+ DEFINE_METHOD4(AVDictionaryEntry *, av_dict_get, (AVDictionary *p1, const char *p2, const AVDictionaryEntry *p3, int p4))
+ DEFINE_METHOD4(int, av_dict_set, (AVDictionary **p1, const char *p2, const char *p3, int p4));
public:
BEGIN_METHOD_RESOLVE()
@@ -195,6 +201,8 @@ class DllAvUtilBase : public DllDynamic, DllAvUtilInterface
RESOLVE_METHOD(av_fifo_generic_write)
RESOLVE_METHOD(av_strdup)
RESOLVE_METHOD(av_get_bits_per_sample_fmt)
+ RESOLVE_METHOD(av_dict_get)
+ RESOLVE_METHOD(av_dict_set)
END_METHOD_RESOLVE()
};
diff --git a/xbmc/cdrip/EncoderFFmpeg.cpp b/xbmc/cdrip/EncoderFFmpeg.cpp
index 7959919..b67b231 100644
--- a/xbmc/cdrip/EncoderFFmpeg.cpp
+++ b/xbmc/cdrip/EncoderFFmpeg.cpp
@@ -181,7 +181,7 @@ bool CEncoderFFmpeg::Init(const char* strFile, int iInChannels, int iInRate, int
void CEncoderFFmpeg::SetTag(const CStdString tag, const CStdString value)
{
- m_dllAvFormat.av_metadata_set2(&m_Format->metadata, tag.c_str(), value.c_str(), 0);
+ m_dllAvUtil.av_dict_set(&m_Format->metadata, tag.c_str(), value.c_str(), 0);
}
int CEncoderFFmpeg::MuxerReadPacket(void *opaque, uint8_t *buf, int buf_size)
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index aff44f6..991491c 100644
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -959,8 +959,8 @@ void CDVDDemuxFFmpeg::AddStream(int iId)
st->iBitRate = pStream->codec->bit_rate;
st->iBitsPerSample = pStream->codec->bits_per_coded_sample;
- if(m_dllAvFormat.av_metadata_get(pStream->metadata, "title", NULL, 0))
- st->m_description = m_dllAvFormat.av_metadata_get(pStream->metadata, "title", NULL, 0)->value;
+ if(m_dllAvUtil.av_dict_get(pStream->metadata, "title", NULL, 0))
+ st->m_description = m_dllAvUtil.av_dict_get(pStream->metadata, "title", NULL, 0)->value;
break;
}
@@ -1049,8 +1049,8 @@ void CDVDDemuxFFmpeg::AddStream(int iId)
if(pStream->codec)
st->identifier = pStream->codec->sub_id;
- if(m_dllAvFormat.av_metadata_get(pStream->metadata, "title", NULL, 0))
- st->m_description = m_dllAvFormat.av_metadata_get(pStream->metadata, "title", NULL, 0)->value;
+ if(m_dllAvUtil.av_dict_get(pStream->metadata, "title", NULL, 0))
+ st->m_description = m_dllAvUtil.av_dict_get(pStream->metadata, "title", NULL, 0)->value;
break;
}
@@ -1061,7 +1061,7 @@ void CDVDDemuxFFmpeg::AddStream(int iId)
{
std::string fileName = "special://temp/fonts/";
XFILE::CDirectory::Create(fileName);
- AVDictionaryEntry *nameTag = m_dllAvFormat.av_metadata_get(pStream->metadata, "filename", NULL, 0);
+ AVDictionaryEntry *nameTag = m_dllAvUtil.av_dict_get(pStream->metadata, "filename", NULL, 0);
if (!nameTag) {
CLog::Log(LOGERROR, "%s: TTF attachment has no name", __FUNCTION__);
break;
@@ -1110,7 +1110,7 @@ void CDVDDemuxFFmpeg::AddStream(int iId)
// API added on: 2010-10-15
// (Note that while the function was available earlier, the generic
// metadata tags were not populated by default)
- AVDictionaryEntry *langTag = m_dllAvFormat.av_metadata_get(pStream->metadata, "language", NULL, 0);
+ AVDictionaryEntry *langTag = m_dllAvUtil.av_dict_get(pStream->metadata, "language", NULL, 0);
if (langTag)
strncpy(m_streams[iId]->language, langTag->value, 3);
#else
@@ -1220,7 +1220,7 @@ void CDVDDemuxFFmpeg::GetChapterName(std::string& strChapterName)
// API added on: 2010-10-15
// (Note that while the function was available earlier, the generic
// metadata tags were not populated by default)
- AVDictionaryEntry *titleTag = m_dllAvFormat.av_metadata_get(m_pFormatContext->chapters[chapterIdx-1]->metadata,
+ AVDictionaryEntry *titleTag = m_dllAvUtil.av_dict_get(m_pFormatContext->chapters[chapterIdx-1]->metadata,
"title", NULL, 0);
if (titleTag)
strChapterName = titleTag->value;