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
ae929709
Commit
ae929709
authored
Mar 26, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/eac3: add support for dependent stream
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
e5819fa6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
167 additions
and
53 deletions
+167
-53
Changelog
Changelog
+1
-0
aac_ac3_parser.c
libavcodec/aac_ac3_parser.c
+6
-3
ac3_parser.c
libavcodec/ac3_parser.c
+1
-1
ac3dec.c
libavcodec/ac3dec.c
+145
-34
ac3dec.h
libavcodec/ac3dec.h
+7
-3
eac3dec.c
libavcodec/eac3dec.c
+3
-8
ts-demux
tests/ref/fate/ts-demux
+1
-1
lavf-rm
tests/ref/seek/lavf-rm
+3
-3
No files found.
Changelog
View file @
ae929709
...
@@ -49,6 +49,7 @@ version <next>:
...
@@ -49,6 +49,7 @@ version <next>:
- hapqa_extract bitstream filter
- hapqa_extract bitstream filter
- filter_units bitstream filter
- filter_units bitstream filter
- AV1 Support through libaom
- AV1 Support through libaom
- E-AC-3 dependent frames support
version 3.4:
version 3.4:
...
...
libavcodec/aac_ac3_parser.c
View file @
ae929709
...
@@ -86,13 +86,16 @@ get_next:
...
@@ -86,13 +86,16 @@ get_next:
the frame). */
the frame). */
if
(
avctx
->
codec_id
!=
AV_CODEC_ID_AAC
)
{
if
(
avctx
->
codec_id
!=
AV_CODEC_ID_AAC
)
{
avctx
->
sample_rate
=
s
->
sample_rate
;
avctx
->
sample_rate
=
s
->
sample_rate
;
avctx
->
channels
=
s
->
channels
;
if
(
avctx
->
codec_id
!=
AV_CODEC_ID_EAC3
)
{
avctx
->
channel_layout
=
s
->
channel_layout
;
avctx
->
channels
=
s
->
channels
;
avctx
->
channel_layout
=
s
->
channel_layout
;
}
s1
->
duration
=
s
->
samples
;
s1
->
duration
=
s
->
samples
;
avctx
->
audio_service_type
=
s
->
service_type
;
avctx
->
audio_service_type
=
s
->
service_type
;
}
}
avctx
->
bit_rate
=
s
->
bit_rate
;
if
(
avctx
->
codec_id
!=
AV_CODEC_ID_EAC3
)
avctx
->
bit_rate
=
s
->
bit_rate
;
}
}
return
i
;
return
i
;
...
...
libavcodec/ac3_parser.c
View file @
ae929709
...
@@ -218,8 +218,8 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
...
@@ -218,8 +218,8 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
else
if
(
hdr_info
->
codec_id
==
AV_CODEC_ID_NONE
)
else
if
(
hdr_info
->
codec_id
==
AV_CODEC_ID_NONE
)
hdr_info
->
codec_id
=
AV_CODEC_ID_AC3
;
hdr_info
->
codec_id
=
AV_CODEC_ID_AC3
;
*
need_next_header
=
(
hdr
.
frame_type
!=
EAC3_FRAME_TYPE_AC3_CONVERT
);
*
new_frame_start
=
(
hdr
.
frame_type
!=
EAC3_FRAME_TYPE_DEPENDENT
);
*
new_frame_start
=
(
hdr
.
frame_type
!=
EAC3_FRAME_TYPE_DEPENDENT
);
*
need_next_header
=
*
new_frame_start
||
(
hdr
.
frame_type
!=
EAC3_FRAME_TYPE_AC3_CONVERT
);
return
hdr
.
frame_size
;
return
hdr
.
frame_size
;
}
}
...
...
libavcodec/ac3dec.c
View file @
ae929709
This diff is collapsed.
Click to expand it.
libavcodec/ac3dec.h
View file @
ae929709
...
@@ -76,6 +76,7 @@ typedef struct AC3DecodeContext {
...
@@ -76,6 +76,7 @@ typedef struct AC3DecodeContext {
///@{
///@{
int
frame_type
;
///< frame type (strmtyp)
int
frame_type
;
///< frame type (strmtyp)
int
substreamid
;
///< substream identification
int
substreamid
;
///< substream identification
int
superframe_size
;
///< current superframe size, in bytes
int
frame_size
;
///< current frame size, in bytes
int
frame_size
;
///< current frame size, in bytes
int
bit_rate
;
///< stream bit rate, in bits-per-second
int
bit_rate
;
///< stream bit rate, in bits-per-second
int
sample_rate
;
///< sample frequency, in Hz
int
sample_rate
;
///< sample frequency, in Hz
...
@@ -87,7 +88,7 @@ typedef struct AC3DecodeContext {
...
@@ -87,7 +88,7 @@ typedef struct AC3DecodeContext {
int
dialog_normalization
[
2
];
///< dialog level in dBFS (dialnorm)
int
dialog_normalization
[
2
];
///< dialog level in dBFS (dialnorm)
int
compression_exists
[
2
];
///< compression field is valid for frame (compre)
int
compression_exists
[
2
];
///< compression field is valid for frame (compre)
int
compression_gain
[
2
];
///< gain to apply for heavy compression (compr)
int
compression_gain
[
2
];
///< gain to apply for heavy compression (compr)
int
channel_map
;
///< custom channel map
int
channel_map
;
///< custom channel map
(chanmap)
int
preferred_downmix
;
///< Preferred 2-channel downmix mode (dmixmod)
int
preferred_downmix
;
///< Preferred 2-channel downmix mode (dmixmod)
int
center_mix_level
;
///< Center mix level index
int
center_mix_level
;
///< Center mix level index
int
center_mix_level_ltrt
;
///< Center mix level index for Lt/Rt (ltrtcmixlev)
int
center_mix_level_ltrt
;
///< Center mix level index for Lt/Rt (ltrtcmixlev)
...
@@ -164,7 +165,9 @@ typedef struct AC3DecodeContext {
...
@@ -164,7 +165,9 @@ typedef struct AC3DecodeContext {
SHORTFLOAT
*
downmix_coeffs
[
2
];
///< stereo downmix coefficients
SHORTFLOAT
*
downmix_coeffs
[
2
];
///< stereo downmix coefficients
int
downmixed
;
///< indicates if coeffs are currently downmixed
int
downmixed
;
///< indicates if coeffs are currently downmixed
int
output_mode
;
///< output channel configuration
int
output_mode
;
///< output channel configuration
int
prev_output_mode
;
///< output channel configuration for previous frame
int
out_channels
;
///< number of output channels
int
out_channels
;
///< number of output channels
int
prev_bit_rate
;
///< stream bit rate, in bits-per-second for previous frame
///@}
///@}
///@name Dynamic range
///@name Dynamic range
...
@@ -239,11 +242,12 @@ typedef struct AC3DecodeContext {
...
@@ -239,11 +242,12 @@ typedef struct AC3DecodeContext {
///@name Aligned arrays
///@name Aligned arrays
DECLARE_ALIGNED
(
16
,
int
,
fixed_coeffs
)[
AC3_MAX_CHANNELS
][
AC3_MAX_COEFS
];
///< fixed-point transform coefficients
DECLARE_ALIGNED
(
16
,
int
,
fixed_coeffs
)[
AC3_MAX_CHANNELS
][
AC3_MAX_COEFS
];
///< fixed-point transform coefficients
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
transform_coeffs
)[
AC3_MAX_CHANNELS
][
AC3_MAX_COEFS
];
///< transform coefficients
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
transform_coeffs
)[
AC3_MAX_CHANNELS
][
AC3_MAX_COEFS
];
///< transform coefficients
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
delay
)[
AC3_MAX_CHANNELS
][
AC3_BLOCK_SIZE
];
///< delay - added to the next block
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
delay
)[
2
*
AC3_MAX_CHANNELS
][
AC3_BLOCK_SIZE
];
///< delay - added to the next block
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
window
)[
AC3_BLOCK_SIZE
];
///< window coefficients
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
window
)[
AC3_BLOCK_SIZE
];
///< window coefficients
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
tmp_output
)[
AC3_BLOCK_SIZE
];
///< temporary storage for output before windowing
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
tmp_output
)[
AC3_BLOCK_SIZE
];
///< temporary storage for output before windowing
DECLARE_ALIGNED
(
32
,
SHORTFLOAT
,
output
)[
AC3_MAX_CHANNELS
][
AC3_BLOCK_SIZE
];
///< output after imdct transform and windowing
DECLARE_ALIGNED
(
32
,
SHORTFLOAT
,
output
)[
2
*
AC3_MAX_CHANNELS
][
AC3_BLOCK_SIZE
];
///< output after imdct transform and windowing
DECLARE_ALIGNED
(
32
,
uint8_t
,
input_buffer
)[
AC3_FRAME_BUFFER_SIZE
+
AV_INPUT_BUFFER_PADDING_SIZE
];
///< temp buffer to prevent overread
DECLARE_ALIGNED
(
32
,
uint8_t
,
input_buffer
)[
AC3_FRAME_BUFFER_SIZE
+
AV_INPUT_BUFFER_PADDING_SIZE
];
///< temp buffer to prevent overread
DECLARE_ALIGNED
(
32
,
SHORTFLOAT
,
output_buffer
)[
2
*
AC3_MAX_CHANNELS
][
AC3_BLOCK_SIZE
*
6
];
///< final output buffer
///@}
///@}
}
AC3DecodeContext
;
}
AC3DecodeContext
;
...
...
libavcodec/eac3dec.c
View file @
ae929709
...
@@ -303,13 +303,7 @@ static int ff_eac3_parse_header(AC3DecodeContext *s)
...
@@ -303,13 +303,7 @@ static int ff_eac3_parse_header(AC3DecodeContext *s)
/* An E-AC-3 stream can have multiple independent streams which the
/* An E-AC-3 stream can have multiple independent streams which the
application can select from. each independent stream can also contain
application can select from. each independent stream can also contain
dependent streams which are used to add or replace channels. */
dependent streams which are used to add or replace channels. */
if
(
s
->
frame_type
==
EAC3_FRAME_TYPE_DEPENDENT
)
{
if
(
s
->
frame_type
==
EAC3_FRAME_TYPE_RESERVED
)
{
if
(
!
s
->
eac3_frame_dependent_found
)
{
s
->
eac3_frame_dependent_found
=
1
;
avpriv_request_sample
(
s
->
avctx
,
"Dependent substream decoding"
);
}
return
AAC_AC3_PARSE_ERROR_FRAME_TYPE
;
}
else
if
(
s
->
frame_type
==
EAC3_FRAME_TYPE_RESERVED
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Reserved frame type
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Reserved frame type
\n
"
);
return
AAC_AC3_PARSE_ERROR_FRAME_TYPE
;
return
AAC_AC3_PARSE_ERROR_FRAME_TYPE
;
}
}
...
@@ -355,7 +349,8 @@ static int ff_eac3_parse_header(AC3DecodeContext *s)
...
@@ -355,7 +349,8 @@ static int ff_eac3_parse_header(AC3DecodeContext *s)
/* dependent stream channel map */
/* dependent stream channel map */
if
(
s
->
frame_type
==
EAC3_FRAME_TYPE_DEPENDENT
)
{
if
(
s
->
frame_type
==
EAC3_FRAME_TYPE_DEPENDENT
)
{
if
(
get_bits1
(
gbc
))
{
if
(
get_bits1
(
gbc
))
{
skip_bits
(
gbc
,
16
);
// skip custom channel map
s
->
channel_map
=
get_bits
(
gbc
,
16
);
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"channel_map: %0X
\n
"
,
s
->
channel_map
);
}
}
}
}
...
...
tests/ref/fate/ts-demux
View file @
ae929709
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
1, 0, 0, 2880, 1536, 0x773ffeea, S=1, 1, 0x00bd00bd
1, 0, 0, 2880, 1536, 0x773ffeea, S=1, 1, 0x00bd00bd
1, 2880, 2880, 2880, 1536, 0x6dc10748
1, 2880, 2880, 2880, 1536, 0x6dc10748
1, 5760, 5760, 2880, 1536, 0xbab5129c
1, 5760, 5760, 2880, 1536, 0xbab5129c
1, 8640, 8640, 2880, 1536, 0x602f034b
1, 8640, 8640, 2880, 1536, 0x602f034b
, S=1, 1, 0x00bd00bd
1, 11520, 11520, 2880, 906, 0x69cdcbcd
1, 11520, 11520, 2880, 906, 0x69cdcbcd
0, 32037, 36541, 1501, 114336, 0x37a215a8, S=1, 1, 0x00e000e0
0, 32037, 36541, 1501, 114336, 0x37a215a8, S=1, 1, 0x00e000e0
0, 33538, 33538, 1501, 12560, 0xb559a3d4, F=0x0, S=1, 1, 0x00e000e0
0, 33538, 33538, 1501, 12560, 0xb559a3d4, F=0x0, S=1, 1, 0x00e000e0
...
...
tests/ref/seek/lavf-rm
View file @
ae929709
ret: 0 st:
1 flags:1 dts: 0.000000 pts: 0.000000 pos: 395 size: 278
ret: 0 st:
0 flags:1 dts: 0.000000 pts: 0.000000 pos: 696 size: 31082
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 696 size: 31082
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 696 size: 31082
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st:-1 flags:1 ts: 1.894167
...
@@ -20,7 +20,7 @@ ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314992 size: 31143
...
@@ -20,7 +20,7 @@ ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314992 size: 31143
ret: 0 st: 0 flags:1 ts: 1.048000
ret: 0 st: 0 flags:1 ts: 1.048000
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314992 size: 31143
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314992 size: 31143
ret: 0 st: 1 flags:0 ts:-0.058000
ret: 0 st: 1 flags:0 ts:-0.058000
ret: 0 st:
1 flags:1 dts: 0.000000 pts: 0.000000 pos: 395 size: 278
ret: 0 st:
0 flags:1 dts: 0.000000 pts: 0.000000 pos: 696 size: 31082
ret: 0 st: 1 flags:1 ts: 2.836000
ret: 0 st: 1 flags:1 ts: 2.836000
ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346138 size: 278
ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346138 size: 278
ret: 0 st:-1 flags:0 ts: 1.730004
ret: 0 st:-1 flags:0 ts: 1.730004
...
@@ -34,7 +34,7 @@ ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314992 size: 31143
...
@@ -34,7 +34,7 @@ ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314992 size: 31143
ret: 0 st: 1 flags:0 ts: 1.307000
ret: 0 st: 1 flags:0 ts: 1.307000
ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346138 size: 278
ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346138 size: 278
ret: 0 st: 1 flags:1 ts: 0.201000
ret: 0 st: 1 flags:1 ts: 0.201000
ret: 0 st:
1 flags:1 dts: 0.174000 pts: 0.174000 pos: 78977 size: 278
ret: 0 st:
0 flags:0 dts: 0.200000 pts: 0.200000 pos: 79274 size: 11400
ret: 0 st:-1 flags:0 ts:-0.904994
ret: 0 st:-1 flags:0 ts:-0.904994
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 696 size: 31082
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 696 size: 31082
ret: 0 st:-1 flags:1 ts: 1.989173
ret: 0 st:-1 flags:1 ts: 1.989173
...
...
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