mpapay: reset payloader on state change

This commit is contained in:
Wim Taymans 2010-12-20 16:51:47 +01:00
parent 984849f8fe
commit 933a170898

View file

@ -50,6 +50,9 @@ static GstStaticPadTemplate gst_rtp_mpa_pay_src_template =
static void gst_rtp_mpa_pay_finalize (GObject * object);
static GstStateChangeReturn gst_rtp_mpa_pay_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_rtp_mpa_pay_setcaps (GstBaseRTPPayload * payload,
GstCaps * caps);
static gboolean gst_rtp_mpa_pay_handle_event (GstPad * pad, GstEvent * event);
@ -78,13 +81,17 @@ static void
gst_rtp_mpa_pay_class_init (GstRtpMPAPayClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstBaseRTPPayloadClass *gstbasertppayload_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
gobject_class->finalize = gst_rtp_mpa_pay_finalize;
gstelement_class->change_state = gst_rtp_mpa_pay_change_state;
gstbasertppayload_class->set_caps = gst_rtp_mpa_pay_setcaps;
gstbasertppayload_class->handle_event = gst_rtp_mpa_pay_handle_event;
gstbasertppayload_class->handle_buffer = gst_rtp_mpa_pay_handle_buffer;
@ -273,6 +280,34 @@ gst_rtp_mpa_pay_handle_buffer (GstBaseRTPPayload * basepayload,
return ret;
}
static GstStateChangeReturn
gst_rtp_mpa_pay_change_state (GstElement * element, GstStateChange transition)
{
GstRtpMPAPay *rtpmpapay;
GstStateChangeReturn ret;
rtpmpapay = GST_RTP_MPA_PAY (element);
switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
gst_rtp_mpa_pay_reset (rtpmpapay);
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_rtp_mpa_pay_reset (rtpmpapay);
break;
default:
break;
}
return ret;
}
gboolean
gst_rtp_mpa_pay_plugin_init (GstPlugin * plugin)
{