]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
[transcode]: small adjustment (video picture type)
authorlekma <lekmalek@gmail.com>
Fri, 16 Sep 2016 06:22:40 +0000 (08:22 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 28 Aug 2017 13:32:48 +0000 (15:32 +0200)
src/transcoding/transcode/video.c

index 3d1a04d5308fae68b3628b504e4edcf521fe12f7..1987c1e6a48b218b3b3863daa6bdbf3869b0f52c 100644 (file)
@@ -246,29 +246,31 @@ tvh_video_context_wrap(TVHContext *self, AVPacket *avpkt, th_pkt_t *pkt)
     int qsdata_size = 0;
     enum AVPictureType pict_type = AV_PICTURE_TYPE_NONE;
 
-    qsdata = av_packet_get_side_data(avpkt, AV_PKT_DATA_QUALITY_STATS,
-                                     &qsdata_size);
-    if (qsdata && qsdata_size >= 5) {
-        pict_type = qsdata[4];
-    }
-    else if (avpkt->flags & AV_PKT_FLAG_KEY) {
+    if (avpkt->flags & AV_PKT_FLAG_KEY) {
         pict_type = AV_PICTURE_TYPE_I;
     }
+    else {
+        qsdata = av_packet_get_side_data(avpkt, AV_PKT_DATA_QUALITY_STATS,
+                                         &qsdata_size);
+        if (qsdata && qsdata_size >= 5) {
+            pict_type = qsdata[4];
+        }
 #if FF_API_CODED_FRAME
-    else if (self->oavctx->coded_frame) {
-        // some codecs do not set pict_type but set key_frame, in this case,
-        // we assume that when key_frame == 1 the frame is an I-frame
-        // (all the others are assumed to be P-frames)
-        if (!(pict_type = self->oavctx->coded_frame->pict_type)) {
-            if (self->oavctx->coded_frame->key_frame) {
-                pict_type = AV_PICTURE_TYPE_I;
-            }
-            else {
-                pict_type = AV_PICTURE_TYPE_P;
+        else if (self->oavctx->coded_frame) {
+            // some codecs do not set pict_type but set key_frame, in this case,
+            // we assume that when key_frame == 1 the frame is an I-frame
+            // (all the others are assumed to be P-frames)
+            if (!(pict_type = self->oavctx->coded_frame->pict_type)) {
+                if (self->oavctx->coded_frame->key_frame) {
+                    pict_type = AV_PICTURE_TYPE_I;
+                }
+                else {
+                    pict_type = AV_PICTURE_TYPE_P;
+                }
             }
         }
-    }
 #endif
+    }
     switch (pict_type) {
         case AV_PICTURE_TYPE_I:
             pkt->v.pkt_frametype = PKT_I_FRAME;