summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpvrawpay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-02-26 13:00:58 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2009-02-26 13:00:58 +0100
commit62d5787bcda78bba5384732f9d25042d33af7923 (patch)
treeb8f3be52111a7f51a29eab688bfdade78c2b2e6a /gst/rtp/gstrtpvrawpay.c
parent80510aeee70ca73d3102559ce9a919134ce9629e (diff)
rtpvrawpay: fail on interlaced video
Detect and fail when trying to payload interlaced video.
Diffstat (limited to 'gst/rtp/gstrtpvrawpay.c')
-rw-r--r--gst/rtp/gstrtpvrawpay.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/gst/rtp/gstrtpvrawpay.c b/gst/rtp/gstrtpvrawpay.c
index 19c14c2b..0f0ef7e8 100644
--- a/gst/rtp/gstrtpvrawpay.c
+++ b/gst/rtp/gstrtpvrawpay.c
@@ -211,6 +211,7 @@ gst_rtp_vraw_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
GstVideoFormat sampling;
const gchar *depthstr, *samplingstr, *colorimetrystr;
gchar *wstr, *hstr;
+ gboolean interlaced;
rtpvrawpay = GST_RTP_VRAW_PAY (payload);
@@ -229,6 +230,13 @@ gst_rtp_vraw_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
if (!res)
goto missing_dimension;
+ /* fail on interlaced video for now */
+ if (!gst_structure_get_boolean (s, "interlaced", &interlaced))
+ interlaced = FALSE;
+
+ if (interlaced)
+ goto interlaced;
+
yp = up = vp = 0;
xinc = yinc = 1;
@@ -358,6 +366,11 @@ unknown_fourcc:
GST_ERROR_OBJECT (payload, "invalid or missing fourcc");
return FALSE;
}
+interlaced:
+ {
+ GST_ERROR_OBJECT (payload, "interlaced video not supported yet");
+ return FALSE;
+ }
missing_dimension:
{
GST_ERROR_OBJECT (payload, "missing width or height property");
@@ -409,7 +422,7 @@ gst_rtp_vraw_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer)
GstBuffer *out;
guint8 *outdata, *headers;
gboolean next_line;
- guint length, cont, pixels;
+ guint length, cont, pixels, fieldid;
/* get the max allowed payload length size, we try to fill the complete MTU */
left = gst_rtp_buffer_calc_payload_len (mtu, 0, 0);
@@ -422,6 +435,24 @@ gst_rtp_vraw_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer)
GST_LOG_OBJECT (rtpvrawpay, "created buffer of size %u for MTU %u", left,
mtu);
+ /*
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Extended Sequence Number | Length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |F| Line No |C| Offset |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Length |F| Line No |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |C| Offset | .
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ .
+ * . .
+ * . Two (partial) lines of video data .
+ * . .
+ * +---------------------------------------------------------------+
+ */
+
/* need 2 bytes for the extended sequence number */
*outdata++ = 0;
*outdata++ = 0;
@@ -456,8 +487,12 @@ gst_rtp_vraw_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer)
/* write length */
*outdata++ = (length >> 8) & 0xff;
*outdata++ = length & 0xff;
+
+ /* always 0 for now */
+ fieldid = 0x00;
+
/* write line no */
- *outdata++ = (line >> 8) & 0x7f;
+ *outdata++ = ((line >> 8) & 0x7f) | fieldid;
*outdata++ = line & 0xff;
if (next_line) {