Commit f34fce9d authored by Sjoerd Simons's avatar Sjoerd Simons Committed by Wim Taymans
Browse files

gst/rtp/gstrtpmp4vpay.*: Handle NEWSEGMENT and FLUSH events. Fixes #434824.

Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/rtp/gstrtpmp4vpay.c: (gst_rtp_mp4v_pay_init),
(gst_rtp_mp4v_pay_empty), (gst_rtp_mp4v_pay_event):
* gst/rtp/gstrtpmp4vpay.h:
Handle NEWSEGMENT and FLUSH events. Fixes #434824.
parent baa94a9b
2007-05-01 Wim Taymans <wim@fluendo.com>
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* gst/rtp/gstrtpmp4vpay.c: (gst_rtp_mp4v_pay_init),
(gst_rtp_mp4v_pay_empty), (gst_rtp_mp4v_pay_event):
* gst/rtp/gstrtpmp4vpay.h:
Handle NEWSEGMENT and FLUSH events. Fixes #434824.
2007-04-30 Tim-Philipp Müller <tim at centricular dot net>
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
......
......@@ -84,6 +84,7 @@ static gboolean gst_rtp_mp4v_pay_setcaps (GstBaseRTPPayload * payload,
GstCaps * caps);
static GstFlowReturn gst_rtp_mp4v_pay_handle_buffer (GstBaseRTPPayload *
payload, GstBuffer * buffer);
static gboolean gst_rtp_mp4v_pay_event (GstPad * pad, GstEvent * event);
static GstBaseRTPPayloadClass *parent_class = NULL;
......@@ -159,10 +160,17 @@ gst_rtp_mp4v_pay_class_init (GstRtpMP4VPayClass * klass)
static void
gst_rtp_mp4v_pay_init (GstRtpMP4VPay * rtpmp4vpay)
{
GstPad *sinkpad;
rtpmp4vpay->adapter = gst_adapter_new ();
rtpmp4vpay->rate = 90000;
rtpmp4vpay->profile = 1;
rtpmp4vpay->send_config = DEFAULT_SEND_CONFIG;
sinkpad = GST_BASE_RTP_PAYLOAD_SINKPAD (rtpmp4vpay);
rtpmp4vpay->old_event_func = sinkpad->eventfunc;
gst_pad_set_event_function (sinkpad, gst_rtp_mp4v_pay_event);
}
static void
......@@ -243,6 +251,12 @@ done:
return TRUE;
}
static void
gst_rtp_mp4v_pay_empty (GstRtpMP4VPay * rtpmp4vpay)
{
gst_adapter_clear (rtpmp4vpay->adapter);
}
static GstFlowReturn
gst_rtp_mp4v_pay_flush (GstRtpMP4VPay * rtpmp4vpay)
{
......@@ -452,6 +466,34 @@ gst_rtp_mp4v_pay_handle_buffer (GstBaseRTPPayload * basepayload,
return ret;
}
static gboolean
gst_rtp_mp4v_pay_event (GstPad * pad, GstEvent * event)
{
GstRtpMP4VPay *rtpmp4vpay;
gboolean ret;
rtpmp4vpay = GST_RTP_MP4V_PAY (gst_pad_get_parent (pad));
GST_DEBUG ("Got event: %s", GST_EVENT_TYPE_NAME (event));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:
gst_rtp_mp4v_pay_flush (rtpmp4vpay);
break;
case GST_EVENT_FLUSH_STOP:
gst_rtp_mp4v_pay_empty (rtpmp4vpay);
break;
default:
break;
}
ret = rtpmp4vpay->old_event_func (pad, event);
g_object_unref (rtpmp4vpay);
return ret;
}
static void
gst_rtp_mp4v_pay_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
......
......@@ -52,6 +52,8 @@ struct _GstRtpMP4VPay
gint profile;
GstBuffer *config;
gboolean send_config;
GstPadEventFunction old_event_func;
};
struct _GstRtpMP4VPayClass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment