Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / filedv.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2004 Richard Baverstock
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
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 General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef FILEDV_H
23 #define FILEDV_H
24
25 #ifdef HAVE_DV
26
27 #include "edl.inc"
28 #include "filebase.h"
29 #include "file.inc"
30
31 #include <libdv/dv.h>
32
33
34 class FileDV : public FileBase
35 {
36 public:
37         FileDV(Asset *asset, File *file);
38         ~FileDV();
39
40         static void get_parameters(BC_WindowBase *parent_window,
41                 Asset *asset, BC_WindowBase* &format_window,
42                 int audio_options, int video_options, EDL *edl);
43
44         int reset_parameters_derived();
45         int open_file(int rd, int wr);
46
47         static int check_sig(Asset *asset);
48         int close_file_derived();
49
50         int64_t get_video_position();
51         int64_t get_audio_position();
52
53         int set_video_position(int64_t x);
54         int set_audio_position(int64_t x);
55
56         int audio_samples_copy(double **buffer, int64_t len);
57
58         int write_samples(double **buffer, int64_t len);
59         int write_frames(VFrame ***frames, int len);
60
61         int read_compressed_frame(VFrame *buffer);
62         int write_compressed_frame(VFrame *buffers);
63
64         int64_t compressed_frame_size();
65
66         int read_samples(double *buffer, int64_t len);
67         int read_frame(VFrame *frame);
68
69         int colormodel_supported(int colormodel);
70
71         int can_copy_from(Edit *edit, int64_t position);
72
73         static int get_best_colormodel(Asset *asset, int driver);
74
75         int get_audio_frame(int64_t pos);
76         int get_audio_offset(int64_t pos);
77
78 private:
79         FILE *stream;
80
81         Mutex *stream_lock;
82         Mutex *decoder_lock;
83         Mutex *video_position_lock;
84
85         dv_decoder_t *decoder;
86         dv_encoder_t *encoder;
87         dv_encoder_t *audio_encoder;
88
89         int64_t audio_position;
90         int64_t video_position;
91
92         unsigned char *video_buffer;
93         unsigned char *audio_buffer;
94
95         int16_t **audio_sample_buffer;
96         int audio_sample_buffer_start;
97         int audio_sample_buffer_end;
98         int audio_sample_buffer_len;
99         int audio_sample_buffer_maxsize;
100
101         int audio_frames_written;
102
103         int output_size;
104         int isPAL;
105 };
106
107
108 class DVConfigAudio: public BC_Window
109 {
110 public:
111         DVConfigAudio(BC_WindowBase *parent_window, Asset *asset);
112         ~DVConfigAudio();
113
114         void create_objects();
115         int close_event();
116
117 private:
118         Asset *asset;
119         BC_WindowBase *parent_window;
120 };
121
122
123
124 class DVConfigVideo: public BC_Window
125 {
126 public:
127         DVConfigVideo(BC_WindowBase *parent_window, Asset *asset);
128         ~DVConfigVideo();
129
130         void create_objects();
131         int close_event();
132
133 private:
134         Asset *asset;
135         BC_WindowBase *parent_window;
136 };
137
138
139 #endif
140 #endif