Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
e600a1e4
Commit
e600a1e4
authored
Jan 31, 2012
by
Alex Converse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aacdec: Simplify output configuration.
parent
0144fe69
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
aacdec.c
libavcodec/aacdec.c
+15
-15
No files found.
libavcodec/aacdec.c
View file @
e600a1e4
...
...
@@ -189,10 +189,10 @@ static int count_channels(enum ChannelPosition che_pos[4][MAX_ELEM_ID])
* @return Returns error status. 0 - OK, !0 - error
*/
static
av_cold
int
che_configure
(
AACContext
*
ac
,
enum
ChannelPosition
che_pos
[
4
][
MAX_ELEM_ID
]
,
enum
ChannelPosition
che_pos
,
int
type
,
int
id
,
int
*
channels
)
{
if
(
che_pos
[
type
][
id
]
)
{
if
(
che_pos
)
{
if
(
!
ac
->
che
[
type
][
id
])
{
if
(
!
(
ac
->
che
[
type
][
id
]
=
av_mallocz
(
sizeof
(
ChannelElement
))))
return
AVERROR
(
ENOMEM
);
...
...
@@ -222,22 +222,21 @@ static av_cold int che_configure(AACContext *ac,
* @return Returns error status. 0 - OK, !0 - error
*/
static
av_cold
int
output_configure
(
AACContext
*
ac
,
enum
ChannelPosition
che_pos
[
4
][
MAX_ELEM_ID
],
enum
ChannelPosition
new_che_pos
[
4
][
MAX_ELEM_ID
],
int
channel_config
,
enum
OCStatus
oc_type
)
{
AVCodecContext
*
avctx
=
ac
->
avctx
;
int
i
,
type
,
channels
=
0
,
ret
;
if
(
new_che_pos
!=
che_pos
)
memcpy
(
che_pos
,
new_che_pos
,
4
*
MAX_ELEM_ID
*
sizeof
(
new_che_pos
[
0
][
0
]));
if
(
new_che_pos
)
memcpy
(
ac
->
che_pos
,
new_che_pos
,
4
*
MAX_ELEM_ID
*
sizeof
(
new_che_pos
[
0
][
0
]));
if
(
channel_config
)
{
for
(
i
=
0
;
i
<
tags_per_config
[
channel_config
];
i
++
)
{
i
f
((
ret
=
che_configure
(
ac
,
che_pos
,
aac_channel_layout_map
[
channel_config
-
1
][
i
][
0
],
aac_channel_layout_map
[
channel_config
-
1
][
i
][
1
],
&
channels
)))
i
nt
id
=
aac_channel_layout_map
[
channel_config
-
1
][
i
][
1
];
type
=
aac_channel_layout_map
[
channel_config
-
1
][
i
][
0
];
if
((
ret
=
che_configure
(
ac
,
ac
->
che_pos
[
type
][
id
],
type
,
id
,
&
channels
)))
return
ret
;
}
...
...
@@ -256,7 +255,8 @@ static av_cold int output_configure(AACContext *ac,
for
(
i
=
0
;
i
<
MAX_ELEM_ID
;
i
++
)
{
for
(
type
=
0
;
type
<
4
;
type
++
)
{
if
((
ret
=
che_configure
(
ac
,
che_pos
,
type
,
i
,
&
channels
)))
if
((
ret
=
che_configure
(
ac
,
ac
->
che_pos
[
type
][
i
],
type
,
i
,
&
channels
)))
return
ret
;
}
}
...
...
@@ -437,7 +437,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
}
else
if
(
m4ac
->
sbr
==
1
&&
m4ac
->
ps
==
-
1
)
m4ac
->
ps
=
1
;
if
(
ac
&&
(
ret
=
output_configure
(
ac
,
ac
->
che_pos
,
new_che_pos
,
channel_config
,
OC_GLOBAL_HDR
)))
if
(
ac
&&
(
ret
=
output_configure
(
ac
,
new_che_pos
,
channel_config
,
OC_GLOBAL_HDR
)))
return
ret
;
if
(
extension_flag
)
{
...
...
@@ -610,7 +610,7 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
if
(
ac
->
m4ac
.
chan_config
)
{
int
ret
=
set_default_channel_config
(
avctx
,
new_che_pos
,
ac
->
m4ac
.
chan_config
);
if
(
!
ret
)
output_configure
(
ac
,
ac
->
che_pos
,
new_che_pos
,
ac
->
m4ac
.
chan_config
,
OC_GLOBAL_HDR
);
output_configure
(
ac
,
new_che_pos
,
ac
->
m4ac
.
chan_config
,
OC_GLOBAL_HDR
);
else
if
(
avctx
->
err_recognition
&
AV_EF_EXPLODE
)
return
AVERROR_INVALIDDATA
;
}
...
...
@@ -1714,7 +1714,7 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
}
else
if
(
ac
->
m4ac
.
ps
==
-
1
&&
ac
->
output_configured
<
OC_LOCKED
&&
ac
->
avctx
->
channels
==
1
)
{
ac
->
m4ac
.
sbr
=
1
;
ac
->
m4ac
.
ps
=
1
;
output_configure
(
ac
,
ac
->
che_pos
,
ac
->
che_pos
,
ac
->
m4ac
.
chan_config
,
ac
->
output_configured
);
output_configure
(
ac
,
NULL
,
ac
->
m4ac
.
chan_config
,
ac
->
output_configured
);
}
else
{
ac
->
m4ac
.
sbr
=
1
;
}
...
...
@@ -2097,7 +2097,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
ac
->
m4ac
.
chan_config
=
hdr_info
.
chan_config
;
if
(
set_default_channel_config
(
ac
->
avctx
,
new_che_pos
,
hdr_info
.
chan_config
))
return
-
7
;
if
(
output_configure
(
ac
,
ac
->
che_pos
,
new_che_pos
,
hdr_info
.
chan_config
,
if
(
output_configure
(
ac
,
new_che_pos
,
hdr_info
.
chan_config
,
FFMAX
(
ac
->
output_configured
,
OC_TRIAL_FRAME
)))
return
-
7
;
}
else
if
(
ac
->
output_configured
!=
OC_LOCKED
)
{
...
...
@@ -2192,7 +2192,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Not evaluating a further program_config_element as this construct is dubious at best.
\n
"
);
else
err
=
output_configure
(
ac
,
ac
->
che_pos
,
new_che_pos
,
0
,
OC_TRIAL_PCE
);
err
=
output_configure
(
ac
,
new_che_pos
,
0
,
OC_TRIAL_PCE
);
break
;
}
...
...
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