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
14cf33e9
Commit
14cf33e9
authored
Nov 18, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lcldec: return meaningful error codes.
parent
01cbc6f6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
lcldec.c
libavcodec/lcldec.c
+13
-14
No files found.
libavcodec/lcldec.c
View file @
14cf33e9
...
...
@@ -132,7 +132,7 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, i
int
zret
=
inflateReset
(
&
c
->
zstream
);
if
(
zret
!=
Z_OK
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Inflate reset error: %d
\n
"
,
zret
);
return
-
1
;
return
AVERROR_UNKNOWN
;
}
c
->
zstream
.
next_in
=
src
;
c
->
zstream
.
avail_in
=
src_len
;
...
...
@@ -141,12 +141,12 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, i
zret
=
inflate
(
&
c
->
zstream
,
Z_FINISH
);
if
(
zret
!=
Z_OK
&&
zret
!=
Z_STREAM_END
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Inflate error: %d
\n
"
,
zret
);
return
-
1
;
return
AVERROR_UNKNOWN
;
}
if
(
expected
!=
(
unsigned
int
)
c
->
zstream
.
total_out
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Decoded size differs (%d != %lu)
\n
"
,
expected
,
c
->
zstream
.
total_out
);
return
-
1
;
return
AVERROR_UNKNOWN
;
}
return
c
->
zstream
.
total_out
;
}
...
...
@@ -172,7 +172,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
unsigned
int
height
=
avctx
->
height
;
// Real image height
unsigned
int
mszh_dlen
;
unsigned
char
yq
,
y1q
,
uq
,
vq
;
int
uqvq
;
int
uqvq
,
ret
;
unsigned
int
mthread_inlen
,
mthread_outlen
;
unsigned
int
len
=
buf_size
;
...
...
@@ -181,9 +181,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
c
->
pic
.
reference
=
0
;
c
->
pic
.
buffer_hints
=
FF_BUFFER_HINTS_VALID
;
if
(
ff_get_buffer
(
avctx
,
&
c
->
pic
)
<
0
)
{
if
((
ret
=
ff_get_buffer
(
avctx
,
&
c
->
pic
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
-
1
;
return
ret
;
}
outptr
=
c
->
pic
.
data
[
0
];
// Output image pointer
...
...
@@ -202,14 +202,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
if
(
mthread_outlen
!=
mszh_dlen
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Mthread1 decoded size differs (%d != %d)
\n
"
,
mthread_outlen
,
mszh_dlen
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
mszh_dlen
=
mszh_decomp
(
encoded
+
8
+
mthread_inlen
,
len
-
8
-
mthread_inlen
,
c
->
decomp_buf
+
mthread_outlen
,
c
->
decomp_size
-
mthread_outlen
);
if
(
mthread_outlen
!=
mszh_dlen
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Mthread2 decoded size differs (%d != %d)
\n
"
,
mthread_outlen
,
mszh_dlen
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
encoded
=
c
->
decomp_buf
;
len
=
c
->
decomp_size
;
...
...
@@ -218,7 +218,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
if
(
c
->
decomp_size
!=
mszh_dlen
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Decoded size differs (%d != %d)
\n
"
,
c
->
decomp_size
,
mszh_dlen
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
encoded
=
c
->
decomp_buf
;
len
=
mszh_dlen
;
...
...
@@ -249,7 +249,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
}
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"BUG! Unknown MSZH compression in frame decoder.
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
break
;
#if CONFIG_ZLIB_DECODER
...
...
@@ -266,7 +266,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
break
;
}
}
else
if
(
c
->
flags
&
FLAG_MULTITHREAD
)
{
int
ret
;
mthread_inlen
=
AV_RL32
(
encoded
);
mthread_inlen
=
FFMIN
(
mthread_inlen
,
len
-
8
);
mthread_outlen
=
AV_RL32
(
encoded
+
4
);
...
...
@@ -286,7 +285,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
#endif
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"BUG! Unknown codec in frame decoder compression switch.
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
...
...
@@ -370,7 +369,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
break
;
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"BUG! Unknown imagetype in pngfilter switch.
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
...
...
@@ -458,7 +457,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
break
;
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"BUG! Unknown imagetype in image decoder.
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
*
got_frame
=
1
;
...
...
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