mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
mpegtsparse/mpegtspacketizer: Register and use GQuark for structures.
This commit is contained in:
parent
d88af539f9
commit
fcc4f8388c
2 changed files with 165 additions and 72 deletions
|
@ -30,6 +30,39 @@
|
|||
GST_DEBUG_CATEGORY_STATIC (mpegts_packetizer_debug);
|
||||
#define GST_CAT_DEFAULT mpegts_packetizer_debug
|
||||
|
||||
static GQuark QUARK_PAT;
|
||||
static GQuark QUARK_TRANSPORT_STREAM_ID;
|
||||
static GQuark QUARK_PROGRAM_NUMBER;
|
||||
static GQuark QUARK_PID;
|
||||
static GQuark QUARK_PROGRAMS;
|
||||
|
||||
static GQuark QUARK_PMT;
|
||||
static GQuark QUARK_PCR_PID;
|
||||
static GQuark QUARK_VERSION_NUMBER;
|
||||
static GQuark QUARK_DESCRIPTORS;
|
||||
static GQuark QUARK_STREAM_TYPE;
|
||||
static GQuark QUARK_STREAMS;
|
||||
|
||||
static GQuark QUARK_NIT;
|
||||
static GQuark QUARK_NETWORK_ID;
|
||||
static GQuark QUARK_CURRENT_NEXT_INDICATOR;
|
||||
static GQuark QUARK_ACTUAL_NETWORK;
|
||||
static GQuark QUARK_NETWORK_NAME;
|
||||
static GQuark QUARK_TRANSPORT_STREAM_ID;
|
||||
static GQuark QUARK_ORIGINAL_NETWORK_ID;
|
||||
static GQuark QUARK_TRANSPORTS;
|
||||
|
||||
static GQuark QUARK_SDT;
|
||||
static GQuark QUARK_ACTUAL_TRANSPORT_STREAM;
|
||||
static GQuark QUARK_SERVICES;
|
||||
|
||||
static GQuark QUARK_EIT;
|
||||
static GQuark QUARK_SERVICE_ID;
|
||||
static GQuark QUARK_PRESENT_FOLLOWING;
|
||||
static GQuark QUARK_SEGMENT_LAST_SECTION_NUMBER;
|
||||
static GQuark QUARK_LAST_TABLE_ID;
|
||||
static GQuark QUARK_EVENTS;
|
||||
|
||||
static void _init_local (void);
|
||||
G_DEFINE_TYPE_EXTENDED (MpegTSPacketizer, mpegts_packetizer, G_TYPE_OBJECT, 0,
|
||||
_init_local ());
|
||||
|
@ -365,8 +398,8 @@ mpegts_packetizer_parse_pat (MpegTSPacketizer * packetizer,
|
|||
/* skip section_number and last_section_number */
|
||||
data += 2;
|
||||
|
||||
pat_info = gst_structure_new ("pat",
|
||||
"transport-stream-id", G_TYPE_UINT, transport_stream_id, NULL);
|
||||
pat_info = gst_structure_id_new (QUARK_PAT,
|
||||
QUARK_TRANSPORT_STREAM_ID, G_TYPE_UINT, transport_stream_id, NULL);
|
||||
g_value_init (&entries, GST_TYPE_LIST);
|
||||
/* stop at the CRC */
|
||||
end = GST_BUFFER_DATA (section->buffer) + GST_BUFFER_SIZE (section->buffer);
|
||||
|
@ -378,10 +411,10 @@ mpegts_packetizer_parse_pat (MpegTSPacketizer * packetizer,
|
|||
data += 2;
|
||||
|
||||
struct_name = g_strdup_printf ("program-%d", program_number);
|
||||
entry = gst_structure_new (struct_name,
|
||||
"program-number", G_TYPE_UINT, program_number,
|
||||
"pid", G_TYPE_UINT, pmt_pid, NULL);
|
||||
entry = gst_structure_new (struct_name, NULL);
|
||||
g_free (struct_name);
|
||||
gst_structure_id_set (entry, QUARK_PROGRAM_NUMBER, G_TYPE_UINT,
|
||||
program_number, QUARK_PID, G_TYPE_UINT, pmt_pid, NULL);
|
||||
|
||||
g_value_init (&value, GST_TYPE_STRUCTURE);
|
||||
g_value_take_boxed (&value, entry);
|
||||
|
@ -389,7 +422,7 @@ mpegts_packetizer_parse_pat (MpegTSPacketizer * packetizer,
|
|||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
gst_structure_set_value (pat_info, "programs", &entries);
|
||||
gst_structure_id_set_value (pat_info, QUARK_PROGRAMS, &entries);
|
||||
g_value_unset (&entries);
|
||||
|
||||
if (data != end - 4) {
|
||||
|
@ -452,12 +485,10 @@ mpegts_packetizer_parse_pmt (MpegTSPacketizer * packetizer,
|
|||
program_info_length = GST_READ_UINT16_BE (data) & 0x0FFF;
|
||||
data += 2;
|
||||
|
||||
struct_name = g_strdup ("pmt");
|
||||
pmt = gst_structure_new (struct_name,
|
||||
"program-number", G_TYPE_UINT, program_number,
|
||||
"pcr-pid", G_TYPE_UINT, pcr_pid,
|
||||
"version-number", G_TYPE_UINT, section->version_number, NULL);
|
||||
g_free (struct_name);
|
||||
pmt = gst_structure_id_new (QUARK_PMT,
|
||||
QUARK_PROGRAM_NUMBER, G_TYPE_UINT, program_number,
|
||||
QUARK_PCR_PID, G_TYPE_UINT, pcr_pid,
|
||||
QUARK_VERSION_NUMBER, G_TYPE_UINT, section->version_number, NULL);
|
||||
|
||||
if (program_info_length) {
|
||||
/* check that the buffer is large enough to contain at least
|
||||
|
@ -475,8 +506,8 @@ mpegts_packetizer_parse_pmt (MpegTSPacketizer * packetizer,
|
|||
goto error;
|
||||
}
|
||||
|
||||
gst_structure_set (pmt, "descriptors", G_TYPE_VALUE_ARRAY, descriptors,
|
||||
NULL);
|
||||
gst_structure_id_set (pmt, QUARK_DESCRIPTORS, G_TYPE_VALUE_ARRAY,
|
||||
descriptors, NULL);
|
||||
g_value_array_free (descriptors);
|
||||
}
|
||||
|
||||
|
@ -500,9 +531,11 @@ mpegts_packetizer_parse_pmt (MpegTSPacketizer * packetizer,
|
|||
}
|
||||
|
||||
struct_name = g_strdup_printf ("pid-%d", pid);
|
||||
stream_info = gst_structure_new (struct_name,
|
||||
"pid", G_TYPE_UINT, pid, "stream-type", G_TYPE_UINT, stream_type, NULL);
|
||||
stream_info = gst_structure_new (struct_name, NULL);
|
||||
g_free (struct_name);
|
||||
gst_structure_id_set (stream_info,
|
||||
QUARK_PID, G_TYPE_UINT, pid, QUARK_STREAM_TYPE, G_TYPE_UINT,
|
||||
stream_type, NULL);
|
||||
|
||||
if (stream_info_length) {
|
||||
/* check for AC3 descriptor */
|
||||
|
@ -563,8 +596,8 @@ mpegts_packetizer_parse_pmt (MpegTSPacketizer * packetizer,
|
|||
goto error;
|
||||
}
|
||||
|
||||
gst_structure_set (stream_info,
|
||||
"descriptors", G_TYPE_VALUE_ARRAY, descriptors, NULL);
|
||||
gst_structure_id_set (stream_info,
|
||||
QUARK_DESCRIPTORS, G_TYPE_VALUE_ARRAY, descriptors, NULL);
|
||||
g_value_array_free (descriptors);
|
||||
|
||||
}
|
||||
|
@ -575,7 +608,7 @@ mpegts_packetizer_parse_pmt (MpegTSPacketizer * packetizer,
|
|||
g_value_unset (&stream_value);
|
||||
}
|
||||
|
||||
gst_structure_set_value (pmt, "streams", &programs);
|
||||
gst_structure_id_set_value (pmt, QUARK_STREAMS, &programs);
|
||||
g_value_unset (&programs);
|
||||
|
||||
g_assert (data == end - 4);
|
||||
|
@ -636,11 +669,12 @@ mpegts_packetizer_parse_nit (MpegTSPacketizer * packetizer,
|
|||
descriptors_loop_length = GST_READ_UINT16_BE (data) & 0x0FFF;
|
||||
data += 2;
|
||||
|
||||
nit = gst_structure_new ("nit",
|
||||
"network-id", G_TYPE_UINT, network_id,
|
||||
"version-number", G_TYPE_UINT, section->version_number,
|
||||
"current-next-indicator", G_TYPE_UINT, section->current_next_indicator,
|
||||
"actual-network", G_TYPE_BOOLEAN, section->table_id == 0x40, NULL);
|
||||
nit = gst_structure_id_new (QUARK_NIT,
|
||||
QUARK_NETWORK_ID, G_TYPE_UINT, network_id,
|
||||
QUARK_VERSION_NUMBER, G_TYPE_UINT, section->version_number,
|
||||
QUARK_CURRENT_NEXT_INDICATOR, G_TYPE_UINT,
|
||||
section->current_next_indicator, QUARK_ACTUAL_NETWORK, G_TYPE_BOOLEAN,
|
||||
section->table_id == 0x40, NULL);
|
||||
|
||||
/* see if the buffer is large enough */
|
||||
if (descriptors_loop_length) {
|
||||
|
@ -667,8 +701,8 @@ mpegts_packetizer_parse_nit (MpegTSPacketizer * packetizer,
|
|||
|
||||
networkname_tmp =
|
||||
get_encoding_and_convert (networkname, networkname_length);
|
||||
gst_structure_set (nit, "network-name", G_TYPE_STRING, networkname_tmp,
|
||||
NULL);
|
||||
gst_structure_id_set (nit, QUARK_NETWORK_NAME, G_TYPE_STRING,
|
||||
networkname_tmp, NULL);
|
||||
g_free (networkname_tmp);
|
||||
}
|
||||
gst_mpeg_descriptor_free (mpegdescriptor);
|
||||
|
@ -681,8 +715,8 @@ mpegts_packetizer_parse_nit (MpegTSPacketizer * packetizer,
|
|||
goto error;
|
||||
}
|
||||
|
||||
gst_structure_set (nit, "descriptors", G_TYPE_VALUE_ARRAY, descriptors,
|
||||
NULL);
|
||||
gst_structure_id_set (nit, QUARK_DESCRIPTORS, G_TYPE_VALUE_ARRAY,
|
||||
descriptors, NULL);
|
||||
g_value_array_free (descriptors);
|
||||
}
|
||||
|
||||
|
@ -713,10 +747,11 @@ mpegts_packetizer_parse_nit (MpegTSPacketizer * packetizer,
|
|||
data += 2;
|
||||
|
||||
transport_name = g_strdup_printf ("transport-%d", transport_stream_id);
|
||||
transport = gst_structure_new (transport_name,
|
||||
"transport-stream-id", G_TYPE_UINT, transport_stream_id,
|
||||
"original-network-id", G_TYPE_UINT, original_network_id, NULL);
|
||||
transport = gst_structure_new (transport_name, NULL);
|
||||
g_free (transport_name);
|
||||
gst_structure_id_set (transport,
|
||||
QUARK_TRANSPORT_STREAM_ID, G_TYPE_UINT, transport_stream_id,
|
||||
QUARK_ORIGINAL_NETWORK_ID, G_TYPE_UINT, original_network_id, NULL);
|
||||
|
||||
if (descriptors_loop_length) {
|
||||
GstMPEGDescriptor *mpegdescriptor;
|
||||
|
@ -1183,7 +1218,7 @@ mpegts_packetizer_parse_nit (MpegTSPacketizer * packetizer,
|
|||
goto error;
|
||||
}
|
||||
|
||||
gst_structure_set (transport, "descriptors", G_TYPE_VALUE_ARRAY,
|
||||
gst_structure_id_set (transport, QUARK_DESCRIPTORS, G_TYPE_VALUE_ARRAY,
|
||||
descriptors, NULL);
|
||||
g_value_array_free (descriptors);
|
||||
}
|
||||
|
@ -1203,7 +1238,7 @@ mpegts_packetizer_parse_nit (MpegTSPacketizer * packetizer,
|
|||
goto error;
|
||||
}
|
||||
|
||||
gst_structure_set_value (nit, "transports", &transports);
|
||||
gst_structure_id_set_value (nit, QUARK_TRANSPORTS, &transports);
|
||||
g_value_unset (&transports);
|
||||
|
||||
GST_DEBUG ("NIT %" GST_PTR_FORMAT, nit);
|
||||
|
@ -1274,13 +1309,13 @@ mpegts_packetizer_parse_sdt (MpegTSPacketizer * packetizer,
|
|||
/* skip reserved byte */
|
||||
data += 1;
|
||||
|
||||
sdt = gst_structure_new ("sdt",
|
||||
"transport-stream-id", G_TYPE_UINT, transport_stream_id,
|
||||
"version-number", G_TYPE_UINT, section->version_number,
|
||||
"current-next-indicator", G_TYPE_UINT, section->current_next_indicator,
|
||||
"original-network-id", G_TYPE_UINT, original_network_id,
|
||||
"actual-transport-stream", G_TYPE_BOOLEAN, section->table_id == 0x42,
|
||||
NULL);
|
||||
sdt = gst_structure_id_new (QUARK_SDT,
|
||||
QUARK_TRANSPORT_STREAM_ID, G_TYPE_UINT, transport_stream_id,
|
||||
QUARK_VERSION_NUMBER, G_TYPE_UINT, section->version_number,
|
||||
QUARK_CURRENT_NEXT_INDICATOR, G_TYPE_UINT,
|
||||
section->current_next_indicator, QUARK_ORIGINAL_NETWORK_ID, G_TYPE_UINT,
|
||||
original_network_id, QUARK_ACTUAL_TRANSPORT_STREAM, G_TYPE_BOOLEAN,
|
||||
section->table_id == 0x42, NULL);
|
||||
|
||||
sdt_info_length = section->section_length - 8;
|
||||
g_value_init (&services, GST_TYPE_LIST);
|
||||
|
@ -1388,7 +1423,7 @@ mpegts_packetizer_parse_sdt (MpegTSPacketizer * packetizer,
|
|||
goto error;
|
||||
}
|
||||
|
||||
gst_structure_set (service, "descriptors", G_TYPE_VALUE_ARRAY,
|
||||
gst_structure_id_set (service, QUARK_DESCRIPTORS, G_TYPE_VALUE_ARRAY,
|
||||
descriptors, NULL);
|
||||
|
||||
g_value_array_free (descriptors);
|
||||
|
@ -1409,7 +1444,7 @@ mpegts_packetizer_parse_sdt (MpegTSPacketizer * packetizer,
|
|||
goto error;
|
||||
}
|
||||
|
||||
gst_structure_set_value (sdt, "services", &services);
|
||||
gst_structure_id_set_value (sdt, QUARK_SERVICES, &services);
|
||||
g_value_unset (&services);
|
||||
|
||||
return sdt;
|
||||
|
@ -1484,18 +1519,19 @@ mpegts_packetizer_parse_eit (MpegTSPacketizer * packetizer,
|
|||
last_table_id = *data;
|
||||
data += 1;
|
||||
|
||||
eit = gst_structure_new ("eit",
|
||||
"version-number", G_TYPE_UINT, section->version_number,
|
||||
"current-next-indicator", G_TYPE_UINT, section->current_next_indicator,
|
||||
"service-id", G_TYPE_UINT, service_id,
|
||||
"actual-transport-stream", G_TYPE_BOOLEAN, (section->table_id == 0x4E ||
|
||||
(section->table_id >= 0x50 && section->table_id <= 0x5F)),
|
||||
"present-following", G_TYPE_BOOLEAN, (section->table_id == 0x4E ||
|
||||
section->table_id == 0x4F),
|
||||
"transport-stream-id", G_TYPE_UINT, transport_stream_id,
|
||||
"original-network-id", G_TYPE_UINT, original_network_id,
|
||||
"segment-last-section-number", G_TYPE_UINT, segment_last_section_number,
|
||||
"last-table-id", G_TYPE_UINT, last_table_id, NULL);
|
||||
eit = gst_structure_id_new (QUARK_EIT,
|
||||
QUARK_VERSION_NUMBER, G_TYPE_UINT, section->version_number,
|
||||
QUARK_CURRENT_NEXT_INDICATOR, G_TYPE_UINT,
|
||||
section->current_next_indicator, QUARK_SERVICE_ID, G_TYPE_UINT,
|
||||
service_id, QUARK_ACTUAL_TRANSPORT_STREAM, G_TYPE_BOOLEAN,
|
||||
(section->table_id == 0x4E || (section->table_id >= 0x50
|
||||
&& section->table_id <= 0x5F)), QUARK_PRESENT_FOLLOWING,
|
||||
G_TYPE_BOOLEAN, (section->table_id == 0x4E
|
||||
|| section->table_id == 0x4F), QUARK_TRANSPORT_STREAM_ID, G_TYPE_UINT,
|
||||
transport_stream_id, QUARK_ORIGINAL_NETWORK_ID, G_TYPE_UINT,
|
||||
original_network_id, QUARK_SEGMENT_LAST_SECTION_NUMBER, G_TYPE_UINT,
|
||||
segment_last_section_number, QUARK_LAST_TABLE_ID, G_TYPE_UINT,
|
||||
last_table_id, NULL);
|
||||
|
||||
g_value_init (&events, GST_TYPE_LIST);
|
||||
while (data < end - 4) {
|
||||
|
@ -1850,8 +1886,8 @@ mpegts_packetizer_parse_eit (MpegTSPacketizer * packetizer,
|
|||
g_value_array_free (descriptors);
|
||||
goto error;
|
||||
}
|
||||
gst_structure_set (event, "descriptors", G_TYPE_VALUE_ARRAY, descriptors,
|
||||
NULL);
|
||||
gst_structure_id_set (event, QUARK_DESCRIPTORS, G_TYPE_VALUE_ARRAY,
|
||||
descriptors, NULL);
|
||||
g_value_array_free (descriptors);
|
||||
}
|
||||
|
||||
|
@ -1868,7 +1904,7 @@ mpegts_packetizer_parse_eit (MpegTSPacketizer * packetizer,
|
|||
goto error;
|
||||
}
|
||||
|
||||
gst_structure_set_value (eit, "events", &events);
|
||||
gst_structure_id_set_value (eit, QUARK_EVENTS, &events);
|
||||
g_value_unset (&events);
|
||||
|
||||
GST_DEBUG ("EIT %" GST_PTR_FORMAT, eit);
|
||||
|
@ -2092,6 +2128,41 @@ _init_local ()
|
|||
{
|
||||
GST_DEBUG_CATEGORY_INIT (mpegts_packetizer_debug, "mpegtspacketizer", 0,
|
||||
"MPEG transport stream parser");
|
||||
|
||||
QUARK_PAT = g_quark_from_string ("pat");
|
||||
QUARK_TRANSPORT_STREAM_ID = g_quark_from_string ("transport-stream-id");
|
||||
QUARK_PROGRAM_NUMBER = g_quark_from_string ("program-number");
|
||||
QUARK_PID = g_quark_from_string ("pid");
|
||||
QUARK_PROGRAMS = g_quark_from_string ("programs");
|
||||
|
||||
QUARK_PMT = g_quark_from_string ("pmt");
|
||||
QUARK_PCR_PID = g_quark_from_string ("pcr-pid");
|
||||
QUARK_VERSION_NUMBER = g_quark_from_string ("version-number");
|
||||
QUARK_DESCRIPTORS = g_quark_from_string ("descriptors");
|
||||
QUARK_STREAM_TYPE = g_quark_from_string ("stream-type");
|
||||
QUARK_STREAMS = g_quark_from_string ("streams");
|
||||
|
||||
QUARK_NIT = g_quark_from_string ("nit");
|
||||
QUARK_NETWORK_ID = g_quark_from_string ("network-id");
|
||||
QUARK_CURRENT_NEXT_INDICATOR = g_quark_from_string ("current-next-indicator");
|
||||
QUARK_ACTUAL_NETWORK = g_quark_from_string ("actual-network");
|
||||
QUARK_NETWORK_NAME = g_quark_from_string ("network-name");
|
||||
QUARK_TRANSPORT_STREAM_ID = g_quark_from_string ("transport-stream-id");
|
||||
QUARK_ORIGINAL_NETWORK_ID = g_quark_from_string ("original-network-id");
|
||||
QUARK_TRANSPORTS = g_quark_from_string ("transports");
|
||||
|
||||
QUARK_SDT = g_quark_from_string ("sdt");
|
||||
QUARK_ACTUAL_TRANSPORT_STREAM =
|
||||
g_quark_from_string ("actual-transport-stream");
|
||||
QUARK_SERVICES = g_quark_from_string ("services");
|
||||
|
||||
QUARK_EIT = g_quark_from_string ("eit");
|
||||
QUARK_SERVICE_ID = g_quark_from_string ("service-id");
|
||||
QUARK_PRESENT_FOLLOWING = g_quark_from_string ("present-following");
|
||||
QUARK_SEGMENT_LAST_SECTION_NUMBER =
|
||||
g_quark_from_string ("segment-last-section-number");
|
||||
QUARK_LAST_TABLE_ID = g_quark_from_string ("last-table-id");
|
||||
QUARK_EVENTS = g_quark_from_string ("events");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -75,6 +75,13 @@ struct _MpegTSParsePad
|
|||
GstFlowReturn flow_return;
|
||||
};
|
||||
|
||||
static GQuark QUARK_PROGRAMS;
|
||||
static GQuark QUARK_PROGRAM_NUMBER;
|
||||
static GQuark QUARK_PID;
|
||||
static GQuark QUARK_PCR_PID;
|
||||
static GQuark QUARK_STREAMS;
|
||||
static GQuark QUARK_STREAM_TYPE;
|
||||
|
||||
static GstElementDetails mpegts_parse_details =
|
||||
GST_ELEMENT_DETAILS ("MPEG transport stream parser",
|
||||
"Codec/Parser",
|
||||
|
@ -134,8 +141,10 @@ static gboolean mpegts_parse_sink_event (GstPad * pad, GstEvent * event);
|
|||
static GstStateChangeReturn mpegts_parse_change_state (GstElement * element,
|
||||
GstStateChange transition);
|
||||
static gboolean mpegts_parse_src_pad_query (GstPad * pad, GstQuery * query);
|
||||
static void _extra_init (GType type);
|
||||
|
||||
GST_BOILERPLATE (MpegTSParse, mpegts_parse, GstElement, GST_TYPE_ELEMENT);
|
||||
GST_BOILERPLATE_FULL (MpegTSParse, mpegts_parse, GstElement, GST_TYPE_ELEMENT,
|
||||
_extra_init);
|
||||
|
||||
static const guint32 crc_tab[256] = {
|
||||
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
|
||||
|
@ -196,6 +205,17 @@ mpegts_parse_calc_crc32 (guint8 * data, guint datalen)
|
|||
return crc;
|
||||
}
|
||||
|
||||
static void
|
||||
_extra_init (GType type)
|
||||
{
|
||||
QUARK_PROGRAMS = g_quark_from_string ("programs");
|
||||
QUARK_PROGRAM_NUMBER = g_quark_from_string ("program-number");
|
||||
QUARK_PID = g_quark_from_string ("pid");
|
||||
QUARK_PCR_PID = g_quark_from_string ("pcr-pid");
|
||||
QUARK_STREAMS = g_quark_from_string ("streams");
|
||||
QUARK_STREAM_TYPE = g_quark_from_string ("stream-type");
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_parse_base_init (gpointer klass)
|
||||
{
|
||||
|
@ -564,13 +584,13 @@ mpegts_parse_deactivate_pmt (MpegTSParse * parse, MpegTSParseProgram * program)
|
|||
const GValue *value;
|
||||
|
||||
if (program->pmt_info) {
|
||||
streams = gst_structure_get_value (program->pmt_info, "streams");
|
||||
streams = gst_structure_id_get_value (program->pmt_info, QUARK_STREAMS);
|
||||
|
||||
for (i = 0; i < gst_value_list_get_size (streams); ++i) {
|
||||
value = gst_value_list_get_value (streams, i);
|
||||
stream = g_value_get_boxed (value);
|
||||
gst_structure_get_uint (stream, "pid", &pid);
|
||||
gst_structure_get_uint (stream, "stream-type", &stream_type);
|
||||
gst_structure_id_get (stream, QUARK_PID, G_TYPE_UINT, &pid,
|
||||
QUARK_STREAM_TYPE, G_TYPE_UINT, &stream_type, NULL);
|
||||
mpegts_parse_program_remove_stream (parse, program, (guint16) pid);
|
||||
g_hash_table_remove (parse->pes_pids, GINT_TO_POINTER ((gint) pid));
|
||||
}
|
||||
|
@ -900,14 +920,14 @@ mpegts_parse_apply_pat (MpegTSParse * parse, GstStructure * pat_info)
|
|||
gst_structure_copy (pat_info)));
|
||||
|
||||
GST_OBJECT_LOCK (parse);
|
||||
programs = gst_structure_get_value (pat_info, "programs");
|
||||
programs = gst_structure_id_get_value (pat_info, QUARK_PROGRAMS);
|
||||
/* activate the new table */
|
||||
for (i = 0; i < gst_value_list_get_size (programs); ++i) {
|
||||
value = gst_value_list_get_value (programs, i);
|
||||
|
||||
program_info = g_value_get_boxed (value);
|
||||
gst_structure_get_uint (program_info, "program-number", &program_number);
|
||||
gst_structure_get_uint (program_info, "pid", &pid);
|
||||
gst_structure_id_get (program_info, QUARK_PROGRAM_NUMBER, G_TYPE_UINT,
|
||||
&program_number, QUARK_PID, G_TYPE_UINT, &pid, NULL);
|
||||
|
||||
program = mpegts_parse_get_program (parse, program_number);
|
||||
if (program) {
|
||||
|
@ -936,13 +956,14 @@ mpegts_parse_apply_pat (MpegTSParse * parse, GstStructure * pat_info)
|
|||
if (old_pat) {
|
||||
/* deactivate the old table */
|
||||
|
||||
programs = gst_structure_get_value (old_pat, "programs");
|
||||
programs = gst_structure_id_get_value (old_pat, QUARK_PROGRAMS);
|
||||
for (i = 0; i < gst_value_list_get_size (programs); ++i) {
|
||||
value = gst_value_list_get_value (programs, i);
|
||||
|
||||
program_info = g_value_get_boxed (value);
|
||||
gst_structure_get_uint (program_info, "program-number", &program_number);
|
||||
gst_structure_get_uint (program_info, "pid", &pid);
|
||||
gst_structure_id_get (program_info,
|
||||
QUARK_PROGRAM_NUMBER, G_TYPE_UINT, &program_number,
|
||||
QUARK_PID, G_TYPE_UINT, &pid, NULL);
|
||||
|
||||
program = mpegts_parse_get_program (parse, program_number);
|
||||
if (program == NULL) {
|
||||
|
@ -990,9 +1011,10 @@ mpegts_parse_apply_pmt (MpegTSParse * parse,
|
|||
const GValue *new_streams;
|
||||
const GValue *value;
|
||||
|
||||
gst_structure_get_uint (pmt_info, "program-number", &program_number);
|
||||
gst_structure_get_uint (pmt_info, "pcr-pid", &pcr_pid);
|
||||
new_streams = gst_structure_get_value (pmt_info, "streams");
|
||||
gst_structure_id_get (pmt_info,
|
||||
QUARK_PROGRAM_NUMBER, G_TYPE_UINT, &program_number,
|
||||
QUARK_PCR_PID, G_TYPE_UINT, &pcr_pid, NULL);
|
||||
new_streams = gst_structure_id_get_value (pmt_info, QUARK_STREAMS);
|
||||
|
||||
GST_OBJECT_LOCK (parse);
|
||||
program = mpegts_parse_get_program (parse, program_number);
|
||||
|
@ -1021,8 +1043,8 @@ mpegts_parse_apply_pmt (MpegTSParse * parse,
|
|||
value = gst_value_list_get_value (new_streams, i);
|
||||
stream = g_value_get_boxed (value);
|
||||
|
||||
gst_structure_get_uint (stream, "pid", &pid);
|
||||
gst_structure_get_uint (stream, "stream-type", &stream_type);
|
||||
gst_structure_id_get (stream, QUARK_PID, G_TYPE_UINT, &pid,
|
||||
QUARK_STREAM_TYPE, G_TYPE_UINT, &stream_type, NULL);
|
||||
mpegts_parse_program_add_stream (parse, program,
|
||||
(guint16) pid, (guint8) stream_type);
|
||||
g_hash_table_insert (parse->pes_pids, GINT_TO_POINTER ((gint) pid),
|
||||
|
|
Loading…
Reference in a new issue