_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) { \
/* 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
.desc = N_("Deinterlace."),
.group = 2,
.off = offsetof(TVHVideoCodecProfile, deinterlace),
+ .set = codec_profile_video_class_deinterlace_set,
.def.i = 1,
},
{
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;
}
}
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;