From: lekma Date: Wed, 21 Sep 2016 13:55:43 +0000 (+0200) Subject: [transcode]: hevc does not support interlaced frames X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c992bdf2d4ea702f6b491a9946b36888eb462cad;p=thirdparty%2Ftvheadend.git [transcode]: hevc does not support interlaced frames --- diff --git a/src/transcoding/codec/internals.h b/src/transcoding/codec/internals.h index 3d3106778..183805359 100644 --- a/src/transcoding/codec/internals.h +++ b/src/transcoding/codec/internals.h @@ -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) { \ diff --git a/src/transcoding/codec/profile_video_class.c b/src/transcoding/codec/profile_video_class.c index 9f781c366..ceb744328 100644 --- a/src/transcoding/codec/profile_video_class.c +++ b/src/transcoding/codec/profile_video_class.c @@ -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, }, { diff --git a/src/transcoding/transcode/video.c b/src/transcoding/transcode/video.c index 1987c1e6a..a4b5deb2e 100644 --- a/src/transcoding/transcode/video.c +++ b/src/transcoding/transcode/video.c @@ -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;