From b3e5482083d71e9913e12b038b329e36c2bbb130 Mon Sep 17 00:00:00 2001 From: Ilya Murav'jov Date: Fri, 18 Nov 2011 22:31:18 +0300 Subject: [PATCH] fix for ArchLinux: new ffmpeg hides ff_codec_bmp_tags etc --- src/mgui/ffviewer.cpp | 32 +++++++++++++++++++++++++------- 1 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/mgui/ffviewer.cpp b/src/mgui/ffviewer.cpp index 3d8e9d9..9e6d31c 100644 --- a/src/mgui/ffviewer.cpp +++ b/src/mgui/ffviewer.cpp @@ -32,7 +32,15 @@ #include // ReadAllStream() #include -///////////////////////////////////////// +// Прямой доступ к ff_codec_bmp_tags, в частности, закрыл, некий +// Anton Khirnov, см. libavformat/libavformat.v (из него генерится скрипт +// для опции --version-script= линковщика ld) +// Вообще, можно воспользоваться av_codec_get_tag(), а доступ к ff_codec_bmp_tags +// получить через ff_avi_muxer->codec_tag (самого же найти по имени "avi") или подобный объект, +// но это сейчас неактуально (никто не попадается на ошибку отсутствия кодека) => игра не стоит свеч +//#define CALC_FF_TAG + +#ifdef CALC_FF_TAG // :KLUDGE: потому что riff.h не копируют C_LINKAGE_BEGIN @@ -62,7 +70,7 @@ static uint FFCodecID2Tag(CodecID codec_id) #endif C_LINKAGE_END -///////////////////////////////////////// +#endif // CALC_FF_TAG static AVStream* VideoStream(FFData& ffv) { @@ -287,11 +295,6 @@ static bool IsFFError(int av_res) return av_res < 0; } -static unsigned char GetChar(uint tag, int bit_begin) -{ - return (tag>>bit_begin) & 0xFF; -} - static bool SetIndex(int& idx, int i, bool b) { bool res = (idx == -1) && b; @@ -300,6 +303,12 @@ static bool SetIndex(int& idx, int i, bool b) return res; } +#ifdef CALC_FF_TAG +static unsigned char GetChar(uint tag, int bit_begin) +{ + return (tag>>bit_begin) & 0xFF; +} + static std::string CodecID2Str(CodecID codec_id) { #ifdef _MSC_VER @@ -316,6 +325,15 @@ static std::string CodecID2Str(CodecID codec_id) return tag_str; } +#else // CALC_FF_TAG + +static std::string CodecID2Str(CodecID codec_id) +{ + return Int2Str(codec_id); +} + +#endif // CALC_FF_TAG + bool OpenInfo(FFData& ffi, const char* fname, FFDiagnosis& diag) { std::string& err_str = diag.errStr; -- 1.7.3.4