diff options
author | Zaheer Abbas Merali <zaheerabbas@merali.org> | 2008-04-29 09:02:35 +0000 |
---|---|---|
committer | Zaheer Abbas Merali <zaheerabbas@merali.org> | 2008-04-29 09:02:35 +0000 |
commit | 63fae1c4bb8b0f2d317bd39c71cc77a319224c7a (patch) | |
tree | 79ae1a2a504cc5d65253a2e2927f6abe8aae572c /gst/mpegtsparse/mpegtsparse.c | |
parent | 625a222f06d943aba5bbb14456bce9d2944ea827 (diff) | |
download | gst-plugins-bad-63fae1c4bb8b0f2d317bd39c71cc77a319224c7a.tar.gz gst-plugins-bad-63fae1c4bb8b0f2d317bd39c71cc77a319224c7a.tar.bz2 gst-plugins-bad-63fae1c4bb8b0f2d317bd39c71cc77a319224c7a.zip |
gst/mpegtsparse/: Detect SI pids (NIT, SDT, EIT etc.) based on table id and not by pid number. This allows for exampl...
Original commit message from CVS:
* gst/mpegtsparse/mpegtspacketizer.c:
* gst/mpegtsparse/mpegtspacketizer.h:
* gst/mpegtsparse/mpegtsparse.c:
Detect SI pids (NIT, SDT, EIT etc.) based on table id and not
by pid number. This allows for example the EPG data from UK's
freesat to be picked up.
Diffstat (limited to 'gst/mpegtsparse/mpegtsparse.c')
-rw-r--r-- | gst/mpegtsparse/mpegtsparse.c | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/gst/mpegtsparse/mpegtsparse.c b/gst/mpegtsparse/mpegtsparse.c index d047f36a..77f65f00 100644 --- a/gst/mpegtsparse/mpegtsparse.c +++ b/gst/mpegtsparse/mpegtsparse.c @@ -33,6 +33,8 @@ /* latency in mseconds */ #define TS_LATENCY 700 +#define TABLE_ID_UNSET 0xFF + GST_DEBUG_CATEGORY_STATIC (mpegts_parse_debug); #define GST_CAT_DEFAULT mpegts_parse_debug @@ -247,18 +249,6 @@ mpegts_parse_reset (MpegTSParse * parse) g_hash_table_insert (parse->psi_pids, GINT_TO_POINTER (0), GINT_TO_POINTER (1)); - /* NIT */ - g_hash_table_insert (parse->psi_pids, - GINT_TO_POINTER (0x10), GINT_TO_POINTER (1)); - - /* SDT */ - g_hash_table_insert (parse->psi_pids, - GINT_TO_POINTER (0x11), GINT_TO_POINTER (1)); - - /* EIT */ - g_hash_table_insert (parse->psi_pids, - GINT_TO_POINTER (0x12), GINT_TO_POINTER (1)); - /* pmt pids will be added and removed dynamically */ } @@ -790,10 +780,53 @@ mpegts_parse_push (MpegTSParse * parse, MpegTSPacketizerPacket * packet, } static gboolean -mpegts_parse_is_psi_pid (MpegTSParse * parse, guint16 pid) +mpegts_parse_is_psi (MpegTSParse * parse, MpegTSPacketizerPacket * packet) { - return g_hash_table_lookup (parse->psi_pids, - GINT_TO_POINTER ((gint) pid)) != NULL; + gboolean retval = FALSE; + guint8 table_id; + int i; + guint8 si_tables[] = { 0x00, 0x01, 0x02, 0x03, 0x40, 0x41, 0x42, 0x46, 0x4A, + 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, + 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, + 0x72, 0x73, 0x7E, 0x7F, TABLE_ID_UNSET + }; + if (g_hash_table_lookup (parse->psi_pids, + GINT_TO_POINTER ((gint) packet->pid)) != NULL) + retval = TRUE; + if (!retval) { + if (packet->payload_unit_start_indicator) { + table_id = *(packet->data); + i = 0; + while (si_tables[i] != TABLE_ID_UNSET) { + if (si_tables[i] == table_id) { + retval = TRUE; + break; + } + i++; + } + } else { + MpegTSPacketizerStream *stream = (MpegTSPacketizerStream *) + g_hash_table_lookup (parse->packetizer->streams, + GINT_TO_POINTER ((gint) packet->pid)); + + if (stream) { + i = 0; + GST_DEBUG_OBJECT (parse, "section table id: 0x%x", + stream->section_table_id); + while (si_tables[i] != TABLE_ID_UNSET) { + if (si_tables[i] == stream->section_table_id) { + retval = TRUE; + break; + } + i++; + } + } + } + } + GST_DEBUG_OBJECT (parse, "Packet of pid 0x%x is psi: %d", packet->pid, + retval); + return retval; } static void @@ -1152,7 +1185,7 @@ mpegts_parse_chain (GstPad * pad, GstBuffer * buf) goto next; /* parse PSI data */ - if (packet.payload != NULL && mpegts_parse_is_psi_pid (parse, packet.pid)) { + if (packet.payload != NULL && mpegts_parse_is_psi (parse, &packet)) { MpegTSPacketizerSection section; parsed = mpegts_packetizer_push_section (packetizer, &packet, §ion); |