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
e2542124
Commit
e2542124
authored
Apr 13, 2020
by
Mark Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: Make filter hardware device selection clearer
Also move it into a dedicated function in the hardware file.
parent
344e6c3f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
11 deletions
+32
-11
ffmpeg.h
fftools/ffmpeg.h
+1
-0
ffmpeg_filter.c
fftools/ffmpeg_filter.c
+3
-11
ffmpeg_hw.c
fftools/ffmpeg_hw.c
+28
-0
No files found.
fftools/ffmpeg.h
View file @
e2542124
...
...
@@ -661,6 +661,7 @@ void hw_device_free_all(void);
int
hw_device_setup_for_decode
(
InputStream
*
ist
);
int
hw_device_setup_for_encode
(
OutputStream
*
ost
);
int
hw_device_setup_for_filter
(
FilterGraph
*
fg
);
int
hwaccel_decode_init
(
AVCodecContext
*
avctx
);
...
...
fftools/ffmpeg_filter.c
View file @
e2542124
...
...
@@ -1061,17 +1061,9 @@ int configure_filtergraph(FilterGraph *fg)
if
((
ret
=
avfilter_graph_parse2
(
fg
->
graph
,
graph_desc
,
&
inputs
,
&
outputs
))
<
0
)
goto
fail
;
if
(
filter_hw_device
||
hw_device_ctx
)
{
AVBufferRef
*
device
=
filter_hw_device
?
filter_hw_device
->
device_ref
:
hw_device_ctx
;
for
(
i
=
0
;
i
<
fg
->
graph
->
nb_filters
;
i
++
)
{
fg
->
graph
->
filters
[
i
]
->
hw_device_ctx
=
av_buffer_ref
(
device
);
if
(
!
fg
->
graph
->
filters
[
i
]
->
hw_device_ctx
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
}
}
ret
=
hw_device_setup_for_filter
(
fg
);
if
(
ret
<
0
)
goto
fail
;
if
(
simple
&&
(
!
inputs
||
inputs
->
next
||
!
outputs
||
outputs
->
next
))
{
const
char
*
num_inputs
;
...
...
fftools/ffmpeg_hw.c
View file @
e2542124
...
...
@@ -480,3 +480,31 @@ int hwaccel_decode_init(AVCodecContext *avctx)
return
0
;
}
int
hw_device_setup_for_filter
(
FilterGraph
*
fg
)
{
HWDevice
*
dev
;
int
i
;
// If the user has supplied exactly one hardware device then just
// give it straight to every filter for convenience. If more than
// one device is available then the user needs to pick one explcitly
// with the filter_hw_device option.
if
(
filter_hw_device
)
dev
=
filter_hw_device
;
else
if
(
nb_hw_devices
==
1
)
dev
=
hw_devices
[
0
];
else
dev
=
NULL
;
if
(
dev
)
{
for
(
i
=
0
;
i
<
fg
->
graph
->
nb_filters
;
i
++
)
{
fg
->
graph
->
filters
[
i
]
->
hw_device_ctx
=
av_buffer_ref
(
dev
->
device_ref
);
if
(
!
fg
->
graph
->
filters
[
i
]
->
hw_device_ctx
)
return
AVERROR
(
ENOMEM
);
}
}
return
0
;
}
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