Farstream.Stream¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r |
A |
||
r |
Parameters used to decrypt the stream |
||
r/w/c |
An enum to set and get the direction of the stream |
||
r |
A |
||
r/w/co |
An |
||
r |
A |
||
r/w |
If |
||
r/w/co |
An |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
This signal is emitted in any error condition |
|
This signal is emitted when a new gst source pad has been created for a specific codec being received. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
Class Details¶
- class Farstream.Stream(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
All members are private, access them using methods and properties
- add_id(id)¶
- Parameters:
id (
int) – The id to add to the stream
This function is used to add data identifiers that allow the plugin to recognize packets that are meant for id. For example, in RTP, one would set the SSRCs that are expected.
Depending on the protocol, one may be able to add more than one ID to a stream (in RTP you can have multiple SSRCs in a stream). If a protocol supports only one id, adding a new one will overwrite it. If an ID was already set on a stream, adding it to another stream will override the previdous decision.
For most protocols, calling this function is optional as the incoming data can be matched with a stream by its source IP address. This is mostly useful if one is using multicast or is behind a muxer server.
- add_remote_candidates(candidates)¶
- Parameters:
candidates ([
Farstream.Candidate]) – anGLib.ListofFarstream.Candidaterepresenting the remote candidates- Raises:
- Returns:
- Return type:
This function adds remote candidates. Any new candidates are added to the list. The candidates will be used to establish a connection with the peer. A copy will be made so the user must free the passed candidate using fs_candidate_destroy() when done.
- destroy()¶
This will cause the stream to remove all links to other objects and to remove itself from the
Farstream.Session. Once aFarstream.Streamhas been destroyed, it can not be used anymore.It is strongly recommended to call this function from the main thread because releasing the application’s reference to a stream.
- emit_error(error_no, error_msg)¶
- Parameters:
This function emits the
Farstream.Stream::error" signal, it should only be called by subclasses.
- emit_src_pad_added(pad, codec)¶
- Parameters:
pad (
Gst.Pad) – theGst.Padthat thisFarstream.Streamhas createdcodec (
Farstream.Codec) – TheFarstream.Codecfor this pad
Emits the
Farstream.Stream::src-pad-added" signal, it should only be called by subclasses.
- force_remote_candidates(remote_candidates)¶
- Parameters:
remote_candidates ([
Farstream.Candidate]) – aGLib.ListofFarstream.Candidateto force- Raises:
- Returns:
- Return type:
This function forces data to be sent immediately to the selected remote candidate, by-passing any connectivity checks. There should be at most one candidate per component.
- iterate_src_pads()¶
- Returns:
The
Gst.Iterator- Return type:
Creates a
Gst.Iteratorthat can be used to iterate the src pads of this stream. These are the pads that were announced byFarstream.Stream:src-pad-addedand are still valid.
- parse_component_state_changed(message)¶
- Parameters:
message (
Gst.Message) – aGst.Messageto parse- Returns:
Trueif the message matches the stream and is valid.- component:
Returns the component from the
Gst.Messageif notNone- state:
Returns the
Farstream.StreamStatefrom theGst.Messageif notNone
- Return type:
(
bool, component:int, state:Farstream.StreamState)
Parses a “farstream-component-state-changed” message and checks if it matches the self parameters.
- parse_local_candidates_prepared(message)¶
- Parameters:
message (
Gst.Message) – aGst.Messageto parse- Returns:
Trueif the message matches the stream and is valid.- Return type:
Parses a “farstream-local-candidates-prepared” message and checks if it matches the self parameters.
- parse_new_active_candidate_pair(message)¶
- Parameters:
message (
Gst.Message) – aGst.Messageto parse- Returns:
Trueif the message matches the stream and is valid.- local_candidate:
Returns the local
Farstream.Candidatein the message if notNone.- remote_candidate:
Returns the remote
Farstream.Candidatein the message if notNone.
- Return type:
(
bool, local_candidate:Farstream.Candidate, remote_candidate:Farstream.Candidate)
Parses a “farstream-new-active-candidate-pair” message and checks if it matches the self parameters.
- parse_new_local_candidate(message)¶
- Parameters:
message (
Gst.Message) – aGst.Messageto parse- Returns:
Trueif the message matches the stream and is valid.- candidate:
Returns the
Farstream.Candidatein the message if notNone.
- Return type:
(
bool, candidate:Farstream.Candidate)
Parses a “farstream-new-local-candidate” message and checks if it matches the self parameters.
- parse_recv_codecs_changed(message)¶
- Parameters:
message (
Gst.Message) – aGst.Messageto parse- Returns:
Trueif the message matches the stream and is valid.- codecs:
Returns a
GLib.ListofFarstream.Codecof the message if notNone
- Return type:
(
bool, codecs: [Farstream.Codec])
Parses a “farstream-recv-codecs-changed” message and checks if it matches the self parameters.
- set_decryption_parameters(parameters)¶
- Parameters:
parameters (
Gst.Structure) – aGst.Structurecontaining the decryption parameters- Raises:
- Returns:
Trueif the decryption parameters could be set,Falseotherwise- Return type:
Sets decryption parameters. The exact parameters depend on the type of plugin being used.
- set_remote_codecs(remote_codecs)¶
- Parameters:
remote_codecs ([
Farstream.Codec]) – aGLib.ListofFarstream.Codecrepresenting the remote codecs- Raises:
- Returns:
Falseif the remote codecs couldn’t be set.- Return type:
This function will set the list of remote codecs for this stream. If the given remote codecs couldn’t be negotiated with the list of local codecs or already negotiated codecs for the corresponding
Farstream.Session, error will be set andFalsewill be returned. The remote_codecs list will be copied so it must be free’d using fs_codec_list_destroy() when done.
- set_transmitter(transmitter, stream_transmitter_parameters)¶
- Parameters:
transmitter (
str) – Name of the type of transmitter to use for this streamstream_transmitter_parameters ([
GObject.Parameter] orNone) – an array of n_parametersGObject.Parameterstruct that will be passed to the newly-createFarstream.StreamTransmitter
- Raises:
- Returns:
- Return type:
Set the transmitter to use for this stream. This function will only succeed once.
The parameters correspond to the varios
GObject.Objectproperties of the selected stream transmitter.
- set_transmitter_ht(transmitter, stream_transmitter_parameters)¶
- Parameters:
transmitter (
str) – Name of the type of transmitter to use for this streamstream_transmitter_parameters ({
str:GObject.Value} orNone) – AGLib.HashTableof string->:obj:GObject.Value containing the parameters.
- Raises:
- Returns:
- Return type:
Set the transmitter to use for this stream. This function will only succeed once.
The parameters correspond to the varios
GObject.Objectproperties of the selected stream transmitter.This is the same as
Farstream.Stream.set_transmitter() except that the parameters are passed in aGLib.HashTableto make it more friendly toGObject.Objectintrospection
- do_add_id(id) virtual¶
- Parameters:
id (
int) – The id to add to the stream
This function is used to add data identifiers that allow the plugin to recognize packets that are meant for id. For example, in RTP, one would set the SSRCs that are expected.
Depending on the protocol, one may be able to add more than one ID to a stream (in RTP you can have multiple SSRCs in a stream). If a protocol supports only one id, adding a new one will overwrite it. If an ID was already set on a stream, adding it to another stream will override the previdous decision.
For most protocols, calling this function is optional as the incoming data can be matched with a stream by its source IP address. This is mostly useful if one is using multicast or is behind a muxer server.
- do_add_remote_candidates(candidates) virtual¶
- Parameters:
candidates ([
Farstream.Candidate]) – anGLib.ListofFarstream.Candidaterepresenting the remote candidates- Returns:
- Return type:
This function adds remote candidates. Any new candidates are added to the list. The candidates will be used to establish a connection with the peer. A copy will be made so the user must free the passed candidate using fs_candidate_destroy() when done.
- do_force_remote_candidates(remote_candidates) virtual¶
- Parameters:
remote_candidates ([
Farstream.Candidate]) – aGLib.ListofFarstream.Candidateto force- Returns:
- Return type:
This function forces data to be sent immediately to the selected remote candidate, by-passing any connectivity checks. There should be at most one candidate per component.
- do_set_decryption_parameters(parameters) virtual¶
- Parameters:
parameters (
Gst.Structure) – aGst.Structurecontaining the decryption parameters- Returns:
Trueif the decryption parameters could be set,Falseotherwise- Return type:
Sets decryption parameters. The exact parameters depend on the type of plugin being used.
- do_set_remote_codecs(remote_codecs) virtual¶
- Parameters:
remote_codecs ([
Farstream.Codec]) – aGLib.ListofFarstream.Codecrepresenting the remote codecs- Returns:
Falseif the remote codecs couldn’t be set.- Return type:
This function will set the list of remote codecs for this stream. If the given remote codecs couldn’t be negotiated with the list of local codecs or already negotiated codecs for the corresponding
Farstream.Session, error will be set andFalsewill be returned. The remote_codecs list will be copied so it must be free’d using fs_codec_list_destroy() when done.
- do_set_transmitter(transmitter, stream_transmitter_parameters) virtual¶
- Parameters:
transmitter (
str) – Name of the type of transmitter to use for this streamstream_transmitter_parameters ([
GObject.Parameter] orNone) – an array of n_parametersGObject.Parameterstruct that will be passed to the newly-createFarstream.StreamTransmitter
- Returns:
- Return type:
Set the transmitter to use for this stream. This function will only succeed once.
The parameters correspond to the varios
GObject.Objectproperties of the selected stream transmitter.
Signal Details¶
- Farstream.Stream.signals.error(stream, errorno, error_msg)¶
- Signal Name:
error- Flags:
- Parameters:
stream (
Farstream.Stream) – The object which received the signalerrorno (
Farstream.Error) – The number of the errorerror_msg (
str) – Error message to be displayed to user
This signal is emitted in any error condition
- Farstream.Stream.signals.src_pad_added(stream, pad, codec)¶
- Signal Name:
src-pad-added- Flags:
- Parameters:
stream (
Farstream.Stream) – The object which received the signalcodec (
Farstream.Codec) –Farstream.Codecof the codec being received on the new source pad
This signal is emitted when a new gst source pad has been created for a specific codec being received. There will be a different source pad for each codec that is received. The user must ref the
Gst.Padif he wants to keep it. The user should not modify theFarstream.Codecand must copy it if he wants to use it outside the callback scope.This signal is not emitted on the main thread, but on GStreamer’s streaming thread!
Property Details¶
- Farstream.Stream.props.current_recv_codecs¶
-
This is the list of codecs that have been received by this stream. The user must free the list if fs_codec_list_destroy(). The “farstream-recv-codecs-changed” message is send on the
Gst.Buswhen the value of this property changes. It is normally emitted right afterFarstream.Stream::src-pad-addedonly if that codec was not previously received in this stream, but it can also be emitted if the pad already exists, but the source material that will come to it is different.
- Farstream.Stream.props.decryption_parameters¶
- Name:
decryption-parameters- Type:
- Default Value:
- Flags:
Retrieves previously set decryption parameters
- Farstream.Stream.props.direction¶
- Name:
direction- Type:
- Default Value:
- Flags:
The direction of the stream. This property is set initially as a parameter to the
Farstream.Session.new_stream() function. It can be changed later if required by setting this property.
- Farstream.Stream.props.negotiated_codecs¶
-
This is the list of negotiatied codecs, it is the same list as the list of
Farstream.Codecfrom the parentFarstream.Session, except that the codec config data has been replaced with the data from the remote codecs for this stream. This is the list ofFarstream.Codecused to receive data from this stream. It is aGLib.ListofFarstream.Codec.
- Farstream.Stream.props.participant¶
- Name:
participant- Type:
- Default Value:
- Flags:
The
Farstream.Participantfor this stream. This property is a construct param and is read-only construction.
- Farstream.Stream.props.remote_codecs¶
-
This is the list of remote codecs for this stream. They must be set by the user as soon as they are known using
Farstream.Stream.set_remote_codecs() (generally through external signaling). It is aGLib.ListofFarstream.Codec.
- Farstream.Stream.props.require_encryption¶
-
If set to
True, only encrypted content will be accepted on this stream.
- Farstream.Stream.props.session¶
- Name:
session- Type:
- Default Value:
- Flags:
The
Farstream.Sessionfor this stream. This property is a construct param and is read-only construction.