Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
590285cc
Commit
590285cc
authored
May 02, 2014
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fdkaac: simplify parameters checks
parent
3d2e27b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
35 deletions
+32
-35
modules/codec/fdkaac.c
modules/codec/fdkaac.c
+32
-35
No files found.
modules/codec/fdkaac.c
View file @
590285cc
...
...
@@ -180,14 +180,32 @@ static int OpenEncoder(vlc_object_t *p_this)
{
encoder_t
*
p_enc
=
(
encoder_t
*
)
p_this
;
if
(
p_enc
->
fmt_out
.
i_codec
!=
VLC_FOURCC
(
'l'
,
'a'
,
'a'
,
'c'
)
&&
p_enc
->
fmt_out
.
i_codec
!=
VLC_FOURCC
(
'h'
,
'a'
,
'a'
,
'c'
)
&&
p_enc
->
fmt_out
.
i_codec
!=
VLC_FOURCC
(
's'
,
'a'
,
'a'
,
'c'
)
&&
p_enc
->
fmt_out
.
i_codec
!=
VLC_CODEC_MP4A
)
{
config_ChainParse
(
p_enc
,
ENC_CFG_PREFIX
,
ppsz_enc_options
,
p_enc
->
p_cfg
);
int
i_aot
;
switch
(
p_enc
->
fmt_out
.
i_codec
)
{
case
VLC_CODEC_MP4A
:
i_aot
=
var_InheritInteger
(
p_enc
,
ENC_CFG_PREFIX
"profile"
);
break
;
case
VLC_FOURCC
(
'l'
,
'a'
,
'a'
,
'c'
):
i_aot
=
PROFILE_AAC_LC
;
break
;
case
VLC_FOURCC
(
'h'
,
'a'
,
'a'
,
'c'
):
i_aot
=
PROFILE_AAC_HE
;
break
;
case
VLC_FOURCC
(
's'
,
'a'
,
'a'
,
'c'
):
i_aot
=
PROFILE_AAC_HE_v2
;
break
;
default:
return
VLC_EGENERIC
;
}
if
(
p_enc
->
fmt_in
.
audio
.
i_channels
!=
2
)
if
(
i_aot
==
PROFILE_AAC_HE_v2
||
i_aot
==
PROFILE_AAC_ELD
)
{
msg_Err
(
p_enc
,
"Selected profile %d can only be used with stereo"
,
i_aot
);
return
VLC_EGENERIC
;
}
uint16_t
channel_config
;
CHANNEL_MODE
mode
;
switch
(
p_enc
->
fmt_in
.
audio
.
i_channels
)
{
...
...
@@ -217,26 +235,8 @@ static int OpenEncoder(vlc_object_t *p_this)
p_enc
->
fmt_out
.
i_cat
=
AUDIO_ES
;
p_enc
->
fmt_out
.
i_codec
=
VLC_CODEC_MP4A
;
config_ChainParse
(
p_enc
,
ENC_CFG_PREFIX
,
ppsz_enc_options
,
p_enc
->
p_cfg
);
int
i_aot
;
/* This stores the aac profile chosen */
if
(
p_enc
->
fmt_out
.
i_codec
==
VLC_FOURCC
(
'l'
,
'a'
,
'a'
,
'c'
))
i_aot
=
PROFILE_AAC_LC
;
else
if
(
p_enc
->
fmt_out
.
i_codec
==
VLC_FOURCC
(
'h'
,
'a'
,
'a'
,
'c'
))
i_aot
=
PROFILE_AAC_HE
;
else
if
(
p_enc
->
fmt_out
.
i_codec
==
VLC_FOURCC
(
's'
,
'a'
,
'a'
,
'c'
))
i_aot
=
PROFILE_AAC_HE_v2
;
else
i_aot
=
var_InheritInteger
(
p_enc
,
ENC_CFG_PREFIX
"profile"
);
int
i_vbr
=
var_InheritInteger
(
p_enc
,
ENC_CFG_PREFIX
"vbr"
);
p_sys
->
i_pts_last
=
0
;
if
((
i_aot
==
PROFILE_AAC_HE
||
i_aot
==
PROFILE_AAC_HE_v2
)
&&
i_vbr
>
3
)
{
msg_Warn
(
p_enc
,
"Maximum VBR quality for this profile is 3, setting vbr=3"
);
i_vbr
=
3
;
}
AACENC_ERROR
erraac
;
erraac
=
aacEncOpen
(
&
p_sys
->
handle
,
0
,
p_enc
->
fmt_in
.
audio
.
i_channels
);
if
(
erraac
!=
AACENC_OK
)
{
...
...
@@ -244,14 +244,6 @@ static int OpenEncoder(vlc_object_t *p_this)
free
(
p_sys
);
return
VLC_EGENERIC
;
}
if
(
i_aot
==
PROFILE_AAC_HE_v2
&&
p_enc
->
fmt_in
.
audio
.
i_channels
!=
2
)
{
msg_Err
(
p_enc
,
"The HE-AAC-v2 profile can only be used with stereo sources"
);
goto
error
;
}
if
(
i_aot
==
PROFILE_AAC_ELD
&&
p_enc
->
fmt_in
.
audio
.
i_channels
!=
2
)
{
msg_Err
(
p_enc
,
"The ELD-AAC profile can only be used with stereo sources"
);
goto
error
;
}
#define SET_PARAM(P, V) do { \
AACENC_ERROR err = aacEncoder_SetParam(p_sys->handle, AACENC_ ## P, V); \
...
...
@@ -268,9 +260,15 @@ static int OpenEncoder(vlc_object_t *p_this)
SET_PARAM
(
SAMPLERATE
,
p_enc
->
fmt_out
.
audio
.
i_rate
);
SET_PARAM
(
CHANNELMODE
,
mode
);
SET_PARAM
(
CHANNELORDER
,
CH_ORDER_WG4
);
if
(
i_vbr
!=
0
)
int
i_vbr
=
var_InheritInteger
(
p_enc
,
ENC_CFG_PREFIX
"vbr"
);
if
(
i_vbr
!=
0
)
{
if
((
i_aot
==
PROFILE_AAC_HE
||
i_aot
==
PROFILE_AAC_HE_v2
)
&&
i_vbr
>
3
)
{
msg_Warn
(
p_enc
,
"Maximum VBR quality for this profile is 3, setting vbr=3"
);
i_vbr
=
3
;
}
SET_PARAM
(
BITRATEMODE
,
i_vbr
);
else
{
}
else
{
int
i_bitrate
=
p_enc
->
fmt_out
.
i_bitrate
;
if
(
i_bitrate
==
0
)
{
i_bitrate
=
96
*
p_enc
->
fmt_in
.
audio
.
i_channels
*
p_enc
->
fmt_out
.
audio
.
i_rate
/
44
;
...
...
@@ -325,8 +323,7 @@ static int OpenEncoder(vlc_object_t *p_this)
return
VLC_SUCCESS
;
error:
aacEncClose
(
&
p_sys
->
handle
);
free
(
p_sys
);
CloseEncoder
(
p_this
);
return
VLC_EGENERIC
;
}
...
...
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