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
5c0a0983
Commit
5c0a0983
authored
Oct 27, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libopenjpegdec: return meaningful error codes
parent
8fbb0979
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
libopenjpegdec.c
libavcodec/libopenjpegdec.c
+9
-6
No files found.
libavcodec/libopenjpegdec.c
View file @
5c0a0983
...
...
@@ -257,7 +257,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
opj_dinfo_t
*
dec
;
opj_cio_t
*
stream
;
opj_image_t
*
image
;
int
width
,
height
,
ret
=
-
1
;
int
width
,
height
,
ret
;
int
pixel_size
=
0
;
int
ispacked
=
0
;
int
i
;
...
...
@@ -279,7 +279,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
if
(
!
dec
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error initializing decoder.
\n
"
);
return
-
1
;
return
AVERROR_UNKNOWN
;
}
opj_set_event_mgr
((
opj_common_ptr
)
dec
,
NULL
,
NULL
);
...
...
@@ -294,7 +294,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Codestream could not be opened for reading.
\n
"
);
opj_destroy_decompress
(
dec
);
return
-
1
;
return
AVERROR_UNKNOWN
;
}
// Decode the header only.
...
...
@@ -304,7 +304,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
if
(
!
image
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error decoding codestream.
\n
"
);
opj_destroy_decompress
(
dec
);
return
-
1
;
return
AVERROR_UNKNOWN
;
}
width
=
image
->
x1
-
image
->
x0
;
...
...
@@ -315,7 +315,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
height
=
(
height
+
(
1
<<
ctx
->
lowres
)
-
1
)
>>
ctx
->
lowres
;
}
if
(
av_image_check_size
(
width
,
height
,
0
,
avctx
)
<
0
)
{
if
(
(
ret
=
av_image_check_size
(
width
,
height
,
0
,
avctx
)
)
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"%dx%d dimension invalid.
\n
"
,
width
,
height
);
goto
done
;
...
...
@@ -340,7 +340,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
if
(
image
->
comps
[
i
].
prec
>
avctx
->
bits_per_raw_sample
)
avctx
->
bits_per_raw_sample
=
image
->
comps
[
i
].
prec
;
if
(
ff_thread_get_buffer
(
avctx
,
&
frame
,
0
)
<
0
)
{
if
(
(
ret
=
ff_thread_get_buffer
(
avctx
,
&
frame
,
0
)
)
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"ff_thread_get_buffer() failed
\n
"
);
goto
done
;
}
...
...
@@ -352,6 +352,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
if
(
!
stream
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Codestream could not be opened for reading.
\n
"
);
ret
=
AVERROR_UNKNOWN
;
goto
done
;
}
...
...
@@ -362,6 +363,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
if
(
!
image
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error decoding codestream.
\n
"
);
ret
=
AVERROR_UNKNOWN
;
goto
done
;
}
...
...
@@ -398,6 +400,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
break
;
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported pixel size %d
\n
"
,
pixel_size
);
ret
=
AVERROR_PATCHWELCOME
;
goto
done
;
}
...
...
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