mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-29 19:50:40 +00:00
qtdemux: refactor stream freeing
This commit is contained in:
parent
eb5c958143
commit
73bbd8e7d3
1 changed files with 23 additions and 19 deletions
|
@ -1683,6 +1683,27 @@ gst_qtdemux_stbl_free (QtDemuxStream * stream)
|
||||||
stream->ctts.data = NULL;
|
stream->ctts.data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_qtdemux_stream_free (GstQTDemux * qtdemux, QtDemuxStream * stream)
|
||||||
|
{
|
||||||
|
while (stream->buffers) {
|
||||||
|
gst_buffer_unref (GST_BUFFER_CAST (stream->buffers->data));
|
||||||
|
stream->buffers = g_slist_delete_link (stream->buffers, stream->buffers);
|
||||||
|
}
|
||||||
|
if (stream->pad)
|
||||||
|
gst_element_remove_pad (GST_ELEMENT_CAST (qtdemux), stream->pad);
|
||||||
|
g_free (stream->samples);
|
||||||
|
if (stream->caps)
|
||||||
|
gst_caps_unref (stream->caps);
|
||||||
|
g_free (stream->segments);
|
||||||
|
if (stream->pending_tags)
|
||||||
|
gst_tag_list_free (stream->pending_tags);
|
||||||
|
g_free (stream->redirect_uri);
|
||||||
|
/* free stbl sub-atoms */
|
||||||
|
gst_qtdemux_stbl_free (stream);
|
||||||
|
g_free (stream);
|
||||||
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
gst_qtdemux_change_state (GstElement * element, GstStateChange transition)
|
gst_qtdemux_change_state (GstElement * element, GstStateChange transition)
|
||||||
{
|
{
|
||||||
|
@ -1725,25 +1746,8 @@ gst_qtdemux_change_state (GstElement * element, GstStateChange transition)
|
||||||
qtdemux->element_index = NULL;
|
qtdemux->element_index = NULL;
|
||||||
gst_adapter_clear (qtdemux->adapter);
|
gst_adapter_clear (qtdemux->adapter);
|
||||||
for (n = 0; n < qtdemux->n_streams; n++) {
|
for (n = 0; n < qtdemux->n_streams; n++) {
|
||||||
QtDemuxStream *stream = qtdemux->streams[n];
|
gst_qtdemux_stream_free (qtdemux, qtdemux->streams[n]);
|
||||||
|
qtdemux->streams[n] = NULL;
|
||||||
while (stream->buffers) {
|
|
||||||
gst_buffer_unref (GST_BUFFER_CAST (stream->buffers->data));
|
|
||||||
stream->buffers =
|
|
||||||
g_slist_delete_link (stream->buffers, stream->buffers);
|
|
||||||
}
|
|
||||||
if (stream->pad)
|
|
||||||
gst_element_remove_pad (element, stream->pad);
|
|
||||||
g_free (stream->samples);
|
|
||||||
if (stream->caps)
|
|
||||||
gst_caps_unref (stream->caps);
|
|
||||||
g_free (stream->segments);
|
|
||||||
if (stream->pending_tags)
|
|
||||||
gst_tag_list_free (stream->pending_tags);
|
|
||||||
g_free (stream->redirect_uri);
|
|
||||||
/* free stbl sub-atoms */
|
|
||||||
gst_qtdemux_stbl_free (stream);
|
|
||||||
g_free (stream);
|
|
||||||
}
|
}
|
||||||
qtdemux->major_brand = 0;
|
qtdemux->major_brand = 0;
|
||||||
qtdemux->n_streams = 0;
|
qtdemux->n_streams = 0;
|
||||||
|
|
Loading…
Reference in a new issue