diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2005-12-01 14:30:01 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2005-12-01 14:30:01 +0000 |
commit | 7a4f8655ce2679dc535d6698630dbc087dc1ce87 (patch) | |
tree | 88124114105a1b2dd08b99207689d5313c6c029f /gst/rtp/gstrtpmpapay.c | |
parent | 0b3776c0b80196d747c351ebf3e165434a38a22b (diff) |
Do burger's rename for rtp payloaders and depayloaders
Original commit message from CVS:
Do burger's rename for rtp payloaders and depayloaders
Diffstat (limited to 'gst/rtp/gstrtpmpapay.c')
-rw-r--r-- | gst/rtp/gstrtpmpapay.c | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/gst/rtp/gstrtpmpapay.c b/gst/rtp/gstrtpmpapay.c index cbfc4a43..4b13c7d2 100644 --- a/gst/rtp/gstrtpmpapay.c +++ b/gst/rtp/gstrtpmpapay.c @@ -20,24 +20,24 @@ #include <gst/rtp/gstrtpbuffer.h> -#include "gstrtpmpaenc.h" +#include "gstrtpmpapay.h" /* elementfactory information */ -static GstElementDetails gst_rtp_mpaenc_details = { +static GstElementDetails gst_rtp_mpapay_details = { "RTP packet parser", - "Codec/Encoder/Network", - "Encode MPEG audio as RTP packets (RFC 2038)", + "Codec/Payloader/Network", + "Payode MPEG audio as RTP packets (RFC 2038)", "Wim Taymans <wim@fluendo.com>" }; -static GstStaticPadTemplate gst_rtpmpaenc_sink_template = +static GstStaticPadTemplate gst_rtp_mpa_pay_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/mpeg") ); -static GstStaticPadTemplate gst_rtpmpaenc_src_template = +static GstStaticPadTemplate gst_rtp_mpa_pay_src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, @@ -47,58 +47,58 @@ GST_STATIC_PAD_TEMPLATE ("src", "clock-rate = (int) 90000, " "encoding-name = (string) \"MPA\"") ); -static void gst_rtpmpaenc_class_init (GstRtpMPAEncClass * klass); -static void gst_rtpmpaenc_base_init (GstRtpMPAEncClass * klass); -static void gst_rtpmpaenc_init (GstRtpMPAEnc * rtpmpaenc); -static void gst_rtpmpaenc_finalize (GObject * object); +static void gst_rtp_mpa_pay_class_init (GstRtpMPAPayClass * klass); +static void gst_rtp_mpa_pay_base_init (GstRtpMPAPayClass * klass); +static void gst_rtp_mpa_pay_init (GstRtpMPAPay * rtpmpapay); +static void gst_rtp_mpa_pay_finalize (GObject * object); -static gboolean gst_rtpmpaenc_setcaps (GstBaseRTPPayload * payload, +static gboolean gst_rtp_mpa_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps); -static GstFlowReturn gst_rtpmpaenc_handle_buffer (GstBaseRTPPayload * payload, +static GstFlowReturn gst_rtp_mpa_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer); static GstBaseRTPPayloadClass *parent_class = NULL; static GType -gst_rtpmpaenc_get_type (void) +gst_rtp_mpa_pay_get_type (void) { - static GType rtpmpaenc_type = 0; + static GType rtpmpapay_type = 0; - if (!rtpmpaenc_type) { - static const GTypeInfo rtpmpaenc_info = { - sizeof (GstRtpMPAEncClass), - (GBaseInitFunc) gst_rtpmpaenc_base_init, + if (!rtpmpapay_type) { + static const GTypeInfo rtpmpapay_info = { + sizeof (GstRtpMPAPayClass), + (GBaseInitFunc) gst_rtp_mpa_pay_base_init, NULL, - (GClassInitFunc) gst_rtpmpaenc_class_init, + (GClassInitFunc) gst_rtp_mpa_pay_class_init, NULL, NULL, - sizeof (GstRtpMPAEnc), + sizeof (GstRtpMPAPay), 0, - (GInstanceInitFunc) gst_rtpmpaenc_init, + (GInstanceInitFunc) gst_rtp_mpa_pay_init, }; - rtpmpaenc_type = - g_type_register_static (GST_TYPE_BASE_RTP_PAYLOAD, "GstRtpMPAEnc", - &rtpmpaenc_info, 0); + rtpmpapay_type = + g_type_register_static (GST_TYPE_BASE_RTP_PAYLOAD, "GstRtpMPAPay", + &rtpmpapay_info, 0); } - return rtpmpaenc_type; + return rtpmpapay_type; } static void -gst_rtpmpaenc_base_init (GstRtpMPAEncClass * klass) +gst_rtp_mpa_pay_base_init (GstRtpMPAPayClass * klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtpmpaenc_src_template)); + gst_static_pad_template_get (&gst_rtp_mpa_pay_src_template)); gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_rtpmpaenc_sink_template)); + gst_static_pad_template_get (&gst_rtp_mpa_pay_sink_template)); - gst_element_class_set_details (element_class, &gst_rtp_mpaenc_details); + gst_element_class_set_details (element_class, &gst_rtp_mpapay_details); } static void -gst_rtpmpaenc_class_init (GstRtpMPAEncClass * klass) +gst_rtp_mpa_pay_class_init (GstRtpMPAPayClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; @@ -110,33 +110,33 @@ gst_rtpmpaenc_class_init (GstRtpMPAEncClass * klass) parent_class = g_type_class_ref (GST_TYPE_BASE_RTP_PAYLOAD); - gobject_class->finalize = gst_rtpmpaenc_finalize; + gobject_class->finalize = gst_rtp_mpa_pay_finalize; - gstbasertppayload_class->set_caps = gst_rtpmpaenc_setcaps; - gstbasertppayload_class->handle_buffer = gst_rtpmpaenc_handle_buffer; + gstbasertppayload_class->set_caps = gst_rtp_mpa_pay_setcaps; + gstbasertppayload_class->handle_buffer = gst_rtp_mpa_pay_handle_buffer; } static void -gst_rtpmpaenc_init (GstRtpMPAEnc * rtpmpaenc) +gst_rtp_mpa_pay_init (GstRtpMPAPay * rtpmpapay) { - rtpmpaenc->adapter = gst_adapter_new (); + rtpmpapay->adapter = gst_adapter_new (); } static void -gst_rtpmpaenc_finalize (GObject * object) +gst_rtp_mpa_pay_finalize (GObject * object) { - GstRtpMPAEnc *rtpmpaenc; + GstRtpMPAPay *rtpmpapay; - rtpmpaenc = GST_RTP_MPA_ENC (object); + rtpmpapay = GST_RTP_MPA_PAY (object); - g_object_unref (rtpmpaenc->adapter); - rtpmpaenc->adapter = NULL; + g_object_unref (rtpmpapay->adapter); + rtpmpapay->adapter = NULL; G_OBJECT_CLASS (parent_class)->finalize (object); } static gboolean -gst_rtpmpaenc_setcaps (GstBaseRTPPayload * payload, GstCaps * caps) +gst_rtp_mpa_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps) { gst_basertppayload_set_options (payload, "audio", TRUE, "MPA", 90000); gst_basertppayload_set_outcaps (payload, NULL); @@ -145,7 +145,7 @@ gst_rtpmpaenc_setcaps (GstBaseRTPPayload * payload, GstCaps * caps) } static GstFlowReturn -gst_rtpmpaenc_flush (GstRtpMPAEnc * rtpmpaenc) +gst_rtp_mpa_pay_flush (GstRtpMPAPay * rtpmpapay) { guint avail; GstBuffer *outbuf; @@ -158,7 +158,7 @@ gst_rtpmpaenc_flush (GstRtpMPAEnc * rtpmpaenc) * adapter has more than one MTU, we need to split the MPA data * over multiple packets. The frag_offset in each packet header * needs to be updated with the position in the MPA frame. */ - avail = gst_adapter_available (rtpmpaenc->adapter); + avail = gst_adapter_available (rtpmpapay->adapter); ret = GST_FLOW_OK; @@ -171,20 +171,20 @@ gst_rtpmpaenc_flush (GstRtpMPAEnc * rtpmpaenc) guint packet_len; /* this will be the total lenght of the packet */ - packet_len = gst_rtpbuffer_calc_packet_len (4 + avail, 0, 0); + packet_len = gst_rtp_buffer_calc_packet_len (4 + avail, 0, 0); /* fill one MTU or all available bytes */ - towrite = MIN (packet_len, GST_BASE_RTP_PAYLOAD_MTU (rtpmpaenc)); + towrite = MIN (packet_len, GST_BASE_RTP_PAYLOAD_MTU (rtpmpapay)); /* this is the payload length */ - payload_len = gst_rtpbuffer_calc_payload_len (towrite, 0, 0); + payload_len = gst_rtp_buffer_calc_payload_len (towrite, 0, 0); /* create buffer to hold the payload */ - outbuf = gst_rtpbuffer_new_allocate (payload_len, 0, 0); + outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0); payload_len -= 4; - gst_rtpbuffer_set_payload_type (outbuf, GST_RTP_PAYLOAD_MPA); + gst_rtp_buffer_set_payload_type (outbuf, GST_RTP_PAYLOAD_MPA); /* * 0 1 2 3 @@ -193,76 +193,76 @@ gst_rtpmpaenc_flush (GstRtpMPAEnc * rtpmpaenc) * | MBZ | Frag_offset | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ - payload = gst_rtpbuffer_get_payload (outbuf); + payload = gst_rtp_buffer_get_payload (outbuf); payload[0] = 0; payload[1] = 0; payload[2] = frag_offset >> 8; payload[3] = frag_offset & 0xff; - data = (guint8 *) gst_adapter_peek (rtpmpaenc->adapter, payload_len); + data = (guint8 *) gst_adapter_peek (rtpmpapay->adapter, payload_len); memcpy (&payload[4], data, payload_len); - gst_adapter_flush (rtpmpaenc->adapter, payload_len); + gst_adapter_flush (rtpmpapay->adapter, payload_len); avail -= payload_len; frag_offset += payload_len; if (avail == 0) - gst_rtpbuffer_set_marker (outbuf, TRUE); + gst_rtp_buffer_set_marker (outbuf, TRUE); - GST_BUFFER_TIMESTAMP (outbuf) = rtpmpaenc->first_ts; - GST_BUFFER_DURATION (outbuf) = rtpmpaenc->duration; + GST_BUFFER_TIMESTAMP (outbuf) = rtpmpapay->first_ts; + GST_BUFFER_DURATION (outbuf) = rtpmpapay->duration; - ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtpmpaenc), outbuf); + ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtpmpapay), outbuf); } return ret; } static GstFlowReturn -gst_rtpmpaenc_handle_buffer (GstBaseRTPPayload * basepayload, +gst_rtp_mpa_pay_handle_buffer (GstBaseRTPPayload * basepayload, GstBuffer * buffer) { - GstRtpMPAEnc *rtpmpaenc; + GstRtpMPAPay *rtpmpapay; GstFlowReturn ret; guint size, avail; guint packet_len; GstClockTime duration; - rtpmpaenc = GST_RTP_MPA_ENC (basepayload); + rtpmpapay = GST_RTP_MPA_PAY (basepayload); size = GST_BUFFER_SIZE (buffer); duration = GST_BUFFER_DURATION (buffer); - avail = gst_adapter_available (rtpmpaenc->adapter); + avail = gst_adapter_available (rtpmpapay->adapter); if (avail == 0) { - rtpmpaenc->first_ts = GST_BUFFER_TIMESTAMP (buffer); - rtpmpaenc->duration = 0; + rtpmpapay->first_ts = GST_BUFFER_TIMESTAMP (buffer); + rtpmpapay->duration = 0; } /* get packet length of previous data and this new data, * payload length includes a 4 byte header */ - packet_len = gst_rtpbuffer_calc_packet_len (4 + avail + size, 0, 0); + packet_len = gst_rtp_buffer_calc_packet_len (4 + avail + size, 0, 0); /* if this buffer is going to overflow the packet, flush what we * have. */ if (gst_basertppayload_is_filled (basepayload, - packet_len, rtpmpaenc->duration + duration)) { - ret = gst_rtpmpaenc_flush (rtpmpaenc); - rtpmpaenc->first_ts = GST_BUFFER_TIMESTAMP (buffer); - rtpmpaenc->duration = 0; + packet_len, rtpmpapay->duration + duration)) { + ret = gst_rtp_mpa_pay_flush (rtpmpapay); + rtpmpapay->first_ts = GST_BUFFER_TIMESTAMP (buffer); + rtpmpapay->duration = 0; } else { ret = GST_FLOW_OK; } - gst_adapter_push (rtpmpaenc->adapter, buffer); - rtpmpaenc->duration += duration; + gst_adapter_push (rtpmpapay->adapter, buffer); + rtpmpapay->duration += duration; return ret; } gboolean -gst_rtpmpaenc_plugin_init (GstPlugin * plugin) +gst_rtp_mpa_pay_plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "rtpmpaenc", - GST_RANK_NONE, GST_TYPE_RTP_MPA_ENC); + return gst_element_register (plugin, "rtpmpapay", + GST_RANK_NONE, GST_TYPE_RTP_MPA_PAY); } |