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
4936a48b
Commit
4936a48b
authored
Mar 04, 2017
by
Mark Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qsv: Add ability to create a session from a device
parent
41dda860
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
24 deletions
+46
-24
qsv.c
libavcodec/qsv.c
+34
-15
qsv_internal.h
libavcodec/qsv_internal.h
+6
-3
qsvdec.c
libavcodec/qsvdec.c
+3
-3
qsvenc.c
libavcodec/qsvenc.c
+3
-3
No files found.
libavcodec/qsv.c
View file @
4936a48b
...
@@ -537,27 +537,16 @@ static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
...
@@ -537,27 +537,16 @@ static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
return
MFX_ERR_NONE
;
return
MFX_ERR_NONE
;
}
}
int
ff_qsv_init_session_hwcontext
(
AVCodecContext
*
avctx
,
mfxSession
*
psession
,
int
ff_qsv_init_session_device
(
AVCodecContext
*
avctx
,
mfxSession
*
psession
,
QSVFramesContext
*
qsv_frames_ctx
,
AVBufferRef
*
device_ref
,
const
char
*
load_plugins
)
const
char
*
load_plugins
,
int
opaque
)
{
{
static
const
mfxHandleType
handle_types
[]
=
{
static
const
mfxHandleType
handle_types
[]
=
{
MFX_HANDLE_VA_DISPLAY
,
MFX_HANDLE_VA_DISPLAY
,
MFX_HANDLE_D3D9_DEVICE_MANAGER
,
MFX_HANDLE_D3D9_DEVICE_MANAGER
,
MFX_HANDLE_D3D11_DEVICE
,
MFX_HANDLE_D3D11_DEVICE
,
};
};
mfxFrameAllocator
frame_allocator
=
{
AVHWDeviceContext
*
device_ctx
=
(
AVHWDeviceContext
*
)
device_ref
->
data
;
.
pthis
=
qsv_frames_ctx
,
AVQSVDeviceContext
*
device_hwctx
=
device_ctx
->
hwctx
;
.
Alloc
=
qsv_frame_alloc
,
.
Lock
=
qsv_frame_lock
,
.
Unlock
=
qsv_frame_unlock
,
.
GetHDL
=
qsv_frame_get_hdl
,
.
Free
=
qsv_frame_free
,
};
AVHWFramesContext
*
frames_ctx
=
(
AVHWFramesContext
*
)
qsv_frames_ctx
->
hw_frames_ctx
->
data
;
AVQSVFramesContext
*
frames_hwctx
=
frames_ctx
->
hwctx
;
AVQSVDeviceContext
*
device_hwctx
=
frames_ctx
->
device_ctx
->
hwctx
;
mfxSession
parent_session
=
device_hwctx
->
session
;
mfxSession
parent_session
=
device_hwctx
->
session
;
mfxSession
session
;
mfxSession
session
;
...
@@ -607,6 +596,36 @@ int ff_qsv_init_session_hwcontext(AVCodecContext *avctx, mfxSession *psession,
...
@@ -607,6 +596,36 @@ int ff_qsv_init_session_hwcontext(AVCodecContext *avctx, mfxSession *psession,
return
ret
;
return
ret
;
}
}
*
psession
=
session
;
return
0
;
}
int
ff_qsv_init_session_frames
(
AVCodecContext
*
avctx
,
mfxSession
*
psession
,
QSVFramesContext
*
qsv_frames_ctx
,
const
char
*
load_plugins
,
int
opaque
)
{
mfxFrameAllocator
frame_allocator
=
{
.
pthis
=
qsv_frames_ctx
,
.
Alloc
=
qsv_frame_alloc
,
.
Lock
=
qsv_frame_lock
,
.
Unlock
=
qsv_frame_unlock
,
.
GetHDL
=
qsv_frame_get_hdl
,
.
Free
=
qsv_frame_free
,
};
AVHWFramesContext
*
frames_ctx
=
(
AVHWFramesContext
*
)
qsv_frames_ctx
->
hw_frames_ctx
->
data
;
AVQSVFramesContext
*
frames_hwctx
=
frames_ctx
->
hwctx
;
mfxSession
session
;
mfxStatus
err
;
int
ret
;
ret
=
ff_qsv_init_session_device
(
avctx
,
&
session
,
frames_ctx
->
device_ref
,
load_plugins
);
if
(
ret
<
0
)
return
ret
;
if
(
!
opaque
)
{
if
(
!
opaque
)
{
qsv_frames_ctx
->
logctx
=
avctx
;
qsv_frames_ctx
->
logctx
=
avctx
;
...
...
libavcodec/qsv_internal.h
View file @
4936a48b
...
@@ -87,9 +87,12 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc);
...
@@ -87,9 +87,12 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc);
int
ff_qsv_init_internal_session
(
AVCodecContext
*
avctx
,
mfxSession
*
session
,
int
ff_qsv_init_internal_session
(
AVCodecContext
*
avctx
,
mfxSession
*
session
,
const
char
*
load_plugins
);
const
char
*
load_plugins
);
int
ff_qsv_init_session_hwcontext
(
AVCodecContext
*
avctx
,
mfxSession
*
session
,
int
ff_qsv_init_session_device
(
AVCodecContext
*
avctx
,
mfxSession
*
psession
,
QSVFramesContext
*
qsv_frames_ctx
,
AVBufferRef
*
device_ref
,
const
char
*
load_plugins
);
const
char
*
load_plugins
,
int
opaque
);
int
ff_qsv_init_session_frames
(
AVCodecContext
*
avctx
,
mfxSession
*
session
,
QSVFramesContext
*
qsv_frames_ctx
,
const
char
*
load_plugins
,
int
opaque
);
int
ff_qsv_find_surface_idx
(
QSVFramesContext
*
ctx
,
QSVFrame
*
frame
);
int
ff_qsv_find_surface_idx
(
QSVFramesContext
*
ctx
,
QSVFrame
*
frame
);
...
...
libavcodec/qsvdec.c
View file @
4936a48b
...
@@ -59,9 +59,9 @@ static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession ses
...
@@ -59,9 +59,9 @@ static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession ses
if
(
!
q
->
frames_ctx
.
hw_frames_ctx
)
if
(
!
q
->
frames_ctx
.
hw_frames_ctx
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
ret
=
ff_qsv_init_session_
hwcontext
(
avctx
,
&
q
->
internal_session
,
ret
=
ff_qsv_init_session_
frames
(
avctx
,
&
q
->
internal_session
,
&
q
->
frames_ctx
,
q
->
load_plugins
,
&
q
->
frames_ctx
,
q
->
load_plugins
,
q
->
iopattern
==
MFX_IOPATTERN_OUT_OPAQUE_MEMORY
);
q
->
iopattern
==
MFX_IOPATTERN_OUT_OPAQUE_MEMORY
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
av_buffer_unref
(
&
q
->
frames_ctx
.
hw_frames_ctx
);
av_buffer_unref
(
&
q
->
frames_ctx
.
hw_frames_ctx
);
return
ret
;
return
ret
;
...
...
libavcodec/qsvenc.c
View file @
4936a48b
...
@@ -684,9 +684,9 @@ static int qsvenc_init_session(AVCodecContext *avctx, QSVEncContext *q)
...
@@ -684,9 +684,9 @@ static int qsvenc_init_session(AVCodecContext *avctx, QSVEncContext *q)
if
(
!
q
->
frames_ctx
.
hw_frames_ctx
)
if
(
!
q
->
frames_ctx
.
hw_frames_ctx
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
ret
=
ff_qsv_init_session_
hwcontext
(
avctx
,
&
q
->
internal_session
,
ret
=
ff_qsv_init_session_
frames
(
avctx
,
&
q
->
internal_session
,
&
q
->
frames_ctx
,
q
->
load_plugins
,
&
q
->
frames_ctx
,
q
->
load_plugins
,
q
->
param
.
IOPattern
==
MFX_IOPATTERN_IN_OPAQUE_MEMORY
);
q
->
param
.
IOPattern
==
MFX_IOPATTERN_IN_OPAQUE_MEMORY
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
av_buffer_unref
(
&
q
->
frames_ctx
.
hw_frames_ctx
);
av_buffer_unref
(
&
q
->
frames_ctx
.
hw_frames_ctx
);
return
ret
;
return
ret
;
...
...
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