Top | ![]() |
![]() |
![]() |
![]() |
guint | buffer-size | Read / Write |
GstElement * | element | Read / Write / Construct Only |
gboolean | eos-shutdown | Read / Write |
GstRTSPProfile | profiles | Read / Write |
GstRTSPLowerTrans | protocols | Read / Write |
gboolean | reusable | Read / Write |
gboolean | shared | Read / Write |
GstRTSPSuspendMode | suspend-mode | Read / Write |
gboolean | time-provider | Read / Write |
void | new-state | Run Last |
void | new-stream | Run Last |
void | prepared | Run Last |
void | removed-stream | Run Last |
void | target-state | Run Last |
void | unprepared | Run Last |
struct | GstRTSPMedia |
struct | GstRTSPMediaClass |
enum | GstRTSPMediaStatus |
enum | GstRTSPSuspendMode |
a GstRTSPMedia contains the complete GStreamer pipeline to manage the streaming to the clients. The actual data transfer is done by the GstRTSPStream objects that are created and exposed by the GstRTSPMedia.
The GstRTSPMedia is usually created from a GstRTSPMediaFactory when the client does a DESCRIBE or SETUP of a resource.
A media is created with gst_rtsp_media_new()
that takes the element that will
provide the streaming elements. For each of the streams, a new GstRTSPStream
object needs to be made with the gst_rtsp_media_create_stream()
which takes
the payloader element and the source pad that produces the RTP stream.
The pipeline of the media is set to PAUSED with gst_rtsp_media_prepare()
. The
prepare method will add rtpbin and sinks and sources to send and receive RTP
and RTCP packets from the clients. Each stream srcpad is connected to an
input into the internal rtpbin.
It is also possible to dynamically create GstRTSPStream objects during the
prepare phase. With gst_rtsp_media_get_status()
you can check the status of
the prepare phase.
After the media is prepared, it is ready for streaming. It will usually be
managed in a session with gst_rtsp_session_manage_media()
. See
GstRTSPSession and GstRTSPSessionMedia.
The state of the media can be controlled with gst_rtsp_media_set_state()
.
Seeking can be done with gst_rtsp_media_seek()
.
With gst_rtsp_media_unprepare()
the pipeline is stopped and shut down. When
gst_rtsp_media_set_eos_shutdown()
an EOS will be sent to the pipeline to
cleanly shut down.
With gst_rtsp_media_set_shared()
, the media can be shared between multiple
clients. With gst_rtsp_media_set_reusable()
you can control if the pipeline
can be prepared again after an unprepare.
Last reviewed on 2013-07-11 (1.0.0)
GstRTSPMedia *
gst_rtsp_media_new (GstElement *element
);
Create a new GstRTSPMedia instance. element
is the bin element that
provides the different streams. The GstRTSPMedia object contains the
element to produce RTP data for one or more related (audio/video/..)
streams.
Ownership is taken of element
.
GstElement *
gst_rtsp_media_get_element (GstRTSPMedia *media
);
Get the element that was used when constructing media
.
void gst_rtsp_media_take_pipeline (GstRTSPMedia *media
,GstPipeline *pipeline
);
Set pipeline
as the GstPipeline for media
. Ownership is
taken of pipeline
.
void gst_rtsp_media_set_permissions (GstRTSPMedia *media
,GstRTSPPermissions *permissions
);
Set permissions
on media
.
GstRTSPPermissions *
gst_rtsp_media_get_permissions (GstRTSPMedia *media
);
Get the permissions object from media
.
void gst_rtsp_media_set_shared (GstRTSPMedia *media
,gboolean shared
);
Set or unset if the pipeline for media
can be shared will multiple clients.
When shared
is TRUE
, client requests for this media will share the media
pipeline.
gboolean
gst_rtsp_media_is_shared (GstRTSPMedia *media
);
Check if the pipeline for media
can be shared between multiple clients.
void gst_rtsp_media_set_reusable (GstRTSPMedia *media
,gboolean reusable
);
Set or unset if the pipeline for media
can be reused after the pipeline has
been unprepared.
gboolean
gst_rtsp_media_is_reusable (GstRTSPMedia *media
);
Check if the pipeline for media
can be reused after an unprepare.
void gst_rtsp_media_set_profiles (GstRTSPMedia *media
,GstRTSPProfile profiles
);
Configure the allowed lower transport for media
.
GstRTSPProfile
gst_rtsp_media_get_profiles (GstRTSPMedia *media
);
Get the allowed profiles of media
.
void gst_rtsp_media_set_protocols (GstRTSPMedia *media
,GstRTSPLowerTrans protocols
);
Configure the allowed lower transport for media
.
GstRTSPLowerTrans
gst_rtsp_media_get_protocols (GstRTSPMedia *media
);
Get the allowed protocols of media
.
void gst_rtsp_media_set_eos_shutdown (GstRTSPMedia *media
,gboolean eos_shutdown
);
Set or unset if an EOS event will be sent to the pipeline for media
before
it is unprepared.
gboolean
gst_rtsp_media_is_eos_shutdown (GstRTSPMedia *media
);
Check if the pipeline for media
will send an EOS down the pipeline before
unpreparing.
void gst_rtsp_media_set_address_pool (GstRTSPMedia *media
,GstRTSPAddressPool *pool
);
configure pool
to be used as the address pool of media
.
GstRTSPAddressPool *
gst_rtsp_media_get_address_pool (GstRTSPMedia *media
);
Get the GstRTSPAddressPool used as the address pool of media
.
void gst_rtsp_media_set_buffer_size (GstRTSPMedia *media
,guint size
);
Set the kernel UDP buffer size.
guint
gst_rtsp_media_get_buffer_size (GstRTSPMedia *media
);
Get the kernel UDP buffer size.
gboolean gst_rtsp_media_setup_sdp (GstRTSPMedia *media
,GstSDPMessage *sdp
,GstSDPInfo *info
);
Add media
specific info to sdp
. info
is used to configure the connection
information in the SDP.
gboolean gst_rtsp_media_prepare (GstRTSPMedia *media
,GstRTSPThread *thread
);
Prepare media
for streaming. This function will create the objects
to manage the streaming. A pipeline must have been set on media
with
gst_rtsp_media_take_pipeline()
.
It will preroll the pipeline and collect vital information about the streams such as the duration.
gboolean
gst_rtsp_media_unprepare (GstRTSPMedia *media
);
Unprepare media
. After this call, the media should be prepared again before
it can be used again. If the media is set to be non-reusable, a new instance
must be created.
GstRTSPMediaStatus
gst_rtsp_media_get_status (GstRTSPMedia *media
);
Get the status of media
. When media
is busy preparing, this function waits
until media
is prepared or in error.
void gst_rtsp_media_set_suspend_mode (GstRTSPMedia *media
,GstRTSPSuspendMode mode
);
Control how @ media will be suspended after the SDP has been generated and after a PAUSE request has been performed.
Media must be unprepared when setting the suspend mode.
GstRTSPSuspendMode
gst_rtsp_media_get_suspend_mode (GstRTSPMedia *media
);
Get how media
will be suspended.
gboolean
gst_rtsp_media_suspend (GstRTSPMedia *media
);
Suspend media
. The state of the pipeline managed by media
is set to
GST_STATE_NULL but all streams are kept. media
can be prepared again
with gst_rtsp_media_unsuspend()
media
must be prepared with gst_rtsp_media_prepare()
;
gboolean
gst_rtsp_media_unsuspend (GstRTSPMedia *media
);
Unsuspend media
if it was in a suspended state. This method does nothing
when the media was not in the suspended state.
void
gst_rtsp_media_collect_streams (GstRTSPMedia *media
);
Find all payloader elements, they should be named pay%d in the
element of media
, and create GstRTSPStreams for them.
Collect all dynamic elements, named dynpay%d, and add them to the list of dynamic elements.
GstRTSPStream * gst_rtsp_media_create_stream (GstRTSPMedia *media
,GstElement *payloader
,GstPad *srcpad
);
Create a new stream in media
that provides RTP data on srcpad
.
srcpad
should be a pad of an element inside media->element
.
guint
gst_rtsp_media_n_streams (GstRTSPMedia *media
);
Get the number of streams in this media.
GstRTSPStream * gst_rtsp_media_get_stream (GstRTSPMedia *media
,guint idx
);
Retrieve the stream with index idx
from media
.
the GstRTSPStream at index
idx
or NULL
when a stream with that index did not exist.
[nullable][transfer none]
GstRTSPStream * gst_rtsp_media_find_stream (GstRTSPMedia *media
,const gchar *control
);
Find a stream in media
with control
as the control uri.
the GstRTSPStream with
control uri control
or NULL
when a stream with that control did
not exist.
[nullable][transfer none]
gboolean gst_rtsp_media_seek (GstRTSPMedia *media
,GstRTSPTimeRange *range
);
Seek the pipeline of media
to range
. media
must be prepared with
gst_rtsp_media_prepare()
.
gchar * gst_rtsp_media_get_range_string (GstRTSPMedia *media
,gboolean play
,GstRTSPRangeUnit unit
);
Get the current range as a string. media
must be prepared with
gst_rtsp_media_prepare()
.
gboolean gst_rtsp_media_set_state (GstRTSPMedia *media
,GstState state
,GPtrArray *transports
);
Set the state of media
to state
and for the transports in transports
.
media
must be prepared with gst_rtsp_media_prepare()
;
media |
||
state |
the target state of the media |
|
transports |
a GPtrArray of GstRTSPStreamTransport pointers. |
[transfer none][element-type GstRtspServer.RTSPStreamTransport] |
void gst_rtsp_media_set_pipeline_state (GstRTSPMedia *media
,GstState state
);
Set the state of the pipeline managed by media
to state
GstClock *
gst_rtsp_media_get_clock (GstRTSPMedia *media
);
Get the clock that is used by the pipeline in media
.
media
must be prepared before this method returns a valid clock object.
GstClockTime
gst_rtsp_media_get_base_time (GstRTSPMedia *media
);
Get the base_time that is used by the pipeline in media
.
media
must be prepared before this method returns a valid base_time.
void gst_rtsp_media_use_time_provider (GstRTSPMedia *media
,gboolean time_provider
);
Set media
to provide a GstNetTimeProvider.
gboolean
gst_rtsp_media_is_time_provider (GstRTSPMedia *media
);
Check if media
can provide a GstNetTimeProvider for its pipeline clock.
Use gst_rtsp_media_get_time_provider()
to get the network clock.
GstNetTimeProvider * gst_rtsp_media_get_time_provider (GstRTSPMedia *media
,const gchar *address
,guint16 port
);
Get the GstNetTimeProvider for the clock used by media
. The time provider
will listen on address
and port
for client time requests.
struct GstRTSPMedia;
A class that contains the GStreamer element along with a list of GstRTSPStream objects that can produce data.
This object is usually created from a GstRTSPMediaFactory.
struct GstRTSPMediaClass { GObjectClass parent_class; /* vmethods */ gboolean (*handle_message) (GstRTSPMedia *media, GstMessage *message); gboolean (*prepare) (GstRTSPMedia *media, GstRTSPThread *thread); gboolean (*unprepare) (GstRTSPMedia *media); gboolean (*suspend) (GstRTSPMedia *media); gboolean (*unsuspend) (GstRTSPMedia *media); gboolean (*convert_range) (GstRTSPMedia *media, GstRTSPTimeRange *range, GstRTSPRangeUnit unit); gboolean (*query_position) (GstRTSPMedia *media, gint64 *position); gboolean (*query_stop) (GstRTSPMedia *media, gint64 *stop); GstElement * (*create_rtpbin) (GstRTSPMedia *media); gboolean (*setup_rtpbin) (GstRTSPMedia *media, GstElement *rtpbin); gboolean (*setup_sdp) (GstRTSPMedia *media, GstSDPMessage *sdp, GstSDPInfo *info); /* signals */ void (*new_stream) (GstRTSPMedia *media, GstRTSPStream * stream); void (*removed_stream) (GstRTSPMedia *media, GstRTSPStream * stream); void (*prepared) (GstRTSPMedia *media); void (*unprepared) (GstRTSPMedia *media); void (*target_state) (GstRTSPMedia *media, GstState state); void (*new_state) (GstRTSPMedia *media, GstState state); };
The RTSP media class
GObjectClass |
||
handle a message |
||
the default implementation adds all elements and sets the pipeline's state to GST_STATE_PAUSED (or GST_STATE_PLAYING in case of NO_PREROLL elements). |
||
the default implementation sets the pipeline's state to GST_STATE_NULL and removes all elements. |
||
the default implementation sets the pipeline's state to GST_STATE_NULL GST_STATE_PAUSED depending on the selected suspend mode. |
||
the default implementation reverts the suspend operation. The pipeline will be prerolled again if it's state was set to GST_STATE_NULL in suspend. |
||
convert a range to the given unit |
||
query the current position in the pipeline |
||
query when playback will stop |
||
The state of the media pipeline.
“buffer-size”
property“buffer-size” guint
The kernel UDP buffer size to use.
Flags: Read / Write
Default value: 524288
“element”
property“element” GstElement *
The GstBin to use for streaming the media.
Flags: Read / Write / Construct Only
“eos-shutdown”
property“eos-shutdown” gboolean
Send an EOS event to the pipeline before unpreparing.
Flags: Read / Write
Default value: FALSE
“profiles”
property“profiles” GstRTSPProfile
Allowed transfer profiles.
Flags: Read / Write
Default value: GST_RTSP_PROFILE_AVP
“protocols”
property“protocols” GstRTSPLowerTrans
Allowed lower transport protocols.
Flags: Read / Write
Default value: GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_UDP_MCAST | GST_RTSP_LOWER_TRANS_TCP
“reusable”
property“reusable” gboolean
If this media pipeline can be reused after an unprepare.
Flags: Read / Write
Default value: FALSE
“shared”
property“shared” gboolean
If this media pipeline can be shared.
Flags: Read / Write
Default value: FALSE
“suspend-mode”
property“suspend-mode” GstRTSPSuspendMode
How to suspend the media in PAUSED.
Flags: Read / Write
Default value: GST_RTSP_SUSPEND_MODE_NONE
“time-provider”
property“time-provider” gboolean
Use a NetTimeProvider for clients.
Flags: Read / Write
Default value: FALSE
“new-state”
signalvoid user_function (GstRTSPMedia *gstrtspmedia, gint arg1, gpointer user_data)
Flags: Run Last
“new-stream”
signalvoid user_function (GstRTSPMedia *gstrtspmedia, GstRTSPStream *arg1, gpointer user_data)
Flags: Run Last
“prepared”
signalvoid user_function (GstRTSPMedia *gstrtspmedia, gpointer user_data)
Flags: Run Last
“removed-stream”
signalvoid user_function (GstRTSPMedia *gstrtspmedia, GstRTSPStream *arg1, gpointer user_data)
Flags: Run Last
“target-state”
signalvoid user_function (GstRTSPMedia *gstrtspmedia, gint arg1, gpointer user_data)
Flags: Run Last
“unprepared”
signalvoid user_function (GstRTSPMedia *gstrtspmedia, gpointer user_data)
Flags: Run Last