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
This commit is contained in:
Thomas Vander Stichele 2006-04-13 09:15:31 +00:00
parent 9e8bbf41f7
commit cafd99311b
27 changed files with 311 additions and 127 deletions

View file

@ -1,47 +1,3 @@
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> 2006-04-12 Wim Taymans <wim@fluendo.com>
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_setcaps), * ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_setcaps),

View file

@ -16,8 +16,6 @@ libgstrtp_la_SOURCES = \
gstrtph263pdepay.c \ gstrtph263pdepay.c \
gstrtph263ppay.c \ gstrtph263ppay.c \
gstrtph263pay.c \ gstrtph263pay.c \
gstrtpilbcpay.c \
gstrtpilbcdepay.c \
gstasteriskh263.c \ gstasteriskh263.c \
gstrtpmp4vdepay.c \ gstrtpmp4vdepay.c \
gstrtpmp4vpay.c \ gstrtpmp4vpay.c \
@ -54,8 +52,6 @@ noinst_HEADERS = \
gstrtph263pdepay.h \ gstrtph263pdepay.h \
gstrtph263ppay.h \ gstrtph263ppay.h \
gstrtph263pay.h \ gstrtph263pay.h \
gstrtpilbcpay.h \
gstrtpilbcdepay.h \
gstrtpmp4vdepay.h \ gstrtpmp4vdepay.h \
gstrtpmp4vpay.h \ gstrtpmp4vpay.h \
gstrtpmp4gpay.h \ gstrtpmp4gpay.h \

View file

@ -30,10 +30,10 @@ G_BEGIN_DECLS
#define GST_ASTERISK_H263(obj) \ #define GST_ASTERISK_H263(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ASTERISK_H263,GstAsteriskh263)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ASTERISK_H263,GstAsteriskh263))
#define GST_ASTERISK_H263_CLASS(klass) \ #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) \ #define GST_IS_ASTERISK_H263(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ASTERISK_H263)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ASTERISK_H263))
typedef struct _GstAsteriskh263 GstAsteriskh263; typedef struct _GstAsteriskh263 GstAsteriskh263;

View file

@ -35,8 +35,6 @@
#include "gstrtph263pdepay.h" #include "gstrtph263pdepay.h"
#include "gstrtph263ppay.h" #include "gstrtph263ppay.h"
#include "gstrtph263pay.h" #include "gstrtph263pay.h"
#include "gstrtpilbcpay.h"
#include "gstrtpilbcdepay.h"
#include "gstasteriskh263.h" #include "gstasteriskh263.h"
#include "gstrtpmp4vpay.h" #include "gstrtpmp4vpay.h"
#include "gstrtpmp4gpay.h" #include "gstrtpmp4gpay.h"
@ -89,12 +87,6 @@ plugin_init (GstPlugin * plugin)
if (!gst_rtp_h263_pay_plugin_init (plugin)) if (!gst_rtp_h263_pay_plugin_init (plugin))
return FALSE; 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)) if (!gst_asteriskh263_plugin_init (plugin))
return FALSE; return FALSE;

View file

@ -24,7 +24,10 @@
#include "rtp-packet.h" #include "rtp-packet.h"
#include "gstrtp-common.h" #include "gstrtp-common.h"
G_BEGIN_DECLS #ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/* Definition of structure storing data for this element. */ /* Definition of structure storing data for this element. */
typedef struct _GstRtpL16Depay GstRtpL16Depay; typedef struct _GstRtpL16Depay GstRtpL16Depay;
@ -54,14 +57,17 @@ struct _GstRtpL16DepayClass
#define GST_RTP_L16_DEPAY(obj) \ #define GST_RTP_L16_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_L16_DEPAY,GstRtpL16Depay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_L16_DEPAY,GstRtpL16Depay))
#define GST_RTP_L16_DEPAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_L16_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_L16_DEPAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_L16_DEPAY))
gboolean gst_rtp_L16depay_plugin_init (GstPlugin * plugin); gboolean gst_rtp_L16depay_plugin_init (GstPlugin * plugin);
G_END_DECLS #ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GST_RTP_L16_DEPAY_H__ */ #endif /* __GST_RTP_L16_DEPAY_H__ */

View file

@ -59,10 +59,10 @@ struct _GstRtpL16PayClass
#define GST_RTP_L16_PAY(obj) \ #define GST_RTP_L16_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_L16_PAY,GstRtpL16Pay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_L16_PAY,GstRtpL16Pay))
#define GST_RTP_L16_PAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_L16_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_L16_PAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_L16_PAY))
gboolean gst_rtpL16pay_plugin_init (GstPlugin * plugin); gboolean gst_rtpL16pay_plugin_init (GstPlugin * plugin);

