Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
3e4666f3
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,发现更多精彩内容 >>
提交
3e4666f3
编写于
8月 18, 2011
作者:
S
Stefano Sabatini
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vsrc_movie: create media agnostic movie init and uninit routines
Allow factorization for the pending work on the audio movie source.
上级
8aa62bb9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
41 deletion
+49
-41
libavfilter/vsrc_movie.c
libavfilter/vsrc_movie.c
+49
-41
未找到文件。
libavfilter/vsrc_movie.c
浏览文件 @
3e4666f3
...
...
@@ -39,6 +39,7 @@
#include "avfilter.h"
typedef
struct
{
/* common A/V fields */
const
AVClass
*
class
;
int64_t
seek_point
;
///< seekpoint in microseconds
double
seek_point_d
;
...
...
@@ -51,6 +52,7 @@ typedef struct {
int
is_done
;
AVFrame
*
frame
;
///< video frame to store the decoded images in
/* video-only fields */
int
w
,
h
;
AVFilterBufferRef
*
picref
;
}
MovieContext
;
...
...
@@ -78,13 +80,31 @@ static const AVClass movie_class = {
movie_options
};
static
int
movie_init
(
AVFilterContext
*
ctx
)
static
av_cold
int
movie_common_init
(
AVFilterContext
*
ctx
,
const
char
*
args
,
void
*
opaque
,
enum
AVMediaType
type
)
{
MovieContext
*
movie
=
ctx
->
priv
;
AVInputFormat
*
iformat
=
NULL
;
AVCodec
*
codec
;
int
ret
;
int64_t
timestamp
;
int
ret
;
movie
->
class
=
&
movie_class
;
av_opt_set_defaults2
(
movie
,
0
,
0
);
if
(
args
)
movie
->
file_name
=
av_get_token
(
&
args
,
":"
);
if
(
!
movie
->
file_name
||
!*
movie
->
file_name
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"No filename provided!
\n
"
);
return
AVERROR
(
EINVAL
);
}
if
(
*
args
++
==
':'
&&
(
ret
=
av_set_options_string
(
movie
,
args
,
"="
,
":"
))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Error parsing options string: '%s'
\n
"
,
args
);
return
ret
;
}
movie
->
seek_point
=
movie
->
seek_point_d
*
1000000
+
0
.
5
;
av_register_all
();
...
...
@@ -120,11 +140,11 @@ static int movie_init(AVFilterContext *ctx)
}
}
/* select the
video
stream */
if
((
ret
=
av_find_best_stream
(
movie
->
format_ctx
,
AVMEDIA_TYPE_VIDEO
,
/* select the
media
stream */
if
((
ret
=
av_find_best_stream
(
movie
->
format_ctx
,
type
,
movie
->
stream_index
,
-
1
,
NULL
,
0
))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"No
video
stream with index '%d' found
\n
"
,
movie
->
stream_index
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"No
%s
stream with index '%d' found
\n
"
,
av_get_media_type_string
(
type
),
movie
->
stream_index
);
return
ret
;
}
movie
->
stream_index
=
ret
;
...
...
@@ -145,14 +165,6 @@ static int movie_init(AVFilterContext *ctx)
return
ret
;
}
if
(
!
(
movie
->
frame
=
avcodec_alloc_frame
())
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Failed to alloc frame
\n
"
);
return
AVERROR
(
ENOMEM
);
}
movie
->
w
=
movie
->
codec_ctx
->
width
;
movie
->
h
=
movie
->
codec_ctx
->
height
;
av_log
(
ctx
,
AV_LOG_INFO
,
"seek_point:%"
PRIi64
" format_name:%s file_name:%s stream_index:%d
\n
"
,
movie
->
seek_point
,
movie
->
format_name
,
movie
->
file_name
,
movie
->
stream_index
);
...
...
@@ -160,31 +172,7 @@ static int movie_init(AVFilterContext *ctx)
return
0
;
}
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
,
void
*
opaque
)
{
MovieContext
*
movie
=
ctx
->
priv
;
int
ret
;
movie
->
class
=
&
movie_class
;
av_opt_set_defaults2
(
movie
,
0
,
0
);
if
(
args
)
movie
->
file_name
=
av_get_token
(
&
args
,
":"
);
if
(
!
movie
->
file_name
||
!*
movie
->
file_name
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"No filename provided!
\n
"
);
return
AVERROR
(
EINVAL
);
}
if
(
*
args
++
==
':'
&&
(
ret
=
av_set_options_string
(
movie
,
args
,
"="
,
":"
))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Error parsing options string: '%s'
\n
"
,
args
);
return
ret
;
}
movie
->
seek_point
=
movie
->
seek_point_d
*
1000000
+
0
.
5
;
return
movie_init
(
ctx
);
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
static
av_cold
void
movie_common_uninit
(
AVFilterContext
*
ctx
)
{
MovieContext
*
movie
=
ctx
->
priv
;
...
...
@@ -194,10 +182,30 @@ static av_cold void uninit(AVFilterContext *ctx)
avcodec_close
(
movie
->
codec_ctx
);
if
(
movie
->
format_ctx
)
av_close_input_file
(
movie
->
format_ctx
);
avfilter_unref_buffer
(
movie
->
picref
);
av_freep
(
&
movie
->
frame
);
}
static
av_cold
int
movie_init
(
AVFilterContext
*
ctx
,
const
char
*
args
,
void
*
opaque
)
{
MovieContext
*
movie
=
ctx
->
priv
;
int
ret
;
if
((
ret
=
movie_common_init
(
ctx
,
args
,
opaque
,
AVMEDIA_TYPE_VIDEO
))
<
0
)
return
ret
;
if
(
!
(
movie
->
frame
=
avcodec_alloc_frame
())
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Failed to alloc frame
\n
"
);
return
AVERROR
(
ENOMEM
);
}
movie
->
w
=
movie
->
codec_ctx
->
width
;
movie
->
h
=
movie
->
codec_ctx
->
height
;
return
0
;
}
static
int
query_formats
(
AVFilterContext
*
ctx
)
{
MovieContext
*
movie
=
ctx
->
priv
;
...
...
@@ -298,8 +306,8 @@ AVFilter avfilter_vsrc_movie = {
.
name
=
"movie"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Read from a movie source."
),
.
priv_size
=
sizeof
(
MovieContext
),
.
init
=
init
,
.
uninit
=
uninit
,
.
init
=
movie_
init
,
.
uninit
=
movie_common_
uninit
,
.
query_formats
=
query_formats
,
.
inputs
=
(
AVFilterPad
[])
{{
.
name
=
NULL
}},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录