diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2014-05-08 22:32:26 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.co.uk> | 2014-09-18 13:37:59 -0400 |
commit | 279d507732bedc0395584c9ba0ad7bb555163e6d (patch) | |
tree | 8bcdf158c8e5207de5ea2b96e7f44ac014c5f927 /farstream | |
parent | 0cb4edb253ea78d8544682079c36b16f0b082df8 (diff) | |
download | farstream-279d507732bedc0395584c9ba0ad7bb555163e6d.tar.gz |
session: Add API to set the allowed caps
Diffstat (limited to 'farstream')
-rw-r--r-- | farstream/Makefile.am | 5 | ||||
-rw-r--r-- | farstream/fs-session.c | 80 | ||||
-rw-r--r-- | farstream/fs-session.h | 9 |
3 files changed, 91 insertions, 3 deletions
diff --git a/farstream/Makefile.am b/farstream/Makefile.am index 6e5cf9af..8cb9d569 100644 --- a/farstream/Makefile.am +++ b/farstream/Makefile.am @@ -91,7 +91,10 @@ Farstream_@FS_API_VERSION@_gir_LIBS = libfarstream-@FS_APIVERSION@.la Farstream_@FS_API_VERSION@_gir_FILES = $(introspection_sources) Farstream_@FS_API_VERSION@_gir_INCLUDES = GObject-2.0 Gst-@GST_API_VERSION@ Farstream_@FS_API_VERSION@_gir_CFLAGS = $(FS_INTERNAL_CFLAGS) -Farstream_@FS_API_VERSION@_gir_SCANNERFLAGS = --identifier-prefix=fs_ --identifier-prefix=Fs +Farstream_@FS_API_VERSION@_gir_SCANNERFLAGS = --identifier-prefix=fs_ \ + --identifier-prefix=Fs --add-init-section="gst_init(NULL,NULL);" +Farstream_@FS_API_VERSION@_gir_LDFLAGS = $(GST_LIBS) + girdir = $(datadir)/gir-1.0 dist_gir_DATA = Farstream-@FS_APIVERSION@.gir diff --git a/farstream/fs-session.c b/farstream/fs-session.c index 08a15172..eaa1b9e0 100644 --- a/farstream/fs-session.c +++ b/farstream/fs-session.c @@ -169,7 +169,9 @@ enum PROP_CODECS, PROP_CODECS_WITHOUT_CONFIG, PROP_CURRENT_SEND_CODEC, - PROP_TYPE_OF_SERVICE + PROP_TYPE_OF_SERVICE, + PROP_ALLOWED_SRC_CAPS, + PROP_ALLOWED_SINK_CAPS }; /* @@ -387,6 +389,36 @@ fs_session_class_init (FsSessionClass *klass) 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * FsSession:allowed-sink-caps: + * + * These are the #GstCaps that can be fed into the session, + * they are used to filter the codecs to only those that can + * accepted those caps as input. + */ + g_object_class_install_property (gobject_class, + PROP_ALLOWED_SINK_CAPS, + g_param_spec_boxed ("allowed-sink-caps", + "Allowed sink caps", + "GstCaps that can be fed into the session", + GST_TYPE_CAPS, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * FsSession:allowed-src-caps: + * + * These are the #GstCaps that the session can produce, + * they are used to filter the codecs to only those that can + * accepted those caps as output. + */ + g_object_class_install_property (gobject_class, + PROP_ALLOWED_SRC_CAPS, + g_param_spec_boxed ("allowed-src-caps", + "Allowed source caps", + "GstCaps that the session can produce", + GST_TYPE_CAPS, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + /** * FsSession::error: @@ -936,3 +968,49 @@ fs_session_parse_telephony_event_stopped (FsSession *session, return TRUE; } + +/** + * fs_session_set_allowed_caps: + * @session: a #FsSession + * @sink_caps: (allow-none): Caps for the sink pad or %NULL + * @src_caps: (allow-none): Caps for the src pad or %NULL + * @error: the location where a #GError can be stored or %NULL + * + * Sets the allowed caps for the sink and source pads for this #FsSession. + * Only codecs that can take the input specified by the @sink_caps and + * can produce output as specified by the @src_caps will be produced + * in the #FsSession:codecs property and so only those will be negotiated. + * + * If %NULL is passed to either @src_caps or @sink_caps, it is not changed. + * + * The default is "video/x-raw" for a video stream, "audio/x-raw" for an audio + * stream and "ANY" for an application stream. + * + * The values can be retrived using the #FsSession:allowed-src-caps and + * #FsSession:allowed-sink-caps properties. + * + * Returns: %TRUE if the new filter caps were acceptable. + * + * Since: UNRELEASED + */ +gboolean +fs_session_set_allowed_caps (FsSession *session, GstCaps *sink_caps, + GstCaps *src_caps, GError **error) +{ + FsSessionClass *klass; + + g_return_val_if_fail (FS_IS_SESSION (session), FALSE); + + if (sink_caps == NULL && src_caps == NULL) + return TRUE; + + klass = FS_SESSION_GET_CLASS (session); + + if (klass->set_allowed_caps) + return klass->set_allowed_caps (session, sink_caps, src_caps, error); + + g_set_error (error, FS_ERROR, FS_ERROR_NOT_IMPLEMENTED, + "set_allowed_caps is not implemented"); + + return FALSE; +} diff --git a/farstream/fs-session.h b/farstream/fs-session.h index 280627b4..c3fe4a50 100644 --- a/farstream/fs-session.h +++ b/farstream/fs-session.h @@ -109,6 +109,7 @@ typedef enum _FsDTMFMethod * @list_transmitters: Returns a list of the available transmitters * @get_stream_transmitter_type: Returns the GType of the stream transmitter * @codecs_need_resend: Returns the list of codecs that need resending + * @set_allowed_caps: Set the possible allowed src and sink caps * * You must override at least new_stream in a subclass. */ @@ -142,8 +143,11 @@ struct _FsSessionClass GList* (* codecs_need_resend) (FsSession *session, GList *old_codecs, GList *new_codecs); + gboolean (* set_allowed_caps) (FsSession *session, GstCaps *sink_caps, + GstCaps *src_caps, GError **error); + /*< private >*/ - gpointer _padding[8]; + gpointer _padding[7]; }; /** @@ -193,6 +197,9 @@ GType fs_session_get_stream_transmitter_type (FsSession *session, GList* fs_session_codecs_need_resend (FsSession *session, GList *old_codecs, GList *new_codecs); +gboolean fs_session_set_allowed_caps (FsSession *session, GstCaps *sink_caps, + GstCaps *src_caps, GError **error); + void fs_session_destroy (FsSession *session); |