34 int res = 0,
flags = O_RDWR;
35 struct v4l2_format fmt = {
36 .type = V4L2_BUF_TYPE_VIDEO_OUTPUT
55 "V4L2 output device supports only a single raw video stream\n");
73 if (ioctl(
s->fd, VIDIOC_G_FMT, &fmt) < 0) {
80 fmt.fmt.pix.height = par->
height;
81 fmt.fmt.pix.pixelformat = v4l2_pixfmt;
84 if (ioctl(
s->fd, VIDIOC_S_FMT, &fmt) < 0) {
96 if (write(
s->fd,
pkt->data,
pkt->size) == -1)
109 .class_name =
"V4L2 outdev",
116 .p.name =
"video4linux2,v4l2",
const FFOutputFormat ff_v4l2_muxer
static av_cold void close(AVCodecParserContext *s)
#define flags(name, subs,...)
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
static void write_header(FFV1Context *f)
#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.
This struct describes the properties of an encoded stream.
int height
The height of the video frame in pixels.
int width
The width of the video frame in pixels.
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int flags
Flags modifying the (de)muxer behaviour.
char * url
input or output URL.
void * priv_data
Format private data.
AVStream ** streams
A list of all streams in the file.
This structure stores compressed data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
uint32_t ff_fmt_ff2v4l(enum AVPixelFormat pix_fmt, enum AVCodecID codec_id)
static const AVClass v4l2_class
static av_cold int write_header(AVFormatContext *s1)
static int write_trailer(AVFormatContext *s1)
static int write_packet(AVFormatContext *s1, AVPacket *pkt)