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
1bca72e1
Commit
1bca72e1
authored
May 29, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eac3enc: support writing of basic mixing and info metadata
parent
e72f3d10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
210 additions
and
93 deletions
+210
-93
ac3enc.c
libavcodec/ac3enc.c
+159
-80
ac3enc.h
libavcodec/ac3enc.h
+2
-0
ac3enc_opts_template.c
libavcodec/ac3enc_opts_template.c
+6
-8
ac3enc_template.c
libavcodec/ac3enc_template.c
+1
-1
eac3enc.c
libavcodec/eac3enc.c
+42
-4
No files found.
libavcodec/ac3enc.c
View file @
1bca72e1
This diff is collapsed.
Click to expand it.
libavcodec/ac3enc.h
View file @
1bca72e1
...
...
@@ -91,6 +91,8 @@ typedef struct AC3EncOptions {
int
dolby_surround_ex_mode
;
int
dolby_headphone_mode
;
int
ad_converter_type
;
int
eac3_mixing_metadata
;
int
eac3_info_metadata
;
/* other encoding options */
int
allow_per_frame_metadata
;
...
...
libavcodec/ac3enc_opts_template.c
View file @
1bca72e1
...
...
@@ -29,12 +29,13 @@ static const AVOption ac3_options[] = {
#else
/* AC3ENC_TYPE_EAC3 */
static
const
AVOption
eac3_options
[]
=
{
#endif
#if AC3ENC_TYPE != AC3ENC_TYPE_EAC3
/* Metadata Options */
{
"per_frame_metadata"
,
"Allow Changing Metadata Per-Frame"
,
OFFSET
(
allow_per_frame_metadata
),
FF_OPT_TYPE_INT
,
{.
dbl
=
0
},
0
,
1
,
AC3ENC_PARAM
},
/* downmix levels */
#if AC3ENC_TYPE != AC3ENC_TYPE_EAC3
/* AC-3 downmix levels */
{
"center_mixlev"
,
"Center Mix Level"
,
OFFSET
(
center_mix_level
),
FF_OPT_TYPE_FLOAT
,
{.
dbl
=
LEVEL_MINUS_4POINT5DB
},
0
.
0
,
1
.
0
,
AC3ENC_PARAM
},
{
"surround_mixlev"
,
"Surround Mix Level"
,
OFFSET
(
surround_mix_level
),
FF_OPT_TYPE_FLOAT
,
{.
dbl
=
LEVEL_MINUS_6DB
},
0
.
0
,
1
.
0
,
AC3ENC_PARAM
},
#endif
/* audio production information */
{
"mixing_level"
,
"Mixing Level"
,
OFFSET
(
mixing_level
),
FF_OPT_TYPE_INT
,
{.
dbl
=
-
1
},
-
1
,
111
,
AC3ENC_PARAM
},
{
"room_type"
,
"Room Type"
,
OFFSET
(
room_type
),
FF_OPT_TYPE_INT
,
{.
dbl
=
-
1
},
-
1
,
2
,
AC3ENC_PARAM
,
"room_type"
},
...
...
@@ -42,15 +43,13 @@ static const AVOption eac3_options[] = {
{
"large"
,
"Large Room"
,
0
,
FF_OPT_TYPE_CONST
,
{.
dbl
=
1
},
INT_MIN
,
INT_MAX
,
AC3ENC_PARAM
,
"room_type"
},
{
"small"
,
"Small Room"
,
0
,
FF_OPT_TYPE_CONST
,
{.
dbl
=
2
},
INT_MIN
,
INT_MAX
,
AC3ENC_PARAM
,
"room_type"
},
/* other metadata options */
{
"copyright"
,
"Copyright Bit"
,
OFFSET
(
copyright
),
FF_OPT_TYPE_INT
,
{.
dbl
=
0
},
0
,
1
,
AC3ENC_PARAM
},
#endif
{
"copyright"
,
"Copyright Bit"
,
OFFSET
(
copyright
),
FF_OPT_TYPE_INT
,
{.
dbl
=
-
1
},
-
1
,
1
,
AC3ENC_PARAM
},
{
"dialnorm"
,
"Dialogue Level (dB)"
,
OFFSET
(
dialogue_level
),
FF_OPT_TYPE_INT
,
{.
dbl
=
-
31
},
-
31
,
-
1
,
AC3ENC_PARAM
},
#if AC3ENC_TYPE != AC3ENC_TYPE_EAC3
{
"dsur_mode"
,
"Dolby Surround Mode"
,
OFFSET
(
dolby_surround_mode
),
FF_OPT_TYPE_INT
,
{.
dbl
=
0
},
0
,
2
,
AC3ENC_PARAM
,
"dsur_mode"
},
{
"dsur_mode"
,
"Dolby Surround Mode"
,
OFFSET
(
dolby_surround_mode
),
FF_OPT_TYPE_INT
,
{.
dbl
=
-
1
},
-
1
,
2
,
AC3ENC_PARAM
,
"dsur_mode"
},
{
"notindicated"
,
"Not Indicated (default)"
,
0
,
FF_OPT_TYPE_CONST
,
{.
dbl
=
0
},
INT_MIN
,
INT_MAX
,
AC3ENC_PARAM
,
"dsur_mode"
},
{
"on"
,
"Dolby Surround Encoded"
,
0
,
FF_OPT_TYPE_CONST
,
{.
dbl
=
1
},
INT_MIN
,
INT_MAX
,
AC3ENC_PARAM
,
"dsur_mode"
},
{
"off"
,
"Not Dolby Surround Encoded"
,
0
,
FF_OPT_TYPE_CONST
,
{.
dbl
=
2
},
INT_MIN
,
INT_MAX
,
AC3ENC_PARAM
,
"dsur_mode"
},
{
"original"
,
"Original Bit Stream"
,
OFFSET
(
original
),
FF_OPT_TYPE_INT
,
{.
dbl
=
1
},
0
,
1
,
AC3ENC_PARAM
},
{
"original"
,
"Original Bit Stream"
,
OFFSET
(
original
),
FF_OPT_TYPE_INT
,
{.
dbl
=
-
1
},
-
1
,
1
,
AC3ENC_PARAM
},
/* extended bitstream information */
{
"dmix_mode"
,
"Preferred Stereo Downmix Mode"
,
OFFSET
(
preferred_stereo_downmix
),
FF_OPT_TYPE_INT
,
{.
dbl
=
-
1
},
-
1
,
2
,
AC3ENC_PARAM
,
"dmix_mode"
},
{
"notindicated"
,
"Not Indicated (default)"
,
0
,
FF_OPT_TYPE_CONST
,
{.
dbl
=
0
},
INT_MIN
,
INT_MAX
,
AC3ENC_PARAM
,
"dmix_mode"
},
...
...
@@ -71,7 +70,6 @@ static const AVOption eac3_options[] = {
{
"ad_conv_type"
,
"A/D Converter Type"
,
OFFSET
(
ad_converter_type
),
FF_OPT_TYPE_INT
,
{.
dbl
=
-
1
},
-
1
,
1
,
AC3ENC_PARAM
,
"ad_conv_type"
},
{
"standard"
,
"Standard (default)"
,
0
,
FF_OPT_TYPE_CONST
,
{.
dbl
=
0
},
INT_MIN
,
INT_MAX
,
AC3ENC_PARAM
,
"ad_conv_type"
},
{
"hdcd"
,
"HDCD"
,
0
,
FF_OPT_TYPE_CONST
,
{.
dbl
=
1
},
INT_MIN
,
INT_MAX
,
AC3ENC_PARAM
,
"ad_conv_type"
},
#endif
/* Other Encoding Options */
{
"stereo_rematrixing"
,
"Stereo Rematrixing"
,
OFFSET
(
stereo_rematrixing
),
FF_OPT_TYPE_INT
,
{.
dbl
=
1
},
0
,
1
,
AC3ENC_PARAM
},
#if AC3ENC_TYPE != AC3ENC_TYPE_AC3_FIXED
...
...
libavcodec/ac3enc_template.c
View file @
1bca72e1
...
...
@@ -423,7 +423,7 @@ int AC3_NAME(encode_frame)(AVCodecContext *avctx, unsigned char *frame,
const
SampleType
*
samples
=
data
;
int
ret
;
if
(
!
s
->
eac3
&&
s
->
options
.
allow_per_frame_metadata
)
{
if
(
s
->
options
.
allow_per_frame_metadata
)
{
ret
=
ff_ac3_validate_metadata
(
s
);
if
(
ret
)
return
ret
;
...
...
libavcodec/eac3enc.c
View file @
1bca72e1
...
...
@@ -142,10 +142,48 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s)
put_bits
(
&
s
->
pb
,
5
,
s
->
bitstream_id
);
/* bitstream id (EAC3=16) */
put_bits
(
&
s
->
pb
,
5
,
-
opt
->
dialogue_level
);
/* dialogue normalization level */
put_bits
(
&
s
->
pb
,
1
,
0
);
/* no compression gain */
put_bits
(
&
s
->
pb
,
1
,
0
);
/* no mixing metadata */
/* TODO: mixing metadata */
put_bits
(
&
s
->
pb
,
1
,
0
);
/* no info metadata */
/* TODO: info metadata */
/* mixing metadata*/
put_bits
(
&
s
->
pb
,
1
,
opt
->
eac3_mixing_metadata
);
if
(
opt
->
eac3_mixing_metadata
)
{
if
(
s
->
channel_mode
>
AC3_CHMODE_STEREO
)
put_bits
(
&
s
->
pb
,
2
,
opt
->
preferred_stereo_downmix
);
if
(
s
->
has_center
)
{
put_bits
(
&
s
->
pb
,
3
,
s
->
ltrt_center_mix_level
);
put_bits
(
&
s
->
pb
,
3
,
s
->
loro_center_mix_level
);
}
if
(
s
->
has_surround
)
{
put_bits
(
&
s
->
pb
,
3
,
s
->
ltrt_surround_mix_level
);
put_bits
(
&
s
->
pb
,
3
,
s
->
loro_surround_mix_level
);
}
if
(
s
->
lfe_on
)
put_bits
(
&
s
->
pb
,
1
,
0
);
put_bits
(
&
s
->
pb
,
1
,
0
);
/* no program scale */
put_bits
(
&
s
->
pb
,
1
,
0
);
/* no ext program scale */
put_bits
(
&
s
->
pb
,
2
,
0
);
/* no mixing parameters */
if
(
s
->
channel_mode
<
AC3_CHMODE_STEREO
)
put_bits
(
&
s
->
pb
,
1
,
0
);
/* no pan info */
put_bits
(
&
s
->
pb
,
1
,
0
);
/* no frame mix config info */
}
/* info metadata*/
put_bits
(
&
s
->
pb
,
1
,
opt
->
eac3_info_metadata
);
if
(
opt
->
eac3_info_metadata
)
{
put_bits
(
&
s
->
pb
,
3
,
s
->
bitstream_mode
);
put_bits
(
&
s
->
pb
,
1
,
opt
->
copyright
);
put_bits
(
&
s
->
pb
,
1
,
opt
->
original
);
if
(
s
->
channel_mode
==
AC3_CHMODE_STEREO
)
{
put_bits
(
&
s
->
pb
,
2
,
opt
->
dolby_surround_mode
);
put_bits
(
&
s
->
pb
,
2
,
opt
->
dolby_headphone_mode
);
}
if
(
s
->
channel_mode
>=
AC3_CHMODE_2F2R
)
put_bits
(
&
s
->
pb
,
2
,
opt
->
dolby_surround_ex_mode
);
put_bits
(
&
s
->
pb
,
1
,
opt
->
audio_production_info
);
if
(
opt
->
audio_production_info
)
{
put_bits
(
&
s
->
pb
,
5
,
opt
->
mixing_level
-
80
);
put_bits
(
&
s
->
pb
,
2
,
opt
->
room_type
);
put_bits
(
&
s
->
pb
,
1
,
opt
->
ad_converter_type
);
}
put_bits
(
&
s
->
pb
,
1
,
0
);
}
if
(
s
->
num_blocks
!=
6
)
put_bits
(
&
s
->
pb
,
1
,
!
(
s
->
avctx
->
frame_number
%
6
));
/* converter sync flag */
put_bits
(
&
s
->
pb
,
1
,
0
);
/* no additional bit stream info */
...
...
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