mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
rtpvraw: use plane pointers when needed
Pack/unpack planar formats to/from the first plane. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=729058
This commit is contained in:
parent
3b6c17c2b6
commit
9994ff2c6c
2 changed files with 8 additions and 6 deletions
|
@ -309,7 +309,7 @@ static GstBuffer *
|
||||||
gst_rtp_vraw_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
gst_rtp_vraw_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstRtpVRawDepay *rtpvrawdepay;
|
GstRtpVRawDepay *rtpvrawdepay;
|
||||||
guint8 *payload, *yp, *up, *vp, *headers;
|
guint8 *payload, *p0, *yp, *up, *vp, *headers;
|
||||||
guint32 timestamp;
|
guint32 timestamp;
|
||||||
guint cont, ystride, uvstride, pgroup, payload_len;
|
guint cont, ystride, uvstride, pgroup, payload_len;
|
||||||
gint width, height, xinc, yinc;
|
gint width, height, xinc, yinc;
|
||||||
|
@ -361,6 +361,7 @@ gst_rtp_vraw_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
goto invalid_frame;
|
goto invalid_frame;
|
||||||
|
|
||||||
/* get pointer and strides of the planes */
|
/* get pointer and strides of the planes */
|
||||||
|
p0 = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0);
|
||||||
yp = GST_VIDEO_FRAME_COMP_DATA (&frame, 0);
|
yp = GST_VIDEO_FRAME_COMP_DATA (&frame, 0);
|
||||||
up = GST_VIDEO_FRAME_COMP_DATA (&frame, 1);
|
up = GST_VIDEO_FRAME_COMP_DATA (&frame, 1);
|
||||||
vp = GST_VIDEO_FRAME_COMP_DATA (&frame, 2);
|
vp = GST_VIDEO_FRAME_COMP_DATA (&frame, 2);
|
||||||
|
@ -452,7 +453,7 @@ gst_rtp_vraw_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
case GST_VIDEO_FORMAT_UYVP:
|
case GST_VIDEO_FORMAT_UYVP:
|
||||||
/* samples are packed just like gstreamer packs them */
|
/* samples are packed just like gstreamer packs them */
|
||||||
offs /= xinc;
|
offs /= xinc;
|
||||||
datap = yp + (line * ystride) + (offs * pgroup);
|
datap = p0 + (line * ystride) + (offs * pgroup);
|
||||||
|
|
||||||
memcpy (datap, payload, plen);
|
memcpy (datap, payload, plen);
|
||||||
break;
|
break;
|
||||||
|
@ -461,7 +462,7 @@ gst_rtp_vraw_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
gint i;
|
gint i;
|
||||||
guint8 *p;
|
guint8 *p;
|
||||||
|
|
||||||
datap = yp + (line * ystride) + (offs * 4);
|
datap = p0 + (line * ystride) + (offs * 4);
|
||||||
p = payload;
|
p = payload;
|
||||||
|
|
||||||
/* samples are packed in order Cb-Y-Cr for both interlaced and
|
/* samples are packed in order Cb-Y-Cr for both interlaced and
|
||||||
|
|
|
@ -240,7 +240,7 @@ gst_rtp_vraw_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
|
||||||
GstRtpVRawPay *rtpvrawpay;
|
GstRtpVRawPay *rtpvrawpay;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
guint line, offset;
|
guint line, offset;
|
||||||
guint8 *yp, *up, *vp;
|
guint8 *p0, *yp, *up, *vp;
|
||||||
guint ystride, uvstride;
|
guint ystride, uvstride;
|
||||||
guint pgroup;
|
guint pgroup;
|
||||||
guint mtu;
|
guint mtu;
|
||||||
|
@ -258,6 +258,7 @@ gst_rtp_vraw_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
|
||||||
gst_buffer_get_size (buffer));
|
gst_buffer_get_size (buffer));
|
||||||
|
|
||||||
/* get pointer and strides of the planes */
|
/* get pointer and strides of the planes */
|
||||||
|
p0 = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0);
|
||||||
yp = GST_VIDEO_FRAME_COMP_DATA (&frame, 0);
|
yp = GST_VIDEO_FRAME_COMP_DATA (&frame, 0);
|
||||||
up = GST_VIDEO_FRAME_COMP_DATA (&frame, 1);
|
up = GST_VIDEO_FRAME_COMP_DATA (&frame, 1);
|
||||||
vp = GST_VIDEO_FRAME_COMP_DATA (&frame, 2);
|
vp = GST_VIDEO_FRAME_COMP_DATA (&frame, 2);
|
||||||
|
@ -412,7 +413,7 @@ gst_rtp_vraw_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
|
||||||
case GST_VIDEO_FORMAT_UYVY:
|
case GST_VIDEO_FORMAT_UYVY:
|
||||||
case GST_VIDEO_FORMAT_UYVP:
|
case GST_VIDEO_FORMAT_UYVP:
|
||||||
offs /= rtpvrawpay->xinc;
|
offs /= rtpvrawpay->xinc;
|
||||||
memcpy (outdata, yp + (lin * ystride) + (offs * pgroup), length);
|
memcpy (outdata, p0 + (lin * ystride) + (offs * pgroup), length);
|
||||||
outdata += length;
|
outdata += length;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_AYUV:
|
case GST_VIDEO_FORMAT_AYUV:
|
||||||
|
@ -420,7 +421,7 @@ gst_rtp_vraw_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
|
||||||
gint i;
|
gint i;
|
||||||
guint8 *datap;
|
guint8 *datap;
|
||||||
|
|
||||||
datap = yp + (lin * ystride) + (offs * 4);
|
datap = p0 + (lin * ystride) + (offs * 4);
|
||||||
|
|
||||||
for (i = 0; i < pixels; i++) {
|
for (i = 0; i < pixels; i++) {
|
||||||
*outdata++ = datap[2];
|
*outdata++ = datap[2];
|
||||||
|
|
Loading…
Reference in a new issue