[FFmpeg-cvslog] lavc/libdavs2: correct frame type setting

hwren git at videolan.org
Sun Nov 18 20:56:06 EET 2018


ffmpeg | branch: master | hwren <hwrenx at 126.com> | Fri Nov  2 21:30:10 2018 +0800| [31b79e0210c4184627b5971ce1e909e6de7df976] | committer: Mark Thompson

lavc/libdavs2: correct frame type setting

Signed-off-by: hwren <hwrenx at 126.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31b79e0210c4184627b5971ce1e909e6de7df976
---

 libavcodec/libdavs2.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index 3b9efe05b1..874f2f084d 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -76,6 +76,26 @@ static int davs2_dump_frames(AVCodecContext *avctx, davs2_picture_t *pic,
         return 0;
     }
 
+    switch (pic->type) {
+        case DAVS2_PIC_I:
+        case DAVS2_PIC_G:
+            frame->pict_type = AV_PICTURE_TYPE_I;
+            break;
+        case DAVS2_PIC_P:
+        case DAVS2_PIC_S:
+            frame->pict_type = AV_PICTURE_TYPE_P;
+            break;
+        case DAVS2_PIC_B:
+            frame->pict_type = AV_PICTURE_TYPE_B;
+            break;
+        case DAVS2_PIC_F:
+            frame->pict_type = AV_PICTURE_TYPE_S;
+            break;
+        default:
+            av_log(avctx, AV_LOG_ERROR, "Decoder error: unknown frame type\n");
+            return AVERROR_EXTERNAL;
+    }
+
     for (plane = 0; plane < 3; ++plane) {
         int size_line = pic->widths[plane] * bytes_per_sample;
         frame->buf[plane]  = av_buffer_alloc(size_line * pic->lines[plane]);
@@ -97,7 +117,6 @@ static int davs2_dump_frames(AVCodecContext *avctx, davs2_picture_t *pic,
     frame->width     = cad->headerset.width;
     frame->height    = cad->headerset.height;
     frame->pts       = cad->out_frame.pts;
-    frame->pict_type = pic->type;
     frame->format    = avctx->pix_fmt;
 
     return 1;



More information about the ffmpeg-cvslog mailing list