From 8b7b405381929000aa0229d27478c64ce3f71421 Mon Sep 17 00:00:00 2001 From: "Joshua M. Doe" Date: Thu, 10 Oct 2019 07:38:52 -0400 Subject: [PATCH] pleorasrc: add support for IYU1 and IYU2 pixel formats This also needed a change to calculating the strides, as IYU1 is 12bpp, and GstVideoInfo defines pixel stride in bytes, so for IYU2 the stride was calculated as zero. Instead use Pleora's own definition of pixel stride to calculate Pleora's row stride. --- sys/pleora/gstpleorasrc.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sys/pleora/gstpleorasrc.cpp b/sys/pleora/gstpleorasrc.cpp index a67bdf9..962a2a1 100644 --- a/sys/pleora/gstpleorasrc.cpp +++ b/sys/pleora/gstpleorasrc.cpp @@ -748,6 +748,18 @@ GstPleoraCapsInfos gst_caps_infos[] = { "video/x-raw", "UYVY", 0, 0, MAKE_FOURCC ('U', 'Y', 'V', 'Y') }, + { + PvPixelYUV411_8_UYYVYY, + "video/x-raw, format=(string)IYU1", + "video/x-raw", "IYU1", + 0, 0, MAKE_FOURCC ('I', 'Y', 'U', '1') + }, + { + PvPixelYUV8_UYV, + "video/x-raw, format=(string)IYU2", + "video/x-raw", "IYU2", + 0, 0, MAKE_FOURCC ('I', 'Y', 'U', '2') + }, { PvPixelYUV422_8, "video/x-raw, format=(string)YUY2", @@ -972,8 +984,6 @@ gst_pleorasrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps) if (GST_VIDEO_INFO_FORMAT (&vinfo) != GST_VIDEO_FORMAT_UNKNOWN) { src->height = GST_VIDEO_INFO_HEIGHT (&vinfo); src->gst_stride = GST_VIDEO_INFO_COMP_STRIDE (&vinfo, 0); - src->pleora_stride = - GST_VIDEO_INFO_WIDTH (&vinfo) * GST_VIDEO_INFO_COMP_PSTRIDE (&vinfo, 0); } else { goto unsupported_caps; } @@ -1125,6 +1135,9 @@ gst_pleorasrc_create (GstPushSrc * psrc, GstBuffer ** buf) } src->caps = caps; gst_base_src_set_caps (GST_BASE_SRC (src), src->caps); + + guint32 pixel_bpp = PvGetPixelBitCount (pvimage->GetPixelType ()); + src->pleora_stride = (pvimage->GetWidth () * pixel_bpp) / 8; } else { GST_ELEMENT_ERROR (src, RESOURCE, FAILED, ("Pixel type not supported"), (NULL));