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
01cbc6f6
Commit
01cbc6f6
authored
Nov 17, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
targa: return meaningful error codes.
parent
62d96552
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
targa.c
libavcodec/targa.c
+8
-8
No files found.
libavcodec/targa.c
View file @
01cbc6f6
...
@@ -103,7 +103,7 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -103,7 +103,7 @@ static int decode_frame(AVCodecContext *avctx,
AVFrame
*
const
p
=
&
s
->
picture
;
AVFrame
*
const
p
=
&
s
->
picture
;
uint8_t
*
dst
;
uint8_t
*
dst
;
int
stride
;
int
stride
;
int
idlen
,
compr
,
y
,
w
,
h
,
bpp
,
flags
;
int
idlen
,
compr
,
y
,
w
,
h
,
bpp
,
flags
,
ret
;
int
first_clr
,
colors
,
csize
;
int
first_clr
,
colors
,
csize
;
bytestream2_init
(
&
s
->
gb
,
avpkt
->
data
,
avpkt
->
size
);
bytestream2_init
(
&
s
->
gb
,
avpkt
->
data
,
avpkt
->
size
);
...
@@ -141,19 +141,19 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -141,19 +141,19 @@ static int decode_frame(AVCodecContext *avctx,
break
;
break
;
default:
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"Bit depth %i is not supported
\n
"
,
bpp
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Bit depth %i is not supported
\n
"
,
bpp
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
if
(
s
->
picture
.
data
[
0
])
if
(
s
->
picture
.
data
[
0
])
avctx
->
release_buffer
(
avctx
,
&
s
->
picture
);
avctx
->
release_buffer
(
avctx
,
&
s
->
picture
);
if
(
av_image_check_size
(
w
,
h
,
0
,
avctx
)
)
if
((
ret
=
av_image_check_size
(
w
,
h
,
0
,
avctx
))
<
0
)
return
-
1
;
return
ret
;
if
(
w
!=
avctx
->
width
||
h
!=
avctx
->
height
)
if
(
w
!=
avctx
->
width
||
h
!=
avctx
->
height
)
avcodec_set_dimensions
(
avctx
,
w
,
h
);
avcodec_set_dimensions
(
avctx
,
w
,
h
);
if
(
ff_get_buffer
(
avctx
,
p
)
<
0
){
if
((
ret
=
ff_get_buffer
(
avctx
,
p
)
)
<
0
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
-
1
;
return
ret
;
}
}
if
(
flags
&
0x20
){
if
(
flags
&
0x20
){
dst
=
p
->
data
[
0
];
dst
=
p
->
data
[
0
];
...
@@ -167,7 +167,7 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -167,7 +167,7 @@ static int decode_frame(AVCodecContext *avctx,
int
pal_size
,
pal_sample_size
;
int
pal_size
,
pal_sample_size
;
if
((
colors
+
first_clr
)
>
256
){
if
((
colors
+
first_clr
)
>
256
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"Incorrect palette: %i colors with offset %i
\n
"
,
colors
,
first_clr
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Incorrect palette: %i colors with offset %i
\n
"
,
colors
,
first_clr
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
switch
(
csize
)
{
switch
(
csize
)
{
case
24
:
pal_sample_size
=
3
;
break
;
case
24
:
pal_sample_size
=
3
;
break
;
...
@@ -175,7 +175,7 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -175,7 +175,7 @@ static int decode_frame(AVCodecContext *avctx,
case
15
:
pal_sample_size
=
2
;
break
;
case
15
:
pal_sample_size
=
2
;
break
;
default:
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"Palette entry size %i bits is not supported
\n
"
,
csize
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Palette entry size %i bits is not supported
\n
"
,
csize
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
pal_size
=
colors
*
pal_sample_size
;
pal_size
=
colors
*
pal_sample_size
;
if
(
avctx
->
pix_fmt
!=
AV_PIX_FMT_PAL8
)
//should not occur but skip palette anyway
if
(
avctx
->
pix_fmt
!=
AV_PIX_FMT_PAL8
)
//should not occur but skip palette anyway
...
...
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