v4l.c File Reference
#include "avdevice.h"
#include "config.h"
#include "libavutil/rational.h"
#include "libavutil/imgutils.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavformat/avformat.h"
#include "libavformat/internal.h"
#include "libavcodec/dsputil.h"
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <linux/videodev.h>
#include <time.h>

Go to the source code of this file.

Data Structures

struct  VideoData
 

Macros

#define _LINUX_TIME_H   1
 

Functions

static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap)
 
static int v4l_mm_read_picture (VideoData *s, uint8_t *buf)
 
static int grab_read_packet (AVFormatContext *s1, AVPacket *pkt)
 
static int grab_read_close (AVFormatContext *s1)
 

Variables

struct {
   int   palette
 
   int   depth
 
   enum PixelFormat   pix_fmt
 
video_formats []
 
static const AVOption options []
 
static const AVClass v4l_class
 
AVInputFormat ff_v4l_demuxer
 

Macro Definition Documentation

#define _LINUX_TIME_H   1

Definition at line 40 of file v4l.c.

Function Documentation

static int grab_read_close ( AVFormatContext s1)
static

Definition at line 325 of file v4l.c.

static int grab_read_header ( AVFormatContext s1,
AVFormatParameters ap 
)
static

Definition at line 78 of file v4l.c.

static int grab_read_packet ( AVFormatContext s1,
AVPacket pkt 
)
static

Definition at line 285 of file v4l.c.

static int v4l_mm_read_picture ( VideoData s,
uint8_t *  buf 
)
static

Definition at line 259 of file v4l.c.

Referenced by grab_read_packet().

Variable Documentation

AVInputFormat ff_v4l_demuxer
Initial value:
= {
.name = "video4linux",
.long_name = NULL_IF_CONFIG_SMALL("Video4Linux device grab"),
.priv_data_size = sizeof(VideoData),
.priv_class = &v4l_class,
}
static int read_header(FFV1Context *f)
Definition: ffv1.c:1513
static int flags
Definition: log.c:34
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:140
static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
Definition: v4l.c:285
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:191
Definition: bktr.c:52
static const AVClass v4l_class
Definition: v4l.c:349
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
Definition: libcdio.c:109
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:368
static int grab_read_close(AVFormatContext *s1)
Definition: v4l.c:325
static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
Definition: v4l.c:78

Definition at line 356 of file v4l.c.

const AVOption options[]
static
Initial value:
= {
{ "standard", "", 0x42, AV_OPT_TYPE_INT, {.dbl = VIDEO_MODE_NTSC}, VIDEO_MODE_PAL, VIDEO_MODE_NTSC, AV_OPT_FLAG_DECODING_PARAM, "standard" },
{ "PAL", "", 0, AV_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
{ "SECAM", "", 0, AV_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_SECAM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
{ "NTSC", "", 0, AV_OPT_TYPE_CONST, {.dbl = VIDEO_MODE_NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
{ NULL },
}
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:275
NULL
Definition: eval.c:50

Definition at line 341 of file v4l.c.

const AVClass v4l_class
static
Initial value:
= {
.class_name = "V4L indev",
.item_name = av_default_item_name,
.option = options,
}
LIBAVUTIL_VERSION_INT
Definition: eval.c:50
av_default_item_name
Definition: dnxhdenc.c:43
static const AVOption options[]
Definition: v4l.c:341

Definition at line 349 of file v4l.c.

const { ... } video_formats[]
Initial value:
= {
{.palette = VIDEO_PALETTE_YUV420P, .depth = 12, .pix_fmt = PIX_FMT_YUV420P },
{.palette = VIDEO_PALETTE_YUV422, .depth = 16, .pix_fmt = PIX_FMT_YUYV422 },
{.palette = VIDEO_PALETTE_UYVY, .depth = 16, .pix_fmt = PIX_FMT_UYVY422 },
{.palette = VIDEO_PALETTE_YUYV, .depth = 16, .pix_fmt = PIX_FMT_YUYV422 },
{.palette = VIDEO_PALETTE_RGB24, .depth = 24, .pix_fmt = PIX_FMT_BGR24 },
{.palette = VIDEO_PALETTE_RGB565, .depth = 16, .pix_fmt = PIX_FMT_BGR565 },
{.palette = VIDEO_PALETTE_GREY, .depth = 8, .pix_fmt = PIX_FMT_GRAY8 },
}
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:64
#define PIX_FMT_BGR565
Definition: pixfmt.h:180
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:65
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:67
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:81
Y , 8bpp.
Definition: pixfmt.h:72

Referenced by grab_read_header().