[FFmpeg-devel] [PATCH 25/25] hwcontext_drm: do not require drm device
Mark Thompson
sw at jkqxz.net
Fri Sep 13 03:05:29 EEST 2019
On 03/09/2019 02:02, Aman Gupta wrote:
> From: Jonas Karlman <jonas at kwiboo.se>
>
> This allows the cli to create a dummy drm hwcontext
> that can be shared between the v4l2 decoder/scaler/encoder.
>
> This is especially useful on older RPI3 where /dev/dri devices
> are not available in the default configuration.
>
> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
> Signed-off-by: Aman Gupta <aman at tmm1.net>
> ---
> libavutil/hwcontext_drm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/libavutil/hwcontext_drm.c b/libavutil/hwcontext_drm.c
> index 32cbde82eb..aa4794c5e6 100644
> --- a/libavutil/hwcontext_drm.c
> +++ b/libavutil/hwcontext_drm.c
> @@ -43,6 +43,11 @@ static int drm_device_create(AVHWDeviceContext *hwdev, const char *device,
> AVDRMDeviceContext *hwctx = hwdev->hwctx;
> drmVersionPtr version;
>
> + if (device == NULL) {
> + hwctx->fd = -1;
> + return 0;
> + }
> +
> hwctx->fd = open(device, O_RDWR);
> if (hwctx->fd < 0)
> return AVERROR(errno);
>
This smells like a hack for making something work in the ffmpeg command-line utility. Can you explain the use-case? If necessary, modifying the behaviour of ffmpeg would probably be better than putting this sort of thing into the library.
- Mark
More information about the ffmpeg-devel
mailing list