rtsptransport: calculate default lower transport
Add an internal method to calculate the default lower transport whan it is missing.
This commit is contained in:
parent
124cf22d5d
commit
594dd4287b
@ -78,24 +78,32 @@ typedef struct
|
|||||||
const gchar *name;
|
const gchar *name;
|
||||||
const GstRTSPTransMode mode;
|
const GstRTSPTransMode mode;
|
||||||
const GstRTSPProfile profile;
|
const GstRTSPProfile profile;
|
||||||
|
const GstRTSPLowerTrans ltrans;
|
||||||
const gchar *media_type;
|
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, GST_RTSP_PROFILE_AVP, "application/x-rtp",
|
{"rtp", GST_RTSP_TRANS_RTP, GST_RTSP_PROFILE_AVP,
|
||||||
|
GST_RTSP_LOWER_TRANS_UDP_MCAST, "application/x-rtp",
|
||||||
{"rtpbin", "rtpdec"}},
|
{"rtpbin", "rtpdec"}},
|
||||||
{"srtp", GST_RTSP_TRANS_RTP, GST_RTSP_PROFILE_SAVP, "application/x-srtp",
|
{"srtp", GST_RTSP_TRANS_RTP, GST_RTSP_PROFILE_SAVP,
|
||||||
|
GST_RTSP_LOWER_TRANS_UDP_MCAST, "application/x-srtp",
|
||||||
{"rtpbin", "rtpdec"}},
|
{"rtpbin", "rtpdec"}},
|
||||||
{"rtpf", GST_RTSP_TRANS_RTP, GST_RTSP_PROFILE_AVPF, "application/x-rtp",
|
{"rtpf", GST_RTSP_TRANS_RTP, GST_RTSP_PROFILE_AVPF,
|
||||||
|
GST_RTSP_LOWER_TRANS_UDP_MCAST, "application/x-rtp",
|
||||||
{"rtpbin", "rtpdec"}},
|
{"rtpbin", "rtpdec"}},
|
||||||
{"srtpf", GST_RTSP_TRANS_RTP, GST_RTSP_PROFILE_SAVPF, "application/x-srtp",
|
{"srtpf", GST_RTSP_TRANS_RTP, GST_RTSP_PROFILE_SAVPF,
|
||||||
|
GST_RTSP_LOWER_TRANS_UDP_MCAST, "application/x-srtp",
|
||||||
{"rtpbin", "rtpdec"}},
|
{"rtpbin", "rtpdec"}},
|
||||||
{"x-real-rdt", GST_RTSP_TRANS_RDT, GST_RTSP_PROFILE_AVP, "application/x-rdt",
|
{"x-real-rdt", GST_RTSP_TRANS_RDT, GST_RTSP_PROFILE_AVP,
|
||||||
|
GST_RTSP_LOWER_TRANS_UNKNOWN, "application/x-rdt",
|
||||||
{"rdtmanager", NULL}},
|
{"rdtmanager", NULL}},
|
||||||
{"x-pn-tng", GST_RTSP_TRANS_RDT, GST_RTSP_PROFILE_AVP, "application/x-rdt",
|
{"x-pn-tng", GST_RTSP_TRANS_RDT, GST_RTSP_PROFILE_AVP,
|
||||||
|
GST_RTSP_LOWER_TRANS_UNKNOWN, "application/x-rdt",
|
||||||
{"rdtmanager", NULL}},
|
{"rdtmanager", NULL}},
|
||||||
{NULL, GST_RTSP_TRANS_UNKNOWN, GST_RTSP_PROFILE_UNKNOWN, NULL, {NULL, NULL}}
|
{NULL, GST_RTSP_TRANS_UNKNOWN, GST_RTSP_PROFILE_UNKNOWN,
|
||||||
|
GST_RTSP_LOWER_TRANS_UNKNOWN, NULL, {NULL, NULL}}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -292,6 +300,19 @@ gst_rtsp_transport_get_media_type (GstRTSPTransport * transport,
|
|||||||
return GST_RTSP_OK;
|
return GST_RTSP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstRTSPLowerTrans
|
||||||
|
get_default_lower_trans (GstRTSPTransport * transport)
|
||||||
|
{
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
for (i = 0; transports[i].name; i++)
|
||||||
|
if (transports[i].mode == transport->trans
|
||||||
|
&& transports[i].profile == transport->profile)
|
||||||
|
break;
|
||||||
|
|
||||||
|
return transports[i].ltrans;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_rtsp_transport_get_manager:
|
* gst_rtsp_transport_get_manager:
|
||||||
* @trans: a #GstRTSPTransMode
|
* @trans: a #GstRTSPTransMode
|
||||||
@ -506,11 +527,7 @@ gst_rtsp_transport_parse (const gchar * str, GstRTSPTransport * transport)
|
|||||||
transport->lower_transport = ltrans[i].ltrans;
|
transport->lower_transport = ltrans[i].ltrans;
|
||||||
} else {
|
} else {
|
||||||
/* specifying the lower transport is optional */
|
/* specifying the lower transport is optional */
|
||||||
if (transport->trans == GST_RTSP_TRANS_RTP &&
|
transport->lower_transport = get_default_lower_trans (transport);
|
||||||
transport->profile == GST_RTSP_PROFILE_AVP)
|
|
||||||
transport->lower_transport = GST_RTSP_LOWER_TRANS_UDP_MCAST;
|
|
||||||
else
|
|
||||||
transport->lower_transport = GST_RTSP_LOWER_TRANS_UNKNOWN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (transp);
|
g_strfreev (transp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user