Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
448
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
2a2b219f
Commit
2a2b219f
authored
18 years ago
by
Rémi Denis-Courmont
Browse files
Options
Downloads
Patches
Plain Diff
UDP-Lite access output
parent
7605da80
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
NEWS
+4
-1
4 additions, 1 deletion
NEWS
include/vlc_network.h
+8
-3
8 additions, 3 deletions
include/vlc_network.h
modules/access_output/udp.c
+31
-9
31 additions, 9 deletions
modules/access_output/udp.c
src/network/udp.c
+6
-6
6 additions, 6 deletions
src/network/udp.c
with
49 additions
and
19 deletions
NEWS
+
4
−
1
View file @
2a2b219f
...
...
@@ -29,7 +29,7 @@ Playlist:
* Audioscrobbler/last.fm support
Input/Demuxers:
*
Support for
UDP-Lite (requires OS support) for
UDP-R
aw and RTP
* UDP-Lite (requires OS support) for
r
aw and RTP
encapsulation
Decoders:
* VP60/VP61 codecs support
...
...
@@ -41,6 +41,9 @@ Video output:
* Rewrite motion detection video filter
* New extract video filter (extract Red, Green and Blue components from a video)
Stream output:
* UDP-Lite (requires OS support) for raw and RTP/TS encapsulation
Interfaces:
* Windows/Linux
* Brand new interface for Linux and Windows, based on the Qt toolkit
...
...
This diff is collapsed.
Click to expand it.
include/vlc_network.h
+
8
−
3
View file @
2a2b219f
...
...
@@ -83,12 +83,17 @@ VLC_EXPORT( int *, __net_ListenTCP, ( vlc_object_t *, const char *, int ) );
#define net_Accept(a, b, c) __net_Accept(VLC_OBJECT(a), b, c)
VLC_EXPORT
(
int
,
__net_Accept
,
(
vlc_object_t
*
,
int
*
,
mtime_t
)
);
#define net_ConnectUDP(a, b, c, d ) __net_ConnectUDP(VLC_OBJECT(a), b, c, d)
VLC_EXPORT
(
int
,
__net_ConnectUDP
,
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
hlim
)
);
#define net_ConnectDgram(a, b, c, d, e ) __net_ConnectDgram(VLC_OBJECT(a), b, c, d, e)
VLC_EXPORT
(
int
,
__net_ConnectDgram
,
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
hlim
,
int
proto
)
);
static
inline
int
net_ConnectUDP
(
vlc_object_t
*
obj
,
const
char
*
host
,
int
port
,
int
hlim
)
{
return
net_ConnectDgram
(
obj
,
host
,
port
,
hlim
,
0
);
}
static
inline
int
net_ListenUDP1
(
vlc_object_t
*
obj
,
const
char
*
host
,
int
port
)
{
return
net_ListenSingle
(
obj
,
host
,
port
,
AF_UNSPEC
,
SOCK_DGRAM
,
IPPROTO_UDP
);
return
net_ListenSingle
(
obj
,
host
,
port
,
AF_UNSPEC
,
SOCK_DGRAM
,
0
);
}
#define net_OpenDgram( a, b, c, d, e, g, h ) __net_OpenDgram(VLC_OBJECT(a), b, c, d, e, g, h)
...
...
This diff is collapsed.
Click to expand it.
modules/access_output/udp.c
+
31
−
9
View file @
2a2b219f
...
...
@@ -52,6 +52,20 @@
#include
<vlc_network.h>
#if defined (HAVE_NETINET_UDPLITE_H)
# include <netinet/udplite.h>
#elif defined (__linux__)
# define UDPLITE_SEND_CSCOV 10
# define UDPLITE_RECV_CSCOV 11
#endif
#ifndef IPPROTO_UDPLITE
# define IPPROTO_UDPLITE 136
/* from IANA */
#endif
#ifndef SOL_UDPLITE
# define SOL_UDPLITE IPPROTO_UDPLITE
#endif
#define MAX_EMPTY_BLOCKS 200
#if defined(WIN32) || defined(UNDER_CE)
...
...
@@ -105,6 +119,8 @@ vlc_module_begin();
set_capability
(
"sout access"
,
100
);
add_shortcut
(
"udp"
);
add_shortcut
(
"rtp"
);
// Will work only with ts muxer
add_shortcut
(
"udplite"
);
add_shortcut
(
"rtplite"
);
set_callbacks
(
Open
,
Close
);
vlc_module_end
();
...
...
@@ -180,7 +196,8 @@ static int Open( vlc_object_t *p_this )
char
*
psz_parser
;
char
*
psz_dst_addr
;
int
i_dst_port
;
int
i_dst_port
,
proto
=
IPPROTO_UDP
,
cscov
=
8
;
const
char
*
protoname
=
"UDP"
;
int
i_handle
;
...
...
@@ -199,14 +216,16 @@ static int Open( vlc_object_t *p_this )
memset
(
p_sys
,
0
,
sizeof
(
sout_access_out_sys_t
)
);
p_access
->
p_sys
=
p_sys
;
if
(
p_access
->
psz_access
!=
NULL
&&
!
strcmp
(
p_access
->
psz_access
,
"rtp"
)
)
if
(
p_access
->
psz_access
!=
NULL
)
{
p_sys
->
b_rtpts
=
1
;
}
else
{
p_sys
->
b_rtpts
=
0
;
if
(
strncmp
(
p_access
->
psz_access
,
"rtp"
,
3
)
==
0
)
{
p_sys
->
b_rtpts
=
1
;
cscov
+=
RTP_HEADER_LENGTH
;
}
if
((
strlen
(
p_access
->
psz_access
)
>=
3
)
&&
(
strcmp
(
p_access
->
psz_access
+
3
,
"lite"
)
==
0
))
proto
=
IPPROTO_UDPLITE
;
}
psz_parser
=
strdup
(
p_access
->
psz_name
);
...
...
@@ -251,7 +270,7 @@ static int Open( vlc_object_t *p_this )
p_sys
->
p_thread
->
p_fifo
=
block_FifoNew
(
p_access
);
p_sys
->
p_thread
->
p_empty_blocks
=
block_FifoNew
(
p_access
);
i_handle
=
net_Connect
UDP
(
p_this
,
psz_dst_addr
,
i_dst_port
,
-
1
);
i_handle
=
net_Connect
Dgram
(
p_this
,
psz_dst_addr
,
i_dst_port
,
-
1
,
proto
);
if
(
i_handle
==
-
1
)
{
msg_Err
(
p_access
,
"failed to create UDP socket"
);
...
...
@@ -260,6 +279,9 @@ static int Open( vlc_object_t *p_this )
p_sys
->
p_thread
->
i_handle
=
i_handle
;
net_StopRecv
(
i_handle
);
if
(
proto
==
IPPROTO_UDPLITE
)
setsockopt
(
i_handle
,
SOL_UDPLITE
,
UDPLITE_SEND_CSCOV
,
&
cscov
,
sizeof
(
cscov
));
var_Get
(
p_access
,
SOUT_CFG_PREFIX
"caching"
,
&
val
);
p_sys
->
p_thread
->
i_caching
=
(
int64_t
)
val
.
i_int
*
1000
;
...
...
This diff is collapsed.
Click to expand it.
src/network/udp.c
+
6
−
6
View file @
2a2b219f
...
...
@@ -511,13 +511,13 @@ int net_SetDSCP( int fd, uint8_t dscp )
/*****************************************************************************
* __net_Connect
UDP
:
* __net_Connect
Dgram
:
*****************************************************************************
* Open a
UDP
socket to send data to a defined destination, with an
optional
* hop limit.
* Open a
datagram
socket to send data to a defined destination, with an
*
optional
hop limit.
*****************************************************************************/
int
__net_Connect
UDP
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
i_hlim
)
int
__net_Connect
Dgram
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
i_hlim
,
int
proto
)
{
struct
addrinfo
hints
,
*
res
,
*
ptr
;
int
i_val
,
i_handle
=
-
1
;
...
...
@@ -546,7 +546,7 @@ int __net_ConnectUDP( vlc_object_t *p_this, const char *psz_host, int i_port,
{
char
*
str
;
int
fd
=
net_Socket
(
p_this
,
ptr
->
ai_family
,
ptr
->
ai_socktype
,
ptr
->
ai_protocol
);
proto
?:
ptr
->
ai_protocol
);
if
(
fd
==
-
1
)
continue
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment