Bug 1133634 - Fix CanPlayType in GStreamer backend - r=kinetik

This commit is contained in:
Edwin Flores 2015-02-18 15:33:42 +13:00
parent d08f967d7b
commit eda1e0c4c7
2 changed files with 12 additions and 22 deletions

View File

@ -224,25 +224,15 @@ GStreamerFormatHelper::IsBlacklistEnabled()
}
/* static */ bool
GStreamerFormatHelper::IsPluginFeatureBlacklisted(GstPluginFeature *aFeature,
FactoryType aTypes)
GStreamerFormatHelper::IsPluginFeatureBlacklisted(GstPluginFeature *aFeature)
{
if (!IsBlacklistEnabled()) {
return false;
}
const gchar *className =
gst_element_factory_get_klass(GST_ELEMENT_FACTORY_CAST(aFeature));
const gchar *factoryName =
gst_plugin_feature_get_name(aFeature);
if ((!(aTypes & FactoryTypeDecoder) && strstr(className, "Decoder")) ||
(!(aTypes & FactoryTypeDemuxer) && strstr(className, "Demuxer")) ||
(!(aTypes & FactoryTypeParser) && strstr(className, "Parser"))) {
return false;
}
for (unsigned int i = 0; i < G_N_ELEMENTS(sPluginBlacklist); i++) {
if (!strcmp(factoryName, sPluginBlacklist[i])) {
return true;
@ -258,8 +248,16 @@ static gboolean FactoryFilter(GstPluginFeature *aFeature, gpointer)
return FALSE;
}
return !GStreamerFormatHelper::IsPluginFeatureBlacklisted(aFeature,
(FactoryType)(FactoryTypeDecoder|FactoryTypeDemuxer));
const gchar *className =
gst_element_factory_get_klass(GST_ELEMENT_FACTORY_CAST(aFeature));
if (!strstr(className, "Decoder") && !strstr(className, "Demux")) {
return FALSE;
}
return
gst_plugin_feature_get_rank(aFeature) >= GST_RANK_MARGINAL &&
!GStreamerFormatHelper::IsPluginFeatureBlacklisted(aFeature);
}
/**

View File

@ -13,13 +13,6 @@
namespace mozilla {
enum FactoryType {
FactoryTypeDecoder = 1 << 0,
FactoryTypeDemuxer = 1 << 1,
FactoryTypeParser = 1 << 2,
FactoryTypeAll = FactoryTypeDecoder|FactoryTypeDemuxer|FactoryTypeParser
};
class GStreamerFormatHelper {
/* This class can be used to query the GStreamer registry for the required
* demuxers/decoders from nsHTMLMediaElement::CanPlayType.
@ -37,8 +30,7 @@ class GStreamerFormatHelper {
bool CanHandleCodecCaps(GstCaps* aCaps);
static bool IsBlacklistEnabled();
static bool IsPluginFeatureBlacklisted(GstPluginFeature *aFeature,
FactoryType aTypes = FactoryTypeAll);
static bool IsPluginFeatureBlacklisted(GstPluginFeature *aFeature);
static GstCaps* ConvertFormatsToCaps(const char* aMIMEType,
const nsAString* aCodecs);