mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
media: add method to get the base_time of the pipeline
Together with a shared clock, this base-time could eventually be sent to the client so that it can reconstruct the exact running-time of the clock on the server.
This commit is contained in:
parent
36ff679558
commit
a64cb68164
4 changed files with 55 additions and 0 deletions
|
@ -1745,7 +1745,44 @@ gst_rtsp_media_get_clock (GstRTSPMedia * media)
|
|||
g_rec_mutex_unlock (&priv->state_lock);
|
||||
|
||||
return clock;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_media_get_base_time:
|
||||
* @media: a #GstRTSPMedia
|
||||
*
|
||||
* Get the base_time that is used by the pipeline in @media.
|
||||
*
|
||||
* @media must be prepared before this method returns a valid base_time.
|
||||
*
|
||||
* Returns: the base_time used by @media.
|
||||
*/
|
||||
GstClockTime
|
||||
gst_rtsp_media_get_base_time (GstRTSPMedia * media)
|
||||
{
|
||||
GstClockTime result;
|
||||
GstRTSPMediaPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GST_IS_RTSP_MEDIA (media), GST_CLOCK_TIME_NONE);
|
||||
|
||||
priv = media->priv;
|
||||
|
||||
g_rec_mutex_lock (&priv->state_lock);
|
||||
if (media->priv->status != GST_RTSP_MEDIA_STATUS_PREPARED)
|
||||
goto not_prepared;
|
||||
|
||||
result = gst_element_get_base_time (media->priv->pipeline);
|
||||
g_rec_mutex_unlock (&priv->state_lock);
|
||||
|
||||
return result;
|
||||
|
||||
/* ERRORS */
|
||||
not_prepared:
|
||||
{
|
||||
g_rec_mutex_unlock (&priv->state_lock);
|
||||
GST_DEBUG_OBJECT (media, "media was not prepared");
|
||||
return GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -157,6 +157,7 @@ GstRTSPStream * gst_rtsp_media_create_stream (GstRTSPMedia *media,
|
|||
|
||||
/* dealing with the media */
|
||||
GstClock * gst_rtsp_media_get_clock (GstRTSPMedia *media);
|
||||
GstClockTime gst_rtsp_media_get_base_time (GstRTSPMedia *media);
|
||||
|
||||
guint gst_rtsp_media_n_streams (GstRTSPMedia *media);
|
||||
GstRTSPStream * gst_rtsp_media_get_stream (GstRTSPMedia *media, guint idx);
|
||||
|
|
|
@ -176,6 +176,22 @@ gst_rtsp_session_media_get_media (GstRTSPSessionMedia * media)
|
|||
return media->priv->media;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_session_media_get_base_time:
|
||||
* @media: a #GstRTSPSessionMedia
|
||||
*
|
||||
* Get the base_time of the #GstRTSPMedia in @media
|
||||
*
|
||||
* Returns: the base_time of the media.
|
||||
*/
|
||||
GstClockTime
|
||||
gst_rtsp_session_media_get_base_time (GstRTSPSessionMedia * media)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_RTSP_SESSION_MEDIA (media), GST_CLOCK_TIME_NONE);
|
||||
|
||||
return gst_rtsp_media_get_base_time (media->priv->media);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_session_media_set_transport:
|
||||
* @media: a #GstRTSPSessionMedia
|
||||
|
|
|
@ -71,6 +71,7 @@ gboolean gst_rtsp_session_media_matches_url (GstRTSPSessionMe
|
|||
const GstRTSPUrl *url);
|
||||
GstRTSPMedia * gst_rtsp_session_media_get_media (GstRTSPSessionMedia *media);
|
||||
|
||||
GstClockTime gst_rtsp_session_media_get_base_time (GstRTSPSessionMedia *media);
|
||||
/* control media */
|
||||
gboolean gst_rtsp_session_media_set_state (GstRTSPSessionMedia *media,
|
||||
GstState state);
|
||||
|
|
Loading…
Reference in a new issue