[FFmpeg-devel] [PATCH v2] * mpegts demuxer recognizes private streams on demand
Wolfgang Lorenz
wl-chmw at gmx.de
Thu Jun 4 00:52:40 CEST 2015
Here is a new version, that doesn't touch the way ffmpeg behaves
without further user actions:
I added a new flag to AVFormatContext, that activates the check for
private streams, when set. It can be used like this:
AVFormatContext * formatContext = avformat_alloc_context();
formatContext->flags |= AVFMT_FLAG_MPEGTS_RECOGNIZE_PRIVATE_STREAMS;
avformat_open_input(&formatContext, fileName, NULL, NULL);
---
libavformat/avformat.h | 1 +
libavformat/mpegts.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 719c23b..f5dd3a8 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1394,6 +1394,7 @@ typedef struct AVFormatContext {
#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted)
#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate.
#define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats
+#define AVFMT_FLAG_MPEGTS_RECOGNIZE_PRIVATE_STREAMS 0x100000 ///< In MPEG-TS files, private streams will be recognized as such and not probed for encoded data
/**
* @deprecated deprecated in favor of probesize2
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index aeb2335..2f4ae20 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -705,6 +705,11 @@ static const StreamType ISO_types[] = {
{ 0 },
};
+static const StreamType ISO_type_private_stream[] = {
+ { 0x06, AVMEDIA_TYPE_DATA, AV_CODEC_ID_BIN_DATA },
+ { 0 },
+};
+
static const StreamType HDMV_types[] = {
{ 0x80, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_BLURAY },
{ 0x81, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 },
@@ -800,6 +805,11 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
st->codec->codec_tag = pes->stream_type;
mpegts_find_stream_type(st, pes->stream_type, ISO_types);
+ if (st->codec->codec_id == AV_CODEC_ID_NONE &&
+ (pes->stream->flags & AVFMT_FLAG_MPEGTS_RECOGNIZE_PRIVATE_STREAMS))
+ {
+ mpegts_find_stream_type(st, pes->stream_type, ISO_type_private_stream);
+ }
if ((prog_reg_desc == AV_RL32("HDMV") ||
prog_reg_desc == AV_RL32("HDPR")) &&
st->codec->codec_id == AV_CODEC_ID_NONE) {
--
1.9.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150604/92e4e7a4/attachment.asc>
More information about the ffmpeg-devel
mailing list