hrev47475 adds 3 changesets to branch 'master' old head: cb5ed9c7555ac159127a726f68023b8dd72e47de new head: d65388e7fa1d82e5c7ed66c250d5f3e06bd95543 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=d65388e+%5Ecb5ed9c ---------------------------------------------------------------------------- 366ee54: DVB media addon: Fix debug build. - Compiling dvb.media_addon with DEBUG on fails with error message: generated/objects/haiku/x86/debug_1/add-ons/media/media-add-ons/dvb/ MediaFormat.o: In function `av_log2_c': /boot/home/Development/haiku-a4/ generated/build_packages/ffmpeg-0.10.2-r1a4-x86-gcc2-2012-08-30/common/ include/libavutil/common.h:80: undefined reference to `ff_log2_tab' collect2: ld returned 1 exit status" - Research done to narrow down the solution space: - ff_log2_tab is a array that is nowhere needed in the dvb.media_addon - ff_log2_tab is defined as an extern array in the ffmpeg header file libavutil/common.h - ff_log2_tab is used in the inline function av_log2_c (libavutil/common.h) which doesn't get optimized away when compiling with debug information - MediaFormat.cpp needs only some Codec-IDs from the ffmpeg header file avcodec.h - The following fixes were tried: - Trying to eliminate unused debug symbols with compilation flag -feliminate-unused-debug-types (see gcc documentation http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Debugging-Options.html#Debugging-Options) by adding the following lines to UserBuildConfig AppendToConfigVar C++FLAGS : HAIKU_TOP src : -feliminate-unused-debug-types : global ; AppendToConfigVar CCFLAGS : HAIKU_TOP src : -feliminate-unused-debug-types : global ; -> Failed, because flag -feliminate-unused-debug-types is not supported by GCC 2.95.3 - Trying to eliminate unused debug symbols in the linker stage -> This worked, by removing the LINKFLAG "-Xlinker --no-undefined" when linking all objects into the dvb.media_addon we are getting our addon with debug symbols. - Final solution: - Instead of adding/removing flags, we just add the missing implementation for the ff_log2_tab array in MediaFormat.cpp. This -feels- the seems to be the cleanest solution as it is more obvious what's goin' on compared to hiding the solution in the Jamfile. Signed-off-by: Colin Günther <coling@xxxxxx> 50b586b: Media Kit: Add workaround for #11018 to MPEG2 video stream decoder test. The workaround triggers the loading of all media plugins prior to using methods of class BMediaFormats. Using the function get_next_encoder() is used because of two facts 1. It is publicly available and thus can be used by 3rd party apps, too. 2. It is already available by including BMediaFormats.h, so there is no need to include another header for this workaround. Signed-off-by: Colin Günther <coling@xxxxxx> (cherry picked from commit 80354716fe8b25c81ec45bd96ae36e171228b8a0) d65388e: Media Kit: Add workaround for #11018 to MP3 audio stream decoder test. The workaround triggers the loading of all media plugins prior to using methods of class BMediaFormats. Using the function get_next_encoder() is used because of two facts 1. It is publicly available and thus can be used by 3rd party apps, too. 2. It is already available by including BMediaFormats.h, so there is no need to include another header for this workaround. Signed-off-by: Colin Günther <coling@xxxxxx> (cherry picked from commit a89b0a4e69f18b2b3b2c2f5615450a5ddac838af) [ Colin Günther <coling@xxxxxx> ] ---------------------------------------------------------------------------- 3 files changed, 52 insertions(+), 3 deletions(-) .../media/media-add-ons/dvb/MediaFormat.cpp | 9 +++++++- .../media/mp3_decoder_test/mp3_decoder_test.cpp | 23 +++++++++++++++++++- .../mpeg2_decoder_test/mpeg2_decoder_test.cpp | 23 +++++++++++++++++++- ############################################################################ Commit: 366ee54830b3889c0bac89b034d6b3198edc6e96 URL: http://cgit.haiku-os.org/haiku/commit/?id=366ee54 Author: Colin Günther <coling@xxxxxx> Date: Mon Jul 7 14:20:39 2014 UTC DVB media addon: Fix debug build. - Compiling dvb.media_addon with DEBUG on fails with error message: generated/objects/haiku/x86/debug_1/add-ons/media/media-add-ons/dvb/ MediaFormat.o: In function `av_log2_c': /boot/home/Development/haiku-a4/ generated/build_packages/ffmpeg-0.10.2-r1a4-x86-gcc2-2012-08-30/common/ include/libavutil/common.h:80: undefined reference to `ff_log2_tab' collect2: ld returned 1 exit status" - Research done to narrow down the solution space: - ff_log2_tab is a array that is nowhere needed in the dvb.media_addon - ff_log2_tab is defined as an extern array in the ffmpeg header file libavutil/common.h - ff_log2_tab is used in the inline function av_log2_c (libavutil/common.h) which doesn't get optimized away when compiling with debug information - MediaFormat.cpp needs only some Codec-IDs from the ffmpeg header file avcodec.h - The following fixes were tried: - Trying to eliminate unused debug symbols with compilation flag -feliminate-unused-debug-types (see gcc documentation http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Debugging-Options.html#Debugging-Options) by adding the following lines to UserBuildConfig AppendToConfigVar C++FLAGS : HAIKU_TOP src : -feliminate-unused-debug-types : global ; AppendToConfigVar CCFLAGS : HAIKU_TOP src : -feliminate-unused-debug-types : global ; -> Failed, because flag -feliminate-unused-debug-types is not supported by GCC 2.95.3 - Trying to eliminate unused debug symbols in the linker stage -> This worked, by removing the LINKFLAG "-Xlinker --no-undefined" when linking all objects into the dvb.media_addon we are getting our addon with debug symbols. - Final solution: - Instead of adding/removing flags, we just add the missing implementation for the ff_log2_tab array in MediaFormat.cpp. This -feels- the seems to be the cleanest solution as it is more obvious what's goin' on compared to hiding the solution in the Jamfile. Signed-off-by: Colin Günther <coling@xxxxxx> ---------------------------------------------------------------------------- diff --git a/src/add-ons/media/media-add-ons/dvb/MediaFormat.cpp b/src/add-ons/media/media-add-ons/dvb/MediaFormat.cpp index 024af50..9b75662 100644 --- a/src/add-ons/media/media-add-ons/dvb/MediaFormat.cpp +++ b/src/add-ons/media/media-add-ons/dvb/MediaFormat.cpp @@ -30,7 +30,14 @@ #define UINT64_C(c) (c ## ULL) extern "C" { #include "avcodec.h" -} + +#ifdef DEBUG + // Needed to fix debug build, otherwise the linker complains about + // "undefined reference to `ff_log2_tab'" + const uint8_t ff_log2_tab[256] = {0}; +#endif + +} // extern "C" void PrintFormat(const media_format &format) ############################################################################ Commit: 50b586b9de53b4e0c7bb0197172bd340b9455d99 URL: http://cgit.haiku-os.org/haiku/commit/?id=50b586b Author: Colin Günther <coling@xxxxxx> Date: Wed Jul 9 16:44:50 2014 UTC Ticket: https://dev.haiku-os.org/ticket/11018 Media Kit: Add workaround for #11018 to MPEG2 video stream decoder test. The workaround triggers the loading of all media plugins prior to using methods of class BMediaFormats. Using the function get_next_encoder() is used because of two facts 1. It is publicly available and thus can be used by 3rd party apps, too. 2. It is already available by including BMediaFormats.h, so there is no need to include another header for this workaround. Signed-off-by: Colin Günther <coling@xxxxxx> (cherry picked from commit 80354716fe8b25c81ec45bd96ae36e171228b8a0) ---------------------------------------------------------------------------- diff --git a/src/tests/kits/media/mpeg2_decoder_test/mpeg2_decoder_test.cpp b/src/tests/kits/media/mpeg2_decoder_test/mpeg2_decoder_test.cpp index c943abb..8d65ad9 100644 --- a/src/tests/kits/media/mpeg2_decoder_test/mpeg2_decoder_test.cpp +++ b/src/tests/kits/media/mpeg2_decoder_test/mpeg2_decoder_test.cpp @@ -120,6 +120,27 @@ main(int argc, char* argv[]) BFile* mpeg2EncodedFile = new BFile(kTestVideoFilename, O_RDONLY); BMediaDecoder* mpeg2Decoder = new FileDecoder(mpeg2EncodedFile); + // TODO: The following code block is a workaround for the bug #11018 + // (https://dev.haiku-os.org/ticket/11018). Please remove this code block, + // once the bug is being resolved. + // The workaround triggers the loading of all media plugins prior to using + // methods of class BMediaFormats. Using the function get_next_encoder() + // is used because of two facts + // 1. It is publicly available and thus can be used by 3rd party apps, + // too. + // 2. It is already available by including BMediaFormats.h, so there is + // no need to include another header for this workaround. + // Also, please leave the workaround code at this -prominent- place + // instead of moving it to the more appropriate place in + // CreateMpeg2MediaFormat(). This way it acts as a reminder to fix + // the bug :) + int32 workaroundCookie = 0; + media_codec_info workaroundMediaCodecInfo; + status_t workaroundStatus = get_next_encoder(&workaroundCookie, + &workaroundMediaCodecInfo); + if (workaroundStatus < B_OK) + exit(99); + media_format* mpeg2MediaFormat = CreateMpeg2MediaFormat(); mpeg2Decoder->SetTo(mpeg2MediaFormat); status_t settingMpeg2DecoderStatus = mpeg2Decoder->InitCheck(); @@ -192,7 +213,7 @@ CreateMpeg2MediaFormat() return kFailedToCreateMpeg2MediaFormat; } - // The following code block can be removed, once the ffmpeg addon can + // TODO: The following code block can be removed, once the ffmpeg addon can // determine the codec output parameters from the encoded data. mpeg2MediaFormat->u.encoded_video.output.first_active = 0; mpeg2MediaFormat->u.encoded_video.output.last_active = 575; ############################################################################ Revision: hrev47475 Commit: d65388e7fa1d82e5c7ed66c250d5f3e06bd95543 URL: http://cgit.haiku-os.org/haiku/commit/?id=d65388e Author: Colin Günther <coling@xxxxxx> Date: Wed Jul 9 16:44:50 2014 UTC Ticket: https://dev.haiku-os.org/ticket/11018 Media Kit: Add workaround for #11018 to MP3 audio stream decoder test. The workaround triggers the loading of all media plugins prior to using methods of class BMediaFormats. Using the function get_next_encoder() is used because of two facts 1. It is publicly available and thus can be used by 3rd party apps, too. 2. It is already available by including BMediaFormats.h, so there is no need to include another header for this workaround. Signed-off-by: Colin Günther <coling@xxxxxx> (cherry picked from commit a89b0a4e69f18b2b3b2c2f5615450a5ddac838af) ---------------------------------------------------------------------------- diff --git a/src/tests/kits/media/mp3_decoder_test/mp3_decoder_test.cpp b/src/tests/kits/media/mp3_decoder_test/mp3_decoder_test.cpp index b3c9c9d..128e739 100644 --- a/src/tests/kits/media/mp3_decoder_test/mp3_decoder_test.cpp +++ b/src/tests/kits/media/mp3_decoder_test/mp3_decoder_test.cpp @@ -124,6 +124,27 @@ main(int argc, char* argv[]) { BApplication app("application/x-vnd.mp3-decoder-test"); + // TODO: The following code block is a workaround for the bug #11018 + // (https://dev.haiku-os.org/ticket/11018). Please remove this code block, + // once the bug is being resolved. + // The workaround triggers the loading of all media plugins prior to using + // methods of class BMediaFormats. Using the function get_next_encoder() + // is used because of two facts + // 1. It is publicly available and thus can be used by 3rd party apps, + // too. + // 2. It is already available by including BMediaFormats.h, so there is + // no need to include another header for this workaround. + // Also, please leave the workaround code at this -prominent- place + // instead of moving it to the more appropriate place in + // InitializeMp3DecodingCookie(). This way it acts as a reminder to fix + // the bug :) + int32 workaroundCookie = 0; + media_codec_info workaroundMediaCodecInfo; + status_t workaroundStatus = get_next_encoder(&workaroundCookie, + &workaroundMediaCodecInfo); + if (workaroundStatus < B_OK) + exit(99); + cookie_decode decodingCookie; if (InitializeMp3DecodingCookie(&decodingCookie) != B_OK) exit(1); @@ -226,7 +247,7 @@ CreateMp3MediaFormat() return sNoMp3MediaFormat; } - // The following code block can be removed, once the ffmpeg addon can + // TODO: The following code block can be removed, once the ffmpeg addon can // determine the codec output parameters from the encoded data. mp3MediaFormat->u.encoded_audio.output.frame_rate = 48000; mp3MediaFormat->u.encoded_audio.output.channel_count = 2;