From c2af6b500bcf5bf59380c404b77edeb0c6eb46a2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jul 2014 21:03:43 +0200 Subject: [PATCH] avformat: add av_stream_get_parser() to access avformat AVParser The AVStream.parser field is considered private and its location cannot be preserved while preserving also ABI compatibility to libav, as libav added fields before it. Some tools like ffmpeg.c access this field though Signed-off-by: Michael Niedermayer (cherry picked from commit 62227a70f0a4c07d7ead5775d8bad64797f8ef80) Conflicts: RELEASE_NOTES doc/APIchanges libavformat/utils.c libavformat/version.h (cherry picked from commit a78e6363e9a7ef90bd1ff4aeceee8e5501cbc6d4) Conflicts: libavformat/utils.c --- libavformat/avformat.h | 1 + libavformat/utils.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 04fad94219..2adcae27d7 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -892,6 +892,7 @@ typedef struct AVStream { AVRational av_stream_get_r_frame_rate(const AVStream *s); void av_stream_set_r_frame_rate(AVStream *s, AVRational r); +struct AVCodecParserContext *av_stream_get_parser(const AVStream *s); #define AV_PROGRAM_RUNNING 1 diff --git a/libavformat/utils.c b/libavformat/utils.c index 3280a0d214..4cb0adfdfe 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -103,6 +103,11 @@ static int64_t wrap_timestamp(AVStream *st, int64_t timestamp) MAKE_ACCESSORS(AVStream, stream, AVRational, r_frame_rate) +struct AVCodecParserContext *av_stream_get_parser(const AVStream *st) +{ + return st->parser; +} + /* an arbitrarily chosen "sane" max packet size -- 50M */ #define SANE_CHUNK_SIZE (50000000)