mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
tsdemux: Add new API for fetching extended descriptors
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1555>
This commit is contained in:
parent
e2d88f0569
commit
5269777a97
5 changed files with 61 additions and 4 deletions
|
@ -988,6 +988,38 @@ gst_mpegts_find_descriptor (GPtrArray * descriptors, guint8 tag)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_mpegts_find_descriptor_with_extension:
|
||||
* @descriptors: (element-type GstMpegtsDescriptor) (transfer none): an array
|
||||
* of #GstMpegtsDescriptor
|
||||
* @tag: the tag to look for
|
||||
*
|
||||
* Finds the first descriptor of type @tag with @tag_extension in the array.
|
||||
*
|
||||
* Note: To look for descriptors that can be present more than once in an
|
||||
* array of descriptors, iterate the #GArray manually.
|
||||
*
|
||||
* Returns: (transfer none): the first descriptor matchin @tag with @tag_extension, else %NULL.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
const GstMpegtsDescriptor *
|
||||
gst_mpegts_find_descriptor_with_extension (GPtrArray * descriptors, guint8 tag,
|
||||
guint8 tag_extension)
|
||||
{
|
||||
guint i, nb_desc;
|
||||
|
||||
g_return_val_if_fail (descriptors != NULL, NULL);
|
||||
|
||||
nb_desc = descriptors->len;
|
||||
for (i = 0; i < nb_desc; i++) {
|
||||
GstMpegtsDescriptor *desc = g_ptr_array_index (descriptors, i);
|
||||
if ((desc->tag == tag) && (desc->tag_extension == tag_extension))
|
||||
return (const GstMpegtsDescriptor *) desc;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* GST_MTS_DESC_REGISTRATION (0x05) */
|
||||
/**
|
||||
* gst_mpegts_descriptor_from_registration:
|
||||
|
|
|
@ -274,6 +274,10 @@ GST_MPEGTS_API
|
|||
const GstMpegtsDescriptor * gst_mpegts_find_descriptor (GPtrArray *descriptors,
|
||||
guint8 tag);
|
||||
|
||||
GST_MPEGTS_API
|
||||
const GstMpegtsDescriptor * gst_mpegts_find_descriptor_with_extension (GPtrArray *descriptors,
|
||||
guint8 tag, guint8 tag_extension);
|
||||
|
||||
/* GST_MTS_DESC_REGISTRATION (0x05) */
|
||||
|
||||
GST_MPEGTS_API
|
||||
|
@ -375,6 +379,12 @@ GST_MPEGTS_API
|
|||
GstMpegtsDescriptor *
|
||||
gst_mpegts_descriptor_from_custom (guint8 tag, const guint8 *data, gsize length);
|
||||
|
||||
|
||||
/**
|
||||
* gst_mpegts_descriptor_from_custom_with_extension:
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
GST_MPEGTS_API
|
||||
GstMpegtsDescriptor *
|
||||
gst_mpegts_descriptor_from_custom_with_extension (guint8 tag, guint8 tag_extension, const guint8 *data, gsize length);
|
||||
|
|
|
@ -325,6 +325,20 @@ mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag)
|
|||
return gst_mpegts_find_descriptor (pmt->descriptors, tag);
|
||||
}
|
||||
|
||||
const GstMpegtsDescriptor *
|
||||
mpegts_get_descriptor_from_stream_with_extension (MpegTSBaseStream * stream,
|
||||
guint8 tag, guint8 tag_extension)
|
||||
{
|
||||
GstMpegtsPMTStream *pmt = stream->stream;
|
||||
|
||||
GST_DEBUG ("Searching for tag 0x%02x tag_extension 0x%02x "
|
||||
"in stream 0x%04x (stream_type 0x%02x)",
|
||||
tag, tag_extension, stream->pid, stream->stream_type);
|
||||
|
||||
return gst_mpegts_find_descriptor_with_extension (pmt->descriptors, tag,
|
||||
tag_extension);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gboolean res;
|
||||
|
|
|
@ -234,6 +234,8 @@ G_GNUC_INTERNAL MpegTSBaseProgram *mpegts_base_get_program (MpegTSBase * base, g
|
|||
G_GNUC_INTERNAL MpegTSBaseProgram *mpegts_base_add_program (MpegTSBase * base, gint program_number, guint16 pmt_pid);
|
||||
|
||||
G_GNUC_INTERNAL const GstMpegtsDescriptor *mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag);
|
||||
G_GNUC_INTERNAL const GstMpegtsDescriptor *mpegts_get_descriptor_from_stream_with_extension (MpegTSBaseStream * stream,
|
||||
guint8 tag, guint8 tag_extension);
|
||||
G_GNUC_INTERNAL const GstMpegtsDescriptor *mpegts_get_descriptor_from_program (MpegTSBaseProgram * program, guint8 tag);
|
||||
|
||||
G_GNUC_INTERNAL gboolean
|
||||
|
|
|
@ -1266,10 +1266,9 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream,
|
|||
* types also, depending on registratino descriptors also
|
||||
*/
|
||||
|
||||
desc =
|
||||
mpegts_get_descriptor_from_stream (bstream,
|
||||
GST_MTS_DESC_DVB_EXTENSION);
|
||||
if (desc != NULL && desc->tag_extension == GST_MTS_DESC_EXT_DVB_AC4) {
|
||||
desc = mpegts_get_descriptor_from_stream_with_extension (bstream,
|
||||
GST_MTS_DESC_DVB_EXTENSION, GST_MTS_DESC_EXT_DVB_AC4);
|
||||
if (desc) {
|
||||
GST_LOG ("ac4 audio");
|
||||
is_audio = TRUE;
|
||||
caps = gst_caps_new_empty_simple ("audio/x-ac4");
|
||||
|
|
Loading…
Reference in a new issue