mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
Add method to serialize RTSP options
Add gst_rtsp_options_as_text() method to serialize a set of RTSP options to a string. API: GstRTSP::gst_rtsp_options_as_text()
This commit is contained in:
parent
81cc88326f
commit
e8bd8cab41
2 changed files with 49 additions and 0 deletions
|
@ -395,3 +395,50 @@ gst_rtsp_find_method (const gchar * method)
|
|||
}
|
||||
return GST_RTSP_INVALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_options_as_text:
|
||||
* @options: one or more #GstRTSPMethod
|
||||
*
|
||||
* Convert @moptions to a string.
|
||||
*
|
||||
* Returns: a new string of @opions. g_free () after usage.
|
||||
*
|
||||
* Since: 0.10.23
|
||||
*/
|
||||
gchar *
|
||||
gst_rtsp_options_as_text (GstRTSPMethod options)
|
||||
{
|
||||
GString *str;
|
||||
|
||||
str = g_string_new ("");
|
||||
|
||||
if (options & GST_RTSP_OPTIONS)
|
||||
g_string_append (str, "OPTIONS, ");
|
||||
if (options & GST_RTSP_DESCRIBE)
|
||||
g_string_append (str, "DESCRIBE, ");
|
||||
if (options & GST_RTSP_ANNOUNCE)
|
||||
g_string_append (str, "ANNOUNCE, ");
|
||||
if (options & GST_RTSP_GET_PARAMETER)
|
||||
g_string_append (str, "GET_PARAMETER, ");
|
||||
if (options & GST_RTSP_PAUSE)
|
||||
g_string_append (str, "PAUSE, ");
|
||||
if (options & GST_RTSP_PLAY)
|
||||
g_string_append (str, "PLAY, ");
|
||||
if (options & GST_RTSP_RECORD)
|
||||
g_string_append (str, "RECORD, ");
|
||||
if (options & GST_RTSP_REDIRECT)
|
||||
g_string_append (str, "REDIRECT, ");
|
||||
if (options & GST_RTSP_SETUP)
|
||||
g_string_append (str, "SETUP, ");
|
||||
if (options & GST_RTSP_SET_PARAMETER)
|
||||
g_string_append (str, "SET_PARAMETER, ");
|
||||
if (options & GST_RTSP_TEARDOWN)
|
||||
g_string_append (str, "TEARDOWN, ");
|
||||
|
||||
/* remove trailing ", " if there is one */
|
||||
if (str->len > 2)
|
||||
str = g_string_truncate (str, str->len - 2);
|
||||
|
||||
return g_string_free (str, FALSE);
|
||||
}
|
||||
|
|
|
@ -338,6 +338,8 @@ const gchar* gst_rtsp_version_as_text (GstRTSPVersion version);
|
|||
const gchar* gst_rtsp_header_as_text (GstRTSPHeaderField field);
|
||||
const gchar* gst_rtsp_status_as_text (GstRTSPStatusCode code);
|
||||
|
||||
gchar* gst_rtsp_options_as_text (GstRTSPMethod options);
|
||||
|
||||
GstRTSPHeaderField gst_rtsp_find_header_field (const gchar *header);
|
||||
GstRTSPMethod gst_rtsp_find_method (const gchar *method);
|
||||
|
||||
|
|
Loading…
Reference in a new issue