mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-13 02:45:35 +00:00
discoverer: fix caps and discoverer object ref leaks
This commit is contained in:
parent
9ab18d7a68
commit
96e40584ce
1 changed files with 18 additions and 11 deletions
|
@ -641,7 +641,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
|
||||||
if (!st || !gst_structure_id_has_field (st, _CAPS_QUARK)) {
|
if (!st || !gst_structure_id_has_field (st, _CAPS_QUARK)) {
|
||||||
GST_WARNING ("Couldn't find caps !");
|
GST_WARNING ("Couldn't find caps !");
|
||||||
if (parent)
|
if (parent)
|
||||||
return parent;
|
return gst_discoverer_stream_info_ref (parent);
|
||||||
else
|
else
|
||||||
return (GstDiscovererStreamInfo *)
|
return (GstDiscovererStreamInfo *)
|
||||||
gst_mini_object_new (GST_TYPE_DISCOVERER_STREAM_INFO);
|
gst_mini_object_new (GST_TYPE_DISCOVERER_STREAM_INFO);
|
||||||
|
@ -655,11 +655,11 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
|
||||||
GstDiscovererAudioInfo *info;
|
GstDiscovererAudioInfo *info;
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
info = (GstDiscovererAudioInfo *) parent;
|
info = (GstDiscovererAudioInfo *) gst_discoverer_stream_info_ref (parent);
|
||||||
else {
|
else {
|
||||||
info = (GstDiscovererAudioInfo *)
|
info = (GstDiscovererAudioInfo *)
|
||||||
gst_mini_object_new (GST_TYPE_DISCOVERER_AUDIO_INFO);
|
gst_mini_object_new (GST_TYPE_DISCOVERER_AUDIO_INFO);
|
||||||
info->parent.caps = caps;
|
info->parent.caps = gst_caps_ref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gst_structure_get_int (caps_st, "rate", &tmp))
|
if (gst_structure_get_int (caps_st, "rate", &tmp))
|
||||||
|
@ -692,6 +692,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_caps_unref (caps);
|
||||||
return (GstDiscovererStreamInfo *) info;
|
return (GstDiscovererStreamInfo *) info;
|
||||||
|
|
||||||
} else if (g_str_has_prefix (name, "video/") ||
|
} else if (g_str_has_prefix (name, "video/") ||
|
||||||
|
@ -699,11 +700,11 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
|
||||||
GstDiscovererVideoInfo *info;
|
GstDiscovererVideoInfo *info;
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
info = (GstDiscovererVideoInfo *) parent;
|
info = (GstDiscovererVideoInfo *) gst_discoverer_stream_info_ref (parent);
|
||||||
else {
|
else {
|
||||||
info = (GstDiscovererVideoInfo *)
|
info = (GstDiscovererVideoInfo *)
|
||||||
gst_mini_object_new (GST_TYPE_DISCOVERER_VIDEO_INFO);
|
gst_mini_object_new (GST_TYPE_DISCOVERER_VIDEO_INFO);
|
||||||
info->parent.caps = caps;
|
info->parent.caps = gst_caps_ref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gst_structure_get_int (caps_st, "width", &tmp) &&
|
if (gst_structure_get_int (caps_st, "width", &tmp) &&
|
||||||
|
@ -745,17 +746,19 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
|
||||||
(GstTagList *) tags_st);
|
(GstTagList *) tags_st);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_caps_unref (caps);
|
||||||
return (GstDiscovererStreamInfo *) info;
|
return (GstDiscovererStreamInfo *) info;
|
||||||
|
|
||||||
} else if (is_subtitle_caps (caps)) {
|
} else if (is_subtitle_caps (caps)) {
|
||||||
GstDiscovererSubtitleInfo *info;
|
GstDiscovererSubtitleInfo *info;
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
info = (GstDiscovererSubtitleInfo *) parent;
|
info =
|
||||||
|
(GstDiscovererSubtitleInfo *) gst_discoverer_stream_info_ref (parent);
|
||||||
else {
|
else {
|
||||||
info = (GstDiscovererSubtitleInfo *)
|
info = (GstDiscovererSubtitleInfo *)
|
||||||
gst_mini_object_new (GST_TYPE_DISCOVERER_SUBTITLE_INFO);
|
gst_mini_object_new (GST_TYPE_DISCOVERER_SUBTITLE_INFO);
|
||||||
info->parent.caps = caps;
|
info->parent.caps = gst_caps_ref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gst_structure_id_has_field (st, _TAGS_QUARK)) {
|
if (gst_structure_id_has_field (st, _TAGS_QUARK)) {
|
||||||
|
@ -779,6 +782,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_caps_unref (caps);
|
||||||
return (GstDiscovererStreamInfo *) info;
|
return (GstDiscovererStreamInfo *) info;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -786,11 +790,11 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
|
||||||
GstDiscovererStreamInfo *info;
|
GstDiscovererStreamInfo *info;
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
info = parent;
|
info = gst_discoverer_stream_info_ref (parent);
|
||||||
else {
|
else {
|
||||||
info = (GstDiscovererStreamInfo *)
|
info = (GstDiscovererStreamInfo *)
|
||||||
gst_mini_object_new (GST_TYPE_DISCOVERER_STREAM_INFO);
|
gst_mini_object_new (GST_TYPE_DISCOVERER_STREAM_INFO);
|
||||||
info->caps = caps;
|
info->caps = gst_caps_ref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gst_structure_id_get (st, _TAGS_QUARK,
|
if (gst_structure_id_get (st, _TAGS_QUARK,
|
||||||
|
@ -798,6 +802,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
|
||||||
gst_discoverer_merge_and_replace_tags (&info->tags, tags_st);
|
gst_discoverer_merge_and_replace_tags (&info->tags, tags_st);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_caps_unref (caps);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -937,6 +942,8 @@ parse_stream_topology (GstDiscoverer * dc, const GstStructure * topology,
|
||||||
if (add_to_list) {
|
if (add_to_list) {
|
||||||
dc->priv->current_info->stream_list =
|
dc->priv->current_info->stream_list =
|
||||||
g_list_append (dc->priv->current_info->stream_list, res);
|
g_list_append (dc->priv->current_info->stream_list, res);
|
||||||
|
} else {
|
||||||
|
gst_discoverer_stream_info_unref (res);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (GST_VALUE_HOLDS_LIST (nval)) {
|
} else if (GST_VALUE_HOLDS_LIST (nval)) {
|
||||||
|
@ -1056,8 +1063,8 @@ discoverer_collect (GstDiscoverer * dc)
|
||||||
gst_caps_get_structure (dc->priv->current_info->stream_info->caps, 0);
|
gst_caps_get_structure (dc->priv->current_info->stream_info->caps, 0);
|
||||||
|
|
||||||
if (g_str_has_prefix (gst_structure_get_name (st), "image/"))
|
if (g_str_has_prefix (gst_structure_get_name (st), "image/"))
|
||||||
((GstDiscovererVideoInfo *) dc->priv->current_info->
|
((GstDiscovererVideoInfo *) dc->priv->current_info->stream_info)->
|
||||||
stream_info)->is_image = TRUE;
|
is_image = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue