Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
335c3129
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,发现更多精彩内容 >>
提交
335c3129
编写于
2月 25, 2013
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vf_drawbox: switch to an AVOptions-based system.
上级
63e58c55
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
25 addition
and
13 deletion
+25
-13
doc/filters.texi
doc/filters.texi
+2
-5
libavfilter/vf_drawbox.c
libavfilter/vf_drawbox.c
+23
-8
未找到文件。
doc/filters.texi
浏览文件 @
335c3129
...
...
@@ -811,10 +811,7 @@ delogo=x=0:y=0:w=100:h=77:band=10
Draw a colored box on the input image.
It accepts the syntax:
@example
drawbox=@var{x}:@var{y}:@var{width}:@var{height}:@var{color}
@end example
This filter accepts the following options:
@table @option
...
...
@@ -836,7 +833,7 @@ Follow some examples:
drawbox
# draw a box with color red and an opacity of 50%
drawbox=
10:20:200:60:
red@@0.5"
drawbox=
x=10:y=20:width=200:height=60:color=
red@@0.5"
@end example
@section drawtext
...
...
libavfilter/vf_drawbox.c
浏览文件 @
335c3129
...
...
@@ -26,6 +26,7 @@
#include "libavutil/colorspace.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
...
...
@@ -36,7 +37,9 @@
enum
{
Y
,
U
,
V
,
A
};
typedef
struct
{
const
AVClass
*
class
;
int
x
,
y
,
w
,
h
;
char
*
color_str
;
unsigned
char
yuv_color
[
4
];
int
vsub
,
hsub
;
///< chroma subsampling
}
DrawBoxContext
;
...
...
@@ -44,16 +47,9 @@ typedef struct {
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
DrawBoxContext
*
drawbox
=
ctx
->
priv
;
char
color_str
[
1024
]
=
"black"
;
uint8_t
rgba_color
[
4
];
drawbox
->
x
=
drawbox
->
y
=
drawbox
->
w
=
drawbox
->
h
=
0
;
if
(
args
)
sscanf
(
args
,
"%d:%d:%d:%d:%s"
,
&
drawbox
->
x
,
&
drawbox
->
y
,
&
drawbox
->
w
,
&
drawbox
->
h
,
color_str
);
if
(
av_parse_color
(
rgba_color
,
color_str
,
-
1
,
ctx
)
<
0
)
if
(
av_parse_color
(
rgba_color
,
drawbox
->
color_str
,
-
1
,
ctx
)
<
0
)
return
AVERROR
(
EINVAL
);
drawbox
->
yuv_color
[
Y
]
=
RGB_TO_Y_CCIR
(
rgba_color
[
0
],
rgba_color
[
1
],
rgba_color
[
2
]);
...
...
@@ -124,6 +120,24 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
return
ff_filter_frame
(
inlink
->
dst
->
outputs
[
0
],
frame
);
}
#define OFFSET(x) offsetof(DrawBoxContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
options
[]
=
{
{
"x"
,
"Horizontal position of the left box edge"
,
OFFSET
(
x
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
INT_MIN
,
INT_MAX
,
FLAGS
},
{
"y"
,
"Vertical position of the top box edge"
,
OFFSET
(
y
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
INT_MIN
,
INT_MAX
,
FLAGS
},
{
"width"
,
"Width of the box"
,
OFFSET
(
w
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
INT_MAX
,
FLAGS
},
{
"height"
,
"Height of the box"
,
OFFSET
(
h
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
INT_MAX
,
FLAGS
},
{
"color"
,
"Color of the box"
,
OFFSET
(
color_str
),
AV_OPT_TYPE_STRING
,
{
.
str
=
"black"
},
.
flags
=
FLAGS
},
{
NULL
},
};
static
const
AVClass
drawbox_class
=
{
.
class_name
=
"drawbox"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
static
const
AVFilterPad
avfilter_vf_drawbox_inputs
[]
=
{
{
.
name
=
"default"
,
...
...
@@ -148,6 +162,7 @@ AVFilter avfilter_vf_drawbox = {
.
name
=
"drawbox"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Draw a colored box on the input video."
),
.
priv_size
=
sizeof
(
DrawBoxContext
),
.
priv_class
=
&
drawbox_class
,
.
init
=
init
,
.
query_formats
=
query_formats
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录