31 int res = 0,
flags = O_RDWR;
32 struct v4l2_format fmt = {
33 .type = V4L2_BUF_TYPE_VIDEO_OUTPUT
49 if (
s1->nb_streams != 1 ||
52 "V4L2 output device supports only a single raw video stream\n");
56 par =
s1->streams[0]->codecpar;
70 if (ioctl(
s->fd, VIDIOC_G_FMT, &fmt) < 0) {
76 fmt.fmt.pix.width = par->
width;
77 fmt.fmt.pix.height = par->
height;
78 fmt.fmt.pix.pixelformat = v4l2_pixfmt;
81 if (ioctl(
s->fd, VIDIOC_S_FMT, &fmt) < 0) {
113 .
name =
"video4linux2,v4l2",
Main libavdevice API header.
#define flags(name, subs,...)
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align)
Return the size in bytes of the amount of data required to store an image with the given parameters.
#define LIBAVUTIL_VERSION_INT
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
This struct describes the properties of an encoded stream.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
uint32_t ff_fmt_ff2v4l(enum AVPixelFormat pix_fmt, enum AVCodecID codec_id)
static av_cold int write_header(AVFormatContext *s1)
static int write_trailer(AVFormatContext *s1)
static const AVClass v4l2_class
AVOutputFormat ff_v4l2_muxer
static int write_packet(AVFormatContext *s1, AVPacket *pkt)