## TfStream

TfStream — Handles a media Stream

## Synopsis

                        TfStream;
                        TfStreamClass;
    void                tf_stream_error                     (TfStream *self,
                                                             TpMediaStreamError error,
                                                             const gchar *message);
    guint               tf_stream_get_id                    (TfStream *stream);

## Object Hierarchy

      GObject
       +----TfStream

## Properties

      "channel"                  TfChannel*            : Read / Write / Construct Only
      "codec-preferences"        FsCodecGList*         : Read / Write / Construct Only
      "direction"                guint                 : Read / Write / Construct Only
      "farsight-conference"      FsConference*         : Read / Write / Construct Only
      "farsight-participant"     FsParticipant*        : Read / Write / Construct Only
      "media-type"               guint                 : Read / Write / Construct Only
      "nat-properties"           gpointer              : Write / Construct Only
      "proxy"                    TpMediaStreamHandler*  : Read / Write / Construct Only
      "sink-pad"                 GstPad*               : Read
      "stream-id"                guint                 : Read / Write / Construct Only

## Signals

      "closed"                                         : Run Last
      "error"                                          : Run Last
      "free-resource"                                  : Run Last
      "request-resource"                               : Run Last
      "src-pad-added"                                  : Run Last

## Description

These objects handle media streams and wrap the appropriate Farsight 2 objects. It is used to interact on a stream level with the other parts of the media pipeline and the proper UI.

## Details

### TfStream

    typedef struct _TfStream TfStream;

All other members are privated

### TfStreamClass

    typedef struct {
      GObjectClass parent_class;
    } TfStreamClass;

There are no overridable functions

GObjectClass `parent_class`; | the parent GObjecClass

### tf_stream_error ()

    void                tf_stream_error                     (TfStream *self,
                                                             TpMediaStreamError error,
                                                             const gchar *message);

This function can be used to tell the connection manager that an error has happened on a specific stream.

`self` : | a TfStream
`error` : | the error number as a TpMediaStreamError
`message` : | the message for this error

### tf_stream_get_id ()

    guint               tf_stream_get_id                    (TfStream *stream);

Quick getter for the stream id

`stream` : | A TfStream
Returns : | the stream's id

## Property Details

### The `"channel"` property

      "channel"                  TfChannel*            : Read / Write / Construct Only

The TfChannel this stream is in.

### The `"codec-preferences"` property

      "codec-preferences"        FsCodecGList*         : Read / Write / Construct Only

A GList of FsCodec representing preferences to be passed to the fs_session_set_local_preferences() function.

### The `"direction"` property

      "direction"                guint                 : Read / Write / Construct Only

The Telepathy stream direction (a TpMediaStreamDirection).

Allowed values: <= 3

Default value: 3

### The `"farsight-conference"` property

      "farsight-conference"      FsConference*         : Read / Write / Construct Only

The Farsight conference this stream will create streams within.

### The `"farsight-participant"` property

      "farsight-participant"     FsParticipant*        : Read / Write / Construct Only

The Farsight participant this stream will create streams for.

### The `"media-type"` property

      "media-type"               guint                 : Read / Write / Construct Only

The Telepathy stream media type (as a TpStreamMediaType).

Allowed values: <= 1

Default value: 0

### The `"nat-properties"` property

      "nat-properties"           gpointer              : Write / Construct Only

A pointer to a TfNatProperties structure detailing which NAT traversal method and parameters to use for this stream.

### The `"proxy"` property

      "proxy"                    TpMediaStreamHandler*  : Read / Write / Construct Only

The stream handler proxy which this stream interacts with.

### The `"sink-pad"` property

      "sink-pad"                 GstPad*               : Read

This sink pad that data has to be sent.

### The `"stream-id"` property

      "stream-id"                guint                 : Read / Write / Construct Only

A number identifying this stream within its channel.

Default value: 0

## Signal Details

### The `"closed"` signal

    void                user_function                      (TfStream *stream,
                                                            gpointer  user_data)      : Run Last

This signal is emitted when the `Close()` signal is received from the connection manager.

`stream` : | the stream that has been closed
`user_data` : | user data set when the signal handler was connected.

### The `"error"` signal

    void                user_function                      (TfStream *stream,
                                                            gpointer  user_data)      : Run Last

This signal is emitted when there is an error on this stream

`stream` : | the stream that has been errored
`user_data` : | user data set when the signal handler was connected.

### The `"free-resource"` signal

    void                user_function                      (TfStream *stream,
                                                            guint     direction,
                                                            gpointer  user_data)      : Run Last

Emitted when the stream no longer needs a resource allocated from "request-resource" and it can be freed.

`stream` : | the stream for which resources can be freed
`direction` : | The direction for which this resource is freed (as a TpMediaDirection
`user_data` : | user data set when the signal handler was connected.

### The `"request-resource"` signal

    gboolean            user_function                      (TfStream *stream,
                                                            guint     direction,
                                                            gpointer  user_data)      : Run Last

This signal is emitted when the connection manager ask to send or receive media. For example, this can be used allocated an X window or open a camera. The resouces can later be freed on "free-resource"

`stream` : | the stream requesting the resources
`direction` : | The direction for which this resource is requested (as a TpMediaDirection
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` if the resources requested could be allocated or `FALSE` otherwise

### The `"src-pad-added"` signal

    void                user_function                      (TfStream *stream,
                                                            GstPad   *pad,
                                                            FsCodec  *codec,
                                                            gpointer  user_data)      : Run Last

This is emitted when a new src pad comes out. The user must connect this pad to his pipeline.

`stream` : | the stream which has a new pad
`pad` : | The new src pad
`codec` : | the codec for which data is coming out
`user_data` : | user data set when the signal handler was connected.