* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#if defined(HAVE_LINUX_VIDEODEV2_H)
-# include <linux/videodev2.h>
-#elif defined(HAVE_SYS_VIDEOIO_H)
-# include <sys/videoio.h>
+#if defined (HAVE_LINUX_VIDEODEV2_H)
+# include <linux/videodev2.h>
+#elif defined (HAVE_SYS_VIDEOIO_H)
+# include <sys/videoio.h>
#else
-# error "No Video4Linux2 headers found."
+# error "No Video4Linux2 headers found."
+#endif
+#ifndef V4L2_CAP_DEVICE_CAPS
+# warning Please update Video4Linux2 headers!
#endif
/* Hacks to compile with old headers */
#ifndef V4L2_CTRL_FLAG_VOLATILE /* 3.2 */
-# warning Please update Video4Linux2 headers!
# define V4L2_CTRL_FLAG_VOLATILE 0x0080
# define V4L2_CID_POWER_LINE_FREQUENCY_AUTO 3
# define V4L2_STD_G (V4L2_STD_PAL_G|V4L2_STD_SECAM_G)
# define V4L2_STD_MTS (V4L2_STD_NTSC_M|V4L2_STD_PAL_M|V4L2_STD_PAL_N|\
V4L2_STD_PAL_Nc)
#endif
-#ifdef __linux__
-# include <linux/version.h>
-# if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
-# define V4L2_CTRL_TYPE_BITMASK 8
-# endif
-#endif
#ifndef V4L2_CID_ILLUMINATORS_1 /* 2.6.37 */
# define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+38)
# define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+37)
#define CFG_PREFIX "v4l2-"
-/* TODO: remove this, use callbacks */
-typedef enum {
- IO_METHOD_READ=1,
- IO_METHOD_MMAP,
- IO_METHOD_USERPTR,
-} io_method;
-
typedef struct vlc_v4l2_ctrl vlc_v4l2_ctrl_t;
-/* TODO: move this to access.c and demux.c (separately) */
-struct demux_sys_t
-{
- int i_fd;
-
- /* Video */
- io_method io;
-
- struct buffer_t *p_buffers;
- unsigned int i_nbuffers;
-#define blocksize i_nbuffers /* HACK HACK */
-
- int i_fourcc;
- uint32_t i_block_flags;
-
- es_out_id_t *p_es;
-
- vlc_v4l2_ctrl_t *controls;
-};
-
struct buffer_t
{
void * start;
size_t length;
};
-/* video.c */
+/* v4l2.c */
void ParseMRL(vlc_object_t *, const char *);
-block_t* GrabVideo(vlc_object_t *, demux_sys_t *);
-int InitVideo(vlc_object_t *, int fd, demux_sys_t *, bool demux);
+v4l2_std_id var_InheritStandard (vlc_object_t *, const char *);
+
+/* video.c */
+int SetupInput (vlc_object_t *, int fd);
+int SetupFormat (vlc_object_t *, int, uint32_t,
+ struct v4l2_format *, struct v4l2_streamparm *);
+#define SetupFormat(o,fd,fcc,fmt,p) \
+ SetupFormat(VLC_OBJECT(o),fd,fcc,fmt,p)
+
+int StartUserPtr (vlc_object_t *, int);
+struct buffer_t *StartMmap (vlc_object_t *, int, uint32_t *);
+void StopMmap (int, struct buffer_t *, uint32_t);
+
+block_t* GrabVideo (vlc_object_t *, int, const struct buffer_t *);
/* demux.c */
int DemuxOpen(vlc_object_t *);