Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
6f176376
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,发现更多精彩内容 >>
提交
6f176376
编写于
6月 18, 2007
作者:
R
Ramiro Polla
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add alpha channel support for imlib2 vhook
Originally committed as revision 9365 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
f32adb22
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
7 deletion
+37
-7
doc/hooks.texi
doc/hooks.texi
+8
-0
vhook/imlib2.c
vhook/imlib2.c
+29
-7
未找到文件。
doc/hooks.texi
浏览文件 @
6f176376
...
...
@@ -158,6 +158,14 @@ Usage examples:
In this example, the color for the text goes up and down from black to
white.
# Text fade-out
ffmpeg -i input.avi -vhook
\
'vhook/imlib2.so -t Hello -A max(0,255-exp(N/47))'
\
-sameq output.avi
In this example, the text fades out in about 10 seconds for a 25 fps input
video file.
# scrolling credits from a graphics file
ffmpeg -sameq -i input.avi
\
-vhook 'vhook/imlib2.so -x 0 -y -1.0*N -i credits.png' output.avi
...
...
vhook/imlib2.c
浏览文件 @
6f176376
...
...
@@ -29,6 +29,7 @@
* -R <expression> Value for R color
* -G <expression> Value for G color
* -B <expression> Value for B color
* -A <expression> Value for Alpha channel
*
* Expressions are functions of:
* N // frame number (starting at zero)
...
...
@@ -133,9 +134,9 @@ typedef struct {
Imlib_Font
fn
;
char
*
text
;
char
*
file
;
int
r
,
g
,
b
;
AVEvalExpr
*
eval_r
,
*
eval_g
,
*
eval_b
;
char
*
expr_R
,
*
expr_G
,
*
expr_B
;
int
r
,
g
,
b
,
a
;
AVEvalExpr
*
eval_r
,
*
eval_g
,
*
eval_b
,
*
eval_a
;
char
*
expr_R
,
*
expr_G
,
*
expr_B
,
*
expr_A
;
int
eval_colors
;
double
x
,
y
;
char
*
fileImage
;
...
...
@@ -179,12 +180,14 @@ void Release(void *ctx)
ff_eval_free
(
ci
->
eval_r
);
ff_eval_free
(
ci
->
eval_g
);
ff_eval_free
(
ci
->
eval_b
);
ff_eval_free
(
ci
->
eval_a
);
av_free
(
ci
->
expr_x
);
av_free
(
ci
->
expr_y
);
av_free
(
ci
->
expr_R
);
av_free
(
ci
->
expr_G
);
av_free
(
ci
->
expr_B
);
av_free
(
ci
->
expr_A
);
sws_freeContext
(
ci
->
toRGB_convert_ctx
);
sws_freeContext
(
ci
->
fromRGB_convert_ctx
);
av_free
(
ctx
);
...
...
@@ -223,7 +226,7 @@ int Configure(void **ctxp, int argc, char *argv[])
imlib_add_path_to_font_path
(
fp
);
while
((
c
=
getopt
(
argc
,
argv
,
"R:G:B:C:c:f:F:t:x:y:i:"
))
>
0
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"R:G:B:
A:
C:c:f:F:t:x:y:i:"
))
>
0
)
{
switch
(
c
)
{
case
'R'
:
ci
->
expr_R
=
av_strdup
(
optarg
);
...
...
@@ -237,6 +240,9 @@ int Configure(void **ctxp, int argc, char *argv[])
ci
->
expr_B
=
av_strdup
(
optarg
);
ci
->
eval_colors
=
1
;
break
;
case
'A'
:
ci
->
expr_A
=
av_strdup
(
optarg
);
break
;
case
'C'
:
rgbtxt
=
optarg
;
break
;
...
...
@@ -339,8 +345,17 @@ int Configure(void **ctxp, int argc, char *argv[])
}
}
if
(
!
ci
->
eval_colors
)
imlib_context_set_color
(
ci
->
r
,
ci
->
g
,
ci
->
b
,
255
);
if
(
ci
->
expr_A
)
{
if
(
!
(
ci
->
eval_a
=
ff_parse
(
ci
->
expr_A
,
const_names
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
))){
av_log
(
NULL
,
AV_LOG_ERROR
,
"Couldn't parse A expression '%s'
\n
"
,
ci
->
expr_A
);
return
-
1
;
}
}
else
{
ci
->
a
=
255
;
}
if
(
!
(
ci
->
eval_colors
||
ci
->
eval_a
))
imlib_context_set_color
(
ci
->
r
,
ci
->
g
,
ci
->
b
,
ci
->
a
);
/* load the image (for example, credits for a movie) */
if
(
ci
->
fileImage
)
{
...
...
@@ -477,11 +492,18 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
ci
->
y
=
ff_parse_eval
(
ci
->
eval_y
,
const_values
,
ci
);
y
=
ci
->
y
;
if
(
ci
->
eval_a
)
{
ci
->
a
=
ff_parse_eval
(
ci
->
eval_a
,
const_values
,
ci
);
}
if
(
ci
->
eval_colors
)
{
ci
->
r
=
ff_parse_eval
(
ci
->
eval_r
,
const_values
,
ci
);
ci
->
g
=
ff_parse_eval
(
ci
->
eval_g
,
const_values
,
ci
);
ci
->
b
=
ff_parse_eval
(
ci
->
eval_b
,
const_values
,
ci
);
imlib_context_set_color
(
ci
->
r
,
ci
->
g
,
ci
->
b
,
255
);
}
if
(
ci
->
eval_colors
||
ci
->
eval_a
)
{
imlib_context_set_color
(
ci
->
r
,
ci
->
g
,
ci
->
b
,
ci
->
a
);
}
if
(
!
(
ci
->
imageOverlaid
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录