4 #include "bitspopup.inc"
5 #include "condition.inc"
10 #include "quicktime.h"
21 void load_output(mjpeg_t
*mjpeg
);
24 unsigned char *output
; // Output buffer
25 int64_t output_size
; // Size of output buffer
26 int64_t output_allocated
; // Allocation of output buffer
27 Condition
*completion_lock
;
30 class FileMOV
: public FileBase
33 FileMOV(Asset
*asset
, File
*file
);
36 friend class FileMOVThread
;
38 static void get_parameters(BC_WindowBase
*parent_window
,
40 BC_WindowBase
* &format_window
,
44 static int check_sig(Asset
*asset
);
46 int open_file(int rd
, int wr
);
48 void asset_to_format();
49 void format_to_asset();
50 int64_t get_video_length();
51 int64_t get_audio_length();
52 int set_video_position(int64_t x
);
53 int set_audio_position(int64_t x
);
54 int write_samples(double **buffer
,
56 int write_frames(VFrame
***frames
, int len
);
57 int64_t compressed_frame_size();
58 int read_compressed_frame(VFrame
*buffer
);
59 int write_compressed_frame(VFrame
*buffer
);
61 int read_frame(VFrame
*frame
);
62 int read_samples(double *buffer
, int64_t len
);
64 // Direct copy routines
65 static int get_best_colormodel(Asset
*asset
, int driver
);
66 int colormodel_supported(int colormodel
);
67 int can_copy_from(Edit
*edit
, int64_t position
); // This file can copy frames directly from the asset
68 static char *strtocompression(char *string
);
69 static char *compressiontostr(char *string
);
71 // Fix codec to what AVI or MOV support
72 static void fix_codecs(Asset
*asset
);
74 // set programme timecode
75 void set_frame_start(int64_t offset
);
78 void new_audio_temp(int64_t len
);
79 // read raw audio data
80 int read_raw(char *buffer
, int64_t samples
, int track
);
81 // overlay raw frame from the current layer and position
82 int read_raw(VFrame
*frame
,
83 float in_x1
, float in_y1
, float in_x2
, float in_y2
,
84 float out_x1
, float out_y1
, float out_x2
, float out_y2
,
85 int use_float
, int interpolate
);
86 int reset_parameters_derived();
87 int quicktime_atracks
;
88 int quicktime_vtracks
;
89 // current positions for when the file descriptor doesn't have the right position
91 int depth
; // Depth in bits per pixel
92 int64_t frames_correction
; // Correction after 32bit overflow
93 int64_t samples_correction
; // Correction after 32bit overflow
95 // An array of frames for threads to look up and compress on their own.
96 ArrayList
<ThreadStruct
*> threadframes
;
98 int total_threadframes
; // Number of thread frames in this buffer
99 int current_threadframe
; // Next threadframe to compress
100 Mutex
*threadframe_lock
; // Lock threadframe array.
102 FileMOVThread
**threads
; // One thread for every CPU
103 char prefix_path
[1024]; // Prefix for new file when 2G limit is exceeded
104 int suffix_number
; // Number for new file
106 // Temp buffers for converting from double to float
108 int64_t temp_allocated
;
112 // Encoder thread to parallelize certain compression formats, mainly JPEG.
113 // Only works when no alpha.
115 class FileMOVThread
: public Thread
118 FileMOVThread(FileMOV
*filemov
, int fields
);
121 int start_encoding();
126 ThreadStruct
*threadframe
; // The frame currently being processed.
129 Condition
*input_lock
; // Wait for new array of threads or completion.
135 class MOVConfigAudioNum
;
136 class MOVConfigAudioPopup
;
137 class MOVConfigAudioToggle
;
139 class MOVConfigAudio
: public BC_Window
142 MOVConfigAudio(BC_WindowBase
*parent_window
, Asset
*asset
);
145 int create_objects();
147 void update_parameters();
149 MOVConfigAudioPopup
*compression_popup
;
150 ArrayList
<BC_ListBoxItem
*> compression_items
;
151 BC_WindowBase
*parent_window
;
152 BitsPopup
*bits_popup
;
153 BC_Title
*bits_title
;
156 MOVConfigAudioNum
*vorbis_min_bitrate
;
157 MOVConfigAudioNum
*vorbis_bitrate
;
158 MOVConfigAudioNum
*vorbis_max_bitrate
;
159 MOVConfigAudioToggle
*vorbis_vbr
;
161 MOVConfigAudioNum
*mp3_bitrate
;
165 class MOVConfigAudioPopup
: public BC_PopupTextBox
168 MOVConfigAudioPopup(MOVConfigAudio
*popup
, int x
, int y
);
170 MOVConfigAudio
*popup
;
174 class MOVConfigAudioToggle
: public BC_CheckBox
177 MOVConfigAudioToggle(MOVConfigAudio
*popup
,
184 MOVConfigAudio
*popup
;
188 class MOVConfigAudioNum
: public BC_TumbleTextBox
191 MOVConfigAudioNum(MOVConfigAudio
*popup
,
196 ~MOVConfigAudioNum();
198 void create_objects();
201 MOVConfigAudio
*popup
;
208 class MOVConfigVideoPopup
;
209 class MOVConfigVideoNum
;
210 class MOVConfigVideoFix
;
211 class MOVConfigVideoFixBitrate
;
212 class MOVConfigVideoFixQuant
;
213 class MOVConfigVideoCheckBox
;
216 class MOVConfigVideo
: public BC_Window
219 MOVConfigVideo(BC_WindowBase
*parent_window
,
221 int lock_compressor
);
224 int create_objects();
228 void update_parameters();
230 ArrayList
<BC_ListBoxItem
*> compression_items
;
231 MOVConfigVideoPopup
*compression_popup
;
232 BC_WindowBase
*parent_window
;
234 int param_x
, param_y
;
237 BC_ISlider
*jpeg_quality
;
238 BC_Title
*jpeg_quality_title
;
240 MOVConfigVideoNum
*ms_bitrate
;
241 MOVConfigVideoNum
*ms_bitrate_tolerance
;
242 MOVConfigVideoNum
*ms_quantization
;
243 MOVConfigVideoNum
*ms_gop_size
;
244 MOVConfigVideoCheckBox
*ms_interlaced
;
245 MOVConfigVideoFixBitrate
*ms_fix_bitrate
;
246 MOVConfigVideoFixQuant
*ms_fix_quant
;
248 MOVConfigVideoNum
*divx_bitrate
;
249 MOVConfigVideoNum
*divx_quantizer
;
250 MOVConfigVideoNum
*divx_rc_period
;
251 MOVConfigVideoNum
*divx_rc_reaction_ratio
;
252 MOVConfigVideoNum
*divx_rc_reaction_period
;
253 MOVConfigVideoNum
*divx_max_key_interval
;
254 MOVConfigVideoNum
*divx_max_quantizer
;
255 MOVConfigVideoNum
*divx_min_quantizer
;
256 MOVConfigVideoNum
*divx_quality
;
257 MOVConfigVideoFixBitrate
*divx_fix_bitrate
;
258 MOVConfigVideoFixQuant
*divx_fix_quant
;
261 class MOVConfigVideoPopup
: public BC_PopupTextBox
264 MOVConfigVideoPopup(MOVConfigVideo
*popup
, int x
, int y
);
266 MOVConfigVideo
*popup
;
269 class MOVConfigVideoFixBitrate
: public BC_Radial
272 MOVConfigVideoFixBitrate(int x
,
282 class MOVConfigVideoFixQuant
: public BC_Radial
285 MOVConfigVideoFixQuant(int x
,
295 class MOVConfigVideoCheckBox
: public BC_CheckBox
298 MOVConfigVideoCheckBox(char *title_text
,
306 class MOVConfigVideoNum
: public BC_TumbleTextBox
309 MOVConfigVideoNum(MOVConfigVideo
*popup
,
314 ~MOVConfigVideoNum();
316 void create_objects();
319 MOVConfigVideo
*popup
;