Ejemplo n.º 1
0
/**
 * 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;
}
Ejemplo n.º 2
0
/**
 * 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;
}