android_external_ffmpeg/libavutil/hwcontext_v4l2request_internal.h
Jonas Karlman bb10d3d5a1 avutil/hwcontext: Add hwdevice type for V4L2 Request API
Add a hwdevice type for use with V4L2 Request API stateless decoding.

AVV4L2RequestFramesContext is expected to be filled with a V4L2 coded
pixel format and optional codec-specific extended controls before an
AVHWFramesContext is initialized.

Once initialized AVV4L2RequestFramesContextInternal describe the opened
V4L2 stateless decoder session, with details about media/video file
descriptors, formats of CAPTURE/OUTPUT queues and buffer pools for
creating CAPTURE/OUTPUT buffers.

AVHWFramesContext.pool defaults to create frame descriptors around a
CAPTURE buffer, and frames are returned with AVFrame.data[0] pointing
to a AVDRMFrameDescriptor and AVFrame.data[1] the CAPTURE buffer index.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2025-12-20 23:45:35 +00:00

67 lines
1.8 KiB
C

/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_HWCONTEXT_V4L2REQUEST_INTERNAL_H
#define AVUTIL_HWCONTEXT_V4L2REQUEST_INTERNAL_H
#include "buffer.h"
#include "hwcontext_v4l2request.h"
/**
* @file
* FFmpeg internal API-specific header for AV_HWDEVICE_TYPE_V4L2REQUEST.
*/
/**
* Internal context for the initialized V4L2 stateless decoder/encoder session.
*/
struct AVV4L2RequestFramesContextInternal {
/**
* Media device file descriptor of the initialized session.
*/
int media_fd;
/**
* Video device file descriptor of the initialized session.
*/
int video_fd;
/**
* Details of the initialized CAPTURE and OUTPUT queues.
*/
struct {
/**
* V4L2 buffer format.
*/
struct v4l2_format format;
/**
* V4L2 buffer capabilities flags.
*/
uint32_t capabilities;
/**
* Buffer pool of allocated V4L2 buffers.
*
* AVBufferRef.data points to a struct v4l2_buffer for the created buffer.
*/
AVBufferPool *pool;
} capture, output;
};
#endif /* AVUTIL_HWCONTEXT_V4L2REQUEST_INTERNAL_H */