Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
abcedfac
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,发现更多精彩内容 >>
提交
abcedfac
编写于
6月 04, 2011
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
img2: add framerate private option.
上级
a915bf64
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
10 addition
and
5 deletion
+10
-5
libavformat/img2.c
libavformat/img2.c
+10
-5
未找到文件。
libavformat/img2.c
浏览文件 @
abcedfac
...
@@ -41,6 +41,7 @@ typedef struct {
...
@@ -41,6 +41,7 @@ typedef struct {
char
path
[
1024
];
char
path
[
1024
];
char
*
pixel_format
;
/**< Set by a private option. */
char
*
pixel_format
;
/**< Set by a private option. */
char
*
video_size
;
/**< Set by a private option. */
char
*
video_size
;
/**< Set by a private option. */
char
*
framerate
;
/**< Set by a private option. */
}
VideoData
;
}
VideoData
;
typedef
struct
{
typedef
struct
{
...
@@ -209,6 +210,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
...
@@ -209,6 +210,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
int
width
=
0
,
height
=
0
;
int
width
=
0
,
height
=
0
;
AVStream
*
st
;
AVStream
*
st
;
enum
PixelFormat
pix_fmt
=
PIX_FMT_NONE
;
enum
PixelFormat
pix_fmt
=
PIX_FMT_NONE
;
AVRational
framerate
;
s1
->
ctx_flags
|=
AVFMTCTX_NOHEADER
;
s1
->
ctx_flags
|=
AVFMTCTX_NOHEADER
;
...
@@ -225,6 +227,10 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
...
@@ -225,6 +227,10 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
av_log
(
s
,
AV_LOG_ERROR
,
"Could not parse video size: %s.
\n
"
,
s
->
video_size
);
av_log
(
s
,
AV_LOG_ERROR
,
"Could not parse video size: %s.
\n
"
,
s
->
video_size
);
return
ret
;
return
ret
;
}
}
if
((
ret
=
av_parse_video_rate
(
&
framerate
,
s
->
framerate
))
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Could not parse framerate: %s.
\n
"
,
s
->
framerate
);
return
ret
;
}
#if FF_API_FORMAT_PARAMETERS
#if FF_API_FORMAT_PARAMETERS
if
(
ap
->
pix_fmt
!=
PIX_FMT_NONE
)
if
(
ap
->
pix_fmt
!=
PIX_FMT_NONE
)
pix_fmt
=
ap
->
pix_fmt
;
pix_fmt
=
ap
->
pix_fmt
;
...
@@ -232,6 +238,8 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
...
@@ -232,6 +238,8 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
width
=
ap
->
width
;
width
=
ap
->
width
;
if
(
ap
->
height
>
0
)
if
(
ap
->
height
>
0
)
height
=
ap
->
height
;
height
=
ap
->
height
;
if
(
ap
->
time_base
.
num
)
framerate
=
(
AVRational
){
ap
->
time_base
.
den
,
ap
->
time_base
.
num
};
#endif
#endif
av_strlcpy
(
s
->
path
,
s1
->
filename
,
sizeof
(
s
->
path
));
av_strlcpy
(
s
->
path
,
s1
->
filename
,
sizeof
(
s
->
path
));
...
@@ -246,11 +254,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
...
@@ -246,11 +254,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
st
->
need_parsing
=
AVSTREAM_PARSE_FULL
;
st
->
need_parsing
=
AVSTREAM_PARSE_FULL
;
}
}
if
(
!
ap
->
time_base
.
num
)
{
av_set_pts_info
(
st
,
60
,
framerate
.
den
,
framerate
.
num
);
av_set_pts_info
(
st
,
60
,
1
,
25
);
}
else
{
av_set_pts_info
(
st
,
60
,
ap
->
time_base
.
num
,
ap
->
time_base
.
den
);
}
if
(
width
&&
height
)
{
if
(
width
&&
height
)
{
st
->
codec
->
width
=
width
;
st
->
codec
->
width
=
width
;
...
@@ -452,6 +456,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -452,6 +456,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
static
const
AVOption
options
[]
=
{
static
const
AVOption
options
[]
=
{
{
"pixel_format"
,
""
,
OFFSET
(
pixel_format
),
FF_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
"pixel_format"
,
""
,
OFFSET
(
pixel_format
),
FF_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
"video_size"
,
""
,
OFFSET
(
video_size
),
FF_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
"video_size"
,
""
,
OFFSET
(
video_size
),
FF_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
DEC
},
{
"framerate"
,
""
,
OFFSET
(
framerate
),
FF_OPT_TYPE_STRING
,
{.
str
=
"25"
},
0
,
0
,
DEC
},
{
NULL
},
{
NULL
},
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录