Skip to content

Commit 3f007b7

Browse files
committed
Fix crash with hardware scaler and interlace video
Besides, it is not a good idea to scale interlaced video with a non-interlace-aware scaler like I think all the hardware scalers are.
1 parent 836a70d commit 3f007b7

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/modules/avformat/producer_avformat.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2865,7 +2865,19 @@ static int producer_get_image(mlt_frame frame,
28652865
"consumer.scale");
28662866
consumer_scale = consumer_scale * profile->height
28672867
/ self->video_frame->height;
2868-
if (consumer_scale > 0.0 && consumer_scale < 1.0) {
2868+
2869+
// Do not add hardware filters for interlaced video
2870+
#if LIBAVUTIL_VERSION_INT >= ((58 << 16) + (7 << 8) + 100)
2871+
int is_interlaced = !!(self->video_frame->flags
2872+
& AV_FRAME_FLAG_INTERLACED);
2873+
#else
2874+
int is_interlaced = self->video_frame->interlaced_frame;
2875+
#endif
2876+
if (mlt_properties_get(properties, "force_progressive")) {
2877+
is_interlaced = !mlt_properties_get_int(properties,
2878+
"force_progressive");
2879+
}
2880+
if (!is_interlaced && consumer_scale > 0.0 && consumer_scale < 1.0) {
28692881
try_setup_hwaccel_filters(self, producer, consumer_scale);
28702882
}
28712883

0 commit comments

Comments
 (0)