Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
B1ack1e
FFmpeg
提交
38392b2a
F
FFmpeg
项目概览
B1ack1e
/
FFmpeg
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FFmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
38392b2a
编写于
5月 19, 2016
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hwcontext_vdpau: implement device creation
上级
1c9e8616
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
82 addition
and
2 deletion
+82
-2
configure
configure
+1
-2
libavutil/hwcontext_vdpau.c
libavutil/hwcontext_vdpau.c
+81
-0
未找到文件。
configure
浏览文件 @
38392b2a
...
...
@@ -4766,8 +4766,7 @@ enabled vdpau &&
disable vdpau
enabled vdpau
&&
enabled xlib
&&
check_func_headers
"vdpau/vdpau.h vdpau/vdpau_x11.h"
vdp_device_create_x11
-lvdpau
&&
prepend avconv_libs
$(
$ldflags_filter
"-lvdpau"
)
&&
check_lib2
"vdpau/vdpau.h vdpau/vdpau_x11.h"
vdp_device_create_x11
-lvdpau
&&
enable
vdpau_x11
enabled debug
&&
add_cflags
-g
"
$debuglevel
"
&&
add_asflags
-g
"
$debuglevel
"
...
...
libavutil/hwcontext_vdpau.c
浏览文件 @
38392b2a
...
...
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include <stdint.h>
#include <string.h>
...
...
@@ -388,6 +390,82 @@ static int vdpau_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
return
0
;
}
#if HAVE_VDPAU_X11
#include <vdpau/vdpau_x11.h>
#include <X11/Xlib.h>
typedef
struct
VDPAUDevicePriv
{
VdpDeviceDestroy
*
device_destroy
;
Display
*
dpy
;
}
VDPAUDevicePriv
;
static
void
vdpau_device_free
(
AVHWDeviceContext
*
ctx
)
{
AVVDPAUDeviceContext
*
hwctx
=
ctx
->
hwctx
;
VDPAUDevicePriv
*
priv
=
ctx
->
user_opaque
;
if
(
priv
->
device_destroy
)
priv
->
device_destroy
(
hwctx
->
device
);
if
(
priv
->
dpy
)
XCloseDisplay
(
priv
->
dpy
);
av_freep
(
&
priv
);
}
static
int
vdpau_device_create
(
AVHWDeviceContext
*
ctx
,
const
char
*
device
,
AVDictionary
*
opts
,
int
flags
)
{
AVVDPAUDeviceContext
*
hwctx
=
ctx
->
hwctx
;
VDPAUDevicePriv
*
priv
;
VdpStatus
err
;
VdpGetInformationString
*
get_information_string
;
const
char
*
display
,
*
vendor
;
priv
=
av_mallocz
(
sizeof
(
*
priv
));
if
(
!
priv
)
return
AVERROR
(
ENOMEM
);
ctx
->
user_opaque
=
priv
;
ctx
->
free
=
vdpau_device_free
;
priv
->
dpy
=
XOpenDisplay
(
device
);
if
(
!
priv
->
dpy
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Cannot open the X11 display %s.
\n
"
,
XDisplayName
(
device
));
return
AVERROR_UNKNOWN
;
}
display
=
XDisplayString
(
priv
->
dpy
);
err
=
vdp_device_create_x11
(
priv
->
dpy
,
XDefaultScreen
(
priv
->
dpy
),
&
hwctx
->
device
,
&
hwctx
->
get_proc_address
);
if
(
err
!=
VDP_STATUS_OK
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"VDPAU device creation on X11 display %s failed.
\n
"
,
display
);
return
AVERROR_UNKNOWN
;
}
#define GET_CALLBACK(id, result) \
do { \
void *tmp; \
err = hwctx->get_proc_address(hwctx->device, id, &tmp); \
if (err != VDP_STATUS_OK) { \
av_log(ctx, AV_LOG_ERROR, "Error getting the " #id " callback.\n"); \
return AVERROR_UNKNOWN; \
} \
result = tmp; \
} while (0)
GET_CALLBACK
(
VDP_FUNC_ID_GET_INFORMATION_STRING
,
get_information_string
);
GET_CALLBACK
(
VDP_FUNC_ID_DEVICE_DESTROY
,
priv
->
device_destroy
);
get_information_string
(
&
vendor
);
av_log
(
ctx
,
AV_LOG_VERBOSE
,
"Successfully created a VDPAU device (%s) on "
"X11 display %s
\n
"
,
vendor
,
display
);
return
0
;
}
#endif
const
HWContextType
ff_hwcontext_type_vdpau
=
{
.
type
=
AV_HWDEVICE_TYPE_VDPAU
,
.
name
=
"VDPAU"
,
...
...
@@ -396,6 +474,9 @@ const HWContextType ff_hwcontext_type_vdpau = {
.
device_priv_size
=
sizeof
(
VDPAUDeviceContext
),
.
frames_priv_size
=
sizeof
(
VDPAUFramesContext
),
#if HAVE_VDPAU_X11
.
device_create
=
vdpau_device_create
,
#endif
.
device_init
=
vdpau_device_init
,
.
device_uninit
=
vdpau_device_uninit
,
.
frames_init
=
vdpau_frames_init
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录