mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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)
This commit is contained in:
parent
3b6825a546
commit
8c60e42070
3 changed files with 59 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
|
||||
#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;
|
||||
|
||||
|
|
|
@ -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++;
|
||||
|
|
Loading…
Reference in a new issue