mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-04 23:46:43 +00:00
rtpssrcdemux: make naming consistent
Use plural for GstRtpSsrcDemuxPads, since it contains two pads, and use the variable-name 'dpads' everywhere. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/992>
This commit is contained in:
parent
80966ed0a3
commit
c721c6fe72
2 changed files with 52 additions and 53 deletions
|
@ -145,24 +145,24 @@ static guint gst_rtp_ssrc_demux_signals[LAST_SIGNAL] = { 0 };
|
||||||
/*
|
/*
|
||||||
* Item for storing GstPad <-> SSRC pairs.
|
* Item for storing GstPad <-> SSRC pairs.
|
||||||
*/
|
*/
|
||||||
struct _GstRtpSsrcDemuxPad
|
typedef struct
|
||||||
{
|
{
|
||||||
guint32 ssrc;
|
guint32 ssrc;
|
||||||
GstPad *rtp_pad;
|
GstPad *rtp_pad;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstPad *rtcp_pad;
|
GstPad *rtcp_pad;
|
||||||
};
|
} GstRtpSsrcDemuxPads;
|
||||||
|
|
||||||
/* find a src pad for a given SSRC, returns NULL if the SSRC was not found
|
/* find a src pad for a given SSRC, returns NULL if the SSRC was not found
|
||||||
* MUST be called with object lock
|
* MUST be called with object lock
|
||||||
*/
|
*/
|
||||||
static GstRtpSsrcDemuxPad *
|
static GstRtpSsrcDemuxPads *
|
||||||
find_demux_pad_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc)
|
find_demux_pads_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc)
|
||||||
{
|
{
|
||||||
GSList *walk;
|
GSList *walk;
|
||||||
|
|
||||||
for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) {
|
for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) {
|
||||||
GstRtpSsrcDemuxPad *pad = (GstRtpSsrcDemuxPad *) walk->data;
|
GstRtpSsrcDemuxPads *pad = (GstRtpSsrcDemuxPads *) walk->data;
|
||||||
|
|
||||||
if (pad->ssrc == ssrc)
|
if (pad->ssrc == ssrc)
|
||||||
return pad;
|
return pad;
|
||||||
|
@ -174,23 +174,23 @@ find_demux_pad_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc)
|
||||||
static GstPad *
|
static GstPad *
|
||||||
get_demux_pad_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc, PadType padtype)
|
get_demux_pad_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc, PadType padtype)
|
||||||
{
|
{
|
||||||
GstRtpSsrcDemuxPad *demuxpad;
|
GstRtpSsrcDemuxPads *dpads;
|
||||||
GstPad *retpad;
|
GstPad *retpad;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (demux);
|
GST_OBJECT_LOCK (demux);
|
||||||
|
|
||||||
demuxpad = find_demux_pad_for_ssrc (demux, ssrc);
|
dpads = find_demux_pads_for_ssrc (demux, ssrc);
|
||||||
if (!demuxpad) {
|
if (!dpads) {
|
||||||
GST_OBJECT_UNLOCK (demux);
|
GST_OBJECT_UNLOCK (demux);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (padtype) {
|
switch (padtype) {
|
||||||
case RTP_PAD:
|
case RTP_PAD:
|
||||||
retpad = gst_object_ref (demuxpad->rtp_pad);
|
retpad = gst_object_ref (dpads->rtp_pad);
|
||||||
break;
|
break;
|
||||||
case RTCP_PAD:
|
case RTCP_PAD:
|
||||||
retpad = gst_object_ref (demuxpad->rtcp_pad);
|
retpad = gst_object_ref (dpads->rtcp_pad);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
retpad = NULL;
|
retpad = NULL;
|
||||||
|
@ -280,7 +280,7 @@ find_or_create_demux_pad_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc,
|
||||||
GstElementClass *klass;
|
GstElementClass *klass;
|
||||||
GstPadTemplate *templ;
|
GstPadTemplate *templ;
|
||||||
gchar *padname;
|
gchar *padname;
|
||||||
GstRtpSsrcDemuxPad *demuxpad;
|
GstRtpSsrcDemuxPads *dpads;
|
||||||
GstPad *retpad;
|
GstPad *retpad;
|
||||||
guint num_streams;
|
guint num_streams;
|
||||||
|
|
||||||
|
@ -313,16 +313,16 @@ find_or_create_demux_pad_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc,
|
||||||
g_free (padname);
|
g_free (padname);
|
||||||
|
|
||||||
/* wrap in structure and add to list */
|
/* wrap in structure and add to list */
|
||||||
demuxpad = g_new0 (GstRtpSsrcDemuxPad, 1);
|
dpads = g_new0 (GstRtpSsrcDemuxPads, 1);
|
||||||
demuxpad->ssrc = ssrc;
|
dpads->ssrc = ssrc;
|
||||||
demuxpad->rtp_pad = rtp_pad;
|
dpads->rtp_pad = rtp_pad;
|
||||||
demuxpad->rtcp_pad = rtcp_pad;
|
dpads->rtcp_pad = rtcp_pad;
|
||||||
|
|
||||||
gst_pad_set_element_private (rtp_pad, demuxpad);
|
gst_pad_set_element_private (rtp_pad, dpads);
|
||||||
gst_pad_set_element_private (rtcp_pad, demuxpad);
|
gst_pad_set_element_private (rtcp_pad, dpads);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (demux);
|
GST_OBJECT_LOCK (demux);
|
||||||
demux->srcpads = g_slist_prepend (demux->srcpads, demuxpad);
|
demux->srcpads = g_slist_prepend (demux->srcpads, dpads);
|
||||||
GST_OBJECT_UNLOCK (demux);
|
GST_OBJECT_UNLOCK (demux);
|
||||||
|
|
||||||
gst_pad_set_query_function (rtp_pad, gst_rtp_ssrc_demux_src_query);
|
gst_pad_set_query_function (rtp_pad, gst_rtp_ssrc_demux_src_query);
|
||||||
|
@ -346,10 +346,10 @@ find_or_create_demux_pad_for_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc,
|
||||||
|
|
||||||
switch (padtype) {
|
switch (padtype) {
|
||||||
case RTP_PAD:
|
case RTP_PAD:
|
||||||
retpad = gst_object_ref (demuxpad->rtp_pad);
|
retpad = gst_object_ref (dpads->rtp_pad);
|
||||||
break;
|
break;
|
||||||
case RTCP_PAD:
|
case RTCP_PAD:
|
||||||
retpad = gst_object_ref (demuxpad->rtcp_pad);
|
retpad = gst_object_ref (dpads->rtcp_pad);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
retpad = NULL;
|
retpad = NULL;
|
||||||
|
@ -521,14 +521,14 @@ gst_rtp_ssrc_demux_reset (GstRtpSsrcDemux * demux)
|
||||||
GSList *walk;
|
GSList *walk;
|
||||||
|
|
||||||
for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) {
|
for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) {
|
||||||
GstRtpSsrcDemuxPad *dpad = (GstRtpSsrcDemuxPad *) walk->data;
|
GstRtpSsrcDemuxPads *dpads = (GstRtpSsrcDemuxPads *) walk->data;
|
||||||
|
|
||||||
gst_pad_set_active (dpad->rtp_pad, FALSE);
|
gst_pad_set_active (dpads->rtp_pad, FALSE);
|
||||||
gst_pad_set_active (dpad->rtcp_pad, FALSE);
|
gst_pad_set_active (dpads->rtcp_pad, FALSE);
|
||||||
|
|
||||||
gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpad->rtp_pad);
|
gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpads->rtp_pad);
|
||||||
gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpad->rtcp_pad);
|
gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpads->rtcp_pad);
|
||||||
g_free (dpad);
|
g_free (dpads);
|
||||||
}
|
}
|
||||||
g_slist_free (demux->srcpads);
|
g_slist_free (demux->srcpads);
|
||||||
demux->srcpads = NULL;
|
demux->srcpads = NULL;
|
||||||
|
@ -560,31 +560,31 @@ gst_rtp_ssrc_demux_finalize (GObject * object)
|
||||||
static void
|
static void
|
||||||
gst_rtp_ssrc_demux_clear_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc)
|
gst_rtp_ssrc_demux_clear_ssrc (GstRtpSsrcDemux * demux, guint32 ssrc)
|
||||||
{
|
{
|
||||||
GstRtpSsrcDemuxPad *dpad;
|
GstRtpSsrcDemuxPads *dpads;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (demux);
|
GST_OBJECT_LOCK (demux);
|
||||||
dpad = find_demux_pad_for_ssrc (demux, ssrc);
|
dpads = find_demux_pads_for_ssrc (demux, ssrc);
|
||||||
if (dpad == NULL) {
|
if (dpads == NULL) {
|
||||||
GST_OBJECT_UNLOCK (demux);
|
GST_OBJECT_UNLOCK (demux);
|
||||||
goto unknown_pad;
|
goto unknown_pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux, "clearing pad for SSRC %08x", ssrc);
|
GST_DEBUG_OBJECT (demux, "clearing pad for SSRC %08x", ssrc);
|
||||||
|
|
||||||
demux->srcpads = g_slist_remove (demux->srcpads, dpad);
|
demux->srcpads = g_slist_remove (demux->srcpads, dpads);
|
||||||
GST_OBJECT_UNLOCK (demux);
|
GST_OBJECT_UNLOCK (demux);
|
||||||
|
|
||||||
gst_pad_set_active (dpad->rtp_pad, FALSE);
|
gst_pad_set_active (dpads->rtp_pad, FALSE);
|
||||||
gst_pad_set_active (dpad->rtcp_pad, FALSE);
|
gst_pad_set_active (dpads->rtcp_pad, FALSE);
|
||||||
|
|
||||||
g_signal_emit (G_OBJECT (demux),
|
g_signal_emit (G_OBJECT (demux),
|
||||||
gst_rtp_ssrc_demux_signals[SIGNAL_REMOVED_SSRC_PAD], 0, ssrc,
|
gst_rtp_ssrc_demux_signals[SIGNAL_REMOVED_SSRC_PAD], 0, ssrc,
|
||||||
dpad->rtp_pad);
|
dpads->rtp_pad);
|
||||||
|
|
||||||
gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpad->rtp_pad);
|
gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpads->rtp_pad);
|
||||||
gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpad->rtcp_pad);
|
gst_element_remove_pad (GST_ELEMENT_CAST (demux), dpads->rtcp_pad);
|
||||||
|
|
||||||
g_free (dpad);
|
g_free (dpads);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -613,10 +613,10 @@ forward_event (GstPad * pad, gpointer user_data)
|
||||||
|
|
||||||
GST_OBJECT_LOCK (fdata->demux);
|
GST_OBJECT_LOCK (fdata->demux);
|
||||||
for (walk = fdata->demux->srcpads; walk; walk = walk->next) {
|
for (walk = fdata->demux->srcpads; walk; walk = walk->next) {
|
||||||
GstRtpSsrcDemuxPad *dpad = (GstRtpSsrcDemuxPad *) walk->data;
|
GstRtpSsrcDemuxPads *dpads = (GstRtpSsrcDemuxPads *) walk->data;
|
||||||
|
|
||||||
if (pad == dpad->rtp_pad || pad == dpad->rtcp_pad) {
|
if (pad == dpads->rtp_pad || pad == dpads->rtcp_pad) {
|
||||||
newevent = add_ssrc_and_ref (fdata->event, dpad->ssrc);
|
newevent = add_ssrc_and_ref (fdata->event, dpads->ssrc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,15 +806,15 @@ create_failed:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstRtpSsrcDemuxPad *
|
static GstRtpSsrcDemuxPads *
|
||||||
find_demux_pad_for_pad (GstRtpSsrcDemux * demux, GstPad * pad)
|
find_demux_pad_for_pad (GstRtpSsrcDemux * demux, GstPad * pad)
|
||||||
{
|
{
|
||||||
GSList *walk;
|
GSList *walk;
|
||||||
|
|
||||||
for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) {
|
for (walk = demux->srcpads; walk; walk = g_slist_next (walk)) {
|
||||||
GstRtpSsrcDemuxPad *dpad = (GstRtpSsrcDemuxPad *) walk->data;
|
GstRtpSsrcDemuxPads *dpads = (GstRtpSsrcDemuxPads *) walk->data;
|
||||||
if (dpad->rtp_pad == pad || dpad->rtcp_pad == pad) {
|
if (dpads->rtp_pad == pad || dpads->rtcp_pad == pad) {
|
||||||
return dpad;
|
return dpads;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -837,14 +837,14 @@ gst_rtp_ssrc_demux_src_event (GstPad * pad, GstObject * parent,
|
||||||
case GST_EVENT_CUSTOM_BOTH_OOB:
|
case GST_EVENT_CUSTOM_BOTH_OOB:
|
||||||
s = gst_event_get_structure (event);
|
s = gst_event_get_structure (event);
|
||||||
if (s && !gst_structure_has_field (s, "ssrc")) {
|
if (s && !gst_structure_has_field (s, "ssrc")) {
|
||||||
GstRtpSsrcDemuxPad *dpad = find_demux_pad_for_pad (demux, pad);
|
GstRtpSsrcDemuxPads *dpads = find_demux_pad_for_pad (demux, pad);
|
||||||
|
|
||||||
if (dpad) {
|
if (dpads) {
|
||||||
GstStructure *ws;
|
GstStructure *ws;
|
||||||
|
|
||||||
event = gst_event_make_writable (event);
|
event = gst_event_make_writable (event);
|
||||||
ws = gst_event_writable_structure (event);
|
ws = gst_event_writable_structure (event);
|
||||||
gst_structure_set (ws, "ssrc", G_TYPE_UINT, dpad->ssrc, NULL);
|
gst_structure_set (ws, "ssrc", G_TYPE_UINT, dpads->ssrc, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -867,12 +867,12 @@ gst_rtp_ssrc_demux_iterate_internal_links_src (GstPad * pad, GstObject * parent)
|
||||||
|
|
||||||
GST_OBJECT_LOCK (demux);
|
GST_OBJECT_LOCK (demux);
|
||||||
for (current = demux->srcpads; current; current = g_slist_next (current)) {
|
for (current = demux->srcpads; current; current = g_slist_next (current)) {
|
||||||
GstRtpSsrcDemuxPad *dpad = (GstRtpSsrcDemuxPad *) current->data;
|
GstRtpSsrcDemuxPads *dpads = (GstRtpSsrcDemuxPads *) current->data;
|
||||||
|
|
||||||
if (pad == dpad->rtp_pad) {
|
if (pad == dpads->rtp_pad) {
|
||||||
otherpad = demux->rtp_sink;
|
otherpad = demux->rtp_sink;
|
||||||
break;
|
break;
|
||||||
} else if (pad == dpad->rtcp_pad) {
|
} else if (pad == dpads->rtcp_pad) {
|
||||||
otherpad = demux->rtcp_sink;
|
otherpad = demux->rtcp_sink;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -949,16 +949,16 @@ gst_rtp_ssrc_demux_src_query (GstPad * pad, GstObject * parent,
|
||||||
if ((res = gst_pad_peer_query (demux->rtp_sink, query))) {
|
if ((res = gst_pad_peer_query (demux->rtp_sink, query))) {
|
||||||
gboolean live;
|
gboolean live;
|
||||||
GstClockTime min_latency, max_latency;
|
GstClockTime min_latency, max_latency;
|
||||||
GstRtpSsrcDemuxPad *demuxpad;
|
GstRtpSsrcDemuxPads *dpads;
|
||||||
|
|
||||||
demuxpad = gst_pad_get_element_private (pad);
|
dpads = gst_pad_get_element_private (pad);
|
||||||
|
|
||||||
gst_query_parse_latency (query, &live, &min_latency, &max_latency);
|
gst_query_parse_latency (query, &live, &min_latency, &max_latency);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux, "peer min latency %" GST_TIME_FORMAT,
|
GST_DEBUG_OBJECT (demux, "peer min latency %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (min_latency));
|
GST_TIME_ARGS (min_latency));
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux, "latency for SSRC %08x", demuxpad->ssrc);
|
GST_DEBUG_OBJECT (demux, "latency for SSRC %08x", dpads->ssrc);
|
||||||
|
|
||||||
gst_query_set_latency (query, live, min_latency, max_latency);
|
gst_query_set_latency (query, live, min_latency, max_latency);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
typedef struct _GstRtpSsrcDemux GstRtpSsrcDemux;
|
typedef struct _GstRtpSsrcDemux GstRtpSsrcDemux;
|
||||||
typedef struct _GstRtpSsrcDemuxClass GstRtpSsrcDemuxClass;
|
typedef struct _GstRtpSsrcDemuxClass GstRtpSsrcDemuxClass;
|
||||||
typedef struct _GstRtpSsrcDemuxPad GstRtpSsrcDemuxPad;
|
|
||||||
|
|
||||||
struct _GstRtpSsrcDemux
|
struct _GstRtpSsrcDemux
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue