Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / libdv.h
1 /*
2  * Grabbing algorithm is from dvgrab
3  */
4
5 #ifndef LIBDV_H
6 #define LIBDV_H
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 // Buffer sizes
13 #define DV_NTSC_SIZE 120000
14 #define DV_PAL_SIZE 144000
15 #define CODEC_TAG_DVSD "dvsd"
16
17 // Norms
18 #define DV_NTSC 0
19 #define DV_PAL 1
20
21
22 #include <libdv/dv.h>
23 #include <pthread.h>
24 #include <sys/time.h>
25
26 typedef struct
27 {
28         dv_decoder_t *decoder;
29         dv_encoder_t *encoder;
30         short *temp_audio[4];
31         unsigned char *temp_video;
32         int use_mmx;
33         int audio_frames;
34 } dv_t;
35
36
37 // ================================== The frame decoder
38 dv_t* dv_new();
39 int dv_delete(dv_t* dv);
40
41 // Decode a video frame from the data and return nonzero if failure
42 int dv_read_video(dv_t *dv,
43                 unsigned char **output_rows,
44                 unsigned char *data,
45                 long bytes,
46                 int color_model);
47 // Decode audio from the data and return the number of samples decoded.
48 int dv_read_audio(dv_t *dv,
49                 unsigned char *samples,
50                 unsigned char *data,
51                 long size,
52                 int channels,
53                 int bits);
54
55 void dv_write_video(dv_t *dv,
56                 unsigned char *data,
57                 unsigned char **input_rows,
58                 int color_model,
59                 int norm);
60
61 // Write audio into frame after video is encoded.
62 // Returns the number of samples put in frame.
63 int dv_write_audio(dv_t *dv,
64                 unsigned char *data,
65                 unsigned char *input_samples,
66                 int max_samples,
67                 int channels,
68                 int bits,
69                 int rate,
70                 int norm);
71
72
73 #ifdef __cplusplus
74 }
75 #endif
76
77 #endif