mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
encodebin: release additional obtained caps reference
This commit is contained in:
parent
43b0c5d258
commit
0ad7fe0590
1 changed files with 30 additions and 14 deletions
|
@ -777,7 +777,7 @@ _get_parser (GstEncodeBin * ebin, GstEncodingProfile * sprof)
|
||||||
GList *parsers1, *parsers, *tmp;
|
GList *parsers1, *parsers, *tmp;
|
||||||
GstElement *parser = NULL;
|
GstElement *parser = NULL;
|
||||||
GstElementFactory *parserfact = NULL;
|
GstElementFactory *parserfact = NULL;
|
||||||
const GstCaps *format;
|
GstCaps *format;
|
||||||
|
|
||||||
format = gst_encoding_profile_get_format (sprof);
|
format = gst_encoding_profile_get_format (sprof);
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ _get_parser (GstEncodeBin * ebin, GstEncodingProfile * sprof)
|
||||||
|
|
||||||
if (G_UNLIKELY (parsers == NULL)) {
|
if (G_UNLIKELY (parsers == NULL)) {
|
||||||
GST_DEBUG ("Couldn't find any compatible parsers");
|
GST_DEBUG ("Couldn't find any compatible parsers");
|
||||||
return NULL;
|
goto beach;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (tmp = parsers; tmp; tmp = tmp->next) {
|
for (tmp = parsers; tmp; tmp = tmp->next) {
|
||||||
|
@ -809,6 +809,10 @@ _get_parser (GstEncodeBin * ebin, GstEncodingProfile * sprof)
|
||||||
|
|
||||||
gst_plugin_feature_list_free (parsers);
|
gst_plugin_feature_list_free (parsers);
|
||||||
|
|
||||||
|
beach:
|
||||||
|
if (format)
|
||||||
|
gst_caps_unref (format);
|
||||||
|
|
||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -838,7 +842,7 @@ _get_encoder (GstEncodeBin * ebin, GstEncodingProfile * sprof)
|
||||||
GList *encoders, *tmp;
|
GList *encoders, *tmp;
|
||||||
GstElement *encoder = NULL;
|
GstElement *encoder = NULL;
|
||||||
GstElementFactory *encoderfact = NULL;
|
GstElementFactory *encoderfact = NULL;
|
||||||
const GstCaps *format;
|
GstCaps *format;
|
||||||
const gchar *preset;
|
const gchar *preset;
|
||||||
|
|
||||||
format = gst_encoding_profile_get_format (sprof);
|
format = gst_encoding_profile_get_format (sprof);
|
||||||
|
@ -871,6 +875,9 @@ _get_encoder (GstEncodeBin * ebin, GstEncodingProfile * sprof)
|
||||||
gst_plugin_feature_list_free (encoders);
|
gst_plugin_feature_list_free (encoders);
|
||||||
|
|
||||||
beach:
|
beach:
|
||||||
|
if (format)
|
||||||
|
gst_caps_unref (format);
|
||||||
|
|
||||||
return encoder;
|
return encoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1516,7 +1523,7 @@ _get_formatter (GstEncodeBin * ebin, GstEncodingProfile * sprof)
|
||||||
GList *formatters, *tmpfmtr;
|
GList *formatters, *tmpfmtr;
|
||||||
GstElement *formatter = NULL;
|
GstElement *formatter = NULL;
|
||||||
GstElementFactory *formatterfact = NULL;
|
GstElementFactory *formatterfact = NULL;
|
||||||
const GstCaps *format;
|
GstCaps *format;
|
||||||
const gchar *preset;
|
const gchar *preset;
|
||||||
|
|
||||||
format = gst_encoding_profile_get_format (sprof);
|
format = gst_encoding_profile_get_format (sprof);
|
||||||
|
@ -1546,6 +1553,8 @@ _get_formatter (GstEncodeBin * ebin, GstEncodingProfile * sprof)
|
||||||
gst_plugin_feature_list_free (formatters);
|
gst_plugin_feature_list_free (formatters);
|
||||||
|
|
||||||
beach:
|
beach:
|
||||||
|
if (format)
|
||||||
|
gst_caps_unref (format);
|
||||||
return formatter;
|
return formatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1581,7 +1590,7 @@ _get_muxer (GstEncodeBin * ebin)
|
||||||
GstElement *muxer = NULL;
|
GstElement *muxer = NULL;
|
||||||
GstElementFactory *muxerfact = NULL;
|
GstElementFactory *muxerfact = NULL;
|
||||||
const GList *tmp;
|
const GList *tmp;
|
||||||
const GstCaps *format;
|
GstCaps *format;
|
||||||
const gchar *preset;
|
const gchar *preset;
|
||||||
|
|
||||||
format = gst_encoding_profile_get_format (ebin->profile);
|
format = gst_encoding_profile_get_format (ebin->profile);
|
||||||
|
@ -1619,14 +1628,18 @@ _get_muxer (GstEncodeBin * ebin)
|
||||||
/* See if the muxer can sink all of our stream profile caps */
|
/* See if the muxer can sink all of our stream profile caps */
|
||||||
for (tmp = profiles; tmp; tmp = tmp->next) {
|
for (tmp = profiles; tmp; tmp = tmp->next) {
|
||||||
GstEncodingProfile *sprof = (GstEncodingProfile *) tmp->data;
|
GstEncodingProfile *sprof = (GstEncodingProfile *) tmp->data;
|
||||||
|
GstCaps *sformat = gst_encoding_profile_get_format (sprof);
|
||||||
|
|
||||||
if (!_factory_can_handle_caps (muxerfact,
|
if (!_factory_can_handle_caps (muxerfact, sformat, GST_PAD_SINK, FALSE)) {
|
||||||
gst_encoding_profile_get_format (sprof), GST_PAD_SINK, FALSE)) {
|
|
||||||
GST_DEBUG ("Skipping muxer because it can't sink caps %"
|
GST_DEBUG ("Skipping muxer because it can't sink caps %"
|
||||||
GST_PTR_FORMAT, gst_encoding_profile_get_format (sprof));
|
GST_PTR_FORMAT, sformat);
|
||||||
cansinkstreams = FALSE;
|
cansinkstreams = FALSE;
|
||||||
|
if (sformat)
|
||||||
|
gst_caps_unref (sformat);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (sformat)
|
||||||
|
gst_caps_unref (sformat);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only use a muxer than can use all streams and than can accept the
|
/* Only use a muxer than can use all streams and than can accept the
|
||||||
|
@ -1639,6 +1652,8 @@ _get_muxer (GstEncodeBin * ebin)
|
||||||
gst_plugin_feature_list_free (muxers);
|
gst_plugin_feature_list_free (muxers);
|
||||||
|
|
||||||
beach:
|
beach:
|
||||||
|
if (format)
|
||||||
|
gst_caps_unref (format);
|
||||||
return muxer;
|
return muxer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1701,15 +1716,16 @@ create_elements_and_pads (GstEncodeBin * ebin)
|
||||||
|
|
||||||
no_muxer:
|
no_muxer:
|
||||||
{
|
{
|
||||||
GST_WARNING ("No available muxer for %" GST_PTR_FORMAT,
|
GstCaps *format = gst_encoding_profile_get_format (ebin->profile);
|
||||||
gst_encoding_profile_get_format (ebin->profile));
|
|
||||||
|
GST_WARNING ("No available muxer for %" GST_PTR_FORMAT, format);
|
||||||
/* missing plugin support */
|
/* missing plugin support */
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (ebin),
|
gst_element_post_message (GST_ELEMENT_CAST (ebin),
|
||||||
gst_missing_encoder_message_new (GST_ELEMENT_CAST (ebin),
|
gst_missing_encoder_message_new (GST_ELEMENT_CAST (ebin), format));
|
||||||
gst_encoding_profile_get_format (ebin->profile)));
|
|
||||||
GST_ELEMENT_ERROR (ebin, CORE, MISSING_PLUGIN, (NULL),
|
GST_ELEMENT_ERROR (ebin, CORE, MISSING_PLUGIN, (NULL),
|
||||||
("No available muxer for format %" GST_PTR_FORMAT,
|
("No available muxer for format %" GST_PTR_FORMAT, format));
|
||||||
gst_encoding_profile_get_format (ebin->profile)));
|
if (format)
|
||||||
|
gst_caps_unref (format);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue