diff --git a/src/kits/media/AddOnManager.cpp b/src/kits/media/AddOnManager.cpp index 50d4ce6d4e..3dde8ac31a 100644 --- a/src/kits/media/AddOnManager.cpp +++ b/src/kits/media/AddOnManager.cpp @@ -95,7 +95,7 @@ AddOnManager::GetDecoderForFormat(entry_ref* _decoderRef, return B_MEDIA_BAD_FORMAT; BAutolock locker(fLock); - _RegisterAddOns(); + RegisterAddOns(); // Since the list of decoders is unsorted, we need to search for // a decoder by add-on directory, in order to maintain the shadowing @@ -128,7 +128,7 @@ AddOnManager::GetReaders(entry_ref* outRefs, int32* outCount, int32 maxCount) { BAutolock locker(fLock); - _RegisterAddOns(); + RegisterAddOns(); *outCount = 0; @@ -158,7 +158,7 @@ status_t AddOnManager::GetEncoder(entry_ref* _encoderRef, int32 id) { BAutolock locker(fLock); - _RegisterAddOns(); + RegisterAddOns(); encoder_info* info; for (fEncoderList.Rewind(); fEncoderList.GetNext(&info);) { @@ -177,7 +177,7 @@ status_t AddOnManager::GetWriter(entry_ref* _ref, uint32 internalID) { BAutolock locker(fLock); - _RegisterAddOns(); + RegisterAddOns(); writer_info* info; for (fWriterList.Rewind(); fWriterList.GetNext(&info);) { @@ -195,7 +195,7 @@ status_t AddOnManager::GetFileFormat(media_file_format* _fileFormat, int32 cookie) { BAutolock locker(fLock); - _RegisterAddOns(); + RegisterAddOns(); media_file_format* fileFormat; if (fWriterFileFormats.Get(cookie, &fileFormat)) { @@ -213,7 +213,7 @@ AddOnManager::GetCodecInfo(media_codec_info* _codecInfo, media_format* _inputFormat, media_format* _outputFormat, int32 cookie) { BAutolock locker(fLock); - _RegisterAddOns(); + RegisterAddOns(); encoder_info* info; if (fEncoderList.Get(cookie, &info)) { @@ -232,7 +232,7 @@ AddOnManager::GetCodecInfo(media_codec_info* _codecInfo, void -AddOnManager::_RegisterAddOns() +AddOnManager::RegisterAddOns() { // Check if add-ons are already registered. if (!fReaderList.IsEmpty() || !fWriterList.IsEmpty() diff --git a/src/kits/media/AddOnManager.h b/src/kits/media/AddOnManager.h index 072560a0ed..32154d284b 100644 --- a/src/kits/media/AddOnManager.h +++ b/src/kits/media/AddOnManager.h @@ -50,8 +50,9 @@ public: media_format* _inputFormat, media_format* _outputFormat, int32 cookie); + void RegisterAddOns(); + private: - void _RegisterAddOns(); status_t _RegisterAddOn(const entry_ref& ref); status_t _UnregisterAddOn(const entry_ref& ref); diff --git a/src/kits/media/MediaFormats.cpp b/src/kits/media/MediaFormats.cpp index 0fe393a113..1ee0be001b 100644 --- a/src/kits/media/MediaFormats.cpp +++ b/src/kits/media/MediaFormats.cpp @@ -364,6 +364,10 @@ update_media_formats() if (!sLock.IsLocked()) return B_NOT_ALLOWED; + // We want the add-ons to register themselves with the format manager, so + // the list is up to date. + AddOnManager::GetInstance()->RegisterAddOns(); + BMessage reply; FormatManager::GetInstance()->GetFormats(sLastFormatsUpdate, reply); 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 b04261241d..1e326d4fdb 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,27 +124,6 @@ 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);