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)
{
/* 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;
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)
/* 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;
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)
{
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;
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);
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);
}
}
-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)
{
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);