diff --git a/subprojects/gst-plugins-bad/ext/wayland/wlshmallocator.c b/subprojects/gst-plugins-bad/ext/wayland/wlshmallocator.c index 0a82a35d29..611e2fbdf0 100644 --- a/subprojects/gst-plugins-bad/ext/wayland/wlshmallocator.c +++ b/subprojects/gst-plugins-bad/ext/wayland/wlshmallocator.c @@ -144,31 +144,6 @@ gst_is_wl_shm_memory (GstMemory * mem) return gst_memory_is_type (mem, GST_ALLOCATOR_WL_SHM); } -/* Copied from gst_v4l2_object_extrapolate_stride() */ -static gint -gst_wl_shm_extrapolate_stride (const GstVideoFormatInfo * finfo, gint plane, - gint stride) -{ - gint estride; - - switch (finfo->format) { - case GST_VIDEO_FORMAT_NV12: - case GST_VIDEO_FORMAT_NV12_64Z32: - case GST_VIDEO_FORMAT_NV21: - case GST_VIDEO_FORMAT_NV16: - case GST_VIDEO_FORMAT_NV61: - case GST_VIDEO_FORMAT_NV24: - estride = (plane == 0 ? 1 : 2) * - GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, plane, stride); - break; - default: - estride = GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, plane, stride); - break; - } - - return estride; -} - static gboolean gst_wl_shm_validate_video_info (const GstVideoInfo * vinfo) { @@ -183,7 +158,8 @@ gst_wl_shm_validate_video_info (const GstVideoInfo * vinfo) /* Overwrite the video info's stride and offset using the pitch calculcated * by the kms driver. */ - estride = gst_wl_shm_extrapolate_stride (vinfo->finfo, i, base_stride); + estride = gst_video_format_info_extrapolate_stride (vinfo->finfo, i, + base_stride); if (estride != GST_VIDEO_INFO_PLANE_STRIDE (vinfo, i)) return FALSE; diff --git a/subprojects/gst-plugins-bad/sys/kms/gstkmsallocator.c b/subprojects/gst-plugins-bad/sys/kms/gstkmsallocator.c index 2ae22fcaec..6687f3b0a3 100644 --- a/subprojects/gst-plugins-bad/sys/kms/gstkmsallocator.c +++ b/subprojects/gst-plugins-bad/sys/kms/gstkmsallocator.c @@ -138,34 +138,6 @@ gst_kms_allocator_memory_reset (GstKMSAllocator * allocator, GstKMSMemory * mem) mem->bo = NULL; } -/* Copied from gst_v4l2_object_extrapolate_stride() */ -static gint -extrapolate_stride (const GstVideoFormatInfo * finfo, gint plane, gint stride) -{ - gint estride; - - switch (finfo->format) { - case GST_VIDEO_FORMAT_NV12: - case GST_VIDEO_FORMAT_NV12_64Z32: - case GST_VIDEO_FORMAT_NV21: - case GST_VIDEO_FORMAT_NV16: - case GST_VIDEO_FORMAT_NV61: - case GST_VIDEO_FORMAT_NV24: - case GST_VIDEO_FORMAT_P010_10LE: - case GST_VIDEO_FORMAT_P010_10BE: - case GST_VIDEO_FORMAT_P016_LE: - case GST_VIDEO_FORMAT_P016_BE: - estride = (plane == 0 ? 1 : 2) * - GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, plane, stride); - break; - default: - estride = GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, plane, stride); - break; - } - - return estride; -} - static gboolean gst_kms_allocator_memory_create (GstKMSAllocator * allocator, GstKMSMemory * kmsmem, GstVideoInfo * vinfo) @@ -207,7 +179,8 @@ gst_kms_allocator_memory_create (GstKMSAllocator * allocator, /* Overwrite the video info's stride and offset using the pitch calculcated * by the kms driver. */ - pitch = extrapolate_stride (vinfo->finfo, i, arg.pitch); + pitch = gst_video_format_info_extrapolate_stride (vinfo->finfo, i, + arg.pitch); GST_VIDEO_INFO_PLANE_STRIDE (vinfo, i) = pitch; GST_VIDEO_INFO_PLANE_OFFSET (vinfo, i) = offs; diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2format.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2format.c index 15e57fb12f..3a6a06f451 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2format.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2format.c @@ -71,31 +71,6 @@ lookup_gst_fmt (GstVideoFormat gst_fmt) return ret; } -static gint -extrapolate_stride (const GstVideoFormatInfo * finfo, gint plane, gint stride) -{ - gint estride; - - switch (finfo->format) { - case GST_VIDEO_FORMAT_NV12: - case GST_VIDEO_FORMAT_NV12_4L4: - case GST_VIDEO_FORMAT_NV12_32L32: - case GST_VIDEO_FORMAT_NV12_64Z32: - case GST_VIDEO_FORMAT_NV16: - case GST_VIDEO_FORMAT_NV21: - case GST_VIDEO_FORMAT_NV24: - case GST_VIDEO_FORMAT_NV61: - estride = (plane == 0 ? 1 : 2) * - GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, plane, stride); - break; - default: - estride = GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, plane, stride); - break; - } - - return estride; -} - static void set_stride (GstVideoInfo * info, gint plane, gint stride) { @@ -152,10 +127,11 @@ gst_v4l2_format_to_video_info (struct v4l2_format *fmt, GstVideoInfo * out_info) gint stride; if (V4L2_TYPE_IS_MULTIPLANAR (fmt->type)) - stride = extrapolate_stride (out_info->finfo, plane, + stride = gst_video_format_info_extrapolate_stride (out_info->finfo, plane, pix_mp->plane_fmt[0].bytesperline); else - stride = extrapolate_stride (out_info->finfo, plane, pix->bytesperline); + stride = gst_video_format_info_extrapolate_stride (out_info->finfo, plane, + pix->bytesperline); set_stride (out_info, plane, stride); out_info->offset[plane] = offset; diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c index 58667de434..d68732646d 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c @@ -270,7 +270,7 @@ gst_v4l2_buffer_pool_import_userptr (GstV4l2BufferPool * pool, for (i = 0; i < (GST_VIDEO_FORMAT_INFO_N_PLANES (finfo) - 1); i++) { const struct v4l2_pix_format *pix_fmt = &pool->obj->format.fmt.pix; gpointer tmp; - gint estride = gst_v4l2_object_extrapolate_stride (finfo, i, + gint estride = gst_video_format_info_extrapolate_stride (finfo, i, pix_fmt->bytesperline); guint eheight = GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (finfo, i, pix_fmt->height); diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c index 9eb3b8e181..be5276dfe4 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c @@ -3204,7 +3204,7 @@ gst_v4l2_object_extrapolate_info (GstV4l2Object * v4l2object, align->padding_bottom; for (i = 0; i < finfo->n_planes; i++) { - estride = gst_v4l2_object_extrapolate_stride (finfo, i, stride); + estride = gst_video_format_info_extrapolate_stride (finfo, i, stride); gst_v4l2_object_set_stride (info, align, i, estride); @@ -3369,30 +3369,6 @@ store_info: } } -gint -gst_v4l2_object_extrapolate_stride (const GstVideoFormatInfo * finfo, - gint plane, gint stride) -{ - gint estride; - - switch (finfo->format) { - case GST_VIDEO_FORMAT_NV12: - case GST_VIDEO_FORMAT_NV12_64Z32: - case GST_VIDEO_FORMAT_NV21: - case GST_VIDEO_FORMAT_NV16: - case GST_VIDEO_FORMAT_NV61: - case GST_VIDEO_FORMAT_NV24: - estride = (plane == 0 ? 1 : 2) * - GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, plane, stride); - break; - default: - estride = GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, plane, stride); - break; - } - - return estride; -} - static enum v4l2_field get_v4l2_field_for_info (GstVideoInfo * info) { diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.h b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.h index e5ed0acaba..ed32d8ee9a 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.h +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.h @@ -286,9 +286,6 @@ GstCaps* gst_v4l2_object_get_raw_caps (void); GstCaps* gst_v4l2_object_get_codec_caps (void); -gint gst_v4l2_object_extrapolate_stride (const GstVideoFormatInfo * finfo, - gint plane, gint stride); - gboolean gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps, GstV4l2Error * error); gboolean gst_v4l2_object_try_format (GstV4l2Object * v4l2object, GstCaps * caps, GstV4l2Error * error); gboolean gst_v4l2_object_try_import (GstV4l2Object * v4l2object, GstBuffer * buffer);