Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
5a922f69
Commit
5a922f69
authored
Sep 15, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_out_std: use new SDP API too
parent
cf1414dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
43 deletions
+46
-43
modules/stream_out/standard.c
modules/stream_out/standard.c
+46
-43
No files found.
modules/stream_out/standard.c
View file @
5a922f69
...
@@ -96,7 +96,8 @@ vlc_module_begin();
...
@@ -96,7 +96,8 @@ vlc_module_begin();
add_string
(
SOUT_CFG_PREFIX
"dst"
,
""
,
NULL
,
DST_TEXT
,
add_string
(
SOUT_CFG_PREFIX
"dst"
,
""
,
NULL
,
DST_TEXT
,
DST_LONGTEXT
,
VLC_FALSE
);
DST_LONGTEXT
,
VLC_FALSE
);
add_bool
(
SOUT_CFG_PREFIX
"sap"
,
0
,
NULL
,
SAP_TEXT
,
SAP_LONGTEXT
,
VLC_TRUE
);
add_bool
(
SOUT_CFG_PREFIX
"sap"
,
VLC_FALSE
,
NULL
,
SAP_TEXT
,
SAP_LONGTEXT
,
VLC_TRUE
);
add_string
(
SOUT_CFG_PREFIX
"name"
,
""
,
NULL
,
NAME_TEXT
,
NAME_LONGTEXT
,
add_string
(
SOUT_CFG_PREFIX
"name"
,
""
,
NULL
,
NAME_TEXT
,
NAME_LONGTEXT
,
VLC_TRUE
);
VLC_TRUE
);
add_string
(
SOUT_CFG_PREFIX
"group"
,
""
,
NULL
,
GROUP_TEXT
,
GROUP_LONGTEXT
,
add_string
(
SOUT_CFG_PREFIX
"group"
,
""
,
NULL
,
GROUP_TEXT
,
GROUP_LONGTEXT
,
...
@@ -142,6 +143,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -142,6 +143,7 @@ static int Open( vlc_object_t *p_this )
{
{
sout_stream_t
*
p_stream
=
(
sout_stream_t
*
)
p_this
;
sout_stream_t
*
p_stream
=
(
sout_stream_t
*
)
p_this
;
sout_instance_t
*
p_sout
=
p_stream
->
p_sout
;
sout_instance_t
*
p_sout
=
p_stream
->
p_sout
;
sout_stream_sys_t
*
p_sys
;
char
*
psz_mux
;
char
*
psz_mux
;
char
*
psz_access
;
char
*
psz_access
;
...
@@ -170,7 +172,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -170,7 +172,7 @@ static int Open( vlc_object_t *p_this )
psz_url
=
*
val
.
psz_string
?
val
.
psz_string
:
NULL
;
psz_url
=
*
val
.
psz_string
?
val
.
psz_string
:
NULL
;
if
(
!*
val
.
psz_string
)
free
(
val
.
psz_string
);
if
(
!*
val
.
psz_string
)
free
(
val
.
psz_string
);
p_stream
->
p_sys
=
malloc
(
sizeof
(
sout_stream_sys_t
)
);
p_s
ys
=
p_s
tream
->
p_sys
=
malloc
(
sizeof
(
sout_stream_sys_t
)
);
p_stream
->
p_sys
->
p_session
=
NULL
;
p_stream
->
p_sys
->
p_session
=
NULL
;
msg_Dbg
(
p_this
,
"creating `%s/%s://%s'"
,
psz_access
,
psz_mux
,
psz_url
);
msg_Dbg
(
p_this
,
"creating `%s/%s://%s'"
,
psz_access
,
psz_mux
,
psz_url
);
...
@@ -334,58 +336,60 @@ static int Open( vlc_object_t *p_this )
...
@@ -334,58 +336,60 @@ static int Open( vlc_object_t *p_this )
/* *** Create the SAP Session structure *** */
/* *** Create the SAP Session structure *** */
if
(
var_GetBool
(
p_stream
,
SOUT_CFG_PREFIX
"sap"
)
)
if
(
var_GetBool
(
p_stream
,
SOUT_CFG_PREFIX
"sap"
)
)
{
{
session_descriptor_t
*
p_session
;
/* Create the SDP */
announce_method_t
*
p_method
=
sout_SAPMethod
();
char
*
shost
=
var_GetNonEmptyString
(
p_access
,
"src-addr"
);
char
*
dhost
=
var_GetNonEmptyString
(
p_access
,
"dst-addr"
);
int
sport
=
var_GetInteger
(
p_access
,
"src-port"
);
int
dport
=
var_GetInteger
(
p_access
,
"dst-port"
);
struct
sockaddr_storage
src
,
dst
;
socklen_t
srclen
=
0
,
dstlen
=
0
;
struct
addrinfo
*
res
;
if
(
vlc_getaddrinfo
(
VLC_OBJECT
(
p_stream
),
dhost
,
dport
,
NULL
,
&
res
)
==
0
)
{
memcpy
(
&
dst
,
res
->
ai_addr
,
dstlen
=
res
->
ai_addrlen
);
vlc_freeaddrinfo
(
res
);
}
static
const
struct
{
const
char
*
access
;
const
char
*
fmt
;
}
fmts
[]
=
if
(
vlc_getaddrinfo
(
VLC_OBJECT
(
p_stream
),
shost
,
sport
,
NULL
,
&
res
)
==
0
)
{
{
/* Plain text: */
memcpy
(
&
src
,
res
->
ai_addr
,
srclen
=
res
->
ai_addrlen
);
{
"udp"
,
"udp mpeg"
},
vlc_freeaddrinfo
(
res
);
{
"rtp"
,
"RTP/AVP 33"
},
}
{
NULL
,
NULL
}
};
const
char
*
fmt
=
NULL
;
char
*
src
,
*
dst
;
int
sport
,
dport
;
for
(
unsigned
i
=
0
;
fmts
[
i
].
access
!=
NULL
;
i
++
)
if
(
strncasecmp
(
fmts
[
i
].
access
,
psz_access
,
strlen
(
fmts
[
i
].
access
))
==
0
)
{
fmt
=
fmts
[
i
].
fmt
;
break
;
}
src
=
var_GetNonEmptyString
(
p_access
,
"src-addr"
);
char
*
head
=
vlc_sdp_Start
(
VLC_OBJECT
(
p_stream
),
SOUT_CFG_PREFIX
,
dst
=
var_GetNonEmptyString
(
p_access
,
"dst-addr"
);
(
struct
sockaddr
*
)
&
src
,
srclen
,
sport
=
var_GetInteger
(
p_access
,
"src-port"
);
(
struct
sockaddr
*
)
&
dst
,
dstlen
);
dport
=
var_GetInteger
(
p_access
,
"dst-port"
);
free
(
shost
);
msg_Dbg
(
p_stream
,
"SAP advertized format: %s"
,
fmt
)
;
char
*
psz_sdp
=
NULL
;
if
(
(
fmt
==
NULL
)
||
((
src
==
NULL
)
&&
(
dst
==
NULL
))
)
if
(
head
!=
NULL
)
{
{
msg_Err
(
p_access
,
"SAP announces not supported for access %s"
,
if
(
asprintf
(
&
psz_sdp
,
"%s"
psz_access
);
"m=video %d udp mpeg
\r\n
"
,
head
,
dport
)
==
-
1
)
goto
nosap
;
psz_sdp
=
NULL
;
free
(
head
);
}
}
p_session
=
sout_AnnounceSessionCreate
(
VLC_OBJECT
(
p_stream
),
/* Register the SDP with the SAP thread */
SOUT_CFG_PREFIX
);
if
(
psz_sdp
!=
NULL
)
sout_SessionSetMedia
(
VLC_OBJECT
(
p_stream
),
p_session
,
fmt
,
{
src
,
sport
,
dst
,
dport
);
announce_method_t
*
p_method
=
sout_SAPMethod
();
sout_AnnounceRegister
(
p_sout
,
p_session
,
p_method
);
msg_Dbg
(
p_stream
,
"Generated SDP:
\n
%s"
,
psz_sdp
);
p_stream
->
p_sys
->
p_session
=
p_session
;
sout_MethodRelease
(
p_method
);
p_sys
->
p_session
=
sout_AnnounceRegisterSDP
(
p_sout
,
SOUT_CFG_PREFIX
,
psz_sdp
,
nosap:
dhost
,
p_method
);
free
(
src
);
sout_MethodRelease
(
p_method
);
free
(
dst
);
}
free
(
dhost
);
}
}
p_stream
->
pf_add
=
Add
;
p_stream
->
pf_add
=
Add
;
p_stream
->
pf_del
=
Del
;
p_stream
->
pf_del
=
Del
;
p_stream
->
pf_send
=
Send
;
p_stream
->
pf_send
=
Send
;
p_s
tream
->
p_s
ys
->
p_mux
=
p_mux
;
p_sys
->
p_mux
=
p_mux
;
free
(
psz_access
);
free
(
psz_access
);
free
(
psz_mux
);
free
(
psz_mux
);
...
@@ -409,7 +413,6 @@ static void Close( vlc_object_t * p_this )
...
@@ -409,7 +413,6 @@ static void Close( vlc_object_t * p_this )
sout_AnnounceSessionDestroy
(
p_sys
->
p_session
);
sout_AnnounceSessionDestroy
(
p_sys
->
p_session
);
}
}
sout_MuxDelete
(
p_sys
->
p_mux
);
sout_MuxDelete
(
p_sys
->
p_mux
);
sout_AccessOutDelete
(
p_access
);
sout_AccessOutDelete
(
p_access
);
...
...
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