From 9994ff2c6c4c1e25d96627cd8edf2cdcad736e47 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 28 Apr 2014 14:41:10 +0200 Subject: [PATCH] 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 --- gst/rtp/gstrtpvrawdepay.c | 7 ++++--- gst/rtp/gstrtpvrawpay.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gst/rtp/gstrtpvrawdepay.c b/gst/rtp/gstrtpvrawdepay.c index 7674122ee9..9a2880262a 100644 --- a/gst/rtp/gstrtpvrawdepay.c +++ b/gst/rtp/gstrtpvrawdepay.c @@ -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 diff --git a/gst/rtp/gstrtpvrawpay.c b/gst/rtp/gstrtpvrawpay.c index 5df9c52a87..ca54bbb75d 100644 --- a/gst/rtp/gstrtpvrawpay.c +++ b/gst/rtp/gstrtpvrawpay.c @@ -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];