#include "config.h"#include "libavformat/avformat.h"#include "libavformat/internal.h"#include <unistd.h>#include <fcntl.h>#include <sys/ioctl.h>#include <sys/mman.h>#include <sys/time.h>#include <poll.h>#include <linux/videodev2.h>#include <time.h>#include "libavutil/imgutils.h"#include "libavutil/log.h"#include "libavutil/opt.h"#include "libavutil/parseutils.h"#include "libavutil/pixdesc.h"#include "libavutil/avstring.h"#include "libavutil/mathematics.h"Go to the source code of this file.
| #define OFFSET | ( | x | ) | offsetof(struct video_data, x) |
| #define V4L_COMPFORMATS 2 |
Definition at line 58 of file v4l2.c.
Referenced by list_formats().
| #define V4L_RAWFORMATS 1 |
Definition at line 57 of file v4l2.c.
Referenced by list_formats().
| static int device_init | ( | AVFormatContext * | ctx, | |
| int * | width, | |||
| int * | height, | |||
| uint32_t | pix_fmt | |||
| ) | [static] |
Definition at line 167 of file v4l2.c.
Referenced by device_try_init().
| static int device_open | ( | AVFormatContext * | ctx | ) | [static] |
Definition at line 112 of file v4l2.c.
Referenced by v4l2_read_header().
| static uint32_t device_try_init | ( | AVFormatContext * | s1, | |
| enum PixelFormat | pix_fmt, | |||
| int * | width, | |||
| int * | height, | |||
| enum CodecID * | codec_id | |||
| ) | [static] |
Definition at line 648 of file v4l2.c.
Referenced by v4l2_read_header().
| static int first_field | ( | int | fd | ) | [static] |
Definition at line 208 of file v4l2.c.
Referenced by dnxhd_decode_frame(), dnxhd_encode_picture(), and v4l2_read_header().
| static uint32_t fmt_ff2v4l | ( | enum PixelFormat | pix_fmt, | |
| enum CodecID | codec_id | |||
| ) | [static] |
Definition at line 224 of file v4l2.c.
Referenced by device_try_init().
| static enum CodecID fmt_v4l2codec | ( | uint32_t | v4l2_fmt | ) | [static] |
Definition at line 254 of file v4l2.c.
Referenced by device_try_init(), and list_formats().
| static enum PixelFormat fmt_v4l2ff | ( | uint32_t | v4l2_fmt, | |
| enum CodecID | codec_id | |||
| ) | [static] |
Definition at line 240 of file v4l2.c.
Referenced by list_formats(), and v4l2_read_header().
| static void list_formats | ( | AVFormatContext * | ctx, | |
| int | fd, | |||
| int | type | |||
| ) | [static] |
Definition at line 293 of file v4l2.c.
Referenced by v4l2_read_header().
| static void mmap_close | ( | struct video_data * | s | ) | [static] |
Definition at line 529 of file v4l2.c.
Referenced by v4l2_read_close().
| static int mmap_init | ( | AVFormatContext * | ctx | ) | [static] |
Definition at line 332 of file v4l2.c.
Referenced by v4l2_read_header().
| static int mmap_read_frame | ( | AVFormatContext * | ctx, | |
| AVPacket * | pkt | |||
| ) | [static] |
Definition at line 433 of file v4l2.c.
Referenced by v4l2_read_packet().
| static int mmap_start | ( | AVFormatContext * | ctx | ) | [static] |
Definition at line 495 of file v4l2.c.
Referenced by v4l2_read_header().
| static int v4l2_read_close | ( | AVFormatContext * | s1 | ) | [static] |
| static int v4l2_read_header | ( | AVFormatContext * | s1, | |
| AVFormatParameters * | ap | |||
| ) | [static] |
| static int v4l2_read_packet | ( | AVFormatContext * | s1, | |
| AVPacket * | pkt | |||
| ) | [static] |
| static int v4l2_set_parameters | ( | AVFormatContext * | s1, | |
| AVFormatParameters * | ap | |||
| ) | [static] |
Definition at line 546 of file v4l2.c.
Referenced by v4l2_read_header().
const int desired_video_buffers = 256 [static] |
Definition at line 54 of file v4l2.c.
Referenced by mmap_init().
{
.name = "video4linux2",
.long_name = NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
.priv_data_size = sizeof(struct video_data),
.read_header = v4l2_read_header,
.read_packet = v4l2_read_packet,
.read_close = v4l2_read_close,
.flags = AVFMT_NOFILE,
.priv_class = &v4l2_class,
}
struct fmt_map fmt_conversion_table[] [static] |
{
{ PIX_FMT_YUV420P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV420 },
{ PIX_FMT_YUV422P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV422P },
{ PIX_FMT_YUYV422, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUYV },
{ PIX_FMT_UYVY422, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_UYVY },
{ PIX_FMT_YUV411P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV411P },
{ PIX_FMT_YUV410P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV410 },
{ PIX_FMT_RGB555, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555 },
{ PIX_FMT_RGB565, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565 },
{ PIX_FMT_BGR24, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR24 },
{ PIX_FMT_RGB24, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB24 },
{ PIX_FMT_BGRA, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR32 },
{ PIX_FMT_GRAY8, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_GREY },
{ PIX_FMT_NV12, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_NV12 },
{ PIX_FMT_NONE, CODEC_ID_MJPEG, V4L2_PIX_FMT_MJPEG },
{ PIX_FMT_NONE, CODEC_ID_MJPEG, V4L2_PIX_FMT_JPEG },
}
{
{ "standard", "TV standard, used only by analog frame grabber", OFFSET(standard), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC },
{ "channel", "TV channel, used only by frame grabber", OFFSET(channel), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, DEC },
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "pixel_format", "Preferred pixel format", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "input_format", "Preferred pixel format (for raw video) or codec name", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "list_formats", "List available formats and exit", OFFSET(list_format), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, DEC, "list_formats" },
{ "all", "Show all available formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.dbl = V4L_ALLFORMATS }, 0, INT_MAX, DEC, "list_formats" },
{ "raw", "Show only non-compressed formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.dbl = V4L_RAWFORMATS }, 0, INT_MAX, DEC, "list_formats" },
{ "compressed", "Show only compressed formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.dbl = V4L_COMPFORMATS }, 0, INT_MAX, DEC, "list_formats" },
{ NULL },
}
const AVClass v4l2_class [static] |
{
.class_name = "V4L2 indev",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
}