blob: ab51aa835d47d32ef9291d9b4371b70944c5221a [file] [log] [blame]
From 11cf797e31a671e0ef4a5ca7c1a0205c15ea9456 Mon Sep 17 00:00:00 2001
From: Qian Hu <Qian.Hu@mediatek.com>
Date: Sun, 1 Dec 2019 11:06:20 +0800
Subject: [PATCH] add judge for mpeg4 codec in mpeg container
Signed-off-by: Qian Hu <Qian.Hu@mediatek.com>
---
gst/mpegdemux/gstmpegdemux.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c
index 4454149..0c684b5 100644
--- a/gst/mpegdemux/gstmpegdemux.c
+++ b/gst/mpegdemux/gstmpegdemux.c
@@ -2255,6 +2255,23 @@ gst_ps_demux_data_cb (GstPESFilter * filter, gboolean first,
}
if (stream_type == -1)
goto unknown_stream_type;
+ } else if (stream_type == ST_GST_VIDEO_MPEG1_OR_2) {
+ if (datalen >= 4) {
+ if (!memcmp("\x00\x00\x01\xB0", map.data, 4)) {
+ stream_type = ST_VIDEO_MPEG4;
+ }
+ }
+ if (datalen >= 5) {
+ if (!memcmp("\x00\x00\x01\x00\x00", map.data, 5)) {
+ stream_type = ST_VIDEO_MPEG4;
+ }
+ }
+ } else if (stream_type == ST_AUDIO_MPEG1) {
+ if (datalen >= 4) {
+ if (!memcmp("\xFF\xF1\x50\x80", map.data, 4)) {
+ stream_type = ST_AUDIO_AAC_ADTS;
+ }
+ }
}
if (filter->pts != -1) {
demux->next_pts = filter->pts + demux->scr_adjust;
@@ -2858,9 +2875,10 @@ gst_ps_demux_loop (GstPad * pad)
offset += size;
gst_segment_set_position (&demux->sink_segment, GST_FORMAT_BYTES, offset);
/* check EOS condition */
- if ((demux->sink_segment.position >= demux->sink_segment.stop) ||
- (demux->src_segment.stop != (guint64) - 1 &&
- demux->src_segment.position >= demux->src_segment.stop)) {
+ if ((demux->src_segment.flags & GST_SEEK_FLAG_SEGMENT) &&
+ ((demux->sink_segment.position >= demux->sink_segment.stop) ||
+ (demux->src_segment.stop != (guint64) - 1 &&
+ demux->src_segment.position >= demux->src_segment.stop))) {
GST_DEBUG_OBJECT (demux,
"forward mode using segment reached end of " "segment pos %"
GST_TIME_FORMAT " stop %" GST_TIME_FORMAT " pos in bytes %"
--
2.6.4