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
,
48 char *locked_compressor
);
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 int64_t get_memory_usage();
72 int colormodel_supported(int colormodel
);
73 int can_copy_from(Edit
*edit
, int64_t position
); // This file can copy frames directly from the asset
74 static char *strtocompression(char *string
);
75 static char *compressiontostr(char *string
);
77 // Fix codec to what AVI or MOV support
78 static void fix_codecs(Asset
*asset
);
79 // Check if resolutions match the DV codec when used
80 int check_codec_params(Asset
*asset
);
82 // set programme timecode
83 void set_frame_start(int64_t offset
);
86 void new_audio_temp(int64_t len
);
87 // read raw audio data
88 int read_raw(char *buffer
, int64_t samples
, int track
);
89 // overlay raw frame from the current layer and position
90 int read_raw(VFrame
*frame
,
91 float in_x1
, float in_y1
, float in_x2
, float in_y2
,
92 float out_x1
, float out_y1
, float out_x2
, float out_y2
,
93 int use_float
, int interpolate
);
94 int reset_parameters_derived();
95 int quicktime_atracks
;
96 int quicktime_vtracks
;
97 // current positions for when the file descriptor doesn't have the right position
99 int depth
; // Depth in bits per pixel
100 int64_t frames_correction
; // Correction after 32bit overflow
101 int64_t samples_correction
; // Correction after 32bit overflow
103 // An array of frames for threads to look up and compress on their own.
104 ArrayList
<ThreadStruct
*> threadframes
;
106 int total_threadframes
; // Number of thread frames in this buffer
107 int current_threadframe
; // Next threadframe to compress
108 Mutex
*threadframe_lock
; // Lock threadframe array.
110 FileMOVThread
**threads
; // One thread for every CPU
111 char prefix_path
[1024]; // Prefix for new file when 2G limit is exceeded
112 int suffix_number
; // Number for new file
114 // Temp buffers for converting from double to float
116 int64_t temp_allocated
;
120 // Encoder thread to parallelize certain compression formats, mainly JPEG.
121 // Only works when no alpha.
123 class FileMOVThread
: public Thread
126 FileMOVThread(FileMOV
*filemov
, int fields
);
129 int start_encoding();
134 ThreadStruct
*threadframe
; // The frame currently being processed.
137 Condition
*input_lock
; // Wait for new array of threads or completion.
143 class MOVConfigAudioNum
;
144 class MOVConfigAudioPopup
;
145 class MOVConfigAudioToggle
;
147 class MOVConfigAudio
: public BC_Window
150 MOVConfigAudio(BC_WindowBase
*parent_window
, Asset
*asset
);
153 int create_objects();
155 void update_parameters();
158 MOVConfigAudioPopup
*compression_popup
;
159 ArrayList
<BC_ListBoxItem
*> compression_items
;
160 BC_WindowBase
*parent_window
;
161 BitsPopup
*bits_popup
;
162 BC_Title
*bits_title
;
165 MOVConfigAudioNum
*vorbis_min_bitrate
;
166 MOVConfigAudioNum
*vorbis_bitrate
;
167 MOVConfigAudioNum
*vorbis_max_bitrate
;
168 MOVConfigAudioToggle
*vorbis_vbr
;
170 MOVConfigAudioNum
*mp3_bitrate
;
171 MOVConfigAudioNum
*mp4a_bitrate
;
172 MOVConfigAudioNum
*mp4a_quantqual
;
176 class MOVConfigAudioPopup
: public BC_PopupTextBox
179 MOVConfigAudioPopup(MOVConfigAudio
*popup
, int x
, int y
);
181 MOVConfigAudio
*popup
;
185 class MOVConfigAudioToggle
: public BC_CheckBox
188 MOVConfigAudioToggle(MOVConfigAudio
*popup
,
195 MOVConfigAudio
*popup
;
199 class MOVConfigAudioNum
: public BC_TumbleTextBox
202 MOVConfigAudioNum(MOVConfigAudio
*popup
,
207 ~MOVConfigAudioNum();
209 void create_objects();
212 MOVConfigAudio
*popup
;
219 class MOVConfigVideoPopup
;
220 class MOVConfigVideoNum
;
221 class MOVConfigVideoFix
;
222 class MOVConfigVideoFixBitrate
;
223 class MOVConfigVideoFixQuant
;
224 class MOVConfigVideoCheckBox
;
227 class MOVConfigVideo
: public BC_Window
230 MOVConfigVideo(BC_WindowBase
*parent_window
,
232 char *locked_compressor
);
235 int create_objects();
239 void update_parameters();
241 ArrayList
<BC_ListBoxItem
*> compression_items
;
242 MOVConfigVideoPopup
*compression_popup
;
243 BC_WindowBase
*parent_window
;
245 int param_x
, param_y
;
246 char *locked_compressor
;
248 BC_ISlider
*jpeg_quality
;
249 BC_Title
*jpeg_quality_title
;
251 MOVConfigVideoNum
*ms_bitrate
;
252 MOVConfigVideoNum
*ms_bitrate_tolerance
;
253 MOVConfigVideoNum
*ms_quantization
;
254 MOVConfigVideoNum
*ms_gop_size
;
255 MOVConfigVideoCheckBox
*ms_interlaced
;
256 MOVConfigVideoFixBitrate
*ms_fix_bitrate
;
257 MOVConfigVideoFixQuant
*ms_fix_quant
;
259 MOVConfigVideoNum
*divx_bitrate
;
260 MOVConfigVideoNum
*divx_quantizer
;
261 MOVConfigVideoNum
*divx_rc_period
;
262 MOVConfigVideoNum
*divx_rc_reaction_ratio
;
263 MOVConfigVideoNum
*divx_rc_reaction_period
;
264 MOVConfigVideoNum
*divx_max_key_interval
;
265 MOVConfigVideoNum
*divx_max_quantizer
;
266 MOVConfigVideoNum
*divx_min_quantizer
;
267 MOVConfigVideoNum
*divx_quality
;
268 MOVConfigVideoFixBitrate
*divx_fix_bitrate
;
269 MOVConfigVideoFixQuant
*divx_fix_quant
;
271 MOVConfigVideoNum
*h264_bitrate
;
272 MOVConfigVideoNum
*h264_quantizer
;
273 MOVConfigVideoFixBitrate
*h264_fix_bitrate
;
274 MOVConfigVideoFixQuant
*h264_fix_quant
;
277 class MOVConfigVideoPopup
: public BC_PopupTextBox
280 MOVConfigVideoPopup(MOVConfigVideo
*popup
, int x
, int y
);
282 MOVConfigVideo
*popup
;
285 class MOVConfigVideoFixBitrate
: public BC_Radial
288 MOVConfigVideoFixBitrate(int x
,
298 class MOVConfigVideoFixQuant
: public BC_Radial
301 MOVConfigVideoFixQuant(int x
,
311 class MOVConfigVideoCheckBox
: public BC_CheckBox
314 MOVConfigVideoCheckBox(char *title_text
,
322 class MOVConfigVideoNum
: public BC_TumbleTextBox
325 MOVConfigVideoNum(MOVConfigVideo
*popup
,
330 MOVConfigVideoNum(MOVConfigVideo
*popup
,
337 ~MOVConfigVideoNum();
339 void create_objects();
342 MOVConfigVideo
*popup
;