rtpbasepayload->max_ptime = DEFAULT_MAX_PTIME;
}
+static gboolean
+_set_caps (GQuark field_id, const GValue * value, GstCaps * caps)
+{
+ gst_caps_set_value (caps, g_quark_to_string (field_id), value);
+
+ return TRUE;
+}
+
/**
- * gst_rtp_base_payload_set_outcaps:
+ * gst_rtp_base_payload_set_outcaps_structure:
* @payload: a #GstRTPBasePayload
- * @fieldname: the first field name or %NULL
- * @...: field values
- *
- * Configure the output caps with the optional parameters.
+ * @s: (nullable): a #GstStructure with the caps fields
*
- * Variable arguments should be in the form field name, field type
- * (as a GType), value(s). The last variable argument should be NULL.
+ * Configure the output caps with the optional fields.
*
* Returns: %TRUE if the caps could be set.
+ *
+ * Since: 1.20
*/
gboolean
-gst_rtp_base_payload_set_outcaps (GstRTPBasePayload * payload,
- const gchar * fieldname, ...)
+gst_rtp_base_payload_set_outcaps_structure (GstRTPBasePayload * payload,
+ GstStructure * s)
{
GstCaps *srccaps;
GST_DEBUG_OBJECT (payload, "defaults: %" GST_PTR_FORMAT, srccaps);
+ if (s && gst_structure_n_fields (s) > 0) {
+ gst_structure_foreach (s, (GstStructureForeachFunc) _set_caps, srccaps);
+
+ GST_DEBUG_OBJECT (payload, "custom added: %" GST_PTR_FORMAT, srccaps);
+ }
+
+ gst_caps_replace (&payload->priv->subclass_srccaps, srccaps);
+ gst_caps_unref (srccaps);
+
+ return gst_rtp_base_payload_negotiate (payload);
+}
+
+/**
+ * gst_rtp_base_payload_set_outcaps:
+ * @payload: a #GstRTPBasePayload
+ * @fieldname: the first field name or %NULL
+ * @...: field values
+ *
+ * Configure the output caps with the optional parameters.
+ *
+ * Variable arguments should be in the form field name, field type
+ * (as a GType), value(s). The last variable argument should be NULL.
+ *
+ * Returns: %TRUE if the caps could be set.
+ */
+gboolean
+gst_rtp_base_payload_set_outcaps (GstRTPBasePayload * payload,
+ const gchar * fieldname, ...)
+{
+ gboolean result;
+ GstStructure *s = NULL;
+
if (fieldname) {
va_list varargs;
+ s = gst_structure_new_empty ("unused");
+
/* override with custom properties */
va_start (varargs, fieldname);
- gst_caps_set_simple_valist (srccaps, fieldname, varargs);
+ gst_structure_set_valist (s, fieldname, varargs);
va_end (varargs);
-
- GST_DEBUG_OBJECT (payload, "custom added: %" GST_PTR_FORMAT, srccaps);
}
- gst_caps_replace (&payload->priv->subclass_srccaps, srccaps);
- gst_caps_unref (srccaps);
+ result = gst_rtp_base_payload_set_outcaps_structure (payload, s);
- return gst_rtp_base_payload_negotiate (payload);
+ gst_clear_structure (&s);
+
+ return result;
}
static void