View file

@ -29,10 +29,10 @@ G_BEGIN_DECLS
#define GST_RTP_AMR_DEPAY(obj) \ #define GST_RTP_AMR_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_AMR_DEPAY,GstRtpAMRDepay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_AMR_DEPAY,GstRtpAMRDepay))
#define GST_RTP_AMR_DEPAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_AMR_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_AMR_DEPAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_AMR_DEPAY))
typedef struct _GstRtpAMRDepay GstRtpAMRDepay; typedef struct _GstRtpAMRDepay GstRtpAMRDepay;

View file

@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_AMR_PAY(obj) \ #define GST_RTP_AMR_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_AMR_PAY,GstRtpAMRPay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_AMR_PAY,GstRtpAMRPay))
#define GST_RTP_AMR_PAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_AMR_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_AMR_PAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_AMR_PAY))
typedef struct _GstRtpAMRPay GstRtpAMRPay; typedef struct _GstRtpAMRPay GstRtpAMRPay;

View file

@ -26,7 +26,7 @@ G_BEGIN_DECLS
#define GST_TYPE_RTP_DEPAY (gst_rtp_depay_get_type()) #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(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(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)) #define GST_RTP_DEPAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_DEPAY, GstRTPDepayClass))

View file

@ -33,10 +33,10 @@ typedef struct _GstRTPGSMDepayClass GstRTPGSMDepayClass;
#define GST_RTP_GSM_DEPAY(obj) \ #define GST_RTP_GSM_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_GSM_DEPAY,GstRTPGSMDepay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_GSM_DEPAY,GstRTPGSMDepay))
#define GST_RTP_GSM_DEPAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_GSM_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_GSM_DEPAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_GSM_DEPAY))
struct _GstRTPGSMDepay struct _GstRTPGSMDepay

View file

@ -34,10 +34,10 @@ typedef struct _GstRTPGSMPayClass GstRTPGSMPayClass;
#define GST_RTP_GSM_PAY(obj) \ #define GST_RTP_GSM_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_GSM_PAY,GstRTPGSMPay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_GSM_PAY,GstRTPGSMPay))
#define GST_RTP_GSM_PAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_GSM_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_GSM_PAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_GSM_PAY))
struct _GstRTPGSMPay struct _GstRTPGSMPay

View file

@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_H263_PAY(obj) \ #define GST_RTP_H263_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H263_PAY,GstRtpH263Pay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H263_PAY,GstRtpH263Pay))
#define GST_RTP_H263_PAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_H263_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_H263_PAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_H263_PAY))
typedef struct _GstRtpH263Pay GstRtpH263Pay; typedef struct _GstRtpH263Pay GstRtpH263Pay;

View file

@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_H263P_DEPAY(obj) \ #define GST_RTP_H263P_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H263P_DEPAY,GstRtpH263PDepay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H263P_DEPAY,GstRtpH263PDepay))
#define GST_RTP_H263P_DEPAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_H263P_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_H263P_DEPAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_H263P_DEPAY))
typedef struct _GstRtpH263PDepay GstRtpH263PDepay; typedef struct _GstRtpH263PDepay GstRtpH263PDepay;

View file

@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_H263P_PAY(obj) \ #define GST_RTP_H263P_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H263P_PAY,GstRtpH263PPay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H263P_PAY,GstRtpH263PPay))
#define GST_RTP_H263P_PAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_H263P_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_H263P_PAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_H263P_PAY))
typedef struct _GstRtpH263PPay GstRtpH263PPay; typedef struct _GstRtpH263PPay GstRtpH263PPay;

View file

@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_MP4G_PAY(obj) \ #define GST_RTP_MP4G_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MP4G_PAY,GstRtpMP4GPay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MP4G_PAY,GstRtpMP4GPay))
#define GST_RTP_MP4G_PAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_MP4G_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MP4G_PAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MP4G_PAY))
typedef struct _GstRtpMP4GPay GstRtpMP4GPay; typedef struct _GstRtpMP4GPay GstRtpMP4GPay;

View file

@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_MP4V_DEPAY(obj) \ #define GST_RTP_MP4V_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MP4V_DEPAY,GstRtpMP4VDepay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MP4V_DEPAY,GstRtpMP4VDepay))
#define GST_RTP_MP4V_DEPAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_MP4V_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MP4V_DEPAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MP4V_DEPAY))
typedef struct _GstRtpMP4VDepay GstRtpMP4VDepay; typedef struct _GstRtpMP4VDepay GstRtpMP4VDepay;

View file

@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_MP4V_PAY(obj) \ #define GST_RTP_MP4V_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MP4V_PAY,GstRtpMP4VPay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MP4V_PAY,GstRtpMP4VPay))
#define GST_RTP_MP4V_PAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_MP4V_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MP4V_PAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MP4V_PAY))
typedef struct _GstRtpMP4VPay GstRtpMP4VPay; typedef struct _GstRtpMP4VPay GstRtpMP4VPay;

View file

@ -29,10 +29,10 @@ G_BEGIN_DECLS
#define GST_RTP_MPA_DEPAY(obj) \ #define GST_RTP_MPA_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MPA_DEPAY,GstRtpMPADepay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MPA_DEPAY,GstRtpMPADepay))
#define GST_RTP_MPA_DEPAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_MPA_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MPA_DEPAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MPA_DEPAY))
typedef struct _GstRtpMPADepay GstRtpMPADepay; typedef struct _GstRtpMPADepay GstRtpMPADepay;

View file

@ -31,10 +31,10 @@ G_BEGIN_DECLS
#define GST_RTP_MPA_PAY(obj) \ #define GST_RTP_MPA_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MPA_PAY,GstRtpMPAPay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MPA_PAY,GstRtpMPAPay))
#define GST_RTP_MPA_PAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_MPA_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MPA_PAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MPA_PAY))
typedef struct _GstRtpMPAPay GstRtpMPAPay; typedef struct _GstRtpMPAPay GstRtpMPAPay;

View file

@ -28,10 +28,10 @@ typedef struct _GstRtpPcmaDepayClass GstRtpPcmaDepayClass;
#define GST_RTP_PCMA_DEPAY(obj) \ #define GST_RTP_PCMA_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_PCMA_DEPAY,GstRtpPcmaDepay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_PCMA_DEPAY,GstRtpPcmaDepay))
#define GST_RTP_PCMA_DEPAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_PCMA_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_PCMA_DEPAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_PCMA_DEPAY))
struct _GstRtpPcmaDepay struct _GstRtpPcmaDepay

View file

