remove whitespace at eol
[goodguy/history.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 "../config.h"
28 #include "filebase.h"
29 #include "file.inc"
30
31 #ifdef DV_USE_FFMPEG
32 #include <avcodec.h>
33 #endif
34
35 #include <libdv/dv.h>
36
37
38 class FileDV : public FileBase
39 {
40 public:
41         FileDV(Asset *asset, File *file);
42         ~FileDV();
43
44         static void get_parameters(BC_WindowBase *parent_window,
45                 Asset *asset,
46                 BC_WindowBase* &format_window,
47                 int audio_options,
48                 int video_options);
49
50         int reset_parameters_derived();
51         int open_file(int rd, int wr);
52
53         static int check_sig(Asset *asset);
54         int close_file_derived();
55
56         int64_t get_video_position();
57         int64_t get_audio_position();
58
59         int set_video_position(int64_t x);
60         int set_audio_position(int64_t x);
61
62         int audio_samples_copy(double **buffer, int64_t len);
63
64         int write_samples(double **buffer, int64_t len);
65         int write_frames(VFrame ***frames, int len);
66
67         int read_compressed_frame(VFrame *buffer);
68         int write_compressed_frame(VFrame *buffers);
69
70         int64_t compressed_frame_size();
71
72         int read_samples(double *buffer, int64_t len);
73         int read_frame(VFrame *frame);
74
75         int colormodel_supported(int colormodel);
76
77         int can_copy_from(Edit *edit, int64_t position);
78
79         static int get_best_colormodel(Asset *asset, int driver);
80
81         int get_audio_frame(int64_t pos);
82         int get_audio_offset(int64_t pos);
83
84 private:
85         FILE *stream;
86
87         Mutex *stream_lock;
88         Mutex *decoder_lock;
89         Mutex *video_position_lock;
90
91         dv_decoder_t *decoder;
92         dv_encoder_t *encoder;
93         dv_encoder_t *audio_encoder;
94
95         int64_t audio_position;
96         int64_t video_position;
97
98         unsigned char *video_buffer;
99         unsigned char *audio_buffer;
100
101         int16_t **audio_sample_buffer;
102         int audio_sample_buffer_start;
103         int audio_sample_buffer_end;
104         int audio_sample_buffer_len;
105         int audio_sample_buffer_maxsize;
106
107         int audio_frames_written;
108
109         int output_size;
110         int isPAL;
111 };
112
113
114 class DVConfigAudio: public BC_Window
115 {
116 public:
117         DVConfigAudio(BC_WindowBase *parent_window, Asset *asset);
118         ~DVConfigAudio();
119
120         void create_objects();
121         int close_event();
122
123 private:
124         Asset *asset;
125         BC_WindowBase *parent_window;
126 };
127
128
129
130 class DVConfigVideo: public BC_Window
131 {
132 public:
133         DVConfigVideo(BC_WindowBase *parent_window, Asset *asset);
134         ~DVConfigVideo();
135
136         void create_objects();
137         int close_event();
138
139 private:
140         Asset *asset;
141         BC_WindowBase *parent_window;
142 };
143
144
145 #endif
146 #endif