Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
23333fe2
Commit
23333fe2
authored
Feb 10, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore some kind of SAP support
parent
c6632249
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
15 deletions
+98
-15
include/vlc_sout.h
include/vlc_sout.h
+1
-0
modules/stream_out/standard.c
modules/stream_out/standard.c
+68
-9
src/stream_output/announce.c
src/stream_output/announce.c
+25
-0
src/stream_output/sap.c
src/stream_output/sap.c
+3
-3
src/stream_output/stream_output.h
src/stream_output/stream_output.h
+1
-3
No files found.
include/vlc_sout.h
View file @
23333fe2
...
...
@@ -215,6 +215,7 @@ VLC_EXPORT(session_descriptor_t*,sout_AnnounceRegisterSDP, (sout_instance_t *, c
VLC_EXPORT
(
int
,
sout_AnnounceUnRegister
,
(
sout_instance_t
*
,
session_descriptor_t
*
)
);
VLC_EXPORT
(
session_descriptor_t
*
,
sout_AnnounceSessionCreate
,
(
vlc_object_t
*
obj
,
const
char
*
cfgpref
)
);
VLC_EXPORT
(
int
,
sout_SessionSetMedia
,
(
vlc_object_t
*
obj
,
session_descriptor_t
*
,
char
*
,
char
*
,
int
,
char
*
,
int
)
);
VLC_EXPORT
(
void
,
sout_AnnounceSessionDestroy
,
(
session_descriptor_t
*
)
);
VLC_EXPORT
(
announce_method_t
*
,
sout_SAPMethod
,
(
void
)
);
VLC_EXPORT
(
void
,
sout_MethodRelease
,
(
announce_method_t
*
)
);
...
...
modules/stream_out/standard.c
View file @
23333fe2
...
...
@@ -24,12 +24,13 @@
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h>
#include <string.h>
#include <vlc/vlc.h>
#include <vlc_sout.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <vlc_network.h>
#include "vlc_url.h"
...
...
@@ -245,8 +246,10 @@ static int Open( vlc_object_t *p_this )
{
psz_mux
=
strdup
(
"asfh"
);
}
else
if
(
!
strncmp
(
psz_access
,
"udp"
,
3
)
||
!
strncmp
(
psz_access
,
"rtp"
,
3
)
)
else
if
(
!
strcmp
(
psz_access
,
"udp"
)
||
!
strcmp
(
psz_access
,
"rtp"
)
||
!
strcmp
(
psz_access
,
"udplite"
)
||
!
strcmp
(
psz_access
,
"tcp"
)
||
!
strcmp
(
psz_access
,
"sctp"
)
||
!
strcmp
(
psz_access
,
"dccp"
))
{
psz_mux
=
strdup
(
"ts"
);
}
...
...
@@ -337,13 +340,69 @@ static int Open( vlc_object_t *p_this )
msg_Dbg
(
p_stream
,
"mux opened"
);
/* *** Create the SAP Session structure *** */
if
(
var_GetBool
(
p_stream
,
SOUT_CFG_PREFIX
"sap"
)
&&
(
strncmp
(
psz_access
,
"udp"
,
3
)
||
strncmp
(
psz_access
,
"rtp"
,
3
)
)
)
if
(
var_GetBool
(
p_stream
,
SOUT_CFG_PREFIX
"sap"
)
)
{
session_descriptor_t
*
p_session
;
announce_method_t
*
p_method
=
sout_SAPMethod
();
vlc_url_t
url
;
p_session
=
sout_AnnounceSessionCreate
(
VLC_OBJECT
(
p_stream
),
SOUT_CFG_PREFIX
);
const
int
payload_type
=
33
;
static
const
struct
{
const
char
*
access
;
const
char
*
fmt
;
}
fmts
[]
=
{
{
"udp"
,
"udp mpeg"
},
{
"rtp"
,
"RTP/AVP %d"
},
{
"udplite"
,
"UDPLite/RTP/AVP %d"
},
/* Currently unsupported access outputs: */
{
"dccp"
,
"DCCP/RTP/AVP %d"
},
{
"tcp"
,
"TCP/RTP/AVP %d"
},
/* TLS/DTLS variants (none implemented). */
{
"dtls"
,
"UDP/TLS/RTP/AVP %d"
},
{
"dtlslite"
,
"UDPLite/TLS/RTP/AVP %d"
},
{
"dccps"
,
"DCCP/TLS/RTP/AVP %d"
},
{
"tls"
,
"TCP/TLS/RTP/AVP %d"
},
/* SRTP (not implemented) */
{
"srtp"
,
"RTP/SAVP %d"
},
{
"sudplite"
,
"UDPLite/RTP/SAVP %d"
},
{
"sdccp"
,
"DCCP/RTP/SAVP %d"
},
{
"stcp"
,
"TCP/RTP/SAVP %d"
},
{
NULL
,
NULL
}
};
const
char
*
psz_sdp_fmt
=
NULL
;
char
*
fmt
,
*
src
,
*
dst
;
int
sport
,
dport
;
for
(
unsigned
i
=
0
;
fmts
[
i
].
access
!=
NULL
;
i
++
)
if
(
strcasecmp
(
fmts
[
i
].
access
,
psz_access
)
==
0
)
{
psz_sdp_fmt
=
fmts
[
i
].
fmt
;
break
;
}
src
=
var_GetNonEmptyString
(
p_access
,
"src-addr"
);
dst
=
var_GetNonEmptyString
(
p_access
,
"dst-addr"
);
sport
=
var_GetInteger
(
p_access
,
"src-port"
);
dport
=
var_GetInteger
(
p_access
,
"dst-port"
);
msg_Err
(
p_stream
,
"%p, %p, %d, %d"
,
src
,
dst
,
sport
,
dport
);
if
((
psz_sdp_fmt
==
NULL
)
||
(
asprintf
(
&
fmt
,
psz_sdp_fmt
,
payload_type
)
==
-
1
))
fmt
=
NULL
;
msg_Dbg
(
p_stream
,
"SAP advertized format: %s"
,
fmt
);
if
((
fmt
==
NULL
)
||
((
src
==
NULL
)
&&
(
dst
==
NULL
)))
{
msg_Err
(
p_access
,
"SAP announces not supported for access %s"
,
psz_access
);
free
(
fmt
);
free
(
src
);
free
(
dst
);
goto
nosap
;
}
p_session
=
sout_AnnounceSessionCreate
(
VLC_OBJECT
(
p_stream
),
SOUT_CFG_PREFIX
);
sout_SessionSetMedia
(
VLC_OBJECT
(
p_stream
),
p_session
,
fmt
,
src
,
sport
,
dst
,
dport
);
/* Now, parse the URL to extract host and port */
vlc_UrlParse
(
&
url
,
psz_url
,
0
);
...
...
@@ -355,7 +414,6 @@ static int Open( vlc_object_t *p_this )
#if 0
p_session->psz_uri = strdup( url.psz_host );
p_session->i_port = url.i_port;
p_session->i_payload = 33;
p_session->b_rtp = strstr( psz_access, "rtp") ? 1 : 0;
#endif
msg_Info
(
p_this
,
"SAP Enabled"
);
...
...
@@ -366,6 +424,7 @@ static int Open( vlc_object_t *p_this )
vlc_UrlClean
(
&
url
);
sout_MethodRelease
(
p_method
);
}
nosap:
p_stream
->
pf_add
=
Add
;
p_stream
->
pf_del
=
Del
;
...
...
src/stream_output/announce.c
View file @
23333fe2
...
...
@@ -192,6 +192,31 @@ session_descriptor_t * sout_AnnounceSessionCreate (vlc_object_t *obj,
return
p_session
;
}
int
sout_SessionSetMedia
(
vlc_object_t
*
obj
,
session_descriptor_t
*
p_session
,
char
*
fmt
,
char
*
src
,
int
sport
,
char
*
dst
,
int
dport
)
{
p_session
->
sdpformat
=
fmt
;
/* GRUIK. We should not convert back-and-forth from string to numbers */
struct
addrinfo
*
res
;
if
(
vlc_getaddrinfo
(
obj
,
dst
,
dport
,
NULL
,
&
res
)
==
0
)
{
if
(
res
->
ai_addrlen
<=
sizeof
(
p_session
->
addr
))
memcpy
(
&
p_session
->
addr
,
res
->
ai_addr
,
p_session
->
addrlen
=
res
->
ai_addrlen
);
freeaddrinfo
(
res
);
}
if
(
vlc_getaddrinfo
(
obj
,
src
,
sport
,
NULL
,
&
res
)
==
0
)
{
if
(
res
->
ai_addrlen
<=
sizeof
(
p_session
->
orig
))
memcpy
(
&
p_session
->
orig
,
res
->
ai_addr
,
p_session
->
origlen
=
res
->
ai_addrlen
);
freeaddrinfo
(
res
);
}
return
0
;
}
/**
* Destroy a session descriptor and free all
*
...
...
src/stream_output/sap.c
View file @
23333fe2
...
...
@@ -382,6 +382,7 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
if
(
p_address
->
i_wfd
!=
-
1
)
{
net_StopRecv
(
p_address
->
i_wfd
);
p_address
->
origlen
=
sizeof
(
p_address
->
orig
);
getsockname
(
p_address
->
i_wfd
,
(
struct
sockaddr
*
)
&
p_address
->
orig
,
&
p_address
->
origlen
);
}
...
...
@@ -624,13 +625,12 @@ static char *SDPGenerate( sap_handler_t *p_sap,
sfilter
=
NULL
;
int
res
=
asprintf
(
&
psz_sdp
,
"%s"
"%s"
"%s"
"m=video %d %s
%d
\r\n
"
,
"m=video %d %s
\r\n
"
,
head
,
plgroup
?:
""
,
sfilter
?:
""
,
net_GetPort
((
const
struct
sockaddr
*
)
&
p_session
->
addr
),
p_session
->
b_rtp
?
"RTP/AVP"
:
"udp"
,
p_session
->
i_payload
);
p_session
->
sdpformat
);
free
(
plgroup
);
free
(
sfilter
);
...
...
src/stream_output/stream_output.h
View file @
23333fe2
...
...
@@ -83,10 +83,8 @@ struct session_descriptor_t
struct
sockaddr_storage
addr
;
socklen_t
addrlen
;
int
i_payload
;
/* SAP Payload type */
char
*
sdpformat
;
// format suitable for SDP
char
*
psz_sdp
;
vlc_bool_t
b_rtp
;
vlc_bool_t
b_ssm
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment