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
fe63f4c5
Commit
fe63f4c5
authored
Sep 11, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to improve and export the SDP formatting helpers
parent
4a7e8ae3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
51 deletions
+66
-51
include/vlc_sout.h
include/vlc_sout.h
+7
-0
src/libvlc.sym
src/libvlc.sym
+3
-0
src/stream_output/sap.c
src/stream_output/sap.c
+1
-1
src/stream_output/sdp.c
src/stream_output/sdp.c
+55
-37
src/stream_output/stream_output.h
src/stream_output/stream_output.h
+0
-13
No files found.
include/vlc_sout.h
View file @
fe63f4c5
...
@@ -220,6 +220,13 @@ VLC_EXPORT(void, sout_AnnounceSessionDestroy, (session_descripto
...
@@ -220,6 +220,13 @@ VLC_EXPORT(void, sout_AnnounceSessionDestroy, (session_descripto
VLC_EXPORT
(
announce_method_t
*
,
sout_SAPMethod
,
(
void
)
);
VLC_EXPORT
(
announce_method_t
*
,
sout_SAPMethod
,
(
void
)
);
VLC_EXPORT
(
void
,
sout_MethodRelease
,
(
announce_method_t
*
)
);
VLC_EXPORT
(
void
,
sout_MethodRelease
,
(
announce_method_t
*
)
);
/** SDP */
VLC_EXPORT
(
char
*
,
sdp_Start
,
(
const
char
*
name
,
const
char
*
description
,
const
char
*
url
,
const
char
*
email
,
const
char
*
phone
,
const
struct
sockaddr
*
orig
,
socklen_t
origlen
,
const
struct
sockaddr
*
addr
,
socklen_t
addrlen
)
);
VLC_EXPORT
(
char
*
,
sdp_AddMedia
,
(
char
**
sdp
,
const
char
*
type
,
const
char
*
protocol
,
int
dport
,
unsigned
pt
,
vlc_bool_t
bw_indep
,
unsigned
bw
,
const
char
*
rtpmap
,
const
char
*
fmtp
)
);
VLC_EXPORT
(
char
*
,
sdp_AddAttribute
,
(
char
**
sdp
,
const
char
*
name
,
const
char
*
fmt
,
...)
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
src/libvlc.sym
View file @
fe63f4c5
...
@@ -255,6 +255,9 @@ playlist_ServicesDiscoveryRemove
...
@@ -255,6 +255,9 @@ playlist_ServicesDiscoveryRemove
playlist_TreeMove
playlist_TreeMove
resolve_xml_special_chars
resolve_xml_special_chars
secstotimestr
secstotimestr
sdp_Start
sdp_AddAttribute
sdp_AddMedia
sout_AccessOutDelete
sout_AccessOutDelete
sout_AccessOutNew
sout_AccessOutNew
sout_AccessOutRead
sout_AccessOutRead
...
...
src/stream_output/sap.c
View file @
fe63f4c5
...
@@ -597,7 +597,7 @@ static char *SDPGenerate( sap_handler_t *p_sap,
...
@@ -597,7 +597,7 @@ static char *SDPGenerate( sap_handler_t *p_sap,
{
{
char
*
psz_group
,
*
psz_name
,
*
psz_sdp
;
char
*
psz_group
,
*
psz_name
,
*
psz_sdp
;
char
*
head
=
StartSDP
(
p_session
->
psz_name
,
p_session
->
description
,
char
*
head
=
sdp_Start
(
p_session
->
psz_name
,
p_session
->
description
,
p_session
->
url
,
p_session
->
email
,
p_session
->
phone
,
p_session
->
url
,
p_session
->
email
,
p_session
->
phone
,
(
const
struct
sockaddr
*
)
&
p_session
->
orig
,
p_session
->
origlen
,
(
const
struct
sockaddr
*
)
&
p_session
->
orig
,
p_session
->
origlen
,
(
const
struct
sockaddr
*
)
&
p_session
->
addr
,
p_session
->
addrlen
);
(
const
struct
sockaddr
*
)
&
p_session
->
addr
,
p_session
->
addrlen
);
...
...
src/stream_output/sdp.c
View file @
fe63f4c5
...
@@ -86,7 +86,7 @@ static vlc_bool_t IsSDPString (const char *str)
...
@@ -86,7 +86,7 @@ static vlc_bool_t IsSDPString (const char *str)
}
}
char
*
StartSDP
(
const
char
*
name
,
const
char
*
description
,
const
char
*
url
,
char
*
sdp_Start
(
const
char
*
name
,
const
char
*
description
,
const
char
*
url
,
const
char
*
email
,
const
char
*
phone
,
const
char
*
email
,
const
char
*
phone
,
const
struct
sockaddr
*
src
,
socklen_t
srclen
,
const
struct
sockaddr
*
src
,
socklen_t
srclen
,
const
struct
sockaddr
*
addr
,
socklen_t
addrlen
)
const
struct
sockaddr
*
addr
,
socklen_t
addrlen
)
...
@@ -157,10 +157,52 @@ char *StartSDP (const char *name, const char *description, const char *url,
...
@@ -157,10 +157,52 @@ char *StartSDP (const char *name, const char *description, const char *url,
}
}
char
*
vAddSDPMedia
(
char
**
sdp
,
static
char
*
const
char
*
type
,
int
dport
,
const
char
*
protocol
,
vsdp_AddAttribute
(
char
**
sdp
,
const
char
*
name
,
const
char
*
fmt
,
va_list
ap
)
unsigned
pt
,
const
char
*
rtpmap
,
{
const
char
*
fmtpfmt
,
va_list
ap
)
size_t
oldlen
=
strlen
(
*
sdp
);
size_t
addlen
=
sizeof
(
"a=:
\r\n
"
)
+
strlen
(
name
)
+
vsnprintf
(
NULL
,
0
,
fmt
,
ap
);
char
*
ret
=
realloc
(
*
sdp
,
oldlen
+
addlen
);
if
(
ret
==
NULL
)
return
NULL
;
oldlen
+=
sprintf
(
ret
+
oldlen
,
"a=%s:"
,
name
);
sprintf
(
ret
+
oldlen
,
fmt
,
ap
);
return
*
sdp
=
ret
;
}
char
*
sdp_AddAttribute
(
char
**
sdp
,
const
char
*
name
,
const
char
*
fmt
,
...)
{
char
*
ret
;
if
(
fmt
!=
NULL
)
{
va_list
ap
;
va_start
(
ap
,
fmt
);
ret
=
vsdp_AddAttribute
(
sdp
,
name
,
fmt
,
ap
);
va_end
(
ap
);
}
else
{
size_t
oldlen
=
strlen
(
*
sdp
);
ret
=
realloc
(
*
sdp
,
oldlen
+
strlen
(
name
)
+
sizeof
(
"a=
\r\n
"
));
if
(
ret
==
NULL
)
return
NULL
;
sprintf
(
ret
+
oldlen
,
"a=%s
\r\n
"
,
name
);
}
return
ret
;
}
char
*
sdp_AddMedia
(
char
**
sdp
,
const
char
*
type
,
const
char
*
protocol
,
int
dport
,
unsigned
pt
,
vlc_bool_t
bw_indep
,
unsigned
bw
,
const
char
*
rtpmap
,
const
char
*
fmtp
)
{
{
char
*
newsdp
,
*
ptr
;
char
*
newsdp
,
*
ptr
;
size_t
inlen
=
strlen
(
*
sdp
),
outlen
=
inlen
;
size_t
inlen
=
strlen
(
*
sdp
),
outlen
=
inlen
;
...
@@ -177,17 +219,6 @@ char *vAddSDPMedia (char **sdp,
...
@@ -177,17 +219,6 @@ char *vAddSDPMedia (char **sdp,
"b=RR:0
\r\n
"
,
"b=RR:0
\r\n
"
,
type
,
dport
,
protocol
,
pt
);
type
,
dport
,
protocol
,
pt
);
/* RTP payload type map */
if
(
rtpmap
!=
NULL
)
outlen
+=
snprintf
(
NULL
,
0
,
"a=rtpmap:%u %s
\r\n
"
,
pt
,
rtpmap
);
/* Format parameters */
if
(
fmtpfmt
!=
NULL
)
{
outlen
+=
sizeof
(
"a=fmtp:123 *
\r\n
"
);
outlen
+=
vsnprintf
(
NULL
,
0
,
fmtpfmt
,
ap
);
}
newsdp
=
realloc
(
*
sdp
,
outlen
+
1
);
newsdp
=
realloc
(
*
sdp
,
outlen
+
1
);
if
(
newsdp
==
NULL
)
if
(
newsdp
==
NULL
)
return
NULL
;
return
NULL
;
...
@@ -195,29 +226,16 @@ char *vAddSDPMedia (char **sdp,
...
@@ -195,29 +226,16 @@ char *vAddSDPMedia (char **sdp,
*
sdp
=
newsdp
;
*
sdp
=
newsdp
;
ptr
=
newsdp
+
inlen
;
ptr
=
newsdp
+
inlen
;
/* RTP payload type map */
ptr
+=
sprintf
(
ptr
,
"m=%s %u %s %d
\r\n
"
ptr
+=
sprintf
(
ptr
,
"a=rtpmap:%u %s
\r\n
"
,
pt
,
rtpmap
);
"b=RR:0
\r\n
"
,
type
,
dport
,
protocol
,
pt
);
/* RTP payload type map */
if
(
rtpmap
!=
NULL
)
sdp_AddAttribute
(
"rtpmap"
,
"%u %s"
,
pt
,
rtpmap
);
/* Format parameters */
/* Format parameters */
if
(
fmtpfmt
!=
NULL
)
if
(
fmtp
!=
NULL
)
{
sdp_AddAttribute
(
"fmtp"
,
"%u %s"
,
pt
,
fmtp
);
ptr
+=
sprintf
(
ptr
,
"a=fmtp:%u "
,
pt
);
ptr
+=
vsprintf
(
ptr
,
fmtpfmt
,
ap
);
}
return
newsdp
;
return
newsdp
;
}
}
char
*
AddSDPMedia
(
char
**
sdp
,
const
char
*
type
,
int
dport
,
const
char
*
proto
,
unsigned
pt
,
const
char
*
rtpmap
,
const
char
*
fmtpfmt
,
...)
{
va_list
ap
;
char
*
ret
;
va_start
(
ap
,
fmtpfmt
);
ret
=
vAddSDPMedia
(
sdp
,
type
,
dport
,
proto
,
pt
,
rtpmap
,
fmtpfmt
,
ap
);
va_end
(
ap
);
return
ret
;
}
src/stream_output/stream_output.h
View file @
fe63f4c5
...
@@ -115,17 +115,4 @@ int announce_UnRegister( announce_handler_t *p_announce,
...
@@ -115,17 +115,4 @@ int announce_UnRegister( announce_handler_t *p_announce,
sap_handler_t
*
announce_SAPHandlerCreate
(
announce_handler_t
*
p_announce
);
sap_handler_t
*
announce_SAPHandlerCreate
(
announce_handler_t
*
p_announce
);
void
announce_SAPHandlerDestroy
(
sap_handler_t
*
p_sap
);
void
announce_SAPHandlerDestroy
(
sap_handler_t
*
p_sap
);
#include <stdarg.h>
char
*
StartSDP
(
const
char
*
name
,
const
char
*
description
,
const
char
*
url
,
const
char
*
email
,
const
char
*
phone
,
const
struct
sockaddr
*
orig
,
socklen_t
origlen
,
const
struct
sockaddr
*
addr
,
socklen_t
addrlen
);
char
*
vAddSDPMedia
(
char
**
sdp
,
const
char
*
type
,
int
dport
,
const
char
*
prot
,
unsigned
pt
,
const
char
*
rtpmap
,
const
char
*
fmtpfmt
,
va_list
ap
);
char
*
AddSDPMedia
(
char
**
sdp
,
const
char
*
type
,
int
dport
,
const
char
*
proto
,
unsigned
pt
,
const
char
*
rtpmap
,
const
char
*
fmtpfmt
,
...);
#endif
#endif
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