reverting rtp patches to fix freeze break on -base as explained on the list

Original commit message from CVS:
reverting rtp patches to fix freeze break on -base as explained on the list
parent 9e8bbf41
2006-04-13 Tim-Philipp Müller <tim at centricular dot net>
* gst/rtp/gstasteriskh263.h:
* gst/rtp/gstrtpL16depay.h:
* gst/rtp/gstrtpL16pay.h:
* gst/rtp/gstrtpamrdepay.h:
* gst/rtp/gstrtpamrpay.h:
* gst/rtp/gstrtpdepay.h:
* gst/rtp/gstrtpgsmdepay.h:
* gst/rtp/gstrtpgsmpay.h:
* gst/rtp/gstrtph263pay.h:
* gst/rtp/gstrtph263pdepay.h:
* gst/rtp/gstrtph263ppay.h:
* gst/rtp/gstrtpilbcdepay.h:
* gst/rtp/gstrtpilbcpay.h:
* gst/rtp/gstrtpmp4gpay.h:
* gst/rtp/gstrtpmp4vdepay.h:
* gst/rtp/gstrtpmp4vpay.h:
* gst/rtp/gstrtpmpadepay.h:
* gst/rtp/gstrtpmpapay.h:
* gst/rtp/gstrtppcmadepay.h:
* gst/rtp/gstrtppcmapay.h:
* gst/rtp/gstrtppcmudepay.h:
* gst/rtp/gstrtppcmupay.h:
* gst/rtp/gstrtpspeexdepay.h:
* gst/rtp/gstrtpspeexpay.h:
Fix GObject macros.
2006-04-12 Philippe Kalaf <philippe.kalaf@collabora.co.uk>
* gst/rtp/gstrtppcmapay.c:
* gst/rtp/gstrtppcmapay.h:
* gst/rtp/gstrtppcmupay.c:
* gst/rtp/gstrtppcmupay.h:
Ported mulaw and alaw payloaders to use new base class
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c:
* gst/rtp/gstrtpilbcpay.c:
* gst/rtp/gstrtpilbcpay.h:
* gst/rtp/gstrtpilbcdepay.c:
* gst/rtp/gstrtpilbcdepay.h:
Added new iLBC payloader/depayloader. Payloader uses new audio payload base
class.
2006-04-12 Wim Taymans <wim@fluendo.com>
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_setcaps),
......
......@@ -16,8 +16,6 @@ libgstrtp_la_SOURCES = \
gstrtph263pdepay.c \
gstrtph263ppay.c \
gstrtph263pay.c \
gstrtpilbcpay.c \
gstrtpilbcdepay.c \
gstasteriskh263.c \
gstrtpmp4vdepay.c \
gstrtpmp4vpay.c \
......@@ -54,8 +52,6 @@ noinst_HEADERS = \
gstrtph263pdepay.h \
gstrtph263ppay.h \
gstrtph263pay.h \
gstrtpilbcpay.h \
gstrtpilbcdepay.h \
gstrtpmp4vdepay.h \
gstrtpmp4vpay.h \
gstrtpmp4gpay.h \
......
......@@ -30,10 +30,10 @@ G_BEGIN_DECLS
#define GST_ASTERISK_H263(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ASTERISK_H263,GstAsteriskh263))
#define GST_ASTERISK_H263_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ASTERISK_H263,GstAsteriskh263Class))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ASTERISK_H263,GstAsteriskh263))
#define GST_IS_ASTERISK_H263(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ASTERISK_H263))
#define GST_IS_ASTERISK_H263_CLASS(klass) \
#define GST_IS_ASTERISK_H263_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ASTERISK_H263))
typedef struct _GstAsteriskh263 GstAsteriskh263;
......
......@@ -35,8 +35,6 @@
#include "gstrtph263pdepay.h"
#include "gstrtph263ppay.h"
#include "gstrtph263pay.h"
#include "gstrtpilbcpay.h"
#include "gstrtpilbcdepay.h"
#include "gstasteriskh263.h"
#include "gstrtpmp4vpay.h"
#include "gstrtpmp4gpay.h"
......@@ -89,12 +87,6 @@ plugin_init (GstPlugin * plugin)
if (!gst_rtp_h263_pay_plugin_init (plugin))
return FALSE;
if (!gst_rtp_ilbc_pay_plugin_init (plugin))
return FALSE;
if (!gst_rtp_ilbc_depay_plugin_init (plugin))
return FALSE;
if (!gst_asteriskh263_plugin_init (plugin))
return FALSE;
......
......@@ -24,7 +24,10 @@
#include "rtp-packet.h"
#include "gstrtp-common.h"
G_BEGIN_DECLS
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Definition of structure storing data for this element. */
typedef struct _GstRtpL16Depay GstRtpL16Depay;
......@@ -54,14 +57,17 @@ struct _GstRtpL16DepayClass
#define GST_RTP_L16_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_L16_DEPAY,GstRtpL16Depay))
#define GST_RTP_L16_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_L16_DEPAY,GstRtpL16DepayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_L16_DEPAY,GstRtpL16Depay))
#define GST_IS_RTP_L16_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_L16_DEPAY))
#define GST_IS_RTP_L16_DEPAY_CLASS(klass) \
#define GST_IS_RTP_L16_DEPAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_L16_DEPAY))
gboolean gst_rtp_L16depay_plugin_init (GstPlugin * plugin);
G_END_DECLS
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GST_RTP_L16_DEPAY_H__ */
......@@ -59,10 +59,10 @@ struct _GstRtpL16PayClass
#define GST_RTP_L16_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_L16_PAY,GstRtpL16Pay))
#define GST_RTP_L16_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_L16_PAY,GstRtpL16PayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_L16_PAY,GstRtpL16Pay))
#define GST_IS_RTP_L16_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_L16_PAY))
#define GST_IS_RTP_L16_PAY_CLASS(klass) \
#define GST_IS_RTP_L16_PAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_L16_PAY))
gboolean gst_rtpL16pay_plugin_init (GstPlugin * plugin);
......
......@@ -29,10 +29,10 @@ G_BEGIN_DECLS
#define GST_RTP_AMR_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_AMR_DEPAY,GstRtpAMRDepay))
#define GST_RTP_AMR_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_AMR_DEPAY,GstRtpAMRDepayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_AMR_DEPAY,GstRtpAMRDepay))
#define GST_IS_RTP_AMR_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_AMR_DEPAY))
#define GST_IS_RTP_AMR_DEPAY_CLASS(klass) \
#define GST_IS_RTP_AMR_DEPAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_AMR_DEPAY))
typedef struct _GstRtpAMRDepay GstRtpAMRDepay;
......
......@@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_AMR_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_AMR_PAY,GstRtpAMRPay))
#define GST_RTP_AMR_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_AMR_PAY,GstRtpAMRPayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_AMR_PAY,GstRtpAMRPay))
#define GST_IS_RTP_AMR_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_AMR_PAY))
#define GST_IS_RTP_AMR_PAY_CLASS(klass) \
#define GST_IS_RTP_AMR_PAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_AMR_PAY))
typedef struct _GstRtpAMRPay GstRtpAMRPay;
......
......@@ -26,7 +26,7 @@ G_BEGIN_DECLS
#define GST_TYPE_RTP_DEPAY (gst_rtp_depay_get_type())
#define GST_IS_RTP_DEPAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_DEPAY))
#define GST_IS_RTP_DEPAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_DEPAY))
#define GST_IS_RTP_DEPAY_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_DEPAY))
#define GST_RTP_DEPAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_DEPAY, GstRTPDepay))
#define GST_RTP_DEPAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_DEPAY, GstRTPDepayClass))
......
......@@ -33,10 +33,10 @@ typedef struct _GstRTPGSMDepayClass GstRTPGSMDepayClass;
#define GST_RTP_GSM_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_GSM_DEPAY,GstRTPGSMDepay))
#define GST_RTP_GSM_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_GSM_DEPAY,GstRTPGSMDepayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_GSM_DEPAY,GstRTPGSMDepay))
#define GST_IS_RTP_GSM_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_GSM_DEPAY))
#define GST_IS_RTP_GSM_DEPAY_CLASS(klass) \
#define GST_IS_RTP_GSM_DEPAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_GSM_DEPAY))
struct _GstRTPGSMDepay
......
......@@ -34,10 +34,10 @@ typedef struct _GstRTPGSMPayClass GstRTPGSMPayClass;
#define GST_RTP_GSM_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_GSM_PAY,GstRTPGSMPay))
#define GST_RTP_GSM_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_GSM_PAY,GstRTPGSMPayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_GSM_PAY,GstRTPGSMPay))
#define GST_IS_RTP_GSM_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_GSM_PAY))
#define GST_IS_RTP_GSM_PAY_CLASS(klass) \
#define GST_IS_RTP_GSM_PAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_GSM_PAY))
struct _GstRTPGSMPay
......
......@@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_H263_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H263_PAY,GstRtpH263Pay))
#define GST_RTP_H263_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_H263_PAY,GstRtpH263PayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_H263_PAY,GstRtpH263Pay))
#define GST_IS_RTP_H263_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_H263_PAY))
#define GST_IS_RTP_H263_PAY_CLASS(klass) \
#define GST_IS_RTP_H263_PAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_H263_PAY))
typedef struct _GstRtpH263Pay GstRtpH263Pay;
......
......@@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_H263P_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H263P_DEPAY,GstRtpH263PDepay))
#define GST_RTP_H263P_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_H263P_DEPAY,GstRtpH263PDepayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_H263P_DEPAY,GstRtpH263PDepay))
#define GST_IS_RTP_H263P_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_H263P_DEPAY))
#define GST_IS_RTP_H263P_DEPAY_CLASS(klass) \
#define GST_IS_RTP_H263P_DEPAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_H263P_DEPAY))
typedef struct _GstRtpH263PDepay GstRtpH263PDepay;
......
......@@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_H263P_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H263P_PAY,GstRtpH263PPay))
#define GST_RTP_H263P_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_H263P_PAY,GstRtpH263PPayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_H263P_PAY,GstRtpH263PPay))
#define GST_IS_RTP_H263P_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_H263P_PAY))
#define GST_IS_RTP_H263P_PAY_CLASS(klass) \
#define GST_IS_RTP_H263P_PAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_H263P_PAY))
typedef struct _GstRtpH263PPay GstRtpH263PPay;
......
......@@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_MP4G_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MP4G_PAY,GstRtpMP4GPay))
#define GST_RTP_MP4G_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MP4G_PAY,GstRtpMP4GPayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MP4G_PAY,GstRtpMP4GPay))
#define GST_IS_RTP_MP4G_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MP4G_PAY))
#define GST_IS_RTP_MP4G_PAY_CLASS(klass) \
#define GST_IS_RTP_MP4G_PAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MP4G_PAY))
typedef struct _GstRtpMP4GPay GstRtpMP4GPay;
......
......@@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_MP4V_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MP4V_DEPAY,GstRtpMP4VDepay))
#define GST_RTP_MP4V_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MP4V_DEPAY,GstRtpMP4VDepayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MP4V_DEPAY,GstRtpMP4VDepay))
#define GST_IS_RTP_MP4V_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MP4V_DEPAY))
#define GST_IS_RTP_MP4V_DEPAY_CLASS(klass) \
#define GST_IS_RTP_MP4V_DEPAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MP4V_DEPAY))
typedef struct _GstRtpMP4VDepay GstRtpMP4VDepay;
......
......@@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_MP4V_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MP4V_PAY,GstRtpMP4VPay))
#define GST_RTP_MP4V_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MP4V_PAY,GstRtpMP4VPayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MP4V_PAY,GstRtpMP4VPay))
#define GST_IS_RTP_MP4V_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MP4V_PAY))
#define GST_IS_RTP_MP4V_PAY_CLASS(klass) \
#define GST_IS_RTP_MP4V_PAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MP4V_PAY))
typedef struct _GstRtpMP4VPay GstRtpMP4VPay;
......
......@@ -29,10 +29,10 @@ G_BEGIN_DECLS
#define GST_RTP_MPA_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MPA_DEPAY,GstRtpMPADepay))
#define GST_RTP_MPA_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MPA_DEPAY,GstRtpMPADepayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MPA_DEPAY,GstRtpMPADepay))
#define GST_IS_RTP_MPA_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MPA_DEPAY))
#define GST_IS_RTP_MPA_DEPAY_CLASS(klass) \
#define GST_IS_RTP_MPA_DEPAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MPA_DEPAY))
typedef struct _GstRtpMPADepay GstRtpMPADepay;
......
......@@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_MPA_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MPA_PAY,GstRtpMPAPay))
#define GST_RTP_MPA_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MPA_PAY,GstRtpMPAPayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MPA_PAY,GstRtpMPAPay))
#define GST_IS_RTP_MPA_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MPA_PAY))
#define GST_IS_RTP_MPA_PAY_CLASS(klass) \
#define GST_IS_RTP_MPA_PAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MPA_PAY))
typedef struct _GstRtpMPAPay GstRtpMPAPay;
......
......@@ -28,10 +28,10 @@ typedef struct _GstRtpPcmaDepayClass GstRtpPcmaDepayClass;
#define GST_RTP_PCMA_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_PCMA_DEPAY,GstRtpPcmaDepay))
#define GST_RTP_PCMA_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_PCMA_DEPAY,GstRtpPcmaDepayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_PCMA_DEPAY,GstRtpPcmaDepay))
#define GST_IS_RTP_PCMA_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_PCMA_DEPAY))
#define GST_IS_RTP_PCMA_DEPAY_CLASS(klass) \
#define GST_IS_RTP_PCMA_DEPAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_PCMA_DEPAY))
struct _GstRtpPcmaDepay
......
......@@ -50,9 +50,17 @@ GST_STATIC_PAD_TEMPLATE ("src",
static gboolean gst_rtp_pcma_pay_setcaps (GstBaseRTPPayload * payload,
GstCaps * caps);
static GstFlowReturn gst_rtp_pcma_pay_handle_buffer (GstBaseRTPPayload *
payload, GstBuffer * buffer);
static void gst_rtp_pcma_pay_finalize (GObject * object);
GST_BOILERPLATE (GstRtpPmcaPay, gst_rtp_pcma_pay, GstBaseRTPAudioPayload,
GST_TYPE_BASE_RTP_AUDIO_PAYLOAD);
GST_BOILERPLATE (GstRtpPmcaPay, gst_rtp_pcma_pay, GstBaseRTPPayload,
GST_TYPE_BASE_RTP_PAYLOAD);
/* The lower limit for number of octet to put in one packet
* (clock-rate=8000, octet-per-sample=1). The default 80 is equal
* to to 10msec (see RFC3551) */
#define GST_RTP_PCMA_MIN_PTIME_OCTETS 80
static void
gst_rtp_pcma_pay_base_init (gpointer klass)
......@@ -78,24 +86,30 @@ gst_rtp_pcma_pay_class_init (GstRtpPmcaPayClass * klass)
gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = gst_rtp_pcma_pay_finalize;
gstbasertppayload_class->set_caps = gst_rtp_pcma_pay_setcaps;
gstbasertppayload_class->handle_buffer = gst_rtp_pcma_pay_handle_buffer;
}
static void
gst_rtp_pcma_pay_init (GstRtpPmcaPay * rtppcmapay, GstRtpPmcaPayClass * klass)
{
GstBaseRTPAudioPayload *basertpaudiopayload;
rtppcmapay->adapter = gst_adapter_new ();
GST_BASE_RTP_PAYLOAD (rtppcmapay)->clock_rate = 8000;
}
basertpaudiopayload = GST_BASE_RTP_AUDIO_PAYLOAD (rtppcmapay);
static void
gst_rtp_pcma_pay_finalize (GObject * object)
{
GstRtpPmcaPay *rtppcmapay;
GST_BASE_RTP_PAYLOAD (rtppcmapay)->clock_rate = 8000;
rtppcmapay = GST_RTP_PCMA_PAY (object);
/* tell basertpaudiopayload that this is a sample based codec */
gst_basertpaudiopayload_set_sample_based (basertpaudiopayload);
g_object_unref (rtppcmapay->adapter);
rtppcmapay->adapter = NULL;
/* octet-per-sample is 1 for PCM */
gst_basertpaudiopayload_set_sample_options (basertpaudiopayload, 1);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
......@@ -109,6 +123,104 @@ gst_rtp_pcma_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
return TRUE;
}
static GstFlowReturn
gst_rtp_pcma_pay_flush (GstRtpPmcaPay * rtppcmapay)
{
guint avail;
GstBuffer *outbuf;
GstFlowReturn ret;
guint maxptime_octets = G_MAXUINT;
guint minptime_octets = GST_RTP_PCMA_MIN_PTIME_OCTETS;
if (GST_BASE_RTP_PAYLOAD (rtppcmapay)->max_ptime > 0) {
/* calculate octet count with:
maxptime-nsec * samples-per-sec / nsecs-per-sec * octets-per-sample */
maxptime_octets =
GST_BASE_RTP_PAYLOAD (rtppcmapay)->max_ptime *
GST_BASE_RTP_PAYLOAD (rtppcmapay)->clock_rate / GST_SECOND;
}
/* the data available in the adapter is either smaller
* than the MTU or bigger. In the case it is smaller, the complete
* adapter contents can be put in one packet. */
avail = gst_adapter_available (rtppcmapay->adapter);
ret = GST_FLOW_OK;
while (avail >= minptime_octets) {
guint8 *payload;
guint8 *data;
guint payload_len;
guint packet_len;
/* fill one MTU or all available bytes */
payload_len =
MIN (MIN (GST_BASE_RTP_PAYLOAD_MTU (rtppcmapay), maxptime_octets),
avail);
/* this will be the total lenght of the packet */
packet_len = gst_rtp_buffer_calc_packet_len (payload_len, 0, 0);
/* create buffer to hold the payload */
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
/* copy payload */
gst_rtp_buffer_set_payload_type (outbuf,
GST_BASE_RTP_PAYLOAD_PT (rtppcmapay));
payload = gst_rtp_buffer_get_payload (outbuf);
data = (guint8 *) gst_adapter_peek (rtppcmapay->adapter, payload_len);
memcpy (payload, data, payload_len);
gst_adapter_flush (rtppcmapay->adapter, payload_len);
avail -= payload_len;
GST_BUFFER_TIMESTAMP (outbuf) = rtppcmapay->first_ts;
ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtppcmapay), outbuf);
}
return ret;
}
static GstFlowReturn
gst_rtp_pcma_pay_handle_buffer (GstBaseRTPPayload * basepayload,
GstBuffer * buffer)
{
GstRtpPmcaPay *rtppcmapay;
guint size, packet_len, avail;
GstFlowReturn ret;
GstClockTime duration;
rtppcmapay = GST_RTP_PCMA_PAY (basepayload);
size = GST_BUFFER_SIZE (buffer);
duration = GST_BUFFER_TIMESTAMP (buffer);
avail = gst_adapter_available (rtppcmapay->adapter);
if (avail == 0) {
rtppcmapay->first_ts = GST_BUFFER_TIMESTAMP (buffer);
rtppcmapay->duration = 0;
}
/* get packet length of data and see if we exceeded MTU. */
packet_len = gst_rtp_buffer_calc_packet_len (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, rtppcmapay->duration + duration)) {
ret = gst_rtp_pcma_pay_flush (rtppcmapay);
rtppcmapay->first_ts = GST_BUFFER_TIMESTAMP (buffer);
rtppcmapay->duration = 0;
} else {
ret = GST_FLOW_OK;
}
gst_adapter_push (rtppcmapay->adapter, buffer);
rtppcmapay->duration += duration;
return ret;
}
gboolean
gst_rtp_pcma_pay_plugin_init (GstPlugin * plugin)
{
......
......@@ -17,7 +17,8 @@
#define __GST_RTP_PCMA_PAY_H__
#include <gst/gst.h>
#include <gst/rtp/gstbasertpaudiopayload.h>
#include <gst/rtp/gstbasertppayload.h>
#include <gst/base/gstadapter.h>
G_BEGIN_DECLS
......@@ -29,20 +30,24 @@ typedef struct _GstRtpPmcaPayClass GstRtpPmcaPayClass;
#define GST_RTP_PCMA_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_PCMA_PAY,GstRtpPmcaPay))
#define GST_RTP_PCMA_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_PCMA_PAY,GstRtpPmcaPayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_PCMA_PAY,GstRtpPmcaPay))
#define GST_IS_RTP_PCMA_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_PCMA_PAY))
#define GST_IS_RTP_PCMA_PAY_CLASS(klass) \
#define GST_IS_RTP_PCMA_PAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_PCMA_PAY))
struct _GstRtpPmcaPay
{
GstBaseRTPAudioPayload audiopayload;
GstBaseRTPPayload payload;
GstAdapter *adapter;
GstClockTime first_ts;
GstClockTime duration;
};
struct _GstRtpPmcaPayClass
{
GstBaseRTPAudioPayloadClass parent_class;
GstBaseRTPPayloadClass parent_class;
};
gboolean gst_rtp_pcma_pay_plugin_init (GstPlugin * plugin);
......
......@@ -28,10 +28,10 @@ typedef struct _GstRtpPcmuDepayClass GstRtpPcmuDepayClass;
#define GST_RTP_PCMU_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_PCMU_DEPAY,GstRtpPcmuDepay))
#define GST_RTP_PCMU_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_PCMU_DEPAY,GstRtpPcmuDepayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_PCMU_DEPAY,GstRtpPcmuDepay))
#define GST_IS_RTP_PCMU_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_PCMU_DEPAY))
#define GST_IS_RTP_PCMU_DEPAY_CLASS(klass) \
#define GST_IS_RTP_PCMU_DEPAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_PCMU_DEPAY))
struct _GstRtpPcmuDepay
......
......@@ -50,9 +50,17 @@ GST_STATIC_PAD_TEMPLATE ("src",
static gboolean gst_rtp_pcmu_pay_setcaps (GstBaseRTPPayload * payload,
GstCaps * caps);
static GstFlowReturn gst_rtp_pcmu_pay_handle_buffer (GstBaseRTPPayload *
payload, GstBuffer * buffer);
static void gst_rtp_pcmu_pay_finalize (GObject * object);
GST_BOILERPLATE (GstRtpPcmuPay, gst_rtp_pcmu_pay, GstBaseRTPAudioPayload,
GST_TYPE_BASE_RTP_AUDIO_PAYLOAD);
GST_BOILERPLATE (GstRtpPcmuPay, gst_rtp_pcmu_pay, GstBaseRTPPayload,
GST_TYPE_BASE_RTP_PAYLOAD);
/* The lower limit for number of octet to put in one packet
* (clock-rate=8000, octet-per-sample=1). The default 80 is equal
* to to 10msec (see RFC3551) */
#define GST_RTP_PCMU_MIN_PTIME_OCTETS 80
static void
gst_rtp_pcmu_pay_base_init (gpointer klass)
......@@ -78,24 +86,30 @@ gst_rtp_pcmu_pay_class_init (GstRtpPcmuPayClass * klass)
gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = gst_rtp_pcmu_pay_finalize;
gstbasertppayload_class->set_caps = gst_rtp_pcmu_pay_setcaps;
gstbasertppayload_class->handle_buffer = gst_rtp_pcmu_pay_handle_buffer;
}
static void
gst_rtp_pcmu_pay_init (GstRtpPcmuPay * rtppcmupay, GstRtpPcmuPayClass * klass)
{
GstBaseRTPAudioPayload *basertpaudiopayload;
rtppcmupay->adapter = gst_adapter_new ();
GST_BASE_RTP_PAYLOAD (rtppcmupay)->clock_rate = 8000;
}
basertpaudiopayload = GST_BASE_RTP_AUDIO_PAYLOAD (rtppcmupay);
static void
gst_rtp_pcmu_pay_finalize (GObject * object)
{
GstRtpPcmuPay *rtppcmupay;
GST_BASE_RTP_PAYLOAD (rtppcmupay)->clock_rate = 8000;
rtppcmupay = GST_RTP_PCMU_PAY (object);
/* tell basertpaudiopayload that this is a sample based codec */
gst_basertpaudiopayload_set_sample_based (basertpaudiopayload);
g_object_unref (rtppcmupay->adapter);
rtppcmupay->adapter = NULL;
/* octet-per-sample is 1 for PCM */
gst_basertpaudiopayload_set_sample_options (basertpaudiopayload, 1);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
......@@ -109,6 +123,104 @@ gst_rtp_pcmu_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
return TRUE;
}
static GstFlowReturn
gst_rtp_pcmu_pay_flush (GstRtpPcmuPay * rtppcmupay)
{
guint avail;
GstBuffer *outbuf;
GstFlowReturn ret;
guint maxptime_octets = G_MAXUINT;
guint minptime_octets = GST_RTP_PCMU_MIN_PTIME_OCTETS;
if (GST_BASE_RTP_PAYLOAD (rtppcmupay)->max_ptime > 0) {
/* calculate octet count with:
maxptime-nsec * samples-per-sec / nsecs-per-sec * octets-per-sample */
maxptime_octets =
GST_BASE_RTP_PAYLOAD (rtppcmupay)->max_ptime *
GST_BASE_RTP_PAYLOAD (rtppcmupay)->clock_rate / GST_SECOND;
}
/* the data available in the adapter is either smaller
* than the MTU or bigger. In the case it is smaller, the complete
* adapter contents can be put in one packet. */
avail = gst_adapter_available (rtppcmupay->adapter);
ret = GST_FLOW_OK;
while (avail >= minptime_octets) {
guint8 *payload;
guint8 *data;
guint payload_len;
guint packet_len;
/* fill one MTU or all available bytes */
payload_len =
MIN (MIN (GST_BASE_RTP_PAYLOAD_MTU (rtppcmupay), maxptime_octets),
avail);
/* this will be the total lenght of the packet */
packet_len = gst_rtp_buffer_calc_packet_len (payload_len, 0, 0);
/* create buffer to hold the payload */
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
/* copy payload */
gst_rtp_buffer_set_payload_type (outbuf,
GST_BASE_RTP_PAYLOAD_PT (rtppcmupay));
payload = gst_rtp_buffer_get_payload (outbuf);
data = (guint8 *) gst_adapter_peek (rtppcmupay->adapter, payload_len);
memcpy (payload, data, payload_len);
gst_adapter_flush (rtppcmupay->adapter, payload_len);
avail -= payload_len;
GST_BUFFER_TIMESTAMP (outbuf) = rtppcmupay->first_ts;
ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtppcmupay), outbuf);
}
return ret;
}
static GstFlowReturn
gst_rtp_pcmu_pay_handle_buffer (GstBaseRTPPayload * basepayload,
GstBuffer * buffer)
{
GstRtpPcmuPay *rtppcmupay;
guint size, packet_len, avail;
GstFlowReturn ret;
GstClockTime duration;
rtppcmupay = GST_RTP_PCMU_PAY (basepayload);
size = GST_BUFFER_SIZE (buffer);
duration = GST_BUFFER_TIMESTAMP (buffer);
avail = gst_adapter_available (rtppcmupay->adapter);
if (avail == 0) {
rtppcmupay->first_ts = GST_BUFFER_TIMESTAMP (buffer);
rtppcmupay->duration = 0;
}
/* get packet length of data and see if we exceeded MTU. */
packet_len = gst_rtp_buffer_calc_packet_len (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, rtppcmupay->duration + duration)) {
ret = gst_rtp_pcmu_pay_flush (rtppcmupay);
rtppcmupay->first_ts = GST_BUFFER_TIMESTAMP (buffer);
rtppcmupay->duration = 0;
} else {
ret = GST_FLOW_OK;