@ -50,9 +50,17 @@ GST_STATIC_PAD_TEMPLATE ("src",
static gboolean gst_rtp_pcma_pay_setcaps (GstBaseRTPPayload * payload, static gboolean gst_rtp_pcma_pay_setcaps (GstBaseRTPPayload * payload,
GstCaps * caps); 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_BOILERPLATE (GstRtpPmcaPay, gst_rtp_pcma_pay, GstBaseRTPPayload,
GST_TYPE_BASE_RTP_AUDIO_PAYLOAD); 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 static void
gst_rtp_pcma_pay_base_init (gpointer klass) gst_rtp_pcma_pay_base_init (gpointer klass)
@ -78,24 +86,30 @@ gst_rtp_pcma_pay_class_init (GstRtpPmcaPayClass * klass)
gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
parent_class = g_type_class_peek_parent (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->set_caps = gst_rtp_pcma_pay_setcaps;
gstbasertppayload_class->handle_buffer = gst_rtp_pcma_pay_handle_buffer;
} }
static void static void
gst_rtp_pcma_pay_init (GstRtpPmcaPay * rtppcmapay, GstRtpPmcaPayClass * klass) gst_rtp_pcma_pay_init (GstRtpPmcaPay * rtppcmapay, GstRtpPmcaPayClass * klass)
{ {
GstBaseRTPAudioPayload *basertpaudiopayload; rtppcmapay->adapter = gst_adapter_new ();
basertpaudiopayload = GST_BASE_RTP_AUDIO_PAYLOAD (rtppcmapay);
GST_BASE_RTP_PAYLOAD (rtppcmapay)->clock_rate = 8000; GST_BASE_RTP_PAYLOAD (rtppcmapay)->clock_rate = 8000;
}
/* tell basertpaudiopayload that this is a sample based codec */ static void
gst_basertpaudiopayload_set_sample_based (basertpaudiopayload); gst_rtp_pcma_pay_finalize (GObject * object)
{
GstRtpPmcaPay *rtppcmapay;
/* octet-per-sample is 1 for PCM */ rtppcmapay = GST_RTP_PCMA_PAY (object);
gst_basertpaudiopayload_set_sample_options (basertpaudiopayload, 1);
g_object_unref (rtppcmapay->adapter);
rtppcmapay->adapter = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
} }
static gboolean static gboolean
@ -109,6 +123,104 @@ gst_rtp_pcma_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
return TRUE; 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 gboolean
gst_rtp_pcma_pay_plugin_init (GstPlugin * plugin) gst_rtp_pcma_pay_plugin_init (GstPlugin * plugin)
{ {

View file

@ -17,7 +17,8 @@
#define __GST_RTP_PCMA_PAY_H__ #define __GST_RTP_PCMA_PAY_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/rtp/gstbasertpaudiopayload.h> #include <gst/rtp/gstbasertppayload.h>
#include <gst/base/gstadapter.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -29,20 +30,24 @@ typedef struct _GstRtpPmcaPayClass GstRtpPmcaPayClass;
#define GST_RTP_PCMA_PAY(obj) \ #define GST_RTP_PCMA_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_PCMA_PAY,GstRtpPmcaPay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_PCMA_PAY,GstRtpPmcaPay))
#define GST_RTP_PCMA_PAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_PCMA_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_PCMA_PAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_PCMA_PAY))
struct _GstRtpPmcaPay struct _GstRtpPmcaPay
{ {
GstBaseRTPAudioPayload audiopayload; GstBaseRTPPayload payload;
GstAdapter *adapter;
GstClockTime first_ts;
GstClockTime duration;
}; };
struct _GstRtpPmcaPayClass struct _GstRtpPmcaPayClass
{ {
GstBaseRTPAudioPayloadClass parent_class; GstBaseRTPPayloadClass parent_class;
}; };
gboolean gst_rtp_pcma_pay_plugin_init (GstPlugin * plugin); gboolean gst_rtp_pcma_pay_plugin_init (GstPlugin * plugin);

View file

@ -28,10 +28,10 @@ typedef struct _GstRtpPcmuDepayClass GstRtpPcmuDepayClass;
#define GST_RTP_PCMU_DEPAY(obj) \ #define GST_RTP_PCMU_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_PCMU_DEPAY,GstRtpPcmuDepay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_PCMU_DEPAY,GstRtpPcmuDepay))
#define GST_RTP_PCMU_DEPAY_CLASS(klass) \ #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) \ #define GST_IS_RTP_PCMU_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_PCMU_DEPAY)) (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)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_PCMU_DEPAY))
struct _GstRtpPcmuDepay struct _GstRtpPcmuDepay

View file

@ -50,9 +50,17 @@ GST_STATIC_PAD_TEMPLATE ("src",
static gboolean gst_rtp_pcmu_pay_setcaps (GstBaseRTPPayload * payload, static gboolean gst_rtp_pcmu_pay_setcaps (GstBaseRTPPayload * payload,
GstCaps * caps); 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_BOILERPLATE (GstRtpPcmuPay, gst_rtp_pcmu_pay, GstBaseRTPPayload,
GST_TYPE_BASE_RTP_AUDIO_PAYLOAD); 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 static void
gst_rtp_pcmu_pay_base_init (gpointer klass) gst_rtp_pcmu_pay_base_init (gpointer klass)
@ -78,24 +86,30 @@ gst_rtp_pcmu_pay_class_init (GstRtpPcmuPayClass * klass)
gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass; gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
parent_class = g_type_class_peek_parent (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->set_caps = gst_rtp_pcmu_pay_setcaps;
gstbasertppayload_class->handle_buffer = gst_rtp_pcmu_pay_handle_buffer;
} }
static void static void
gst_rtp_pcmu_pay_init (GstRtpPcmuPay * rtppcmupay, GstRtpPcmuPayClass * klass) gst_rtp_pcmu_pay_init (GstRtpPcmuPay * rtppcmupay, GstRtpPcmuPayClass * klass)
{ {
GstBaseRTPAudioPayload *basertpaudiopayload; rtppcmupay->adapter = gst_adapter_new ();
basertpaudiopayload = GST_BASE_RTP_AUDIO_PAYLOAD (rtppcmupay);
GST_BASE_RTP_PAYLOAD (rtppcmupay)->clock_rate = 8000; GST_BASE_RTP_PAYLOAD (rtppcmupay)->clock_rate = 8000;
}
/* tell basertpaudiopayload that this is a sample based codec */ static void
gst_basertpaudiopayload_set_sample_based (basertpaudiopayload); gst_rtp_pcmu_pay_finalize (GObject * object)
{
GstRtpPcmuPay *rtppcmupay;
/* octet-per-sample is 1 for PCM */ rtppcmupay = GST_RTP_PCMU_PAY (object);
gst_basertpaudiopayload_set_sample_options (basertpaudiopayload, 1);
g_object_unref (rtppcmupay->adapter);
rtppcmupay->adapter = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
} }
static gboolean static gboolean
@ -109,6 +123,104 @@ gst_rtp_pcmu_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
return TRUE; 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;
}
gst_adapter_push (rtppcmupay->adapter, buffer);
rtppcmupay->duration += duration;
return ret;
}
gboolean gboolean
gst_rtp_pcmu_pay_plugin_init (GstPlugin * plugin) gst_rtp_pcmu_pay_plugin_init (GstPlugin * plugin)
{ {

View file

@ -17,7 +17,8 @@
#define __GST_RTP_PCMU_PAY_H__ #define __GST_RTP_PCMU_PAY_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/rtp/gstbasertpaudiopayload.h> #include <gst/rtp/gstbasertppayload.h>
#include <gst/base/gstadapter.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -29,20 +30,24 @@ typedef struct _GstRtpPcmuPayClass GstRtpPcmuPayClass;
#define GST_RTP_PCMU_PAY(obj) \ #define GST_RTP_PCMU_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_PCMU_PAY,GstRtpPcmuPay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_PCMU_PAY,GstRtpPcmuPay))
#define GST_RTP_PCMU_PAY_CLASS(klass) \ #define GST_RTP_PCMU_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_PCMU_PAY,GstRtpPcmuPayClass)) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_PCMU_PAY,GstRtpPcmuPay))
#define GST_IS_RTP_PCMU_PAY(obj) \ #define GST_IS_RTP_PCMU_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_PCMU_PAY)) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_PCMU_PAY))
#define GST_IS_RTP_PCMU_PAY_CLASS(klass) \ #define GST_IS_RTP_PCMU_PAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_PCMU_PAY)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_PCMU_PAY))
struct _GstRtpPcmuPay struct _GstRtpPcmuPay
{ {
GstBaseRTPAudioPayload audiopayload; GstBaseRTPPayload payload;
GstAdapter *adapter;
GstClockTime first_ts;
GstClockTime duration;
}; };
struct _GstRtpPcmuPayClass struct _GstRtpPcmuPayClass
{ {
GstBaseRTPAudioPayloadClass parent_class; GstBaseRTPPayloadClass parent_class;
}; };
gboolean gst_rtp_pcmu_pay_plugin_init (GstPlugin * plugin); gboolean gst_rtp_pcmu_pay_plugin_init (GstPlugin * plugin);

View file

@ -28,10 +28,10 @@ typedef struct _GstRtpSPEEXDepayClass GstRtpSPEEXDepayClass;
#define GST_RTP_SPEEX_DEPAY(obj) \ #define GST_RTP_SPEEX_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_SPEEX_DEPAY,GstRtpSPEEXDepay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_SPEEX_DEPAY,GstRtpSPEEXDepay))
#define GST_RTP_SPEEX_DEPAY_CLASS(klass) \ #define GST_RTP_SPEEX_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_SPEEX_DEPAY,GstRtpSPEEXDepayClass)) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_SPEEX_DEPAY,GstRtpSPEEXDepay))
#define GST_IS_RTP_SPEEX_DEPAY(obj) \ #define GST_IS_RTP_SPEEX_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_SPEEX_DEPAY)) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_SPEEX_DEPAY))
#define GST_IS_RTP_SPEEX_DEPAY_CLASS(klass) \ #define GST_IS_RTP_SPEEX_DEPAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_SPEEX_DEPAY)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_SPEEX_DEPAY))
struct _GstRtpSPEEXDepay struct _GstRtpSPEEXDepay

View file

@ -29,10 +29,10 @@ typedef struct _GstRtpSPEEXPayClass GstRtpSPEEXPayClass;
#define GST_RTP_SPEEX_PAY(obj) \ #define GST_RTP_SPEEX_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_SPEEX_PAY,GstRtpSPEEXPay)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_SPEEX_PAY,GstRtpSPEEXPay))
#define GST_RTP_SPEEX_PAY_CLASS(klass) \ #define GST_RTP_SPEEX_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_SPEEX_PAY,GstRtpSPEEXPayClass)) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_SPEEX_PAY,GstRtpSPEEXPay))
#define GST_IS_RTP_SPEEX_PAY(obj) \ #define GST_IS_RTP_SPEEX_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_SPEEX_PAY)) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_SPEEX_PAY))
#define GST_IS_RTP_SPEEX_PAY_CLASS(klass) \ #define GST_IS_RTP_SPEEX_PAY_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_SPEEX_PAY)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_SPEEX_PAY))
struct _GstRtpSPEEXPay struct _GstRtpSPEEXPay