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
4397d95c
Commit
4397d95c
authored
Jun 07, 2008
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
split up header parsing function
Originally committed as revision 13705 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
da04be10
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
32 deletions
+43
-32
ac3dec.c
libavcodec/ac3dec.c
+43
-32
No files found.
libavcodec/ac3dec.c
View file @
4397d95c
...
@@ -235,10 +235,50 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
...
@@ -235,10 +235,50 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
* start of the synchronized ac3 bitstream.
* start of the synchronized ac3 bitstream.
*/
*/
static
int
ac3_parse_header
(
AC3DecodeContext
*
s
)
static
int
ac3_parse_header
(
AC3DecodeContext
*
s
)
{
GetBitContext
*
gbc
=
&
s
->
gbc
;
int
i
;
/* read the rest of the bsi. read twice for dual mono mode. */
i
=
!
(
s
->
channel_mode
);
do
{
skip_bits
(
gbc
,
5
);
// skip dialog normalization
if
(
get_bits1
(
gbc
))
skip_bits
(
gbc
,
8
);
//skip compression
if
(
get_bits1
(
gbc
))
skip_bits
(
gbc
,
8
);
//skip language code
if
(
get_bits1
(
gbc
))
skip_bits
(
gbc
,
7
);
//skip audio production information
}
while
(
i
--
);
skip_bits
(
gbc
,
2
);
//skip copyright bit and original bitstream bit
/* skip the timecodes (or extra bitstream information for Alternate Syntax)
TODO: read & use the xbsi1 downmix levels */
if
(
get_bits1
(
gbc
))
skip_bits
(
gbc
,
14
);
//skip timecode1 / xbsi1
if
(
get_bits1
(
gbc
))
skip_bits
(
gbc
,
14
);
//skip timecode2 / xbsi2
/* skip additional bitstream info */
if
(
get_bits1
(
gbc
))
{
i
=
get_bits
(
gbc
,
6
);
do
{
skip_bits
(
gbc
,
8
);
}
while
(
i
--
);
}
return
0
;
}
/**
* Common function to parse AC3 or E-AC3 frame header
*/
static
int
parse_frame_header
(
AC3DecodeContext
*
s
)
{
{
AC3HeaderInfo
hdr
;
AC3HeaderInfo
hdr
;
GetBitContext
*
gbc
=
&
s
->
gbc
;
GetBitContext
*
gbc
=
&
s
->
gbc
;
int
err
,
i
;
int
err
;
err
=
ff_ac3_parse_header
(
gbc
,
&
hdr
);
err
=
ff_ac3_parse_header
(
gbc
,
&
hdr
);
if
(
err
)
if
(
err
)
...
@@ -271,36 +311,7 @@ static int ac3_parse_header(AC3DecodeContext *s)
...
@@ -271,36 +311,7 @@ static int ac3_parse_header(AC3DecodeContext *s)
s
->
channel_in_cpl
[
s
->
lfe_ch
]
=
0
;
s
->
channel_in_cpl
[
s
->
lfe_ch
]
=
0
;
}
}
/* read the rest of the bsi. read twice for dual mono mode. */
return
ac3_parse_header
(
s
);
i
=
!
(
s
->
channel_mode
);
do
{
skip_bits
(
gbc
,
5
);
// skip dialog normalization
if
(
get_bits1
(
gbc
))
skip_bits
(
gbc
,
8
);
//skip compression
if
(
get_bits1
(
gbc
))
skip_bits
(
gbc
,
8
);
//skip language code
if
(
get_bits1
(
gbc
))
skip_bits
(
gbc
,
7
);
//skip audio production information
}
while
(
i
--
);
skip_bits
(
gbc
,
2
);
//skip copyright bit and original bitstream bit
/* skip the timecodes (or extra bitstream information for Alternate Syntax)
TODO: read & use the xbsi1 downmix levels */
if
(
get_bits1
(
gbc
))
skip_bits
(
gbc
,
14
);
//skip timecode1 / xbsi1
if
(
get_bits1
(
gbc
))
skip_bits
(
gbc
,
14
);
//skip timecode2 / xbsi2
/* skip additional bitstream info */
if
(
get_bits1
(
gbc
))
{
i
=
get_bits
(
gbc
,
6
);
do
{
skip_bits
(
gbc
,
8
);
}
while
(
i
--
);
}
return
0
;
}
}
/**
/**
...
@@ -1081,7 +1092,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
...
@@ -1081,7 +1092,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
/* parse the syncinfo */
/* parse the syncinfo */
*
data_size
=
0
;
*
data_size
=
0
;
err
=
ac3_pars
e_header
(
s
);
err
=
parse_fram
e_header
(
s
);
/* check that reported frame size fits in input buffer */
/* check that reported frame size fits in input buffer */
if
(
s
->
frame_size
>
buf_size
)
{
if
(
s
->
frame_size
>
buf_size
)
{
...
...
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