From cca80087793cd88742fbc34168346b1718c79c91 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 20 Jan 2020 12:30:12 +0530 Subject: [PATCH] deinterlace: fix video info on output frames Output frames used to have their interlace mode set to the same one as the input. This breaks their field and comp heights when deinterlacing an alternate stream. --- gst/deinterlace/gstdeinterlace.c | 12 ++++++++++-- gst/deinterlace/gstdeinterlace.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index 5a9edd0734..b3534a7d50 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -668,6 +668,7 @@ gst_deinterlace_init (GstDeinterlace * self) self->mode = DEFAULT_MODE; self->user_set_method_id = DEFAULT_METHOD; gst_video_info_init (&self->vinfo); + gst_video_info_init (&self->vinfo_out); gst_deinterlace_set_method (self, self->user_set_method_id); self->fields = DEFAULT_FIELDS; self->user_set_fields = DEFAULT_FIELDS; @@ -830,6 +831,7 @@ gst_deinterlace_reset (GstDeinterlace * self) GST_DEBUG_OBJECT (self, "Resetting internal state"); gst_video_info_init (&self->vinfo); + gst_video_info_init (&self->vinfo_out); self->passthrough = FALSE; @@ -1866,7 +1868,7 @@ restart: /* map the frame so the deinterlace methods can write the data to the * correct memory locations */ outframe = - gst_video_frame_new_and_map (&self->vinfo, outbuf, GST_MAP_WRITE); + gst_video_frame_new_and_map (&self->vinfo_out, outbuf, GST_MAP_WRITE); /* do magic calculus */ gst_deinterlace_method_deinterlace_frame (self->method, @@ -2027,7 +2029,7 @@ restart: /* map the frame so the deinterlace methods can write the data to the * correct memory locations */ outframe = - gst_video_frame_new_and_map (&self->vinfo, outbuf, GST_MAP_WRITE); + gst_video_frame_new_and_map (&self->vinfo_out, outbuf, GST_MAP_WRITE); /* do magic calculus */ gst_deinterlace_method_deinterlace_frame (self->method, @@ -2705,6 +2707,12 @@ gst_deinterlace_setcaps (GstDeinterlace * self, GstPad * pad, GstCaps * caps) if (!gst_video_info_from_caps (&self->vinfo, caps)) goto invalid_caps; + gst_video_info_set_interlaced_format (&self->vinfo_out, + GST_VIDEO_INFO_FORMAT (&self->vinfo), + GST_VIDEO_INTERLACE_MODE_PROGRESSIVE, + GST_VIDEO_INFO_WIDTH (&self->vinfo), + GST_VIDEO_INFO_HEIGHT (&self->vinfo)); + fps_n = GST_VIDEO_INFO_FPS_N (&self->vinfo); fps_d = GST_VIDEO_INFO_FPS_D (&self->vinfo); diff --git a/gst/deinterlace/gstdeinterlace.h b/gst/deinterlace/gstdeinterlace.h index b87fce2e6c..1f4c02ea8c 100644 --- a/gst/deinterlace/gstdeinterlace.h +++ b/gst/deinterlace/gstdeinterlace.h @@ -136,6 +136,7 @@ struct _GstDeinterlace GstDeinterlaceMethod *method; GstVideoInfo vinfo; + GstVideoInfo vinfo_out; GstBufferPool *pool; GstAllocator *allocator; GstAllocationParams params;