tsdemux: Return descriptor in get_descriptor

https://bugzilla.gnome.org/show_bug.cgi?id=709180
This commit is contained in:
Jesper Larsen 2013-10-05 14:45:32 +02:00 committed by Edward Hervey
parent 7cb434e42f
commit 279bdef4ea
3 changed files with 12 additions and 23 deletions

View file

@ -278,20 +278,15 @@ mpegts_base_finalize (GObject * object)
/* returns NULL if no matching descriptor found * /* returns NULL if no matching descriptor found *
* otherwise returns a descriptor that needs to * * otherwise returns a descriptor that needs to *
* be freed */ * be freed */
/* FIXME : Return the GstMpegTsDescriptor */ const GstMpegTsDescriptor *
const guint8 *
mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag) mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag)
{ {
const GstMpegTsDescriptor *desc;
GstMpegTsPMTStream *pmt = stream->stream; GstMpegTsPMTStream *pmt = stream->stream;
GST_DEBUG ("Searching for tag 0x%02x in stream 0x%04x (stream_type 0x%02x)", GST_DEBUG ("Searching for tag 0x%02x in stream 0x%04x (stream_type 0x%02x)",
tag, stream->pid, stream->stream_type); tag, stream->pid, stream->stream_type);
desc = gst_mpegts_find_descriptor (pmt->descriptors, tag); return gst_mpegts_find_descriptor (pmt->descriptors, tag);
if (desc)
return desc->data;
return NULL;
} }
typedef struct typedef struct
@ -326,18 +321,12 @@ mpegts_pid_in_active_programs (MpegTSBase * base, guint16 pid)
/* returns NULL if no matching descriptor found * /* returns NULL if no matching descriptor found *
* otherwise returns a descriptor that needs to * * otherwise returns a descriptor that needs to *
* be freed */ * be freed */
/* FIXME : Return the GstMpegTsDescriptor */ const GstMpegTsDescriptor *
const guint8 *
mpegts_get_descriptor_from_program (MpegTSBaseProgram * program, guint8 tag) mpegts_get_descriptor_from_program (MpegTSBaseProgram * program, guint8 tag)
{ {
const GstMpegTsDescriptor *descriptor;
const GstMpegTsPMT *pmt = program->pmt; const GstMpegTsPMT *pmt = program->pmt;
descriptor = gst_mpegts_find_descriptor (pmt->descriptors, tag); return gst_mpegts_find_descriptor (pmt->descriptors, tag);
if (descriptor)
return descriptor->data;
return NULL;
} }
static MpegTSBaseProgram * static MpegTSBaseProgram *

View file

@ -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_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 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 GstMpegTsDescriptor *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_program (MpegTSBaseProgram * program, guint8 tag);
G_GNUC_INTERNAL gboolean G_GNUC_INTERNAL gboolean
mpegts_base_handle_seek_event(MpegTSBase * base, GstPad * pad, GstEvent * event); mpegts_base_handle_seek_event(MpegTSBase * base, GstPad * pad, GstEvent * event);

View file

@ -677,7 +677,7 @@ static void
gst_ts_demux_create_tags (TSDemuxStream * stream) gst_ts_demux_create_tags (TSDemuxStream * stream)
{ {
MpegTSBaseStream *bstream = (MpegTSBaseStream *) stream; MpegTSBaseStream *bstream = (MpegTSBaseStream *) stream;
const guint8 *desc = NULL; const GstMpegTsDescriptor *desc = NULL;
int i; int i;
desc = desc =
@ -694,13 +694,13 @@ gst_ts_demux_create_tags (TSDemuxStream * stream)
if (!stream->taglist) if (!stream->taglist)
stream->taglist = gst_tag_list_new_empty (); 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; const gchar *lc;
gchar lang_code[4]; gchar lang_code[4];
gchar *language_n; gchar *language_n;
language_n = (gchar *) 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 /* Language codes should be 3 character long, we allow
* a bit more flexibility by allowing 2 characters. */ * a bit more flexibility by allowing 2 characters. */
@ -731,7 +731,7 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream,
gchar *name = NULL; gchar *name = NULL;
GstCaps *caps = NULL; GstCaps *caps = NULL;
GstPadTemplate *template = NULL; GstPadTemplate *template = NULL;
const guint8 *desc = NULL; const GstMpegTsDescriptor *desc = NULL;
GstPad *pad = NULL; GstPad *pad = NULL;
gst_ts_demux_create_tags (stream); gst_ts_demux_create_tags (stream);
@ -745,13 +745,13 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream,
switch (bstream->stream_type) { switch (bstream->stream_type) {
case ST_BD_AUDIO_AC3: case ST_BD_AUDIO_AC3:
{ {
const guint8 *ac3_desc; const GstMpegTsDescriptor *ac3_desc;
/* ATSC ac3 audio descriptor */ /* ATSC ac3 audio descriptor */
ac3_desc = ac3_desc =
mpegts_get_descriptor_from_stream (bstream, mpegts_get_descriptor_from_stream (bstream,
GST_MTS_DESC_AC3_AUDIO_STREAM); 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"); GST_LOG ("ac3 audio");
template = gst_static_pad_template_get (&audio_template); template = gst_static_pad_template_get (&audio_template);
name = g_strdup_printf ("audio_%04x", bstream->pid); name = g_strdup_printf ("audio_%04x", bstream->pid);