1 /*****************************************************************************
2 * v4l2.h : Video4Linux2 input module for vlc
3 *****************************************************************************
4 * Copyright (C) 2002-2011 VLC authors and VideoLAN
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
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 Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #include <linux/videodev2.h>
23 /* libv4l2 functions */
24 extern int v4l2_fd_open(int, int);
25 extern int (*v4l2_close
) (int);
26 extern int (*v4l2_ioctl
) (int, unsigned long int, ...);
27 extern ssize_t (*v4l2_read
) (int, void *, size_t);
28 extern void * (*v4l2_mmap
) (void *, size_t, int, int, int, int64_t);
29 extern int (*v4l2_munmap
) (void *, size_t);
31 #define CFG_PREFIX "v4l2-"
33 typedef struct vlc_v4l2_ctrl vlc_v4l2_ctrl_t
;
42 void ParseMRL(vlc_object_t
*, const char *);
43 int OpenDevice (vlc_object_t
*, const char *, uint32_t *);
44 v4l2_std_id
var_InheritStandard (vlc_object_t
*, const char *);
47 int SetupInput (vlc_object_t
*, int fd
, v4l2_std_id
*std
);
48 int SetupFormat (vlc_object_t
*, int, uint32_t,
49 struct v4l2_format
*, struct v4l2_streamparm
*);
50 #define SetupFormat(o,fd,fcc,fmt,p) \
51 SetupFormat(VLC_OBJECT(o),fd,fcc,fmt,p)
52 int SetupTuner (vlc_object_t
*, int fd
, uint32_t);
54 int StartUserPtr (vlc_object_t
*, int);
55 struct buffer_t
*StartMmap (vlc_object_t
*, int, uint32_t *);
56 void StopMmap (int, struct buffer_t
*, uint32_t);
58 mtime_t
GetBufferPTS (const struct v4l2_buffer
*);
59 block_t
* GrabVideo (vlc_object_t
*, int, const struct buffer_t
*);
63 typedef struct vlc_v4l2_vbi vlc_v4l2_vbi_t
;
65 vlc_v4l2_vbi_t
*OpenVBI (demux_t
*, const char *);
66 int GetFdVBI (vlc_v4l2_vbi_t
*);
67 void GrabVBI (demux_t
*p_demux
, vlc_v4l2_vbi_t
*);
68 void CloseVBI (vlc_v4l2_vbi_t
*);
72 int DemuxOpen(vlc_object_t
*);
73 void DemuxClose(vlc_object_t
*);
74 float GetAbsoluteMaxFrameRate(vlc_object_t
*, int fd
, uint32_t fmt
);
75 void GetMaxDimensions(vlc_object_t
*, int fd
, uint32_t fmt
, float fps_min
,
76 uint32_t *pwidth
, uint32_t *pheight
);
79 int AccessOpen(vlc_object_t
*);
80 void AccessClose(vlc_object_t
*);
83 int RadioOpen(vlc_object_t
*);
84 void RadioClose(vlc_object_t
*);
87 vlc_v4l2_ctrl_t
*ControlsInit(vlc_object_t
*, int fd
);
88 void ControlsDeinit(vlc_object_t
*, vlc_v4l2_ctrl_t
*);