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
f96ceadb
Commit
f96ceadb
authored
Aug 21, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Append media description to the SDP, as the name suggest
parent
6d479b50
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
30 deletions
+37
-30
src/stream_output/sdp.c
src/stream_output/sdp.c
+34
-26
src/stream_output/stream_output.h
src/stream_output/stream_output.h
+3
-4
No files found.
src/stream_output/sdp.c
View file @
f96ceadb
...
...
@@ -157,59 +157,67 @@ char *StartSDP (const char *name, const char *description, const char *url,
}
char
*
vAddSDPMedia
(
const
char
*
type
,
int
dport
,
const
char
*
protocol
,
char
*
vAddSDPMedia
(
char
**
sdp
,
const
char
*
type
,
int
dport
,
const
char
*
protocol
,
unsigned
pt
,
const
char
*
rtpmap
,
const
char
*
fmtpfmt
,
va_list
ap
)
{
char
*
sdp_media
=
NULL
;
char
*
newsdp
,
*
ptr
;
size_t
inlen
=
strlen
(
*
sdp
),
outlen
=
inlen
;
/* Some default values */
if
(
type
==
NULL
)
type
=
"video"
;
if
(
dport
==
0
)
dport
=
9
;
if
(
protocol
==
NULL
)
protocol
=
"RTP/AVP"
;
assert
(
pt
<
128u
);
outlen
+=
snprintf
(
NULL
,
0
,
"m=%s %u %s %d
\r\n
"
"b=RR:0
\r\n
"
,
type
,
dport
,
protocol
,
pt
);
/* RTP payload type map */
char
sdp_rtpmap
[
rtpmap
?
(
sizeof
(
"a=rtpmap:123 *
\r\n
"
)
+
strlen
(
rtpmap
))
:
1
];
if
(
rtpmap
!=
NULL
)
sprintf
(
sdp_rtpmap
,
"a=rtpmap:%u %s
\r\n
"
,
pt
,
rtpmap
);
else
*
sdp_rtpmap
=
'\0'
;
outlen
+=
snprintf
(
NULL
,
0
,
"a=rtpmap:%u %s
\r\n
"
,
pt
,
rtpmap
);
/* Format parameters */
char
*
fmtp
=
NULL
;
if
((
fmtpfmt
!=
NULL
)
&&
(
vasprintf
(
&
fmtp
,
fmtpfmt
,
ap
)
==
-
1
))
return
NULL
;
char
sdp_fmtp
[
fmtp
?
(
sizeof
(
"a=fmtp:123 *
\r\n
"
)
+
strlen
(
fmtp
))
:
1
];
if
(
fmtp
!=
NULL
)
if
(
fmtpfmt
!=
NULL
)
{
sprintf
(
sdp_fmtp
,
"a=fmtp:%u %s
\r\n
"
,
pt
,
fmtp
);
free
(
fmt
p
);
outlen
+=
sizeof
(
"a=fmtp:123 *
\r\n
"
);
outlen
+=
vsnprintf
(
NULL
,
0
,
fmtpfmt
,
a
p
);
}
else
*
sdp_fmtp
=
'\0'
;
if
(
asprintf
(
&
sdp_media
,
"m=%s %u %s %d
\r\n
"
"b=RR:0
\r\n
"
"%s"
"%s"
,
type
,
dport
,
protocol
,
pt
,
sdp_rtpmap
,
sdp_fmtp
)
==
-
1
)
newsdp
=
realloc
(
*
sdp
,
outlen
+
1
);
if
(
newsdp
==
NULL
)
return
NULL
;
return
sdp_media
;
*
sdp
=
newsdp
;
ptr
=
newsdp
+
inlen
;
/* RTP payload type map */
ptr
+=
sprintf
(
ptr
,
"a=rtpmap:%u %s
\r\n
"
,
pt
,
rtpmap
);
/* Format parameters */
if
(
fmtpfmt
!=
NULL
)
{
ptr
+=
sprintf
(
ptr
,
"a=fmtp:%u "
,
pt
);
ptr
+=
vsprintf
(
ptr
,
fmtpfmt
,
ap
);
}
return
newsdp
;
}
char
*
AddSDPMedia
(
c
onst
char
*
type
,
int
dport
,
const
char
*
protocol
,
unsigned
pt
,
const
char
*
rtpmap
,
const
char
*
fmtpfmt
,
...)
char
*
AddSDPMedia
(
c
har
**
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
(
type
,
dport
,
protocol
,
pt
,
rtpmap
,
fmtpfmt
,
ap
);
ret
=
vAddSDPMedia
(
sdp
,
type
,
dport
,
proto
,
pt
,
rtpmap
,
fmtpfmt
,
ap
);
va_end
(
ap
);
return
ret
;
}
src/stream_output/stream_output.h
View file @
f96ceadb
...
...
@@ -122,11 +122,10 @@ char *StartSDP (const char *name, const char *description, const char *url,
const
struct
sockaddr
*
orig
,
socklen_t
origlen
,
const
struct
sockaddr
*
addr
,
socklen_t
addrlen
);
char
*
vAddSDPMedia
(
c
onst
char
*
type
,
int
dport
,
const
char
*
protocol
,
char
*
vAddSDPMedia
(
c
har
**
sdp
,
const
char
*
type
,
int
dport
,
const
char
*
prot
,
unsigned
pt
,
const
char
*
rtpmap
,
const
char
*
fmtpfmt
,
va_list
ap
);
char
*
AddSDPMedia
(
const
char
*
type
,
int
dport
,
const
char
*
protocol
,
unsigned
pt
,
const
char
*
rtpmap
,
const
char
*
fmtpfmt
,
...);
char
*
AddSDPMedia
(
char
**
sdp
,
const
char
*
type
,
int
dport
,
const
char
*
proto
,
unsigned
pt
,
const
char
*
rtpmap
,
const
char
*
fmtpfmt
,
...);
#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