summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@collabora.com>2013-07-26 07:53:06 +0200
committerEdward Hervey <edward@collabora.com>2013-07-26 08:17:17 +0200
commit8c60e420700bc121166c59f991d33cea6cd15205 (patch)
treef44732c642b80dd694bb0f6ff6f90355012ae780
parent3b6825a5465bddce5e48965370e74a8e9bf01db8 (diff)
mpegtsdemux: Add more flag debugging for PES and TS packets
Helps with debugging issues. And also remove unused variable (opcr) This will also allow us in the future to properly detect: * random-access location (to enable keyframe observation and potentially seeking * discont location (to properly handle resets) * splice location (to properly handle new stream changes)
-rw-r--r--gst/mpegtsdemux/mpegtspacketizer.c44
-rw-r--r--gst/mpegtsdemux/mpegtspacketizer.h8
-rw-r--r--gst/mpegtsdemux/pesparse.c15
3 files changed, 59 insertions, 8 deletions
diff --git a/gst/mpegtsdemux/mpegtspacketizer.c b/gst/mpegtsdemux/mpegtspacketizer.c
index 2432469c2..8ed14c05f 100644
--- a/gst/mpegtsdemux/mpegtspacketizer.c
+++ b/gst/mpegtsdemux/mpegtspacketizer.c
@@ -406,6 +406,16 @@ mpegts_packetizer_parse_adaptation_field_control (MpegTSPacketizer2 *
afcflags = packet->afc_flags = *data++;
+ GST_DEBUG ("flags: %s%s%s%s%s%s%s%s%s",
+ afcflags & 0x80 ? "discontinuity " : "",
+ afcflags & 0x40 ? "random_access " : "",
+ afcflags & 0x20 ? "elementary_stream_priority " : "",
+ afcflags & 0x10 ? "PCR " : "",
+ afcflags & 0x08 ? "OPCR " : "",
+ afcflags & 0x04 ? "splicing_point " : "",
+ afcflags & 0x02 ? "transport_private_data " : "",
+ afcflags & 0x01 ? "extension " : "", afcflags == 0x00 ? "<none>" : "");
+
/* PCR */
if (afcflags & MPEGTS_AFC_PCR_FLAG) {
MpegTSPCR *pcrtable = NULL;
@@ -426,15 +436,41 @@ mpegts_packetizer_parse_adaptation_field_control (MpegTSPacketizer2 *
record_pcr (packetizer, pcrtable, packet->pcr, packet->offset);
}
}
-
+#ifndef GST_DISABLE_GST_DEBUG
/* OPCR */
if (afcflags & MPEGTS_AFC_OPCR_FLAG) {
- packet->opcr = mpegts_packetizer_compute_pcr (data);
- /* *data += 6; */
+ /* Note: We don't use/need opcr for the time being */
+ guint64 opcr = mpegts_packetizer_compute_pcr (data);
+ data += 6;
GST_DEBUG ("opcr %" G_GUINT64_FORMAT " (%" GST_TIME_FORMAT ")",
- packet->pcr, GST_TIME_ARGS (PCRTIME_TO_GSTTIME (packet->pcr)));
+ opcr, GST_TIME_ARGS (PCRTIME_TO_GSTTIME (opcr)));
+ }
+
+ if (afcflags & MPEGTS_AFC_SPLICING_POINT_FLAG) {
+ GST_DEBUG ("splice_countdown: %u", *data++);
}
+ if (afcflags & MPEGTS_AFC_TRANSPORT_PRIVATE_DATA_FLAG) {
+ guint8 len = *data++;
+ GST_MEMDUMP ("private data", data, len);
+ data += len;
+ }
+
+ if (afcflags & MPEGTS_AFC_EXTENSION_FLAG) {
+ guint8 extlen = *data++;
+ guint8 flags = *data++;
+ GST_DEBUG ("extension size:%d flags : %s%s%s", extlen,
+ flags & 0x80 ? "ltw " : "",
+ flags & 0x40 ? "piecewise_rate " : "",
+ flags & 0x20 ? "seamless_splice " : "");
+ if (flags & 0x80) {
+ GST_DEBUG ("legal time window: valid_flag:%d offset:%d", *data >> 7,
+ GST_READ_UINT16_BE (data) & 0x7fff);
+ data += 2;
+ }
+ }
+#endif
+
return TRUE;
}
diff --git a/gst/mpegtsdemux/mpegtspacketizer.h b/gst/mpegtsdemux/mpegtspacketizer.h
index c17101b09..2034b573b 100644
--- a/gst/mpegtsdemux/mpegtspacketizer.h
+++ b/gst/mpegtsdemux/mpegtspacketizer.h
@@ -39,8 +39,11 @@
#define MPEGTS_MIN_PACKETSIZE MPEGTS_NORMAL_PACKETSIZE
#define MPEGTS_MAX_PACKETSIZE MPEGTS_ATSC_PACKETSIZE
-#define MPEGTS_AFC_PCR_FLAG 0x10
-#define MPEGTS_AFC_OPCR_FLAG 0x08
+#define MPEGTS_AFC_PCR_FLAG 0x10
+#define MPEGTS_AFC_OPCR_FLAG 0x08
+#define MPEGTS_AFC_SPLICING_POINT_FLAG 0x04
+#define MPEGTS_AFC_TRANSPORT_PRIVATE_DATA_FLAG 0x02
+#define MPEGTS_AFC_EXTENSION_FLAG 0x01
#define MAX_WINDOW 512
@@ -131,7 +134,6 @@ typedef struct
guint8 afc_flags;
guint64 pcr;
- guint64 opcr;
guint64 offset;
} MpegTSPacketizerPacket;
diff --git a/gst/mpegtsdemux/pesparse.c b/gst/mpegtsdemux/pesparse.c
index d99665534..28150a136 100644
--- a/gst/mpegtsdemux/pesparse.c
+++ b/gst/mpegtsdemux/pesparse.c
@@ -113,6 +113,11 @@ mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res,
res->flags = val8 & 0xf;
GST_LOG ("scrambling_control 0x%0x", res->scrambling_control);
+ GST_LOG ("flags_1: %s%s%s%s%s",
+ val8 & 0x08 ? "priority " : "",
+ val8 & 0x04 ? "data_alignment " : "",
+ val8 & 0x02 ? "copyright " : "",
+ val8 & 0x01 ? "original_or_copy " : "", val8 & 0x0f ? "" : "<none>");
/* PTS_DTS_flags 2
* ESCR_flag 1
@@ -122,7 +127,15 @@ mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res,
* PES_CRC_flag 1
* PES_extension_flag 1*/
flags = *data++;
- GST_DEBUG ("PES_flag 0x%02x", flags);
+ GST_LOG ("flags_2: %s%s%s%s%s%s%s%s%s",
+ flags & 0x80 ? "PTS " : "",
+ flags & 0x40 ? "DTS " : "",
+ flags & 0x20 ? "ESCR" : "",
+ flags & 0x10 ? "ES_rate " : "",
+ flags & 0x08 ? "DSM_trick_mode " : "",
+ flags & 0x04 ? "additional_copy_info " : "",
+ flags & 0x02 ? "CRC " : "",
+ flags & 0x01 ? "extension " : "", flags ? "" : "<none>");
/* PES_header_data_length 8 */
res->header_size = *data++;