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.
This commit is contained in:
Sjoerd Simons 2007-05-01 16:13:58 +00:00 committed by Wim Taymans
parent baa94a9b42
commit f34fce9df4
3 changed files with 53 additions and 0 deletions

View file

@ -1,3 +1,12 @@
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:

View file

@ -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)

View file

@ -52,6 +52,8 @@ struct _GstRtpMP4VPay
gint profile;
GstBuffer *config;
gboolean send_config;
GstPadEventFunction old_event_func;
};
struct _GstRtpMP4VPayClass