Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
458
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
10576415
Commit
10576415
authored
3 years ago
by
Rémi Denis-Courmont
Committed by
Hugo Beauzée-Luyssen
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
rtp/pcm: add audio/G726-{16,24,32,40} ADPCM formats
parent
478e4dac
No related branches found
Branches containing commit
No related tags found
1 merge request
!957
RTP G722 and G726 ADPCM formats
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/access/rtp/pcm.c
+37
-3
37 additions, 3 deletions
modules/access/rtp/pcm.c
with
37 additions
and
3 deletions
modules/access/rtp/pcm.c
+
37
−
3
View file @
10576415
/**
* @file pcm.c
* @brief Real-Time Protocol (RTP) linear and logarithmic audio
* @brief Real-Time Protocol (RTP) sample-based audio
* This files defines the same-based RTP payload formats (mostly from RFC3551)
* including linear, logarithmic and adaptive audio formats.
*/
/*****************************************************************************
* Copyright © 2021 Rémi Denis-Courmont
...
...
@@ -132,6 +134,26 @@ static const struct vlc_rtp_pt_operations rtp_pcm_ops = {
rtp_pcm_release
,
rtp_pcm_init
,
rtp_pcm_destroy
,
rtp_pcm_decode
,
};
static
void
*
rtp_g726_init
(
struct
vlc_rtp_pt
*
pt
)
{
struct
rtp_pcm
*
sys
=
pt
->
opaque
;
es_format_t
fmt
;
es_format_Init
(
&
fmt
,
AUDIO_ES
,
VLC_CODEC_ADPCM_G726
);
fmt
.
audio
.
i_rate
=
8000
;
fmt
.
audio
.
i_physical_channels
=
sys
->
channel_mask
;
fmt
.
audio
.
i_channels
=
sys
->
channel_count
;
/* By VLC convention, the decoder knows the bit depth from the bit rate. */
fmt
.
i_bitrate
=
sys
->
sample_bits
*
sys
->
channel_count
*
8000
;
aout_FormatPrepare
(
&
fmt
.
audio
);
return
vlc_rtp_pt_request_es
(
pt
,
&
fmt
);
}
static
const
struct
vlc_rtp_pt_operations
rtp_g726_ops
=
{
rtp_pcm_release
,
rtp_g726_init
,
rtp_pcm_destroy
,
rtp_pcm_decode
,
};
static
const
uint32_t
channel_masks
[]
=
{
/* By default, there is only one channel. */
AOUT_CHAN_CENTER
,
...
...
@@ -164,6 +186,7 @@ static int rtp_pcm_open(vlc_object_t *obj, struct vlc_rtp_pt *pt,
{
vlc_fourcc_t
fourcc
;
unsigned
bits
;
const
struct
vlc_rtp_pt_operations
*
ops
=
&
rtp_pcm_ops
;
if
(
vlc_ascii_strcasecmp
(
desc
->
name
,
"L8"
)
==
0
)
{
fourcc
=
VLC_CODEC_U8
;
/* RFC3551 §4.5.10 */
...
...
@@ -189,6 +212,15 @@ static int rtp_pcm_open(vlc_object_t *obj, struct vlc_rtp_pt *pt,
fourcc
=
VLC_CODEC_MULAW
;
/* RFC3551 §4.5.14 */
bits
=
8
;
}
else
if
(
sscanf
(
desc
->
name
,
"G726-%u"
,
&
bits
)
==
1
||
sscanf
(
desc
->
name
,
"g726-%u"
,
&
bits
)
==
1
)
{
fourcc
=
VLC_CODEC_ADPCM_G726
;
/* RFC33551 §4.5.4 */
bits
/=
8
;
ops
=
&
rtp_g726_ops
;
if
(
unlikely
(
bits
<
16
||
bits
%
8
||
bits
>
40
))
return
VLC_ENOTSUP
;
}
else
if
(
vlc_ascii_strcasecmp
(
desc
->
name
,
"DAT12"
)
==
0
)
{
fourcc
=
VLC_CODEC_DAT12
;
/* RFC3190 §3 */
bits
=
12
;
...
...
@@ -227,7 +259,7 @@ static int rtp_pcm_open(vlc_object_t *obj, struct vlc_rtp_pt *pt,
}
pt
->
opaque
=
sys
;
pt
->
ops
=
&
rtp_pcm_
ops
;
pt
->
ops
=
ops
;
return
VLC_SUCCESS
;
}
...
...
@@ -238,5 +270,7 @@ vlc_module_begin()
set_subcategory
(
SUBCAT_INPUT_DEMUX
)
set_rtp_parser_callback
(
rtp_pcm_open
)
add_shortcut
(
"audio/L8"
,
"audio/L16"
,
"audio/L20"
,
"audio/L24"
,
"audio/DAT12"
,
"audio/PCMA"
,
"audio/PCMU"
)
"audio/DAT12"
,
"audio/PCMA"
,
"audio/PCMU"
,
"audio/G726-16"
,
"audio/G726-24"
,
"audio/G726-32"
,
"audio/G726-40"
)
/* TODO? DVI4, G722, VDVI */
vlc_module_end
()
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