diff --git a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c index 6101c755ed..7611eb0e8f 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.c @@ -43,10 +43,15 @@ GST_DEBUG_CATEGORY_STATIC (rtphderext_debug); #define MAX_RTP_EXT_ID 256 +#define GST_RTP_HEADER_EXTENSION_DIRECTION_DEFAULT \ + (GST_RTP_HEADER_EXTENSION_DIRECTION_SENDRECV | \ + GST_RTP_HEADER_EXTENSION_DIRECTION_INHERITED) + typedef struct { guint ext_id; gboolean wants_update_non_rtp_src_caps; + GstRTPHeaderExtensionDirection direction; } GstRTPHeaderExtensionPrivate; /** @@ -193,6 +198,7 @@ gst_rtp_header_extension_init (GstRTPHeaderExtension * ext) gst_rtp_header_extension_get_instance_private (ext); priv->ext_id = G_MAXUINT32; + priv->direction = GST_RTP_HEADER_EXTENSION_DIRECTION_DEFAULT; } /** @@ -736,3 +742,52 @@ gst_rtp_header_extension_create_from_uri (const gchar * uri) return NULL; } + +/** + * gst_rtp_header_extension_set_direction: + * @ext: the #GstRTPHeaderExtension + * @direction: The direction + * + * Set the direction that this header extension should be used in. + * If #GST_RTP_HEADER_EXTENSION_DIRECTION_INHERITED is included, the + * direction will not be included in the caps (as it shouldn't be in the + * extmap line in the SDP). + * + * Since: 1.20 + */ + +void +gst_rtp_header_extension_set_direction (GstRTPHeaderExtension * ext, + GstRTPHeaderExtensionDirection direction) +{ + GstRTPHeaderExtensionPrivate *priv = + gst_rtp_header_extension_get_instance_private (ext); + + g_return_if_fail (GST_IS_RTP_HEADER_EXTENSION (ext)); + g_return_if_fail (direction <= GST_RTP_HEADER_EXTENSION_DIRECTION_DEFAULT); + + priv->direction = direction; +} + +/** + * gst_rtp_header_extension_get_direction: + * @ext: the #GstRTPHeaderExtension + * + * Retrieve the direction + * + * Returns: The direction + * + * Since: 1.20 + */ + +GstRTPHeaderExtensionDirection +gst_rtp_header_extension_get_direction (GstRTPHeaderExtension * ext) +{ + GstRTPHeaderExtensionPrivate *priv = + gst_rtp_header_extension_get_instance_private (ext); + + g_return_val_if_fail (GST_IS_RTP_HEADER_EXTENSION (ext), + GST_RTP_HEADER_EXTENSION_DIRECTION_DEFAULT); + + return priv->direction; +} diff --git a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.h b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.h index 76e7775be2..5fbf013e98 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.h +++ b/subprojects/gst-plugins-base/gst-libs/gst/rtp/gstrtphdrext.h @@ -103,6 +103,33 @@ typedef enum /*< underscore_name=gst_rtp_header_extension_flags >*/ GST_RTP_HEADER_EXTENSION_TWO_BYTE = (1 << 1), } GstRTPHeaderExtensionFlags; +/** + * GstRTPHeaderExtensionDirection: + * @GST_RTP_HEADER_EXTENSION_DIRECTION_INACTIVE: Neither send nor + * receive RTP Header Extensions + * @GST_RTP_HEADER_EXTENSION_DIRECTION_SENDONLY: Only send RTP Header + * Extensions @GST_RTP_HEADER_EXTENSION_DIRECTION_RECVONLY: Only + * receive RTP Header Extensions + * @GST_RTP_HEADER_EXTENSION_DIRECTION_SENDRECV: Send and receive RTP + * Header Extensions ext + * @GST_RTP_HEADER_EXTENSION_DIRECTION_INHERITED: RTP header extension + * direction is inherited from the stream + * + * Direction to which to apply the RTP Header Extension + * + * Since: 1.20 + */ +typedef enum /*< underscore_name=gst_rtp_header_extension_direction >*/ +{ + GST_RTP_HEADER_EXTENSION_DIRECTION_INACTIVE = 0, + GST_RTP_HEADER_EXTENSION_DIRECTION_SENDONLY = (1 << 0), + GST_RTP_HEADER_EXTENSION_DIRECTION_RECVONLY = (1 << 1), + GST_RTP_HEADER_EXTENSION_DIRECTION_SENDRECV = ( + GST_RTP_HEADER_EXTENSION_DIRECTION_SENDONLY | + GST_RTP_HEADER_EXTENSION_DIRECTION_RECVONLY), + GST_RTP_HEADER_EXTENSION_DIRECTION_INHERITED = (1 << 2) +} GstRTPHeaderExtensionDirection; + /** * GstRTPHeaderExtension: * @parent: the parent #GObject @@ -248,6 +275,12 @@ GstRTPHeaderExtension * gst_rtp_header_extension_create_from_uri (const gchar * GST_RTP_API gchar * gst_rtp_header_extension_get_sdp_caps_field_name (GstRTPHeaderExtension * ext); +GST_RTP_API +void gst_rtp_header_extension_set_direction (GstRTPHeaderExtension * ext, + GstRTPHeaderExtensionDirection direction); +GST_RTP_API +GstRTPHeaderExtensionDirection gst_rtp_header_extension_get_direction (GstRTPHeaderExtension * ext); + G_END_DECLS #endif /* __GST_RTPHDREXT_H__ */