Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
c16fe143
Commit
c16fe143
authored
Jan 16, 2017
by
wm4
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hwcontext_cuda: implement frames_get_constraints
Copied and modified from hwcontext_qsv.c.
parent
2b202900
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
hwcontext_cuda.c
libavutil/hwcontext_cuda.c
+26
-0
No files found.
libavutil/hwcontext_cuda.c
View file @
c16fe143
...
@@ -39,6 +39,31 @@ static const enum AVPixelFormat supported_formats[] = {
...
@@ -39,6 +39,31 @@ static const enum AVPixelFormat supported_formats[] = {
AV_PIX_FMT_P016
,
AV_PIX_FMT_P016
,
};
};
static
int
cuda_frames_get_constraints
(
AVHWDeviceContext
*
ctx
,
const
void
*
hwconfig
,
AVHWFramesConstraints
*
constraints
)
{
int
i
;
constraints
->
valid_sw_formats
=
av_malloc_array
(
FF_ARRAY_ELEMS
(
supported_formats
)
+
1
,
sizeof
(
*
constraints
->
valid_sw_formats
));
if
(
!
constraints
->
valid_sw_formats
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
supported_formats
);
i
++
)
constraints
->
valid_sw_formats
[
i
]
=
supported_formats
[
i
];
constraints
->
valid_sw_formats
[
FF_ARRAY_ELEMS
(
supported_formats
)]
=
AV_PIX_FMT_NONE
;
constraints
->
valid_hw_formats
=
av_malloc_array
(
2
,
sizeof
(
*
constraints
->
valid_hw_formats
));
if
(
!
constraints
->
valid_hw_formats
)
return
AVERROR
(
ENOMEM
);
constraints
->
valid_hw_formats
[
0
]
=
AV_PIX_FMT_CUDA
;
constraints
->
valid_hw_formats
[
1
]
=
AV_PIX_FMT_NONE
;
return
0
;
}
static
void
cuda_buffer_free
(
void
*
opaque
,
uint8_t
*
data
)
static
void
cuda_buffer_free
(
void
*
opaque
,
uint8_t
*
data
)
{
{
AVHWFramesContext
*
ctx
=
opaque
;
AVHWFramesContext
*
ctx
=
opaque
;
...
@@ -376,6 +401,7 @@ const HWContextType ff_hwcontext_type_cuda = {
...
@@ -376,6 +401,7 @@ const HWContextType ff_hwcontext_type_cuda = {
.
device_create
=
cuda_device_create
,
.
device_create
=
cuda_device_create
,
.
device_init
=
cuda_device_init
,
.
device_init
=
cuda_device_init
,
.
device_uninit
=
cuda_device_uninit
,
.
device_uninit
=
cuda_device_uninit
,
.
frames_get_constraints
=
cuda_frames_get_constraints
,
.
frames_init
=
cuda_frames_init
,
.
frames_init
=
cuda_frames_init
,
.
frames_get_buffer
=
cuda_get_buffer
,
.
frames_get_buffer
=
cuda_get_buffer
,
.
transfer_get_formats
=
cuda_transfer_get_formats
,
.
transfer_get_formats
=
cuda_transfer_get_formats
,
...
...
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