[FFmpeg-devel] [PATCH 2/2] avcodec/hevc_parser: handle PARSER_FLAG_ONCE

Dima Buzdyk dima.buzdyk at gmail.com
Wed Jul 15 09:50:57 EEST 2020


* make HEVC parser respect PARSER_FLAG_ONCE flag

Signed-off-by: Dima Buzdyk <dima.buzdyk at gmail.com>
---
 libavcodec/hevc_parser.c | 4 ++++
 libavformat/avformat.h   | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
index 5af4b788d5..d0c9aa6e44 100644
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@ -331,6 +331,10 @@ static int hevc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
     if (!is_dummy_buf)
         parse_nal_units(s, buf, buf_size, avctx);
 
+    if (s->flags & PARSER_FLAG_ONCE) {
+        s->flags &= PARSER_FLAG_COMPLETE_FRAMES;
+    }
+
     *poutbuf      = buf;
     *poutbuf_size = buf_size;
     return next;
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index e91e7f1d33..044921b2e4 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -786,7 +786,7 @@ enum AVStreamParseType {
     AVSTREAM_PARSE_FULL,       /**< full parsing and repack */
     AVSTREAM_PARSE_HEADERS,    /**< Only parse headers, do not repack. */
     AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */
-    AVSTREAM_PARSE_FULL_ONCE,  /**< full parsing and repack of the first frame only, only implemented for H.264 currently */
+    AVSTREAM_PARSE_FULL_ONCE,  /**< full parsing and repack of the first frame only, only implemented for H.264 and HEVC currently */
     AVSTREAM_PARSE_FULL_RAW,   /**< full parsing and repack with timestamp and position generation by parser for raw
                                     this assumes that each packet in the file contains no demuxer level headers and
                                     just codec level data, otherwise position generation would fail */
-- 
Dmitry Buzdyk
Rhonda Software



More information about the ffmpeg-devel mailing list