gstreamer/gst-libs/gst/rtp/gstrtpbasepayload.c

1070 lines
34 KiB
C
Raw Normal View History

/* GStreamer
* Copyright (C) <2005> Wim Taymans <wim@fluendo.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more
*/
/**
2011-11-11 11:32:23 +00:00
* SECTION:gstrtpbasepayload
* @short_description: Base class for RTP payloader
*
* Provides a base class for RTP payloaders
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <gst/rtp/gstrtpbuffer.h>
2011-11-11 11:32:23 +00:00
#include "gstrtpbasepayload.h"
2011-11-11 11:32:23 +00:00
GST_DEBUG_CATEGORY_STATIC (rtpbasepayload_debug);
#define GST_CAT_DEFAULT (rtpbasepayload_debug)
2011-11-11 11:24:08 +00:00
#define GST_RTP_BASE_PAYLOAD_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_RTP_BASE_PAYLOAD, GstRTPBasePayloadPrivate))
2011-11-11 11:24:08 +00:00
struct _GstRTPBasePayloadPrivate
{
gboolean ts_offset_random;
gboolean seqnum_offset_random;
gboolean ssrc_random;
guint16 next_seqnum;
gboolean perfect_rtptime;
gint notified_first_timestamp;
guint64 base_offset;
gint64 base_rtime;
gint64 prop_max_ptime;
gint64 caps_max_ptime;
};
2011-11-11 11:24:08 +00:00
/* RTPBasePayload signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
/* FIXME 0.11, a better default is the Ethernet MTU of
* 1500 - sizeof(headers) as pointed out by marcelm in IRC:
* So an Ethernet MTU of 1500, minus 60 for the max IP, minus 8 for UDP, gives
* 1432 bytes or so. And that should be adjusted downward further for other
* encapsulations like PPPoE, so 1400 at most.
*/
#define DEFAULT_MTU 1400
#define DEFAULT_PT 96
#define DEFAULT_SSRC -1
#define DEFAULT_TIMESTAMP_OFFSET -1
#define DEFAULT_SEQNUM_OFFSET -1
#define DEFAULT_MAX_PTIME -1
#define DEFAULT_MIN_PTIME 0
#define DEFAULT_PERFECT_RTPTIME TRUE
#define DEFAULT_PTIME_MULTIPLE 0
enum
{
PROP_0,
PROP_MTU,
PROP_PT,
PROP_SSRC,
PROP_TIMESTAMP_OFFSET,
PROP_SEQNUM_OFFSET,
PROP_MAX_PTIME,
PROP_MIN_PTIME,
PROP_TIMESTAMP,
PROP_SEQNUM,
PROP_PERFECT_RTPTIME,
PROP_PTIME_MULTIPLE,
PROP_LAST
};
2011-11-11 11:24:08 +00:00
static void gst_rtp_base_payload_class_init (GstRTPBasePayloadClass * klass);
2011-11-11 11:32:23 +00:00
static void gst_rtp_base_payload_init (GstRTPBasePayload * rtpbasepayload,
gpointer g_class);
2011-11-11 11:24:08 +00:00
static void gst_rtp_base_payload_finalize (GObject * object);
2011-11-11 11:24:08 +00:00
static GstCaps *gst_rtp_base_payload_sink_getcaps (GstPad * pad,
GstCaps * filter);
2011-11-11 11:24:08 +00:00
static gboolean gst_rtp_base_payload_event_default (GstRTPBasePayload *
2011-11-11 11:32:23 +00:00
rtpbasepayload, GstEvent * event);
2011-11-11 11:24:08 +00:00
static gboolean gst_rtp_base_payload_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_rtp_base_payload_chain (GstPad * pad,
GstBuffer * buffer);
2011-11-11 11:24:08 +00:00
static GstCaps *gst_rtp_base_payload_getcaps_default (GstRTPBasePayload *
2011-11-11 11:32:23 +00:00
rtpbasepayload, GstPad * pad, GstCaps * filter);
2011-11-11 11:24:08 +00:00
static void gst_rtp_base_payload_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
2011-11-11 11:24:08 +00:00
static void gst_rtp_base_payload_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
2011-11-11 11:24:08 +00:00
static GstStateChangeReturn gst_rtp_base_payload_change_state (GstElement *
element, GstStateChange transition);
static GstElementClass *parent_class = NULL;
/* FIXME 0.11: API should be changed to gst_base_typ_payload_xyz */
GType
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_get_type (void)
{
2011-11-11 11:32:23 +00:00
static GType rtpbasepayload_type = 0;
2011-11-11 11:32:23 +00:00
if (g_once_init_enter ((gsize *) & rtpbasepayload_type)) {
static const GTypeInfo rtpbasepayload_info = {
2011-11-11 11:24:08 +00:00
sizeof (GstRTPBasePayloadClass),
NULL,
NULL,
2011-11-11 11:24:08 +00:00
(GClassInitFunc) gst_rtp_base_payload_class_init,
NULL,
NULL,
2011-11-11 11:24:08 +00:00
sizeof (GstRTPBasePayload),
0,
2011-11-11 11:24:08 +00:00
(GInstanceInitFunc) gst_rtp_base_payload_init,
};
2011-11-11 11:32:23 +00:00
g_once_init_leave ((gsize *) & rtpbasepayload_type,
2011-11-11 11:24:08 +00:00
g_type_register_static (GST_TYPE_ELEMENT, "GstRTPBasePayload",
2011-11-11 11:32:23 +00:00
&rtpbasepayload_info, G_TYPE_FLAG_ABSTRACT));
}
2011-11-11 11:32:23 +00:00
return rtpbasepayload_type;
}
static void
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_class_init (GstRTPBasePayloadClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
2011-11-11 11:24:08 +00:00
g_type_class_add_private (klass, sizeof (GstRTPBasePayloadPrivate));
Fix #337365 (g_type_class_ref <-> g_type_class_peek_parent) Original commit message from CVS: * ext/alsa/gstalsamixeroptions.c: (gst_alsa_mixer_options_class_init): * ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_class_init): * ext/ogg/gstoggdemux.c: (gst_ogg_pad_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/ogg/gstoggparse.c: (gst_ogg_parse_class_init): * gst-libs/gst/audio/gstaudioclock.c: (gst_audio_clock_class_init): * gst-libs/gst/audio/gstaudiofilter.c: (gst_audio_filter_class_init): * gst-libs/gst/audio/gstaudiosink.c: (gst_audioringbuffer_class_init): * gst-libs/gst/audio/gstaudiosrc.c: (gst_audioringbuffer_class_init): * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_class_init): * gst-libs/gst/interfaces/colorbalancechannel.c: (gst_color_balance_channel_class_init): * gst-libs/gst/interfaces/mixeroptions.c: (gst_mixer_options_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/interfaces/tunerchannel.c: (gst_tuner_channel_class_init): * gst-libs/gst/interfaces/tunernorm.c: (gst_tuner_norm_class_init): * gst-libs/gst/netbuffer/gstnetbuffer.c: (gst_netbuffer_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/playback/gstdecodebin.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_stream_selector_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * sys/v4l/gstv4lcolorbalance.c: (gst_v4l_color_balance_channel_class_init): * sys/v4l/gstv4ljpegsrc.c: (gst_v4ljpegsrc_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4ltuner.c: (gst_v4l_tuner_channel_class_init), (gst_v4l_tuner_norm_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): * tests/old/testsuite/alsa/sinesrc.c: (sinesrc_class_init): Fix #337365 (g_type_class_ref <-> g_type_class_peek_parent)
2006-04-08 21:02:53 +00:00
parent_class = g_type_class_peek_parent (klass);
2011-11-11 11:24:08 +00:00
gobject_class->finalize = gst_rtp_base_payload_finalize;
2011-11-11 11:24:08 +00:00
gobject_class->set_property = gst_rtp_base_payload_set_property;
gobject_class->get_property = gst_rtp_base_payload_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MTU,
g_param_spec_uint ("mtu", "MTU",
"Maximum size of one packet",
Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory u... Original commit message from CVS: * configure.ac: * ext/alsa/gstalsamixerelement.c: (gst_alsa_mixer_element_class_init): * ext/alsa/gstalsasink.c: (gst_alsasink_class_init): * ext/alsa/gstalsasrc.c: (gst_alsasrc_class_init): * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_src_class_init): * ext/gio/gstgiosink.c: (gst_gio_sink_class_init): * ext/gio/gstgiosrc.c: (gst_gio_src_class_init): * ext/gio/gstgiostreamsink.c: (gst_gio_stream_sink_class_init): * ext/gio/gstgiostreamsrc.c: (gst_gio_stream_src_class_init): * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_class_init): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/pango/gsttextoverlay.c: (gst_text_overlay_class_init): * ext/pango/gsttextrender.c: (gst_text_render_class_init): * ext/theora/theoradec.c: (gst_theora_dec_class_init): * ext/theora/theoraenc.c: (gst_theora_enc_class_init): * ext/theora/theoraparse.c: (gst_theora_parse_class_init): * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_class_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (gst_audio_filter_template_class_init): * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_class_init): * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_class_init): * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_class_init): * gst/audiorate/gstaudiorate.c: (gst_audio_rate_class_init): * gst/audioresample/gstaudioresample.c: (gst_audioresample_class_init): * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audio_test_src_class_init): * gst/gdp/gstgdppay.c: (gst_gdp_pay_class_init): * gst/playback/gstdecodebin2.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (preroll_unlinked): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gstplaybin2.c: (gst_play_bin_class_init): * gst/playback/gstplaysink.c: (gst_play_sink_class_init): * gst/playback/gstqueue2.c: (gst_queue_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_selector_pad_class_init), (gst_stream_selector_class_init): * gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * gst/tcp/gsttcpclientsrc.c: (gst_tcp_client_src_class_init): * gst/tcp/gsttcpserversink.c: (gst_tcp_server_sink_class_init): * gst/tcp/gsttcpserversrc.c: (gst_tcp_server_src_class_init): * gst/videorate/gstvideorate.c: (gst_video_rate_class_init): * gst/videoscale/gstvideoscale.c: (gst_video_scale_class_init): * gst/videotestsrc/gstvideotestsrc.c: (gst_video_test_src_class_init): * gst/volume/gstvolume.c: (gst_volume_class_init): * sys/v4l/gstv4lelement.c: (gst_v4lelement_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory usage, fewer allocations and thus less memory defragmentation. Depend on core CVS for this. Fixes bug #523806.
2008-03-22 15:00:53 +00:00
28, G_MAXUINT, DEFAULT_MTU,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PT,
g_param_spec_uint ("pt", "payload type",
Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory u... Original commit message from CVS: * configure.ac: * ext/alsa/gstalsamixerelement.c: (gst_alsa_mixer_element_class_init): * ext/alsa/gstalsasink.c: (gst_alsasink_class_init): * ext/alsa/gstalsasrc.c: (gst_alsasrc_class_init): * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_src_class_init): * ext/gio/gstgiosink.c: (gst_gio_sink_class_init): * ext/gio/gstgiosrc.c: (gst_gio_src_class_init): * ext/gio/gstgiostreamsink.c: (gst_gio_stream_sink_class_init): * ext/gio/gstgiostreamsrc.c: (gst_gio_stream_src_class_init): * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_class_init): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/pango/gsttextoverlay.c: (gst_text_overlay_class_init): * ext/pango/gsttextrender.c: (gst_text_render_class_init): * ext/theora/theoradec.c: (gst_theora_dec_class_init): * ext/theora/theoraenc.c: (gst_theora_enc_class_init): * ext/theora/theoraparse.c: (gst_theora_parse_class_init): * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_class_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (gst_audio_filter_template_class_init): * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_class_init): * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_class_init): * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_class_init): * gst/audiorate/gstaudiorate.c: (gst_audio_rate_class_init): * gst/audioresample/gstaudioresample.c: (gst_audioresample_class_init): * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audio_test_src_class_init): * gst/gdp/gstgdppay.c: (gst_gdp_pay_class_init): * gst/playback/gstdecodebin2.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (preroll_unlinked): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gstplaybin2.c: (gst_play_bin_class_init): * gst/playback/gstplaysink.c: (gst_play_sink_class_init): * gst/playback/gstqueue2.c: (gst_queue_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_selector_pad_class_init), (gst_stream_selector_class_init): * gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * gst/tcp/gsttcpclientsrc.c: (gst_tcp_client_src_class_init): * gst/tcp/gsttcpserversink.c: (gst_tcp_server_sink_class_init): * gst/tcp/gsttcpserversrc.c: (gst_tcp_server_src_class_init): * gst/videorate/gstvideorate.c: (gst_video_rate_class_init): * gst/videoscale/gstvideoscale.c: (gst_video_scale_class_init): * gst/videotestsrc/gstvideotestsrc.c: (gst_video_test_src_class_init): * gst/volume/gstvolume.c: (gst_volume_class_init): * sys/v4l/gstv4lelement.c: (gst_v4lelement_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory usage, fewer allocations and thus less memory defragmentation. Depend on core CVS for this. Fixes bug #523806.
2008-03-22 15:00:53 +00:00
"The payload type of the packets", 0, 0x80, DEFAULT_PT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SSRC,
g_param_spec_uint ("ssrc", "SSRC",
Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory u... Original commit message from CVS: * configure.ac: * ext/alsa/gstalsamixerelement.c: (gst_alsa_mixer_element_class_init): * ext/alsa/gstalsasink.c: (gst_alsasink_class_init): * ext/alsa/gstalsasrc.c: (gst_alsasrc_class_init): * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_src_class_init): * ext/gio/gstgiosink.c: (gst_gio_sink_class_init): * ext/gio/gstgiosrc.c: (gst_gio_src_class_init): * ext/gio/gstgiostreamsink.c: (gst_gio_stream_sink_class_init): * ext/gio/gstgiostreamsrc.c: (gst_gio_stream_src_class_init): * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_class_init): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/pango/gsttextoverlay.c: (gst_text_overlay_class_init): * ext/pango/gsttextrender.c: (gst_text_render_class_init): * ext/theora/theoradec.c: (gst_theora_dec_class_init): * ext/theora/theoraenc.c: (gst_theora_enc_class_init): * ext/theora/theoraparse.c: (gst_theora_parse_class_init): * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_class_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (gst_audio_filter_template_class_init): * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_class_init): * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_class_init): * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_class_init): * gst/audiorate/gstaudiorate.c: (gst_audio_rate_class_init): * gst/audioresample/gstaudioresample.c: (gst_audioresample_class_init): * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audio_test_src_class_init): * gst/gdp/gstgdppay.c: (gst_gdp_pay_class_init): * gst/playback/gstdecodebin2.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (preroll_unlinked): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gstplaybin2.c: (gst_play_bin_class_init): * gst/playback/gstplaysink.c: (gst_play_sink_class_init): * gst/playback/gstqueue2.c: (gst_queue_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_selector_pad_class_init), (gst_stream_selector_class_init): * gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * gst/tcp/gsttcpclientsrc.c: (gst_tcp_client_src_class_init): * gst/tcp/gsttcpserversink.c: (gst_tcp_server_sink_class_init): * gst/tcp/gsttcpserversrc.c: (gst_tcp_server_src_class_init): * gst/videorate/gstvideorate.c: (gst_video_rate_class_init): * gst/videoscale/gstvideoscale.c: (gst_video_scale_class_init): * gst/videotestsrc/gstvideotestsrc.c: (gst_video_test_src_class_init): * gst/volume/gstvolume.c: (gst_volume_class_init): * sys/v4l/gstv4lelement.c: (gst_v4lelement_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory usage, fewer allocations and thus less memory defragmentation. Depend on core CVS for this. Fixes bug #523806.
2008-03-22 15:00:53 +00:00
"The SSRC of the packets (default == random)", 0, G_MAXUINT32,
DEFAULT_SSRC, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass),
PROP_TIMESTAMP_OFFSET, g_param_spec_uint ("timestamp-offset",
"Timestamp Offset",
"Offset to add to all outgoing timestamps (default = random)", 0,
Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory u... Original commit message from CVS: * configure.ac: * ext/alsa/gstalsamixerelement.c: (gst_alsa_mixer_element_class_init): * ext/alsa/gstalsasink.c: (gst_alsasink_class_init): * ext/alsa/gstalsasrc.c: (gst_alsasrc_class_init): * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_src_class_init): * ext/gio/gstgiosink.c: (gst_gio_sink_class_init): * ext/gio/gstgiosrc.c: (gst_gio_src_class_init): * ext/gio/gstgiostreamsink.c: (gst_gio_stream_sink_class_init): * ext/gio/gstgiostreamsrc.c: (gst_gio_stream_src_class_init): * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_class_init): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/pango/gsttextoverlay.c: (gst_text_overlay_class_init): * ext/pango/gsttextrender.c: (gst_text_render_class_init): * ext/theora/theoradec.c: (gst_theora_dec_class_init): * ext/theora/theoraenc.c: (gst_theora_enc_class_init): * ext/theora/theoraparse.c: (gst_theora_parse_class_init): * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_class_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (gst_audio_filter_template_class_init): * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_class_init): * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_class_init): * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_class_init): * gst/audiorate/gstaudiorate.c: (gst_audio_rate_class_init): * gst/audioresample/gstaudioresample.c: (gst_audioresample_class_init): * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audio_test_src_class_init): * gst/gdp/gstgdppay.c: (gst_gdp_pay_class_init): * gst/playback/gstdecodebin2.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (preroll_unlinked): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gstplaybin2.c: (gst_play_bin_class_init): * gst/playback/gstplaysink.c: (gst_play_sink_class_init): * gst/playback/gstqueue2.c: (gst_queue_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_selector_pad_class_init), (gst_stream_selector_class_init): * gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * gst/tcp/gsttcpclientsrc.c: (gst_tcp_client_src_class_init): * gst/tcp/gsttcpserversink.c: (gst_tcp_server_sink_class_init): * gst/tcp/gsttcpserversrc.c: (gst_tcp_server_src_class_init): * gst/videorate/gstvideorate.c: (gst_video_rate_class_init): * gst/videoscale/gstvideoscale.c: (gst_video_scale_class_init): * gst/videotestsrc/gstvideotestsrc.c: (gst_video_test_src_class_init): * gst/volume/gstvolume.c: (gst_volume_class_init): * sys/v4l/gstv4lelement.c: (gst_v4lelement_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory usage, fewer allocations and thus less memory defragmentation. Depend on core CVS for this. Fixes bug #523806.
2008-03-22 15:00:53 +00:00
G_MAXUINT32, DEFAULT_TIMESTAMP_OFFSET,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEQNUM_OFFSET,
g_param_spec_int ("seqnum-offset", "Sequence number Offset",
"Offset to add to all outgoing seqnum (-1 = random)", -1, G_MAXUINT16,
Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory u... Original commit message from CVS: * configure.ac: * ext/alsa/gstalsamixerelement.c: (gst_alsa_mixer_element_class_init): * ext/alsa/gstalsasink.c: (gst_alsasink_class_init): * ext/alsa/gstalsasrc.c: (gst_alsasrc_class_init): * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_src_class_init): * ext/gio/gstgiosink.c: (gst_gio_sink_class_init): * ext/gio/gstgiosrc.c: (gst_gio_src_class_init): * ext/gio/gstgiostreamsink.c: (gst_gio_stream_sink_class_init): * ext/gio/gstgiostreamsrc.c: (gst_gio_stream_src_class_init): * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_class_init): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/pango/gsttextoverlay.c: (gst_text_overlay_class_init): * ext/pango/gsttextrender.c: (gst_text_render_class_init): * ext/theora/theoradec.c: (gst_theora_dec_class_init): * ext/theora/theoraenc.c: (gst_theora_enc_class_init): * ext/theora/theoraparse.c: (gst_theora_parse_class_init): * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_class_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (gst_audio_filter_template_class_init): * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_class_init): * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_class_init): * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_class_init): * gst/audiorate/gstaudiorate.c: (gst_audio_rate_class_init): * gst/audioresample/gstaudioresample.c: (gst_audioresample_class_init): * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audio_test_src_class_init): * gst/gdp/gstgdppay.c: (gst_gdp_pay_class_init): * gst/playback/gstdecodebin2.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (preroll_unlinked): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gstplaybin2.c: (gst_play_bin_class_init): * gst/playback/gstplaysink.c: (gst_play_sink_class_init): * gst/playback/gstqueue2.c: (gst_queue_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_selector_pad_class_init), (gst_stream_selector_class_init): * gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * gst/tcp/gsttcpclientsrc.c: (gst_tcp_client_src_class_init): * gst/tcp/gsttcpserversink.c: (gst_tcp_server_sink_class_init): * gst/tcp/gsttcpserversrc.c: (gst_tcp_server_src_class_init): * gst/videorate/gstvideorate.c: (gst_video_rate_class_init): * gst/videoscale/gstvideoscale.c: (gst_video_scale_class_init): * gst/videotestsrc/gstvideotestsrc.c: (gst_video_test_src_class_init): * gst/volume/gstvolume.c: (gst_volume_class_init): * sys/v4l/gstv4lelement.c: (gst_v4lelement_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory usage, fewer allocations and thus less memory defragmentation. Depend on core CVS for this. Fixes bug #523806.
2008-03-22 15:00:53 +00:00
DEFAULT_SEQNUM_OFFSET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MAX_PTIME,
g_param_spec_int64 ("max-ptime", "Max packet time",
"Maximum duration of the packet data in ns (-1 = unlimited up to MTU)",
Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory u... Original commit message from CVS: * configure.ac: * ext/alsa/gstalsamixerelement.c: (gst_alsa_mixer_element_class_init): * ext/alsa/gstalsasink.c: (gst_alsasink_class_init): * ext/alsa/gstalsasrc.c: (gst_alsasrc_class_init): * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_src_class_init): * ext/gio/gstgiosink.c: (gst_gio_sink_class_init): * ext/gio/gstgiosrc.c: (gst_gio_src_class_init): * ext/gio/gstgiostreamsink.c: (gst_gio_stream_sink_class_init): * ext/gio/gstgiostreamsrc.c: (gst_gio_stream_src_class_init): * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_class_init): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/pango/gsttextoverlay.c: (gst_text_overlay_class_init): * ext/pango/gsttextrender.c: (gst_text_render_class_init): * ext/theora/theoradec.c: (gst_theora_dec_class_init): * ext/theora/theoraenc.c: (gst_theora_enc_class_init): * ext/theora/theoraparse.c: (gst_theora_parse_class_init): * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_class_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (gst_audio_filter_template_class_init): * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_class_init): * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_class_init): * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_class_init): * gst/audiorate/gstaudiorate.c: (gst_audio_rate_class_init): * gst/audioresample/gstaudioresample.c: (gst_audioresample_class_init): * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audio_test_src_class_init): * gst/gdp/gstgdppay.c: (gst_gdp_pay_class_init): * gst/playback/gstdecodebin2.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (preroll_unlinked): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gstplaybin2.c: (gst_play_bin_class_init): * gst/playback/gstplaysink.c: (gst_play_sink_class_init): * gst/playback/gstqueue2.c: (gst_queue_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_selector_pad_class_init), (gst_stream_selector_class_init): * gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * gst/tcp/gsttcpclientsrc.c: (gst_tcp_client_src_class_init): * gst/tcp/gsttcpserversink.c: (gst_tcp_server_sink_class_init): * gst/tcp/gsttcpserversrc.c: (gst_tcp_server_src_class_init): * gst/videorate/gstvideorate.c: (gst_video_rate_class_init): * gst/videoscale/gstvideoscale.c: (gst_video_scale_class_init): * gst/videotestsrc/gstvideotestsrc.c: (gst_video_test_src_class_init): * gst/volume/gstvolume.c: (gst_volume_class_init): * sys/v4l/gstv4lelement.c: (gst_v4lelement_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory usage, fewer allocations and thus less memory defragmentation. Depend on core CVS for this. Fixes bug #523806.
2008-03-22 15:00:53 +00:00
-1, G_MAXINT64, DEFAULT_MAX_PTIME,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
2011-11-11 11:24:08 +00:00
* GstRTPBaseAudioPayload:min-ptime:
*
* Minimum duration of the packet data in ns (can't go above MTU)
*
* Since: 0.10.13
**/
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MIN_PTIME,
g_param_spec_int64 ("min-ptime", "Min packet time",
"Minimum duration of the packet data in ns (can't go above MTU)",
Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory u... Original commit message from CVS: * configure.ac: * ext/alsa/gstalsamixerelement.c: (gst_alsa_mixer_element_class_init): * ext/alsa/gstalsasink.c: (gst_alsasink_class_init): * ext/alsa/gstalsasrc.c: (gst_alsasrc_class_init): * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_src_class_init): * ext/gio/gstgiosink.c: (gst_gio_sink_class_init): * ext/gio/gstgiosrc.c: (gst_gio_src_class_init): * ext/gio/gstgiostreamsink.c: (gst_gio_stream_sink_class_init): * ext/gio/gstgiostreamsrc.c: (gst_gio_stream_src_class_init): * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_class_init): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/pango/gsttextoverlay.c: (gst_text_overlay_class_init): * ext/pango/gsttextrender.c: (gst_text_render_class_init): * ext/theora/theoradec.c: (gst_theora_dec_class_init): * ext/theora/theoraenc.c: (gst_theora_enc_class_init): * ext/theora/theoraparse.c: (gst_theora_parse_class_init): * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_class_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (gst_audio_filter_template_class_init): * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_class_init): * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_class_init): * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_class_init): * gst/audiorate/gstaudiorate.c: (gst_audio_rate_class_init): * gst/audioresample/gstaudioresample.c: (gst_audioresample_class_init): * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audio_test_src_class_init): * gst/gdp/gstgdppay.c: (gst_gdp_pay_class_init): * gst/playback/gstdecodebin2.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (preroll_unlinked): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gstplaybin2.c: (gst_play_bin_class_init): * gst/playback/gstplaysink.c: (gst_play_sink_class_init): * gst/playback/gstqueue2.c: (gst_queue_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_selector_pad_class_init), (gst_stream_selector_class_init): * gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * gst/tcp/gsttcpclientsrc.c: (gst_tcp_client_src_class_init): * gst/tcp/gsttcpserversink.c: (gst_tcp_server_sink_class_init): * gst/tcp/gsttcpserversrc.c: (gst_tcp_server_src_class_init): * gst/videorate/gstvideorate.c: (gst_video_rate_class_init): * gst/videoscale/gstvideoscale.c: (gst_video_scale_class_init): * gst/videotestsrc/gstvideotestsrc.c: (gst_video_test_src_class_init): * gst/volume/gstvolume.c: (gst_volume_class_init): * sys/v4l/gstv4lelement.c: (gst_v4lelement_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory usage, fewer allocations and thus less memory defragmentation. Depend on core CVS for this. Fixes bug #523806.
2008-03-22 15:00:53 +00:00
0, G_MAXINT64, DEFAULT_MIN_PTIME,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TIMESTAMP,
g_param_spec_uint ("timestamp", "Timestamp",
"The RTP timestamp of the last processed packet",
Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory u... Original commit message from CVS: * configure.ac: * ext/alsa/gstalsamixerelement.c: (gst_alsa_mixer_element_class_init): * ext/alsa/gstalsasink.c: (gst_alsasink_class_init): * ext/alsa/gstalsasrc.c: (gst_alsasrc_class_init): * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_src_class_init): * ext/gio/gstgiosink.c: (gst_gio_sink_class_init): * ext/gio/gstgiosrc.c: (gst_gio_src_class_init): * ext/gio/gstgiostreamsink.c: (gst_gio_stream_sink_class_init): * ext/gio/gstgiostreamsrc.c: (gst_gio_stream_src_class_init): * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_class_init): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/pango/gsttextoverlay.c: (gst_text_overlay_class_init): * ext/pango/gsttextrender.c: (gst_text_render_class_init): * ext/theora/theoradec.c: (gst_theora_dec_class_init): * ext/theora/theoraenc.c: (gst_theora_enc_class_init): * ext/theora/theoraparse.c: (gst_theora_parse_class_init): * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_class_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (gst_audio_filter_template_class_init): * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_class_init): * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_class_init): * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_class_init): * gst/audiorate/gstaudiorate.c: (gst_audio_rate_class_init): * gst/audioresample/gstaudioresample.c: (gst_audioresample_class_init): * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audio_test_src_class_init): * gst/gdp/gstgdppay.c: (gst_gdp_pay_class_init): * gst/playback/gstdecodebin2.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (preroll_unlinked): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gstplaybin2.c: (gst_play_bin_class_init): * gst/playback/gstplaysink.c: (gst_play_sink_class_init): * gst/playback/gstqueue2.c: (gst_queue_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_selector_pad_class_init), (gst_stream_selector_class_init): * gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * gst/tcp/gsttcpclientsrc.c: (gst_tcp_client_src_class_init): * gst/tcp/gsttcpserversink.c: (gst_tcp_server_sink_class_init): * gst/tcp/gsttcpserversrc.c: (gst_tcp_server_src_class_init): * gst/videorate/gstvideorate.c: (gst_video_rate_class_init): * gst/videoscale/gstvideoscale.c: (gst_video_scale_class_init): * gst/videotestsrc/gstvideotestsrc.c: (gst_video_test_src_class_init): * gst/volume/gstvolume.c: (gst_volume_class_init): * sys/v4l/gstv4lelement.c: (gst_v4lelement_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory usage, fewer allocations and thus less memory defragmentation. Depend on core CVS for this. Fixes bug #523806.
2008-03-22 15:00:53 +00:00
0, G_MAXUINT32, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEQNUM,
g_param_spec_uint ("seqnum", "Sequence number",
"The RTP sequence number of the last processed packet",
Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory u... Original commit message from CVS: * configure.ac: * ext/alsa/gstalsamixerelement.c: (gst_alsa_mixer_element_class_init): * ext/alsa/gstalsasink.c: (gst_alsasink_class_init): * ext/alsa/gstalsasrc.c: (gst_alsasrc_class_init): * ext/cdparanoia/gstcdparanoiasrc.c: (gst_cd_paranoia_src_class_init): * ext/gio/gstgiosink.c: (gst_gio_sink_class_init): * ext/gio/gstgiosrc.c: (gst_gio_src_class_init): * ext/gio/gstgiostreamsink.c: (gst_gio_stream_sink_class_init): * ext/gio/gstgiostreamsrc.c: (gst_gio_stream_src_class_init): * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_class_init): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init): * ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init): * ext/pango/gsttextoverlay.c: (gst_text_overlay_class_init): * ext/pango/gsttextrender.c: (gst_text_render_class_init): * ext/theora/theoradec.c: (gst_theora_dec_class_init): * ext/theora/theoraenc.c: (gst_theora_enc_class_init): * ext/theora/theoraparse.c: (gst_theora_parse_class_init): * ext/vorbis/vorbisenc.c: (gst_vorbis_enc_class_init): * gst-libs/gst/audio/gstaudiofiltertemplate.c: (gst_audio_filter_template_class_init): * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_class_init): * gst-libs/gst/audio/gstbaseaudiosrc.c: (gst_base_audio_src_class_init): * gst-libs/gst/cdda/gstcddabasesrc.c: (gst_cdda_base_src_class_init): * gst-libs/gst/interfaces/mixertrack.c: (gst_mixer_track_class_init): * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_class_init): * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_class_init): * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_class_init): * gst/audiorate/gstaudiorate.c: (gst_audio_rate_class_init): * gst/audioresample/gstaudioresample.c: (gst_audioresample_class_init): * gst/audiotestsrc/gstaudiotestsrc.c: (gst_audio_test_src_class_init): * gst/gdp/gstgdppay.c: (gst_gdp_pay_class_init): * gst/playback/gstdecodebin2.c: (gst_decode_bin_class_init): * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), (preroll_unlinked): * gst/playback/gstplaybin.c: (gst_play_bin_class_init): * gst/playback/gstplaybin2.c: (gst_play_bin_class_init): * gst/playback/gstplaysink.c: (gst_play_sink_class_init): * gst/playback/gstqueue2.c: (gst_queue_class_init): * gst/playback/gststreaminfo.c: (gst_stream_info_class_init): * gst/playback/gststreamselector.c: (gst_selector_pad_class_init), (gst_stream_selector_class_init): * gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init): * gst/subparse/gstsubparse.c: (gst_sub_parse_class_init): * gst/tcp/gstmultifdsink.c: (gst_multi_fd_sink_class_init): * gst/tcp/gsttcpclientsink.c: (gst_tcp_client_sink_class_init): * gst/tcp/gsttcpclientsrc.c: (gst_tcp_client_src_class_init): * gst/tcp/gsttcpserversink.c: (gst_tcp_server_sink_class_init): * gst/tcp/gsttcpserversrc.c: (gst_tcp_server_src_class_init): * gst/videorate/gstvideorate.c: (gst_video_rate_class_init): * gst/videoscale/gstvideoscale.c: (gst_video_scale_class_init): * gst/videotestsrc/gstvideotestsrc.c: (gst_video_test_src_class_init): * gst/volume/gstvolume.c: (gst_volume_class_init): * sys/v4l/gstv4lelement.c: (gst_v4lelement_class_init): * sys/v4l/gstv4lmjpegsink.c: (gst_v4lmjpegsink_class_init): * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init): * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_class_init): * sys/ximage/ximagesink.c: (gst_ximagesink_class_init): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_class_init): Use G_PARAM_STATIC_STRINGS everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory usage, fewer allocations and thus less memory defragmentation. Depend on core CVS for this. Fixes bug #523806.
2008-03-22 15:00:53 +00:00
0, G_MAXUINT16, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
2011-11-11 11:24:08 +00:00
* GstRTPBaseAudioPayload:perfect-rtptime:
*
* Try to use the offset fields to generate perfect RTP timestamps. when this
* option is disabled, RTP timestamps are generated from the GStreamer
* timestamps, which could result in RTP timestamps that don't increment with
* the amount of data in the packet.
*
* Since: 0.10.25
*/
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PERFECT_RTPTIME,
g_param_spec_boolean ("perfect-rtptime", "Perfect RTP Time",
"Generate perfect RTP timestamps when possible",
DEFAULT_PERFECT_RTPTIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
2011-11-11 11:24:08 +00:00
* GstRTPBaseAudioPayload:ptime-multiple:
*
* Force buffers to be multiples of this duration in ns (0 disables)
*
* Since: 0.10.29
**/
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PTIME_MULTIPLE,
g_param_spec_int64 ("ptime-multiple", "Packet time multiple",
"Force buffers to be multiples of this duration in ns (0 disables)",
0, G_MAXINT64, DEFAULT_PTIME_MULTIPLE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2011-11-11 11:24:08 +00:00
gstelement_class->change_state = gst_rtp_base_payload_change_state;
2011-11-11 11:24:08 +00:00
klass->get_caps = gst_rtp_base_payload_getcaps_default;
klass->handle_event = gst_rtp_base_payload_event_default;
2011-11-11 11:32:23 +00:00
GST_DEBUG_CATEGORY_INIT (rtpbasepayload_debug, "rtpbasepayload", 0,
"Base class for RTP Payloaders");
}
static void
2011-11-11 11:32:23 +00:00
gst_rtp_base_payload_init (GstRTPBasePayload * rtpbasepayload, gpointer g_class)
{
GstPadTemplate *templ;
2011-11-11 11:24:08 +00:00
GstRTPBasePayloadPrivate *priv;
2011-11-11 11:32:23 +00:00
rtpbasepayload->priv = priv =
GST_RTP_BASE_PAYLOAD_GET_PRIVATE (rtpbasepayload);
templ =
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "src");
g_return_if_fail (templ != NULL);
2011-11-11 11:32:23 +00:00
rtpbasepayload->srcpad = gst_pad_new_from_template (templ, "src");
gst_element_add_pad (GST_ELEMENT (rtpbasepayload), rtpbasepayload->srcpad);
templ =
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "sink");
g_return_if_fail (templ != NULL);
2011-11-11 11:32:23 +00:00
rtpbasepayload->sinkpad = gst_pad_new_from_template (templ, "sink");
gst_pad_set_getcaps_function (rtpbasepayload->sinkpad,
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_sink_getcaps);
2011-11-11 11:32:23 +00:00
gst_pad_set_event_function (rtpbasepayload->sinkpad,
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_event);
2011-11-11 11:32:23 +00:00
gst_pad_set_chain_function (rtpbasepayload->sinkpad,
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_chain);
2011-11-11 11:32:23 +00:00
gst_element_add_pad (GST_ELEMENT (rtpbasepayload), rtpbasepayload->sinkpad);
rtpbasepayload->mtu = DEFAULT_MTU;
rtpbasepayload->pt = DEFAULT_PT;
rtpbasepayload->seqnum_offset = DEFAULT_SEQNUM_OFFSET;
rtpbasepayload->ssrc = DEFAULT_SSRC;
rtpbasepayload->ts_offset = DEFAULT_TIMESTAMP_OFFSET;
priv->seqnum_offset_random = (rtpbasepayload->seqnum_offset == -1);
priv->ts_offset_random = (rtpbasepayload->ts_offset == -1);
priv->ssrc_random = (rtpbasepayload->ssrc == -1);
rtpbasepayload->max_ptime = DEFAULT_MAX_PTIME;
rtpbasepayload->min_ptime = DEFAULT_MIN_PTIME;
rtpbasepayload->priv->perfect_rtptime = DEFAULT_PERFECT_RTPTIME;
rtpbasepayload->ptime_multiple = DEFAULT_PTIME_MULTIPLE;
2011-11-11 11:32:23 +00:00
rtpbasepayload->priv->base_offset = GST_BUFFER_OFFSET_NONE;
rtpbasepayload->priv->base_rtime = GST_BUFFER_OFFSET_NONE;
rtpbasepayload->media = NULL;
rtpbasepayload->encoding_name = NULL;
rtpbasepayload->clock_rate = 0;
rtpbasepayload->priv->caps_max_ptime = DEFAULT_MAX_PTIME;
rtpbasepayload->priv->prop_max_ptime = DEFAULT_MAX_PTIME;
}
static void
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_finalize (GObject * object)
{
2011-11-11 11:32:23 +00:00
GstRTPBasePayload *rtpbasepayload;
2011-11-11 11:32:23 +00:00
rtpbasepayload = GST_RTP_BASE_PAYLOAD (object);
2011-11-11 11:32:23 +00:00
g_free (rtpbasepayload->media);
rtpbasepayload->media = NULL;
g_free (rtpbasepayload->encoding_name);
rtpbasepayload->encoding_name = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GstCaps *
2011-11-11 11:32:23 +00:00
gst_rtp_base_payload_getcaps_default (GstRTPBasePayload * rtpbasepayload,
GstPad * pad, GstCaps * filter)
{
GstCaps *caps;
caps = GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (pad));
GST_DEBUG_OBJECT (pad,
"using pad template %p with caps %p %" GST_PTR_FORMAT,
GST_PAD_PAD_TEMPLATE (pad), caps, caps);
if (filter)
caps = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
else
caps = gst_caps_ref (caps);
return caps;
}
static GstCaps *
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_sink_getcaps (GstPad * pad, GstCaps * filter)
{
2011-11-11 11:32:23 +00:00
GstRTPBasePayload *rtpbasepayload;
GstRTPBasePayloadClass *rtpbasepayload_class;
GstCaps *caps = NULL;
GST_DEBUG_OBJECT (pad, "getting caps");
2011-11-11 11:32:23 +00:00
rtpbasepayload = GST_RTP_BASE_PAYLOAD (gst_pad_get_parent (pad));
rtpbasepayload_class = GST_RTP_BASE_PAYLOAD_GET_CLASS (rtpbasepayload);
2011-11-11 11:32:23 +00:00
if (rtpbasepayload_class->get_caps)
caps = rtpbasepayload_class->get_caps (rtpbasepayload, pad, filter);
2011-11-11 11:32:23 +00:00
gst_object_unref (rtpbasepayload);
return caps;
}
static gboolean
2011-11-11 11:32:23 +00:00
gst_rtp_base_payload_event_default (GstRTPBasePayload * rtpbasepayload,
GstEvent * event)
{
gboolean res = FALSE;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_START:
2011-11-11 11:32:23 +00:00
res = gst_pad_event_default (rtpbasepayload->sinkpad, event);
break;
case GST_EVENT_FLUSH_STOP:
2011-11-11 11:32:23 +00:00
res = gst_pad_event_default (rtpbasepayload->sinkpad, event);
gst_segment_init (&rtpbasepayload->segment, GST_FORMAT_UNDEFINED);
break;
case GST_EVENT_CAPS:
{
2011-11-11 11:32:23 +00:00
GstRTPBasePayloadClass *rtpbasepayload_class;
GstCaps *caps;
gst_event_parse_caps (event, &caps);
2011-11-11 11:32:23 +00:00
GST_DEBUG_OBJECT (rtpbasepayload, "setting caps %" GST_PTR_FORMAT, caps);
2011-11-11 11:32:23 +00:00
rtpbasepayload_class = GST_RTP_BASE_PAYLOAD_GET_CLASS (rtpbasepayload);
if (rtpbasepayload_class->set_caps)
res = rtpbasepayload_class->set_caps (rtpbasepayload, caps);
2011-06-07 10:06:22 +00:00
gst_event_unref (event);
break;
}
2011-05-16 11:48:11 +00:00
case GST_EVENT_SEGMENT:
{
GstSegment *segment;
2011-11-11 11:32:23 +00:00
segment = &rtpbasepayload->segment;
gst_event_copy_segment (event, segment);
2011-11-11 11:32:23 +00:00
rtpbasepayload->priv->base_offset = GST_BUFFER_OFFSET_NONE;
2011-11-11 11:32:23 +00:00
GST_DEBUG_OBJECT (rtpbasepayload,
2011-05-16 11:48:11 +00:00
"configured SEGMENT %" GST_SEGMENT_FORMAT, segment);
2011-11-11 11:32:23 +00:00
res = gst_pad_event_default (rtpbasepayload->sinkpad, event);
break;
}
default:
2011-11-11 11:32:23 +00:00
res = gst_pad_event_default (rtpbasepayload->sinkpad, event);
break;
}
return res;
}
static gboolean
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_event (GstPad * pad, GstEvent * event)
{
2011-11-11 11:32:23 +00:00
GstRTPBasePayload *rtpbasepayload;
GstRTPBasePayloadClass *rtpbasepayload_class;
gboolean res = FALSE;
2011-11-11 11:32:23 +00:00
rtpbasepayload = GST_RTP_BASE_PAYLOAD (gst_pad_get_parent (pad));
if (G_UNLIKELY (rtpbasepayload == NULL)) {
gst_event_unref (event);
return FALSE;
}
2011-11-11 11:32:23 +00:00
rtpbasepayload_class = GST_RTP_BASE_PAYLOAD_GET_CLASS (rtpbasepayload);
2011-11-11 11:32:23 +00:00
if (rtpbasepayload_class->handle_event)
res = rtpbasepayload_class->handle_event (rtpbasepayload, event);
else
gst_event_unref (event);
2011-11-11 11:32:23 +00:00
gst_object_unref (rtpbasepayload);
return res;
}
static GstFlowReturn
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_chain (GstPad * pad, GstBuffer * buffer)
{
2011-11-11 11:32:23 +00:00
GstRTPBasePayload *rtpbasepayload;
GstRTPBasePayloadClass *rtpbasepayload_class;
GstFlowReturn ret;
2011-11-11 11:32:23 +00:00
rtpbasepayload = GST_RTP_BASE_PAYLOAD (gst_pad_get_parent (pad));
rtpbasepayload_class = GST_RTP_BASE_PAYLOAD_GET_CLASS (rtpbasepayload);
2011-11-11 11:32:23 +00:00
if (!rtpbasepayload_class->handle_buffer)
goto no_function;
2011-11-11 11:32:23 +00:00
ret = rtpbasepayload_class->handle_buffer (rtpbasepayload, buffer);
2011-11-11 11:32:23 +00:00
gst_object_unref (rtpbasepayload);
return ret;
/* ERRORS */
no_function:
{
2011-11-11 11:32:23 +00:00
GST_ELEMENT_ERROR (rtpbasepayload, STREAM, NOT_IMPLEMENTED, (NULL),
("subclass did not implement handle_buffer function"));
2011-11-11 11:32:23 +00:00
gst_object_unref (rtpbasepayload);
gst_buffer_unref (buffer);
return GST_FLOW_ERROR;
}
}
/**
2011-11-11 11:24:08 +00:00
* gst_rtp_base_payload_set_options:
* @payload: a #GstRTPBasePayload
* @media: the media type (typically "audio" or "video")
* @dynamic: if the payload type is dynamic
* @encoding_name: the encoding name
* @clock_rate: the clock rate of the media
*
* Set the rtp options of the payloader. These options will be set in the caps
* of the payloader. Subclasses must call this method before calling
2011-11-11 11:24:08 +00:00
* gst_rtp_base_payload_push() or gst_rtp_base_payload_set_outcaps().
*/
void
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_set_options (GstRTPBasePayload * payload,
const gchar * media, gboolean dynamic, const gchar * encoding_name,
guint32 clock_rate)
{
g_return_if_fail (payload != NULL);
g_return_if_fail (clock_rate != 0);
g_free (payload->media);
payload->media = g_strdup (media);
payload->dynamic = dynamic;
g_free (payload->encoding_name);
payload->encoding_name = g_strdup (encoding_name);
payload->clock_rate = clock_rate;
}
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static... Original commit message from CVS: * ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_get_type): * ext/alsa/gstalsasink.c: (set_hwparams): * ext/alsa/gstalsasrc.c: (set_hwparams): * ext/gio/gstgio.c: (gst_gio_uri_handler_get_uri): * ext/ogg/gstoggmux.h: * ext/ogg/gstogmparse.c: * gst-libs/gst/audio/audio.c: * gst-libs/gst/fft/kiss_fft_f64.c: (kiss_fft_f64_alloc): * gst-libs/gst/pbutils/missing-plugins.c: (gst_missing_uri_sink_message_new), (gst_missing_element_message_new), (gst_missing_decoder_message_new), (gst_missing_encoder_message_new): * gst-libs/gst/rtp/gstbasertppayload.c: * gst-libs/gst/rtp/gstrtcpbuffer.c: (gst_rtcp_packet_bye_get_reason): * gst/audioconvert/gstaudioconvert.c: * gst/audioresample/gstaudioresample.c: * gst/ffmpegcolorspace/imgconvert.c: * gst/playback/test.c: (gen_video_element), (gen_audio_element): * gst/typefind/gsttypefindfunctions.c: * gst/videoscale/vs_4tap.c: * gst/videoscale/vs_4tap.h: * sys/v4l/gstv4lelement.c: * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_get_any_caps): * sys/v4l/v4l_calls.c: * sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_capture_init), (gst_v4lsrc_try_capture): * sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls), (gst_ximagesink_ximage_new): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls), (gst_xvimagesink_xvimage_new): * tests/check/elements/audioconvert.c: * tests/check/elements/audioresample.c: (fail_unless_perfect_stream): * tests/check/elements/audiotestsrc.c: (setup_audiotestsrc): * tests/check/elements/decodebin.c: * tests/check/elements/gdpdepay.c: (setup_gdpdepay), (setup_gdpdepay_streamheader): * tests/check/elements/gdppay.c: (setup_gdppay), (GST_START_TEST), (setup_gdppay_streamheader): * tests/check/elements/gnomevfssink.c: (setup_gnomevfssink): * tests/check/elements/multifdsink.c: (setup_multifdsink): * tests/check/elements/textoverlay.c: * tests/check/elements/videorate.c: (setup_videorate): * tests/check/elements/videotestsrc.c: (setup_videotestsrc): * tests/check/elements/volume.c: (setup_volume): * tests/check/elements/vorbisdec.c: (setup_vorbisdec): * tests/check/elements/vorbistag.c: * tests/check/generic/clock-selection.c: * tests/check/generic/states.c: (setup), (teardown): * tests/check/libs/cddabasesrc.c: * tests/check/libs/video.c: * tests/check/pipelines/gio.c: * tests/check/pipelines/oggmux.c: * tests/check/pipelines/simple-launch-lines.c: (simple_launch_lines_suite): * tests/check/pipelines/streamheader.c: * tests/check/pipelines/theoraenc.c: * tests/check/pipelines/vorbisdec.c: * tests/check/pipelines/vorbisenc.c: * tests/examples/seek/scrubby.c: * tests/examples/seek/seek.c: (query_positions_elems), (query_positions_pads): * tests/icles/stress-xoverlay.c: (myclock): Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static, using NULL instead of 0 for pointers and using "foo (void)" instead of "foo ()" for declarations. * win32/common/libgstrtp.def: Add gst_rtp_buffer_set_extension_data to the symbol definition file.
2008-03-03 06:04:31 +00:00
static gboolean
copy_fixed (GQuark field_id, const GValue * value, GstStructure * dest)
{
if (gst_value_is_fixed (value)) {
gst_structure_id_set_value (dest, field_id, value);
}
return TRUE;
}
static void
2011-11-11 11:32:23 +00:00
update_max_ptime (GstRTPBasePayload * rtpbasepayload)
{
2011-11-11 11:32:23 +00:00
if (rtpbasepayload->priv->caps_max_ptime != -1 &&
rtpbasepayload->priv->prop_max_ptime != -1)
rtpbasepayload->max_ptime = MIN (rtpbasepayload->priv->caps_max_ptime,
rtpbasepayload->priv->prop_max_ptime);
else if (rtpbasepayload->priv->caps_max_ptime != -1)
rtpbasepayload->max_ptime = rtpbasepayload->priv->caps_max_ptime;
else if (rtpbasepayload->priv->prop_max_ptime != -1)
rtpbasepayload->max_ptime = rtpbasepayload->priv->prop_max_ptime;
else
2011-11-11 11:32:23 +00:00
rtpbasepayload->max_ptime = DEFAULT_MAX_PTIME;
}
/**
2011-11-11 11:24:08 +00:00
* gst_rtp_base_payload_set_outcaps:
* @payload: a #GstRTPBasePayload
* @fieldname: the first field name or %NULL
* @...: field values
*
* Configure the output caps with the optional parameters.
*
* Variable arguments should be in the form field name, field type
* (as a GType), value(s). The last variable argument should be NULL.
*
* Returns: %TRUE if the caps could be set.
*/
gboolean
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_set_outcaps (GstRTPBasePayload * payload,
const gchar * fieldname, ...)
{
GstCaps *srccaps, *peercaps;
gboolean res;
2009-04-27 08:15:44 +00:00
/* fill in the defaults, their properties cannot be negotiated. */
srccaps = gst_caps_new_simple ("application/x-rtp",
"media", G_TYPE_STRING, payload->media,
"clock-rate", G_TYPE_INT, payload->clock_rate,
"encoding-name", G_TYPE_STRING, payload->encoding_name, NULL);
GST_DEBUG_OBJECT (payload, "defaults: %" GST_PTR_FORMAT, srccaps);
if (fieldname) {
va_list varargs;
/* override with custom properties */
va_start (varargs, fieldname);
gst_caps_set_simple_valist (srccaps, fieldname, varargs);
va_end (varargs);
GST_DEBUG_OBJECT (payload, "custom added: %" GST_PTR_FORMAT, srccaps);
}
payload->priv->caps_max_ptime = DEFAULT_MAX_PTIME;
payload->ptime = 0;
/* the peer caps can override some of the defaults */
peercaps = gst_pad_peer_get_caps (payload->srcpad, srccaps);
if (peercaps == NULL) {
/* no peer caps, just add the other properties */
gst_caps_set_simple (srccaps,
2011-11-11 11:24:08 +00:00
"payload", G_TYPE_INT, GST_RTP_BASE_PAYLOAD_PT (payload),
"ssrc", G_TYPE_UINT, payload->current_ssrc,
"timestamp-offset", G_TYPE_UINT, payload->ts_base,
"seqnum-offset", G_TYPE_UINT, payload->seqnum_base, NULL);
GST_DEBUG_OBJECT (payload, "no peer caps: %" GST_PTR_FORMAT, srccaps);
} else {
GstCaps *temp;
GstStructure *s, *d;
const GValue *value;
gint pt;
guint max_ptime, ptime;
/* peer provides caps we can use to fixate. They are already intersected
* with our srccaps, just make them writable */
temp = gst_caps_make_writable (peercaps);
gst_caps_unref (srccaps);
if (gst_caps_is_empty (temp)) {
gst_caps_unref (temp);
return FALSE;
}
/* now fixate, start by taking the first caps */
gst_caps_truncate (temp);
/* get first structure */
s = gst_caps_get_structure (temp, 0);
if (gst_structure_get_uint (s, "maxptime", &max_ptime))
payload->priv->caps_max_ptime = max_ptime * GST_MSECOND;
if (gst_structure_get_uint (s, "ptime", &ptime))
payload->ptime = ptime * GST_MSECOND;
if (gst_structure_get_int (s, "payload", &pt)) {
/* use peer pt */
2011-11-11 11:24:08 +00:00
GST_RTP_BASE_PAYLOAD_PT (payload) = pt;
GST_LOG_OBJECT (payload, "using peer pt %d", pt);
} else {
if (gst_structure_has_field (s, "payload")) {
/* can only fixate if there is a field */
gst_structure_fixate_field_nearest_int (s, "payload",
2011-11-11 11:24:08 +00:00
GST_RTP_BASE_PAYLOAD_PT (payload));
gst_structure_get_int (s, "payload", &pt);
GST_LOG_OBJECT (payload, "using peer pt %d", pt);
} else {
/* no pt field, use the internal pt */
2011-11-11 11:24:08 +00:00
pt = GST_RTP_BASE_PAYLOAD_PT (payload);
gst_structure_set (s, "payload", G_TYPE_INT, pt, NULL);
GST_LOG_OBJECT (payload, "using internal pt %d", pt);
}
}
if (gst_structure_has_field_typed (s, "ssrc", G_TYPE_UINT)) {
value = gst_structure_get_value (s, "ssrc");
payload->current_ssrc = g_value_get_uint (value);
GST_LOG_OBJECT (payload, "using peer ssrc %08x", payload->current_ssrc);
} else {
/* FIXME, fixate_nearest_uint would be even better */
gst_structure_set (s, "ssrc", G_TYPE_UINT, payload->current_ssrc, NULL);
GST_LOG_OBJECT (payload, "using internal ssrc %08x",
payload->current_ssrc);
}
if (gst_structure_has_field_typed (s, "timestamp-offset", G_TYPE_UINT)) {
value = gst_structure_get_value (s, "timestamp-offset");
payload->ts_base = g_value_get_uint (value);
GST_LOG_OBJECT (payload, "using peer timestamp-offset %u",
payload->ts_base);
} else {
/* FIXME, fixate_nearest_uint would be even better */
gst_structure_set (s, "timestamp-offset", G_TYPE_UINT, payload->ts_base,
NULL);
GST_LOG_OBJECT (payload, "using internal timestamp-offset %u",
payload->ts_base);
}
if (gst_structure_has_field_typed (s, "seqnum-offset", G_TYPE_UINT)) {
value = gst_structure_get_value (s, "seqnum-offset");
payload->seqnum_base = g_value_get_uint (value);
GST_LOG_OBJECT (payload, "using peer seqnum-offset %u",
payload->seqnum_base);
} else {
/* FIXME, fixate_nearest_uint would be even better */
gst_structure_set (s, "seqnum-offset", G_TYPE_UINT, payload->seqnum_base,
NULL);
GST_LOG_OBJECT (payload, "using internal seqnum-offset %u",
payload->seqnum_base);
}
/* make the target caps by copying over all the fixed caps, removing the
* unfixed caps. */
2011-10-27 15:26:58 +00:00
srccaps = gst_caps_new_empty_simple (gst_structure_get_name (s));
d = gst_caps_get_structure (srccaps, 0);
gst_structure_foreach (s, (GstStructureForeachFunc) copy_fixed, d);
gst_caps_unref (temp);
GST_DEBUG_OBJECT (payload, "with peer caps: %" GST_PTR_FORMAT, srccaps);
}
update_max_ptime (payload);
2011-11-11 11:24:08 +00:00
res = gst_pad_set_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload), srccaps);
gst_caps_unref (srccaps);
return res;
}
/**
2011-11-11 11:24:08 +00:00
* gst_rtp_base_payload_is_filled:
* @payload: a #GstRTPBasePayload
* @size: the size of the packet
* @duration: the duration of the packet
*
2009-06-11 10:39:19 +00:00
* Check if the packet with @size and @duration would exceed the configured
* maximum size.
*
* Returns: %TRUE if the packet of @size and @duration would exceed the
* configured MTU or max_ptime.
*/
gboolean
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_is_filled (GstRTPBasePayload * payload,
guint size, GstClockTime duration)
{
if (size > payload->mtu)
return TRUE;
if (payload->max_ptime != -1 && duration >= payload->max_ptime)
return TRUE;
return FALSE;
}
typedef struct
{
2011-11-11 11:24:08 +00:00
GstRTPBasePayload *payload;
guint32 ssrc;
guint16 seqnum;
guint8 pt;
GstClockTime timestamp;
guint64 offset;
guint32 rtptime;
} HeaderData;
2011-03-31 15:47:43 +00:00
static gboolean
find_timestamp (GstBuffer ** buffer, guint idx, HeaderData * data)
{
data->timestamp = GST_BUFFER_TIMESTAMP (*buffer);
data->offset = GST_BUFFER_OFFSET (*buffer);
2009-10-16 08:54:31 +00:00
/* stop when we find a timestamp. We take whatever offset is associated with
* the timestamp (if any) to do perfect timestamps when we need to. */
if (data->timestamp != -1)
2011-03-31 15:47:43 +00:00
return FALSE;
else
2011-03-31 15:47:43 +00:00
return TRUE;
}
2011-03-31 15:47:43 +00:00
static gboolean
set_headers (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
{
2011-03-27 11:55:15 +00:00
GstRTPBuffer rtp;
gst_rtp_buffer_map (*buffer, GST_MAP_WRITE, &rtp);
gst_rtp_buffer_set_ssrc (&rtp, data->ssrc);
gst_rtp_buffer_set_payload_type (&rtp, data->pt);
gst_rtp_buffer_set_seq (&rtp, data->seqnum);
gst_rtp_buffer_set_timestamp (&rtp, data->rtptime);
gst_rtp_buffer_unmap (&rtp);
/* increment the seqnum for each buffer */
data->seqnum++;
2011-03-31 15:47:43 +00:00
return TRUE;
}
/* Updates the SSRC, payload type, seqnum and timestamp of the RTP buffer
* before the buffer is pushed. */
static GstFlowReturn
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_prepare_push (GstRTPBasePayload * payload,
gpointer obj, gboolean is_list)
{
2011-11-11 11:24:08 +00:00
GstRTPBasePayloadPrivate *priv;
HeaderData data;
if (payload->clock_rate == 0)
goto no_rate;
priv = payload->priv;
/* update first, so that the property is set to the last
* seqnum pushed */
payload->seqnum = priv->next_seqnum;
/* fill in the fields we want to set on all headers */
data.payload = payload;
data.seqnum = payload->seqnum;
data.ssrc = payload->current_ssrc;
data.pt = payload->pt;
/* find the first buffer with a timestamp */
if (is_list) {
data.timestamp = -1;
data.offset = GST_BUFFER_OFFSET_NONE;
gst_buffer_list_foreach (GST_BUFFER_LIST_CAST (obj),
(GstBufferListFunc) find_timestamp, &data);
} else {
data.timestamp = GST_BUFFER_TIMESTAMP (GST_BUFFER_CAST (obj));
data.offset = GST_BUFFER_OFFSET (GST_BUFFER_CAST (obj));
}
/* convert to RTP time */
if (priv->perfect_rtptime && data.offset != GST_BUFFER_OFFSET_NONE &&
priv->base_offset != GST_BUFFER_OFFSET_NONE) {
/* if we have an offset, use that for making an RTP timestamp */
data.rtptime = payload->ts_base + priv->base_rtime +
data.offset - priv->base_offset;
2009-09-03 12:13:12 +00:00
GST_LOG_OBJECT (payload,
"Using offset %" G_GUINT64_FORMAT " for RTP timestamp", data.offset);
} else if (GST_CLOCK_TIME_IS_VALID (data.timestamp)) {
gint64 rtime;
/* no offset, use the gstreamer timestamp */
rtime = gst_segment_to_running_time (&payload->segment, GST_FORMAT_TIME,
data.timestamp);
if (rtime == -1) {
GST_LOG_OBJECT (payload, "Clipped timestamp, using base RTP timestamp");
rtime = 0;
} else {
GST_LOG_OBJECT (payload,
"Using running_time %" GST_TIME_FORMAT " for RTP timestamp",
GST_TIME_ARGS (rtime));
rtime =
gst_util_uint64_scale_int (rtime, payload->clock_rate, GST_SECOND);
priv->base_offset = data.offset;
priv->base_rtime = rtime;
}
/* add running_time in clock-rate units to the base timestamp */
data.rtptime = payload->ts_base + rtime;
} else {
2009-09-03 12:13:12 +00:00
GST_LOG_OBJECT (payload,
"Using previous RTP timestamp %" G_GUINT32_FORMAT, payload->timestamp);
/* no timestamp to convert, take previous timestamp */
data.rtptime = payload->timestamp;
}
/* set ssrc, payload type, seq number, caps and rtptime */
if (is_list) {
gst_buffer_list_foreach (GST_BUFFER_LIST_CAST (obj),
(GstBufferListFunc) set_headers, &data);
} else {
GstBuffer *buf = GST_BUFFER_CAST (obj);
set_headers (&buf, 0, 0, &data);
}
priv->next_seqnum = data.seqnum;
payload->timestamp = data.rtptime;
GST_LOG_OBJECT (payload, "Preparing to push packet with size %"
G_GSIZE_FORMAT ", seq=%d, rtptime=%u, timestamp %" GST_TIME_FORMAT,
(is_list) ? -1 : gst_buffer_get_size (GST_BUFFER (obj)),
payload->seqnum, data.rtptime, GST_TIME_ARGS (data.timestamp));
if (g_atomic_int_compare_and_exchange (&payload->priv->
notified_first_timestamp, 1, 0)) {
g_object_notify (G_OBJECT (payload), "timestamp");
g_object_notify (G_OBJECT (payload), "seqnum");
}
return GST_FLOW_OK;
/* ERRORS */
no_rate:
{
GST_ELEMENT_ERROR (payload, STREAM, NOT_IMPLEMENTED, (NULL),
("subclass did not specify clock-rate"));
return GST_FLOW_ERROR;
}
}
/**
2011-11-11 11:24:08 +00:00
* gst_rtp_base_payload_push_list:
* @payload: a #GstRTPBasePayload
* @list: a #GstBufferList
*
* Push @list to the peer element of the payloader. The SSRC, payload type,
* seqnum and timestamp of the RTP buffer will be updated first.
*
* This function takes ownership of @list.
*
* Returns: a #GstFlowReturn.
*
* Since: 0.10.24
*/
GstFlowReturn
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_push_list (GstRTPBasePayload * payload,
GstBufferList * list)
{
GstFlowReturn res;
2011-11-11 11:24:08 +00:00
res = gst_rtp_base_payload_prepare_push (payload, list, TRUE);
if (G_LIKELY (res == GST_FLOW_OK))
res = gst_pad_push_list (payload->srcpad, list);
else
gst_buffer_list_unref (list);
return res;
}
/**
2011-11-11 11:24:08 +00:00
* gst_rtp_base_payload_push:
* @payload: a #GstRTPBasePayload
* @buffer: a #GstBuffer
*
* Push @buffer to the peer element of the payloader. The SSRC, payload type,
* seqnum and timestamp of the RTP buffer will be updated first.
*
* This function takes ownership of @buffer.
*
* Returns: a #GstFlowReturn.
*/
GstFlowReturn
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_push (GstRTPBasePayload * payload, GstBuffer * buffer)
{
GstFlowReturn res;
2011-11-11 11:24:08 +00:00
res = gst_rtp_base_payload_prepare_push (payload, buffer, FALSE);
if (G_LIKELY (res == GST_FLOW_OK))
res = gst_pad_push (payload->srcpad, buffer);
else
gst_buffer_unref (buffer);
return res;
}
static void
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
2011-11-11 11:32:23 +00:00
GstRTPBasePayload *rtpbasepayload;
2011-11-11 11:24:08 +00:00
GstRTPBasePayloadPrivate *priv;
gint64 val;
2011-11-11 11:32:23 +00:00
rtpbasepayload = GST_RTP_BASE_PAYLOAD (object);
priv = rtpbasepayload->priv;
switch (prop_id) {
case PROP_MTU:
2011-11-11 11:32:23 +00:00
rtpbasepayload->mtu = g_value_get_uint (value);
break;
case PROP_PT:
2011-11-11 11:32:23 +00:00
rtpbasepayload->pt = g_value_get_uint (value);
break;
case PROP_SSRC:
val = g_value_get_uint (value);
2011-11-11 11:32:23 +00:00
rtpbasepayload->ssrc = val;
priv->ssrc_random = FALSE;
break;
case PROP_TIMESTAMP_OFFSET:
val = g_value_get_uint (value);
2011-11-11 11:32:23 +00:00
rtpbasepayload->ts_offset = val;
priv->ts_offset_random = FALSE;
break;
case PROP_SEQNUM_OFFSET:
val = g_value_get_int (value);
2011-11-11 11:32:23 +00:00
rtpbasepayload->seqnum_offset = val;
priv->seqnum_offset_random = (val == -1);
2011-11-11 11:32:23 +00:00
GST_DEBUG_OBJECT (rtpbasepayload, "seqnum offset 0x%04x, random %d",
rtpbasepayload->seqnum_offset, priv->seqnum_offset_random);
break;
case PROP_MAX_PTIME:
2011-11-11 11:32:23 +00:00
rtpbasepayload->priv->prop_max_ptime = g_value_get_int64 (value);
update_max_ptime (rtpbasepayload);
break;
case PROP_MIN_PTIME:
2011-11-11 11:32:23 +00:00
rtpbasepayload->min_ptime = g_value_get_int64 (value);
break;
case PROP_PERFECT_RTPTIME:
priv->perfect_rtptime = g_value_get_boolean (value);
break;
case PROP_PTIME_MULTIPLE:
rtpbasepayload->ptime_multiple = g_value_get_int64 (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
2011-11-11 11:32:23 +00:00
GstRTPBasePayload *rtpbasepayload;
2011-11-11 11:24:08 +00:00
GstRTPBasePayloadPrivate *priv;
2011-11-11 11:32:23 +00:00
rtpbasepayload = GST_RTP_BASE_PAYLOAD (object);
priv = rtpbasepayload->priv;
switch (prop_id) {
case PROP_MTU:
2011-11-11 11:32:23 +00:00
g_value_set_uint (value, rtpbasepayload->mtu);
break;
case PROP_PT:
2011-11-11 11:32:23 +00:00
g_value_set_uint (value, rtpbasepayload->pt);
break;
case PROP_SSRC:
if (priv->ssrc_random)
g_value_set_uint (value, -1);
else
2011-11-11 11:32:23 +00:00
g_value_set_uint (value, rtpbasepayload->ssrc);
break;
case PROP_TIMESTAMP_OFFSET:
if (priv->ts_offset_random)
g_value_set_uint (value, -1);
else
2011-11-11 11:32:23 +00:00
g_value_set_uint (value, (guint32) rtpbasepayload->ts_offset);
break;
case PROP_SEQNUM_OFFSET:
if (priv->seqnum_offset_random)
g_value_set_int (value, -1);
else
2011-11-11 11:32:23 +00:00
g_value_set_int (value, (guint16) rtpbasepayload->seqnum_offset);
break;
case PROP_MAX_PTIME:
2011-11-11 11:32:23 +00:00
g_value_set_int64 (value, rtpbasepayload->max_ptime);
break;
case PROP_MIN_PTIME:
2011-11-11 11:32:23 +00:00
g_value_set_int64 (value, rtpbasepayload->min_ptime);
break;
case PROP_TIMESTAMP:
2011-11-11 11:32:23 +00:00
g_value_set_uint (value, rtpbasepayload->timestamp);
break;
case PROP_SEQNUM:
2011-11-11 11:32:23 +00:00
g_value_set_uint (value, rtpbasepayload->seqnum);
break;
case PROP_PERFECT_RTPTIME:
g_value_set_boolean (value, priv->perfect_rtptime);
break;
case PROP_PTIME_MULTIPLE:
g_value_set_int64 (value, rtpbasepayload->ptime_multiple);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static GstStateChangeReturn
2011-11-11 11:24:08 +00:00
gst_rtp_base_payload_change_state (GstElement * element,
GstStateChange transition)
{
2011-11-11 11:32:23 +00:00
GstRTPBasePayload *rtpbasepayload;
2011-11-11 11:24:08 +00:00
GstRTPBasePayloadPrivate *priv;
GstStateChangeReturn ret;
2011-11-11 11:32:23 +00:00
rtpbasepayload = GST_RTP_BASE_PAYLOAD (element);
priv = rtpbasepayload->priv;
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
2011-11-11 11:32:23 +00:00
gst_segment_init (&rtpbasepayload->segment, GST_FORMAT_UNDEFINED);
if (priv->seqnum_offset_random)
2011-11-11 11:32:23 +00:00
rtpbasepayload->seqnum_base = g_random_int_range (0, G_MAXUINT16);
else
2011-11-11 11:32:23 +00:00
rtpbasepayload->seqnum_base = rtpbasepayload->seqnum_offset;
priv->next_seqnum = rtpbasepayload->seqnum_base;
rtpbasepayload->seqnum = rtpbasepayload->seqnum_base;
if (priv->ssrc_random)
2011-11-11 11:32:23 +00:00
rtpbasepayload->current_ssrc = g_random_int ();
else
2011-11-11 11:32:23 +00:00
rtpbasepayload->current_ssrc = rtpbasepayload->ssrc;
if (priv->ts_offset_random)
2011-11-11 11:32:23 +00:00
rtpbasepayload->ts_base = g_random_int ();
else
2011-11-11 11:32:23 +00:00
rtpbasepayload->ts_base = rtpbasepayload->ts_offset;
rtpbasepayload->timestamp = rtpbasepayload->ts_base;
g_atomic_int_set (&rtpbasepayload->priv->notified_first_timestamp, 1);
priv->base_offset = GST_BUFFER_OFFSET_NONE;
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
2011-11-11 11:32:23 +00:00
g_atomic_int_set (&rtpbasepayload->priv->notified_first_timestamp, 1);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
break;
default:
break;
}
return ret;
}