/** * fs_session_new_stream: * @session: a #FsSession * @participant: #FsParticipant of a participant for the new stream * @direction: #FsStreamDirection describing the direction of the new stream that will * be created for this participant * @transmitter: Name of the type of transmitter to use for this session * @stream_transmitter_n_parameters: Number of parametrs passed to the stream * transmitter * @stream_transmitter_parameters: an array of n_parameters #GParameter struct * that will be passed * to the newly-create #FsStreamTransmitter * @error: location of a #GError, or %NULL if no error occured * * This function creates a stream for the given participant into the active session. * * Returns: the new #FsStream that has been created. User must unref the * #FsStream when the stream is ended. If an error occured, returns NULL. */ FsStream * fs_session_new_stream (FsSession *session, FsParticipant *participant, FsStreamDirection direction, const gchar *transmitter, guint stream_transmitter_n_parameters, GParameter *stream_transmitter_parameters, GError **error) { FsSessionClass *klass = FS_SESSION_GET_CLASS (session); FsStream *new_stream = NULL; g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (session), FS_TYPE_SESSION), NULL); if (klass->new_stream) { new_stream = klass->new_stream (session, participant, direction, transmitter, stream_transmitter_n_parameters, stream_transmitter_parameters, error); if (!new_stream) return NULL; /* Let's catch all stream errors and forward them */ g_signal_connect (new_stream, "error", G_CALLBACK (fs_session_error_forward), session); } else { g_set_error (error, FS_ERROR, FS_ERROR_NOT_IMPLEMENTED, "new_stream not defined for %s", G_OBJECT_TYPE_NAME (session)); } return new_stream; }
/** * fs_session_new_stream: * @session: a #FsSession * @participant: #FsParticipant of a participant for the new stream * @direction: #FsStreamDirection describing the direction of the new stream that will * be created for this participant * @error: location of a #GError, or %NULL if no error occured * * This function creates a stream for the given participant into the active session. * * Returns: (transfer full): the new #FsStream that has been created. * User must unref the #FsStream when the stream is ended. If an error occured, * returns NULL. */ FsStream * fs_session_new_stream (FsSession *session, FsParticipant *participant, FsStreamDirection direction, GError **error) { FsSessionClass *klass; FsStream *new_stream = NULL; g_return_val_if_fail (session, NULL); g_return_val_if_fail (FS_IS_SESSION (session), NULL); klass = FS_SESSION_GET_CLASS (session); g_return_val_if_fail (klass->new_stream, NULL); new_stream = klass->new_stream (session, participant, direction, error); if (!new_stream) return NULL; /* Let's catch all stream errors and forward them */ g_signal_connect_object (new_stream, "error", G_CALLBACK (fs_session_error_forward), session, 0); return new_stream; }
/** * fs_session_stop_telephony_event: * @session: an #FsSession * @method: The method used to send the event * * This function will stop sending a telephony event started by * fs_session_start_telephony_event(). If the event was being sent * for less than 50ms, it will be sent for 50ms minimum. If the * duration was a positive and the event is not over, it will cut it * short. * * Returns: %TRUE if sucessful, it can return %FALSE if the #FsSession * does not support telephony events or if no telephony event is being sent */ gboolean fs_session_stop_telephony_event (FsSession *session, FsDTMFMethod method) { FsSessionClass *klass = FS_SESSION_GET_CLASS (session); if (klass->stop_telephony_event) { return klass->stop_telephony_event (session, method); } else { GST_WARNING ("stop_telephony_event not defined in class"); } return FALSE; }
/** * fs_session_set_send_codec: * @session: a #FsSession * @send_codec: a #FsCodec representing the codec to send * @error: location of a #GError, or %NULL if no error occured * * This function will set the currently being sent codec for all streams in this * session. The given #FsCodec must be taken directly from the #codecs * property of the session. If the given codec is not in the codecs * list, @error will be set and %FALSE will be returned. The @send_codec will be * copied so it must be free'd using fs_codec_destroy() when done. * * Returns: %FALSE if the send codec couldn't be set. */ gboolean fs_session_set_send_codec (FsSession *session, FsCodec *send_codec, GError **error) { FsSessionClass *klass = FS_SESSION_GET_CLASS (session); if (klass->set_send_codec) { return klass->set_send_codec (session, send_codec, error); } else { g_set_error (error, FS_ERROR, FS_ERROR_NOT_IMPLEMENTED, "set_send_codec not defined in class"); } return FALSE; }
/** * fs_session_set_codec_preferences: * @session: a #FsSession * @codec_preferences: a #GList of #FsCodec with the desired configuration * @error: location of a #GError, or %NULL if no error occured * * Set the list of desired codec preferences. The user may * change this value during an ongoing session. Note that doing this can cause * the codecs to change. Therefore this requires the user to fetch * the new codecs and renegotiate them with the peers. It is a #GList * of #FsCodec. The changes are immediately effective. * The function does not take ownership of the list. * * The payload type may be a valid dynamic PT (96-127), %FS_CODEC_ID_DISABLE * or %FS_CODEC_ID_ANY. If the encoding name is "reserve-pt", then the * payload type of the codec will be "reserved" and not be used by any * dynamically assigned payload type. * * If the list of specifications would invalidate all codecs, an error will * be returned. * * Returns: %TRUE on success, %FALSE on error. */ gboolean fs_session_set_codec_preferences (FsSession *session, GList *codec_preferences, GError **error) { FsSessionClass *klass = FS_SESSION_GET_CLASS (session); if (klass->set_codec_preferences) { return klass->set_codec_preferences (session, codec_preferences, error); } else { g_set_error (error, FS_ERROR, FS_ERROR_NOT_IMPLEMENTED, "set_codec_preferences not defined in class"); } return FALSE; }
/** * fs_session_codecs_need_resend: * @session: a #FsSession * @old_codecs: (element-type FsCodec) (transfer none) (allow-none): * Codecs previously retrieved from the #FsSession:codecs property * @new_codecs: (element-type FsCodec) (transfer none) (allow-none): * Codecs recently retrieved from the #FsSession:codecs property * * Some codec updates need to be reliably transmitted to the other side * because they contain important parameters required to decode the media. * Other codec updates, caused by user action, don't. * * Returns: (element-type FsCodec) (transfer full): A new #GList of * #FsCodec that need to be resent or %NULL if there are none. This * list must be freed with fs_codec_list_destroy(). */ GList * fs_session_codecs_need_resend (FsSession *session, GList *old_codecs, GList *new_codecs) { FsSessionClass *klass; g_return_val_if_fail (session, 0); g_return_val_if_fail (FS_IS_SESSION (session), 0); klass = FS_SESSION_GET_CLASS (session); if (klass->codecs_need_resend) return klass->codecs_need_resend (session, old_codecs, new_codecs); return NULL; }
/** * fs_session_get_stream_transmitter_type: * @session: A #FsSession * @transmitter: The name of the transmitter * * Returns the GType of the stream transmitter, bindings can use it * to validate/convert the parameters passed to fs_session_new_stream(). * * Returns: The #GType of the stream transmitter */ GType fs_session_get_stream_transmitter_type (FsSession *session, const gchar *transmitter) { FsSessionClass *klass; g_return_val_if_fail (session, 0); g_return_val_if_fail (FS_IS_SESSION (session), 0); klass = FS_SESSION_GET_CLASS (session); if (klass->get_stream_transmitter_type) return klass->get_stream_transmitter_type (session, transmitter); return 0; }
/** * fs_session_stop_telephony_event: * @session: an #FsSession * * This function will stop sending a telephony event started by * fs_session_start_telephony_event(). If the event was being sent * for less than 50ms, it will be sent for 50ms minimum. If the * duration was a positive and the event is not over, it will cut it * short. * * If this function returns %TRUE, a "farstream-telephony-event-stopped" will * always be emitted when the event is actually stopped. * Returns: %TRUE if sucessful, it can return %FALSE if the #FsSession * does not support telephony events or if no telephony event is being sent */ gboolean fs_session_stop_telephony_event (FsSession *session) { FsSessionClass *klass; g_return_val_if_fail (session, FALSE); g_return_val_if_fail (FS_IS_SESSION (session), FALSE); klass = FS_SESSION_GET_CLASS (session); if (klass->stop_telephony_event) { return klass->stop_telephony_event (session); } else { GST_WARNING ("stop_telephony_event not defined in class"); } return FALSE; }
/** * fs_session_set_send_codec: * @session: a #FsSession * @send_codec: a #FsCodec representing the codec to send * @error: location of a #GError, or %NULL if no error occured * * This function will set the currently being sent codec for all streams in this * session. The given #FsCodec must be taken directly from the #codecs * property of the session. If the given codec is not in the codecs * list, @error will be set and %FALSE will be returned. The @send_codec will be * copied so it must be free'd using fs_codec_destroy() when done. * * Returns: %FALSE if the send codec couldn't be set. */ gboolean fs_session_set_send_codec (FsSession *session, FsCodec *send_codec, GError **error) { FsSessionClass *klass; g_return_val_if_fail (session, FALSE); g_return_val_if_fail (FS_IS_SESSION (session), FALSE); klass = FS_SESSION_GET_CLASS (session); if (klass->set_send_codec) { return klass->set_send_codec (session, send_codec, error); } else { GST_WARNING ("set_send_codec not defined in class"); g_set_error (error, FS_ERROR, FS_ERROR_NOT_IMPLEMENTED, "set_send_codec not defined in class"); } return FALSE; }