Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
9b3130c8
Commit
9b3130c8
authored
Jun 03, 2019
by
Anton Khirnov
Committed by
James Almer
Mar 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libmp3lame: convert to new channel layout API
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
53593818
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
libmp3lame.c
libavcodec/libmp3lame.c
+11
-4
No files found.
libavcodec/libmp3lame.c
View file @
9b3130c8
...
...
@@ -101,8 +101,9 @@ static av_cold int mp3lame_encode_init(AVCodecContext *avctx)
return
AVERROR
(
ENOMEM
);
lame_set_num_channels
(
s
->
gfp
,
avctx
->
channels
);
lame_set_mode
(
s
->
gfp
,
avctx
->
channels
>
1
?
s
->
joint_stereo
?
JOINT_STEREO
:
STEREO
:
MONO
);
lame_set_num_channels
(
s
->
gfp
,
avctx
->
ch_layout
.
nb_channels
);
lame_set_mode
(
s
->
gfp
,
avctx
->
ch_layout
.
nb_channels
>
1
?
s
->
joint_stereo
?
JOINT_STEREO
:
STEREO
:
MONO
);
/* sample rate */
lame_set_in_samplerate
(
s
->
gfp
,
avctx
->
sample_rate
);
...
...
@@ -151,7 +152,7 @@ static av_cold int mp3lame_encode_init(AVCodecContext *avctx)
/* allocate float sample buffers */
if
(
avctx
->
sample_fmt
==
AV_SAMPLE_FMT_FLTP
)
{
int
ch
;
for
(
ch
=
0
;
ch
<
avctx
->
channels
;
ch
++
)
{
for
(
ch
=
0
;
ch
<
avctx
->
ch
_layout
.
nb_ch
annels
;
ch
++
)
{
s
->
samples_flt
[
ch
]
=
av_malloc_array
(
avctx
->
frame_size
,
sizeof
(
*
s
->
samples_flt
[
ch
]));
if
(
!
s
->
samples_flt
[
ch
])
{
...
...
@@ -208,7 +209,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
av_log
(
avctx
,
AV_LOG_ERROR
,
"inadequate AVFrame plane padding
\n
"
);
return
AVERROR
(
EINVAL
);
}
for
(
ch
=
0
;
ch
<
avctx
->
channels
;
ch
++
)
{
for
(
ch
=
0
;
ch
<
avctx
->
ch
_layout
.
nb_ch
annels
;
ch
++
)
{
s
->
fdsp
->
vector_fmul_scalar
(
s
->
samples_flt
[
ch
],
(
const
float
*
)
frame
->
data
[
ch
],
32768
.
0
f
,
...
...
@@ -343,9 +344,15 @@ const AVCodec ff_libmp3lame_encoder = {
AV_SAMPLE_FMT_S16P
,
AV_SAMPLE_FMT_NONE
},
.
supported_samplerates
=
libmp3lame_sample_rates
,
#if FF_API_OLD_CHANNEL_LAYOUT
.
channel_layouts
=
(
const
uint64_t
[])
{
AV_CH_LAYOUT_MONO
,
AV_CH_LAYOUT_STEREO
,
0
},
#endif
.
ch_layouts
=
(
const
AVChannelLayout
[])
{
AV_CHANNEL_LAYOUT_MONO
,
AV_CHANNEL_LAYOUT_STEREO
,
{
0
},
},
.
priv_class
=
&
libmp3lame_class
,
.
defaults
=
libmp3lame_defaults
,
.
wrapper_name
=
"libmp3lame"
,
...
...
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