![]() |
![]() |
![]() |
GStreamer RTSP Server Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
struct GstRTSPMediaStream; struct GstRTSPMedia; struct GstRTSPMediaClass; struct GstRTSPMediaTrans; gboolean (*GstRTSPSendFunc) (GstBuffer *buffer
,guint8 channel
,gpointer user_data
); gboolean (*GstRTSPSendListFunc) (GstBufferList *blist
,guint8 channel
,gpointer user_data
); void (*GstRTSPKeepAliveFunc) (gpointer user_data
); enum GstRTSPMediaStatus; GstRTSPMedia * gst_rtsp_media_new (void
); void gst_rtsp_media_set_shared (GstRTSPMedia *media
,gboolean shared
); gboolean gst_rtsp_media_is_shared (GstRTSPMedia *media
); void gst_rtsp_media_set_reusable (GstRTSPMedia *media
,gboolean reusable
); gboolean gst_rtsp_media_is_reusable (GstRTSPMedia *media
); void gst_rtsp_media_set_protocols (GstRTSPMedia *media
,GstRTSPLowerTrans protocols
); GstRTSPLowerTrans gst_rtsp_media_get_protocols (GstRTSPMedia *media
); void gst_rtsp_media_set_eos_shutdown (GstRTSPMedia *media
,gboolean eos_shutdown
); gboolean gst_rtsp_media_is_eos_shutdown (GstRTSPMedia *media
); gboolean gst_rtsp_media_prepare (GstRTSPMedia *media
); gboolean gst_rtsp_media_is_prepared (GstRTSPMedia *media
); gboolean gst_rtsp_media_unprepare (GstRTSPMedia *media
); guint gst_rtsp_media_n_streams (GstRTSPMedia *media
); GstRTSPMediaStream * gst_rtsp_media_get_stream (GstRTSPMedia *media
,guint idx
); gboolean gst_rtsp_media_seek (GstRTSPMedia *media
,GstRTSPTimeRange *range
); gchar * gst_rtsp_media_get_range_string (GstRTSPMedia *media
,gboolean play
); GstFlowReturn gst_rtsp_media_stream_rtp (GstRTSPMediaStream *stream
,GstBuffer *buffer
); GstFlowReturn gst_rtsp_media_stream_rtcp (GstRTSPMediaStream *stream
,GstBuffer *buffer
); gboolean gst_rtsp_media_set_state (GstRTSPMedia *media
,GstState state
,GArray *transports
); void gst_rtsp_media_remove_elements (GstRTSPMedia *media
); void gst_rtsp_media_trans_cleanup (GstRTSPMediaTrans *trans
);
"eos-shutdown" gboolean : Read / Write "protocols" GstRTSPLowerTrans : Read / Write "reusable" gboolean : Read / Write "shared" gboolean : Read / Write
struct GstRTSPMediaStream { GstPad *srcpad; GstElement *payloader; gboolean prepared; /* pads on the rtpbin */ GstPad *recv_rtcp_sink; GstPad *recv_rtp_sink; GstPad *send_rtp_sink; GstPad *send_rtp_src; GstPad *send_rtcp_src; /* the RTPSession object */ GObject *session; /* sinks used for sending and receiving RTP and RTCP, they share * sockets */ GstElement *udpsrc[2]; GstElement *udpsink[2]; /* for TCP transport */ GstElement *appsrc[2]; GstElement *appsink[2]; GstElement *tee[2]; GstElement *selector[2]; /* server ports for sending/receiving */ GstRTSPRange server_port; /* the caps of the stream */ gulong caps_sig; GstCaps *caps; /* transports we stream to */ GList *transports; /* to filter out duplicate destinations in case multiudpsink is too old to do * this for us */ gboolean filter_duplicates; GList *destinations; };
The definition of a media stream. The streams are identified by id
.
GstPad * |
the srcpad of the stream |
GstElement * |
the payloader of the format |
gboolean |
if the stream is prepared for streaming |
GstPad * |
sinkpad for RTCP buffers |
GstPad * |
sinkpad for RTP buffers |
GstPad * |
|
GstPad * |
srcpad for RTP buffers |
GstPad * |
srcpad for RTCP buffers |
GObject * |
|
GstElement * |
the udp source elements for RTP/RTCP |
GstElement * |
the udp sink elements for RTP/RTCP |
GstElement * |
the app source elements for RTP/RTCP |
GstElement * |
the app sink elements for RTP/RTCP |
GstElement * |
|
GstElement * |
|
GstRTSPRange |
the server ports for this stream |
gulong |
the signal id for detecting caps |
GstCaps * |
the caps of the stream |
GList * |
|
gboolean |
|
GList * |
struct GstRTSPMedia;
A class that contains the GStreamer element along with a list of GstRTSPMediaStream objects that can produce data.
This object is usually created from a GstRTSPMediaFactory.
struct GstRTSPMediaClass { GObjectClass parent_class; /* thread for the mainloop */ GMainContext *context; GMainLoop *loop; GThread *thread; /* vmethods */ gboolean (*handle_message) (GstRTSPMedia *media, GstMessage *message); gboolean (*unprepare) (GstRTSPMedia *media); /* signals */ gboolean (*prepared) (GstRTSPMedia *media); gboolean (*unprepared) (GstRTSPMedia *media); gboolean (*new_state) (GstRTSPMedia *media, GstState state); };
The RTSP media class
GObjectClass |
|
GMainContext * |
the main context for dispatching messages |
GMainLoop * |
the mainloop for message. |
GThread * |
the thread dispatching messages. |
handle a message | |
the default implementation sets the pipeline's state to GST_STATE_NULL. | |
struct GstRTSPMediaTrans { guint idx; GstRTSPSendFunc send_rtp; GstRTSPSendFunc send_rtcp; GstRTSPSendListFunc send_rtp_list; GstRTSPSendListFunc send_rtcp_list; gpointer user_data; GDestroyNotify notify; GstRTSPKeepAliveFunc keep_alive; gpointer ka_user_data; GDestroyNotify ka_notify; gboolean active; gboolean timeout; GstRTSPTransport *transport; GObject *rtpsource; };
A Transport description for stream idx
guint |
a stream index |
GstRTSPSendFunc |
callback for sending RTP messages |
GstRTSPSendFunc |
callback for sending RTCP messages |
GstRTSPSendListFunc |
callback for sending RTP messages |
GstRTSPSendListFunc |
callback for sending RTCP messages |
gpointer |
user data passed in the callbacks |
GDestroyNotify |
free function for the user_data. |
GstRTSPKeepAliveFunc |
keep alive callback |
gpointer |
data passed to keep_alive
|
GDestroyNotify |
called when ka_user_data is freed |
gboolean |
if we are actively sending |
gboolean |
if we timed out |
GstRTSPTransport * |
a transport description |
GObject * |
the receiver rtp source object |
gboolean (*GstRTSPSendFunc) (GstBuffer *buffer
,guint8 channel
,gpointer user_data
);
gboolean (*GstRTSPSendListFunc) (GstBufferList *blist
,guint8 channel
,gpointer user_data
);
typedef enum { GST_RTSP_MEDIA_STATUS_UNPREPARED = 0, GST_RTSP_MEDIA_STATUS_PREPARING = 1, GST_RTSP_MEDIA_STATUS_PREPARED = 2, GST_RTSP_MEDIA_STATUS_ERROR = 3 } GstRTSPMediaStatus;
The state of the media pipeline.
GstRTSPMedia * gst_rtsp_media_new (void
);
Create a new GstRTSPMedia instance. The GstRTSPMedia object contains the element to produde RTP data for one or more related (audio/video/..) streams.
Returns : |
a new GstRTSPMedia object. |
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.
|
a GstRTSPMedia |
|
the new value |
gboolean gst_rtsp_media_is_shared (GstRTSPMedia *media
);
Check if the pipeline for media
can be shared between multiple clients.
|
a GstRTSPMedia |
Returns : |
TRUE if the media can be shared between 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.
|
a GstRTSPMedia |
|
the new value |
gboolean gst_rtsp_media_is_reusable (GstRTSPMedia *media
);
Check if the pipeline for media
can be reused after an unprepare.
|
a GstRTSPMedia |
Returns : |
TRUE if the media can be reused |
void gst_rtsp_media_set_protocols (GstRTSPMedia *media
,GstRTSPLowerTrans protocols
);
Configure the allowed lower transport for media
.
|
a GstRTSPMedia |
|
the new flags |
GstRTSPLowerTrans gst_rtsp_media_get_protocols (GstRTSPMedia *media
);
Get the allowed protocols of media
.
|
a GstRTSPMedia |
Returns : |
a GstRTSPLowerTrans |
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.
|
a GstRTSPMedia |
|
the new value |
gboolean gst_rtsp_media_is_eos_shutdown (GstRTSPMedia *media
);
Check if the pipeline for media
will send an EOS down the pipeline before
unpreparing.
|
a GstRTSPMedia |
Returns : |
TRUE if the media will send EOS before unpreparing. |
gboolean gst_rtsp_media_prepare (GstRTSPMedia *media
);
Prepare media
for streaming. This function will create the pipeline and
other objects to manage the streaming.
It will preroll the pipeline and collect vital information about the streams such as the duration.
|
a GstRTSPMedia |
Returns : |
TRUE on success. |
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.
|
a GstRTSPMedia |
Returns : |
TRUE on success. |
guint gst_rtsp_media_n_streams (GstRTSPMedia *media
);
Get the number of streams in this media.
|
a GstRTSPMedia |
Returns : |
The number of streams. |
GstRTSPMediaStream * gst_rtsp_media_get_stream (GstRTSPMedia *media
,guint idx
);
Retrieve the stream with index idx
from media
.
|
a GstRTSPMedia |
|
the stream index |
Returns : |
the GstRTSPMediaStream at index idx or NULL when a stream with
that index did not exist. |
gboolean gst_rtsp_media_seek (GstRTSPMedia *media
,GstRTSPTimeRange *range
);
Seek the pipeline to range
.
|
a GstRTSPMedia |
|
a GstRTSPTimeRange |
Returns : |
TRUE on success. |
gchar * gst_rtsp_media_get_range_string (GstRTSPMedia *media
,gboolean play
);
Get the current range as a string.
|
a GstRTSPMedia |
|
for the PLAY request |
Returns : |
The range as a string, g_free() after usage. |
GstFlowReturn gst_rtsp_media_stream_rtp (GstRTSPMediaStream *stream
,GstBuffer *buffer
);
Handle an RTP buffer for the stream. This method is usually called when a message has been received from a client using the TCP transport.
This function takes ownership of buffer
.
|
a GstRTSPMediaStream |
|
a GstBuffer |
Returns : |
a GstFlowReturn. |
GstFlowReturn gst_rtsp_media_stream_rtcp (GstRTSPMediaStream *stream
,GstBuffer *buffer
);
Handle an RTCP buffer for the stream. This method is usually called when a message has been received from a client using the TCP transport.
This function takes ownership of buffer
.
|
a GstRTSPMediaStream |
|
a GstBuffer |
Returns : |
a GstFlowReturn. |
gboolean gst_rtsp_media_set_state (GstRTSPMedia *media
,GstState state
,GArray *transports
);
Set the state of media
to state
and for the transports in transports
.
|
a GstRTSPMedia |
|
the target state of the media |
|
a GArray of GstRTSPMediaTrans pointers |
Returns : |
TRUE on success. |
void gst_rtsp_media_remove_elements (GstRTSPMedia *media
);
Remove all elements and the pipeline controlled by media
.
|
a GstRTSPMedia |
"eos-shutdown"
property"eos-shutdown" gboolean : Read / Write
Send an EOS event to the pipeline before unpreparing.
Default value: FALSE
"protocols"
property"protocols" GstRTSPLowerTrans : Read / Write
Allowed lower transport protocols.
Default value: GST_RTSP_LOWER_TRANS_UDP|GST_RTSP_LOWER_TRANS_TCP
"reusable"
property"reusable" gboolean : Read / Write
If this media pipeline can be reused after an unprepare.
Default value: FALSE
"shared"
property"shared" gboolean : Read / Write
If this media pipeline can be shared.
Default value: FALSE
"new-state"
signalvoid user_function (GstRTSPMedia *gstrtspmedia,
gpointer user_data) : Run Last
"prepared"
signalvoid user_function (GstRTSPMedia *gstrtspmedia,
gpointer user_data) : Run Last
"unprepared"
signalvoid user_function (GstRTSPMedia *gstrtspmedia,
gpointer user_data) : Run Last