mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +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)
|
||||
{
|
||||
GstRtpVRawDepay *rtpvrawdepay;
|
||||
guint8 *payload, *yp, *up, *vp, *headers;
|
||||
guint8 *payload, *p0, *yp, *up, *vp, *headers;
|
||||
guint32 timestamp;
|
||||
guint cont, ystride, uvstride, pgroup, payload_len;
|
||||
gint width, height, xinc, yinc;
|
||||
|
@ -361,6 +361,7 @@ gst_rtp_vraw_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
|||
goto invalid_frame;
|
||||
|
||||
/* get pointer and strides of the planes */
|
||||
p0 = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0);
|
||||
yp = GST_VIDEO_FRAME_COMP_DATA (&frame, 0);
|
||||
up = GST_VIDEO_FRAME_COMP_DATA (&frame, 1);
|
||||
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:
|
||||
/* samples are packed just like gstreamer packs them */
|
||||
offs /= xinc;
|
||||
datap = yp + (line * ystride) + (offs * pgroup);
|
||||
datap = p0 + (line * ystride) + (offs * pgroup);
|
||||
|
||||
memcpy (datap, payload, plen);
|
||||
break;
|
||||
|
@ -461,7 +462,7 @@ gst_rtp_vraw_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
|||
gint i;
|
||||
guint8 *p;
|
||||
|
||||
datap = yp + (line * ystride) + (offs * 4);
|
||||
datap = p0 + (line * ystride) + (offs * 4);
|
||||
p = payload;
|
||||
|
||||
/* 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;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
guint line, offset;
|
||||
guint8 *yp, *up, *vp;
|
||||
guint8 *p0, *yp, *up, *vp;
|
||||
guint ystride, uvstride;
|
||||
guint pgroup;
|
||||
guint mtu;
|
||||
|
@ -258,6 +258,7 @@ gst_rtp_vraw_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
|
|||
gst_buffer_get_size (buffer));
|
||||
|
||||
/* get pointer and strides of the planes */
|
||||
p0 = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0);
|
||||
yp = GST_VIDEO_FRAME_COMP_DATA (&frame, 0);
|
||||
up = GST_VIDEO_FRAME_COMP_DATA (&frame, 1);
|
||||
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_UYVP:
|
||||
offs /= rtpvrawpay->xinc;
|
||||
memcpy (outdata, yp + (lin * ystride) + (offs * pgroup), length);
|
||||
memcpy (outdata, p0 + (lin * ystride) + (offs * pgroup), length);
|
||||
outdata += length;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_AYUV:
|
||||
|
@ -420,7 +421,7 @@ gst_rtp_vraw_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
|
|||
gint i;
|
||||
guint8 *datap;
|
||||
|
||||
datap = yp + (lin * ystride) + (offs * 4);
|
||||
datap = p0 + (lin * ystride) + (offs * 4);
|
||||
|
||||
for (i = 0; i < pixels; i++) {
|
||||
*outdata++ = datap[2];
|
||||
|
|
Loading…
Reference in a new issue