2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
* Copyright (C) <2005> Wim Taymans <wim@fluendo.com>
|
2006-01-07 20:01:09 +00:00
|
|
|
* Copyright (C) <2005> Nokia Corporation <kai.vehmanen@nokia.com>
|
2012-01-17 08:03:38 +00:00
|
|
|
* Copyright (C) <2012> Collabora Ltd.
|
|
|
|
* Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
2014-09-09 11:15:43 +00:00
|
|
|
* Copyright (C) 2014 Tim-Philipp Müller <tim@centricular.com>
|
|
|
|
* Copyright (C) 2014 Centricular Ltd
|
2001-12-22 23:27:31 +00:00
|
|
|
*
|
|
|
|
* 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 details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2001-12-22 23:27:31 +00:00
|
|
|
*/
|
|
|
|
|
2006-02-16 14:13:48 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-udpsrc
|
|
|
|
* @see_also: udpsink, multifdsink
|
|
|
|
*
|
|
|
|
* udpsrc is a network source that reads UDP packets from the network.
|
|
|
|
* It can be combined with RTP depayloaders to implement RTP streaming.
|
2009-01-28 10:29:42 +00:00
|
|
|
*
|
2006-02-16 14:13:48 +00:00
|
|
|
* The udpsrc element supports automatic port allocation by setting the
|
2009-01-28 10:29:42 +00:00
|
|
|
* #GstUDPSrc:port property to 0. After setting the udpsrc to PAUSED, the
|
|
|
|
* allocated port can be obtained by reading the port property.
|
|
|
|
*
|
2009-01-28 15:46:06 +00:00
|
|
|
* udpsrc can read from multicast groups by setting the #GstUDPSrc:multicast-group
|
2009-01-28 10:29:42 +00:00
|
|
|
* property to the IP address of the multicast group.
|
|
|
|
*
|
2014-08-18 09:45:54 +00:00
|
|
|
* Alternatively one can provide a custom socket to udpsrc with the #GstUDPSrc:socket
|
2009-01-28 10:29:42 +00:00
|
|
|
* property, udpsrc will then not allocate a socket itself but use the provided
|
|
|
|
* one.
|
|
|
|
*
|
|
|
|
* The #GstUDPSrc:caps property is mainly used to give a type to the UDP packet
|
2015-10-23 00:40:38 +00:00
|
|
|
* so that they can be autoplugged in GStreamer pipelines. This is very useful
|
2009-01-28 10:29:42 +00:00
|
|
|
* for RTP implementations where the contents of the UDP packets is transfered
|
|
|
|
* out-of-bounds using SDP or other means.
|
|
|
|
*
|
2011-02-04 10:33:09 +00:00
|
|
|
* The #GstUDPSrc:buffer-size property is used to change the default kernel
|
|
|
|
* buffersizes used for receiving packets. The buffer size may be increased for
|
2009-01-28 10:29:42 +00:00
|
|
|
* high-volume connections, or may be decreased to limit the possible backlog of
|
|
|
|
* incoming data. The system places an absolute limit on these values, on Linux,
|
|
|
|
* for example, the default buffer size is typically 50K and can be increased to
|
|
|
|
* maximally 100K.
|
|
|
|
*
|
|
|
|
* The #GstUDPSrc:skip-first-bytes property is used to strip off an arbitrary
|
|
|
|
* number of bytes from the start of the raw udp packet and can be used to strip
|
2011-02-04 10:33:09 +00:00
|
|
|
* off proprietary header, for example.
|
2009-01-28 10:29:42 +00:00
|
|
|
*
|
|
|
|
* The udpsrc is always a live source. It does however not provide a #GstClock,
|
|
|
|
* this is left for upstream elements such as an RTP session manager or demuxer
|
|
|
|
* (such as an MPEG demuxer). As with all live sources, the captured buffers
|
|
|
|
* will have their timestamp set to the current running time of the pipeline.
|
|
|
|
*
|
|
|
|
* udpsrc implements a #GstURIHandler interface that handles udp://host:port
|
|
|
|
* type URIs.
|
|
|
|
*
|
|
|
|
* If the #GstUDPSrc:timeout property is set to a value bigger than 0, udpsrc
|
|
|
|
* will generate an element message named
|
2007-09-26 14:28:20 +00:00
|
|
|
* <classname>"GstUDPSrcTimeout"</classname>
|
2006-09-29 11:09:40 +00:00
|
|
|
* if no data was recieved in the given timeout.
|
|
|
|
* The message's structure contains one field:
|
|
|
|
* <itemizedlist>
|
|
|
|
* <listitem>
|
|
|
|
* <para>
|
|
|
|
* #guint64
|
gst/rtsp/URLS: Add some more URLs.
Original commit message from CVS:
* gst/rtsp/URLS:
Add some more URLs.
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_class_init),
(gst_rtspsrc_init), (gst_rtspsrc_finalize),
(gst_rtspsrc_set_property), (gst_rtspsrc_get_property),
(gst_rtspsrc_stream_setup_rtp), (gst_rtspsrc_loop_interleaved),
(gst_rtspsrc_loop_udp), (gst_rtspsrc_loop_send_cmd),
(gst_rtspsrc_loop), (gst_rtspsrc_send),
(gst_rtspsrc_parse_methods), (gst_rtspsrc_open),
(gst_rtspsrc_close), (gst_rtspsrc_play), (gst_rtspsrc_pause),
(gst_rtspsrc_handle_message), (gst_rtspsrc_change_state):
* gst/rtsp/gstrtspsrc.h:
Add timeout property to control UDP timeouts.
Fix error messages.
Also start a loop function when operating in UDP mode so that we can
do some more stuff async.
Handle element messages from udpsrc to detect timeouts. If a timeout
happens we currently generate an error.
API: rtspsrc::timeout property.
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init),
(gst_udpsrc_create):
Really implement the timeout in microseconds and not milliseconds.
2006-09-29 15:37:29 +00:00
|
|
|
* <classname>"timeout"</classname>: the timeout in microseconds that
|
|
|
|
* expired when waiting for data.
|
2006-09-29 11:09:40 +00:00
|
|
|
* </para>
|
|
|
|
* </listitem>
|
|
|
|
* </itemizedlist>
|
|
|
|
* The message is typically used to detect that no UDP arrives in the receiver
|
|
|
|
* because it is blocked by a firewall.
|
2014-02-14 20:27:20 +00:00
|
|
|
*
|
2011-02-04 10:33:09 +00:00
|
|
|
* A custom file descriptor can be configured with the
|
2014-08-18 09:45:54 +00:00
|
|
|
* #GstUDPSrc:socket property. The socket will be closed when setting
|
|
|
|
* the element to READY by default. This behaviour can be overriden
|
|
|
|
* with the #GstUDPSrc:close-socket property, in which case the
|
|
|
|
* application is responsible for closing the file descriptor.
|
2009-01-28 10:29:42 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <title>Examples</title>
|
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 -v udpsrc ! fakesink dump=1
|
2009-01-28 10:29:42 +00:00
|
|
|
* ]| A pipeline to read from the default port and dump the udp packets.
|
|
|
|
* To actually generate udp packets on the default port one can use the
|
|
|
|
* udpsink element. When running the following pipeline in another terminal, the
|
|
|
|
* above mentioned pipeline should dump data packets to the console.
|
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 -v audiotestsrc ! udpsink
|
2009-01-28 10:29:42 +00:00
|
|
|
* ]|
|
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 -v udpsrc port=0 ! fakesink
|
2009-01-28 10:29:42 +00:00
|
|
|
* ]| read udp packets from a free port.
|
2006-02-16 14:13:48 +00:00
|
|
|
* </refsect2>
|
|
|
|
*/
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2016-06-28 12:08:04 +00:00
|
|
|
/* Needed to get struct in6_pktinfo.
|
|
|
|
* Also all these have to be before glib.h is included as
|
|
|
|
* otherwise struct in6_pktinfo is not defined completely
|
|
|
|
* due to broken glibc headers */
|
2016-06-23 17:21:59 +00:00
|
|
|
#define _GNU_SOURCE
|
2016-06-28 12:15:14 +00:00
|
|
|
/* Needed for OSX/iOS to define the IPv6 variants */
|
|
|
|
#define __APPLE_USE_RFC_3542
|
2016-06-23 17:21:59 +00:00
|
|
|
#include <sys/types.h>
|
2016-06-28 11:25:03 +00:00
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
2016-06-23 17:21:59 +00:00
|
|
|
#include <sys/socket.h>
|
2016-06-28 11:25:03 +00:00
|
|
|
#endif
|
2016-06-23 17:21:59 +00:00
|
|
|
|
2014-09-12 05:25:23 +00:00
|
|
|
#include <string.h>
|
2001-12-22 23:27:31 +00:00
|
|
|
#include "gstudpsrc.h"
|
2007-11-02 21:16:09 +00:00
|
|
|
|
2011-11-03 15:43:00 +00:00
|
|
|
#include <gst/net/gstnetaddressmeta.h>
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
|
2013-02-15 14:11:36 +00:00
|
|
|
#include <gio/gnetworking.h>
|
2013-04-27 10:16:54 +00:00
|
|
|
|
2016-06-28 12:08:04 +00:00
|
|
|
/* Required for other parts of in_pktinfo / in6_pktinfo but only
|
|
|
|
* on non-Windows and can be included after glib.h */
|
2016-10-24 00:23:10 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
2016-06-28 12:08:04 +00:00
|
|
|
#include <netinet/ip.h>
|
|
|
|
#endif
|
|
|
|
|
2016-06-23 17:21:59 +00:00
|
|
|
/* Control messages for getting the destination address */
|
|
|
|
#ifdef IP_PKTINFO
|
|
|
|
GType gst_ip_pktinfo_message_get_type (void);
|
|
|
|
|
|
|
|
#define GST_TYPE_IP_PKTINFO_MESSAGE (gst_ip_pktinfo_message_get_type ())
|
|
|
|
#define GST_IP_PKTINFO_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GST_TYPE_IP_PKTINFO_MESSAGE, GstIPPktinfoMessage))
|
|
|
|
#define GST_IP_PKTINFO_MESSAGE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GST_TYPE_IP_PKTINFO_MESSAGE, GstIPPktinfoMessageClass))
|
|
|
|
#define GST_IS_IP_PKTINFO_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GST_TYPE_IP_PKTINFO_MESSAGE))
|
|
|
|
#define GST_IS_IP_PKTINFO_MESSAGE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GST_TYPE_IP_PKTINFO_MESSAGE))
|
|
|
|
#define GST_IP_PKTINFO_MESSAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GST_TYPE_IP_PKTINFO_MESSAGE, GstIPPktinfoMessageClass))
|
|
|
|
|
|
|
|
typedef struct _GstIPPktinfoMessage GstIPPktinfoMessage;
|
|
|
|
typedef struct _GstIPPktinfoMessageClass GstIPPktinfoMessageClass;
|
|
|
|
|
|
|
|
struct _GstIPPktinfoMessageClass
|
|
|
|
{
|
|
|
|
GSocketControlMessageClass parent_class;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstIPPktinfoMessage
|
|
|
|
{
|
|
|
|
GSocketControlMessage parent;
|
|
|
|
|
|
|
|
guint ifindex;
|
2016-10-24 00:23:10 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
2016-09-12 09:02:00 +00:00
|
|
|
#ifndef __NetBSD__
|
2016-06-28 13:44:50 +00:00
|
|
|
struct in_addr spec_dst;
|
2016-09-12 09:02:00 +00:00
|
|
|
#endif
|
2016-06-28 13:44:50 +00:00
|
|
|
#endif
|
|
|
|
struct in_addr addr;
|
2016-06-23 17:21:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GstIPPktinfoMessage, gst_ip_pktinfo_message,
|
|
|
|
G_TYPE_SOCKET_CONTROL_MESSAGE);
|
|
|
|
|
|
|
|
static gsize
|
|
|
|
gst_ip_pktinfo_message_get_size (GSocketControlMessage * message)
|
|
|
|
{
|
|
|
|
return sizeof (struct in_pktinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
gst_ip_pktinfo_message_get_level (GSocketControlMessage * message)
|
|
|
|
{
|
|
|
|
return IPPROTO_IP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
gst_ip_pktinfo_message_get_msg_type (GSocketControlMessage * message)
|
|
|
|
{
|
|
|
|
return IP_PKTINFO;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GSocketControlMessage *
|
|
|
|
gst_ip_pktinfo_message_deserialize (gint level,
|
|
|
|
gint type, gsize size, gpointer data)
|
|
|
|
{
|
|
|
|
struct in_pktinfo *pktinfo;
|
|
|
|
GstIPPktinfoMessage *message;
|
|
|
|
|
|
|
|
if (level != IPPROTO_IP || type != IP_PKTINFO)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (size < sizeof (struct in_pktinfo))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pktinfo = data;
|
|
|
|
|
|
|
|
message = g_object_new (GST_TYPE_IP_PKTINFO_MESSAGE, NULL);
|
|
|
|
message->ifindex = pktinfo->ipi_ifindex;
|
2016-10-24 00:23:10 +00:00
|
|
|
#ifndef G_PLATFORM_WIN32
|
2016-09-12 09:02:00 +00:00
|
|
|
#ifndef __NetBSD__
|
2016-06-23 17:21:59 +00:00
|
|
|
message->spec_dst = pktinfo->ipi_spec_dst;
|
2016-09-12 09:02:00 +00:00
|
|
|
#endif
|
2016-06-28 13:44:50 +00:00
|
|
|
#endif
|
2016-06-23 17:21:59 +00:00
|
|
|
message->addr = pktinfo->ipi_addr;
|
|
|
|
|
|
|
|
return G_SOCKET_CONTROL_MESSAGE (message);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ip_pktinfo_message_init (GstIPPktinfoMessage * message)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ip_pktinfo_message_class_init (GstIPPktinfoMessageClass * class)
|
|
|
|
{
|
|
|
|
GSocketControlMessageClass *scm_class;
|
|
|
|
|
|
|
|
scm_class = G_SOCKET_CONTROL_MESSAGE_CLASS (class);
|
|
|
|
scm_class->get_size = gst_ip_pktinfo_message_get_size;
|
|
|
|
scm_class->get_level = gst_ip_pktinfo_message_get_level;
|
|
|
|
scm_class->get_type = gst_ip_pktinfo_message_get_msg_type;
|
|
|
|
scm_class->deserialize = gst_ip_pktinfo_message_deserialize;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef IPV6_PKTINFO
|
|
|
|
GType gst_ipv6_pktinfo_message_get_type (void);
|
|
|
|
|
|
|
|
#define GST_TYPE_IPV6_PKTINFO_MESSAGE (gst_ipv6_pktinfo_message_get_type ())
|
|
|
|
#define GST_IPV6_PKTINFO_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GST_TYPE_IPV6_PKTINFO_MESSAGE, GstIPV6PktinfoMessage))
|
|
|
|
#define GST_IPV6_PKTINFO_MESSAGE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GST_TYPE_IPV6_PKTINFO_MESSAGE, GstIPV6PktinfoMessageClass))
|
|
|
|
#define GST_IS_IPV6_PKTINFO_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GST_TYPE_IPV6_PKTINFO_MESSAGE))
|
|
|
|
#define GST_IS_IPV6_PKTINFO_MESSAGE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GST_TYPE_IPV6_PKTINFO_MESSAGE))
|
|
|
|
#define GST_IPV6_PKTINFO_MESSAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GST_TYPE_IPV6_PKTINFO_MESSAGE, GstIPV6PktinfoMessageClass))
|
|
|
|
|
|
|
|
typedef struct _GstIPV6PktinfoMessage GstIPV6PktinfoMessage;
|
|
|
|
typedef struct _GstIPV6PktinfoMessageClass GstIPV6PktinfoMessageClass;
|
|
|
|
|
|
|
|
struct _GstIPV6PktinfoMessageClass
|
|
|
|
{
|
|
|
|
GSocketControlMessageClass parent_class;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstIPV6PktinfoMessage
|
|
|
|
{
|
|
|
|
GSocketControlMessage parent;
|
|
|
|
|
|
|
|
guint ifindex;
|
|
|
|
struct in6_addr addr;
|
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GstIPV6PktinfoMessage, gst_ipv6_pktinfo_message,
|
|
|
|
G_TYPE_SOCKET_CONTROL_MESSAGE);
|
|
|
|
|
|
|
|
static gsize
|
|
|
|
gst_ipv6_pktinfo_message_get_size (GSocketControlMessage * message)
|
|
|
|
{
|
|
|
|
return sizeof (struct in6_pktinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
gst_ipv6_pktinfo_message_get_level (GSocketControlMessage * message)
|
|
|
|
{
|
|
|
|
return IPPROTO_IPV6;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
gst_ipv6_pktinfo_message_get_msg_type (GSocketControlMessage * message)
|
|
|
|
{
|
|
|
|
return IPV6_PKTINFO;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GSocketControlMessage *
|
|
|
|
gst_ipv6_pktinfo_message_deserialize (gint level,
|
|
|
|
gint type, gsize size, gpointer data)
|
|
|
|
{
|
|
|
|
struct in6_pktinfo *pktinfo;
|
|
|
|
GstIPV6PktinfoMessage *message;
|
|
|
|
|
|
|
|
if (level != IPPROTO_IPV6 || type != IPV6_PKTINFO)
|
|
|
|
return NULL;
|
|
|
|
|
2016-07-10 18:30:27 +00:00
|
|
|
if (size < sizeof (struct in6_pktinfo))
|
2016-06-23 17:21:59 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pktinfo = data;
|
|
|
|
|
|
|
|
message = g_object_new (GST_TYPE_IPV6_PKTINFO_MESSAGE, NULL);
|
|
|
|
message->ifindex = pktinfo->ipi6_ifindex;
|
|
|
|
message->addr = pktinfo->ipi6_addr;
|
|
|
|
|
|
|
|
return G_SOCKET_CONTROL_MESSAGE (message);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ipv6_pktinfo_message_init (GstIPV6PktinfoMessage * message)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ipv6_pktinfo_message_class_init (GstIPV6PktinfoMessageClass * class)
|
|
|
|
{
|
|
|
|
GSocketControlMessageClass *scm_class;
|
|
|
|
|
|
|
|
scm_class = G_SOCKET_CONTROL_MESSAGE_CLASS (class);
|
|
|
|
scm_class->get_size = gst_ipv6_pktinfo_message_get_size;
|
|
|
|
scm_class->get_level = gst_ipv6_pktinfo_message_get_level;
|
|
|
|
scm_class->get_type = gst_ipv6_pktinfo_message_get_msg_type;
|
|
|
|
scm_class->deserialize = gst_ipv6_pktinfo_message_deserialize;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef IP_RECVDSTADDR
|
|
|
|
GType gst_ip_recvdstaddr_message_get_type (void);
|
|
|
|
|
|
|
|
#define GST_TYPE_IP_RECVDSTADDR_MESSAGE (gst_ip_recvdstaddr_message_get_type ())
|
|
|
|
#define GST_IP_RECVDSTADDR_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GST_TYPE_IP_RECVDSTADDR_MESSAGE, GstIPRecvdstaddrMessage))
|
|
|
|
#define GST_IP_RECVDSTADDR_MESSAGE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GST_TYPE_IP_RECVDSTADDR_MESSAGE, GstIPRecvdstaddrMessageClass))
|
|
|
|
#define GST_IS_IP_RECVDSTADDR_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GST_TYPE_IP_RECVDSTADDR_MESSAGE))
|
|
|
|
#define GST_IS_IP_RECVDSTADDR_MESSAGE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GST_TYPE_IP_RECVDSTADDR_MESSAGE))
|
|
|
|
#define GST_IP_RECVDSTADDR_MESSAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GST_TYPE_IP_RECVDSTADDR_MESSAGE, GstIPRecvdstaddrMessageClass))
|
|
|
|
|
|
|
|
typedef struct _GstIPRecvdstaddrMessage GstIPRecvdstaddrMessage;
|
|
|
|
typedef struct _GstIPRecvdstaddrMessageClass GstIPRecvdstaddrMessageClass;
|
|
|
|
|
|
|
|
struct _GstIPRecvdstaddrMessageClass
|
|
|
|
{
|
|
|
|
GSocketControlMessageClass parent_class;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstIPRecvdstaddrMessage
|
|
|
|
{
|
|
|
|
GSocketControlMessage parent;
|
|
|
|
|
|
|
|
guint ifindex;
|
|
|
|
struct in_addr addr;
|
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GstIPRecvdstaddrMessage, gst_ip_recvdstaddr_message,
|
|
|
|
G_TYPE_SOCKET_CONTROL_MESSAGE);
|
|
|
|
|
|
|
|
static gsize
|
|
|
|
gst_ip_recvdstaddr_message_get_size (GSocketControlMessage * message)
|
|
|
|
{
|
|
|
|
return sizeof (struct in_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
gst_ip_recvdstaddr_message_get_level (GSocketControlMessage * message)
|
|
|
|
{
|
|
|
|
return IPPROTO_IP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
gst_ip_recvdstaddr_message_get_msg_type (GSocketControlMessage * message)
|
|
|
|
{
|
|
|
|
return IP_RECVDSTADDR;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GSocketControlMessage *
|
|
|
|
gst_ip_recvdstaddr_message_deserialize (gint level,
|
|
|
|
gint type, gsize size, gpointer data)
|
|
|
|
{
|
|
|
|
struct in_addr *addr;
|
|
|
|
GstIPRecvdstaddrMessage *message;
|
|
|
|
|
|
|
|
if (level != IPPROTO_IP || type != IP_RECVDSTADDR)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (size < sizeof (struct in_addr))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
addr = data;
|
|
|
|
|
|
|
|
message = g_object_new (GST_TYPE_IP_RECVDSTADDR_MESSAGE, NULL);
|
2016-06-28 11:25:03 +00:00
|
|
|
message->addr = *addr;
|
2016-06-23 17:21:59 +00:00
|
|
|
|
|
|
|
return G_SOCKET_CONTROL_MESSAGE (message);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ip_recvdstaddr_message_init (GstIPRecvdstaddrMessage * message)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ip_recvdstaddr_message_class_init (GstIPRecvdstaddrMessageClass * class)
|
|
|
|
{
|
|
|
|
GSocketControlMessageClass *scm_class;
|
|
|
|
|
|
|
|
scm_class = G_SOCKET_CONTROL_MESSAGE_CLASS (class);
|
|
|
|
scm_class->get_size = gst_ip_recvdstaddr_message_get_size;
|
|
|
|
scm_class->get_level = gst_ip_recvdstaddr_message_get_level;
|
|
|
|
scm_class->get_type = gst_ip_recvdstaddr_message_get_msg_type;
|
|
|
|
scm_class->deserialize = gst_ip_recvdstaddr_message_deserialize;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-01-02 00:03:27 +00:00
|
|
|
/* not 100% correct, but a good upper bound for memory allocation purposes */
|
|
|
|
#define MAX_IPV4_UDP_PACKET_SIZE (65536 - 8)
|
|
|
|
|
2006-06-22 19:31:04 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (udpsrc_debug);
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
#define GST_CAT_DEFAULT (udpsrc_debug)
|
|
|
|
|
gst/udp/: Ported udp src/sink.
Original commit message from CVS:
* gst/udp/Makefile.am:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_init_send), (gst_udpsink_close),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_base_init),
(gst_udpsrc_class_init), (gst_udpsrc_init), (gst_udpsrc_loop),
(gst_udpsrc_set_property), (gst_udpsrc_get_property),
(gst_udpsrc_init_receive), (gst_udpsrc_close),
(gst_udpsrc_activate), (gst_udpsrc_change_state):
* gst/udp/gstudpsrc.h:
Ported udp src/sink.
2005-05-10 11:15:13 +00:00
|
|
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
2012-03-07 05:44:36 +00:00
|
|
|
#define UDP_DEFAULT_PORT 5004
|
2005-12-06 19:44:58 +00:00
|
|
|
#define UDP_DEFAULT_MULTICAST_GROUP "0.0.0.0"
|
2009-03-13 17:28:59 +00:00
|
|
|
#define UDP_DEFAULT_MULTICAST_IFACE NULL
|
2006-02-16 14:13:48 +00:00
|
|
|
#define UDP_DEFAULT_URI "udp://"UDP_DEFAULT_MULTICAST_GROUP":"G_STRINGIFY(UDP_DEFAULT_PORT)
|
2005-12-06 19:44:58 +00:00
|
|
|
#define UDP_DEFAULT_CAPS NULL
|
2012-01-17 08:03:38 +00:00
|
|
|
#define UDP_DEFAULT_SOCKET NULL
|
2006-09-29 11:09:40 +00:00
|
|
|
#define UDP_DEFAULT_BUFFER_SIZE 0
|
|
|
|
#define UDP_DEFAULT_TIMEOUT 0
|
2007-03-02 12:56:13 +00:00
|
|
|
#define UDP_DEFAULT_SKIP_FIRST_BYTES 0
|
2012-01-17 08:03:38 +00:00
|
|
|
#define UDP_DEFAULT_CLOSE_SOCKET TRUE
|
|
|
|
#define UDP_DEFAULT_USED_SOCKET NULL
|
2008-06-13 11:54:05 +00:00
|
|
|
#define UDP_DEFAULT_AUTO_MULTICAST TRUE
|
2010-07-06 16:11:21 +00:00
|
|
|
#define UDP_DEFAULT_REUSE TRUE
|
2015-11-17 10:39:05 +00:00
|
|
|
#define UDP_DEFAULT_LOOP TRUE
|
2016-04-18 13:33:10 +00:00
|
|
|
#define UDP_DEFAULT_RETRIEVE_SENDER_ADDRESS TRUE
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
PROP_0,
|
2008-06-13 11:54:05 +00:00
|
|
|
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
PROP_PORT,
|
|
|
|
PROP_MULTICAST_GROUP,
|
2009-03-13 17:28:59 +00:00
|
|
|
PROP_MULTICAST_IFACE,
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
PROP_URI,
|
ext/amrnb/: Update caps with audio/AMR.
Original commit message from CVS:
* ext/amrnb/amrnbdec.c:
* ext/amrnb/amrnbenc.c: (gst_amrnbenc_setcaps):
* ext/amrnb/amrnbparse.c:
Update caps with audio/AMR.
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_init),
(gst_rtpamrdec_sink_setcaps), (gst_rtpamrdec_chain),
(gst_rtpamrdec_change_state):
* gst/rtp/gstrtpamrdec.h:
* gst/rtp/gstrtpamrenc.c: (gst_rtpamrenc_class_init),
(gst_rtpamrenc_init), (gst_rtpamrenc_chain):
Dont set FT headers twice, it was already in the encoded
bitstream.
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_send), (gst_rtspsrc_open),
(gst_rtspsrc_close), (gst_rtspsrc_play):
* gst/rtsp/rtspconnection.c: (parse_line):
Cleanups
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property):
* gst/udp/gstudpsrc.h:
Added caps property, we need this soon to type the buffers.
2005-08-19 12:44:35 +00:00
|
|
|
PROP_CAPS,
|
2012-01-17 08:03:38 +00:00
|
|
|
PROP_SOCKET,
|
2006-09-29 11:09:40 +00:00
|
|
|
PROP_BUFFER_SIZE,
|
2007-03-02 12:56:13 +00:00
|
|
|
PROP_TIMEOUT,
|
gst/udp/: Rework the socket allocation a bit based on the sockfd argument so that it becomes usable.
Original commit message from CVS:
Patch by: Laurent Glayal <spglegle at yahoo dot fr>
* gst/udp/gstdynudpsink.c: (gst_dynudpsink_class_init),
(gst_dynudpsink_init), (gst_dynudpsink_set_property),
(gst_dynudpsink_get_property), (gst_dynudpsink_init_send),
(gst_dynudpsink_close):
* gst/udp/gstdynudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_start), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Rework the socket allocation a bit based on the sockfd argument so that
it becomes usable.
Add a closefd property to instruct the udp elements to close the custom
file descriptors when going to READY. Fixes #423304.
API:GstUDPSrc::closefd property
API:GstDynUDPSink::closefd property
2007-03-29 09:59:23 +00:00
|
|
|
PROP_SKIP_FIRST_BYTES,
|
2012-01-17 08:03:38 +00:00
|
|
|
PROP_CLOSE_SOCKET,
|
|
|
|
PROP_USED_SOCKET,
|
2008-06-13 11:54:05 +00:00
|
|
|
PROP_AUTO_MULTICAST,
|
2010-07-06 16:11:21 +00:00
|
|
|
PROP_REUSE,
|
2015-11-17 10:39:05 +00:00
|
|
|
PROP_ADDRESS,
|
2016-04-18 13:33:10 +00:00
|
|
|
PROP_LOOP,
|
|
|
|
PROP_RETRIEVE_SENDER_ADDRESS
|
2001-12-22 23:27:31 +00:00
|
|
|
};
|
|
|
|
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
static void gst_udpsrc_uri_handler_init (gpointer g_iface, gpointer iface_data);
|
|
|
|
|
2011-06-09 15:50:08 +00:00
|
|
|
static GstCaps *gst_udpsrc_getcaps (GstBaseSrc * src, GstCaps * filter);
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
static GstFlowReturn gst_udpsrc_create (GstPushSrc * psrc, GstBuffer ** buf);
|
2014-03-24 14:15:34 +00:00
|
|
|
static gboolean gst_udpsrc_close (GstUDPSrc * src);
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
static gboolean gst_udpsrc_unlock (GstBaseSrc * bsrc);
|
2007-05-21 10:07:05 +00:00
|
|
|
static gboolean gst_udpsrc_unlock_stop (GstBaseSrc * bsrc);
|
2014-09-09 08:42:15 +00:00
|
|
|
static gboolean gst_udpsrc_negotiate (GstBaseSrc * basesrc);
|
2008-06-25 08:12:18 +00:00
|
|
|
|
2006-10-11 08:34:14 +00:00
|
|
|
static void gst_udpsrc_finalize (GObject * object);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_udpsrc_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_udpsrc_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2014-03-24 14:15:34 +00:00
|
|
|
static GstStateChangeReturn gst_udpsrc_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
|
|
|
|
2011-04-19 15:35:47 +00:00
|
|
|
#define gst_udpsrc_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstUDPSrc, gst_udpsrc, GST_TYPE_PUSH_SRC,
|
|
|
|
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_udpsrc_uri_handler_init));
|
2003-11-02 22:34:11 +00:00
|
|
|
|
2001-12-22 23:27:31 +00:00
|
|
|
static void
|
2005-11-16 10:43:44 +00:00
|
|
|
gst_udpsrc_class_init (GstUDPSrcClass * klass)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
2011-04-19 15:35:47 +00:00
|
|
|
GstElementClass *gstelement_class;
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
GstBaseSrcClass *gstbasesrc_class;
|
|
|
|
GstPushSrcClass *gstpushsrc_class;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
2011-04-19 15:35:47 +00:00
|
|
|
gstelement_class = (GstElementClass *) klass;
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
gstbasesrc_class = (GstBaseSrcClass *) klass;
|
|
|
|
gstpushsrc_class = (GstPushSrcClass *) klass;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2011-04-19 15:35:47 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (udpsrc_debug, "udpsrc", 0, "UDP src");
|
|
|
|
|
2016-06-23 17:21:59 +00:00
|
|
|
#ifdef IP_PKTINFO
|
|
|
|
GST_TYPE_IP_PKTINFO_MESSAGE;
|
|
|
|
#endif
|
|
|
|
#ifdef IPV6_PKTINFO
|
|
|
|
GST_TYPE_IPV6_PKTINFO_MESSAGE;
|
|
|
|
#endif
|
|
|
|
#ifdef IP_RECVDSTADDR
|
|
|
|
GST_TYPE_IP_RECVDSTADDR_MESSAGE;
|
|
|
|
#endif
|
|
|
|
|
gst/udp/: Ported udp src/sink.
Original commit message from CVS:
* gst/udp/Makefile.am:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_init_send), (gst_udpsink_close),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_base_init),
(gst_udpsrc_class_init), (gst_udpsrc_init), (gst_udpsrc_loop),
(gst_udpsrc_set_property), (gst_udpsrc_get_property),
(gst_udpsrc_init_receive), (gst_udpsrc_close),
(gst_udpsrc_activate), (gst_udpsrc_change_state):
* gst/udp/gstudpsrc.h:
Ported udp src/sink.
2005-05-10 11:15:13 +00:00
|
|
|
gobject_class->set_property = gst_udpsrc_set_property;
|
|
|
|
gobject_class->get_property = gst_udpsrc_get_property;
|
2006-10-11 08:34:14 +00:00
|
|
|
gobject_class->finalize = gst_udpsrc_finalize;
|
gst/udp/: Ported udp src/sink.
Original commit message from CVS:
* gst/udp/Makefile.am:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_init_send), (gst_udpsink_close),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_base_init),
(gst_udpsrc_class_init), (gst_udpsrc_init), (gst_udpsrc_loop),
(gst_udpsrc_set_property), (gst_udpsrc_get_property),
(gst_udpsrc_init_receive), (gst_udpsrc_close),
(gst_udpsrc_activate), (gst_udpsrc_change_state):
* gst/udp/gstudpsrc.h:
Ported udp src/sink.
2005-05-10 11:15:13 +00:00
|
|
|
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT,
|
2006-07-27 09:04:51 +00:00
|
|
|
g_param_spec_int ("port", "Port",
|
2006-02-16 14:13:48 +00:00
|
|
|
"The port to receive the packets from, 0=allocate", 0, G_MAXUINT16,
|
2010-10-13 14:21:23 +00:00
|
|
|
UDP_DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2013-09-03 09:23:24 +00:00
|
|
|
/* FIXME 2.0: Remove multicast-group property */
|
2014-11-02 16:51:23 +00:00
|
|
|
#ifndef GST_REMOVE_DEPRECATED
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MULTICAST_GROUP,
|
2009-03-13 17:32:47 +00:00
|
|
|
g_param_spec_string ("multicast-group", "Multicast Group",
|
2014-11-02 16:51:23 +00:00
|
|
|
"The Address of multicast group to join. (DEPRECATED: "
|
|
|
|
"Use address property instead)", UDP_DEFAULT_MULTICAST_GROUP,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_DEPRECATED));
|
|
|
|
#endif
|
2009-03-13 17:28:59 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MULTICAST_IFACE,
|
2009-03-13 17:32:47 +00:00
|
|
|
g_param_spec_string ("multicast-iface", "Multicast Interface",
|
2016-12-13 02:11:07 +00:00
|
|
|
"The network interface on which to join the multicast group."
|
|
|
|
"This allows multiple interfaces seperated by comma. (\"eth0,eth1\")",
|
2010-10-13 14:21:23 +00:00
|
|
|
UDP_DEFAULT_MULTICAST_IFACE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_URI,
|
|
|
|
g_param_spec_string ("uri", "URI",
|
2005-11-22 11:49:30 +00:00
|
|
|
"URI in the form of udp://multicast_group:port", UDP_DEFAULT_URI,
|
2010-10-13 14:21:23 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
ext/amrnb/: Update caps with audio/AMR.
Original commit message from CVS:
* ext/amrnb/amrnbdec.c:
* ext/amrnb/amrnbenc.c: (gst_amrnbenc_setcaps):
* ext/amrnb/amrnbparse.c:
Update caps with audio/AMR.
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_init),
(gst_rtpamrdec_sink_setcaps), (gst_rtpamrdec_chain),
(gst_rtpamrdec_change_state):
* gst/rtp/gstrtpamrdec.h:
* gst/rtp/gstrtpamrenc.c: (gst_rtpamrenc_class_init),
(gst_rtpamrenc_init), (gst_rtpamrenc_chain):
Dont set FT headers twice, it was already in the encoded
bitstream.
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_send), (gst_rtspsrc_open),
(gst_rtspsrc_close), (gst_rtspsrc_play):
* gst/rtsp/rtspconnection.c: (parse_line):
Cleanups
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property):
* gst/udp/gstudpsrc.h:
Added caps property, we need this soon to type the buffers.
2005-08-19 12:44:35 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_CAPS,
|
|
|
|
g_param_spec_boxed ("caps", "Caps",
|
2010-10-13 14:21:23 +00:00
|
|
|
"The caps of the source pad", GST_TYPE_CAPS,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2012-01-17 08:03:38 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SOCKET,
|
|
|
|
g_param_spec_object ("socket", "Socket",
|
|
|
|
"Socket to use for UDP reception. (NULL == allocate)",
|
|
|
|
G_TYPE_SOCKET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-07-27 10:05:27 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BUFFER_SIZE,
|
|
|
|
g_param_spec_int ("buffer-size", "Buffer Size",
|
|
|
|
"Size of the kernel receive buffer in bytes, 0=default", 0, G_MAXINT,
|
2010-10-13 14:21:23 +00:00
|
|
|
UDP_DEFAULT_BUFFER_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-09-29 11:09:40 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TIMEOUT,
|
|
|
|
g_param_spec_uint64 ("timeout", "Timeout",
|
2012-01-17 08:03:38 +00:00
|
|
|
"Post a message after timeout nanoseconds (0 = disabled)", 0,
|
2010-10-13 14:21:23 +00:00
|
|
|
G_MAXUINT64, UDP_DEFAULT_TIMEOUT,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2007-03-02 12:56:13 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
|
|
|
PROP_SKIP_FIRST_BYTES, g_param_spec_int ("skip-first-bytes",
|
|
|
|
"Skip first bytes", "number of bytes to skip for each udp packet", 0,
|
2010-10-13 14:21:23 +00:00
|
|
|
G_MAXINT, UDP_DEFAULT_SKIP_FIRST_BYTES,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2012-01-17 08:03:38 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_CLOSE_SOCKET,
|
|
|
|
g_param_spec_boolean ("close-socket", "Close socket",
|
|
|
|
"Close socket if passed as property on state change",
|
|
|
|
UDP_DEFAULT_CLOSE_SOCKET,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_USED_SOCKET,
|
|
|
|
g_param_spec_object ("used-socket", "Socket Handle",
|
|
|
|
"Socket currently in use for UDP reception. (NULL = no socket)",
|
|
|
|
G_TYPE_SOCKET, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
2008-06-13 11:54:05 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_AUTO_MULTICAST,
|
|
|
|
g_param_spec_boolean ("auto-multicast", "Auto Multicast",
|
|
|
|
"Automatically join/leave multicast groups",
|
2010-10-13 14:21:23 +00:00
|
|
|
UDP_DEFAULT_AUTO_MULTICAST,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-07-06 16:11:21 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_REUSE,
|
|
|
|
g_param_spec_boolean ("reuse", "Reuse", "Enable reuse of the port",
|
2010-10-13 14:21:23 +00:00
|
|
|
UDP_DEFAULT_REUSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2013-09-03 09:23:24 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_ADDRESS,
|
|
|
|
g_param_spec_string ("address", "Address",
|
|
|
|
"Address to receive packets for. This is equivalent to the "
|
|
|
|
"multicast-group property for now", UDP_DEFAULT_MULTICAST_GROUP,
|
2013-04-25 07:03:56 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2016-05-17 04:33:35 +00:00
|
|
|
/**
|
|
|
|
* GstUDPSrc::loop:
|
|
|
|
*
|
|
|
|
* Can be used to disable multicast loopback.
|
|
|
|
*
|
2016-05-18 17:32:57 +00:00
|
|
|
* Since: 1.8
|
2016-05-17 04:33:35 +00:00
|
|
|
*/
|
2015-11-17 10:39:05 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_LOOP,
|
|
|
|
g_param_spec_boolean ("loop", "Multicast Loopback",
|
|
|
|
"Used for setting the multicast loop parameter. TRUE = enable,"
|
|
|
|
" FALSE = disable", UDP_DEFAULT_LOOP,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2016-04-18 13:33:10 +00:00
|
|
|
/**
|
|
|
|
* GstUDPSrc::retrieve-sender-address:
|
|
|
|
*
|
|
|
|
* Whether to retrieve the sender address and add it to the buffers as
|
|
|
|
* meta. Disabling this might result in minor performance improvements
|
|
|
|
* in certain scenarios.
|
|
|
|
*
|
|
|
|
* Since: 1.10
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_RETRIEVE_SENDER_ADDRESS,
|
|
|
|
g_param_spec_boolean ("retrieve-sender-address",
|
|
|
|
"Retrieve Sender Address",
|
|
|
|
"Whether to retrieve the sender address and add it to buffers as "
|
|
|
|
"meta. Disabling this might result in minor performance improvements "
|
|
|
|
"in certain scenarios", UDP_DEFAULT_RETRIEVE_SENDER_ADDRESS,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2013-04-25 07:03:56 +00:00
|
|
|
|
2016-03-04 01:30:12 +00:00
|
|
|
gst_element_class_add_static_pad_template (gstelement_class, &src_template);
|
2011-04-19 15:35:47 +00:00
|
|
|
|
2012-04-09 23:51:41 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class,
|
|
|
|
"UDP packet receiver", "Source/Network",
|
2011-04-19 15:35:47 +00:00
|
|
|
"Receive data over the network via UDP",
|
|
|
|
"Wim Taymans <wim@fluendo.com>, "
|
|
|
|
"Thijs Vermeir <thijs.vermeir@barco.com>");
|
|
|
|
|
2014-03-24 14:15:34 +00:00
|
|
|
gstelement_class->change_state = gst_udpsrc_change_state;
|
|
|
|
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
gstbasesrc_class->unlock = gst_udpsrc_unlock;
|
2007-05-21 10:07:05 +00:00
|
|
|
gstbasesrc_class->unlock_stop = gst_udpsrc_unlock_stop;
|
2005-09-21 17:53:26 +00:00
|
|
|
gstbasesrc_class->get_caps = gst_udpsrc_getcaps;
|
2014-09-09 08:42:15 +00:00
|
|
|
gstbasesrc_class->negotiate = gst_udpsrc_negotiate;
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
gstpushsrc_class->create = gst_udpsrc_create;
|
2002-12-15 22:45:53 +00:00
|
|
|
}
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
static void
|
2011-04-19 15:35:47 +00:00
|
|
|
gst_udpsrc_init (GstUDPSrc * udpsrc)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2012-01-17 08:03:38 +00:00
|
|
|
udpsrc->uri =
|
|
|
|
g_strdup_printf ("udp://%s:%u", UDP_DEFAULT_MULTICAST_GROUP,
|
2010-03-09 16:15:16 +00:00
|
|
|
UDP_DEFAULT_PORT);
|
|
|
|
|
2013-09-03 09:23:24 +00:00
|
|
|
udpsrc->address = g_strdup (UDP_DEFAULT_MULTICAST_GROUP);
|
2012-01-17 08:03:38 +00:00
|
|
|
udpsrc->port = UDP_DEFAULT_PORT;
|
|
|
|
udpsrc->socket = UDP_DEFAULT_SOCKET;
|
2009-03-13 17:28:59 +00:00
|
|
|
udpsrc->multi_iface = g_strdup (UDP_DEFAULT_MULTICAST_IFACE);
|
2006-07-27 10:05:27 +00:00
|
|
|
udpsrc->buffer_size = UDP_DEFAULT_BUFFER_SIZE;
|
2006-09-29 11:09:40 +00:00
|
|
|
udpsrc->timeout = UDP_DEFAULT_TIMEOUT;
|
2007-03-02 12:56:13 +00:00
|
|
|
udpsrc->skip_first_bytes = UDP_DEFAULT_SKIP_FIRST_BYTES;
|
2012-01-17 08:03:38 +00:00
|
|
|
udpsrc->close_socket = UDP_DEFAULT_CLOSE_SOCKET;
|
|
|
|
udpsrc->external_socket = (udpsrc->socket != NULL);
|
2008-06-13 11:54:05 +00:00
|
|
|
udpsrc->auto_multicast = UDP_DEFAULT_AUTO_MULTICAST;
|
2012-01-17 08:03:38 +00:00
|
|
|
udpsrc->used_socket = UDP_DEFAULT_USED_SOCKET;
|
2010-07-06 16:11:21 +00:00
|
|
|
udpsrc->reuse = UDP_DEFAULT_REUSE;
|
2015-11-17 10:39:05 +00:00
|
|
|
udpsrc->loop = UDP_DEFAULT_LOOP;
|
2016-04-18 13:33:10 +00:00
|
|
|
udpsrc->retrieve_sender_address = UDP_DEFAULT_RETRIEVE_SENDER_ADDRESS;
|
2008-06-13 11:54:05 +00:00
|
|
|
|
|
|
|
/* configure basesrc to be a live source */
|
|
|
|
gst_base_src_set_live (GST_BASE_SRC (udpsrc), TRUE);
|
|
|
|
/* make basesrc output a segment in time */
|
2007-09-10 19:53:28 +00:00
|
|
|
gst_base_src_set_format (GST_BASE_SRC (udpsrc), GST_FORMAT_TIME);
|
2008-06-13 11:54:05 +00:00
|
|
|
/* make basesrc set timestamps on outgoing buffers based on the running_time
|
|
|
|
* when they were captured */
|
2007-09-10 19:53:28 +00:00
|
|
|
gst_base_src_set_do_timestamp (GST_BASE_SRC (udpsrc), TRUE);
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
2006-10-11 08:34:14 +00:00
|
|
|
static void
|
|
|
|
gst_udpsrc_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstUDPSrc *udpsrc;
|
|
|
|
|
|
|
|
udpsrc = GST_UDPSRC (object);
|
|
|
|
|
|
|
|
if (udpsrc->caps)
|
|
|
|
gst_caps_unref (udpsrc->caps);
|
2012-01-17 08:03:38 +00:00
|
|
|
udpsrc->caps = NULL;
|
2010-03-09 16:15:16 +00:00
|
|
|
|
2009-03-13 17:28:59 +00:00
|
|
|
g_free (udpsrc->multi_iface);
|
2012-01-17 08:03:38 +00:00
|
|
|
udpsrc->multi_iface = NULL;
|
2010-03-09 16:15:16 +00:00
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
g_free (udpsrc->uri);
|
|
|
|
udpsrc->uri = NULL;
|
2006-10-11 08:34:14 +00:00
|
|
|
|
2013-09-03 09:23:24 +00:00
|
|
|
g_free (udpsrc->address);
|
|
|
|
udpsrc->address = NULL;
|
2012-01-24 14:53:38 +00:00
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
if (udpsrc->socket)
|
|
|
|
g_object_unref (udpsrc->socket);
|
|
|
|
udpsrc->socket = NULL;
|
2008-08-20 11:51:38 +00:00
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
if (udpsrc->used_socket)
|
|
|
|
g_object_unref (udpsrc->used_socket);
|
|
|
|
udpsrc->used_socket = NULL;
|
|
|
|
|
2006-10-11 08:34:14 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2005-09-21 17:53:26 +00:00
|
|
|
static GstCaps *
|
2011-06-09 15:50:08 +00:00
|
|
|
gst_udpsrc_getcaps (GstBaseSrc * src, GstCaps * filter)
|
2005-09-21 17:53:26 +00:00
|
|
|
{
|
|
|
|
GstUDPSrc *udpsrc;
|
2014-03-24 13:25:28 +00:00
|
|
|
GstCaps *caps, *result;
|
2005-09-21 17:53:26 +00:00
|
|
|
|
|
|
|
udpsrc = GST_UDPSRC (src);
|
|
|
|
|
2014-03-24 13:25:28 +00:00
|
|
|
GST_OBJECT_LOCK (src);
|
|
|
|
if ((caps = udpsrc->caps))
|
|
|
|
gst_caps_ref (caps);
|
|
|
|
GST_OBJECT_UNLOCK (src);
|
|
|
|
|
|
|
|
if (caps) {
|
|
|
|
if (filter) {
|
|
|
|
result = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
} else {
|
|
|
|
result = caps;
|
|
|
|
}
|
2012-01-17 08:03:38 +00:00
|
|
|
} else {
|
2014-03-24 13:25:28 +00:00
|
|
|
result = (filter) ? gst_caps_ref (filter) : gst_caps_new_any ();
|
2012-01-17 08:03:38 +00:00
|
|
|
}
|
2014-03-24 13:25:28 +00:00
|
|
|
return result;
|
2009-02-23 19:49:37 +00:00
|
|
|
}
|
|
|
|
|
2014-09-09 11:15:43 +00:00
|
|
|
static void
|
|
|
|
gst_udpsrc_reset_memory_allocator (GstUDPSrc * src)
|
|
|
|
{
|
|
|
|
if (src->mem != NULL) {
|
|
|
|
gst_memory_unmap (src->mem, &src->map);
|
|
|
|
gst_memory_unref (src->mem);
|
|
|
|
src->mem = NULL;
|
|
|
|
}
|
|
|
|
if (src->mem_max != NULL) {
|
|
|
|
gst_memory_unmap (src->mem_max, &src->map_max);
|
|
|
|
gst_memory_unref (src->mem_max);
|
|
|
|
src->mem_max = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
src->vec[0].buffer = NULL;
|
|
|
|
src->vec[0].size = 0;
|
|
|
|
src->vec[1].buffer = NULL;
|
|
|
|
src->vec[1].size = 0;
|
|
|
|
|
|
|
|
if (src->allocator != NULL) {
|
|
|
|
gst_object_unref (src->allocator);
|
|
|
|
src->allocator = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-09 08:42:15 +00:00
|
|
|
static gboolean
|
|
|
|
gst_udpsrc_negotiate (GstBaseSrc * basesrc)
|
|
|
|
{
|
2014-09-09 11:15:43 +00:00
|
|
|
GstUDPSrc *src = GST_UDPSRC_CAST (basesrc);
|
2014-09-09 08:42:15 +00:00
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
/* just chain up to the default implementation, we just want to
|
|
|
|
* retrieve the allocator at the end of it (if there is one) */
|
|
|
|
ret = GST_BASE_SRC_CLASS (parent_class)->negotiate (basesrc);
|
|
|
|
|
|
|
|
if (ret) {
|
2014-09-09 11:15:43 +00:00
|
|
|
GstAllocationParams new_params;
|
|
|
|
GstAllocator *new_allocator = NULL;
|
2014-09-09 08:42:15 +00:00
|
|
|
|
2014-09-09 11:15:43 +00:00
|
|
|
/* retrieve new allocator */
|
|
|
|
gst_base_src_get_allocator (basesrc, &new_allocator, &new_params);
|
2014-09-09 08:42:15 +00:00
|
|
|
|
2014-09-09 11:15:43 +00:00
|
|
|
if (src->allocator != new_allocator ||
|
|
|
|
memcmp (&src->params, &new_params, sizeof (GstAllocationParams)) != 0) {
|
|
|
|
/* drop old allocator and throw away any memory allocated with it */
|
|
|
|
gst_udpsrc_reset_memory_allocator (src);
|
|
|
|
|
|
|
|
/* and save the new allocator and/or new allocation parameters */
|
|
|
|
src->allocator = new_allocator;
|
|
|
|
src->params = new_params;
|
2014-09-09 08:42:15 +00:00
|
|
|
|
2014-09-09 11:15:43 +00:00
|
|
|
GST_INFO_OBJECT (src, "new allocator: %" GST_PTR_FORMAT, new_allocator);
|
|
|
|
}
|
2014-09-09 08:42:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-09-09 11:15:43 +00:00
|
|
|
static gboolean
|
|
|
|
gst_udpsrc_alloc_mem (GstUDPSrc * src, GstMemory ** p_mem, GstMapInfo * map,
|
|
|
|
gsize size)
|
|
|
|
{
|
|
|
|
GstMemory *mem;
|
|
|
|
|
|
|
|
mem = gst_allocator_alloc (src->allocator, size, &src->params);
|
|
|
|
|
|
|
|
if (!gst_memory_map (mem, map, GST_MAP_WRITE)) {
|
|
|
|
gst_memory_unref (mem);
|
|
|
|
memset (map, 0, sizeof (GstMapInfo));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
*p_mem = mem;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_udpsrc_ensure_mem (GstUDPSrc * src)
|
|
|
|
{
|
|
|
|
if (src->mem == NULL) {
|
|
|
|
gsize mem_size = 1500; /* typical max. MTU */
|
|
|
|
|
|
|
|
/* if packets are likely to be smaller, just use that size, otherwise
|
|
|
|
* default to assuming incoming packets are around MTU size */
|
|
|
|
if (src->max_size > 0 && src->max_size < mem_size)
|
|
|
|
mem_size = src->max_size;
|
|
|
|
|
|
|
|
if (!gst_udpsrc_alloc_mem (src, &src->mem, &src->map, mem_size))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
src->vec[0].buffer = src->map.data;
|
|
|
|
src->vec[0].size = src->map.size;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (src->mem_max == NULL) {
|
|
|
|
gsize max_size = MAX_IPV4_UDP_PACKET_SIZE;
|
|
|
|
|
|
|
|
if (!gst_udpsrc_alloc_mem (src, &src->mem_max, &src->map_max, max_size))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
src->vec[1].buffer = src->map_max.data;
|
|
|
|
src->vec[1].size = src->map_max.size;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-05-19 17:13:16 +00:00
|
|
|
static void
|
|
|
|
gst_udpsrc_create_cancellable (GstUDPSrc * src)
|
|
|
|
{
|
|
|
|
GPollFD pollfd;
|
|
|
|
|
|
|
|
src->cancellable = g_cancellable_new ();
|
|
|
|
src->made_cancel_fd = g_cancellable_make_pollfd (src->cancellable, &pollfd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_udpsrc_free_cancellable (GstUDPSrc * src)
|
|
|
|
{
|
|
|
|
if (src->made_cancel_fd) {
|
|
|
|
g_cancellable_release_fd (src->cancellable);
|
|
|
|
src->made_cancel_fd = FALSE;
|
|
|
|
}
|
|
|
|
g_object_unref (src->cancellable);
|
|
|
|
src->cancellable = NULL;
|
|
|
|
}
|
|
|
|
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_udpsrc_create (GstPushSrc * psrc, GstBuffer ** buf)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
|
|
|
GstUDPSrc *udpsrc;
|
2013-12-19 16:50:10 +00:00
|
|
|
GstBuffer *outbuf = NULL;
|
2012-01-17 08:03:38 +00:00
|
|
|
GSocketAddress *saddr = NULL;
|
2016-04-18 13:33:10 +00:00
|
|
|
GSocketAddress **p_saddr;
|
2014-09-09 12:46:56 +00:00
|
|
|
gint flags = G_SOCKET_MSG_NONE;
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
gboolean try_again;
|
2012-01-17 08:03:38 +00:00
|
|
|
GError *err = NULL;
|
2014-09-09 12:46:56 +00:00
|
|
|
gssize res;
|
|
|
|
gsize offset;
|
2016-06-23 17:21:59 +00:00
|
|
|
GSocketControlMessage **msgs = NULL;
|
2016-11-12 22:34:23 +00:00
|
|
|
GSocketControlMessage ***p_msgs;
|
2016-06-23 17:21:59 +00:00
|
|
|
gint n_msgs = 0, i;
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2008-06-13 11:54:05 +00:00
|
|
|
udpsrc = GST_UDPSRC_CAST (psrc);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2014-09-09 11:15:43 +00:00
|
|
|
if (!gst_udpsrc_ensure_mem (udpsrc))
|
|
|
|
goto memory_alloc_error;
|
|
|
|
|
2017-02-14 22:13:30 +00:00
|
|
|
/* optimization: use messages only in multicast mode and
|
|
|
|
* if we can't let the kernel do the filtering for us */
|
2016-11-12 22:34:23 +00:00
|
|
|
p_msgs =
|
|
|
|
(g_inet_address_get_is_multicast (g_inet_socket_address_get_address
|
|
|
|
(udpsrc->addr))) ? &msgs : NULL;
|
2017-02-14 22:13:30 +00:00
|
|
|
#ifdef IP_MULTICAST_ALL
|
|
|
|
if (g_inet_address_get_family (g_inet_socket_address_get_address
|
|
|
|
(udpsrc->addr)) == G_SOCKET_FAMILY_IPV4)
|
|
|
|
p_msgs = NULL;
|
|
|
|
#endif
|
2016-11-12 22:34:23 +00:00
|
|
|
|
2016-04-18 13:33:10 +00:00
|
|
|
/* Retrieve sender address unless we've been configured not to do so */
|
|
|
|
p_saddr = (udpsrc->retrieve_sender_address) ? &saddr : NULL;
|
|
|
|
|
2007-10-18 17:04:14 +00:00
|
|
|
retry:
|
2016-11-14 11:13:14 +00:00
|
|
|
if (saddr != NULL) {
|
|
|
|
g_object_unref (saddr);
|
|
|
|
saddr = NULL;
|
|
|
|
}
|
2007-08-16 11:49:01 +00:00
|
|
|
|
2008-02-28 11:51:24 +00:00
|
|
|
do {
|
2012-12-12 10:08:13 +00:00
|
|
|
gint64 timeout;
|
|
|
|
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
try_again = FALSE;
|
|
|
|
|
2012-12-12 10:08:13 +00:00
|
|
|
if (udpsrc->timeout)
|
|
|
|
timeout = udpsrc->timeout / 1000;
|
|
|
|
else
|
|
|
|
timeout = -1;
|
|
|
|
|
2014-04-16 11:47:43 +00:00
|
|
|
GST_LOG_OBJECT (udpsrc, "doing select, timeout %" G_GINT64_FORMAT, timeout);
|
2006-09-29 11:09:40 +00:00
|
|
|
|
2012-12-12 10:08:13 +00:00
|
|
|
if (!g_socket_condition_timed_wait (udpsrc->used_socket, G_IO_IN | G_IO_PRI,
|
|
|
|
timeout, udpsrc->cancellable, &err)) {
|
2012-01-17 08:03:38 +00:00
|
|
|
if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_BUSY)
|
|
|
|
|| g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
|
2008-02-28 11:51:24 +00:00
|
|
|
goto stopped;
|
2012-01-17 08:03:38 +00:00
|
|
|
} else if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_TIMED_OUT)) {
|
2012-04-05 17:17:29 +00:00
|
|
|
g_clear_error (&err);
|
2012-01-17 08:03:38 +00:00
|
|
|
/* timeout, post element message */
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (udpsrc),
|
|
|
|
gst_message_new_element (GST_OBJECT_CAST (udpsrc),
|
|
|
|
gst_structure_new ("GstUDPSrcTimeout",
|
|
|
|
"timeout", G_TYPE_UINT64, udpsrc->timeout, NULL)));
|
|
|
|
} else {
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
goto select_error;
|
2012-01-17 08:03:38 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 11:09:40 +00:00
|
|
|
try_again = TRUE;
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
}
|
2008-06-13 11:54:05 +00:00
|
|
|
} while (G_UNLIKELY (try_again));
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2012-10-10 08:10:26 +00:00
|
|
|
res =
|
2016-04-18 13:33:10 +00:00
|
|
|
g_socket_receive_message (udpsrc->used_socket, p_saddr, udpsrc->vec, 2,
|
2016-11-12 22:34:23 +00:00
|
|
|
p_msgs, &n_msgs, &flags, udpsrc->cancellable, &err);
|
2012-01-17 08:03:38 +00:00
|
|
|
|
2012-11-09 10:20:27 +00:00
|
|
|
if (G_UNLIKELY (res < 0)) {
|
2015-09-04 09:01:52 +00:00
|
|
|
/* G_IO_ERROR_HOST_UNREACHABLE for a UDP socket means that a packet sent
|
|
|
|
* with udpsink generated a "port unreachable" ICMP response. We ignore
|
|
|
|
* that and try again.
|
|
|
|
* On Windows we get G_IO_ERROR_CONNECTION_CLOSED instead */
|
2015-09-04 12:18:05 +00:00
|
|
|
#if GLIB_CHECK_VERSION(2,44,0)
|
2015-09-04 09:01:52 +00:00
|
|
|
if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE) ||
|
|
|
|
g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CONNECTION_CLOSED)) {
|
2015-09-04 12:18:05 +00:00
|
|
|
#else
|
|
|
|
if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE)) {
|
|
|
|
#endif
|
2012-11-09 10:22:30 +00:00
|
|
|
g_clear_error (&err);
|
2012-11-09 10:20:27 +00:00
|
|
|
goto retry;
|
|
|
|
}
|
2012-01-17 08:03:38 +00:00
|
|
|
goto receive_error;
|
2012-11-09 10:20:27 +00:00
|
|
|
}
|
2002-12-15 22:45:53 +00:00
|
|
|
|
2014-09-09 08:42:15 +00:00
|
|
|
/* remember maximum packet size */
|
|
|
|
if (res > udpsrc->max_size)
|
|
|
|
udpsrc->max_size = res;
|
|
|
|
|
2016-06-23 17:21:59 +00:00
|
|
|
/* Retry if multicast and the destination address is not ours. We don't want
|
|
|
|
* to receive arbitrary packets */
|
2016-11-12 22:34:23 +00:00
|
|
|
if (p_msgs) {
|
2016-06-23 17:21:59 +00:00
|
|
|
GInetAddress *iaddr = g_inet_socket_address_get_address (udpsrc->addr);
|
|
|
|
gboolean skip_packet = FALSE;
|
|
|
|
gsize iaddr_size = g_inet_address_get_native_size (iaddr);
|
|
|
|
const guint8 *iaddr_bytes = g_inet_address_to_bytes (iaddr);
|
|
|
|
|
2016-11-12 22:34:23 +00:00
|
|
|
for (i = 0; i < n_msgs && !skip_packet; i++) {
|
2016-06-23 17:21:59 +00:00
|
|
|
#ifdef IP_PKTINFO
|
2016-11-12 22:34:23 +00:00
|
|
|
if (GST_IS_IP_PKTINFO_MESSAGE (msgs[i])) {
|
|
|
|
GstIPPktinfoMessage *msg = GST_IP_PKTINFO_MESSAGE (msgs[i]);
|
2016-06-23 17:21:59 +00:00
|
|
|
|
2016-11-12 22:34:23 +00:00
|
|
|
if (sizeof (msg->addr) == iaddr_size
|
|
|
|
&& memcmp (iaddr_bytes, &msg->addr, sizeof (msg->addr)))
|
|
|
|
skip_packet = TRUE;
|
|
|
|
}
|
2016-06-23 17:21:59 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPV6_PKTINFO
|
2016-11-12 22:34:23 +00:00
|
|
|
if (GST_IS_IPV6_PKTINFO_MESSAGE (msgs[i])) {
|
|
|
|
GstIPV6PktinfoMessage *msg = GST_IPV6_PKTINFO_MESSAGE (msgs[i]);
|
2016-06-23 17:21:59 +00:00
|
|
|
|
2016-11-12 22:34:23 +00:00
|
|
|
if (sizeof (msg->addr) == iaddr_size
|
|
|
|
&& memcmp (iaddr_bytes, &msg->addr, sizeof (msg->addr)))
|
|
|
|
skip_packet = TRUE;
|
|
|
|
}
|
2016-06-23 17:21:59 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IP_RECVDSTADDR
|
2016-11-12 22:34:23 +00:00
|
|
|
if (GST_IS_IP_RECVDSTADDR_MESSAGE (msgs[i])) {
|
|
|
|
GstIPRecvdstaddrMessage *msg = GST_IP_RECVDSTADDR_MESSAGE (msgs[i]);
|
2016-06-23 17:21:59 +00:00
|
|
|
|
2016-11-12 22:34:23 +00:00
|
|
|
if (sizeof (msg->addr) == iaddr_size
|
|
|
|
&& memcmp (iaddr_bytes, &msg->addr, sizeof (msg->addr)))
|
|
|
|
skip_packet = TRUE;
|
2016-06-23 17:21:59 +00:00
|
|
|
}
|
2016-11-12 22:34:23 +00:00
|
|
|
#endif
|
2016-06-23 17:21:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < n_msgs; i++) {
|
|
|
|
g_object_unref (msgs[i]);
|
|
|
|
}
|
|
|
|
g_free (msgs);
|
|
|
|
|
|
|
|
if (skip_packet) {
|
|
|
|
GST_DEBUG_OBJECT (udpsrc,
|
|
|
|
"Dropping packet for a different multicast address");
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-09 12:46:56 +00:00
|
|
|
outbuf = gst_buffer_new ();
|
|
|
|
|
|
|
|
/* append first memory chunk to buffer */
|
|
|
|
gst_buffer_append_memory (outbuf, udpsrc->mem);
|
2007-03-02 12:56:13 +00:00
|
|
|
|
2014-09-09 12:46:56 +00:00
|
|
|
/* if the packet didn't fit into the first chunk, add second one as well */
|
|
|
|
if (res > udpsrc->map.size) {
|
|
|
|
gst_buffer_append_memory (outbuf, udpsrc->mem_max);
|
|
|
|
gst_memory_unmap (udpsrc->mem_max, &udpsrc->map_max);
|
|
|
|
udpsrc->vec[1].buffer = NULL;
|
|
|
|
udpsrc->vec[1].size = 0;
|
|
|
|
udpsrc->mem_max = NULL;
|
2007-03-02 12:56:13 +00:00
|
|
|
}
|
2011-04-05 15:06:41 +00:00
|
|
|
|
2014-09-09 12:46:56 +00:00
|
|
|
/* make sure we allocate a new chunk next time (we do this only here because
|
|
|
|
* we look at map.size to see if the second memory chunk is needed above) */
|
|
|
|
gst_memory_unmap (udpsrc->mem, &udpsrc->map);
|
|
|
|
udpsrc->vec[0].buffer = NULL;
|
|
|
|
udpsrc->vec[0].size = 0;
|
|
|
|
udpsrc->mem = NULL;
|
|
|
|
|
|
|
|
offset = udpsrc->skip_first_bytes;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (offset > 0 && res < offset))
|
|
|
|
goto skip_error;
|
|
|
|
|
|
|
|
gst_buffer_resize (outbuf, offset, res - offset);
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
|
2011-02-28 12:14:37 +00:00
|
|
|
/* use buffer metadata so receivers can also track the address */
|
2012-01-17 08:03:38 +00:00
|
|
|
if (saddr) {
|
|
|
|
gst_buffer_add_net_address_meta (outbuf, saddr);
|
|
|
|
g_object_unref (saddr);
|
2014-09-09 12:46:56 +00:00
|
|
|
saddr = NULL;
|
gst/udp/gstudpnetutils.*: Provide a bunch of helper methods to deal with IPv4 and IPv6 transparently.
Original commit message from CVS:
Patch by: Bruno Santos <brunof at ua dot pt>
* gst/udp/gstudpnetutils.c: (gst_udp_get_addr),
(gst_udp_join_group), (gst_udp_leave_group),
(gst_udp_is_multicast):
* gst/udp/gstudpnetutils.h:
Provide a bunch of helper methods to deal with IPv4 and IPv6
transparently.
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_set_property),
(gst_multiudpsink_get_property), (join_multicast),
(gst_multiudpsink_init_send), (gst_multiudpsink_add_internal),
(gst_multiudpsink_remove):
* gst/udp/gstmultiudpsink.h:
Add multicast TTL and loopback properties.
Use the helper methods to implement ip4 and ip6.
* gst/udp/gstudpsrc.c: (gst_udpsrc_create), (gst_udpsrc_start):
* gst/udp/gstudpsrc.h:
Use the helper methods to implement ip4 and ip6.
Fixes #515962.
2008-05-21 09:56:02 +00:00
|
|
|
}
|
2012-01-17 08:03:38 +00:00
|
|
|
|
2014-09-09 12:46:56 +00:00
|
|
|
GST_LOG_OBJECT (udpsrc, "read packet of %d bytes", (int) res);
|
gst/udp/: Use NetBuffer and small cleanups.
Original commit message from CVS:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_init_send),
(gst_multiudpsink_add), (client_compare), (free_client),
(gst_multiudpsink_remove), (gst_multiudpsink_clear),
(gst_multiudpsink_get_stats):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
Use NetBuffer and small cleanups.
Implement client removal in multiudpsink.
2005-06-02 13:28:46 +00:00
|
|
|
|
2006-07-27 09:04:51 +00:00
|
|
|
*buf = GST_BUFFER_CAST (outbuf);
|
2002-12-15 22:45:53 +00:00
|
|
|
|
2014-09-09 12:46:56 +00:00
|
|
|
return GST_FLOW_OK;
|
2002-12-15 22:45:53 +00:00
|
|
|
|
2006-07-27 09:04:51 +00:00
|
|
|
/* ERRORS */
|
2014-09-09 11:15:43 +00:00
|
|
|
memory_alloc_error:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (udpsrc, RESOURCE, READ, (NULL),
|
|
|
|
("Failed to allocate or map memory"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
gst/udp/: Ported udp src/sink.
Original commit message from CVS:
* gst/udp/Makefile.am:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_init_send), (gst_udpsink_close),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_base_init),
(gst_udpsrc_class_init), (gst_udpsrc_init), (gst_udpsrc_loop),
(gst_udpsrc_set_property), (gst_udpsrc_get_property),
(gst_udpsrc_init_receive), (gst_udpsrc_close),
(gst_udpsrc_activate), (gst_udpsrc_change_state):
* gst/udp/gstudpsrc.h:
Ported udp src/sink.
2005-05-10 11:15:13 +00:00
|
|
|
select_error:
|
|
|
|
{
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
GST_ELEMENT_ERROR (udpsrc, RESOURCE, READ, (NULL),
|
2012-01-17 08:03:38 +00:00
|
|
|
("select error: %s", err->message));
|
|
|
|
g_clear_error (&err);
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
stopped:
|
|
|
|
{
|
|
|
|
GST_DEBUG ("stop called");
|
2012-04-05 17:17:29 +00:00
|
|
|
g_clear_error (&err);
|
2012-02-08 15:34:00 +00:00
|
|
|
return GST_FLOW_FLUSHING;
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
}
|
gst/udp/: Ported udp src/sink.
Original commit message from CVS:
* gst/udp/Makefile.am:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_init_send), (gst_udpsink_close),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_base_init),
(gst_udpsrc_class_init), (gst_udpsrc_init), (gst_udpsrc_loop),
(gst_udpsrc_set_property), (gst_udpsrc_get_property),
(gst_udpsrc_init_receive), (gst_udpsrc_close),
(gst_udpsrc_activate), (gst_udpsrc_change_state):
* gst/udp/gstudpsrc.h:
Ported udp src/sink.
2005-05-10 11:15:13 +00:00
|
|
|
receive_error:
|
|
|
|
{
|
2012-01-17 08:03:38 +00:00
|
|
|
if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_BUSY) ||
|
|
|
|
g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
|
|
|
|
g_clear_error (&err);
|
2012-02-08 15:34:00 +00:00
|
|
|
return GST_FLOW_FLUSHING;
|
2012-01-17 08:03:38 +00:00
|
|
|
} else {
|
|
|
|
GST_ELEMENT_ERROR (udpsrc, RESOURCE, READ, (NULL),
|
2012-10-22 13:54:17 +00:00
|
|
|
("receive error %" G_GSSIZE_FORMAT ": %s", res, err->message));
|
2012-01-17 08:03:38 +00:00
|
|
|
g_clear_error (&err);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
}
|
2007-03-02 12:56:13 +00:00
|
|
|
skip_error:
|
|
|
|
{
|
2012-10-10 08:10:26 +00:00
|
|
|
gst_buffer_unref (outbuf);
|
|
|
|
|
2007-03-02 12:56:13 +00:00
|
|
|
GST_ELEMENT_ERROR (udpsrc, STREAM, DECODE, (NULL),
|
|
|
|
("UDP buffer to small to skip header"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-13 18:50:51 +00:00
|
|
|
gst_udpsrc_set_uri (GstUDPSrc * src, const gchar * uri, GError ** error)
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
{
|
2013-09-03 09:23:24 +00:00
|
|
|
gchar *address;
|
2012-01-17 08:03:38 +00:00
|
|
|
guint16 port;
|
|
|
|
|
2013-09-03 09:23:24 +00:00
|
|
|
if (!gst_udp_parse_uri (uri, &address, &port))
|
2010-03-09 16:15:16 +00:00
|
|
|
goto wrong_uri;
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
|
2012-02-22 01:06:17 +00:00
|
|
|
if (port == (guint16) - 1)
|
2012-01-17 08:03:38 +00:00
|
|
|
port = UDP_DEFAULT_PORT;
|
|
|
|
|
2013-09-03 09:23:24 +00:00
|
|
|
g_free (src->address);
|
|
|
|
src->address = address;
|
2012-01-17 08:03:38 +00:00
|
|
|
src->port = port;
|
|
|
|
|
|
|
|
g_free (src->uri);
|
|
|
|
src->uri = g_strdup (uri);
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
2006-10-11 08:34:14 +00:00
|
|
|
/* ERRORS */
|
2010-03-09 16:15:16 +00:00
|
|
|
wrong_uri:
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
{
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
2010-03-09 16:15:16 +00:00
|
|
|
("error parsing uri %s", uri));
|
2011-11-13 18:50:51 +00:00
|
|
|
g_set_error_literal (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
|
|
|
|
"Could not parse UDP URI");
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_udpsrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2005-11-16 10:43:44 +00:00
|
|
|
GstUDPSrc *udpsrc = GST_UDPSRC (object);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2006-07-27 10:05:27 +00:00
|
|
|
case PROP_BUFFER_SIZE:
|
|
|
|
udpsrc->buffer_size = g_value_get_int (value);
|
2006-07-27 09:04:51 +00:00
|
|
|
break;
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
case PROP_PORT:
|
2012-01-17 08:03:38 +00:00
|
|
|
udpsrc->port = g_value_get_int (value);
|
|
|
|
g_free (udpsrc->uri);
|
2013-04-25 07:07:41 +00:00
|
|
|
udpsrc->uri =
|
2013-09-03 09:23:24 +00:00
|
|
|
g_strdup_printf ("udp://%s:%u", udpsrc->address, udpsrc->port);
|
2001-12-22 23:27:31 +00:00
|
|
|
break;
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
case PROP_MULTICAST_GROUP:
|
2013-09-03 09:23:24 +00:00
|
|
|
case PROP_ADDRESS:
|
2010-03-09 16:15:16 +00:00
|
|
|
{
|
|
|
|
const gchar *group;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2013-09-03 09:23:24 +00:00
|
|
|
g_free (udpsrc->address);
|
2010-03-09 16:15:16 +00:00
|
|
|
if ((group = g_value_get_string (value)))
|
2013-09-03 09:23:24 +00:00
|
|
|
udpsrc->address = g_strdup (group);
|
2003-06-09 23:13:40 +00:00
|
|
|
else
|
2013-09-03 09:23:24 +00:00
|
|
|
udpsrc->address = g_strdup (UDP_DEFAULT_MULTICAST_GROUP);
|
2012-01-17 08:03:38 +00:00
|
|
|
|
|
|
|
g_free (udpsrc->uri);
|
2013-04-25 07:07:41 +00:00
|
|
|
udpsrc->uri =
|
2013-09-03 09:23:24 +00:00
|
|
|
g_strdup_printf ("udp://%s:%u", udpsrc->address, udpsrc->port);
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
break;
|
2010-03-09 16:15:16 +00:00
|
|
|
}
|
2009-03-13 17:28:59 +00:00
|
|
|
case PROP_MULTICAST_IFACE:
|
|
|
|
g_free (udpsrc->multi_iface);
|
|
|
|
|
|
|
|
if (g_value_get_string (value) == NULL)
|
|
|
|
udpsrc->multi_iface = g_strdup (UDP_DEFAULT_MULTICAST_IFACE);
|
|
|
|
else
|
|
|
|
udpsrc->multi_iface = g_value_dup_string (value);
|
|
|
|
break;
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
case PROP_URI:
|
2011-11-13 18:50:51 +00:00
|
|
|
gst_udpsrc_set_uri (udpsrc, g_value_get_string (value), NULL);
|
2002-11-16 18:55:43 +00:00
|
|
|
break;
|
ext/amrnb/: Update caps with audio/AMR.
Original commit message from CVS:
* ext/amrnb/amrnbdec.c:
* ext/amrnb/amrnbenc.c: (gst_amrnbenc_setcaps):
* ext/amrnb/amrnbparse.c:
Update caps with audio/AMR.
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_init),
(gst_rtpamrdec_sink_setcaps), (gst_rtpamrdec_chain),
(gst_rtpamrdec_change_state):
* gst/rtp/gstrtpamrdec.h:
* gst/rtp/gstrtpamrenc.c: (gst_rtpamrenc_class_init),
(gst_rtpamrenc_init), (gst_rtpamrenc_chain):
Dont set FT headers twice, it was already in the encoded
bitstream.
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_send), (gst_rtspsrc_open),
(gst_rtspsrc_close), (gst_rtspsrc_play):
* gst/rtsp/rtspconnection.c: (parse_line):
Cleanups
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property):
* gst/udp/gstudpsrc.h:
Added caps property, we need this soon to type the buffers.
2005-08-19 12:44:35 +00:00
|
|
|
case PROP_CAPS:
|
|
|
|
{
|
|
|
|
const GstCaps *new_caps_val = gst_value_get_caps (value);
|
|
|
|
GstCaps *new_caps;
|
|
|
|
GstCaps *old_caps;
|
|
|
|
|
|
|
|
if (new_caps_val == NULL) {
|
|
|
|
new_caps = gst_caps_new_any ();
|
|
|
|
} else {
|
|
|
|
new_caps = gst_caps_copy (new_caps_val);
|
|
|
|
}
|
|
|
|
|
2014-03-24 13:25:28 +00:00
|
|
|
GST_OBJECT_LOCK (udpsrc);
|
ext/amrnb/: Update caps with audio/AMR.
Original commit message from CVS:
* ext/amrnb/amrnbdec.c:
* ext/amrnb/amrnbenc.c: (gst_amrnbenc_setcaps):
* ext/amrnb/amrnbparse.c:
Update caps with audio/AMR.
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_init),
(gst_rtpamrdec_sink_setcaps), (gst_rtpamrdec_chain),
(gst_rtpamrdec_change_state):
* gst/rtp/gstrtpamrdec.h:
* gst/rtp/gstrtpamrenc.c: (gst_rtpamrenc_class_init),
(gst_rtpamrenc_init), (gst_rtpamrenc_chain):
Dont set FT headers twice, it was already in the encoded
bitstream.
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_send), (gst_rtspsrc_open),
(gst_rtspsrc_close), (gst_rtspsrc_play):
* gst/rtsp/rtspconnection.c: (parse_line):
Cleanups
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property):
* gst/udp/gstudpsrc.h:
Added caps property, we need this soon to type the buffers.
2005-08-19 12:44:35 +00:00
|
|
|
old_caps = udpsrc->caps;
|
|
|
|
udpsrc->caps = new_caps;
|
2014-03-24 13:25:28 +00:00
|
|
|
GST_OBJECT_UNLOCK (udpsrc);
|
2005-09-21 12:19:24 +00:00
|
|
|
if (old_caps)
|
|
|
|
gst_caps_unref (old_caps);
|
2014-03-24 13:25:28 +00:00
|
|
|
|
|
|
|
gst_pad_mark_reconfigure (GST_BASE_SRC_PAD (udpsrc));
|
ext/amrnb/: Update caps with audio/AMR.
Original commit message from CVS:
* ext/amrnb/amrnbdec.c:
* ext/amrnb/amrnbenc.c: (gst_amrnbenc_setcaps):
* ext/amrnb/amrnbparse.c:
Update caps with audio/AMR.
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_init),
(gst_rtpamrdec_sink_setcaps), (gst_rtpamrdec_chain),
(gst_rtpamrdec_change_state):
* gst/rtp/gstrtpamrdec.h:
* gst/rtp/gstrtpamrenc.c: (gst_rtpamrenc_class_init),
(gst_rtpamrenc_init), (gst_rtpamrenc_chain):
Dont set FT headers twice, it was already in the encoded
bitstream.
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_send), (gst_rtspsrc_open),
(gst_rtspsrc_close), (gst_rtspsrc_play):
* gst/rtsp/rtspconnection.c: (parse_line):
Cleanups
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property):
* gst/udp/gstudpsrc.h:
Added caps property, we need this soon to type the buffers.
2005-08-19 12:44:35 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-01-17 08:03:38 +00:00
|
|
|
case PROP_SOCKET:
|
|
|
|
if (udpsrc->socket != NULL && udpsrc->socket != udpsrc->used_socket &&
|
|
|
|
udpsrc->close_socket) {
|
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
if (!g_socket_close (udpsrc->socket, &err)) {
|
|
|
|
GST_ERROR ("failed to close socket %p: %s", udpsrc->socket,
|
|
|
|
err->message);
|
|
|
|
g_clear_error (&err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (udpsrc->socket)
|
|
|
|
g_object_unref (udpsrc->socket);
|
|
|
|
udpsrc->socket = g_value_dup_object (value);
|
|
|
|
GST_DEBUG ("setting socket to %p", udpsrc->socket);
|
2006-01-07 20:01:09 +00:00
|
|
|
break;
|
2006-09-29 11:09:40 +00:00
|
|
|
case PROP_TIMEOUT:
|
|
|
|
udpsrc->timeout = g_value_get_uint64 (value);
|
|
|
|
break;
|
2007-03-02 12:56:13 +00:00
|
|
|
case PROP_SKIP_FIRST_BYTES:
|
|
|
|
udpsrc->skip_first_bytes = g_value_get_int (value);
|
|
|
|
break;
|
2012-01-17 08:03:38 +00:00
|
|
|
case PROP_CLOSE_SOCKET:
|
|
|
|
udpsrc->close_socket = g_value_get_boolean (value);
|
gst/udp/: Rework the socket allocation a bit based on the sockfd argument so that it becomes usable.
Original commit message from CVS:
Patch by: Laurent Glayal <spglegle at yahoo dot fr>
* gst/udp/gstdynudpsink.c: (gst_dynudpsink_class_init),
(gst_dynudpsink_init), (gst_dynudpsink_set_property),
(gst_dynudpsink_get_property), (gst_dynudpsink_init_send),
(gst_dynudpsink_close):
* gst/udp/gstdynudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_start), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Rework the socket allocation a bit based on the sockfd argument so that
it becomes usable.
Add a closefd property to instruct the udp elements to close the custom
file descriptors when going to READY. Fixes #423304.
API:GstUDPSrc::closefd property
API:GstDynUDPSink::closefd property
2007-03-29 09:59:23 +00:00
|
|
|
break;
|
2008-06-13 11:54:05 +00:00
|
|
|
case PROP_AUTO_MULTICAST:
|
|
|
|
udpsrc->auto_multicast = g_value_get_boolean (value);
|
|
|
|
break;
|
2010-07-06 16:11:21 +00:00
|
|
|
case PROP_REUSE:
|
|
|
|
udpsrc->reuse = g_value_get_boolean (value);
|
|
|
|
break;
|
2015-11-17 10:39:05 +00:00
|
|
|
case PROP_LOOP:
|
|
|
|
udpsrc->loop = g_value_get_boolean (value);
|
|
|
|
break;
|
2016-04-18 13:33:10 +00:00
|
|
|
case PROP_RETRIEVE_SENDER_ADDRESS:
|
|
|
|
udpsrc->retrieve_sender_address = g_value_get_boolean (value);
|
|
|
|
break;
|
2001-12-22 23:27:31 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_udpsrc_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2005-11-16 10:43:44 +00:00
|
|
|
GstUDPSrc *udpsrc = GST_UDPSRC (object);
|
2001-12-22 23:27:31 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2006-07-27 10:05:27 +00:00
|
|
|
case PROP_BUFFER_SIZE:
|
|
|
|
g_value_set_int (value, udpsrc->buffer_size);
|
2006-07-27 09:04:51 +00:00
|
|
|
break;
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
case PROP_PORT:
|
2012-01-17 08:03:38 +00:00
|
|
|
g_value_set_int (value, udpsrc->port);
|
2001-12-22 23:27:31 +00:00
|
|
|
break;
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
case PROP_MULTICAST_GROUP:
|
2013-09-03 09:23:24 +00:00
|
|
|
case PROP_ADDRESS:
|
|
|
|
g_value_set_string (value, udpsrc->address);
|
2003-06-09 23:13:40 +00:00
|
|
|
break;
|
2009-03-13 17:28:59 +00:00
|
|
|
case PROP_MULTICAST_IFACE:
|
|
|
|
g_value_set_string (value, udpsrc->multi_iface);
|
|
|
|
break;
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
case PROP_URI:
|
2012-01-24 14:52:09 +00:00
|
|
|
g_value_set_string (value, udpsrc->uri);
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
break;
|
ext/amrnb/: Update caps with audio/AMR.
Original commit message from CVS:
* ext/amrnb/amrnbdec.c:
* ext/amrnb/amrnbenc.c: (gst_amrnbenc_setcaps):
* ext/amrnb/amrnbparse.c:
Update caps with audio/AMR.
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_init),
(gst_rtpamrdec_sink_setcaps), (gst_rtpamrdec_chain),
(gst_rtpamrdec_change_state):
* gst/rtp/gstrtpamrdec.h:
* gst/rtp/gstrtpamrenc.c: (gst_rtpamrenc_class_init),
(gst_rtpamrenc_init), (gst_rtpamrenc_chain):
Dont set FT headers twice, it was already in the encoded
bitstream.
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_send), (gst_rtspsrc_open),
(gst_rtspsrc_close), (gst_rtspsrc_play):
* gst/rtsp/rtspconnection.c: (parse_line):
Cleanups
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property):
* gst/udp/gstudpsrc.h:
Added caps property, we need this soon to type the buffers.
2005-08-19 12:44:35 +00:00
|
|
|
case PROP_CAPS:
|
2014-03-24 13:25:28 +00:00
|
|
|
GST_OBJECT_LOCK (udpsrc);
|
ext/amrnb/: Update caps with audio/AMR.
Original commit message from CVS:
* ext/amrnb/amrnbdec.c:
* ext/amrnb/amrnbenc.c: (gst_amrnbenc_setcaps):
* ext/amrnb/amrnbparse.c:
Update caps with audio/AMR.
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_init),
(gst_rtpamrdec_sink_setcaps), (gst_rtpamrdec_chain),
(gst_rtpamrdec_change_state):
* gst/rtp/gstrtpamrdec.h:
* gst/rtp/gstrtpamrenc.c: (gst_rtpamrenc_class_init),
(gst_rtpamrenc_init), (gst_rtpamrenc_chain):
Dont set FT headers twice, it was already in the encoded
bitstream.
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_send), (gst_rtspsrc_open),
(gst_rtspsrc_close), (gst_rtspsrc_play):
* gst/rtsp/rtspconnection.c: (parse_line):
Cleanups
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property):
* gst/udp/gstudpsrc.h:
Added caps property, we need this soon to type the buffers.
2005-08-19 12:44:35 +00:00
|
|
|
gst_value_set_caps (value, udpsrc->caps);
|
2014-03-24 13:25:28 +00:00
|
|
|
GST_OBJECT_UNLOCK (udpsrc);
|
ext/amrnb/: Update caps with audio/AMR.
Original commit message from CVS:
* ext/amrnb/amrnbdec.c:
* ext/amrnb/amrnbenc.c: (gst_amrnbenc_setcaps):
* ext/amrnb/amrnbparse.c:
Update caps with audio/AMR.
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_init),
(gst_rtpamrdec_sink_setcaps), (gst_rtpamrdec_chain),
(gst_rtpamrdec_change_state):
* gst/rtp/gstrtpamrdec.h:
* gst/rtp/gstrtpamrenc.c: (gst_rtpamrenc_class_init),
(gst_rtpamrenc_init), (gst_rtpamrenc_chain):
Dont set FT headers twice, it was already in the encoded
bitstream.
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_send), (gst_rtspsrc_open),
(gst_rtspsrc_close), (gst_rtspsrc_play):
* gst/rtsp/rtspconnection.c: (parse_line):
Cleanups
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property):
* gst/udp/gstudpsrc.h:
Added caps property, we need this soon to type the buffers.
2005-08-19 12:44:35 +00:00
|
|
|
break;
|
2012-01-17 08:03:38 +00:00
|
|
|
case PROP_SOCKET:
|
|
|
|
g_value_set_object (value, udpsrc->socket);
|
2006-01-07 20:01:09 +00:00
|
|
|
break;
|
2006-09-29 11:09:40 +00:00
|
|
|
case PROP_TIMEOUT:
|
|
|
|
g_value_set_uint64 (value, udpsrc->timeout);
|
|
|
|
break;
|
2007-03-02 12:56:13 +00:00
|
|
|
case PROP_SKIP_FIRST_BYTES:
|
|
|
|
g_value_set_int (value, udpsrc->skip_first_bytes);
|
|
|
|
break;
|
2012-01-17 08:03:38 +00:00
|
|
|
case PROP_CLOSE_SOCKET:
|
|
|
|
g_value_set_boolean (value, udpsrc->close_socket);
|
gst/udp/: Rework the socket allocation a bit based on the sockfd argument so that it becomes usable.
Original commit message from CVS:
Patch by: Laurent Glayal <spglegle at yahoo dot fr>
* gst/udp/gstdynudpsink.c: (gst_dynudpsink_class_init),
(gst_dynudpsink_init), (gst_dynudpsink_set_property),
(gst_dynudpsink_get_property), (gst_dynudpsink_init_send),
(gst_dynudpsink_close):
* gst/udp/gstdynudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_start), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Rework the socket allocation a bit based on the sockfd argument so that
it becomes usable.
Add a closefd property to instruct the udp elements to close the custom
file descriptors when going to READY. Fixes #423304.
API:GstUDPSrc::closefd property
API:GstDynUDPSink::closefd property
2007-03-29 09:59:23 +00:00
|
|
|
break;
|
2012-01-17 08:03:38 +00:00
|
|
|
case PROP_USED_SOCKET:
|
|
|
|
g_value_set_object (value, udpsrc->used_socket);
|
2007-08-17 13:59:15 +00:00
|
|
|
break;
|
2008-06-13 11:54:05 +00:00
|
|
|
case PROP_AUTO_MULTICAST:
|
|
|
|
g_value_set_boolean (value, udpsrc->auto_multicast);
|
|
|
|
break;
|
2010-07-06 16:11:21 +00:00
|
|
|
case PROP_REUSE:
|
|
|
|
g_value_set_boolean (value, udpsrc->reuse);
|
|
|
|
break;
|
2015-11-17 10:39:05 +00:00
|
|
|
case PROP_LOOP:
|
|
|
|
g_value_set_boolean (value, udpsrc->loop);
|
|
|
|
break;
|
2016-04-18 13:33:10 +00:00
|
|
|
case PROP_RETRIEVE_SENDER_ADDRESS:
|
|
|
|
g_value_set_boolean (value, udpsrc->retrieve_sender_address);
|
|
|
|
break;
|
2001-12-22 23:27:31 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-02 14:02:37 +00:00
|
|
|
static GInetAddress *
|
|
|
|
gst_udpsrc_resolve (GstUDPSrc * src, const gchar * address)
|
|
|
|
{
|
|
|
|
GInetAddress *addr;
|
|
|
|
GError *err = NULL;
|
|
|
|
GResolver *resolver;
|
|
|
|
|
|
|
|
addr = g_inet_address_new_from_string (address);
|
|
|
|
if (!addr) {
|
|
|
|
GList *results;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (src, "resolving IP address for host %s", address);
|
|
|
|
resolver = g_resolver_get_default ();
|
|
|
|
results =
|
|
|
|
g_resolver_lookup_by_name (resolver, address, src->cancellable, &err);
|
|
|
|
if (!results)
|
|
|
|
goto name_resolve;
|
|
|
|
addr = G_INET_ADDRESS (g_object_ref (results->data));
|
|
|
|
|
|
|
|
g_resolver_free_addresses (results);
|
|
|
|
g_object_unref (resolver);
|
|
|
|
}
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
{
|
|
|
|
gchar *ip = g_inet_address_to_string (addr);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (src, "IP address for host %s is %s", address, ip);
|
|
|
|
g_free (ip);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return addr;
|
|
|
|
|
|
|
|
name_resolve:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (src, "Failed to resolve %s: %s", address, err->message);
|
|
|
|
g_clear_error (&err);
|
|
|
|
g_object_unref (resolver);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-03-19 04:10:05 +00:00
|
|
|
/* create a socket for sending to remote machine */
|
2001-12-22 23:27:31 +00:00
|
|
|
static gboolean
|
2014-03-24 14:15:34 +00:00
|
|
|
gst_udpsrc_open (GstUDPSrc * src)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2012-01-17 08:03:38 +00:00
|
|
|
GInetAddress *addr, *bind_addr;
|
|
|
|
GSocketAddress *bind_saddr;
|
|
|
|
GError *err = NULL;
|
|
|
|
|
2015-05-19 17:13:16 +00:00
|
|
|
gst_udpsrc_create_cancellable (src);
|
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
if (src->socket == NULL) {
|
gst/udp/: Rework the socket allocation a bit based on the sockfd argument so that it becomes usable.
Original commit message from CVS:
Patch by: Laurent Glayal <spglegle at yahoo dot fr>
* gst/udp/gstdynudpsink.c: (gst_dynudpsink_class_init),
(gst_dynudpsink_init), (gst_dynudpsink_set_property),
(gst_dynudpsink_get_property), (gst_dynudpsink_init_send),
(gst_dynudpsink_close):
* gst/udp/gstdynudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_start), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Rework the socket allocation a bit based on the sockfd argument so that
it becomes usable.
Add a closefd property to instruct the udp elements to close the custom
file descriptors when going to READY. Fixes #423304.
API:GstUDPSrc::closefd property
API:GstDynUDPSink::closefd property
2007-03-29 09:59:23 +00:00
|
|
|
/* need to allocate a socket */
|
2013-09-03 09:23:24 +00:00
|
|
|
GST_DEBUG_OBJECT (src, "allocating socket for %s:%d", src->address,
|
2013-04-25 07:07:41 +00:00
|
|
|
src->port);
|
2012-01-17 08:03:38 +00:00
|
|
|
|
2013-09-03 09:23:24 +00:00
|
|
|
addr = gst_udpsrc_resolve (src, src->address);
|
2013-09-02 14:02:37 +00:00
|
|
|
if (!addr)
|
|
|
|
goto name_resolve;
|
2010-06-18 14:49:08 +00:00
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
if ((src->used_socket =
|
|
|
|
g_socket_new (g_inet_address_get_family (addr),
|
|
|
|
G_SOCKET_TYPE_DATAGRAM, G_SOCKET_PROTOCOL_UDP, &err)) == NULL)
|
|
|
|
goto no_socket;
|
|
|
|
|
|
|
|
src->external_socket = FALSE;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (src, "got socket %p", src->used_socket);
|
|
|
|
|
|
|
|
if (src->addr)
|
|
|
|
g_object_unref (src->addr);
|
|
|
|
src->addr =
|
|
|
|
G_INET_SOCKET_ADDRESS (g_inet_socket_address_new (addr, src->port));
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (src, "binding on port %d", src->port);
|
|
|
|
|
2016-04-11 07:54:38 +00:00
|
|
|
/* For multicast, bind to ANY and join the multicast group later */
|
2012-01-17 08:03:38 +00:00
|
|
|
if (g_inet_address_get_is_multicast (addr))
|
|
|
|
bind_addr = g_inet_address_new_any (g_inet_address_get_family (addr));
|
|
|
|
else
|
|
|
|
bind_addr = G_INET_ADDRESS (g_object_ref (addr));
|
|
|
|
|
|
|
|
g_object_unref (addr);
|
|
|
|
|
|
|
|
bind_saddr = g_inet_socket_address_new (bind_addr, src->port);
|
|
|
|
g_object_unref (bind_addr);
|
|
|
|
if (!g_socket_bind (src->used_socket, bind_saddr, src->reuse, &err))
|
2006-01-07 20:01:09 +00:00
|
|
|
goto bind_error;
|
2008-06-25 08:12:18 +00:00
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
g_object_unref (bind_saddr);
|
2015-11-17 10:39:05 +00:00
|
|
|
g_socket_set_multicast_loopback (src->used_socket, src->loop);
|
gst/udp/: Rework the socket allocation a bit based on the sockfd argument so that it becomes usable.
Original commit message from CVS:
Patch by: Laurent Glayal <spglegle at yahoo dot fr>
* gst/udp/gstdynudpsink.c: (gst_dynudpsink_class_init),
(gst_dynudpsink_init), (gst_dynudpsink_set_property),
(gst_dynudpsink_get_property), (gst_dynudpsink_init_send),
(gst_dynudpsink_close):
* gst/udp/gstdynudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_start), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Rework the socket allocation a bit based on the sockfd argument so that
it becomes usable.
Add a closefd property to instruct the udp elements to close the custom
file descriptors when going to READY. Fixes #423304.
API:GstUDPSrc::closefd property
API:GstDynUDPSink::closefd property
2007-03-29 09:59:23 +00:00
|
|
|
} else {
|
2016-03-04 12:07:19 +00:00
|
|
|
GInetSocketAddress *local_addr;
|
|
|
|
|
2012-01-26 15:05:34 +00:00
|
|
|
GST_DEBUG_OBJECT (src, "using provided socket %p", src->socket);
|
2008-06-13 11:54:05 +00:00
|
|
|
/* we use the configured socket, try to get some info about it */
|
2012-01-17 08:03:38 +00:00
|
|
|
src->used_socket = G_SOCKET (g_object_ref (src->socket));
|
|
|
|
src->external_socket = TRUE;
|
|
|
|
|
2016-03-04 12:07:19 +00:00
|
|
|
local_addr =
|
2012-01-17 08:03:38 +00:00
|
|
|
G_INET_SOCKET_ADDRESS (g_socket_get_local_address (src->used_socket,
|
|
|
|
&err));
|
2016-03-04 12:07:19 +00:00
|
|
|
if (!local_addr)
|
2008-06-13 11:54:05 +00:00
|
|
|
goto getsockname_error;
|
2016-03-04 12:07:19 +00:00
|
|
|
|
|
|
|
addr = gst_udpsrc_resolve (src, src->address);
|
|
|
|
if (!addr)
|
|
|
|
goto name_resolve;
|
|
|
|
|
2016-04-11 07:54:38 +00:00
|
|
|
/* If bound to ANY and address points to a multicast address, make
|
|
|
|
* sure that address is not overridden with ANY but we have the
|
|
|
|
* opportunity later to join the multicast address. This ensures that we
|
|
|
|
* have the same behaviour as for sockets created by udpsrc */
|
2016-03-04 12:07:19 +00:00
|
|
|
if (!src->auto_multicast ||
|
|
|
|
!g_inet_address_get_is_any (g_inet_socket_address_get_address
|
|
|
|
(local_addr))
|
|
|
|
|| !g_inet_address_get_is_multicast (addr)) {
|
|
|
|
g_object_unref (addr);
|
|
|
|
if (src->addr)
|
|
|
|
g_object_unref (src->addr);
|
|
|
|
src->addr = local_addr;
|
|
|
|
} else {
|
|
|
|
g_object_unref (local_addr);
|
|
|
|
if (src->addr)
|
|
|
|
g_object_unref (src->addr);
|
|
|
|
src->addr =
|
|
|
|
G_INET_SOCKET_ADDRESS (g_inet_socket_address_new (addr, src->port));
|
|
|
|
g_object_unref (addr);
|
|
|
|
}
|
2006-01-07 20:01:09 +00:00
|
|
|
}
|
2001-12-22 23:27:31 +00:00
|
|
|
|
2013-02-15 14:11:36 +00:00
|
|
|
{
|
|
|
|
gint val = 0;
|
|
|
|
|
|
|
|
if (src->buffer_size != 0) {
|
|
|
|
GError *opt_err = NULL;
|
|
|
|
|
|
|
|
GST_INFO_OBJECT (src, "setting udp buffer of %d bytes", src->buffer_size);
|
|
|
|
/* set buffer size, Note that on Linux this is typically limited to a
|
|
|
|
* maximum of around 100K. Also a minimum of 128 bytes is required on
|
|
|
|
* Linux. */
|
|
|
|
if (!g_socket_set_option (src->used_socket, SOL_SOCKET, SO_RCVBUF,
|
|
|
|
src->buffer_size, &opt_err)) {
|
|
|
|
GST_ELEMENT_WARNING (src, RESOURCE, SETTINGS, (NULL),
|
|
|
|
("Could not create a buffer of requested %d bytes: %s",
|
|
|
|
src->buffer_size, opt_err->message));
|
|
|
|
g_error_free (opt_err);
|
|
|
|
opt_err = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read the value of the receive buffer. Note that on linux this returns
|
|
|
|
* 2x the value we set because the kernel allocates extra memory for
|
|
|
|
* metadata. The default on Linux is about 100K (which is about 50K
|
|
|
|
* without metadata) */
|
|
|
|
if (g_socket_get_option (src->used_socket, SOL_SOCKET, SO_RCVBUF, &val,
|
|
|
|
NULL)) {
|
|
|
|
GST_INFO_OBJECT (src, "have udp buffer of %d bytes", val);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (src, "could not get udp buffer size");
|
|
|
|
}
|
|
|
|
}
|
2009-02-23 19:49:37 +00:00
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
g_socket_set_broadcast (src->used_socket, TRUE);
|
|
|
|
|
|
|
|
if (src->auto_multicast
|
|
|
|
&&
|
|
|
|
g_inet_address_get_is_multicast (g_inet_socket_address_get_address
|
|
|
|
(src->addr))) {
|
2016-12-13 02:11:07 +00:00
|
|
|
|
|
|
|
if (src->multi_iface) {
|
|
|
|
GStrv multi_ifaces = g_strsplit (src->multi_iface, ",", -1);
|
|
|
|
gchar **ifaces = multi_ifaces;
|
|
|
|
while (*ifaces) {
|
|
|
|
g_strstrip (*ifaces);
|
|
|
|
GST_DEBUG_OBJECT (src, "joining multicast group %s interface %s",
|
|
|
|
src->address, *ifaces);
|
|
|
|
if (!g_socket_join_multicast_group (src->used_socket,
|
|
|
|
g_inet_socket_address_get_address (src->addr),
|
|
|
|
FALSE, *ifaces, &err)) {
|
|
|
|
g_strfreev (multi_ifaces);
|
|
|
|
goto membership;
|
|
|
|
}
|
|
|
|
|
|
|
|
ifaces++;
|
|
|
|
}
|
|
|
|
g_strfreev (multi_ifaces);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (src, "joining multicast group %s", src->address);
|
|
|
|
if (!g_socket_join_multicast_group (src->used_socket,
|
|
|
|
g_inet_socket_address_get_address (src->addr), FALSE, NULL, &err))
|
|
|
|
goto membership;
|
|
|
|
}
|
2016-06-23 17:21:59 +00:00
|
|
|
|
|
|
|
if (g_inet_address_get_family (g_inet_socket_address_get_address
|
|
|
|
(src->addr)) == G_SOCKET_FAMILY_IPV4) {
|
2017-02-14 22:13:30 +00:00
|
|
|
#if defined(IP_MULTICAST_ALL)
|
|
|
|
if (!g_socket_set_option (src->used_socket, IPPROTO_IP, IP_MULTICAST_ALL,
|
|
|
|
0, &err)) {
|
|
|
|
GST_WARNING_OBJECT (src, "Failed to disable IP_MULTICAST_ALL: %s",
|
|
|
|
err->message);
|
|
|
|
g_clear_error (&err);
|
|
|
|
}
|
|
|
|
#elif defined(IP_PKTINFO)
|
2016-06-23 17:21:59 +00:00
|
|
|
if (!g_socket_set_option (src->used_socket, IPPROTO_IP, IP_PKTINFO, TRUE,
|
|
|
|
&err)) {
|
|
|
|
GST_WARNING_OBJECT (src, "Failed to enable IP_PKTINFO: %s",
|
|
|
|
err->message);
|
|
|
|
g_clear_error (&err);
|
|
|
|
}
|
|
|
|
#elif defined(IP_RECVDSTADDR)
|
|
|
|
if (!g_socket_set_option (src->used_socket, IPPROTO_IP, IP_RECVDSTADDR,
|
|
|
|
TRUE, &err)) {
|
|
|
|
GST_WARNING_OBJECT (src, "Failed to enable IP_RECVDSTADDR: %s",
|
|
|
|
err->message);
|
|
|
|
g_clear_error (&err);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#pragma message("No API available for getting IPv4 destination address")
|
|
|
|
GST_WARNING_OBJECT (src, "No API available for getting IPv4 destination "
|
|
|
|
"address, will receive packets for every destination to our port");
|
|
|
|
#endif
|
|
|
|
} else
|
|
|
|
if (g_inet_address_get_family (g_inet_socket_address_get_address
|
|
|
|
(src->addr)) == G_SOCKET_FAMILY_IPV6) {
|
|
|
|
#ifdef IPV6_PKTINFO
|
|
|
|
#ifdef IPV6_RECVPKTINFO
|
|
|
|
if (!g_socket_set_option (src->used_socket, IPPROTO_IPV6,
|
|
|
|
IPV6_RECVPKTINFO, TRUE, &err)) {
|
|
|
|
#else
|
|
|
|
if (!g_socket_set_option (src->used_socket, IPPROTO_IPV6, IPV6_PKTINFO,
|
|
|
|
TRUE, &err)) {
|
|
|
|
#endif
|
|
|
|
GST_WARNING_OBJECT (src, "Failed to enable IPV6_PKTINFO: %s",
|
|
|
|
err->message);
|
|
|
|
g_clear_error (&err);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#pragma message("No API available for getting IPv6 destination address")
|
|
|
|
GST_WARNING_OBJECT (src, "No API available for getting IPv6 destination "
|
|
|
|
"address, will receive packets for every destination to our port");
|
|
|
|
#endif
|
|
|
|
}
|
2008-06-13 11:54:05 +00:00
|
|
|
}
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
|
gst/udp/gstudpnetutils.*: Provide a bunch of helper methods to deal with IPv4 and IPv6 transparently.
Original commit message from CVS:
Patch by: Bruno Santos <brunof at ua dot pt>
* gst/udp/gstudpnetutils.c: (gst_udp_get_addr),
(gst_udp_join_group), (gst_udp_leave_group),
(gst_udp_is_multicast):
* gst/udp/gstudpnetutils.h:
Provide a bunch of helper methods to deal with IPv4 and IPv6
transparently.
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_set_property),
(gst_multiudpsink_get_property), (join_multicast),
(gst_multiudpsink_init_send), (gst_multiudpsink_add_internal),
(gst_multiudpsink_remove):
* gst/udp/gstmultiudpsink.h:
Add multicast TTL and loopback properties.
Use the helper methods to implement ip4 and ip6.
* gst/udp/gstudpsrc.c: (gst_udpsrc_create), (gst_udpsrc_start):
* gst/udp/gstudpsrc.h:
Use the helper methods to implement ip4 and ip6.
Fixes #515962.
2008-05-21 09:56:02 +00:00
|
|
|
/* NOTE: sockaddr_in.sin_port works for ipv4 and ipv6 because sin_port
|
|
|
|
* follows ss_family on both */
|
2012-01-17 08:03:38 +00:00
|
|
|
{
|
|
|
|
GInetSocketAddress *addr;
|
|
|
|
guint16 port;
|
2006-07-27 09:04:51 +00:00
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
addr =
|
|
|
|
G_INET_SOCKET_ADDRESS (g_socket_get_local_address (src->used_socket,
|
|
|
|
&err));
|
|
|
|
if (!addr)
|
|
|
|
goto getsockname_error;
|
2008-02-28 11:51:24 +00:00
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
port = g_inet_socket_address_get_port (addr);
|
|
|
|
GST_DEBUG_OBJECT (src, "bound, on port %d", port);
|
|
|
|
if (port != src->port) {
|
|
|
|
src->port = port;
|
|
|
|
GST_DEBUG_OBJECT (src, "notifying port %d", port);
|
|
|
|
g_object_notify (G_OBJECT (src), "port");
|
|
|
|
}
|
|
|
|
g_object_unref (addr);
|
|
|
|
}
|
2008-02-28 11:51:24 +00:00
|
|
|
|
2014-09-09 08:42:15 +00:00
|
|
|
src->allocator = NULL;
|
|
|
|
gst_allocation_params_init (&src->params);
|
|
|
|
|
|
|
|
src->max_size = 0;
|
|
|
|
|
2001-12-22 23:27:31 +00:00
|
|
|
return TRUE;
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
/* ERRORS */
|
2012-01-17 08:03:38 +00:00
|
|
|
name_resolve:
|
gst/udp/gstudpnetutils.*: Provide a bunch of helper methods to deal with IPv4 and IPv6 transparently.
Original commit message from CVS:
Patch by: Bruno Santos <brunof at ua dot pt>
* gst/udp/gstudpnetutils.c: (gst_udp_get_addr),
(gst_udp_join_group), (gst_udp_leave_group),
(gst_udp_is_multicast):
* gst/udp/gstudpnetutils.h:
Provide a bunch of helper methods to deal with IPv4 and IPv6
transparently.
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_set_property),
(gst_multiudpsink_get_property), (join_multicast),
(gst_multiudpsink_init_send), (gst_multiudpsink_add_internal),
(gst_multiudpsink_remove):
* gst/udp/gstmultiudpsink.h:
Add multicast TTL and loopback properties.
Use the helper methods to implement ip4 and ip6.
* gst/udp/gstudpsrc.c: (gst_udpsrc_create), (gst_udpsrc_start):
* gst/udp/gstudpsrc.h:
Use the helper methods to implement ip4 and ip6.
Fixes #515962.
2008-05-21 09:56:02 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
no_socket:
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
{
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
|
2012-01-17 08:03:38 +00:00
|
|
|
("no socket error: %s", err->message));
|
|
|
|
g_clear_error (&err);
|
|
|
|
g_object_unref (addr);
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
return FALSE;
|
2003-04-06 22:20:42 +00:00
|
|
|
}
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
bind_error:
|
|
|
|
{
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
|
2012-01-17 08:03:38 +00:00
|
|
|
("bind failed: %s", err->message));
|
|
|
|
g_clear_error (&err);
|
|
|
|
g_object_unref (bind_saddr);
|
2014-03-24 14:15:34 +00:00
|
|
|
gst_udpsrc_close (src);
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
membership:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
|
2012-01-17 08:03:38 +00:00
|
|
|
("could add membership: %s", err->message));
|
|
|
|
g_clear_error (&err);
|
2014-03-24 14:15:34 +00:00
|
|
|
gst_udpsrc_close (src);
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
getsockname_error:
|
|
|
|
{
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
|
2012-01-17 08:03:38 +00:00
|
|
|
("getsockname failed: %s", err->message));
|
|
|
|
g_clear_error (&err);
|
2014-03-24 14:15:34 +00:00
|
|
|
gst_udpsrc_close (src);
|
2008-02-28 11:51:24 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
|
|
|
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
static gboolean
|
|
|
|
gst_udpsrc_unlock (GstBaseSrc * bsrc)
|
|
|
|
{
|
|
|
|
GstUDPSrc *src;
|
|
|
|
|
|
|
|
src = GST_UDPSRC (bsrc);
|
|
|
|
|
2008-02-28 11:51:24 +00:00
|
|
|
GST_LOG_OBJECT (src, "Flushing");
|
2012-01-17 08:03:38 +00:00
|
|
|
g_cancellable_cancel (src->cancellable);
|
2007-05-21 10:07:05 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_udpsrc_unlock_stop (GstBaseSrc * bsrc)
|
|
|
|
{
|
|
|
|
GstUDPSrc *src;
|
|
|
|
|
|
|
|
src = GST_UDPSRC (bsrc);
|
|
|
|
|
2008-02-28 11:51:24 +00:00
|
|
|
GST_LOG_OBJECT (src, "No longer flushing");
|
2015-05-19 17:13:16 +00:00
|
|
|
|
|
|
|
gst_udpsrc_free_cancellable (src);
|
|
|
|
gst_udpsrc_create_cancellable (src);
|
gst/udp/: Added multifdsink to send UDP to multiple addresses.
Original commit message from CVS:
* gst/udp/.cvsignore:
* gst/udp/Makefile.am:
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_get_type),
(gst_multiudpsink_base_init), (gst_multiudpsink_class_init),
(gst_multiudpsink_init), (gst_multiudpsink_finalize),
(gst_multiudpsink_get_times), (gst_multiudpsink_render),
(gst_multiudpsink_set_property), (gst_multiudpsink_get_property),
(gst_multiudpsink_init_send), (gst_multiudpsink_close),
(gst_multiudpsink_add), (gst_multiudpsink_remove),
(gst_multiudpsink_clear), (gst_multiudpsink_get_stats),
(gst_multiudpsink_change_state):
* gst/udp/gstmultiudpsink.h:
* gst/udp/gstudp-marshal.list:
* gst/udp/gstudp.c: (plugin_init):
* gst/udp/gstudp.h:
* gst/udp/gstudpsink.c: (gst_udpsink_get_type),
(gst_udpsink_base_init), (gst_udpsink_class_init),
(gst_udpsink_init), (gst_udpsink_set_uri),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_uri_get_type), (gst_udpsink_uri_get_protocols),
(gst_udpsink_uri_get_uri), (gst_udpsink_uri_set_uri),
(gst_udpsink_uri_handler_init):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_unlock), (gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Added multifdsink to send UDP to multiple addresses.
Cleaned up UDP source/sink elements some more.
Make UDP sink extends from multiudpsink.
2005-05-12 15:32:51 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
static gboolean
|
2014-03-24 14:15:34 +00:00
|
|
|
gst_udpsrc_close (GstUDPSrc * src)
|
2001-12-22 23:27:31 +00:00
|
|
|
{
|
2014-03-24 14:15:34 +00:00
|
|
|
GST_DEBUG ("closing sockets");
|
2006-09-29 11:09:40 +00:00
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
if (src->used_socket) {
|
|
|
|
if (src->auto_multicast
|
|
|
|
&&
|
|
|
|
g_inet_address_get_is_multicast (g_inet_socket_address_get_address
|
|
|
|
(src->addr))) {
|
|
|
|
GError *err = NULL;
|
|
|
|
|
2016-12-13 02:11:07 +00:00
|
|
|
if (src->multi_iface) {
|
|
|
|
GStrv multi_ifaces = g_strsplit (src->multi_iface, ",", -1);
|
|
|
|
gchar **ifaces = multi_ifaces;
|
|
|
|
while (*ifaces) {
|
|
|
|
g_strstrip (*ifaces);
|
|
|
|
GST_DEBUG_OBJECT (src, "leaving multicast group %s interface %s",
|
|
|
|
src->address, *ifaces);
|
|
|
|
if (!g_socket_leave_multicast_group (src->used_socket,
|
|
|
|
g_inet_socket_address_get_address (src->addr),
|
|
|
|
FALSE, *ifaces, &err)) {
|
|
|
|
GST_ERROR_OBJECT (src, "Failed to leave multicast group: %s",
|
|
|
|
err->message);
|
|
|
|
g_clear_error (&err);
|
|
|
|
}
|
|
|
|
ifaces++;
|
|
|
|
}
|
|
|
|
g_strfreev (multi_ifaces);
|
2012-01-17 08:03:38 +00:00
|
|
|
|
2016-12-13 02:11:07 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (src, "leaving multicast group %s", src->address);
|
|
|
|
if (!g_socket_leave_multicast_group (src->used_socket,
|
|
|
|
g_inet_socket_address_get_address (src->addr), FALSE,
|
|
|
|
NULL, &err)) {
|
|
|
|
GST_ERROR_OBJECT (src, "Failed to leave multicast group: %s",
|
|
|
|
err->message);
|
|
|
|
g_clear_error (&err);
|
|
|
|
}
|
2012-01-17 08:03:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (src->close_socket || !src->external_socket) {
|
|
|
|
GError *err = NULL;
|
|
|
|
if (!g_socket_close (src->used_socket, &err)) {
|
|
|
|
GST_ERROR_OBJECT (src, "Failed to close socket: %s", err->message);
|
|
|
|
g_clear_error (&err);
|
|
|
|
}
|
2008-06-13 11:54:05 +00:00
|
|
|
}
|
2005-11-25 18:03:24 +00:00
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
g_object_unref (src->used_socket);
|
|
|
|
src->used_socket = NULL;
|
|
|
|
g_object_unref (src->addr);
|
|
|
|
src->addr = NULL;
|
2005-11-25 18:03:24 +00:00
|
|
|
}
|
2006-07-24 11:48:03 +00:00
|
|
|
|
2014-09-09 11:15:43 +00:00
|
|
|
gst_udpsrc_reset_memory_allocator (src);
|
2014-09-09 08:42:15 +00:00
|
|
|
|
2015-05-19 17:13:16 +00:00
|
|
|
gst_udpsrc_free_cancellable (src);
|
|
|
|
|
gst/: Make UDP and TCP elements use PushSrc.
Original commit message from CVS:
* gst/rtsp/README:
* gst/tcp/gsttcpclientsrc.c: (gst_tcpclientsrc_get_type),
(gst_tcpclientsrc_base_init), (gst_tcpclientsrc_class_init),
(gst_tcpclientsrc_init), (gst_tcpclientsrc_getcaps),
(gst_tcpclientsrc_stop), (gst_tcpclientsrc_eos),
(gst_tcpclientsrc_create), (gst_tcpclientsrc_start):
* gst/tcp/gsttcpclientsrc.h:
* gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_get_type),
(gst_tcpserversrc_base_init), (gst_tcpserversrc_class_init),
(gst_tcpserversrc_init), (gst_tcpserversrc_create),
(gst_tcpserversrc_start), (gst_tcpserversrc_stop):
* gst/tcp/gsttcpserversrc.h:
* gst/tcp/gsttcpsrc.c: (gst_tcpsrc_get_type),
(gst_tcpsrc_base_init), (gst_tcpsrc_class_init), (gst_tcpsrc_init),
(gst_tcpsrc_create), (gst_tcpsrc_start), (gst_tcpsrc_stop):
* gst/tcp/gsttcpsrc.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_init), (gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_set_property), (gst_udpsink_get_property),
(gst_udpsink_change_state):
* gst/udp/gstudpsink.h:
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_create), (gst_udpsrc_set_uri), (gst_udpsrc_start),
(gst_udpsrc_stop):
* gst/udp/gstudpsrc.h:
Make UDP and TCP elements use PushSrc.
2005-05-12 10:45:25 +00:00
|
|
|
return TRUE;
|
2001-12-22 23:27:31 +00:00
|
|
|
}
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
|
2014-03-24 14:15:34 +00:00
|
|
|
|
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_udpsrc_change_state (GstElement * element, GstStateChange transition)
|
|
|
|
{
|
|
|
|
GstUDPSrc *src;
|
|
|
|
GstStateChangeReturn result;
|
|
|
|
|
|
|
|
src = GST_UDPSRC (element);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
|
|
|
if (!gst_udpsrc_open (src))
|
|
|
|
goto open_failed;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ((result =
|
|
|
|
GST_ELEMENT_CLASS (parent_class)->change_state (element,
|
|
|
|
transition)) == GST_STATE_CHANGE_FAILURE)
|
|
|
|
goto failure;
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
|
|
|
gst_udpsrc_close (src);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
/* ERRORS */
|
|
|
|
open_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (src, "failed to open socket");
|
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
|
|
|
failure:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (src, "parent failed state change");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
/*** GSTURIHANDLER INTERFACE *************************************************/
|
|
|
|
|
2006-10-16 18:22:47 +00:00
|
|
|
static GstURIType
|
2011-07-04 16:15:42 +00:00
|
|
|
gst_udpsrc_uri_get_type (GType type)
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
{
|
|
|
|
return GST_URI_SRC;
|
|
|
|
}
|
2008-06-25 08:12:18 +00:00
|
|
|
|
2011-11-13 23:42:44 +00:00
|
|
|
static const gchar *const *
|
2011-07-04 16:15:42 +00:00
|
|
|
gst_udpsrc_uri_get_protocols (GType type)
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
{
|
2011-11-13 23:42:44 +00:00
|
|
|
static const gchar *protocols[] = { "udp", NULL };
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
|
|
|
|
return protocols;
|
|
|
|
}
|
|
|
|
|
2011-11-13 18:50:51 +00:00
|
|
|
static gchar *
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
gst_udpsrc_uri_get_uri (GstURIHandler * handler)
|
|
|
|
{
|
|
|
|
GstUDPSrc *src = GST_UDPSRC (handler);
|
|
|
|
|
2012-01-17 08:03:38 +00:00
|
|
|
return g_strdup (src->uri);
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-13 18:50:51 +00:00
|
|
|
gst_udpsrc_uri_set_uri (GstURIHandler * handler, const gchar * uri,
|
|
|
|
GError ** error)
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
{
|
2011-11-13 18:50:51 +00:00
|
|
|
return gst_udpsrc_set_uri (GST_UDPSRC (handler), uri, error);
|
gst/: UDP fixes, added uri handler.
Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpdec.c: (gst_rtpdec_get_type),
(gst_rtpdec_class_init), (gst_rtpdec_init), (gst_rtpdec_chain_rtp),
(gst_rtpdec_chain_rtcp), (gst_rtpdec_set_property),
(gst_rtpdec_get_property), (gst_rtpdec_change_state),
(gst_rtpdec_plugin_init):
* gst/rtp/gstrtpdec.h:
* gst/udp/gstudpsink.c: (gst_udpsink_base_init),
(gst_udpsink_get_times), (gst_udpsink_render),
(gst_udpsink_change_state):
* gst/udp/gstudpsrc.c: (gst_udpsrc_get_type),
(gst_udpsrc_base_init), (gst_udpsrc_class_init), (gst_udpsrc_init),
(gst_udpsrc_loop), (gst_udpsrc_set_uri), (gst_udpsrc_set_property),
(gst_udpsrc_get_property), (gst_udpsrc_init_receive),
(gst_udpsrc_activate), (gst_udpsrc_change_state),
(gst_udpsrc_uri_get_type), (gst_udpsrc_uri_get_protocols),
(gst_udpsrc_uri_get_uri), (gst_udpsrc_uri_set_uri),
(gst_udpsrc_uri_handler_init):
* gst/udp/gstudpsrc.h:
UDP fixes, added uri handler.
Added rtpdec that will manage the RTP session in the future.
2005-05-11 07:31:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_udpsrc_uri_handler_init (gpointer g_iface, gpointer iface_data)
|
|
|
|
{
|
|
|
|
GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
|
|
|
|
|
|
|
|
iface->get_type = gst_udpsrc_uri_get_type;
|
|
|
|
iface->get_protocols = gst_udpsrc_uri_get_protocols;
|
|
|
|
iface->get_uri = gst_udpsrc_uri_get_uri;
|
|
|
|
iface->set_uri = gst_udpsrc_uri_set_uri;
|
|
|
|
}
|