diff mbox series

[FFmpeg-devel,2/3] avcodec/qpeg: export missing frame properties

Message ID 20200417031008.2131-2-jamrial@gmail.com
State Accepted
Commit 18bb1d40c1546c573efbec3709fc99a40e79076e
Headers show
Series [FFmpeg-devel,1/3] avcodec/qpeg: remove an unnecessary intermediary AVFrame | expand

Checks

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

Commit Message

James Almer April 17, 2020, 3:10 a.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/qpeg.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Anton Khirnov April 20, 2020, 1:28 p.m. UTC | #1
Quoting James Almer (2020-04-17 05:10:07)
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---

Looks ok
diff mbox series

Patch

diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
index 3fde6381f2..22afd9fa81 100644
--- a/libavcodec/qpeg.c
+++ b/libavcodec/qpeg.c
@@ -270,7 +270,7 @@  static int decode_frame(AVCodecContext *avctx,
     AVFrame * const p = data;
     AVFrame * const ref = a->ref;
     uint8_t* outdata;
-    int delta, ret;
+    int delta, intra, ret;
     int pal_size;
     const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size);
 
@@ -289,7 +289,8 @@  static int decode_frame(AVCodecContext *avctx,
     bytestream2_skip(&a->buffer, 1);
 
     delta = bytestream2_get_byte(&a->buffer);
-    if(delta == 0x10) {
+    intra = delta == 0x10;
+    if (intra) {
         qpeg_decode_intra(a, outdata, p->linesize[0], avctx->width, avctx->height);
     } else {
         qpeg_decode_inter(a, outdata, p->linesize[0], avctx->width, avctx->height, delta, ctable, ref->data[0]);
@@ -308,6 +309,9 @@  static int decode_frame(AVCodecContext *avctx,
     if ((ret = av_frame_ref(ref, p)) < 0)
         return ret;
 
+    p->key_frame = intra;
+    p->pict_type = intra ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
+
     *got_frame      = 1;
 
     return avpkt->size;