Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
e2820d99
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e2820d99
编写于
10月 22, 2012
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pnmdec: use more meaningful error codes
Signed-off-by:
N
Paul B Mahol
<
onemda@gmail.com
>
上级
5442c6cc
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
8 addition
and
8 deletion
+8
-8
libavcodec/pnmdec.c
libavcodec/pnmdec.c
+8
-8
未找到文件。
libavcodec/pnmdec.c
浏览文件 @
e2820d99
...
@@ -34,29 +34,29 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -34,29 +34,29 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
AVFrame
*
const
p
=
&
s
->
picture
;
AVFrame
*
const
p
=
&
s
->
picture
;
int
i
,
j
,
n
,
linesize
,
h
,
upgrade
=
0
,
is_mono
=
0
;
int
i
,
j
,
n
,
linesize
,
h
,
upgrade
=
0
,
is_mono
=
0
;
unsigned
char
*
ptr
;
unsigned
char
*
ptr
;
int
components
,
sample_len
;
int
components
,
sample_len
,
ret
;
s
->
bytestream_start
=
s
->
bytestream_start
=
s
->
bytestream
=
(
uint8_t
*
)
buf
;
s
->
bytestream
=
(
uint8_t
*
)
buf
;
s
->
bytestream_end
=
(
uint8_t
*
)
buf
+
buf_size
;
s
->
bytestream_end
=
(
uint8_t
*
)
buf
+
buf_size
;
if
(
ff_pnm_decode_header
(
avctx
,
s
)
<
0
)
if
(
ff_pnm_decode_header
(
avctx
,
s
)
<
0
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
if
(
p
->
data
[
0
])
if
(
p
->
data
[
0
])
avctx
->
release_buffer
(
avctx
,
p
);
avctx
->
release_buffer
(
avctx
,
p
);
p
->
reference
=
0
;
p
->
reference
=
0
;
if
(
avctx
->
get_buffer
(
avctx
,
p
)
<
0
)
{
if
(
(
ret
=
avctx
->
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
;
}
}
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
p
->
key_frame
=
1
;
p
->
key_frame
=
1
;
switch
(
avctx
->
pix_fmt
)
{
switch
(
avctx
->
pix_fmt
)
{
default:
default:
return
-
1
;
return
AVERROR_INVALIDDATA
;
case
AV_PIX_FMT_RGBA64BE
:
case
AV_PIX_FMT_RGBA64BE
:
n
=
avctx
->
width
*
8
;
n
=
avctx
->
width
*
8
;
components
=
4
;
components
=
4
;
...
@@ -107,7 +107,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -107,7 +107,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
ptr
=
p
->
data
[
0
];
ptr
=
p
->
data
[
0
];
linesize
=
p
->
linesize
[
0
];
linesize
=
p
->
linesize
[
0
];
if
(
s
->
bytestream
+
n
*
avctx
->
height
>
s
->
bytestream_end
)
if
(
s
->
bytestream
+
n
*
avctx
->
height
>
s
->
bytestream_end
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
if
(
s
->
type
<
4
||
(
is_mono
&&
s
->
type
==
7
)){
if
(
s
->
type
<
4
||
(
is_mono
&&
s
->
type
==
7
)){
for
(
i
=
0
;
i
<
avctx
->
height
;
i
++
)
{
for
(
i
=
0
;
i
<
avctx
->
height
;
i
++
)
{
PutBitContext
pb
;
PutBitContext
pb
;
...
@@ -119,7 +119,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -119,7 +119,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
while
(
s
->
bytestream
<
s
->
bytestream_end
&&
(
*
s
->
bytestream
<
'0'
||
*
s
->
bytestream
>
'9'
))
while
(
s
->
bytestream
<
s
->
bytestream_end
&&
(
*
s
->
bytestream
<
'0'
||
*
s
->
bytestream
>
'9'
))
s
->
bytestream
++
;
s
->
bytestream
++
;
if
(
s
->
bytestream
>=
s
->
bytestream_end
)
if
(
s
->
bytestream
>=
s
->
bytestream_end
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
if
(
is_mono
)
{
if
(
is_mono
)
{
/* read a single digit */
/* read a single digit */
v
=
(
*
s
->
bytestream
++
)
&
1
;
v
=
(
*
s
->
bytestream
++
)
&
1
;
...
@@ -163,7 +163,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -163,7 +163,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
ptr
=
p
->
data
[
0
];
ptr
=
p
->
data
[
0
];
linesize
=
p
->
linesize
[
0
];
linesize
=
p
->
linesize
[
0
];
if
(
s
->
bytestream
+
n
*
avctx
->
height
*
3
/
2
>
s
->
bytestream_end
)
if
(
s
->
bytestream
+
n
*
avctx
->
height
*
3
/
2
>
s
->
bytestream_end
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
for
(
i
=
0
;
i
<
avctx
->
height
;
i
++
)
{
for
(
i
=
0
;
i
<
avctx
->
height
;
i
++
)
{
memcpy
(
ptr
,
s
->
bytestream
,
n
);
memcpy
(
ptr
,
s
->
bytestream
,
n
);
s
->
bytestream
+=
n
;
s
->
bytestream
+=
n
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录