summaryrefslogtreecommitdiffstats
path: root/gst/mxf
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-02-09 17:25:35 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-02-09 17:25:35 +0100
commit32dc77f8532f5c46b4fa7dfb96345ae41567dbba (patch)
treea4f8c4c0b19b789de58d47a845fd78dcad2a29b2 /gst/mxf
parentae4b0fcb7c79b9ba8a03f674d7fb883c4e1eba18 (diff)
downloadgst-plugins-bad-32dc77f8532f5c46b4fa7dfb96345ae41567dbba.tar.gz
gst-plugins-bad-32dc77f8532f5c46b4fa7dfb96345ae41567dbba.tar.bz2
gst-plugins-bad-32dc77f8532f5c46b4fa7dfb96345ae41567dbba.zip
mxfdemux: Make sure that the srcpad and essence track arrays always exist
Diffstat (limited to 'gst/mxf')
-rw-r--r--gst/mxf/mxfdemux.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c
index 506ac0d4..c4459564 100644
--- a/gst/mxf/mxfdemux.c
+++ b/gst/mxf/mxfdemux.c
@@ -151,6 +151,8 @@ gst_mxf_demux_partition_free (GstMXFDemuxPartition * partition)
static void
gst_mxf_demux_reset_mxf_state (GstMXFDemux * demux)
{
+ guint i;
+
GST_DEBUG_OBJECT (demux, "Resetting MXF state");
g_list_foreach (demux->partitions, (GFunc) gst_mxf_demux_partition_free,
@@ -160,27 +162,22 @@ gst_mxf_demux_reset_mxf_state (GstMXFDemux * demux)
demux->current_partition = NULL;
- if (demux->essence_tracks) {
- guint i;
-
- for (i = 0; i < demux->essence_tracks->len; i++) {
- GstMXFDemuxEssenceTrack *t =
- &g_array_index (demux->essence_tracks, GstMXFDemuxEssenceTrack, i);
+ for (i = 0; i < demux->essence_tracks->len; i++) {
+ GstMXFDemuxEssenceTrack *t =
+ &g_array_index (demux->essence_tracks, GstMXFDemuxEssenceTrack, i);
- if (t->offsets)
- g_array_free (t->offsets, TRUE);
+ if (t->offsets)
+ g_array_free (t->offsets, TRUE);
- g_free (t->mapping_data);
+ g_free (t->mapping_data);
- if (t->tags)
- gst_tag_list_free (t->tags);
+ if (t->tags)
+ gst_tag_list_free (t->tags);
- if (t->caps)
- gst_caps_unref (t->caps);
- }
- g_array_free (demux->essence_tracks, TRUE);
- demux->essence_tracks = NULL;
+ if (t->caps)
+ gst_caps_unref (t->caps);
}
+ g_array_set_size (demux->essence_tracks, 0);
}
static void
@@ -254,8 +251,7 @@ gst_mxf_demux_reset (GstMXFDemux * demux)
demux->close_seg_event = NULL;
}
- if (demux->adapter)
- gst_adapter_clear (demux->adapter);
+ gst_adapter_clear (demux->adapter);
gst_mxf_demux_remove_pads (demux);
@@ -3790,6 +3786,8 @@ gst_mxf_demux_finalize (GObject * object)
g_ptr_array_free (demux->src, TRUE);
demux->src = NULL;
+ g_array_free (demux->essence_tracks, TRUE);
+ demux->essence_tracks = NULL;
g_hash_table_destroy (demux->metadata);
@@ -3867,8 +3865,12 @@ gst_mxf_demux_init (GstMXFDemux * demux, GstMXFDemuxClass * g_class)
demux->max_drift = 500 * GST_MSECOND;
demux->adapter = gst_adapter_new ();
- demux->src = g_ptr_array_new ();
demux->metadata_lock = g_mutex_new ();
+
+ demux->src = g_ptr_array_new ();
+ demux->essence_tracks =
+ g_array_new (FALSE, FALSE, sizeof (GstMXFDemuxEssenceTrack));
+
gst_segment_init (&demux->segment, GST_FORMAT_TIME);
gst_mxf_demux_reset (demux);