Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (1.48 KB)

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

    
8
#ifndef _CAPTURE_H
9
#define        _CAPTURE_H
10

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

    
15
#include <stdio.h>
16
#include <stdlib.h>
17
#include <pthread.h>
18
#include <signal.h>
19

    
20
FILE * img;
21
unsigned int seq;
22
char filename[255];
23
static unsigned char* rgb_buffer = NULL;
24
pthread_t video_capure_thread;
25
pthread_t audio_capure_thread;
26
FILE* audio_output_file;
27
unsigned char running;
28

    
29
#define DEFAULT_VIDEO_FORMAT V4L2_PIX_FMT_YUYV
30
#define DEFAULT_VIDEO_DEVICE "/dev/video0"
31
#define DEFAULT_AUDIO_OUT_FILE "out.wav"
32
#define WIDTH 640
33
#define HEIGHT 480
34

    
35
#define AUDIO_SAMPLE_RATE 44100 // ( 44100 = CD quality)
36
#define AUDIO_CHANNELS 2
37
#define AUDIO_FORMAT SND_PCM_FORMAT_S16_LE
38
#define AUDIO_INTERLEAVED SND_PCM_ACCESS_RW_INTERLEAVED
39

    
40
/*
41
* The WAVE Header
42
*/
43
typedef struct wav_s {
44
        char chunk_id[4] ; /* "RIFF" */
45
        unsigned int chunk_size; /* n*4 + 36 */
46
        char format[4]; /* "WAVE" */
47
        char sub_chunk_id[4]; /* "fmt " */
48
        unsigned int sub_chunk_size; /* 16 */
49
        unsigned short audio_format; /* 1 */
50
        unsigned short num_channels; /* 2 */
51
        unsigned int sample_rate; /* 44100 */
52
        unsigned int byte_rate; /* 4*44100 */
53
        unsigned short block_alg; /* 4 */
54
        unsigned short bps; /* 16 */
55
        unsigned char sub_chunk2_id[4]; /* "data" */
56
        unsigned int sub_chunk2_size; /* n*4 */
57
} wav_t ;
58

    
59
void* video_capture(void* ThreadParams);
60
void* audio_capture(void* ThreadParams);
61
void terminate(int signum);
62

    
63
#ifdef        __cplusplus
64
}
65
#endif
66

    
67
#endif        /* _CAPTURE_H */
68