mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
gst/rtsp/gstrtpdec.*: Make backward compat with rtpbin by adding the request-pt-map signals.
Original commit message from CVS: * gst/rtsp/gstrtpdec.c: (gst_rtp_dec_marshal_BOXED__UINT_UINT), (gst_rtp_dec_class_init), (gst_rtp_dec_chain_rtp): * gst/rtsp/gstrtpdec.h: Make backward compat with rtpbin by adding the request-pt-map signals. * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_create_stream), (new_session_pad), (request_pt_map), (gst_rtspsrc_stream_configure_transport), (gst_rtspsrc_stream_configure_caps), (gst_rtspsrc_activate_streams): * gst/rtsp/gstrtspsrc.h: Implement request-pt-map signals instead of setting caps on the buffers for the session manager.
This commit is contained in:
parent
bd11d3c9d2
commit
86a4c1c6b0
5 changed files with 134 additions and 5 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2007-04-12 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/rtsp/gstrtpdec.c: (gst_rtp_dec_marshal_BOXED__UINT_UINT),
|
||||||
|
(gst_rtp_dec_class_init), (gst_rtp_dec_chain_rtp):
|
||||||
|
* gst/rtsp/gstrtpdec.h:
|
||||||
|
Make backward compat with rtpbin by adding the request-pt-map signals.
|
||||||
|
|
||||||
|
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_create_stream),
|
||||||
|
(new_session_pad), (request_pt_map),
|
||||||
|
(gst_rtspsrc_stream_configure_transport),
|
||||||
|
(gst_rtspsrc_stream_configure_caps),
|
||||||
|
(gst_rtspsrc_activate_streams):
|
||||||
|
* gst/rtsp/gstrtspsrc.h:
|
||||||
|
Implement request-pt-map signals instead of setting caps on the buffers
|
||||||
|
for the session manager.
|
||||||
|
|
||||||
2007-04-11 Wim Taymans <wim@fluendo.com>
|
2007-04-11 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/udp/gstudp.c: (plugin_init):
|
* gst/udp/gstudp.c: (plugin_init):
|
||||||
|
|
|
@ -76,6 +76,7 @@ GST_ELEMENT_DETAILS ("RTP Decoder",
|
||||||
/* GstRTPDec signals and args */
|
/* GstRTPDec signals and args */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
SIGNAL_REQUEST_PT_MAP,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -189,7 +190,7 @@ free_session (GstRTPDecSession * session)
|
||||||
g_free (session);
|
g_free (session);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static guint gst_rtp_dec_signals[LAST_SIGNAL] = { 0 };*/
|
static guint gst_rtp_dec_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
GST_BOILERPLATE (GstRTPDec, gst_rtp_dec, GstElement, GST_TYPE_ELEMENT);
|
GST_BOILERPLATE (GstRTPDec, gst_rtp_dec, GstElement, GST_TYPE_ELEMENT);
|
||||||
|
|
||||||
|
@ -212,6 +213,44 @@ gst_rtp_dec_base_init (gpointer klass)
|
||||||
gst_element_class_set_details (element_class, &rtpdec_details);
|
gst_element_class_set_details (element_class, &rtpdec_details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* BOXED:UINT,UINT */
|
||||||
|
#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_rtp_dec_marshal_BOXED__UINT_UINT (GClosure * closure,
|
||||||
|
GValue * return_value,
|
||||||
|
guint n_param_values,
|
||||||
|
const GValue * param_values,
|
||||||
|
gpointer invocation_hint, gpointer marshal_data)
|
||||||
|
{
|
||||||
|
typedef gpointer (*GMarshalFunc_BOXED__UINT_UINT) (gpointer data1,
|
||||||
|
guint arg_1, guint arg_2, gpointer data2);
|
||||||
|
register GMarshalFunc_BOXED__UINT_UINT callback;
|
||||||
|
register GCClosure *cc = (GCClosure *) closure;
|
||||||
|
register gpointer data1, data2;
|
||||||
|
gpointer v_return;
|
||||||
|
|
||||||
|
g_return_if_fail (return_value != NULL);
|
||||||
|
g_return_if_fail (n_param_values == 3);
|
||||||
|
|
||||||
|
if (G_CCLOSURE_SWAP_DATA (closure)) {
|
||||||
|
data1 = closure->data;
|
||||||
|
data2 = g_value_peek_pointer (param_values + 0);
|
||||||
|
} else {
|
||||||
|
data1 = g_value_peek_pointer (param_values + 0);
|
||||||
|
data2 = closure->data;
|
||||||
|
}
|
||||||
|
callback =
|
||||||
|
(GMarshalFunc_BOXED__UINT_UINT) (marshal_data ? marshal_data : cc->
|
||||||
|
callback);
|
||||||
|
|
||||||
|
v_return = callback (data1,
|
||||||
|
g_marshal_value_peek_uint (param_values + 1),
|
||||||
|
g_marshal_value_peek_uint (param_values + 2), data2);
|
||||||
|
|
||||||
|
g_value_take_boxed (return_value, v_return);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_dec_class_init (GstRTPDecClass * g_class)
|
gst_rtp_dec_class_init (GstRTPDecClass * g_class)
|
||||||
{
|
{
|
||||||
|
@ -227,6 +266,20 @@ gst_rtp_dec_class_init (GstRTPDecClass * g_class)
|
||||||
gobject_class->set_property = gst_rtp_dec_set_property;
|
gobject_class->set_property = gst_rtp_dec_set_property;
|
||||||
gobject_class->get_property = gst_rtp_dec_get_property;
|
gobject_class->get_property = gst_rtp_dec_get_property;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstRTPDec::request-pt-map:
|
||||||
|
* @rtpdec: the object which received the signal
|
||||||
|
* @session: the session
|
||||||
|
* @pt: the pt
|
||||||
|
*
|
||||||
|
* Request the payload type as #GstCaps for @pt in @session.
|
||||||
|
*/
|
||||||
|
gst_rtp_dec_signals[SIGNAL_REQUEST_PT_MAP] =
|
||||||
|
g_signal_new ("request-pt-map", G_TYPE_FROM_CLASS (klass),
|
||||||
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRTPDecClass, request_pt_map),
|
||||||
|
NULL, NULL, gst_rtp_dec_marshal_BOXED__UINT_UINT, GST_TYPE_CAPS, 2,
|
||||||
|
G_TYPE_UINT, G_TYPE_UINT);
|
||||||
|
|
||||||
gstelement_class->provide_clock =
|
gstelement_class->provide_clock =
|
||||||
GST_DEBUG_FUNCPTR (gst_rtp_dec_provide_clock);
|
GST_DEBUG_FUNCPTR (gst_rtp_dec_provide_clock);
|
||||||
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_rtp_dec_change_state);
|
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_rtp_dec_change_state);
|
||||||
|
@ -308,17 +361,41 @@ gst_rtp_dec_chain_rtp (GstPad * pad, GstBuffer * buffer)
|
||||||
GstPadTemplate *templ;
|
GstPadTemplate *templ;
|
||||||
GstElementClass *klass;
|
GstElementClass *klass;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
GstCaps *caps;
|
||||||
|
GValue ret = { 0 };
|
||||||
|
GValue args[3] = { {0}
|
||||||
|
, {0}
|
||||||
|
, {0}
|
||||||
|
};
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (rtpdec, "creating stream");
|
GST_DEBUG_OBJECT (rtpdec, "creating stream");
|
||||||
|
|
||||||
session->ssrc = ssrc;
|
session->ssrc = ssrc;
|
||||||
session->pt = pt;
|
session->pt = pt;
|
||||||
|
|
||||||
|
/* get pt map */
|
||||||
|
g_value_init (&args[0], GST_TYPE_ELEMENT);
|
||||||
|
g_value_set_object (&args[0], rtpdec);
|
||||||
|
g_value_init (&args[1], G_TYPE_UINT);
|
||||||
|
g_value_set_uint (&args[1], session->id);
|
||||||
|
g_value_init (&args[2], G_TYPE_UINT);
|
||||||
|
g_value_set_uint (&args[2], pt);
|
||||||
|
|
||||||
|
g_value_init (&ret, GST_TYPE_CAPS);
|
||||||
|
g_value_set_boxed (&ret, NULL);
|
||||||
|
|
||||||
|
g_signal_emitv (args, gst_rtp_dec_signals[SIGNAL_REQUEST_PT_MAP], 0, &ret);
|
||||||
|
|
||||||
|
caps = (GstCaps *) g_value_get_boxed (&ret);
|
||||||
|
|
||||||
name = g_strdup_printf ("recv_rtp_src_%d_%u_%d", session->id, ssrc, pt);
|
name = g_strdup_printf ("recv_rtp_src_%d_%u_%d", session->id, ssrc, pt);
|
||||||
klass = GST_ELEMENT_GET_CLASS (rtpdec);
|
klass = GST_ELEMENT_GET_CLASS (rtpdec);
|
||||||
templ = gst_element_class_get_pad_template (klass, "recv_rtp_src_%d_%d_%d");
|
templ = gst_element_class_get_pad_template (klass, "recv_rtp_src_%d_%d_%d");
|
||||||
session->recv_rtp_src = gst_pad_new_from_template (templ, name);
|
session->recv_rtp_src = gst_pad_new_from_template (templ, name);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
|
|
||||||
|
gst_pad_set_caps (session->recv_rtp_src, caps);
|
||||||
|
|
||||||
gst_pad_set_element_private (session->recv_rtp_src, session);
|
gst_pad_set_element_private (session->recv_rtp_src, session);
|
||||||
gst_pad_set_query_function (session->recv_rtp_src, gst_rtp_dec_query_src);
|
gst_pad_set_query_function (session->recv_rtp_src, gst_rtp_dec_query_src);
|
||||||
gst_pad_set_active (session->recv_rtp_src, TRUE);
|
gst_pad_set_active (session->recv_rtp_src, TRUE);
|
||||||
|
@ -327,6 +404,8 @@ gst_rtp_dec_chain_rtp (GstPad * pad, GstBuffer * buffer)
|
||||||
session->active = TRUE;
|
session->active = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_buffer_set_caps (buffer, GST_PAD_CAPS (session->recv_rtp_src));
|
||||||
|
|
||||||
res = gst_pad_push (session->recv_rtp_src, buffer);
|
res = gst_pad_push (session->recv_rtp_src, buffer);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -66,6 +66,9 @@ struct _GstRTPDec {
|
||||||
|
|
||||||
struct _GstRTPDecClass {
|
struct _GstRTPDecClass {
|
||||||
GstElementClass parent_class;
|
GstElementClass parent_class;
|
||||||
|
|
||||||
|
/* get the caps for pt */
|
||||||
|
GstCaps* (*request_pt_map) (GstRTPDec *rtpdec, guint session, guint pt);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_rtp_dec_get_type(void);
|
GType gst_rtp_dec_get_type(void);
|
||||||
|
|
|
@ -519,6 +519,8 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, SDPMessage * sdp, gint idx)
|
||||||
src->streams = g_list_append (src->streams, stream);
|
src->streams = g_list_append (src->streams, stream);
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1061,6 +1063,7 @@ new_session_pad (GstElement * session, GstPad * pad, GstRTSPSrc * src)
|
||||||
if (!stream->added)
|
if (!stream->added)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
GST_DEBUG_OBJECT (src, "We added all streams");
|
||||||
/* when we get here, all stream are added and we can fire the no-more-pads
|
/* when we get here, all stream are added and we can fire the no-more-pads
|
||||||
* signal. */
|
* signal. */
|
||||||
gst_element_no_more_pads (GST_ELEMENT_CAST (src));
|
gst_element_no_more_pads (GST_ELEMENT_CAST (src));
|
||||||
|
@ -1077,6 +1080,30 @@ unknown_stream:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstCaps *
|
||||||
|
request_pt_map (GstElement * sess, guint session, guint pt, GstRTSPSrc * src)
|
||||||
|
{
|
||||||
|
GstRTSPStream *stream;
|
||||||
|
GList *lstream;
|
||||||
|
|
||||||
|
lstream = g_list_find_custom (src->streams, GINT_TO_POINTER (session),
|
||||||
|
(GCompareFunc) find_stream_by_id);
|
||||||
|
if (!lstream)
|
||||||
|
goto unknown_stream;
|
||||||
|
|
||||||
|
stream = (GstRTSPStream *) lstream->data;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (src, "getting pt map for pt %d in session %d", pt, session);
|
||||||
|
|
||||||
|
return stream->caps;
|
||||||
|
|
||||||
|
unknown_stream:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (src, "unknown stream %d", session);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* sets up all elements needed for streaming over the specified transport.
|
/* sets up all elements needed for streaming over the specified transport.
|
||||||
* Does not yet expose the element pads, this will be done when there is actuall
|
* Does not yet expose the element pads, this will be done when there is actuall
|
||||||
* dataflow detected, which might never happen when UDP is blocked in a
|
* dataflow detected, which might never happen when UDP is blocked in a
|
||||||
|
@ -1288,10 +1315,13 @@ use_no_manager:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->session && !src->session_sig_id) {
|
if (src->session && !src->session_sig_id) {
|
||||||
GST_DEBUG_OBJECT (src, "connect to pad-added on session manager");
|
GST_DEBUG_OBJECT (src, "connect to signals on session manager");
|
||||||
src->session_sig_id =
|
src->session_sig_id =
|
||||||
g_signal_connect (src->session, "pad-added",
|
g_signal_connect (src->session, "pad-added",
|
||||||
(GCallback) new_session_pad, src);
|
(GCallback) new_session_pad, src);
|
||||||
|
src->session_ptmap_id =
|
||||||
|
g_signal_connect (src->session, "request-pt-map",
|
||||||
|
(GCallback) request_pt_map, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outpad) {
|
if (outpad) {
|
||||||
|
@ -1347,10 +1377,10 @@ gst_rtspsrc_stream_configure_caps (GstRTSPStream * stream)
|
||||||
{
|
{
|
||||||
/* configure the caps on the UDP source and the channelpad */
|
/* configure the caps on the UDP source and the channelpad */
|
||||||
if (stream->udpsrc[0]) {
|
if (stream->udpsrc[0]) {
|
||||||
g_object_set (G_OBJECT (stream->udpsrc[0]), "caps", stream->caps, NULL);
|
//g_object_set (G_OBJECT (stream->udpsrc[0]), "caps", stream->caps, NULL);
|
||||||
}
|
}
|
||||||
if (stream->channelpad[0]) {
|
if (stream->channelpad[0]) {
|
||||||
gst_pad_set_caps (stream->channelpad[0], stream->caps);
|
//gst_pad_set_caps (stream->channelpad[0], stream->caps);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1380,7 +1410,7 @@ gst_rtspsrc_activate_streams (GstRTSPSrc * src)
|
||||||
gst_pad_set_active (stream->srcpad, TRUE);
|
gst_pad_set_active (stream->srcpad, TRUE);
|
||||||
/* add the pad */
|
/* add the pad */
|
||||||
if (!stream->added) {
|
if (!stream->added) {
|
||||||
gst_pad_set_caps (stream->srcpad, stream->caps);
|
//gst_pad_set_caps (stream->srcpad, stream->caps);
|
||||||
gst_element_add_pad (GST_ELEMENT_CAST (src), stream->srcpad);
|
gst_element_add_pad (GST_ELEMENT_CAST (src), stream->srcpad);
|
||||||
stream->added = TRUE;
|
stream->added = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,7 @@ struct _GstRTSPSrc {
|
||||||
/* session management */
|
/* session management */
|
||||||
GstElement *session;
|
GstElement *session;
|
||||||
gulong session_sig_id;
|
gulong session_sig_id;
|
||||||
|
gulong session_ptmap_id;
|
||||||
|
|
||||||
RTSPConnection *connection;
|
RTSPConnection *connection;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue