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
60db8724
Commit
60db8724
authored
May 01, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helper for SDP media description formatting
parent
7681a9b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
2 deletions
+60
-2
src/stream_output/sdp.c
src/stream_output/sdp.c
+58
-2
src/stream_output/stream_output.h
src/stream_output/stream_output.h
+2
-0
No files found.
src/stream_output/sdp.c
View file @
60db8724
...
@@ -24,6 +24,9 @@
...
@@ -24,6 +24,9 @@
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <string.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <vlc_network.h>
#include <vlc_network.h>
#include <vlc_charset.h>
#include <vlc_charset.h>
...
@@ -108,8 +111,8 @@ char *StartSDP (const char *name, const char *description, const char *url,
...
@@ -108,8 +111,8 @@ char *StartSDP (const char *name, const char *description, const char *url,
if
(
!
IsSDPString
(
name
)
||
!
IsSDPString
(
description
)
if
(
!
IsSDPString
(
name
)
||
!
IsSDPString
(
description
)
||
!
IsSDPString
(
url
)
||
!
IsSDPString
(
email
)
||
!
IsSDPString
(
phone
)
||
!
IsSDPString
(
url
)
||
!
IsSDPString
(
email
)
||
!
IsSDPString
(
phone
)
||
(
AddressToSDP
(
(
struct
sockaddr
*
)
orig
,
origlen
,
machine
)
==
NULL
)
||
(
AddressToSDP
(
orig
,
origlen
,
machine
)
==
NULL
)
||
(
AddressToSDP
(
(
struct
sockaddr
*
)
addr
,
addrlen
,
conn
)
==
NULL
))
||
(
AddressToSDP
(
addr
,
addrlen
,
conn
)
==
NULL
))
return
NULL
;
return
NULL
;
if
(
ssm
)
if
(
ssm
)
...
@@ -149,3 +152,56 @@ char *StartSDP (const char *name, const char *description, const char *url,
...
@@ -149,3 +152,56 @@ char *StartSDP (const char *name, const char *description, const char *url,
return
sdp
;
return
sdp
;
}
}
char
*
MakeSDPMedia
(
const
char
*
type
,
int
dport
,
const
char
*
protocol
,
unsigned
pt
,
const
char
*
rtpmap
,
const
char
*
fmtpfmt
,
...)
{
char
*
sdp_media
=
NULL
;
/* Some default values */
if
(
type
==
NULL
)
type
=
"video"
;
if
(
dport
==
0
)
dport
=
9
;
if
(
protocol
==
NULL
)
protocol
=
"RTP/AVP"
;
assert
(
pt
<
128u
);
/* 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'
;
/* Format parameters */
char
*
fmtp
=
NULL
;
if
(
fmtpfmt
!=
NULL
)
{
va_list
ap
;
va_start
(
ap
,
fmtpfmt
);
if
(
vasprintf
(
&
fmtp
,
fmtpfmt
,
ap
)
==
-
1
)
fmtpfmt
=
NULL
;
va_end
(
ap
);
if
(
fmtp
==
NULL
)
return
NULL
;
}
char
sdp_fmtp
[
fmtp
?
(
sizeof
(
"a=fmtp:123 *
\r\n
"
)
+
strlen
(
fmtp
))
:
1
];
if
(
fmtp
!=
NULL
)
{
sprintf
(
sdp_fmtp
,
"a=fmtp:%u %s
\r\n
"
,
pt
,
fmtp
);
free
(
fmtp
);
}
else
*
sdp_fmtp
=
'\0'
;
if
(
asprintf
(
&
sdp_media
,
"m=%s %u %s %d
\r\n
"
"%s"
"%s"
,
type
,
dport
,
protocol
,
pt
,
sdp_rtpmap
,
sdp_fmtp
)
==
-
1
)
return
NULL
;
return
sdp_media
;
}
src/stream_output/stream_output.h
View file @
60db8724
...
@@ -116,4 +116,6 @@ char *StartSDP (const char *name, const char *description, const char *url,
...
@@ -116,4 +116,6 @@ char *StartSDP (const char *name, const char *description, const char *url,
const
char
*
email
,
const
char
*
phone
,
vlc_bool_t
ssm
,
const
char
*
email
,
const
char
*
phone
,
vlc_bool_t
ssm
,
const
struct
sockaddr
*
orig
,
socklen_t
origlen
,
const
struct
sockaddr
*
orig
,
socklen_t
origlen
,
const
struct
sockaddr
*
addr
,
socklen_t
addrlen
);
const
struct
sockaddr
*
addr
,
socklen_t
addrlen
);
char
*
MakeSDPMedia
(
const
char
*
type
,
int
dport
,
const
char
*
protocol
,
unsigned
pt
,
const
char
*
rtpmap
,
const
char
*
fmtp
,
...);
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