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
e5d4941c
Commit
e5d4941c
authored
Jun 03, 2019
by
Anton Khirnov
Committed by
James Almer
Mar 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvorbis: convert to new channel layout API
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
53bf0ed5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
22 deletions
+24
-22
libvorbisdec.c
libavcodec/libvorbisdec.c
+3
-1
libvorbisenc.c
libavcodec/libvorbisenc.c
+21
-21
No files found.
libavcodec/libvorbisdec.c
View file @
e5d4941c
...
...
@@ -112,7 +112,9 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) {
}
}
avccontext
->
channels
=
context
->
vi
.
channels
;
av_channel_layout_uninit
(
&
avccontext
->
ch_layout
);
avccontext
->
ch_layout
.
order
=
AV_CHANNEL_ORDER_UNSPEC
;
avccontext
->
ch_layout
.
nb_channels
=
context
->
vi
.
channels
;
avccontext
->
sample_rate
=
context
->
vi
.
rate
;
avccontext
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
avccontext
->
time_base
=
(
AVRational
){
1
,
avccontext
->
sample_rate
};
...
...
libavcodec/libvorbisenc.c
View file @
e5d4941c
...
...
@@ -96,6 +96,7 @@ static int vorbis_error_to_averror(int ov_err)
static
av_cold
int
libvorbis_setup
(
vorbis_info
*
vi
,
AVCodecContext
*
avctx
)
{
LibvorbisEncContext
*
s
=
avctx
->
priv_data
;
int
channels
=
avctx
->
ch_layout
.
nb_channels
;
double
cfreq
;
int
ret
;
...
...
@@ -108,7 +109,7 @@ static av_cold int libvorbis_setup(vorbis_info *vi, AVCodecContext *avctx)
/* default to 3 if the user did not set quality or bitrate */
if
(
!
(
avctx
->
flags
&
AV_CODEC_FLAG_QSCALE
))
q
=
3
.
0
;
if
((
ret
=
vorbis_encode_setup_vbr
(
vi
,
avctx
->
channels
,
if
((
ret
=
vorbis_encode_setup_vbr
(
vi
,
channels
,
avctx
->
sample_rate
,
q
/
10
.
0
)))
goto
error
;
...
...
@@ -117,7 +118,7 @@ static av_cold int libvorbis_setup(vorbis_info *vi, AVCodecContext *avctx)
int
maxrate
=
avctx
->
rc_max_rate
>
0
?
avctx
->
rc_max_rate
:
-
1
;
/* average bitrate */
if
((
ret
=
vorbis_encode_setup_managed
(
vi
,
avctx
->
channels
,
if
((
ret
=
vorbis_encode_setup_managed
(
vi
,
channels
,
avctx
->
sample_rate
,
maxrate
,
avctx
->
bit_rate
,
minrate
)))
goto
error
;
...
...
@@ -141,32 +142,31 @@ static av_cold int libvorbis_setup(vorbis_info *vi, AVCodecContext *avctx)
goto
error
;
}
if
(
avctx
->
channels
==
3
&&
avctx
->
channel_layout
!=
(
AV_CH_LAYOUT_STEREO
|
AV_CH_FRONT_CENTER
)
||
avctx
->
channels
==
4
&&
avctx
->
channel_layout
!=
AV_CH_LAYOUT_2_2
&&
avctx
->
channel_layout
!=
AV_CH_LAYOUT_QUAD
||
avctx
->
channels
==
5
&&
avctx
->
channel_layout
!=
AV_CH_LAYOUT_5POINT0
&&
avctx
->
channel_layout
!=
AV_CH_LAYOUT_5POINT0_BACK
||
avctx
->
channels
==
6
&&
avctx
->
channel_layout
!=
AV_CH_LAYOUT_5POINT1
&&
avctx
->
channel_layout
!=
AV_CH_LAYOUT_5POINT1_BACK
||
avctx
->
channels
==
7
&&
avctx
->
channel_layout
!=
(
AV_CH_LAYOUT_5POINT1
|
AV_CH_BACK_CENTER
)
||
avctx
->
channels
==
8
&&
avctx
->
channel_layout
!=
AV_CH_LAYOUT_7POINT1
)
{
if
(
avctx
->
ch
annel_layout
)
{
if
(
(
channels
==
3
&&
av_channel_layout_compare
(
&
avctx
->
ch_layout
,
&
(
AVChannelLayout
)
AV_CHANNEL_LAYOUT_SURROUND
)
)
||
(
channels
==
4
&&
av_channel_layout_compare
(
&
avctx
->
ch_layout
,
&
(
AVChannelLayout
)
AV_CHANNEL_LAYOUT_2_2
)
&&
av_channel_layout_compare
(
&
avctx
->
ch_layout
,
&
(
AVChannelLayout
)
AV_CHANNEL_LAYOUT_QUAD
))
||
(
channels
==
5
&&
av_channel_layout_compare
(
&
avctx
->
ch_layout
,
&
(
AVChannelLayout
)
AV_CHANNEL_LAYOUT_5POINT0
)
&&
av_channel_layout_compare
(
&
avctx
->
ch_layout
,
&
(
AVChannelLayout
)
AV_CHANNEL_LAYOUT_5POINT0_BACK
))
||
(
channels
==
6
&&
av_channel_layout_compare
(
&
avctx
->
ch_layout
,
&
(
AVChannelLayout
)
AV_CHANNEL_LAYOUT_5POINT1
)
&&
av_channel_layout_compare
(
&
avctx
->
ch_layout
,
&
(
AVChannelLayout
)
AV_CHANNEL_LAYOUT_5POINT1_BACK
))
||
(
channels
==
7
&&
av_channel_layout_compare
(
&
avctx
->
ch_layout
,
&
(
AVChannelLayout
)
AV_CHANNEL_LAYOUT_6POINT1
)
)
||
(
channels
==
8
&&
av_channel_layout_compare
(
&
avctx
->
ch_layout
,
&
(
AVChannelLayout
)
AV_CHANNEL_LAYOUT_7POINT1
))
)
{
if
(
avctx
->
ch
_layout
.
order
!=
AV_CHANNEL_ORDER_UNSPEC
)
{
char
name
[
32
];
av_get_channel_layout_string
(
name
,
sizeof
(
name
),
avctx
->
channels
,
avctx
->
channel_layout
);
av_channel_layout_describe
(
&
avctx
->
ch_layout
,
name
,
sizeof
(
name
));
av_log
(
avctx
,
AV_LOG_ERROR
,
"%s not supported by Vorbis: "
"output stream will have incorrect "
"channel layout.
\n
"
,
name
);
}
else
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"No channel layout specified. The encoder "
"will use Vorbis channel layout for "
"%d channels.
\n
"
,
avctx
->
channels
);
"%d channels.
\n
"
,
channels
);
}
}
...
...
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