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
772c87c5
Commit
772c87c5
authored
Aug 05, 2015
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qsvenc: support passing arbitrary external buffers to the encoder
parent
68e00ad6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
5 deletions
+34
-5
qsvenc.c
libavcodec/qsvenc.c
+32
-4
qsvenc.h
libavcodec/qsvenc.h
+2
-1
No files found.
libavcodec/qsvenc.c
View file @
772c87c5
...
...
@@ -134,10 +134,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
q
->
extco
.
CAVLC
=
avctx
->
coder_type
==
FF_CODER_TYPE_VLC
?
MFX_CODINGOPTION_ON
:
MFX_CODINGOPTION_UNKNOWN
;
q
->
extparam
[
0
]
=
(
mfxExtBuffer
*
)
&
q
->
extco
;
q
->
param
.
ExtParam
=
q
->
extparam
;
q
->
param
.
NumExtParam
=
FF_ARRAY_ELEMS
(
q
->
extparam
);
q
->
extparam_internal
[
0
]
=
(
mfxExtBuffer
*
)
&
q
->
extco
;
}
return
0
;
...
...
@@ -228,6 +225,35 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q)
return
ff_qsv_error
(
ret
);
}
if
(
avctx
->
hwaccel_context
)
{
AVQSVContext
*
qsv
=
avctx
->
hwaccel_context
;
int
i
,
j
;
q
->
extparam
=
av_mallocz_array
(
qsv
->
nb_ext_buffers
+
FF_ARRAY_ELEMS
(
q
->
extparam_internal
),
sizeof
(
*
q
->
extparam
));
if
(
!
q
->
extparam
)
return
AVERROR
(
ENOMEM
);
q
->
param
.
ExtParam
=
q
->
extparam
;
for
(
i
=
0
;
i
<
qsv
->
nb_ext_buffers
;
i
++
)
q
->
param
.
ExtParam
[
i
]
=
qsv
->
ext_buffers
[
i
];
q
->
param
.
NumExtParam
=
qsv
->
nb_ext_buffers
;
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
q
->
extparam_internal
);
i
++
)
{
for
(
j
=
0
;
j
<
qsv
->
nb_ext_buffers
;
j
++
)
{
if
(
qsv
->
ext_buffers
[
j
]
->
BufferId
==
q
->
extparam_internal
[
i
]
->
BufferId
)
break
;
}
if
(
j
<
qsv
->
nb_ext_buffers
)
continue
;
q
->
param
.
ExtParam
[
q
->
param
.
NumExtParam
++
]
=
q
->
extparam_internal
[
i
];
}
}
else
{
q
->
param
.
ExtParam
=
q
->
extparam_internal
;
q
->
param
.
NumExtParam
=
FF_ARRAY_ELEMS
(
q
->
extparam_internal
);
}
ret
=
MFXVideoENCODE_Init
(
q
->
session
,
&
q
->
param
);
if
(
ret
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error initializing the encoder
\n
"
);
...
...
@@ -512,5 +538,7 @@ int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q)
av_fifo_free
(
q
->
async_fifo
);
q
->
async_fifo
=
NULL
;
av_freep
(
&
q
->
extparam
);
return
0
;
}
libavcodec/qsvenc.h
View file @
772c87c5
...
...
@@ -49,7 +49,8 @@ typedef struct QSVEncContext {
mfxFrameAllocRequest
req
;
mfxExtCodingOption
extco
;
mfxExtBuffer
*
extparam
[
1
];
mfxExtBuffer
*
extparam_internal
[
1
];
mfxExtBuffer
**
extparam
;
AVFifoBuffer
*
async_fifo
;
...
...
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