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
8c345581
Commit
8c345581
authored
May 17, 2013
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wavpack: return meaningful errors
And forward those that were already meaningful.
parent
0f689a3d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
wavpack.c
libavcodec/wavpack.c
+16
-16
No files found.
libavcodec/wavpack.c
View file @
8c345581
...
...
@@ -777,14 +777,14 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
if
(
block_no
>=
wc
->
fdec_num
&&
wv_alloc_frame_context
(
wc
)
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error creating frame decode context
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
s
=
wc
->
fdec
[
block_no
];
if
(
!
s
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Context for block %d is not present
\n
"
,
block_no
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
memset
(
s
->
decorr
,
0
,
MAX_TERMS
*
sizeof
(
Decorr
));
...
...
@@ -1040,7 +1040,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
if
(
size
<=
1
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Insufficient channel information
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
chan
=
*
buf
++
;
switch
(
size
-
2
)
{
...
...
@@ -1071,7 +1071,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
"Block reports total %d channels, "
"decoder believes it's %d channels
\n
"
,
chan
,
avctx
->
channels
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
!
avctx
->
channel_layout
)
avctx
->
channel_layout
=
chmask
;
...
...
@@ -1086,31 +1086,31 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
if
(
!
got_terms
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"No block with decorrelation terms
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
!
got_weights
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"No block with decorrelation weights
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
!
got_samples
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"No block with decorrelation samples
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
!
got_entropy
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"No block with entropy info
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
s
->
hybrid
&&
!
got_hybrid
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Hybrid config not found
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
!
got_bs
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Packed samples not found
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
!
got_float
&&
avctx
->
sample_fmt
==
AV_SAMPLE_FMT_FLT
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Float information not found
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
s
->
got_extra_bits
&&
avctx
->
sample_fmt
!=
AV_SAMPLE_FMT_FLT
)
{
const
int
size
=
get_bits_left
(
&
s
->
gb_extra_bits
);
...
...
@@ -1130,7 +1130,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
samplecount
=
wv_unpack_stereo
(
s
,
&
s
->
gb
,
samples
,
AV_SAMPLE_FMT_FLT
);
if
(
samplecount
<
0
)
return
-
1
;
return
samplecount
;
samplecount
>>=
1
;
}
else
{
...
...
@@ -1144,7 +1144,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
samplecount
=
wv_unpack_mono
(
s
,
&
s
->
gb
,
samples
,
AV_SAMPLE_FMT_FLT
);
if
(
samplecount
<
0
)
return
-
1
;
return
samplecount
;
if
(
s
->
stereo
&&
avctx
->
sample_fmt
==
AV_SAMPLE_FMT_S16
)
{
int16_t
*
dst
=
(
int16_t
*
)
samples
+
1
;
...
...
@@ -1220,7 +1220,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
if
(
s
->
samples
<=
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid number of samples: %d
\n
"
,
s
->
samples
);
return
AVERROR
(
EINVAL
)
;
return
AVERROR
_INVALIDDATA
;
}
if
(
frame_flags
&
0x80
)
{
...
...
@@ -1258,13 +1258,13 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
"Block %d has invalid size (size %d vs. %d bytes left)
\n
"
,
s
->
block
,
frame_size
,
buf_size
);
wavpack_decode_flush
(
avctx
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
((
samplecount
=
wavpack_decode_block
(
avctx
,
s
->
block
,
frame
->
data
[
0
],
got_frame_ptr
,
buf
,
frame_size
))
<
0
)
{
wavpack_decode_flush
(
avctx
);
return
-
1
;
return
samplecount
;
}
s
->
block
++
;
buf
+=
frame_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