Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
d64fe199
Commit
d64fe199
authored
Jun 02, 2015
by
Steve Lhomme
Committed by
Jean-Baptiste Kempf
Jun 05, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dxva2: store the internal hardware buffer in a picture_t
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
ad0b948a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
+40
-2
modules/codec/avcodec/directx_va.c
modules/codec/avcodec/directx_va.c
+9
-2
modules/codec/avcodec/directx_va.h
modules/codec/avcodec/directx_va.h
+7
-0
modules/codec/avcodec/dxva2.c
modules/codec/avcodec/dxva2.c
+24
-0
No files found.
modules/codec/avcodec/directx_va.c
View file @
d64fe199
...
@@ -324,15 +324,18 @@ int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, AVCodecContext *avctx,
...
@@ -324,15 +324,18 @@ int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, AVCodecContext *avctx,
dx_sys
->
surface_width
,
dx_sys
->
surface_height
,
dx_sys
->
surface_width
,
dx_sys
->
surface_height
,
avctx
->
coded_width
,
avctx
->
coded_height
);
avctx
->
coded_width
,
avctx
->
coded_height
);
dx_sys
->
pf_setup_avcodec_ctx
(
va
);
for
(
int
i
=
0
;
i
<
dx_sys
->
surface_count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
dx_sys
->
surface_count
;
i
++
)
{
vlc_va_surface_t
*
surface
=
&
dx_sys
->
surface
[
i
];
vlc_va_surface_t
*
surface
=
&
dx_sys
->
surface
[
i
];
surface
->
refcount
=
0
;
surface
->
refcount
=
0
;
surface
->
order
=
0
;
surface
->
order
=
0
;
surface
->
p_lock
=
&
dx_sys
->
surface_lock
;
surface
->
p_lock
=
&
dx_sys
->
surface_lock
;
surface
->
p_pic
=
dx_sys
->
pf_alloc_surface_pic
(
va
,
&
fmt
,
i
);
if
(
unlikely
(
surface
->
p_pic
==
NULL
))
return
VLC_EGENERIC
;
}
}
dx_sys
->
pf_setup_avcodec_ctx
(
va
);
ok:
ok:
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -344,6 +347,10 @@ void DestroyVideoDecoder(vlc_va_t *va, directx_sys_t *dx_sys)
...
@@ -344,6 +347,10 @@ void DestroyVideoDecoder(vlc_va_t *va, directx_sys_t *dx_sys)
for
(
int
i
=
0
;
i
<
dx_sys
->
surface_count
;
i
++
)
for
(
int
i
=
0
;
i
<
dx_sys
->
surface_count
;
i
++
)
IUnknown_Release
(
dx_sys
->
hw_surface
[
i
]
);
IUnknown_Release
(
dx_sys
->
hw_surface
[
i
]
);
for
(
int
i
=
0
;
i
<
dx_sys
->
surface_count
;
i
++
)
if
(
dx_sys
->
surface
[
i
].
p_pic
)
picture_Release
(
dx_sys
->
surface
[
i
].
p_pic
);
if
(
dx_sys
->
decoder
)
if
(
dx_sys
->
decoder
)
IUnknown_Release
(
dx_sys
->
decoder
);
IUnknown_Release
(
dx_sys
->
decoder
);
...
...
modules/codec/avcodec/directx_va.h
View file @
d64fe199
...
@@ -46,6 +46,7 @@ typedef struct {
...
@@ -46,6 +46,7 @@ typedef struct {
int
refcount
;
int
refcount
;
unsigned
int
order
;
unsigned
int
order
;
vlc_mutex_t
*
p_lock
;
vlc_mutex_t
*
p_lock
;
picture_t
*
p_pic
;
}
vlc_va_surface_t
;
}
vlc_va_surface_t
;
typedef
struct
input_list_t
{
typedef
struct
input_list_t
{
...
@@ -124,6 +125,12 @@ typedef struct
...
@@ -124,6 +125,12 @@ typedef struct
* Set the avcodec hw context after the decoder is created
* Set the avcodec hw context after the decoder is created
*/
*/
void
(
*
pf_setup_avcodec_ctx
)(
vlc_va_t
*
);
void
(
*
pf_setup_avcodec_ctx
)(
vlc_va_t
*
);
/**
* @brief pf_alloc_surface_pic
* @param fmt
* @return
*/
picture_t
*
(
*
pf_alloc_surface_pic
)(
vlc_va_t
*
,
const
video_format_t
*
,
unsigned
);
}
directx_sys_t
;
}
directx_sys_t
;
...
...
modules/codec/avcodec/dxva2.c
View file @
d64fe199
...
@@ -133,6 +133,9 @@ struct picture_sys_t
...
@@ -133,6 +133,9 @@ struct picture_sys_t
LPDIRECT3DSURFACE9
surface
;
LPDIRECT3DSURFACE9
surface
;
};
};
static
picture_t
*
DxAllocPicture
(
vlc_va_t
*
,
const
video_format_t
*
,
unsigned
index
);
/* */
/* */
static
int
D3dCreateDevice
(
vlc_va_t
*
);
static
int
D3dCreateDevice
(
vlc_va_t
*
);
static
void
D3dDestroyDevice
(
vlc_va_t
*
);
static
void
D3dDestroyDevice
(
vlc_va_t
*
);
...
@@ -281,6 +284,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
...
@@ -281,6 +284,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
dx_sys
->
pf_setup_avcodec_ctx
=
SetupAVCodecContext
;
dx_sys
->
pf_setup_avcodec_ctx
=
SetupAVCodecContext
;
dx_sys
->
pf_get_input_list
=
DxGetInputList
;
dx_sys
->
pf_get_input_list
=
DxGetInputList
;
dx_sys
->
pf_setup_output
=
DxSetupOutput
;
dx_sys
->
pf_setup_output
=
DxSetupOutput
;
dx_sys
->
pf_alloc_surface_pic
=
DxAllocPicture
;
dx_sys
->
psz_decoder_dll
=
TEXT
(
"DXVA2.DLL"
);
dx_sys
->
psz_decoder_dll
=
TEXT
(
"DXVA2.DLL"
);
va
->
sys
=
sys
;
va
->
sys
=
sys
;
...
@@ -713,3 +717,23 @@ static int DxResetVideoDecoder(vlc_va_t *va)
...
@@ -713,3 +717,23 @@ static int DxResetVideoDecoder(vlc_va_t *va)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
static
picture_t
*
DxAllocPicture
(
vlc_va_t
*
va
,
const
video_format_t
*
fmt
,
unsigned
index
)
{
video_format_t
src_fmt
=
*
fmt
;
src_fmt
.
i_chroma
=
VLC_CODEC_D3D9_OPAQUE
;
picture_sys_t
*
pic_sys
=
calloc
(
1
,
sizeof
(
*
pic_sys
));
if
(
unlikely
(
pic_sys
==
NULL
))
return
NULL
;
pic_sys
->
surface
=
(
LPDIRECT3DSURFACE9
)
va
->
sys
->
dx_sys
.
hw_surface
[
index
];
picture_resource_t
res
=
{
.
p_sys
=
pic_sys
,
};
picture_t
*
pic
=
picture_NewFromResource
(
&
src_fmt
,
&
res
);
if
(
unlikely
(
pic
==
NULL
))
{
free
(
pic_sys
);
return
NULL
;
}
return
pic
;
}
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