Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
edecd723
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,发现更多精彩内容 >>
提交
edecd723
编写于
4月 14, 2018
作者:
M
Mark Thompson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
amfenc: Remove spurious initialisations
Also minor cosmetics.
上级
2c6ca2b5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
47 deletion
+29
-47
libavcodec/amfenc.c
libavcodec/amfenc.c
+29
-47
未找到文件。
libavcodec/amfenc.c
浏览文件 @
edecd723
...
...
@@ -107,16 +107,11 @@ static AMFTraceWriterVtbl tracer_vtbl =
static
int
amf_load_library
(
AVCodecContext
*
avctx
)
{
AmfContext
*
ctx
=
avctx
->
priv_data
;
AMFInit_Fn
init_fun
=
NULL
;
AMFQueryVersion_Fn
version_fun
=
NULL
;
AMF_RESULT
res
=
AMF_OK
;
AmfContext
*
ctx
=
avctx
->
priv_data
;
AMFInit_Fn
init_fun
;
AMFQueryVersion_Fn
version_fun
;
AMF_RESULT
res
;
ctx
->
eof
=
0
;
ctx
->
delayed_drain
=
0
;
ctx
->
hw_frames_ctx
=
NULL
;
ctx
->
hw_device_ctx
=
NULL
;
ctx
->
delayed_surface
=
NULL
;
ctx
->
delayed_frame
=
av_frame_alloc
();
if
(
!
ctx
->
delayed_frame
)
{
return
AVERROR
(
ENOMEM
);
...
...
@@ -326,10 +321,10 @@ static int amf_init_context(AVCodecContext *avctx)
static
int
amf_init_encoder
(
AVCodecContext
*
avctx
)
{
AmfContext
*
ctx
=
avctx
->
priv_data
;
const
wchar_t
*
codec_id
=
NULL
;
AMF_RESULT
res
=
AMF_OK
;
enum
AVPixelFormat
pix_fmt
;
AmfContext
*
ctx
=
avctx
->
priv_data
;
const
wchar_t
*
codec_id
=
NULL
;
AMF_RESULT
res
;
enum
AVPixelFormat
pix_fmt
;
switch
(
avctx
->
codec
->
id
)
{
case
AV_CODEC_ID_H264
:
...
...
@@ -360,9 +355,9 @@ static int amf_init_encoder(AVCodecContext *avctx)
int
av_cold
ff_amf_encode_close
(
AVCodecContext
*
avctx
)
{
AmfContext
*
ctx
=
avctx
->
priv_data
;
if
(
ctx
->
delayed_surface
)
{
AmfContext
*
ctx
=
avctx
->
priv_data
;
if
(
ctx
->
delayed_surface
)
{
ctx
->
delayed_surface
->
pVtbl
->
Release
(
ctx
->
delayed_surface
);
ctx
->
delayed_surface
=
NULL
;
}
...
...
@@ -402,11 +397,11 @@ int av_cold ff_amf_encode_close(AVCodecContext *avctx)
static
int
amf_copy_surface
(
AVCodecContext
*
avctx
,
const
AVFrame
*
frame
,
AMFSurface
*
surface
)
{
AMFPlane
*
plane
=
NULL
;
uint8_t
*
dst_data
[
4
];
int
dst_linesize
[
4
];
int
planes
;
int
i
;
AMFPlane
*
plane
;
uint8_t
*
dst_data
[
4
];
int
dst_linesize
[
4
];
int
planes
;
int
i
;
planes
=
surface
->
pVtbl
->
GetPlanesCount
(
surface
);
av_assert0
(
planes
<
FF_ARRAY_ELEMS
(
dst_data
));
...
...
@@ -437,11 +432,11 @@ static inline int timestamp_queue_enqueue(AVCodecContext *avctx, int64_t timesta
static
int
amf_copy_buffer
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
AMFBuffer
*
buffer
)
{
AmfContext
*
ctx
=
avctx
->
priv_data
;
int
ret
;
AMFVariantStruct
var
=
{
0
};
int64_t
timestamp
=
AV_NOPTS_VALUE
;
int64_t
size
=
buffer
->
pVtbl
->
GetSize
(
buffer
);
AmfContext
*
ctx
=
avctx
->
priv_data
;
int
ret
;
AMFVariantStruct
var
=
{
0
};
int64_t
timestamp
=
AV_NOPTS_VALUE
;
int64_t
size
=
buffer
->
pVtbl
->
GetSize
(
buffer
);
if
((
ret
=
ff_alloc_packet2
(
avctx
,
pkt
,
size
,
0
))
<
0
)
{
return
ret
;
...
...
@@ -497,20 +492,7 @@ static int amf_copy_buffer(AVCodecContext *avctx, AVPacket *pkt, AMFBuffer *buff
// amfenc API implementation
int
ff_amf_encode_init
(
AVCodecContext
*
avctx
)
{
AmfContext
*
ctx
=
avctx
->
priv_data
;
int
ret
;
ctx
->
factory
=
NULL
;
ctx
->
debug
=
NULL
;
ctx
->
trace
=
NULL
;
ctx
->
context
=
NULL
;
ctx
->
encoder
=
NULL
;
ctx
->
library
=
NULL
;
ctx
->
version
=
0
;
ctx
->
eof
=
0
;
ctx
->
format
=
0
;
ctx
->
tracer
.
vtbl
=
NULL
;
ctx
->
tracer
.
avctx
=
NULL
;
int
ret
;
if
((
ret
=
amf_load_library
(
avctx
))
==
0
)
{
if
((
ret
=
amf_init_context
(
avctx
))
==
0
)
{
...
...
@@ -587,18 +569,18 @@ static AMFBuffer *amf_create_buffer_with_frame_ref(const AVFrame *frame, AMFCont
static
void
amf_release_buffer_with_frame_ref
(
AMFBuffer
*
frame_ref_storage_buffer
)
{
AVFrame
*
av_
frame_ref
;
memcpy
(
&
av_frame_ref
,
frame_ref_storage_buffer
->
pVtbl
->
GetNative
(
frame_ref_storage_buffer
),
sizeof
(
av_
frame_ref
));
av_frame_free
(
&
av_
frame_ref
);
AVFrame
*
frame_ref
;
memcpy
(
&
frame_ref
,
frame_ref_storage_buffer
->
pVtbl
->
GetNative
(
frame_ref_storage_buffer
),
sizeof
(
frame_ref
));
av_frame_free
(
&
frame_ref
);
frame_ref_storage_buffer
->
pVtbl
->
Release
(
frame_ref_storage_buffer
);
}
int
ff_amf_send_frame
(
AVCodecContext
*
avctx
,
const
AVFrame
*
frame
)
{
A
MF_RESULT
res
=
AMF_OK
;
A
mfContext
*
ctx
=
avctx
->
priv_data
;
AMF
Surface
*
surface
=
NULL
;
int
ret
;
A
mfContext
*
ctx
=
avctx
->
priv_data
;
A
MFSurface
*
surface
;
AMF
_RESULT
res
;
int
ret
;
if
(
!
ctx
->
encoder
)
return
AVERROR
(
EINVAL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录