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
a7cec3a0
Commit
a7cec3a0
authored
Aug 27, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libmp3lame: add 'reservoir' private option.
Deprecate CODEC_FLAG2_BIT_RESERVOIR
parent
88262ca8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
1 deletion
+29
-1
avcodec.h
libavcodec/avcodec.h
+2
-0
libmp3lame.c
libavcodec/libmp3lame.c
+22
-1
options.c
libavcodec/options.c
+2
-0
version.h
libavcodec/version.h
+3
-0
No files found.
libavcodec/avcodec.h
View file @
a7cec3a0
...
...
@@ -628,7 +628,9 @@ typedef struct RcOverride{
#if FF_API_MPEGVIDEO_GLOBAL_OPTS
#define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer.
#endif
#if FF_API_LAME_GLOBAL_OPTS
#define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible
#endif
#define CODEC_FLAG2_MBTREE 0x00040000 ///< Use macroblock tree ratecontrol (x264 only)
#define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations.
#if FF_API_X264_GLOBAL_OPTS
...
...
libavcodec/libmp3lame.c
View file @
a7cec3a0
...
...
@@ -25,16 +25,20 @@
*/
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "mpegaudio.h"
#include <lame/lame.h>
#define BUFFER_SIZE (7200 + 2*MPA_FRAME_SIZE + MPA_FRAME_SIZE/4)
typedef
struct
Mp3AudioContext
{
AVClass
*
class
;
lame_global_flags
*
gfp
;
int
stereo
;
uint8_t
buffer
[
BUFFER_SIZE
];
int
buffer_index
;
int
reservoir
;
}
Mp3AudioContext
;
static
av_cold
int
MP3lame_encode_init
(
AVCodecContext
*
avctx
)
...
...
@@ -64,7 +68,10 @@ static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
lame_set_VBR_quality
(
s
->
gfp
,
avctx
->
global_quality
/
(
float
)
FF_QP2LAMBDA
);
}
lame_set_bWriteVbrTag
(
s
->
gfp
,
0
);
lame_set_disable_reservoir
(
s
->
gfp
,
avctx
->
flags2
&
CODEC_FLAG2_BIT_RESERVOIR
?
0
:
1
);
#if FF_API_LAME_GLOBAL_OPTIONS
s
->
reservoir
=
avctx
->
flags2
&
CODEC_FLAG2_BIT_RESERVOIR
;
#endif
lame_set_disable_reservoir
(
s
->
gfp
,
!
s
->
reservoir
);
if
(
lame_init_params
(
s
->
gfp
)
<
0
)
goto
err_close
;
...
...
@@ -213,6 +220,19 @@ static av_cold int MP3lame_encode_close(AVCodecContext *avctx)
return
0
;
}
#define OFFSET(x) offsetof(Mp3AudioContext, x)
#define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static
const
AVOption
options
[]
=
{
{
"reservoir"
,
"Use bit reservoir."
,
OFFSET
(
reservoir
),
FF_OPT_TYPE_INT
,
{
1
},
0
,
1
,
AE
},
{
NULL
},
};
static
const
AVClass
libmp3lame_class
=
{
.
class_name
=
"libmp3lame encoder"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
AVCodec
ff_libmp3lame_encoder
=
{
.
name
=
"libmp3lame"
,
...
...
@@ -226,4 +246,5 @@ AVCodec ff_libmp3lame_encoder = {
.
sample_fmts
=
(
const
enum
AVSampleFormat
[]){
AV_SAMPLE_FMT_S16
,
AV_SAMPLE_FMT_NONE
},
.
supported_samplerates
=
sSampleRates
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"libmp3lame MP3 (MPEG audio layer 3)"
),
.
priv_class
=
&
libmp3lame_class
,
};
libavcodec/options.c
View file @
a7cec3a0
...
...
@@ -431,7 +431,9 @@ static const AVOption options[]={
#if FF_API_DRC_SCALE
{
"drc_scale"
,
"percentage of dynamic range compression to apply"
,
OFFSET
(
drc_scale
),
FF_OPT_TYPE_FLOAT
,
{.
dbl
=
1
.
0
},
0
.
0
,
1
.
0
,
A
|
D
},
#endif
#if FF_API_LAME_GLOBAL_OPTS
{
"reservoir"
,
"use bit reservoir"
,
0
,
FF_OPT_TYPE_CONST
,
{.
dbl
=
CODEC_FLAG2_BIT_RESERVOIR
},
INT_MIN
,
INT_MAX
,
A
|
E
,
"flags2"
},
#endif
{
"mbtree"
,
"use macroblock tree ratecontrol (x264 only)"
,
0
,
FF_OPT_TYPE_CONST
,
{.
dbl
=
CODEC_FLAG2_MBTREE
},
INT_MIN
,
INT_MAX
,
V
|
E
,
"flags2"
},
{
"bits_per_raw_sample"
,
NULL
,
OFFSET
(
bits_per_raw_sample
),
FF_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
},
{
"channel_layout"
,
NULL
,
OFFSET
(
channel_layout
),
FF_OPT_TYPE_INT64
,
{.
dbl
=
DEFAULT
},
0
,
INT64_MAX
,
A
|
E
|
D
,
"channel_layout"
},
...
...
libavcodec/version.h
View file @
a7cec3a0
...
...
@@ -89,5 +89,8 @@
#ifndef FF_API_MPEGVIDEO_GLOBAL_OPTS
#define FF_API_MPEGVIDEO_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_LAME_GLOBAL_OPTS
#define FF_API_LAME_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
#endif
/* AVCODEC_VERSION_H */
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