Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
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
Hide 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,7 +128,8 @@ static int parse_descriptor(DCAExssParser *s, DCAExssAsset *asset)
// Number of speaker remapping sets
if
((
spkr_remap_nsets
=
get_bits
(
&
s
->
gb
,
3
))
&&
!
spkr_mask_nbits
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Speaker mask disabled yet there are remapping sets
\n
"
);
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Speaker mask disabled yet there are remapping sets
\n
"
);
return
AVERROR_INVALIDDATA
;
}
...
...
@@ -213,7 +214,8 @@ static int parse_descriptor(DCAExssParser *s, DCAExssAsset *asset)
for
(
i
=
0
;
i
<
s
->
nmixoutconfigs
;
i
++
)
{
if
(
!
s
->
nmixoutchs
[
i
])
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid speaker layout mask for mixing configuration
\n
"
);
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid speaker layout mask for mixing configuration
\n
"
);
return
AVERROR_INVALIDDATA
;
}
for
(
j
=
0
;
j
<
nchannels_dmix
;
j
++
)
{
...
...
@@ -310,7 +312,8 @@ static int parse_descriptor(DCAExssParser *s, DCAExssAsset *asset)
// Reserved
// Zero pad
if
(
ff_dca_seek_bits
(
&
s
->
gb
,
descr_pos
+
descr_size
*
8
))
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Read past end of EXSS asset descriptor
\n
"
);
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Read past end of EXSS asset descriptor
\n
"
);
return
AVERROR_INVALIDDATA
;
}
...
...
@@ -373,7 +376,7 @@ static int set_exss_offsets(DCAExssAsset *asset)
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
;
...
...
@@ -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
;
// 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
"
);
return
AVERROR_INVALIDDATA
;
}
...
...
@@ -406,7 +409,8 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
// Number of bytes of extension substream
s
->
exss_size
=
get_bits
(
&
s
->
gb
,
s
->
exss_size_nbits
)
+
1
;
if
(
s
->
exss_size
>
size
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Packet too short for EXSS frame
\n
"
);
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Packet too short for EXSS frame
\n
"
);
return
AVERROR_INVALIDDATA
;
}
...
...
@@ -428,14 +432,16 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
// Number of defined audio presentations
s
->
npresents
=
get_bits
(
&
s
->
gb
,
3
)
+
1
;
if
(
s
->
npresents
>
1
)
{
avpriv_request_sample
(
s
->
avctx
,
"%d audio presentations"
,
s
->
npresents
);
if
(
s
->
avctx
)
avpriv_request_sample
(
s
->
avctx
,
"%d audio presentations"
,
s
->
npresents
);
return
AVERROR_PATCHWELCOME
;
}
// Number of audio assets in extension substream
s
->
nassets
=
get_bits
(
&
s
->
gb
,
3
)
+
1
;
if
(
s
->
nassets
>
1
)
{
avpriv_request_sample
(
s
->
avctx
,
"%d audio assets"
,
s
->
nassets
);
if
(
s
->
avctx
)
avpriv_request_sample
(
s
->
avctx
,
"%d audio assets"
,
s
->
nassets
);
return
AVERROR_PATCHWELCOME
;
}
...
...
@@ -476,7 +482,8 @@ 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
;
offset
+=
s
->
assets
[
i
].
asset_size
;
if
(
offset
>
s
->
exss_size
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"EXSS asset out of bounds
\n
"
);
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"EXSS asset out of bounds
\n
"
);
return
AVERROR_INVALIDDATA
;
}
}
...
...
@@ -486,7 +493,8 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
if
((
ret
=
parse_descriptor
(
s
,
&
s
->
assets
[
i
]))
<
0
)
return
ret
;
if
((
ret
=
set_exss_offsets
(
&
s
->
assets
[
i
]))
<
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid extension size in EXSS asset descriptor
\n
"
);
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid extension size in EXSS asset descriptor
\n
"
);
return
ret
;
}
}
...
...
@@ -498,7 +506,8 @@ int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
// Byte align
// CRC16 of extension substream header
if
(
ff_dca_seek_bits
(
&
s
->
gb
,
header_size
*
8
))
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Read past end of EXSS header
\n
"
);
if
(
s
->
avctx
)
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Read past end of EXSS header
\n
"
);
return
AVERROR_INVALIDDATA
;
}
...
...
libavcodec/dca_exss.h
View file @
72a9a7e9
...
...
@@ -87,6 +87,6 @@ typedef struct DCAExssParser {
DCAExssAsset
assets
[
1
];
///< Audio asset descriptors
}
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
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