From 279bdef4ea5c16ff1c0e4b291bc50f10b866e429 Mon Sep 17 00:00:00 2001 From: Jesper Larsen Date: Sat, 5 Oct 2013 14:45:32 +0200 Subject: [PATCH] tsdemux: Return descriptor in get_descriptor https://bugzilla.gnome.org/show_bug.cgi?id=709180 --- gst/mpegtsdemux/mpegtsbase.c | 19 ++++--------------- gst/mpegtsdemux/mpegtsbase.h | 4 ++-- gst/mpegtsdemux/tsdemux.c | 12 ++++++------ 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c index c817e228dd..626bb41f5c 100644 --- a/gst/mpegtsdemux/mpegtsbase.c +++ b/gst/mpegtsdemux/mpegtsbase.c @@ -278,20 +278,15 @@ mpegts_base_finalize (GObject * object) /* returns NULL if no matching descriptor found * * otherwise returns a descriptor that needs to * * be freed */ -/* FIXME : Return the GstMpegTsDescriptor */ -const guint8 * +const GstMpegTsDescriptor * mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag) { - const GstMpegTsDescriptor *desc; GstMpegTsPMTStream *pmt = stream->stream; GST_DEBUG ("Searching for tag 0x%02x in stream 0x%04x (stream_type 0x%02x)", tag, stream->pid, stream->stream_type); - desc = gst_mpegts_find_descriptor (pmt->descriptors, tag); - if (desc) - return desc->data; - return NULL; + return gst_mpegts_find_descriptor (pmt->descriptors, tag); } typedef struct @@ -326,18 +321,12 @@ mpegts_pid_in_active_programs (MpegTSBase * base, guint16 pid) /* returns NULL if no matching descriptor found * * otherwise returns a descriptor that needs to * * be freed */ -/* FIXME : Return the GstMpegTsDescriptor */ -const guint8 * +const GstMpegTsDescriptor * mpegts_get_descriptor_from_program (MpegTSBaseProgram * program, guint8 tag) { - const GstMpegTsDescriptor *descriptor; const GstMpegTsPMT *pmt = program->pmt; - descriptor = gst_mpegts_find_descriptor (pmt->descriptors, tag); - if (descriptor) - return descriptor->data; - - return NULL; + return gst_mpegts_find_descriptor (pmt->descriptors, tag); } static MpegTSBaseProgram * diff --git a/gst/mpegtsdemux/mpegtsbase.h b/gst/mpegtsdemux/mpegtsbase.h index 3466649130..d0dd780988 100644 --- a/gst/mpegtsdemux/mpegtsbase.h +++ b/gst/mpegtsdemux/mpegtsbase.h @@ -210,8 +210,8 @@ G_GNUC_INTERNAL GType mpegts_base_get_type(void); G_GNUC_INTERNAL MpegTSBaseProgram *mpegts_base_get_program (MpegTSBase * base, gint program_number); G_GNUC_INTERNAL MpegTSBaseProgram *mpegts_base_add_program (MpegTSBase * base, gint program_number, guint16 pmt_pid); -G_GNUC_INTERNAL const guint8 *mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag); -G_GNUC_INTERNAL const guint8 *mpegts_get_descriptor_from_program (MpegTSBaseProgram * program, guint8 tag); +G_GNUC_INTERNAL const GstMpegTsDescriptor *mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag); +G_GNUC_INTERNAL const GstMpegTsDescriptor *mpegts_get_descriptor_from_program (MpegTSBaseProgram * program, guint8 tag); G_GNUC_INTERNAL gboolean mpegts_base_handle_seek_event(MpegTSBase * base, GstPad * pad, GstEvent * event); diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index ec3d67cf7e..b6a125c633 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -677,7 +677,7 @@ static void gst_ts_demux_create_tags (TSDemuxStream * stream) { MpegTSBaseStream *bstream = (MpegTSBaseStream *) stream; - const guint8 *desc = NULL; + const GstMpegTsDescriptor *desc = NULL; int i; desc = @@ -694,13 +694,13 @@ gst_ts_demux_create_tags (TSDemuxStream * stream) if (!stream->taglist) stream->taglist = gst_tag_list_new_empty (); - for (i = 0; i < DESC_ISO_639_LANGUAGE_codes_n (desc); i++) { + for (i = 0; i < DESC_ISO_639_LANGUAGE_codes_n (desc->data); i++) { const gchar *lc; gchar lang_code[4]; gchar *language_n; language_n = (gchar *) - DESC_ISO_639_LANGUAGE_language_code_nth (desc, i); + DESC_ISO_639_LANGUAGE_language_code_nth (desc->data, i); /* Language codes should be 3 character long, we allow * a bit more flexibility by allowing 2 characters. */ @@ -731,7 +731,7 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, gchar *name = NULL; GstCaps *caps = NULL; GstPadTemplate *template = NULL; - const guint8 *desc = NULL; + const GstMpegTsDescriptor *desc = NULL; GstPad *pad = NULL; gst_ts_demux_create_tags (stream); @@ -745,13 +745,13 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, switch (bstream->stream_type) { case ST_BD_AUDIO_AC3: { - const guint8 *ac3_desc; + const GstMpegTsDescriptor *ac3_desc; /* ATSC ac3 audio descriptor */ ac3_desc = mpegts_get_descriptor_from_stream (bstream, GST_MTS_DESC_AC3_AUDIO_STREAM); - if (ac3_desc && DESC_AC_AUDIO_STREAM_bsid (ac3_desc) != 16) { + if (ac3_desc && DESC_AC_AUDIO_STREAM_bsid (ac3_desc->data) != 16) { GST_LOG ("ac3 audio"); template = gst_static_pad_template_get (&audio_template); name = g_strdup_printf ("audio_%04x", bstream->pid);