Commit 9979fb83 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Single service DCCP/RTP/AVP input

parent 761669f1
...@@ -29,7 +29,8 @@ Playlist: ...@@ -29,7 +29,8 @@ Playlist:
* Audioscrobbler/last.fm support * Audioscrobbler/last.fm support
Input/Demuxers: Input/Demuxers:
* UDP-Lite (requires OS support) for raw and RTP encapsulation * UDP-Lite protocol (requires OS support) for RTP/AVP
* DCCP protocol (requires OS support) for RTP/AVP
Decoders: Decoders:
* VP60/VP61 codecs support * VP60/VP61 codecs support
...@@ -44,7 +45,7 @@ Video output: ...@@ -44,7 +45,7 @@ Video output:
* New sharpen video filter (increase the contrast of adjacent pixels) * New sharpen video filter (increase the contrast of adjacent pixels)
Stream output: Stream output:
* UDP-Lite (requires OS support) for raw and RTP/TS encapsulation * UDP-Lite (requires OS support) for RTP/TS encapsulation
Interfaces: Interfaces:
* Windows/Linux * Windows/Linux
......
...@@ -70,6 +70,7 @@ extern "C" { ...@@ -70,6 +70,7 @@ extern "C" {
/* Portable networking layer communication */ /* Portable networking layer communication */
int net_Socket (vlc_object_t *obj, int family, int socktype, int proto); int net_Socket (vlc_object_t *obj, int family, int socktype, int proto);
#define net_Connect(a, b, c, d, e) __net_Connect(VLC_OBJECT(a), b, c, d, e)
VLC_EXPORT( int, __net_Connect, (vlc_object_t *p_this, const char *psz_host, int i_port, int socktype, int protocol) ); VLC_EXPORT( int, __net_Connect, (vlc_object_t *p_this, const char *psz_host, int i_port, int socktype, int protocol) );
VLC_EXPORT( int *, net_Listen, (vlc_object_t *p_this, const char *psz_host, int i_port, VLC_EXPORT( int *, net_Listen, (vlc_object_t *p_this, const char *psz_host, int i_port,
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <vlc_access.h> #include <vlc_access.h>
#include <vlc_network.h> #include <vlc_network.h>
/* Big pile of stuff missing form glibc 2.5 */
#if defined (HAVE_NETINET_UDPLITE_H) #if defined (HAVE_NETINET_UDPLITE_H)
# include <netinet/udplite.h> # include <netinet/udplite.h>
#elif defined (__linux__) #elif defined (__linux__)
...@@ -44,6 +45,16 @@ ...@@ -44,6 +45,16 @@
# define UDPLITE_RECV_CSCOV 11 # define UDPLITE_RECV_CSCOV 11
#endif #endif
#ifndef SOCK_DCCP /* provisional API */
# ifdef __linux__
# define SOCK_DCCP 6
# endif
#endif
#ifndef IPPROTO_DCCP
# define IPPROTO_DCCP 33 /* IANA */
#endif
#ifndef IPPROTO_UDPLITE #ifndef IPPROTO_UDPLITE
# define IPPROTO_UDPLITE 136 /* from IANA */ # define IPPROTO_UDPLITE 136 /* from IANA */
#endif #endif
...@@ -96,6 +107,7 @@ vlc_module_begin(); ...@@ -96,6 +107,7 @@ vlc_module_begin();
add_shortcut( "rtp6" ); add_shortcut( "rtp6" );
add_shortcut( "udplite" ); add_shortcut( "udplite" );
add_shortcut( "rtptcp" ); add_shortcut( "rtptcp" );
add_shortcut( "dccp" );
set_callbacks( Open, Close ); set_callbacks( Open, Close );
vlc_module_end(); vlc_module_end();
...@@ -140,7 +152,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -140,7 +152,6 @@ static int Open( vlc_object_t *p_this )
const char *psz_server_addr, *psz_bind_addr = ""; const char *psz_server_addr, *psz_bind_addr = "";
int i_bind_port, i_server_port = 0; int i_bind_port, i_server_port = 0;
int fam = AF_UNSPEC, proto = IPPROTO_UDP; int fam = AF_UNSPEC, proto = IPPROTO_UDP;
vlc_bool_t b_framed = VLC_FALSE;
if (strlen (p_access->psz_access) >= 3) if (strlen (p_access->psz_access) >= 3)
{ {
...@@ -156,11 +167,12 @@ static int Open( vlc_object_t *p_this ) ...@@ -156,11 +167,12 @@ static int Open( vlc_object_t *p_this )
} }
if (strcmp (p_access->psz_access + 3, "lite") == 0) if (strcmp (p_access->psz_access + 3, "lite") == 0)
proto = IPPROTO_UDPLITE; proto = IPPROTO_UDPLITE;
else
if (strcmp (p_access->psz_access + 3, "tcp") == 0) if (strcmp (p_access->psz_access + 3, "tcp") == 0)
{
proto = IPPROTO_TCP; proto = IPPROTO_TCP;
b_framed = VLC_TRUE; else
} if (strcmp (p_access->psz_access, "dccp") == 0)
proto = IPPROTO_DCCP;
} }
i_bind_port = var_CreateGetInteger( p_access, "server-port" ); i_bind_port = var_CreateGetInteger( p_access, "server-port" );
...@@ -213,10 +225,30 @@ static int Open( vlc_object_t *p_this ) ...@@ -213,10 +225,30 @@ static int Open( vlc_object_t *p_this )
p_access->info.b_prebuffered = VLC_FALSE; p_access->info.b_prebuffered = VLC_FALSE;
MALLOC_ERR( p_access->p_sys, access_sys_t ); p_sys = p_access->p_sys; MALLOC_ERR( p_access->p_sys, access_sys_t ); p_sys = p_access->p_sys;
p_sys->fd = b_framed switch (proto)
? net_ConnectTCP( p_access, psz_server_addr, i_server_port ) {
: net_OpenDgram( p_access, psz_bind_addr, i_bind_port, case IPPROTO_UDP:
psz_server_addr, i_server_port, fam, proto ); case IPPROTO_UDPLITE:
p_sys->fd = net_OpenDgram( p_access, psz_bind_addr, i_bind_port,
psz_server_addr, i_server_port, fam,
proto );
break;
case IPPROTO_TCP:
p_sys = net_ConnectTCP( p_access, psz_server_addr, i_server_port );
p_sys->b_framed_rtp = VLC_TRUE;
break;
case IPPROTO_DCCP:
#ifdef SOCK_DCCP
p_sys->fd = net_Connect( p_access, psz_server_addr, i_server_port,
SOCK_DCCP, IPPROTO_DCCP );
#else
p_sys->fd = -1;
msg_Err( p_access, "DCCP support not compiled-in!" );
#endif
break;
}
free (psz_name); free (psz_name);
if( p_sys->fd == -1 ) if( p_sys->fd == -1 )
{ {
...@@ -234,8 +266,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -234,8 +266,7 @@ static int Open( vlc_object_t *p_this )
&(int){ 20 }, sizeof (int)); &(int){ 20 }, sizeof (int));
#endif #endif
p_sys->b_framed_rtp = b_framed; if (p_sys->b_framed_rtp)
if (b_framed)
{ {
/* We don't do autodetection and prebuffering in case of framing */ /* We don't do autodetection and prebuffering in case of framing */
p_access->pf_block = BlockRTP; p_access->pf_block = BlockRTP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment