]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
[transcode]: hevc does not support interlaced frames
authorlekma <lekmalek@gmail.com>
Wed, 21 Sep 2016 13:55:43 +0000 (15:55 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 28 Aug 2017 13:33:54 +0000 (15:33 +0200)
src/transcoding/codec/internals.h
src/transcoding/codec/profile_video_class.c
src/transcoding/transcode/video.c

index 3d3106778faaa5ccfcc647413807072eccaa5c43..183805359d7a1e55bc3522fd887ca013084671a7 100644 (file)
@@ -79,7 +79,6 @@
     _tvh_codec_getattr(c, a, AVMEDIA_TYPE_AUDIO, TVHAudioCodec)
 
 
-
 #define AV_DICT_SET(d, k, v, f) \
     do { \
         if (av_dict_set((d), (k), (v), (f)) < 0) { \
index 9f781c3665d73cd7cc737eb7702823283f12e4dc..ceb7443289bf900124c07494a8b615cc63c4e6f8 100644 (file)
@@ -101,6 +101,23 @@ tvh_codec_profile_video_open(TVHVideoCodecProfile *self, AVDictionary **opts)
 
 /* codec_profile_video_class ================================================ */
 
+/* codec_profile_video_class.deinterlace */
+
+static int
+codec_profile_video_class_deinterlace_set(void *obj, const void *val)
+{
+    TVHVideoCodecProfile *self = (TVHVideoCodecProfile *)obj;
+    AVCodec *avcodec = NULL;
+
+    if (self &&
+        (avcodec = tvh_codec_profile_get_avcodec((TVHCodecProfile *)self))) {
+        self->deinterlace = (avcodec->id == AV_CODEC_ID_HEVC) ? 1 : *(int *)val;
+        return 1;
+    }
+    return 0;
+}
+
+
 /* codec_profile_video_class.pix_fmt */
 
 static uint32_t
@@ -134,6 +151,7 @@ const codec_profile_class_t codec_profile_video_class = {
                 .desc     = N_("Deinterlace."),
                 .group    = 2,
                 .off      = offsetof(TVHVideoCodecProfile, deinterlace),
+                .set      = codec_profile_video_class_deinterlace_set,
                 .def.i    = 1,
             },
             {
index 1987c1e6a48b218b3b3863daa6bdbf3869b0f52c..a4b5deb2e35083d0d39f53e022c6dcd9c1d634d1 100644 (file)
@@ -224,6 +224,13 @@ tvh_video_context_encode(TVHContext *self, AVFrame *avframe)
         return AVERROR(EAGAIN);
     }
     self->pts = avframe->pts;
+    if (avframe->interlaced_frame) {
+        self->oavctx->field_order =
+            avframe->top_field_first ? AV_FIELD_TB : AV_FIELD_BT;
+    }
+    else {
+        self->oavctx->field_order = AV_FIELD_PROGRESSIVE;
+    }
     return 0;
 }
 
@@ -288,7 +295,7 @@ tvh_video_context_wrap(TVHContext *self, AVPacket *avpkt, th_pkt_t *pkt)
     }
     pkt->pkt_duration   = avpkt->duration;
     pkt->pkt_commercial = self->src_pkt->pkt_commercial;
-    pkt->v.pkt_field      = self->src_pkt->v.pkt_field;
+    pkt->v.pkt_field      = (self->oavctx->field_order > AV_FIELD_PROGRESSIVE);
     pkt->v.pkt_aspect_num = self->src_pkt->v.pkt_aspect_num;
     pkt->v.pkt_aspect_den = self->src_pkt->v.pkt_aspect_den;
     return 0;