Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
4fef4b6d
Commit
4fef4b6d
authored
Dec 22, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: simplify audio sample format mapping
parent
0198b074
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
34 deletions
+18
-34
modules/codec/avcodec/audio.c
modules/codec/avcodec/audio.c
+14
-30
modules/codec/avcodec/avcodec.h
modules/codec/avcodec/avcodec.h
+1
-1
modules/codec/avcodec/encoder.c
modules/codec/avcodec/encoder.c
+3
-3
No files found.
modules/codec/avcodec/audio.c
View file @
4fef4b6d
...
...
@@ -407,33 +407,18 @@ void EndAudioDec( decoder_t *p_dec )
*
*****************************************************************************/
v
oid
GetVlcAudioFormat
(
vlc_fourcc_t
*
pi_codec
,
unsigned
*
pi_bits
,
int
i_sample_
fmt
)
v
lc_fourcc_t
GetVlcAudioFormat
(
int
fmt
)
{
switch
(
i_sample_fmt
)
{
case
AV_SAMPLE_FMT_U8
:
*
pi_codec
=
VLC_CODEC_U8
;
*
pi_bits
=
8
;
break
;
case
AV_SAMPLE_FMT_S32
:
*
pi_codec
=
VLC_CODEC_S32N
;
*
pi_bits
=
32
;
break
;
case
AV_SAMPLE_FMT_FLT
:
*
pi_codec
=
VLC_CODEC_FL32
;
*
pi_bits
=
32
;
break
;
case
AV_SAMPLE_FMT_DBL
:
*
pi_codec
=
VLC_CODEC_FL64
;
*
pi_bits
=
64
;
break
;
case
AV_SAMPLE_FMT_S16
:
default:
*
pi_codec
=
VLC_CODEC_S16N
;
*
pi_bits
=
16
;
break
;
}
static
const
vlc_fourcc_t
fcc
[]
=
{
[
AV_SAMPLE_FMT_U8
]
=
VLC_CODEC_U8
,
[
AV_SAMPLE_FMT_S16
]
=
VLC_CODEC_S16N
,
[
AV_SAMPLE_FMT_S32
]
=
VLC_CODEC_S32N
,
[
AV_SAMPLE_FMT_FLT
]
=
VLC_CODEC_FL32
,
[
AV_SAMPLE_FMT_DBL
]
=
VLC_CODEC_FL64
,
};
if
(
sizeof
(
fcc
)
/
sizeof
(
fcc
[
0
])
<
(
unsigned
)
fmt
)
return
fcc
[
fmt
];
return
VLC_CODEC_S16N
;
}
static
const
uint64_t
pi_channels_map
[][
2
]
=
...
...
@@ -464,9 +449,8 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
GetVlcAudioFormat
(
&
p_dec
->
fmt_out
.
i_codec
,
&
p_dec
->
fmt_out
.
audio
.
i_bitspersample
,
p_sys
->
p_context
->
sample_fmt
);
p_dec
->
fmt_out
.
i_codec
=
GetVlcAudioFormat
(
p_sys
->
p_context
->
sample_fmt
);
p_dec
->
fmt_out
.
audio
.
i_format
=
p_dec
->
fmt_out
.
i_codec
;
p_dec
->
fmt_out
.
audio
.
i_rate
=
p_sys
->
p_context
->
sample_rate
;
/* */
...
...
@@ -518,6 +502,6 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
p_dec
->
fmt_out
.
audio
.
i_physical_channels
=
p_dec
->
fmt_out
.
audio
.
i_original_channels
=
i_layout_dst
;
p_dec
->
fmt_out
.
audio
.
i_channels
=
i_channels_dst
;
aout_FormatPrepare
(
&
p_dec
->
fmt_out
.
audio
)
;
}
modules/codec/avcodec/avcodec.h
View file @
4fef4b6d
...
...
@@ -27,7 +27,7 @@ int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
int
*
pi_ffmpeg_codec
,
const
char
**
ppsz_name
);
int
GetVlcFourcc
(
int
i_ffmpeg_codec
,
int
*
pi_cat
,
vlc_fourcc_t
*
pi_fourcc
,
const
char
**
ppsz_name
);
v
oid
GetVlcAudioFormat
(
vlc_fourcc_t
*
,
unsigned
*
pi_bits
,
int
i_sample_fmt
);
v
lc_fourcc_t
GetVlcAudioFormat
(
int
i_sample_fmt
);
picture_t
*
DecodeVideo
(
decoder_t
*
,
block_t
**
);
block_t
*
DecodeAudio
(
decoder_t
*
,
block_t
**
);
...
...
modules/codec/avcodec/encoder.c
View file @
4fef4b6d
...
...
@@ -807,9 +807,9 @@ int OpenEncoder( vlc_object_t *p_this )
if
(
p_enc
->
fmt_in
.
i_cat
==
AUDIO_ES
)
{
GetVlcAudioFormat
(
&
p_enc
->
fmt_in
.
i_codec
,
&
p_enc
->
fmt_in
.
audio
.
i_bitspersample
,
p_sys
->
p_context
->
sample_fmt
);
p_enc
->
fmt_in
.
i_codec
=
GetVlcAudioFormat
(
p_sys
->
p_context
->
sample_fmt
);
p_enc
->
fmt_in
.
audio
.
i_bitspersample
=
aout_BitsPerSample
(
p_enc
->
fmt_in
.
i_codec
);
p_sys
->
i_sample_bytes
=
(
p_enc
->
fmt_in
.
audio
.
i_bitspersample
/
8
)
*
p_context
->
channels
;
p_sys
->
i_frame_size
=
p_context
->
frame_size
>
1
?
...
...
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