/*
* "a-framerate = (string) 0.00, "
* "x-framerate = (string) 0.00, "
+ * "a-framesize = (string) 1234-1234, "
* "x-dimensions = (string) \"1234,1234\", "
*/
"application/x-rtp, "
/*
* "a-framerate = (string) 0.00, "
* "x-framerate = (string) 0.00, "
+ * "a-framesize = (string) 1234-1234, "
* "x-dimensions = (string) \"1234,1234\""
*/
)
}
}
+ if ((media_attr = gst_structure_get_string (structure, "a-framesize"))) {
+ gint w, h;
+
+ if (sscanf (media_attr, "%d-%d", &w, &h) == 2) {
+ rtpjpegdepay->media_width = w;
+ rtpjpegdepay->media_height = h;
+ }
+ }
+
/* try to get a framerate */
media_attr = gst_structure_get_string (structure, "a-framerate");
if (!media_attr)
GST_STATIC_CAPS ("application/x-rtp, "
" media = (string) \"video\", "
" payload = (int) 26 , "
- " clock-rate = (int) 90000, " " encoding-name = (string) \"JPEG\"")
+ " clock-rate = (int) 90000, "
+ " encoding-name = (string) \"JPEG\", "
+ " width = (int) [ 1, 65536 ], "
+ " height = (int) [ 1, 65536 ]")
);
GST_DEBUG_CATEGORY_STATIC (rtpjpegpay_debug);
gint num = 0, denom;
gchar *rate = NULL;
gchar *dim = NULL;
+ gchar *size;
pay = GST_RTP_JPEG_PAY (basepayload);
- /* these properties are not mandatory, we can get them from the SOF, if there
+ /* these properties are mandatory, but they might be adjusted by the SOF, if there
* is one. */
- if (gst_structure_get_int (caps_structure, "height", &height)) {
- if (height <= 0) {
- goto invalid_dimension;
- }
+ if (!gst_structure_get_int (caps_structure, "height", &height) || height <= 0) {
+ goto invalid_dimension;
}
- if (gst_structure_get_int (caps_structure, "width", &width)) {
- if (width <= 0) {
- goto invalid_dimension;
- }
+ if (!gst_structure_get_int (caps_structure, "width", &width) || width <= 0) {
+ goto invalid_dimension;
}
if (gst_structure_get_fraction (caps_structure, "framerate", &num, &denom) &&
rate = g_strdup_printf("%f", framerate);
}
+ size = g_strdup_printf("%d-%d", width, height);
+
if (pay->width == 0) {
GST_DEBUG_OBJECT (pay,
"width or height are greater than 2040, adding x-dimensions to caps");
if (rate != NULL && dim != NULL) {
res = gst_rtp_base_payload_set_outcaps (basepayload, "a-framerate",
- G_TYPE_STRING, rate, "x-dimensions", G_TYPE_STRING, dim, NULL);
+ G_TYPE_STRING, rate, "a-framesize", G_TYPE_STRING, size,
+ "x-dimensions", G_TYPE_STRING, dim, NULL);
} else if (rate != NULL && dim == NULL) {
res = gst_rtp_base_payload_set_outcaps (basepayload, "a-framerate",
- G_TYPE_STRING, rate, NULL);
+ G_TYPE_STRING, rate, "a-framesize", G_TYPE_STRING, size, NULL);
} else if (rate == NULL && dim != NULL) {
res = gst_rtp_base_payload_set_outcaps (basepayload, "x-dimensions",
- G_TYPE_STRING, dim, NULL);
+ G_TYPE_STRING, dim, "a-framesize", G_TYPE_STRING, size, NULL);
} else {
- res = gst_rtp_base_payload_set_outcaps (basepayload, NULL);
+ res = gst_rtp_base_payload_set_outcaps (basepayload, "a-framesize",
+ G_TYPE_STRING, size, NULL);
}
if (dim != NULL)
g_free (dim);
if (rate != NULL)
g_free (rate);
+ g_free (size);
return res;