Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jean-Baptiste Kempf
VLC
Commits
cafec9d0
Commit
cafec9d0
authored
3 years ago
by
Rémi Denis-Courmont
Browse files
Options
Downloads
Patches
Plain Diff
rtp: add module capabilities for RTP payload type parsers
parent
504d5aa6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/access/rtp/rtp.c
+34
-0
34 additions, 0 deletions
modules/access/rtp/rtp.c
modules/access/rtp/rtp.h
+24
-0
24 additions, 0 deletions
modules/access/rtp/rtp.h
modules/access/rtp/rtpfmt.c
+4
-1
4 additions, 1 deletion
modules/access/rtp/rtpfmt.c
with
62 additions
and
1 deletion
modules/access/rtp/rtp.c
+
34
−
0
View file @
cafec9d0
...
...
@@ -151,6 +151,40 @@ static const struct vlc_rtp_pt_owner_operations vlc_rtp_pt_owner_ops = {
vlc_rtp_es_request
,
vlc_rtp_mux_request
,
};
int
vlc_rtp_pt_instantiate
(
vlc_object_t
*
obj
,
struct
vlc_rtp_pt
*
restrict
pt
,
const
struct
vlc_sdp_pt
*
restrict
desc
)
{
char
modname
[
32
];
int
ret
=
VLC_ENOTSUP
;
if
(
strchr
(
desc
->
name
,
','
)
!=
NULL
)
/* Comma has special meaning in vlc_module_match(), forbid it */
return
VLC_EINVAL
;
if
((
size_t
)
snprintf
(
modname
,
sizeof
(
modname
),
"%s/%s"
,
desc
->
media
->
type
,
desc
->
name
)
>=
sizeof
(
modname
))
return
VLC_ENOTSUP
;
/* Outlandish media type with long name */
module_t
**
mods
;
ssize_t
n
=
vlc_module_match
(
"rtp parser"
,
modname
,
true
,
&
mods
,
NULL
);
for
(
ssize_t
i
=
0
;
i
<
n
;
i
++
)
{
vlc_rtp_parser_cb
cb
=
vlc_module_map
(
vlc_object_logger
(
obj
),
mods
[
i
]);
if
(
cb
==
NULL
)
continue
;
ret
=
cb
(
obj
,
pt
,
desc
);
if
(
ret
==
VLC_SUCCESS
)
{
msg_Dbg
(
obj
,
"- module
\"
%s
\"
"
,
module_get_name
(
mods
[
i
],
true
));
assert
(
pt
->
ops
!=
NULL
);
ret
=
0
;
break
;
}
}
free
(
mods
);
return
ret
;
}
/**
* Extracts port number from "[host]:port" or "host:port" strings,
* and remove brackets from the host name.
...
...
This diff is collapsed.
Click to expand it.
modules/access/rtp/rtp.h
+
24
−
0
View file @
cafec9d0
...
...
@@ -244,6 +244,30 @@ static inline void vlc_rtp_es_send(struct vlc_rtp_es *es, block_t *block)
*/
extern
struct
vlc_rtp_es
*
const
vlc_rtp_es_dummy
;
/**
* Callback prototype for RTP parser module.
*
* This is the callback prototype for any RTP payload format parser module.
*
* \param obj VLC object for logging and configuration
* \param pt RTP payload type
* \param desc[in] SDP payload format description and type mapping
*
* \return VLC_SUCCESS on success, an error code on failure.
*/
typedef
int
(
*
vlc_rtp_parser_cb
)(
vlc_object_t
*
obj
,
struct
vlc_rtp_pt
*
pt
,
const
struct
vlc_sdp_pt
*
desc
);
#define set_rtp_parser_callback(cb) \
{ \
vlc_rtp_parser_cb cb__ = (cb); (void) cb__; \
set_callback(cb); \
set_capability("rtp parser", 0); \
}
int
vlc_rtp_pt_instantiate
(
vlc_object_t
*
obj
,
struct
vlc_rtp_pt
*
restrict
pt
,
const
struct
vlc_sdp_pt
*
restrict
desc
);
void
rtp_autodetect
(
vlc_object_t
*
,
rtp_session_t
*
,
const
struct
vlc_rtp_pt_owner
*
restrict
);
...
...
This diff is collapsed.
Click to expand it.
modules/access/rtp/rtpfmt.c
+
4
−
1
View file @
cafec9d0
...
...
@@ -258,9 +258,12 @@ static struct vlc_rtp_pt *vlc_rtp_pt_create(vlc_object_t *obj,
pt
->
owner
=
*
owner
;
pt
->
frequency
=
desc
->
clock_rate
;
pt
->
channel_count
=
desc
->
channel_count
;
if
(
vlc_rtp_pt_instantiate
(
obj
,
pt
,
desc
)
==
0
)
return
pt
;
pt
->
ops
=
NULL
;
/* TODO: introduce module (capabilities) for payload types */
if
(
strcmp
(
desc
->
media
->
type
,
"audio"
)
==
0
)
{
if
(
strcmp
(
desc
->
name
,
"PCMU"
)
==
0
)
pt
->
ops
=
&
rtp_audio_pcmu
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment