diff options
author | Yanko Kaneti <yaneti@declera.com> | 2015-03-25 19:27:42 +0200 |
---|---|---|
committer | Jan Schmidt <jan@centricular.com> | 2015-06-12 00:09:54 +1000 |
commit | fa9fa5d460d2553c8cac431e71471c12f30d7139 (patch) | |
tree | 7a499f41785d9d3f55d818e162f767f2f930aff3 /gst | |
parent | e8a97877b44bba7b7c8e8d0222ddcf8ad0a91615 (diff) | |
download | gstreamer-plugins-bad-fa9fa5d460d2553c8cac431e71471c12f30d7139.tar.gz |
mpegtsmux: Remove arbitrary constraint on prog-map program ids
https://bugzilla.gnome.org/show_bug.cgi?id=746765
Diffstat (limited to 'gst')
-rw-r--r-- | gst/mpegtsmux/mpegtsmux.c | 23 | ||||
-rw-r--r-- | gst/mpegtsmux/mpegtsmux.h | 7 |
2 files changed, 19 insertions, 11 deletions
diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c index 7c65cb468..89750a7ea 100644 --- a/gst/mpegtsmux/mpegtsmux.c +++ b/gst/mpegtsmux/mpegtsmux.c @@ -390,7 +390,10 @@ mpegtsmux_reset (MpegTsMux * mux, gboolean alloc) mux->tsmux = NULL; } - memset (mux->programs, 0, sizeof (mux->programs)); + if (mux->programs) { + g_hash_table_destroy (mux->programs); + } + mux->programs = g_hash_table_new (g_direct_hash, g_direct_equal); if (mux->streamheader) { GstBuffer *buf; @@ -445,6 +448,10 @@ mpegtsmux_dispose (GObject * object) gst_structure_free (mux->prog_map); mux->prog_map = NULL; } + if (mux->programs) { + g_hash_table_destroy (mux->programs); + mux->programs = NULL; + } GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object)); } @@ -750,10 +757,10 @@ mpegtsmux_create_streams (MpegTsMux * mux) ("Reading program map failed. Assuming default"), (NULL)); idx = DEFAULT_PROG_ID; } - if (idx < 0 || idx >= MAX_PROG_NUMBER) { - GST_DEBUG_OBJECT (mux, "Program number %d associate with pad %s out " - "of range (max = %d); DEFAULT_PROGRAM = %d is used instead", - idx, name, MAX_PROG_NUMBER, DEFAULT_PROG_ID); + if (idx < 0) { + GST_DEBUG_OBJECT (mux, "Program number %d associate with pad %s less " + "than zero; DEFAULT_PROGRAM = %d is used instead", + idx, name, DEFAULT_PROG_ID); idx = DEFAULT_PROG_ID; } ts_data->prog_id = idx; @@ -762,13 +769,15 @@ mpegtsmux_create_streams (MpegTsMux * mux) } } - ts_data->prog = mux->programs[ts_data->prog_id]; + ts_data->prog = + g_hash_table_lookup (mux->programs, GINT_TO_POINTER (ts_data->prog_id)); if (ts_data->prog == NULL) { ts_data->prog = tsmux_program_new (mux->tsmux, ts_data->prog_id); if (ts_data->prog == NULL) goto no_program; tsmux_set_pmt_interval (ts_data->prog, mux->pmt_interval); - mux->programs[ts_data->prog_id] = ts_data->prog; + g_hash_table_insert (mux->programs, + GINT_TO_POINTER (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 eb8f935c1..e829a3177 100644 --- a/gst/mpegtsmux/mpegtsmux.h +++ b/gst/mpegtsmux/mpegtsmux.h @@ -112,7 +112,6 @@ G_BEGIN_DECLS #define NORMAL_TS_PACKET_LENGTH 188 #define M2TS_PACKET_LENGTH 192 -#define MAX_PROG_NUMBER 32 #define DEFAULT_PROG_ID 0 typedef struct MpegTsMux MpegTsMux; @@ -132,7 +131,7 @@ struct MpegTsMux { GstCollectPads *collect; TsMux *tsmux; - TsMuxProgram *programs[MAX_PROG_NUMBER]; + GHashTable *programs; /* properties */ gboolean m2ts_mode; @@ -205,9 +204,9 @@ struct MpegTsPadData { /* handler to free the private data */ MpegTsPadDataFreePrepareDataFunction free_func; - /* program id == idx to which it is attached to (not program pid) */ + /* program id to which it is attached to (not program pid) */ gint prog_id; - /* program this stream belongs to == mux->programs[prog_id] */ + /* program this stream belongs to */ TsMuxProgram *prog; gchar *language; |