rtsptransport: add method to get media-type from transport
Add a method to make a media-type from the transport. Deprecate the old method that only used the mode. Based on patch from Aleix Conchillo Flaqué <aleix@oblong.com> Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720219
This commit is contained in:
parent
5b13c5b464
commit
124cf22d5d
@ -77,15 +77,25 @@ typedef struct
|
|||||||
{
|
{
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
const GstRTSPTransMode mode;
|
const GstRTSPTransMode mode;
|
||||||
const gchar *gst_mime;
|
const GstRTSPProfile profile;
|
||||||
|
const gchar *media_type;
|
||||||
const gchar *manager[MAX_MANAGERS];
|
const gchar *manager[MAX_MANAGERS];
|
||||||
} GstRTSPTransMap;
|
} GstRTSPTransMap;
|
||||||
|
|
||||||
static const GstRTSPTransMap transports[] = {
|
static const GstRTSPTransMap transports[] = {
|
||||||
{"rtp", GST_RTSP_TRANS_RTP, "application/x-rtp", {"rtpbin", "rtpdec"}},
|
{"rtp", GST_RTSP_TRANS_RTP, GST_RTSP_PROFILE_AVP, "application/x-rtp",
|
||||||
{"x-real-rdt", GST_RTSP_TRANS_RDT, "application/x-rdt", {"rdtmanager", NULL}},
|
{"rtpbin", "rtpdec"}},
|
||||||
{"x-pn-tng", GST_RTSP_TRANS_RDT, "application/x-rdt", {"rdtmanager", NULL}},
|
{"srtp", GST_RTSP_TRANS_RTP, GST_RTSP_PROFILE_SAVP, "application/x-srtp",
|
||||||
{NULL, GST_RTSP_TRANS_UNKNOWN, NULL, {NULL, NULL}}
|
{"rtpbin", "rtpdec"}},
|
||||||
|
{"rtpf", GST_RTSP_TRANS_RTP, GST_RTSP_PROFILE_AVPF, "application/x-rtp",
|
||||||
|
{"rtpbin", "rtpdec"}},
|
||||||
|
{"srtpf", GST_RTSP_TRANS_RTP, GST_RTSP_PROFILE_SAVPF, "application/x-srtp",
|
||||||
|
{"rtpbin", "rtpdec"}},
|
||||||
|
{"x-real-rdt", GST_RTSP_TRANS_RDT, GST_RTSP_PROFILE_AVP, "application/x-rdt",
|
||||||
|
{"rdtmanager", NULL}},
|
||||||
|
{"x-pn-tng", GST_RTSP_TRANS_RDT, GST_RTSP_PROFILE_AVP, "application/x-rdt",
|
||||||
|
{"rdtmanager", NULL}},
|
||||||
|
{NULL, GST_RTSP_TRANS_UNKNOWN, GST_RTSP_PROFILE_UNKNOWN, NULL, {NULL, NULL}}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -228,7 +238,11 @@ gst_rtsp_transport_init (GstRTSPTransport * transport)
|
|||||||
* @mime: location to hold the result
|
* @mime: location to hold the result
|
||||||
*
|
*
|
||||||
* Get the mime type of the transport mode @trans. This mime type is typically
|
* Get the mime type of the transport mode @trans. This mime type is typically
|
||||||
* used to generate #GstCaps on buffers.
|
* used to generate #GstCaps events.
|
||||||
|
*
|
||||||
|
* Deprecated: This functions only deals with the GstRTSPTransMode and only
|
||||||
|
* returns the mime type for #GST_RTSP_PROFILE_AVP. Use
|
||||||
|
* gst_rtsp_transport_get_media_type() instead.
|
||||||
*
|
*
|
||||||
* Returns: #GST_RTSP_OK.
|
* Returns: #GST_RTSP_OK.
|
||||||
*/
|
*/
|
||||||
@ -240,9 +254,40 @@ gst_rtsp_transport_get_mime (GstRTSPTransMode trans, const gchar ** mime)
|
|||||||
g_return_val_if_fail (mime != NULL, GST_RTSP_EINVAL);
|
g_return_val_if_fail (mime != NULL, GST_RTSP_EINVAL);
|
||||||
|
|
||||||
for (i = 0; transports[i].name; i++)
|
for (i = 0; transports[i].name; i++)
|
||||||
if (transports[i].mode == trans)
|
if (transports[i].mode == trans
|
||||||
|
&& transports[i].profile == GST_RTSP_PROFILE_AVP)
|
||||||
break;
|
break;
|
||||||
*mime = transports[i].gst_mime;
|
*mime = transports[i].media_type;
|
||||||
|
|
||||||
|
return GST_RTSP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_rtsp_transport_get_media_type:
|
||||||
|
* @transport: a #GstRTSPTransport
|
||||||
|
* @mime: location to hold the result
|
||||||
|
*
|
||||||
|
* Get the media type of @transport. This media type is typically
|
||||||
|
* used to generate #GstCaps events.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*
|
||||||
|
* Returns: #GST_RTSP_OK.
|
||||||
|
*/
|
||||||
|
GstRTSPResult
|
||||||
|
gst_rtsp_transport_get_media_type (GstRTSPTransport * transport,
|
||||||
|
const gchar ** media_type)
|
||||||
|
{
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
g_return_val_if_fail (transport != NULL, GST_RTSP_EINVAL);
|
||||||
|
g_return_val_if_fail (media_type != NULL, GST_RTSP_EINVAL);
|
||||||
|
|
||||||
|
for (i = 0; transports[i].name; i++)
|
||||||
|
if (transports[i].mode == transport->trans
|
||||||
|
&& transports[i].profile == transport->profile)
|
||||||
|
break;
|
||||||
|
*media_type = transports[i].media_type;
|
||||||
|
|
||||||
return GST_RTSP_OK;
|
return GST_RTSP_OK;
|
||||||
}
|
}
|
||||||
|
@ -179,6 +179,9 @@ gchar* gst_rtsp_transport_as_text (GstRTSPTransport *transport)
|
|||||||
GstRTSPResult gst_rtsp_transport_get_mime (GstRTSPTransMode trans, const gchar **mime);
|
GstRTSPResult gst_rtsp_transport_get_mime (GstRTSPTransMode trans, const gchar **mime);
|
||||||
GstRTSPResult gst_rtsp_transport_get_manager (GstRTSPTransMode trans, const gchar **manager, guint option);
|
GstRTSPResult gst_rtsp_transport_get_manager (GstRTSPTransMode trans, const gchar **manager, guint option);
|
||||||
|
|
||||||
|
GstRTSPResult gst_rtsp_transport_get_media_type (GstRTSPTransport *transport,
|
||||||
|
const gchar **media_type);
|
||||||
|
|
||||||
GstRTSPResult gst_rtsp_transport_free (GstRTSPTransport *transport);
|
GstRTSPResult gst_rtsp_transport_free (GstRTSPTransport *transport);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user