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
67da3182
Commit
67da3182
authored
Apr 25, 2009
by
Benjamin Larsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support cook multichannel files.
Originally committed as revision 18685 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
7204850e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
cook.c
libavcodec/cook.c
+31
-3
No files found.
libavcodec/cook.c
View file @
67da3182
...
@@ -1008,6 +1008,13 @@ static int cook_decode_frame(AVCodecContext *avctx,
...
@@ -1008,6 +1008,13 @@ static int cook_decode_frame(AVCodecContext *avctx,
/* estimate subpacket sizes */
/* estimate subpacket sizes */
q
->
subpacket
[
0
].
size
=
avctx
->
block_align
;
q
->
subpacket
[
0
].
size
=
avctx
->
block_align
;
if
(
q
->
num_subpackets
>
1
){
for
(
i
=
1
;
i
<
q
->
num_subpackets
;
i
++
){
q
->
subpacket
[
i
].
size
=
2
*
buf
[
avctx
->
block_align
-
q
->
num_subpackets
+
i
];
q
->
subpacket
[
0
].
size
-=
(
q
->
subpacket
[
i
].
size
+
1
);
}
}
/* decode supbackets */
/* decode supbackets */
*
data_size
=
0
;
*
data_size
=
0
;
for
(
i
=
0
;
i
<
q
->
num_subpackets
;
i
++
){
for
(
i
=
0
;
i
<
q
->
num_subpackets
;
i
++
){
...
@@ -1076,6 +1083,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
...
@@ -1076,6 +1083,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
const
uint8_t
*
edata_ptr_end
=
edata_ptr
+
avctx
->
extradata_size
;
const
uint8_t
*
edata_ptr_end
=
edata_ptr
+
avctx
->
extradata_size
;
int
extradata_size
=
avctx
->
extradata_size
;
int
extradata_size
=
avctx
->
extradata_size
;
int
s
=
0
;
int
s
=
0
;
unsigned
int
channel_mask
=
0
;
q
->
avctx
=
avctx
;
q
->
avctx
=
avctx
;
/* Take care of the codec specific extradata. */
/* Take care of the codec specific extradata. */
...
@@ -1155,8 +1163,25 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
...
@@ -1155,8 +1163,25 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
}
}
break
;
break
;
case
MC_COOK
:
case
MC_COOK
:
av_log
(
avctx
,
AV_LOG_ERROR
,
"MC_COOK not supported!
\n
"
);
av_log
(
avctx
,
AV_LOG_DEBUG
,
"MULTI_CHANNEL
\n
"
);
return
-
1
;
if
(
extradata_size
>=
4
)
channel_mask
|=
q
->
subpacket
[
s
].
channel_mask
=
bytestream_get_be32
(
&
edata_ptr
);
if
(
cook_count_channels
(
q
->
subpacket
[
s
].
channel_mask
)
>
1
){
q
->
subpacket
[
s
].
total_subbands
=
q
->
subpacket
[
s
].
subbands
+
q
->
subpacket
[
s
].
js_subband_start
;
q
->
subpacket
[
s
].
joint_stereo
=
1
;
q
->
subpacket
[
s
].
num_channels
=
2
;
q
->
subpacket
[
s
].
samples_per_channel
=
q
->
subpacket
[
s
].
samples_per_frame
>>
1
;
if
(
q
->
subpacket
[
s
].
samples_per_channel
>
256
)
{
q
->
subpacket
[
s
].
log2_numvector_size
=
6
;
}
if
(
q
->
subpacket
[
s
].
samples_per_channel
>
512
)
{
q
->
subpacket
[
s
].
log2_numvector_size
=
7
;
}
}
else
q
->
subpacket
[
s
].
samples_per_channel
=
q
->
subpacket
[
s
].
samples_per_frame
;
break
;
break
;
default
:
default
:
av_log
(
avctx
,
AV_LOG_ERROR
,
"Unknown Cook version, report sample!
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Unknown Cook version, report sample!
\n
"
);
...
@@ -1240,7 +1265,10 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
...
@@ -1240,7 +1265,10 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
}
}
avctx
->
sample_fmt
=
SAMPLE_FMT_S16
;
avctx
->
sample_fmt
=
SAMPLE_FMT_S16
;
avctx
->
channel_layout
=
(
avctx
->
channels
==
2
)
?
CH_LAYOUT_STEREO
:
CH_LAYOUT_MONO
;
if
(
channel_mask
)
avctx
->
channel_layout
=
channel_mask
;
else
avctx
->
channel_layout
=
(
avctx
->
channels
==
2
)
?
CH_LAYOUT_STEREO
:
CH_LAYOUT_MONO
;
#ifdef COOKDEBUG
#ifdef COOKDEBUG
dump_cook_context
(
q
);
dump_cook_context
(
q
);
...
...
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