dvb.media_addon: Trigger loading of media plugins.

- This is the workaround as described in the bug report #11018.
- I would have preferred to place this workaround in DVBMediaAddon::InitCheck()
  as this method can return a status code but unfortunately it is never called.
This commit is contained in:
Colin Günther
2014-08-10 14:50:57 +02:00
parent b93146243f
commit 7a8c70a3c8
@@ -55,6 +55,20 @@ make_media_addon(image_id id)
DVBMediaAddon::DVBMediaAddon(image_id id) DVBMediaAddon::DVBMediaAddon(image_id id)
: BMediaAddOn(id) : BMediaAddOn(id)
{ {
// 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.
int32 workaroundCookie = 0;
media_codec_info workaroundMediaCodecInfo;
get_next_encoder(&workaroundCookie, &workaroundMediaCodecInfo);
ScanFolder("/dev/dvb"); ScanFolder("/dev/dvb");
} }
@@ -68,10 +82,12 @@ DVBMediaAddon::~DVBMediaAddon()
status_t status_t
DVBMediaAddon::InitCheck(const char ** out_failure_text) DVBMediaAddon::InitCheck(const char ** out_failure_text)
{ {
debugger("");
if (!fDeviceList.CountItems()) { if (!fDeviceList.CountItems()) {
*out_failure_text = "No supported device found"; *out_failure_text = "No supported device found";
return B_ERROR; return B_ERROR;
} }
return B_OK; return B_OK;
} }