4 #include "bitspopup.inc"
5 #include "condition.inc"
15 #include "quicktime.h"
26 void load_output(mjpeg_t
*mjpeg
);
29 unsigned char *output
; // Output buffer
30 int64_t output_size
; // Size of output buffer
31 int64_t output_allocated
; // Allocation of output buffer
32 Condition
*completion_lock
;
35 class FileMOV
: public FileBase
38 FileMOV(Asset
*asset
, File
*file
);
41 friend class FileMOVThread
;
43 static void get_parameters(BC_WindowBase
*parent_window
,
45 BC_WindowBase
* &format_window
,
49 static int check_sig(Asset
*asset
);
51 int open_file(int rd
, int wr
);
53 void asset_to_format();
54 void format_to_asset();
55 int64_t get_video_length();
56 int64_t get_audio_length();
57 int set_video_position(int64_t x
);
58 int set_audio_position(int64_t x
);
59 int write_samples(double **buffer
,
61 int write_frames(VFrame
***frames
, int len
);
62 int64_t compressed_frame_size();
63 int read_compressed_frame(VFrame
*buffer
);
64 int write_compressed_frame(VFrame
*buffer
);
66 int read_frame(VFrame
*frame
);
67 int read_samples(double *buffer
, int64_t len
);
69 // Direct copy routines
70 static int get_best_colormodel(Asset
*asset
, int driver
);
71 int colormodel_supported(int colormodel
);
72 int can_copy_from(Edit
*edit
, int64_t position
); // This file can copy frames directly from the asset
73 static char *strtocompression(char *string
);
74 static char *compressiontostr(char *string
);
76 // Fix codec to what AVI or MOV support
77 static void fix_codecs(Asset
*asset
);
79 // set programme timecode
80 void set_frame_start(int64_t offset
);
83 void new_audio_temp(int64_t len
);
84 // read raw audio data
85 int read_raw(char *buffer
, int64_t samples
, int track
);
86 // overlay raw frame from the current layer and position
87 int read_raw(VFrame
*frame
,
88 float in_x1
, float in_y1
, float in_x2
, float in_y2
,
89 float out_x1
, float out_y1
, float out_x2
, float out_y2
,
90 int use_float
, int interpolate
);
91 int reset_parameters_derived();
92 int quicktime_atracks
;
93 int quicktime_vtracks
;
94 // current positions for when the file descriptor doesn't have the right position
96 int depth
; // Depth in bits per pixel
97 int64_t frames_correction
; // Correction after 32bit overflow
98 int64_t samples_correction
; // Correction after 32bit overflow
100 // An array of frames for threads to look up and compress on their own.
101 ArrayList
<ThreadStruct
*> threadframes
;
103 int total_threadframes
; // Number of thread frames in this buffer
104 int current_threadframe
; // Next threadframe to compress
105 Mutex
*threadframe_lock
; // Lock threadframe array.
107 FileMOVThread
**threads
; // One thread for every CPU
108 char prefix_path
[1024]; // Prefix for new file when 2G limit is exceeded
109 int suffix_number
; // Number for new file
111 // Temp buffers for converting from double to float
113 int64_t temp_allocated
;
117 // Encoder thread to parallelize certain compression formats, mainly JPEG.
118 // Only works when no alpha.
120 class FileMOVThread
: public Thread
123 FileMOVThread(FileMOV
*filemov
, int fields
);
126 int start_encoding();
131 ThreadStruct
*threadframe
; // The frame currently being processed.
134 Condition
*input_lock
; // Wait for new array of threads or completion.
140 class MOVConfigAudioNum
;
141 class MOVConfigAudioPopup
;
142 class MOVConfigAudioToggle
;
144 class MOVConfigAudio
: public BC_Window
147 MOVConfigAudio(BC_WindowBase
*parent_window
, Asset
*asset
);
150 int create_objects();
152 void update_parameters();
155 MOVConfigAudioPopup
*compression_popup
;
156 ArrayList
<BC_ListBoxItem
*> compression_items
;
157 BC_WindowBase
*parent_window
;
158 BitsPopup
*bits_popup
;
159 BC_Title
*bits_title
;
162 MOVConfigAudioNum
*vorbis_min_bitrate
;
163 MOVConfigAudioNum
*vorbis_bitrate
;
164 MOVConfigAudioNum
*vorbis_max_bitrate
;
165 MOVConfigAudioToggle
*vorbis_vbr
;
167 MOVConfigAudioNum
*mp3_bitrate
;
168 MOVConfigAudioNum
*mp4a_bitrate
;
169 MOVConfigAudioNum
*mp4a_quantqual
;
173 class MOVConfigAudioPopup
: public BC_PopupTextBox
176 MOVConfigAudioPopup(MOVConfigAudio
*popup
, int x
, int y
);
178 MOVConfigAudio
*popup
;
182 class MOVConfigAudioToggle
: public BC_CheckBox
185 MOVConfigAudioToggle(MOVConfigAudio
*popup
,
192 MOVConfigAudio
*popup
;
196 class MOVConfigAudioNum
: public BC_TumbleTextBox
199 MOVConfigAudioNum(MOVConfigAudio
*popup
,
204 ~MOVConfigAudioNum();
206 void create_objects();
209 MOVConfigAudio
*popup
;
216 class MOVConfigVideoPopup
;
217 class MOVConfigVideoNum
;
218 class MOVConfigVideoFix
;
219 class MOVConfigVideoFixBitrate
;
220 class MOVConfigVideoFixQuant
;
221 class MOVConfigVideoCheckBox
;
224 class MOVConfigVideo
: public BC_Window
227 MOVConfigVideo(BC_WindowBase
*parent_window
,
229 int lock_compressor
);
232 int create_objects();
236 void update_parameters();
238 ArrayList
<BC_ListBoxItem
*> compression_items
;
239 MOVConfigVideoPopup
*compression_popup
;
240 BC_WindowBase
*parent_window
;
242 int param_x
, param_y
;
245 BC_ISlider
*jpeg_quality
;
246 BC_Title
*jpeg_quality_title
;
248 MOVConfigVideoNum
*ms_bitrate
;
249 MOVConfigVideoNum
*ms_bitrate_tolerance
;
250 MOVConfigVideoNum
*ms_quantization
;
251 MOVConfigVideoNum
*ms_gop_size
;
252 MOVConfigVideoCheckBox
*ms_interlaced
;
253 MOVConfigVideoFixBitrate
*ms_fix_bitrate
;
254 MOVConfigVideoFixQuant
*ms_fix_quant
;
256 MOVConfigVideoNum
*divx_bitrate
;
257 MOVConfigVideoNum
*divx_quantizer
;
258 MOVConfigVideoNum
*divx_rc_period
;
259 MOVConfigVideoNum
*divx_rc_reaction_ratio
;
260 MOVConfigVideoNum
*divx_rc_reaction_period
;
261 MOVConfigVideoNum
*divx_max_key_interval
;
262 MOVConfigVideoNum
*divx_max_quantizer
;
263 MOVConfigVideoNum
*divx_min_quantizer
;
264 MOVConfigVideoNum
*divx_quality
;
265 MOVConfigVideoFixBitrate
*divx_fix_bitrate
;
266 MOVConfigVideoFixQuant
*divx_fix_quant
;
268 MOVConfigVideoNum
*h264_bitrate
;
269 MOVConfigVideoNum
*h264_quantizer
;
270 MOVConfigVideoFixBitrate
*h264_fix_bitrate
;
271 MOVConfigVideoFixQuant
*h264_fix_quant
;
274 class MOVConfigVideoPopup
: public BC_PopupTextBox
277 MOVConfigVideoPopup(MOVConfigVideo
*popup
, int x
, int y
);
279 MOVConfigVideo
*popup
;
282 class MOVConfigVideoFixBitrate
: public BC_Radial
285 MOVConfigVideoFixBitrate(int x
,
295 class MOVConfigVideoFixQuant
: public BC_Radial
298 MOVConfigVideoFixQuant(int x
,
308 class MOVConfigVideoCheckBox
: public BC_CheckBox
311 MOVConfigVideoCheckBox(char *title_text
,
319 class MOVConfigVideoNum
: public BC_TumbleTextBox
322 MOVConfigVideoNum(MOVConfigVideo
*popup
,
327 MOVConfigVideoNum(MOVConfigVideo
*popup
,
334 ~MOVConfigVideoNum();
336 void create_objects();
339 MOVConfigVideo
*popup
;