diff mbox series

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

Message ID 20200715072533.550579-2-dima.buzdyk@gmail.com
State New
Headers show
Series [FFmpeg-devel,v2,1/2] avdevice/v4l2: add support for HEVC payloads
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Dima Buzdyk July 15, 2020, 7:25 a.m. UTC
* make HEVC parser respect PARSER_FLAG_ONCE flag

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

Patch

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 */