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
72a9a7e9
Commit
72a9a7e9
authored
May 23, 2016
by
foo86
Committed by
James Almer
May 25, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/dca_exss: prepare to be called from parser context
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
24fcb233
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
dca_exss.c
libavcodec/dca_exss.c
+20
-11
dca_exss.h
libavcodec/dca_exss.h
+1
-1
No files found.
libavcodec/dca_exss.c
View file @
72a9a7e9
...
@@ -128,6 +128,7 @@ static int parse_descriptor(DCAExssParser *s, DCAExssAsset *asset)
...
@@ -128,6 +128,7 @@ static int parse_descriptor(DCAExssParser *s, DCAExssAsset *asset)
// Number of speaker remapping sets
// Number of speaker remapping sets
if
((
spkr_remap_nsets
=
get_bits
(
&
s
->
gb
,
3
))
&&
!
spkr_mask_nbits
)
{
if
((
spkr_remap_nsets
=
get_bits
(
&
s
->
gb
,
3
))
&&
!
spkr_mask_nbits
)
{
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Speaker mask disabled yet there are remapping sets
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Speaker mask disabled yet there are remapping sets
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
@@ -213,6 +214,7 @@ static int parse_descriptor(DCAExssParser *s, DCAExssAsset *asset)
...
@@ -213,6 +214,7 @@ static int parse_descriptor(DCAExssParser *s, DCAExssAsset *asset)
for
(
i
=
0
;
i
<
s
->
nmixoutconfigs
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
nmixoutconfigs
;
i
++
)
{
if
(
!
s
->
nmixoutchs
[
i
])
{
if
(
!
s
->
nmixoutchs
[
i
])
{
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid speaker layout mask for mixing configuration
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid speaker layout mask for mixing configuration
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
@@ -310,6 +312,7 @@ static int parse_descriptor(DCAExssParser *s, DCAExssAsset *asset)
...
@@ -310,6 +312,7 @@ static int parse_descriptor(DCAExssParser *s, DCAExssAsset *asset)
// Reserved
// Reserved
// Zero pad
// Zero pad
if
(
ff_dca_seek_bits
(
&
s
->
gb
,
descr_pos
+
descr_size
*
8
))
{
if
(
ff_dca_seek_bits
(
&
s
->
gb
,
descr_pos
+
descr_size
*
8
))
{
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Read past end of EXSS asset descriptor
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Read past end of EXSS asset descriptor
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
@@ -373,7 +376,7 @@ static int set_exss_offsets(DCAExssAsset *asset)
...
@@ -373,7 +376,7 @@ static int set_exss_offsets(DCAExssAsset *asset)
return
0
;
return
0
;
}
}
int
ff_dca_exss_parse
(
DCAExssParser
*
s
,
uint8_t
*
data
,
int
size
)
int
ff_dca_exss_parse
(
DCAExssParser
*
s
,
const
uint8_t
*
data
,
int
size
)
{
{
int
i
,
ret
,
offset
,
wide_hdr
,
header_size
;
int
i
,
ret
,
offset
,
wide_hdr
,
header_size
;
...
@@ -396,7 +399,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
...
@@ -396,7 +399,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
header_size
=
get_bits
(
&
s
->
gb
,
8
+
4
*
wide_hdr
)
+
1
;
header_size
=
get_bits
(
&
s
->
gb
,
8
+
4
*
wide_hdr
)
+
1
;
// Check CRC
// Check CRC
if
(
ff_dca_check_crc
(
s
->
avctx
,
&
s
->
gb
,
32
+
8
,
header_size
*
8
))
{
if
(
s
->
avctx
&&
ff_dca_check_crc
(
s
->
avctx
,
&
s
->
gb
,
32
+
8
,
header_size
*
8
))
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid EXSS header checksum
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid EXSS header checksum
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
@@ -406,6 +409,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
...
@@ -406,6 +409,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
// Number of bytes of extension substream
// Number of bytes of extension substream
s
->
exss_size
=
get_bits
(
&
s
->
gb
,
s
->
exss_size_nbits
)
+
1
;
s
->
exss_size
=
get_bits
(
&
s
->
gb
,
s
->
exss_size_nbits
)
+
1
;
if
(
s
->
exss_size
>
size
)
{
if
(
s
->
exss_size
>
size
)
{
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Packet too short for EXSS frame
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Packet too short for EXSS frame
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
@@ -428,6 +432,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
...
@@ -428,6 +432,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
// Number of defined audio presentations
// Number of defined audio presentations
s
->
npresents
=
get_bits
(
&
s
->
gb
,
3
)
+
1
;
s
->
npresents
=
get_bits
(
&
s
->
gb
,
3
)
+
1
;
if
(
s
->
npresents
>
1
)
{
if
(
s
->
npresents
>
1
)
{
if
(
s
->
avctx
)
avpriv_request_sample
(
s
->
avctx
,
"%d audio presentations"
,
s
->
npresents
);
avpriv_request_sample
(
s
->
avctx
,
"%d audio presentations"
,
s
->
npresents
);
return
AVERROR_PATCHWELCOME
;
return
AVERROR_PATCHWELCOME
;
}
}
...
@@ -435,6 +440,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
...
@@ -435,6 +440,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
// Number of audio assets in extension substream
// Number of audio assets in extension substream
s
->
nassets
=
get_bits
(
&
s
->
gb
,
3
)
+
1
;
s
->
nassets
=
get_bits
(
&
s
->
gb
,
3
)
+
1
;
if
(
s
->
nassets
>
1
)
{
if
(
s
->
nassets
>
1
)
{
if
(
s
->
avctx
)
avpriv_request_sample
(
s
->
avctx
,
"%d audio assets"
,
s
->
nassets
);
avpriv_request_sample
(
s
->
avctx
,
"%d audio assets"
,
s
->
nassets
);
return
AVERROR_PATCHWELCOME
;
return
AVERROR_PATCHWELCOME
;
}
}
...
@@ -476,6 +482,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
...
@@ -476,6 +482,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
s
->
assets
[
i
].
asset_size
=
get_bits
(
&
s
->
gb
,
s
->
exss_size_nbits
)
+
1
;
s
->
assets
[
i
].
asset_size
=
get_bits
(
&
s
->
gb
,
s
->
exss_size_nbits
)
+
1
;
offset
+=
s
->
assets
[
i
].
asset_size
;
offset
+=
s
->
assets
[
i
].
asset_size
;
if
(
offset
>
s
->
exss_size
)
{
if
(
offset
>
s
->
exss_size
)
{
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"EXSS asset out of bounds
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"EXSS asset out of bounds
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
@@ -486,6 +493,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
...
@@ -486,6 +493,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
if
((
ret
=
parse_descriptor
(
s
,
&
s
->
assets
[
i
]))
<
0
)
if
((
ret
=
parse_descriptor
(
s
,
&
s
->
assets
[
i
]))
<
0
)
return
ret
;
return
ret
;
if
((
ret
=
set_exss_offsets
(
&
s
->
assets
[
i
]))
<
0
)
{
if
((
ret
=
set_exss_offsets
(
&
s
->
assets
[
i
]))
<
0
)
{
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid extension size in EXSS asset descriptor
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid extension size in EXSS asset descriptor
\n
"
);
return
ret
;
return
ret
;
}
}
...
@@ -498,6 +506,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
...
@@ -498,6 +506,7 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
// Byte align
// Byte align
// CRC16 of extension substream header
// CRC16 of extension substream header
if
(
ff_dca_seek_bits
(
&
s
->
gb
,
header_size
*
8
))
{
if
(
ff_dca_seek_bits
(
&
s
->
gb
,
header_size
*
8
))
{
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Read past end of EXSS header
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Read past end of EXSS header
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
...
libavcodec/dca_exss.h
View file @
72a9a7e9
...
@@ -87,6 +87,6 @@ typedef struct DCAExssParser {
...
@@ -87,6 +87,6 @@ typedef struct DCAExssParser {
DCAExssAsset
assets
[
1
];
///< Audio asset descriptors
DCAExssAsset
assets
[
1
];
///< Audio asset descriptors
}
DCAExssParser
;
}
DCAExssParser
;
int
ff_dca_exss_parse
(
DCAExssParser
*
s
,
uint8_t
*
data
,
int
size
);
int
ff_dca_exss_parse
(
DCAExssParser
*
s
,
const
uint8_t
*
data
,
int
size
);
#endif
#endif
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