Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
edecd723
Commit
edecd723
authored
Apr 14, 2018
by
Mark Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amfenc: Remove spurious initialisations
Also minor cosmetics.
parent
2c6ca2b5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
47 deletions
+29
-47
amfenc.c
libavcodec/amfenc.c
+29
-47
No files found.
libavcodec/amfenc.c
View file @
edecd723
...
...
@@ -108,15 +108,10 @@ 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
;
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
);
...
...
@@ -328,7 +323,7 @@ static int amf_init_encoder(AVCodecContext *avctx)
{
AmfContext
*
ctx
=
avctx
->
priv_data
;
const
wchar_t
*
codec_id
=
NULL
;
AMF_RESULT
res
=
AMF_OK
;
AMF_RESULT
res
;
enum
AVPixelFormat
pix_fmt
;
switch
(
avctx
->
codec
->
id
)
{
...
...
@@ -361,8 +356,8 @@ 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
)
{
if
(
ctx
->
delayed_surface
)
{
ctx
->
delayed_surface
->
pVtbl
->
Release
(
ctx
->
delayed_surface
);
ctx
->
delayed_surface
=
NULL
;
}
...
...
@@ -402,7 +397,7 @@ int av_cold ff_amf_encode_close(AVCodecContext *avctx)
static
int
amf_copy_surface
(
AVCodecContext
*
avctx
,
const
AVFrame
*
frame
,
AMFSurface
*
surface
)
{
AMFPlane
*
plane
=
NULL
;
AMFPlane
*
plane
;
uint8_t
*
dst_data
[
4
];
int
dst_linesize
[
4
];
int
planes
;
...
...
@@ -497,21 +492,8 @@ 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
;
if
((
ret
=
amf_load_library
(
avctx
))
==
0
)
{
if
((
ret
=
amf_init_context
(
avctx
))
==
0
)
{
if
((
ret
=
amf_init_encoder
(
avctx
))
==
0
)
{
...
...
@@ -587,17 +569,17 @@ 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
)
{
AMF_RESULT
res
=
AMF_OK
;
AmfContext
*
ctx
=
avctx
->
priv_data
;
AMFSurface
*
surface
=
NULL
;
AMFSurface
*
surface
;
AMF_RESULT
res
;
int
ret
;
if
(
!
ctx
->
encoder
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment