Statistics
| Branch: | Revision:

chunker-player / capture / video.h @ 1e69ae95

History | View | Annotate | Download (1.52 KB)

1
/* 
2
 * File:   capture.h
3
 * Author: carmelo
4
 *
5
 * Created on December 12, 2009, 7:58 PM
6
 */
7

    
8
#ifndef _VIDEO_H
9
#define        _VIDEO_H
10

    
11
#ifdef        __cplusplus
12
extern "C" {
13
#endif
14

    
15
#include <stdio.h>
16
#include <stdlib.h>
17
#include <string.h>
18
#include <assert.h>
19

    
20
#include <getopt.h>             /* getopt_long() */
21

    
22
#include <fcntl.h>              /* low-level i/o */
23
#include <unistd.h>
24
#include <errno.h>
25
#include <malloc.h>
26
#include <sys/stat.h>
27
#include <sys/types.h>
28
#include <sys/time.h>
29
#include <sys/mman.h>
30
#include <sys/ioctl.h>
31

    
32
#include <asm/types.h>          /* for videodev2.h */
33

    
34
#include <linux/videodev2.h>
35

    
36
#define CLEAR(x) memset (&(x), 0, sizeof (x))
37

    
38
typedef enum {
39
    IO_METHOD_READ,
40
    IO_METHOD_MMAP,
41
    IO_METHOD_USERPTR,
42
} io_method;
43

    
44
struct buffer{
45
    void * start;
46
    size_t length;
47
};
48

    
49
char* video_dev_name;
50
io_method io;
51
int fd;;
52
struct buffer * buffers;
53
unsigned int n_buffers;
54
struct v4l2_format fmt;
55
__u32 video_format;
56

    
57
void errno_exit (const char * s);
58
static int xioctl (int fd, int request, void *arg);
59
void process_frame (unsigned char *p, int bytes, const struct v4l2_format* fmt);
60
int read_frame(void);
61
int poll_video_device(void);
62
void mainloop (void);
63
void stop_video_capturing(void);
64
void start_video_capturing(void);
65
void uninit_video_device (void);
66
static void init_read(unsigned int buffer_size);
67
static void init_mmap(void);
68
static void init_userp (unsigned int buffer_size);
69
void init_video_device (void);
70
void close_video_device (void);
71
void open_video_device (void);
72

    
73
#ifdef        __cplusplus
74
}
75
#endif
76

    
77
#endif        /* _VIDEO_H */
78