mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-09 05:38:58 +00:00
gst-libs/gst/rtp/: closed #320644.
Original commit message from CVS: * gst-libs/gst/rtp/gstbasertpdepayload.h: * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_init), (gst_basertppayload_event), (gst_basertppayload_push), (gst_basertppayload_change_state): * gst-libs/gst/rtp/gstbasertppayload.h: closed #320644.
This commit is contained in:
parent
ef53753a6b
commit
109cd71c76
4 changed files with 80 additions and 7 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2005-11-30 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst-libs/gst/rtp/gstbasertpdepayload.h:
|
||||||
|
* gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_init),
|
||||||
|
(gst_basertppayload_event), (gst_basertppayload_push),
|
||||||
|
(gst_basertppayload_change_state):
|
||||||
|
* gst-libs/gst/rtp/gstbasertppayload.h:
|
||||||
|
closed #320644.
|
||||||
|
|
||||||
2005-11-30 Julien MOUTTE <julien@moutte.net>
|
2005-11-30 Julien MOUTTE <julien@moutte.net>
|
||||||
|
|
||||||
* docs/libs/gst-plugins-base-libs-docs.sgml:
|
* docs/libs/gst-plugins-base-libs-docs.sgml:
|
||||||
|
|
|
@ -78,11 +78,11 @@ struct _GstBaseRTPDepayload
|
||||||
*/
|
*/
|
||||||
GQueue *queue;
|
GQueue *queue;
|
||||||
|
|
||||||
/*< private >*/
|
GstSegment segment;
|
||||||
union {
|
|
||||||
gboolean need_newsegment;
|
gboolean need_newsegment;
|
||||||
gpointer _gst_reserved[GST_PADDING-1+1];
|
|
||||||
};
|
/*< private >*/
|
||||||
|
gpointer _gst_reserved[GST_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstBaseRTPDepayloadClass
|
struct _GstBaseRTPDepayloadClass
|
||||||
|
|
|
@ -59,6 +59,7 @@ static void gst_basertppayload_init (GstBaseRTPPayload * basertppayload,
|
||||||
static void gst_basertppayload_finalize (GObject * object);
|
static void gst_basertppayload_finalize (GObject * object);
|
||||||
|
|
||||||
static gboolean gst_basertppayload_setcaps (GstPad * pad, GstCaps * caps);
|
static gboolean gst_basertppayload_setcaps (GstPad * pad, GstCaps * caps);
|
||||||
|
static gboolean gst_basertppayload_event (GstPad * pad, GstEvent * event);
|
||||||
static GstFlowReturn gst_basertppayload_chain (GstPad * pad,
|
static GstFlowReturn gst_basertppayload_chain (GstPad * pad,
|
||||||
GstBuffer * buffer);
|
GstBuffer * buffer);
|
||||||
|
|
||||||
|
@ -178,6 +179,8 @@ gst_basertppayload_init (GstBaseRTPPayload * basertppayload, gpointer g_class)
|
||||||
basertppayload->sinkpad = gst_pad_new_from_template (templ, "sink");
|
basertppayload->sinkpad = gst_pad_new_from_template (templ, "sink");
|
||||||
gst_pad_set_setcaps_function (basertppayload->sinkpad,
|
gst_pad_set_setcaps_function (basertppayload->sinkpad,
|
||||||
gst_basertppayload_setcaps);
|
gst_basertppayload_setcaps);
|
||||||
|
gst_pad_set_event_function (basertppayload->sinkpad,
|
||||||
|
gst_basertppayload_event);
|
||||||
gst_pad_set_chain_function (basertppayload->sinkpad,
|
gst_pad_set_chain_function (basertppayload->sinkpad,
|
||||||
gst_basertppayload_chain);
|
gst_basertppayload_chain);
|
||||||
gst_element_add_pad (GST_ELEMENT (basertppayload), basertppayload->sinkpad);
|
gst_element_add_pad (GST_ELEMENT (basertppayload), basertppayload->sinkpad);
|
||||||
|
@ -231,6 +234,46 @@ gst_basertppayload_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_basertppayload_event (GstPad * pad, GstEvent * event)
|
||||||
|
{
|
||||||
|
GstBaseRTPPayload *basertppayload;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
|
basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
|
case GST_EVENT_FLUSH_START:
|
||||||
|
res = gst_pad_event_default (pad, event);
|
||||||
|
break;
|
||||||
|
case GST_EVENT_FLUSH_STOP:
|
||||||
|
res = gst_pad_event_default (pad, event);
|
||||||
|
gst_segment_init (&basertppayload->segment, GST_FORMAT_UNDEFINED);
|
||||||
|
break;
|
||||||
|
case GST_EVENT_NEWSEGMENT:
|
||||||
|
{
|
||||||
|
gboolean update;
|
||||||
|
gdouble rate;
|
||||||
|
GstFormat fmt;
|
||||||
|
gint64 start, stop, position;
|
||||||
|
|
||||||
|
gst_event_parse_new_segment (event, &update, &rate, &fmt, &start, &stop,
|
||||||
|
&position);
|
||||||
|
gst_segment_set_newsegment (&basertppayload->segment, update, rate, fmt,
|
||||||
|
start, stop, position);
|
||||||
|
}
|
||||||
|
/* fallthrough */
|
||||||
|
default:
|
||||||
|
res = gst_pad_event_default (pad, event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_object_unref (basertppayload);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_basertppayload_chain (GstPad * pad, GstBuffer * buffer)
|
gst_basertppayload_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
|
@ -333,15 +376,23 @@ gst_basertppayload_push (GstBaseRTPPayload * payload, GstBuffer * buffer)
|
||||||
|
|
||||||
gst_rtpbuffer_set_payload_type (buffer, payload->pt);
|
gst_rtpbuffer_set_payload_type (buffer, payload->pt);
|
||||||
|
|
||||||
/* can warp around, which is perfectly fine */
|
/* can wrap around, which is perfectly fine */
|
||||||
gst_rtpbuffer_set_seq (buffer, payload->seqnum++);
|
gst_rtpbuffer_set_seq (buffer, payload->seqnum++);
|
||||||
|
|
||||||
/* add our random offset to the timestamp */
|
/* add our random offset to the timestamp */
|
||||||
ts = payload->ts_base;
|
ts = payload->ts_base;
|
||||||
|
|
||||||
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||||
if (GST_CLOCK_TIME_IS_VALID (timestamp))
|
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
||||||
ts += timestamp * payload->clock_rate / GST_SECOND;
|
gint64 rtime;
|
||||||
|
|
||||||
|
rtime =
|
||||||
|
gst_segment_to_running_time (&payload->segment, GST_FORMAT_TIME,
|
||||||
|
timestamp);
|
||||||
|
rtime = gst_util_uint64_scale_int (rtime, payload->clock_rate, GST_SECOND);
|
||||||
|
|
||||||
|
ts += rtime;
|
||||||
|
}
|
||||||
gst_rtpbuffer_set_timestamp (buffer, ts);
|
gst_rtpbuffer_set_timestamp (buffer, ts);
|
||||||
|
|
||||||
payload->timestamp = ts;
|
payload->timestamp = ts;
|
||||||
|
@ -349,6 +400,9 @@ gst_basertppayload_push (GstBaseRTPPayload * payload, GstBuffer * buffer)
|
||||||
/* set caps */
|
/* set caps */
|
||||||
gst_buffer_set_caps (buffer, GST_PAD_CAPS (payload->srcpad));
|
gst_buffer_set_caps (buffer, GST_PAD_CAPS (payload->srcpad));
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (payload, "Pushing packet size %d, seq=%d, ts=%u",
|
||||||
|
GST_BUFFER_SIZE (buffer), payload->seqnum - 1, ts);
|
||||||
|
|
||||||
res = gst_pad_push (payload->srcpad, buffer);
|
res = gst_pad_push (payload->srcpad, buffer);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -448,6 +502,7 @@ gst_basertppayload_change_state (GstElement * element,
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
|
gst_segment_init (&basertppayload->segment, GST_FORMAT_UNDEFINED);
|
||||||
|
|
||||||
if (basertppayload->seqnum_offset == -1)
|
if (basertppayload->seqnum_offset == -1)
|
||||||
basertppayload->seqnum_base =
|
basertppayload->seqnum_base =
|
||||||
|
|
|
@ -50,6 +50,7 @@ struct _GstBaseRTPPayload
|
||||||
{
|
{
|
||||||
GstElement element;
|
GstElement element;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
GstPad *sinkpad;
|
GstPad *sinkpad;
|
||||||
GstPad *srcpad;
|
GstPad *srcpad;
|
||||||
|
|
||||||
|
@ -74,6 +75,11 @@ struct _GstBaseRTPPayload
|
||||||
guint ssrc;
|
guint ssrc;
|
||||||
guint current_ssrc;
|
guint current_ssrc;
|
||||||
guint mtu;
|
guint mtu;
|
||||||
|
|
||||||
|
GstSegment segment;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
gpointer _gst_reserved[GST_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstBaseRTPPayloadClass
|
struct _GstBaseRTPPayloadClass
|
||||||
|
@ -86,6 +92,9 @@ struct _GstBaseRTPPayloadClass
|
||||||
* the RTP buffers */
|
* the RTP buffers */
|
||||||
GstFlowReturn (*handle_buffer) (GstBaseRTPPayload *payload,
|
GstFlowReturn (*handle_buffer) (GstBaseRTPPayload *payload,
|
||||||
GstBuffer *buffer);
|
GstBuffer *buffer);
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
gpointer _gst_reserved[GST_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_basertppayload_get_type (void);
|
GType gst_basertppayload_get_type (void);
|
||||||
|
|
Loading…
Reference in a new issue