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
126abaaa
Commit
126abaaa
authored
Nov 17, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rl2: return meaningful error codes.
parent
7c8fceef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
rl2.c
libavcodec/rl2.c
+6
-6
No files found.
libavcodec/rl2.c
View file @
126abaaa
...
@@ -140,7 +140,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
...
@@ -140,7 +140,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
/** parse extra data */
/** parse extra data */
if
(
!
avctx
->
extradata
||
avctx
->
extradata_size
<
EXTRADATA1_SIZE
){
if
(
!
avctx
->
extradata
||
avctx
->
extradata_size
<
EXTRADATA1_SIZE
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid extradata size
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid extradata size
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
/** get frame_offset */
/** get frame_offset */
...
@@ -149,7 +149,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
...
@@ -149,7 +149,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
if
(
s
->
video_base
>=
avctx
->
width
*
avctx
->
height
){
if
(
s
->
video_base
>=
avctx
->
width
*
avctx
->
height
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid video_base
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid video_base
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
/** initialize palette */
/** initialize palette */
...
@@ -162,7 +162,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
...
@@ -162,7 +162,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
if
(
back_size
>
0
){
if
(
back_size
>
0
){
unsigned
char
*
back_frame
=
av_mallocz
(
avctx
->
width
*
avctx
->
height
);
unsigned
char
*
back_frame
=
av_mallocz
(
avctx
->
width
*
avctx
->
height
);
if
(
!
back_frame
)
if
(
!
back_frame
)
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
rl2_rle_decode
(
s
,
avctx
->
extradata
+
EXTRADATA1_SIZE
,
back_size
,
rl2_rle_decode
(
s
,
avctx
->
extradata
+
EXTRADATA1_SIZE
,
back_size
,
back_frame
,
avctx
->
width
,
0
);
back_frame
,
avctx
->
width
,
0
);
s
->
back_frame
=
back_frame
;
s
->
back_frame
=
back_frame
;
...
@@ -176,7 +176,7 @@ static int rl2_decode_frame(AVCodecContext *avctx,
...
@@ -176,7 +176,7 @@ static int rl2_decode_frame(AVCodecContext *avctx,
AVPacket
*
avpkt
)
AVPacket
*
avpkt
)
{
{
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
int
ret
,
buf_size
=
avpkt
->
size
;
Rl2Context
*
s
=
avctx
->
priv_data
;
Rl2Context
*
s
=
avctx
->
priv_data
;
if
(
s
->
frame
.
data
[
0
])
if
(
s
->
frame
.
data
[
0
])
...
@@ -184,9 +184,9 @@ static int rl2_decode_frame(AVCodecContext *avctx,
...
@@ -184,9 +184,9 @@ static int rl2_decode_frame(AVCodecContext *avctx,
/** get buffer */
/** get buffer */
s
->
frame
.
reference
=
0
;
s
->
frame
.
reference
=
0
;
if
(
ff_get_buffer
(
avctx
,
&
s
->
frame
)
)
{
if
((
ret
=
ff_get_buffer
(
avctx
,
&
s
->
frame
))
<
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
-
1
;
return
ret
;
}
}
/** run length decode */
/** run length decode */
...
...
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