Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
9150f42e
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,发现更多精彩内容 >>
提交
9150f42e
编写于
9月 16, 2001
作者:
F
Fabrice Bellard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed image number syntax problems
Originally committed as revision 128 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
5a56c87c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
80 addition
and
13 deletion
+80
-13
libav/img.c
libav/img.c
+13
-7
libav/jpeg.c
libav/jpeg.c
+11
-6
libav/utils.c
libav/utils.c
+56
-0
未找到文件。
libav/img.c
浏览文件 @
9150f42e
...
...
@@ -169,7 +169,9 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
int
ret
;
ByteIOContext
f1
,
*
f
;
snprintf
(
filename
,
sizeof
(
filename
),
s
->
path
,
s
->
img_number
);
if
(
get_frame_filename
(
filename
,
sizeof
(
filename
),
s
->
path
,
s
->
img_number
)
<
0
)
return
-
EIO
;
if
(
!
s
->
is_pipe
)
{
f
=
&
f1
;
...
...
@@ -223,6 +225,7 @@ static int sizes[][2] = {
{
160
,
128
},
{
512
,
384
},
{
640
,
352
},
{
640
,
240
},
};
static
int
infer_size
(
int
*
width_ptr
,
int
*
height_ptr
,
int
size
)
...
...
@@ -288,7 +291,8 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
if
(
!
s
->
is_pipe
)
{
/* try to find the first image */
for
(
i
=
0
;
i
<
5
;
i
++
)
{
snprintf
(
buf
,
sizeof
(
buf
),
s
->
path
,
s
->
img_number
);
if
(
get_frame_filename
(
buf
,
sizeof
(
buf
),
s
->
path
,
s
->
img_number
)
<
0
)
goto
fail
;
if
(
url_fopen
(
f
,
buf
,
URL_RDONLY
)
>=
0
)
break
;
s
->
img_number
++
;
...
...
@@ -543,7 +547,9 @@ static int img_write_packet(AVFormatContext *s, int stream_index,
return
-
EIO
;
}
snprintf
(
filename
,
sizeof
(
filename
),
img
->
path
,
img
->
img_number
);
if
(
get_frame_filename
(
filename
,
sizeof
(
filename
),
img
->
path
,
img
->
img_number
)
<
0
)
return
-
EIO
;
if
(
!
img
->
is_pipe
)
{
pb
=
&
pb1
;
...
...
@@ -596,7 +602,7 @@ AVFormat pgm_format = {
img_read_packet
,
img_read_close
,
NULL
,
AVFMT_NOFILE
,
AVFMT_NOFILE
|
AVFMT_NEEDNUMBER
,
};
AVFormat
pgmyuv_format
=
{
...
...
@@ -614,7 +620,7 @@ AVFormat pgmyuv_format = {
img_read_packet
,
img_read_close
,
NULL
,
AVFMT_NOFILE
,
AVFMT_NOFILE
|
AVFMT_NEEDNUMBER
,
};
AVFormat
ppm_format
=
{
...
...
@@ -632,7 +638,7 @@ AVFormat ppm_format = {
img_read_packet
,
img_read_close
,
NULL
,
AVFMT_NOFILE
,
AVFMT_NOFILE
|
AVFMT_NEEDNUMBER
,
};
AVFormat
imgyuv_format
=
{
...
...
@@ -650,7 +656,7 @@ AVFormat imgyuv_format = {
img_read_packet
,
img_read_close
,
NULL
,
AVFMT_NOFILE
,
AVFMT_NOFILE
|
AVFMT_NEEDNUMBER
,
};
AVFormat
pgmpipe_format
=
{
...
...
libav/jpeg.c
浏览文件 @
9150f42e
/*
*
Miscellaneous M
JPEG based formats
* Copyright (c) 2000 Gerard Lantau.
* JPEG based formats
* Copyright (c) 2000
, 2001
Gerard Lantau.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -126,7 +126,9 @@ static int jpeg_write_packet(AVFormatContext *s1, int stream_index,
char
filename
[
1024
];
ByteIOContext
f1
,
*
pb
=
&
f1
;
snprintf
(
filename
,
sizeof
(
filename
),
s
->
path
,
s
->
img_number
);
if
(
get_frame_filename
(
filename
,
sizeof
(
filename
),
s
->
path
,
s
->
img_number
)
<
0
)
return
-
EIO
;
if
(
url_fopen
(
pb
,
filename
,
URL_WRONLY
)
<
0
)
return
-
EIO
;
...
...
@@ -173,7 +175,8 @@ static int jpeg_read_header(AVFormatContext *s1, AVFormatParameters *ap)
/* try to find the first image */
for
(
i
=
0
;
i
<
5
;
i
++
)
{
snprintf
(
buf
,
sizeof
(
buf
),
s
->
path
,
s
->
img_number
);
if
(
get_frame_filename
(
buf
,
sizeof
(
buf
),
s
->
path
,
s
->
img_number
)
<
0
)
goto
fail
;
if
(
url_fopen
(
f
,
buf
,
URL_RDONLY
)
>=
0
)
break
;
s
->
img_number
++
;
...
...
@@ -201,7 +204,9 @@ static int jpeg_read_packet(AVFormatContext *s1, AVPacket *pkt)
int
size
;
ByteIOContext
f1
,
*
f
=
&
f1
;
snprintf
(
filename
,
sizeof
(
filename
),
s
->
path
,
s
->
img_number
);
if
(
get_frame_filename
(
filename
,
sizeof
(
filename
),
s
->
path
,
s
->
img_number
)
<
0
)
return
-
EIO
;
f
=
&
f1
;
if
(
url_fopen
(
f
,
filename
,
URL_RDONLY
)
<
0
)
...
...
@@ -241,5 +246,5 @@ AVFormat jpeg_format = {
jpeg_read_packet
,
jpeg_read_close
,
NULL
,
AVFMT_NOFILE
,
AVFMT_NOFILE
|
AVFMT_NEEDNUMBER
,
};
libav/utils.c
浏览文件 @
9150f42e
...
...
@@ -548,3 +548,59 @@ int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
return
0
;
}
/* Return in 'buf' the path with '%d' replaced by number. Also handles
the '%0nd' format where 'n' is the total number of digits and
'%%'. Return 0 if OK, and -1 if format error */
int
get_frame_filename
(
char
*
buf
,
int
buf_size
,
const
char
*
path
,
int
number
)
{
const
char
*
p
;
char
*
q
,
buf1
[
20
];
int
nd
,
len
,
c
,
percentd_found
;
q
=
buf
;
p
=
path
;
percentd_found
=
0
;
for
(;;)
{
c
=
*
p
++
;
if
(
c
==
'\0'
)
break
;
if
(
c
==
'%'
)
{
nd
=
0
;
while
(
*
p
>=
'0'
&&
*
p
<=
'9'
)
{
nd
=
nd
*
10
+
*
p
++
-
'0'
;
}
c
=
*
p
++
;
switch
(
c
)
{
case
'%'
:
goto
addchar
;
case
'd'
:
if
(
percentd_found
)
goto
fail
;
percentd_found
=
1
;
snprintf
(
buf1
,
sizeof
(
buf1
),
"%0*d"
,
nd
,
number
);
len
=
strlen
(
buf1
);
if
((
q
-
buf
+
len
)
>
buf_size
-
1
)
goto
fail
;
memcpy
(
q
,
buf1
,
len
);
q
+=
len
;
break
;
default:
goto
fail
;
}
}
else
{
addchar:
if
((
q
-
buf
)
<
buf_size
-
1
)
*
q
++
=
c
;
}
}
if
(
!
percentd_found
)
goto
fail
;
*
q
=
'\0'
;
return
0
;
fail:
*
q
=
'\0'
;
return
-
1
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录