diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecav1dec.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecav1dec.c index 51766a5d6d..b181ab6b0f 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecav1dec.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecav1dec.c @@ -433,6 +433,28 @@ gst_v4l2_codec_av1_dec_decide_allocation (GstVideoDecoder * decoder, return FALSE; } + /* Check if we can zero-copy buffers */ + if (!self->has_videometa) { + GstVideoInfo ref_vinfo; + gint i; + + gst_video_info_set_format (&ref_vinfo, + GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->render_width, + self->render_height); + + for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { + if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || + self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { + GST_WARNING_OBJECT (self, + "GstVideoMeta support required, copying frames."); + self->copy_frames = TRUE; + break; + } + } + } else { + self->copy_frames = FALSE; + } + if (gst_query_get_n_allocation_pools (query) > 0) gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL); @@ -1166,28 +1188,6 @@ gst_v4l2_codec_av1_dec_new_picture (GstAV1Decoder * decoder, GST_ERROR_OBJECT (self, "Failed to negotiate with downstream"); return GST_FLOW_ERROR; } - - /* Check if we can zero-copy buffers */ - if (!self->has_videometa) { - GstVideoInfo ref_vinfo; - gint i; - - gst_video_info_set_format (&ref_vinfo, - GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->render_width, - self->render_height); - - for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { - if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || - self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { - GST_WARNING_OBJECT (self, - "GstVideoMeta support required, copying frames."); - self->copy_frames = TRUE; - break; - } - } - } else { - self->copy_frames = FALSE; - } } /* diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c index 5dcfc0e3c9..9dd851ab67 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech264dec.c @@ -479,6 +479,28 @@ gst_v4l2_codec_h264_dec_decide_allocation (GstVideoDecoder * decoder, return FALSE; } + /* Check if we can zero-copy buffers */ + if (!self->has_videometa) { + GstVideoInfo ref_vinfo; + gint i; + + gst_video_info_set_format (&ref_vinfo, + GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->display_width, + self->display_height); + + for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { + if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || + self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { + GST_WARNING_OBJECT (self, + "GstVideoMeta support required, copying frames."); + self->copy_frames = TRUE; + break; + } + } + } else { + self->copy_frames = FALSE; + } + if (gst_query_get_n_allocation_pools (query) > 0) gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL); @@ -968,28 +990,6 @@ gst_v4l2_codec_h264_dec_new_sequence (GstH264Decoder * decoder, } } - /* Check if we can zero-copy buffers */ - if (!self->has_videometa) { - GstVideoInfo ref_vinfo; - gint i; - - gst_video_info_set_format (&ref_vinfo, - GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->display_width, - self->display_height); - - for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { - if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || - self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { - GST_WARNING_OBJECT (self, - "GstVideoMeta support required, copying frames."); - self->copy_frames = TRUE; - break; - } - } - } else { - self->copy_frames = FALSE; - } - return GST_FLOW_OK; } diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech265dec.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech265dec.c index 72ca794939..867bdf2c68 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech265dec.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codech265dec.c @@ -507,6 +507,28 @@ gst_v4l2_codec_h265_dec_decide_allocation (GstVideoDecoder * decoder, return FALSE; } + /* Check if we can zero-copy buffers */ + if (!self->has_videometa) { + GstVideoInfo ref_vinfo; + gint i; + + gst_video_info_set_format (&ref_vinfo, + GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->display_width, + self->display_height); + + for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { + if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || + self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { + GST_WARNING_OBJECT (self, + "GstVideoMeta support required, copying frames."); + self->copy_frames = TRUE; + break; + } + } + } else { + self->copy_frames = self->need_crop; + } + if (gst_query_get_n_allocation_pools (query) > 0) gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL); @@ -993,28 +1015,6 @@ gst_v4l2_codec_h265_dec_new_sequence (GstH265Decoder * decoder, } } - /* Check if we can zero-copy buffers */ - if (!self->has_videometa) { - GstVideoInfo ref_vinfo; - gint i; - - gst_video_info_set_format (&ref_vinfo, - GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->display_width, - self->display_height); - - for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { - if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || - self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { - GST_WARNING_OBJECT (self, - "GstVideoMeta support required, copying frames."); - self->copy_frames = TRUE; - break; - } - } - } else { - self->copy_frames = self->need_crop; - } - return GST_FLOW_OK; } diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecmpeg2dec.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecmpeg2dec.c index 1449cd3053..b6585228a8 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecmpeg2dec.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecmpeg2dec.c @@ -401,6 +401,28 @@ gst_v4l2_codec_mpeg2_dec_decide_allocation (GstVideoDecoder * decoder, return FALSE; } + /* Check if we can zero-copy buffers */ + if (!self->has_videometa) { + GstVideoInfo ref_vinfo; + gint i; + + gst_video_info_set_format (&ref_vinfo, + GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width, + self->height); + + for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { + if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || + self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { + GST_WARNING_OBJECT (self, + "GstVideoMeta support required, copying frames."); + self->copy_frames = TRUE; + break; + } + } + } else { + self->copy_frames = FALSE; + } + if (gst_query_get_n_allocation_pools (query) > 0) gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL); @@ -529,28 +551,6 @@ gst_v4l2_codec_mpeg2_dec_new_sequence (GstMpeg2Decoder * decoder, self->need_quantiser = TRUE; } - /* Check if we can zero-copy buffers */ - if (!self->has_videometa) { - GstVideoInfo ref_vinfo; - gint i; - - gst_video_info_set_format (&ref_vinfo, - GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width, - self->height); - - for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { - if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || - self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { - GST_WARNING_OBJECT (self, - "GstVideoMeta support required, copying frames."); - self->copy_frames = TRUE; - break; - } - } - } else { - self->copy_frames = FALSE; - } - return GST_FLOW_OK; } diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecvp8dec.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecvp8dec.c index db7d544c8e..433c1d2bf4 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecvp8dec.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecvp8dec.c @@ -360,6 +360,30 @@ gst_v4l2_codec_vp8_dec_decide_allocation (GstVideoDecoder * decoder, return FALSE; } + /* Check if we can zero-copy buffers */ + if (!self->has_videometa) { + GstVideoInfo ref_vinfo; + gint i; + + gst_video_info_set_format (&ref_vinfo, + GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width, + self->height); + + for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { + if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || + self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { + GST_WARNING_OBJECT (self, + "GstVideoMeta support required, copying frames."); + self->copy_frames = TRUE; + break; + } + } + } else { + self->copy_frames = FALSE; + } + + + if (gst_query_get_n_allocation_pools (query) > 0) gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL); @@ -563,28 +587,6 @@ gst_v4l2_codec_vp8_dec_new_sequence (GstVp8Decoder * decoder, } } - /* Check if we can zero-copy buffers */ - if (!self->has_videometa) { - GstVideoInfo ref_vinfo; - gint i; - - gst_video_info_set_format (&ref_vinfo, - GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width, - self->height); - - for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { - if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || - self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { - GST_WARNING_OBJECT (self, - "GstVideoMeta support required, copying frames."); - self->copy_frames = TRUE; - break; - } - } - } else { - self->copy_frames = FALSE; - } - return GST_FLOW_OK; } diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecvp9dec.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecvp9dec.c index bb2195f183..bec044715a 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecvp9dec.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecvp9dec.c @@ -630,6 +630,28 @@ gst_v4l2_codec_vp9_dec_decide_allocation (GstVideoDecoder * decoder, return FALSE; } + /* Check if we can zero-copy buffers */ + if (!self->has_videometa) { + GstVideoInfo ref_vinfo; + gint i; + + gst_video_info_set_format (&ref_vinfo, + GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width, + self->height); + + for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { + if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || + self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { + GST_WARNING_OBJECT (self, + "GstVideoMeta support required, copying frames."); + self->copy_frames = TRUE; + break; + } + } + } else { + self->copy_frames = FALSE; + } + if (gst_query_get_n_allocation_pools (query) > 0) gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL); @@ -775,28 +797,6 @@ gst_v4l2_codec_vp9_dec_new_sequence (GstVp9Decoder * decoder, } } - /* Check if we can zero-copy buffers */ - if (!self->has_videometa) { - GstVideoInfo ref_vinfo; - gint i; - - gst_video_info_set_format (&ref_vinfo, - GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width, - self->height); - - for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) { - if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] || - self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) { - GST_WARNING_OBJECT (self, - "GstVideoMeta support required, copying frames."); - self->copy_frames = TRUE; - break; - } - } - } else { - self->copy_frames = FALSE; - } - return GST_FLOW_OK; }