Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
B1ack1e
FFmpeg
提交
1c9e8616
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,发现更多精彩内容 >>
提交
1c9e8616
编写于
5月 19, 2016
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hwcontext: add a function for opening devices
上级
24b5cff0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
71 addition
and
1 deletion
+71
-1
doc/APIchanges
doc/APIchanges
+3
-0
libavutil/hwcontext.c
libavutil/hwcontext.c
+36
-0
libavutil/hwcontext.h
libavutil/hwcontext.h
+28
-0
libavutil/hwcontext_internal.h
libavutil/hwcontext_internal.h
+3
-0
libavutil/version.h
libavutil/version.h
+1
-1
未找到文件。
doc/APIchanges
浏览文件 @
1c9e8616
...
...
@@ -13,6 +13,9 @@ libavutil: 2015-08-28
API changes, most recent first:
2016-xx-xx - xxxxxxx - lavu 55.13.0 - hwcontext.h
Add av_hwdevice_ctx_create().
2016-xx-xx - xxxxxxx - lavc 57.19.1 - avcodec.h
Adjust values for JPEG 2000 profiles.
...
...
libavutil/hwcontext.c
浏览文件 @
1c9e8616
...
...
@@ -452,3 +452,39 @@ void av_hwframe_constraints_free(AVHWFramesConstraints **constraints)
}
av_freep
(
constraints
);
}
int
av_hwdevice_ctx_create
(
AVBufferRef
**
pdevice_ref
,
enum
AVHWDeviceType
type
,
const
char
*
device
,
AVDictionary
*
opts
,
int
flags
)
{
AVBufferRef
*
device_ref
=
NULL
;
AVHWDeviceContext
*
device_ctx
;
int
ret
=
0
;
device_ref
=
av_hwdevice_ctx_alloc
(
type
);
if
(
!
device_ref
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
device_ctx
=
(
AVHWDeviceContext
*
)
device_ref
->
data
;
if
(
!
device_ctx
->
internal
->
hw_type
->
device_create
)
{
ret
=
AVERROR
(
ENOSYS
);
goto
fail
;
}
ret
=
device_ctx
->
internal
->
hw_type
->
device_create
(
device_ctx
,
device
,
opts
,
flags
);
if
(
ret
<
0
)
goto
fail
;
ret
=
av_hwdevice_ctx_init
(
device_ref
);
if
(
ret
<
0
)
goto
fail
;
*
pdevice_ref
=
device_ref
;
return
0
;
fail:
av_buffer_unref
(
&
device_ref
);
*
pdevice_ref
=
NULL
;
return
ret
;
}
libavutil/hwcontext.h
浏览文件 @
1c9e8616
...
...
@@ -241,6 +241,34 @@ AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type);
*/
int
av_hwdevice_ctx_init
(
AVBufferRef
*
ref
);
/**
* Open a device of the specified type and create an AVHWDeviceContext for it.
*
* This is a convenience function intended to cover the simple cases. Callers
* who need to fine-tune device creation/management should open the device
* manually and then wrap it in an AVHWDeviceContext using
* av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
*
* The returned context is already initialized and ready for use, the caller
* should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of
* the created AVHWDeviceContext are set by this function and should not be
* touched by the caller.
*
* @param device_ctx On success, a reference to the newly-created device context
* will be written here. The reference is owned by the caller
* and must be released with av_buffer_unref() when no longer
* needed. On failure, NULL will be written to this pointer.
* @param type The type of the device to create.
* @param device A type-specific string identifying the device to open.
* @param opts A dictionary of additional (type-specific) options to use in
* opening the device. The dictionary remains owned by the caller.
* @param flags currently unused
*
* @return 0 on success, a negative AVERROR code on failure.
*/
int
av_hwdevice_ctx_create
(
AVBufferRef
**
device_ctx
,
enum
AVHWDeviceType
type
,
const
char
*
device
,
AVDictionary
*
opts
,
int
flags
);
/**
* Allocate an AVHWFramesContext tied to a given device context.
*
...
...
libavutil/hwcontext_internal.h
浏览文件 @
1c9e8616
...
...
@@ -64,6 +64,9 @@ typedef struct HWContextType {
*/
size_t
frames_priv_size
;
int
(
*
device_create
)(
AVHWDeviceContext
*
ctx
,
const
char
*
device
,
AVDictionary
*
opts
,
int
flags
);
int
(
*
device_init
)(
AVHWDeviceContext
*
ctx
);
void
(
*
device_uninit
)(
AVHWDeviceContext
*
ctx
);
...
...
libavutil/version.h
浏览文件 @
1c9e8616
...
...
@@ -54,7 +54,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 55
#define LIBAVUTIL_VERSION_MINOR 1
2
#define LIBAVUTIL_VERSION_MINOR 1
3
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录