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
3d2e27b5
Commit
3d2e27b5
authored
May 02, 2014
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fdkaac: simplify parameters setup
parent
6ea8c376
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
60 deletions
+34
-60
modules/codec/fdkaac.c
modules/codec/fdkaac.c
+34
-60
No files found.
modules/codec/fdkaac.c
View file @
3d2e27b5
...
@@ -229,7 +229,6 @@ static int OpenEncoder(vlc_object_t *p_this)
...
@@ -229,7 +229,6 @@ static int OpenEncoder(vlc_object_t *p_this)
else
else
i_aot
=
var_InheritInteger
(
p_enc
,
ENC_CFG_PREFIX
"profile"
);
i_aot
=
var_InheritInteger
(
p_enc
,
ENC_CFG_PREFIX
"profile"
);
bool
b_eld_sbr
=
var_InheritBool
(
p_enc
,
ENC_CFG_PREFIX
"sbr"
);
int
i_vbr
=
var_InheritInteger
(
p_enc
,
ENC_CFG_PREFIX
"vbr"
);
int
i_vbr
=
var_InheritInteger
(
p_enc
,
ENC_CFG_PREFIX
"vbr"
);
p_sys
->
i_pts_last
=
0
;
p_sys
->
i_pts_last
=
0
;
...
@@ -237,8 +236,10 @@ static int OpenEncoder(vlc_object_t *p_this)
...
@@ -237,8 +236,10 @@ static int OpenEncoder(vlc_object_t *p_this)
msg_Warn
(
p_enc
,
"Maximum VBR quality for this profile is 3, setting vbr=3"
);
msg_Warn
(
p_enc
,
"Maximum VBR quality for this profile is 3, setting vbr=3"
);
i_vbr
=
3
;
i_vbr
=
3
;
}
}
AACENC_ERROR
erraac
;
AACENC_ERROR
erraac
;
if
((
erraac
=
aacEncOpen
(
&
p_sys
->
handle
,
0
,
p_enc
->
fmt_in
.
audio
.
i_channels
))
!=
AACENC_OK
)
{
erraac
=
aacEncOpen
(
&
p_sys
->
handle
,
0
,
p_enc
->
fmt_in
.
audio
.
i_channels
);
if
(
erraac
!=
AACENC_OK
)
{
msg_Err
(
p_enc
,
"Unable to open encoder: %s"
,
aac_get_errorstring
(
erraac
));
msg_Err
(
p_enc
,
"Unable to open encoder: %s"
,
aac_get_errorstring
(
erraac
));
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -251,37 +252,25 @@ static int OpenEncoder(vlc_object_t *p_this)
...
@@ -251,37 +252,25 @@ static int OpenEncoder(vlc_object_t *p_this)
msg_Err
(
p_enc
,
"The ELD-AAC profile can only be used with stereo sources"
);
msg_Err
(
p_enc
,
"The ELD-AAC profile can only be used with stereo sources"
);
goto
error
;
goto
error
;
}
}
if
((
erraac
=
aacEncoder_SetParam
(
p_sys
->
handle
,
AACENC_AOT
,
i_aot
))
!=
AACENC_OK
)
{
msg_Err
(
p_enc
,
"Unable to set the Profile %i: %s"
,
i_aot
,
aac_get_errorstring
(
erraac
));
#define SET_PARAM(P, V) do { \
goto
error
;
AACENC_ERROR err = aacEncoder_SetParam(p_sys->handle, AACENC_ ## P, V); \
}
if (err != AACENC_OK) { \
if
(
i_aot
==
PROFILE_AAC_ELD
&&
b_eld_sbr
)
{
msg_Err(p_enc, "Couldn't set " #P " to value %d: %s", V, aac_get_errorstring(err)); \
if
((
erraac
=
aacEncoder_SetParam
(
p_sys
->
handle
,
AACENC_SBR_MODE
,
1
))
!=
AACENC_OK
)
{
goto error; \
msg_Err
(
p_enc
,
"Unable to set SBR mode for ELD: %s"
,
aac_get_errorstring
(
erraac
));
} \
goto
error
;
} while(0)
}
}
SET_PARAM
(
AOT
,
i_aot
);
if
((
erraac
=
aacEncoder_SetParam
(
p_sys
->
handle
,
AACENC_SAMPLERATE
,
bool
b_eld_sbr
=
var_InheritBool
(
p_enc
,
ENC_CFG_PREFIX
"sbr"
);
p_enc
->
fmt_out
.
audio
.
i_rate
))
!=
AACENC_OK
)
{
if
(
i_aot
==
PROFILE_AAC_ELD
&&
b_eld_sbr
)
msg_Err
(
p_enc
,
"Unable to set the sample rate %i: %s"
,
p_enc
->
fmt_out
.
audio
.
i_rate
,
SET_PARAM
(
SBR_MODE
,
1
);
aac_get_errorstring
(
erraac
));
SET_PARAM
(
SAMPLERATE
,
p_enc
->
fmt_out
.
audio
.
i_rate
);
goto
error
;
SET_PARAM
(
CHANNELMODE
,
mode
);
}
SET_PARAM
(
CHANNELORDER
,
CH_ORDER_WG4
);
if
((
erraac
=
aacEncoder_SetParam
(
p_sys
->
handle
,
AACENC_CHANNELMODE
,
mode
))
!=
AACENC_OK
)
{
if
(
i_vbr
!=
0
)
msg_Err
(
p_enc
,
"Unable to set the channel mode: %s"
,
aac_get_errorstring
(
erraac
));
SET_PARAM
(
BITRATEMODE
,
i_vbr
);
goto
error
;
else
{
}
if
((
erraac
=
aacEncoder_SetParam
(
p_sys
->
handle
,
AACENC_CHANNELORDER
,
CH_ORDER_WG4
))
!=
AACENC_OK
)
{
msg_Err
(
p_enc
,
"Unable to set the sound channel order: %s"
,
aac_get_errorstring
(
erraac
));
goto
error
;
}
if
(
i_vbr
!=
0
)
{
if
((
erraac
=
aacEncoder_SetParam
(
p_sys
->
handle
,
AACENC_BITRATEMODE
,
i_vbr
))
!=
AACENC_OK
)
{
msg_Err
(
p_enc
,
"Unable to set the VBR bitrate mode: %s"
,
aac_get_errorstring
(
erraac
));
goto
error
;
}
}
else
{
int
i_bitrate
=
p_enc
->
fmt_out
.
i_bitrate
;
int
i_bitrate
=
p_enc
->
fmt_out
.
i_bitrate
;
if
(
i_bitrate
==
0
)
{
if
(
i_bitrate
==
0
)
{
i_bitrate
=
96
*
p_enc
->
fmt_in
.
audio
.
i_channels
*
p_enc
->
fmt_out
.
audio
.
i_rate
/
44
;
i_bitrate
=
96
*
p_enc
->
fmt_in
.
audio
.
i_channels
*
p_enc
->
fmt_out
.
audio
.
i_rate
/
44
;
...
@@ -290,36 +279,22 @@ static int OpenEncoder(vlc_object_t *p_this)
...
@@ -290,36 +279,22 @@ static int OpenEncoder(vlc_object_t *p_this)
p_enc
->
fmt_out
.
i_bitrate
=
i_bitrate
;
p_enc
->
fmt_out
.
i_bitrate
=
i_bitrate
;
msg_Info
(
p_enc
,
"Setting optimal bitrate of %i"
,
i_bitrate
);
msg_Info
(
p_enc
,
"Setting optimal bitrate of %i"
,
i_bitrate
);
}
}
if
((
erraac
=
aacEncoder_SetParam
(
p_sys
->
handle
,
AACENC_BITRATE
,
SET_PARAM
(
BITRATE
,
i_bitrate
);
i_bitrate
))
!=
AACENC_OK
)
{
msg_Err
(
p_enc
,
"Unable to set the bitrate %i: %s"
,
i_bitrate
,
aac_get_errorstring
(
erraac
));
goto
error
;
}
}
if
((
erraac
=
aacEncoder_SetParam
(
p_sys
->
handle
,
AACENC_TRANSMUX
,
0
))
!=
AACENC_OK
)
{
msg_Err
(
p_enc
,
"Unable to set the ADTS transmux: %s"
,
aac_get_errorstring
(
erraac
));
goto
error
;
}
if
((
erraac
=
aacEncoder_SetParam
(
p_sys
->
handle
,
AACENC_SIGNALING_MODE
,
(
int
)
var_InheritInteger
(
p_enc
,
ENC_CFG_PREFIX
"signaling"
)))
!=
AACENC_OK
)
{
/* use explicit backward compatible =1 */
/* use explicit hierarchical signaling =2 */
msg_Err
(
p_enc
,
"Unable to set signaling mode: %s"
,
aac_get_errorstring
(
erraac
));
goto
error
;
}
}
if
((
erraac
=
aacEncoder_SetParam
(
p_sys
->
handle
,
AACENC_AFTERBURNER
,
SET_PARAM
(
TRANSMUX
,
0
);
!!
var_InheritBool
(
p_enc
,
ENC_CFG_PREFIX
"afterburner"
)))
!=
SET_PARAM
(
SIGNALING_MODE
,
(
int
)
var_InheritInteger
(
p_enc
,
ENC_CFG_PREFIX
"signaling"
));
AACENC_OK
)
{
SET_PARAM
(
AFTERBURNER
,
!!
var_InheritBool
(
p_enc
,
ENC_CFG_PREFIX
"afterburner"
));
msg_Err
(
p_enc
,
"Unable to set the afterburner mode: %s"
,
aac_get_errorstring
(
erraac
));
#undef SET_PARAM
goto
error
;
}
erraac
=
aacEncEncode
(
p_sys
->
handle
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
(
erraac
=
aacEncEncode
(
p_sys
->
handle
,
NULL
,
NULL
,
NULL
,
NULL
))
!=
AACENC_OK
)
{
if
(
erraac
!=
AACENC_OK
)
{
msg_Err
(
p_enc
,
"Unable to initialize the encoder: %s"
,
aac_get_errorstring
(
erraac
));
msg_Err
(
p_enc
,
"Unable to initialize the encoder: %s"
,
aac_get_errorstring
(
erraac
));
goto
error
;
goto
error
;
}
}
AACENC_InfoStruct
info
=
{
0
};
AACENC_InfoStruct
info
=
{
0
};
if
((
erraac
=
aacEncInfo
(
p_sys
->
handle
,
&
info
))
!=
AACENC_OK
)
{
erraac
=
aacEncInfo
(
p_sys
->
handle
,
&
info
);
if
(
erraac
!=
AACENC_OK
)
{
msg_Err
(
p_enc
,
"Unable to get the encoder info: %s"
,
aac_get_errorstring
(
erraac
));
msg_Err
(
p_enc
,
"Unable to get the encoder info: %s"
,
aac_get_errorstring
(
erraac
));
goto
error
;
goto
error
;
}
}
...
@@ -337,8 +312,7 @@ static int OpenEncoder(vlc_object_t *p_this)
...
@@ -337,8 +312,7 @@ static int OpenEncoder(vlc_object_t *p_this)
msg_Err
(
p_enc
,
"Unable to allocate fmt_out.p_extra"
);
msg_Err
(
p_enc
,
"Unable to allocate fmt_out.p_extra"
);
goto
error
;
goto
error
;
}
}
memcpy
(
p_enc
->
fmt_out
.
p_extra
,
info
.
confBuf
,
memcpy
(
p_enc
->
fmt_out
.
p_extra
,
info
.
confBuf
,
p_enc
->
fmt_out
.
i_extra
);
p_enc
->
fmt_out
.
i_extra
);
}
}
p_enc
->
pf_encode_audio
=
EncodeAudio
;
p_enc
->
pf_encode_audio
=
EncodeAudio
;
...
...
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