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
3509eee1
Commit
3509eee1
authored
Oct 21, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cook: use AVCodecContext.channels instead of keeping a private copy
parent
a3145d03
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
cook.c
libavcodec/cook.c
+6
-8
No files found.
libavcodec/cook.c
View file @
3509eee1
...
@@ -126,7 +126,6 @@ typedef struct cook {
...
@@ -126,7 +126,6 @@ typedef struct cook {
AVFrame
frame
;
AVFrame
frame
;
GetBitContext
gb
;
GetBitContext
gb
;
/* stream data */
/* stream data */
int
nb_channels
;
int
bit_rate
;
int
bit_rate
;
int
sample_rate
;
int
sample_rate
;
int
num_vectors
;
int
num_vectors
;
...
@@ -1024,7 +1023,7 @@ static void dump_cook_context(COOKContext *q)
...
@@ -1024,7 +1023,7 @@ static void dump_cook_context(COOKContext *q)
PRINT
(
"js_vlc_bits"
,
q
->
subpacket
[
0
].
js_vlc_bits
);
PRINT
(
"js_vlc_bits"
,
q
->
subpacket
[
0
].
js_vlc_bits
);
}
}
av_log
(
q
->
avctx
,
AV_LOG_ERROR
,
"COOKContext
\n
"
);
av_log
(
q
->
avctx
,
AV_LOG_ERROR
,
"COOKContext
\n
"
);
PRINT
(
"nb_channels"
,
q
->
nb_
channels
);
PRINT
(
"nb_channels"
,
q
->
avctx
->
channels
);
PRINT
(
"bit_rate"
,
q
->
bit_rate
);
PRINT
(
"bit_rate"
,
q
->
bit_rate
);
PRINT
(
"sample_rate"
,
q
->
sample_rate
);
PRINT
(
"sample_rate"
,
q
->
sample_rate
);
PRINT
(
"samples_per_channel"
,
q
->
subpacket
[
0
].
samples_per_channel
);
PRINT
(
"samples_per_channel"
,
q
->
subpacket
[
0
].
samples_per_channel
);
...
@@ -1072,9 +1071,8 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
...
@@ -1072,9 +1071,8 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
/* Take data from the AVCodecContext (RM container). */
/* Take data from the AVCodecContext (RM container). */
q
->
sample_rate
=
avctx
->
sample_rate
;
q
->
sample_rate
=
avctx
->
sample_rate
;
q
->
nb_channels
=
avctx
->
channels
;
q
->
bit_rate
=
avctx
->
bit_rate
;
q
->
bit_rate
=
avctx
->
bit_rate
;
if
(
!
q
->
nb_
channels
)
{
if
(
!
avctx
->
channels
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid number of channels
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid number of channels
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
@@ -1101,7 +1099,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
...
@@ -1101,7 +1099,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
}
}
/* Initialize extradata related variables. */
/* Initialize extradata related variables. */
q
->
subpacket
[
s
].
samples_per_channel
=
q
->
subpacket
[
s
].
samples_per_frame
/
q
->
nb_
channels
;
q
->
subpacket
[
s
].
samples_per_channel
=
q
->
subpacket
[
s
].
samples_per_frame
/
avctx
->
channels
;
q
->
subpacket
[
s
].
bits_per_subpacket
=
avctx
->
block_align
*
8
;
q
->
subpacket
[
s
].
bits_per_subpacket
=
avctx
->
block_align
*
8
;
/* Initialize default data states. */
/* Initialize default data states. */
...
@@ -1116,21 +1114,21 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
...
@@ -1116,21 +1114,21 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
q
->
subpacket
[
s
].
joint_stereo
=
0
;
q
->
subpacket
[
s
].
joint_stereo
=
0
;
switch
(
q
->
subpacket
[
s
].
cookversion
)
{
switch
(
q
->
subpacket
[
s
].
cookversion
)
{
case
MONO
:
case
MONO
:
if
(
q
->
nb_
channels
!=
1
)
{
if
(
avctx
->
channels
!=
1
)
{
av_log_ask_for_sample
(
avctx
,
"Container channels != 1.
\n
"
);
av_log_ask_for_sample
(
avctx
,
"Container channels != 1.
\n
"
);
return
AVERROR_PATCHWELCOME
;
return
AVERROR_PATCHWELCOME
;
}
}
av_log
(
avctx
,
AV_LOG_DEBUG
,
"MONO
\n
"
);
av_log
(
avctx
,
AV_LOG_DEBUG
,
"MONO
\n
"
);
break
;
break
;
case
STEREO
:
case
STEREO
:
if
(
q
->
nb_
channels
!=
1
)
{
if
(
avctx
->
channels
!=
1
)
{
q
->
subpacket
[
s
].
bits_per_subpdiv
=
1
;
q
->
subpacket
[
s
].
bits_per_subpdiv
=
1
;
q
->
subpacket
[
s
].
num_channels
=
2
;
q
->
subpacket
[
s
].
num_channels
=
2
;
}
}
av_log
(
avctx
,
AV_LOG_DEBUG
,
"STEREO
\n
"
);
av_log
(
avctx
,
AV_LOG_DEBUG
,
"STEREO
\n
"
);
break
;
break
;
case
JOINT_STEREO
:
case
JOINT_STEREO
:
if
(
q
->
nb_
channels
!=
2
)
{
if
(
avctx
->
channels
!=
2
)
{
av_log_ask_for_sample
(
avctx
,
"Container channels != 2.
\n
"
);
av_log_ask_for_sample
(
avctx
,
"Container channels != 2.
\n
"
);
return
AVERROR_PATCHWELCOME
;
return
AVERROR_PATCHWELCOME
;
}
}
...
...
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