mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
rtpvrawpay: fail on interlaced video
Detect and fail when trying to payload interlaced video.
This commit is contained in:
parent
80510aeee7
commit
62d5787bcd
1 changed files with 37 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue