summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-31 13:00:04 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-31 13:00:04 +0100
commitd94d572e16c590ed619bfaed23100b80516ce6f7 (patch)
tree90aaa9a089ee96c3a62fbfed7144651db3506a3c
parentf3e2864f4cd699d915c44f911ad4b559c45b54c5 (diff)
downloadgstreamer-plugins-bad-d94d572e16c590ed619bfaed23100b80516ce6f7.tar.gz
mpegtsmux: use an old-fashioned array instead of GPtrArray for mux->programs
Using GPtrArray for a fixed-sized array is a bit pointless and makes for ugly code.
-rw-r--r--gst/mpegtsmux/mpegtsmux.c14
-rw-r--r--gst/mpegtsmux/mpegtsmux.h2
2 files changed, 5 insertions, 11 deletions
diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c
index c5abe5747..6b9b63255 100644
--- a/gst/mpegtsmux/mpegtsmux.c
+++ b/gst/mpegtsmux/mpegtsmux.c
@@ -196,8 +196,6 @@ mpegtsmux_class_init (MpegTsMuxClass * klass)
static void
mpegtsmux_init (MpegTsMux * mux, MpegTsMuxClass * g_class)
{
- guint i;
-
mux->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&mpegtsmux_src_factory), "src");
@@ -211,10 +209,7 @@ mpegtsmux_init (MpegTsMux * mux, MpegTsMuxClass * g_class)
mux->tsmux = tsmux_new ();
tsmux_set_write_func (mux->tsmux, new_packet_cb, mux);
- mux->programs = g_ptr_array_new ();
- for (i = 0; i < MAX_PROG_NUMBER; i++)
- g_ptr_array_add (mux->programs, NULL);
-
+ mux->programs = g_new0 (TsMuxProgram *, MAX_PROG_NUMBER);
mux->first = TRUE;
mux->last_flow_ret = GST_FLOW_OK;
mux->adapter = gst_adapter_new ();
@@ -248,7 +243,7 @@ mpegtsmux_dispose (GObject * object)
mux->prog_map = NULL;
}
if (mux->programs) {
- g_ptr_array_free (mux->programs, TRUE);
+ g_free (mux->programs);
mux->programs = NULL;
}
@@ -486,13 +481,12 @@ mpegtsmux_create_streams (MpegTsMux * mux)
}
}
- ts_data->prog =
- (TsMuxProgram *) g_ptr_array_index (mux->programs, ts_data->prog_id);
+ ts_data->prog = mux->programs[ts_data->prog_id];
if (ts_data->prog == NULL) {
ts_data->prog = tsmux_program_new (mux->tsmux);
if (ts_data->prog == NULL)
goto no_program;
- g_ptr_array_index (mux->programs, ts_data->prog_id) = ts_data->prog;
+ mux->programs[ts_data->prog_id] = ts_data->prog;
}
if (ts_data->stream == NULL) {
diff --git a/gst/mpegtsmux/mpegtsmux.h b/gst/mpegtsmux/mpegtsmux.h
index f4536fdf0..2ebb7251d 100644
--- a/gst/mpegtsmux/mpegtsmux.h
+++ b/gst/mpegtsmux/mpegtsmux.h
@@ -109,7 +109,7 @@ struct MpegTsMux {
GstCollectPads *collect;
TsMux *tsmux;
- GPtrArray *programs;
+ TsMuxProgram **programs;
GstStructure *prog_map;
gboolean first;