mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 22:21:13 +00:00
subtitleoverlay: Also use "Decoder/Subtitle" elements
Elements that "decoded" subtitle formats to raw text were historically classified as "Parser" and not "Decoder. This is being gradually fixed. This commit ensures that both classification are allowed Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6153>
This commit is contained in:
parent
c1d33126aa
commit
3ce62be851
1 changed files with 12 additions and 8 deletions
|
@ -230,15 +230,19 @@ _is_renderer (GstElementFactory * factory)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Note : Historically subtitle "decoders" (which convert subtitle formats to
|
||||||
|
* raw text) were classified as "Parser/Subtitle". Most were fixed in February
|
||||||
|
* 2024 to use the proper classification of "Decoder/Subtitle" */
|
||||||
static gboolean
|
static gboolean
|
||||||
_is_parser (GstElementFactory * factory)
|
_is_parser_decoder (GstElementFactory * factory)
|
||||||
{
|
{
|
||||||
const gchar *klass;
|
const gchar *klass;
|
||||||
|
|
||||||
klass =
|
klass =
|
||||||
gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_KLASS);
|
gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_KLASS);
|
||||||
|
|
||||||
if (klass != NULL && strstr (klass, "Parser/Subtitle") != NULL)
|
if (klass != NULL && (strstr (klass, "Parser/Subtitle") != NULL ||
|
||||||
|
strstr (klass, "Decoder/Subtitle") != NULL))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -296,7 +300,7 @@ _get_sub_caps (GstElementFactory * factory)
|
||||||
{
|
{
|
||||||
const GList *templates;
|
const GList *templates;
|
||||||
GList *walk;
|
GList *walk;
|
||||||
gboolean is_parser = _is_parser (factory);
|
gboolean is_parser_decoder = _is_parser_decoder (factory);
|
||||||
|
|
||||||
templates = gst_element_factory_get_static_pad_templates (factory);
|
templates = gst_element_factory_get_static_pad_templates (factory);
|
||||||
for (walk = (GList *) templates; walk; walk = g_list_next (walk)) {
|
for (walk = (GList *) templates; walk; walk = g_list_next (walk)) {
|
||||||
|
@ -305,7 +309,7 @@ _get_sub_caps (GstElementFactory * factory)
|
||||||
if (templ->direction == GST_PAD_SINK && templ->presence == GST_PAD_ALWAYS) {
|
if (templ->direction == GST_PAD_SINK && templ->presence == GST_PAD_ALWAYS) {
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
|
|
||||||
if (is_parser) {
|
if (is_parser_decoder) {
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
} else {
|
} else {
|
||||||
guint i;
|
guint i;
|
||||||
|
@ -348,10 +352,10 @@ _factory_filter (GstPluginFeature * feature, GstCaps ** subcaps)
|
||||||
if (strcmp ("textoverlay", name) != 0 && rank < GST_RANK_MARGINAL)
|
if (strcmp ("textoverlay", name) != 0 && rank < GST_RANK_MARGINAL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Check if it's a renderer or a parser */
|
/* Check if it's a renderer or a parser/decoder */
|
||||||
if (_is_renderer (factory)) {
|
if (_is_renderer (factory)) {
|
||||||
is_renderer = TRUE;
|
is_renderer = TRUE;
|
||||||
} else if (_is_parser (factory)) {
|
} else if (_is_parser_decoder (factory)) {
|
||||||
is_renderer = FALSE;
|
is_renderer = FALSE;
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -382,8 +386,8 @@ _factory_filter (GstPluginFeature * feature, GstCaps ** subcaps)
|
||||||
*subcaps = gst_caps_merge (*subcaps, templ_caps);
|
*subcaps = gst_caps_merge (*subcaps, templ_caps);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (!is_renderer && !have_video_sink && templ_caps) {
|
} else if (!is_renderer && !have_video_sink && templ_caps) {
|
||||||
GST_DEBUG ("Found parser element %s (%s) with caps %" GST_PTR_FORMAT,
|
GST_DEBUG ("Found parser/decoder element %s (%s) with caps %"
|
||||||
gst_element_factory_get_metadata (factory,
|
GST_PTR_FORMAT, gst_element_factory_get_metadata (factory,
|
||||||
GST_ELEMENT_METADATA_LONGNAME),
|
GST_ELEMENT_METADATA_LONGNAME),
|
||||||
gst_plugin_feature_get_name (feature), templ_caps);
|
gst_plugin_feature_get_name (feature), templ_caps);
|
||||||
*subcaps = gst_caps_merge (*subcaps, templ_caps);
|
*subcaps = gst_caps_merge (*subcaps, templ_caps);
|
||||||
|
|
Loading…
Reference in a new issue