]> git.sesse.net Git - vlc/blob - modules/access/v4l2/v4l2.h
OMX: rename GetVlcAudioFormat to OmxToVlcAudioFormat
[vlc] / modules / access / v4l2 / v4l2.h
1 /*****************************************************************************
2  * v4l2.h : Video4Linux2 input module for vlc
3  *****************************************************************************
4  * Copyright (C) 2002-2011 the VideoLAN team
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  *****************************************************************************/
20
21 #include <vlc_common.h>
22
23 #if defined(HAVE_LINUX_VIDEODEV2_H)
24 #   include <linux/videodev2.h>
25 #elif defined(HAVE_SYS_VIDEOIO_H)
26 #   include <sys/videoio.h>
27 #else
28 #   error "No Video4Linux2 headers found."
29 #endif
30
31 #ifdef HAVE_LIBV4L2
32 #   include <libv4l2.h>
33 #else
34 #   define v4l2_close close
35 #   define v4l2_dup dup
36 #   define v4l2_ioctl ioctl
37 #   define v4l2_read read
38 #   define v4l2_mmap mmap
39 #   define v4l2_munmap munmap
40 #endif
41
42 #define CFG_PREFIX "v4l2-"
43
44 int ControlList(vlc_object_t *, int fd, bool b_demux);
45
46 /* TODO: remove this, use callbacks */
47 typedef enum {
48     IO_METHOD_READ=1,
49     IO_METHOD_MMAP,
50     IO_METHOD_USERPTR,
51 } io_method;
52
53 /* TODO: move this to .c */
54 struct demux_sys_t
55 {
56     int  i_fd;
57
58     /* Video */
59     io_method io;
60
61     struct buffer_t *p_buffers;
62     unsigned int i_nbuffers;
63 #define blocksize i_nbuffers /* HACK HACK */
64
65     int i_fourcc;
66     uint32_t i_block_flags;
67
68     es_out_id_t *p_es;
69
70 #ifdef HAVE_LIBV4L2
71     bool b_libv4l2;
72 #endif
73 };
74
75 struct buffer_t
76 {
77     void *  start;
78     size_t  length;
79 };
80
81 /* video.c */
82 void ParseMRL(vlc_object_t *, const char *);
83 int OpenVideo(vlc_object_t *, demux_sys_t *, bool);
84 block_t* GrabVideo(vlc_object_t *, demux_sys_t *);
85
86 /* demux.c */
87 int DemuxOpen(vlc_object_t *);
88 void DemuxClose(vlc_object_t *);
89 float GetAbsoluteMaxFrameRate(vlc_object_t *, int fd, uint32_t fmt);
90 void GetMaxDimensions(vlc_object_t *, int fd, uint32_t fmt, float fps_min,
91                       uint32_t *pwidth, uint32_t *pheight);
92
93 /* access.c */
94 int AccessOpen(vlc_object_t *);
95 void AccessClose(vlc_object_t *);