Skip to content

Commit

Permalink
pleorasrc: add support for IYU1 and IYU2 pixel formats
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joshdoe committed Oct 10, 2019
1 parent 5839020 commit 8b7b405
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions sys/pleora/gstpleorasrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 8b7b405

Please sign in to comment.