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
4dcf71aa
Commit
4dcf71aa
authored
Oct 12, 2012
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
takdec: stop decoding in case of unknown bps
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
56519d7d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
takdec.c
libavcodec/takdec.c
+11
-3
No files found.
libavcodec/takdec.c
View file @
4dcf71aa
...
...
@@ -146,7 +146,7 @@ static const struct CParam {
{
0x1A
,
0x1800000
,
0x1800000
,
0x6800000
,
0xC000000
},
};
static
void
tak_set_bps
(
AVCodecContext
*
avctx
,
int
bps
)
static
int
tak_set_bps
(
AVCodecContext
*
avctx
,
int
bps
)
{
switch
(
bps
)
{
case
8
:
...
...
@@ -158,7 +158,12 @@ static void tak_set_bps(AVCodecContext *avctx, int bps)
case
24
:
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S32P
;
break
;
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid/unsupported bits per sample
\n
"
);
return
AVERROR_INVALIDDATA
;
}
return
0
;
}
static
int
get_shift
(
int
sample_rate
)
...
...
@@ -185,6 +190,7 @@ static int get_scale(int sample_rate, int shift)
static
av_cold
int
tak_decode_init
(
AVCodecContext
*
avctx
)
{
TAKDecContext
*
s
=
avctx
->
priv_data
;
int
ret
;
ff_tak_init_crc
();
ff_dsputil_init
(
&
s
->
dsp
,
avctx
);
...
...
@@ -196,7 +202,8 @@ static av_cold int tak_decode_init(AVCodecContext *avctx)
s
->
uval
=
get_scale
(
avctx
->
sample_rate
,
get_shift
(
avctx
->
sample_rate
));
s
->
subframe_scale
=
get_scale
(
avctx
->
sample_rate
,
1
);
tak_set_bps
(
avctx
,
avctx
->
bits_per_coded_sample
);
if
((
ret
=
tak_set_bps
(
avctx
,
avctx
->
bits_per_coded_sample
))
<
0
)
return
ret
;
return
0
;
}
...
...
@@ -775,7 +782,8 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
if
(
s
->
ti
.
bps
!=
avctx
->
bits_per_raw_sample
)
{
avctx
->
bits_per_raw_sample
=
s
->
ti
.
bps
;
tak_set_bps
(
avctx
,
avctx
->
bits_per_raw_sample
);
if
((
ret
=
tak_set_bps
(
avctx
,
avctx
->
bits_per_raw_sample
))
<
0
)
return
ret
;
}
if
(
s
->
ti
.
sample_rate
!=
avctx
->
sample_rate
)
{
avctx
->
sample_rate
=
s
->
ti
.
sample_rate
;
...
...
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