4 #include "bitspopup.inc"
12 #include "quicktime.h"
22 void load_output(mjpeg_t
*mjpeg
);
25 unsigned char *output
; // Output buffer
26 int64_t output_size
; // Size of output buffer
27 int64_t output_allocated
; // Allocation of output buffer
28 Mutex completion_lock
;
31 class FileMOV
: public FileBase
34 FileMOV(Asset
*asset
, File
*file
);
37 friend class FileMOVThread
;
39 static void get_parameters(BC_WindowBase
*parent_window
,
41 BC_WindowBase
* &format_window
,
45 static int check_sig(Asset
*asset
);
47 int open_file(int rd
, int wr
);
49 void asset_to_format();
50 void format_to_asset();
51 int64_t get_video_length();
52 int64_t get_audio_length();
53 int set_video_position(int64_t x
);
54 int set_audio_position(int64_t x
);
55 int write_samples(double **buffer
,
57 int write_frames(VFrame
***frames
, int len
);
58 int64_t compressed_frame_size();
59 int read_compressed_frame(VFrame
*buffer
);
60 int write_compressed_frame(VFrame
*buffer
);
62 int read_frame(VFrame
*frame
);
63 int read_samples(double *buffer
, int64_t len
);
65 // Direct copy routines
66 static int get_best_colormodel(Asset
*asset
, int driver
);
67 int colormodel_supported(int colormodel
);
68 int can_copy_from(Edit
*edit
, int64_t position
); // This file can copy frames directly from the asset
69 static char *strtocompression(char *string
);
70 static char *compressiontostr(char *string
);
72 // Fix codec to what AVI or MOV support
73 static void fix_codecs(Asset
*asset
);
76 void new_audio_temp(int64_t len
);
77 // read raw audio data
78 int read_raw(char *buffer
, int64_t samples
, int track
);
79 // overlay raw frame from the current layer and position
80 int read_raw(VFrame
*frame
,
81 float in_x1
, float in_y1
, float in_x2
, float in_y2
,
82 float out_x1
, float out_y1
, float out_x2
, float out_y2
,
83 int use_float
, int interpolate
);
84 int reset_parameters_derived();
85 int quicktime_atracks
;
86 int quicktime_vtracks
;
87 // current positions for when the file descriptor doesn't have the right position
89 // frame to return through read_frame
91 // Temporary storage for color conversions
93 int depth
; // Depth in bits per pixel
94 int64_t frames_correction
; // Correction after 32bit overflow
95 int64_t samples_correction
; // Correction after 32bit overflow
97 // An array of frames for threads to look up and compress on their own.
98 ArrayList
<ThreadStruct
*> threadframes
;
100 int total_threadframes
; // Number of thread frames in this buffer
101 int current_threadframe
; // Next threadframe to compress
102 Mutex threadframe_lock
; // Lock threadframe array.
104 FileMOVThread
**threads
; // One thread for every CPU
105 char prefix_path
[1024]; // Prefix for new file when 2G limit is exceeded
106 int suffix_number
; // Number for new file
108 // Temp buffers for converting from double to float
110 int64_t temp_allocated
;
114 // Encoder thread to parallelize certain compression formats, mainly JPEG.
115 // Only works when no alpha.
117 class FileMOVThread
: public Thread
120 FileMOVThread(FileMOV
*filemov
, int fields
);
123 int start_encoding();
128 ThreadStruct
*threadframe
; // The frame currently being processed.
131 Mutex input_lock
; // Wait for new array of threads or completion.
132 Mutex quicktime_lock
; // Lock out reopen_file
138 class MOVConfigAudioNum
;
139 class MOVConfigAudioPopup
;
140 class MOVConfigAudioToggle
;
142 class MOVConfigAudio
: public BC_Window
145 MOVConfigAudio(BC_WindowBase
*parent_window
, Asset
*asset
);
148 int create_objects();
150 void update_parameters();
152 MOVConfigAudioPopup
*compression_popup
;
153 ArrayList
<BC_ListBoxItem
*> compression_items
;
154 BC_WindowBase
*parent_window
;
155 BitsPopup
*bits_popup
;
156 BC_Title
*bits_title
;
159 MOVConfigAudioNum
*vorbis_min_bitrate
;
160 MOVConfigAudioNum
*vorbis_bitrate
;
161 MOVConfigAudioNum
*vorbis_max_bitrate
;
162 MOVConfigAudioToggle
*vorbis_vbr
;
164 MOVConfigAudioNum
*mp3_bitrate
;
168 class MOVConfigAudioPopup
: public BC_PopupTextBox
171 MOVConfigAudioPopup(MOVConfigAudio
*popup
, int x
, int y
);
173 MOVConfigAudio
*popup
;
177 class MOVConfigAudioToggle
: public BC_CheckBox
180 MOVConfigAudioToggle(MOVConfigAudio
*popup
,
187 MOVConfigAudio
*popup
;
191 class MOVConfigAudioNum
: public BC_TumbleTextBox
194 MOVConfigAudioNum(MOVConfigAudio
*popup
,
199 ~MOVConfigAudioNum();
201 void create_objects();
204 MOVConfigAudio
*popup
;
211 class MOVConfigVideoPopup
;
212 class MOVConfigVideoNum
;
213 class MOVConfigVideoFix
;
214 class MOVConfigVideoFixBitrate
;
215 class MOVConfigVideoFixQuant
;
216 class MOVConfigVideoCheckBox
;
219 class MOVConfigVideo
: public BC_Window
222 MOVConfigVideo(BC_WindowBase
*parent_window
,
224 int lock_compressor
);
227 int create_objects();
231 void update_parameters();
233 ArrayList
<BC_ListBoxItem
*> compression_items
;
234 MOVConfigVideoPopup
*compression_popup
;
235 BC_WindowBase
*parent_window
;
237 int param_x
, param_y
;
240 BC_ISlider
*jpeg_quality
;
241 BC_Title
*jpeg_quality_title
;
243 MOVConfigVideoNum
*ms_bitrate
;
244 MOVConfigVideoNum
*ms_bitrate_tolerance
;
245 MOVConfigVideoNum
*ms_quantization
;
246 MOVConfigVideoNum
*ms_gop_size
;
247 MOVConfigVideoCheckBox
*ms_interlaced
;
248 MOVConfigVideoFixBitrate
*ms_fix_bitrate
;
249 MOVConfigVideoFixQuant
*ms_fix_quant
;
251 MOVConfigVideoNum
*divx_bitrate
;
252 MOVConfigVideoNum
*divx_quantizer
;
253 MOVConfigVideoNum
*divx_rc_period
;
254 MOVConfigVideoNum
*divx_rc_reaction_ratio
;
255 MOVConfigVideoNum
*divx_rc_reaction_period
;
256 MOVConfigVideoNum
*divx_max_key_interval
;
257 MOVConfigVideoNum
*divx_max_quantizer
;
258 MOVConfigVideoNum
*divx_min_quantizer
;
259 MOVConfigVideoNum
*divx_quality
;
260 MOVConfigVideoFixBitrate
*divx_fix_bitrate
;
261 MOVConfigVideoFixQuant
*divx_fix_quant
;
264 class MOVConfigVideoPopup
: public BC_PopupTextBox
267 MOVConfigVideoPopup(MOVConfigVideo
*popup
, int x
, int y
);
269 MOVConfigVideo
*popup
;
272 class MOVConfigVideoFixBitrate
: public BC_Radial
275 MOVConfigVideoFixBitrate(int x
,
285 class MOVConfigVideoFixQuant
: public BC_Radial
288 MOVConfigVideoFixQuant(int x
,
298 class MOVConfigVideoCheckBox
: public BC_CheckBox
301 MOVConfigVideoCheckBox(char *title_text
,
309 class MOVConfigVideoNum
: public BC_TumbleTextBox
312 MOVConfigVideoNum(MOVConfigVideo
*popup
,
317 ~MOVConfigVideoNum();
319 void create_objects();
322 MOVConfigVideo
*popup
;