diff mbox series

[FFmpeg-devel,05/14] avcodec/mpegpicture: Mark dummy frames as such

Message ID GV1SPRMB00219896492E348CC577B8318F1B2@GV1SPRMB0021.EURP250.PROD.OUTLOOK.COM
State New
Headers show
Series [FFmpeg-devel,01/14] avcodec/get_buffer: Remove redundant check | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Andreas Rheinhardt April 29, 2024, 12:35 a.m. UTC
This will allow to avoid outputting them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpegpicture.c   | 2 ++
 libavcodec/mpegpicture.h   | 1 +
 libavcodec/mpegvideo_dec.c | 2 ++
 3 files changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index aa882cf747..88b4d5dec1 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -270,6 +270,7 @@  void ff_mpeg_unref_picture(Picture *pic)
     if (pic->needs_realloc)
         free_picture_tables(pic);
 
+    pic->dummy         = 0;
     pic->field_picture = 0;
     pic->b_frame_score = 0;
     pic->needs_realloc = 0;
@@ -331,6 +332,7 @@  int ff_mpeg_ref_picture(Picture *dst, Picture *src)
     ff_refstruct_replace(&dst->hwaccel_picture_private,
                           src->hwaccel_picture_private);
 
+    dst->dummy                   = src->dummy;
     dst->field_picture           = src->field_picture;
     dst->b_frame_score           = src->b_frame_score;
     dst->needs_realloc           = src->needs_realloc;
diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h
index 215e7388ef..664c116a47 100644
--- a/libavcodec/mpegpicture.h
+++ b/libavcodec/mpegpicture.h
@@ -70,6 +70,7 @@  typedef struct Picture {
     /// RefStruct reference for hardware accelerator private data
     void *hwaccel_picture_private;
 
+    int dummy;                  ///< Picture is a dummy and should not be output
     int field_picture;          ///< whether or not the picture was encoded in separate fields
 
     int b_frame_score;
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index efc257d43e..bf274e0c48 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -288,6 +288,8 @@  static int av_cold alloc_dummy_frame(MpegEncContext *s, Picture **picp, Picture
     if (ret < 0)
         return ret;
 
+    pic->dummy = 1;
+
     ff_mpeg_unref_picture(wpic);
     ret = ff_mpeg_ref_picture(wpic, pic);
     if (ret < 0) {