aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_hw.c
Commit message (Collapse)AuthorAgeFilesLines
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-3/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: move hwaccel_retrieve_data() from ffmpeg_hw to ffmpeg_decAnton Khirnov2024-01-301-42/+0
| | | | | This function is decoding-only and has no interaction with the rest of ffmpeg_hw. It thus belongs more properly in ffmpeg_dec.
* fftools/ffmpeg_hw: inline hwaccel_decode_init() into its callerAnton Khirnov2023-06-191-10/+1
| | | | | The function is now trivial and cannot fail, so all error handling in its caller can be removed.
* fftools/ffmpeg_hw: move hw_device_setup_for_encode() to ffmpeg_encAnton Khirnov2023-05-281-55/+0
| | | | | | This function is entangled with encoder setup, so it is more encoding code rather than ffmpeg_hw code. This will allow making more encoder state private in the future.
* fftools/ffmpeg_hw: move hw_device_setup_for_decode() to ffmpeg_decAnton Khirnov2023-05-281-149/+4
| | | | | | This function is entangled with decoder setup, so it is more decoding code rather than ffmpeg_hw code. This will allow making more decoder state private in the future.
* fftools/ffmpeg: supply hw_device_ctx to filters before initializing themAnton Khirnov2023-03-241-16/+5
| | | | | | | | | | This is more correct, but was not possible before the recently-added filtergraph parsing API. Also, only pass hw devices to filters that are flagged as capable of using them. Tested-by: Niklas Haas
* fftools/ffmpeg: drop OutputStream.encAnton Khirnov2022-08-291-3/+3
| | | | | | It is either equal to OutputStream.enc_ctx->codec, or NULL when enc_ctx is NULL. Replace the use of enc with enc_ctx->codec, or the equivalent enc_ctx->codec_* fields where more convenient.
* fftools/ffmpeg_hw: stop logging to the decoder contextAnton Khirnov2022-08-081-6/+6
| | | | | Only the decoder itself should do that. Use NULL as is done by all other logging code in ffmpeg.
* ffmpeg_hw: make hardware selection for filters more user friendlyHaihao Xiang2021-09-121-7/+13
| | | | | | | | | | | | | | | | When a device is derived from a source device, there are at least 2 devices, and usually the derived device is the expected device, so let's pick the last device if user doesn't specify the filter device with filter_hw_device option After applying this patch, the command below can work: $> ffmpeg -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device qsv=hw@va -f lavfi -i yuvtestsrc -vf format=nv12,hwupload=extra_hw_frames=64 -c:v h264_qsv -y out.h264 Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg_hw: Don't ignore key parameters when initializing a hw deviceHaihao Xiang2021-08-171-1/+15
| | | | | | | | | | Currently user may use '-init_hw_device type=name' to initialize a hw device, however the key parameter is ignored when use '-init_hw_device type=name,key=value'. After applying this patch, user may set key parameter if needed. Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* qsvdec: add support for HW_DEVICE_CTX methodHaihao Xiang2021-08-111-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows user set hw_device_ctx instead of hw_frames_ctx for QSV decoders, hence we may remove the ad-hoc libmfx setup code from FFmpeg. "-hwaccel_output_format format" is applied to QSV decoders after removing the ad-hoc libmfx code. In order to keep compatibility with old commandlines, the default format is set to AV_PIX_FMT_QSV, but this behavior will be removed in the future. Please set "-hwaccel_output_format qsv" explicitly if AV_PIX_FMT_QSV is expected. The normal device stuff works for QSV decoders now, user may use "-init_hw_device args" to initialise device and "-hwaccel_device devicename" to select a device for QSV decoders. "-qsv_device device" which was added for workarounding device selection in the ad-hoc libmfx code still works For example: $> ffmpeg -init_hw_device qsv=qsv:hw_any,child_device=/dev/dri/card0 -hwaccel qsv -c:v h264_qsv -i input.h264 -f null - /dev/dri/renderD128 is actually open for h264_qsv decoder in the above command without this patch. After applying this patch, /dev/dri/card0 is used. $> ffmpeg -init_hw_device vaapi=va:/dev/dri/card0 -init_hw_device qsv=hw@va -hwaccel_device hw -hwaccel qsv -c:v h264_qsv -i input.h264 -f null - device hw of type qsv is not usable in the above command without this patch. After applying this patch, this command works as expected. Reviewed-by: Soft Works <softworkz@hotmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: Don't require a known device to pass a frames context to an encoderMark Thompson2020-05-031-33/+42
| | | | | | | | | | | | | | The previous code here did not handle passing a frames context when ffmpeg itself did not know about the device it came from (for example, because it was created by device derivation inside a filter graph), which would break encoders requiring that input. Fix that by checking for HW frames and device context methods independently, and prefer to use a frames context method if possible. At the same time, revert the encoding additions to the device matching function because the additional complexity was not relevant to decoding. Also fixes #8637, which is the same case but with the device creation hidden in the ad-hoc libmfx setup code.
* ffmpeg: Use hardware config metadata with encodersMark Thompson2020-04-261-8/+40
| | | | | | | This can support encoders which want frames and/or device contexts. For the device case, it currently picks the first initialised device of the desired type to give to the encoder - a new option would be needed if it were necessary to choose between multiple devices of the same type.
* ffmpeg: Make filter hardware device selection clearerMark Thompson2020-04-261-0/+28
| | | | Also move it into a dedicated function in the hardware file.
* ffmpeg_hw: Treat empty device string as no device settingMark Thompson2019-06-021-5/+8
| | | | | | | The implementation will use some default in this case. The empty string is not a meaningful device for any existing hardware type, and indeed OpenCL treats it identically to no device already to work around the lack of this setting on the command line.
* ffmpeg_hw: Mark some strings as constMark Thompson2019-06-021-1/+1
|
* ffmpeg: Use codec hardware config to configure hwaccelsMark Thompson2017-11-261-75/+169
| | | | | Removes specific support for all hwaccels supported by the generic code (DXVA2, D3D11VA, NVDEC, VAAPI and VDPAU).
* Merge commit 'c95169f0ec68bdeeabc5fde8aa4076f406242524'James Almer2017-10-011-0/+385
* commit 'c95169f0ec68bdeeabc5fde8aa4076f406242524': build: Move cli tool sources to a separate subdirectory Merged-by: James Almer <jamrial@gmail.com>