r955: Fix the Diffkey icon.
[cinelerra_cv.git] / quicktime / quicktime.h
blob7dbd41f5456ddad26ce4f198ec794f0f872b8722
1 #ifndef QUICKTIME_H
2 #define QUICKTIME_H
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
9 #include "qtprivate.h"
11 /* This is the reference for all your library entry points. */
18 /* ===== compression formats for which codecs exist ====== */
20 /* Straight MPEG-4 */
21 #define QUICKTIME_DX50 "DX50"
22 #define QUICKTIME_MPG4 "MPG4"
23 #define QUICKTIME_MP42 "MP42"
24 #define QUICKTIME_DIVX "DIVX"
25 #define QUICKTIME_XVID "XVID"
26 #define QUICKTIME_MP4V "mp4v"
28 #define QUICKTIME_H264 "avc1"
31 /* Basterdization of MPEG-4 which encodes alternating fields in series */
32 /* NOT STANDARD */
33 #define QUICKTIME_HV60 "HV60"
34 /* Basterdization of H264 which encodes alternating fields in series */
35 /* NOT STANDARD */
36 #define QUICKTIME_HV64 "HV64"
38 /* McRoesoft MPEG-4 */
39 #define QUICKTIME_DIV3 "DIV3"
40 #define QUICKTIME_DIV3_LOWER "div3"
42 /* Mormon MPEG-4 */
43 #define QUICKTIME_SVQ1 "SVQ1"
44 #define QUICKTIME_SVQ3 "SVQ3"
45 #define QUICKTIME_H263 "h263"
47 /* Dee Vee */
48 #define QUICKTIME_DV "dvc "
49 #define QUICKTIME_DV25 "dv25"
50 #define QUICKTIME_DVSD "dvsd"
51 #define QUICKTIME_DVCP "dvcp" // PAL video inside Quicktime
53 /* RGB uncompressed. Allows alpha */
54 #define QUICKTIME_RAW "raw "
56 /* Jpeg Photo */
57 #define QUICKTIME_JPEG "jpeg"
59 /* Concatenated png images. Allows alpha */
60 #define QUICKTIME_PNG "png "
62 /* Motion JPEG-A. */
63 #define QUICKTIME_MJPA "mjpa"
65 /* YUV 4:2:2 */
66 #define QUICKTIME_YUV2 "yuv2"
68 /* 8 bit Packed YUV (video range) 4:2:2 */
69 #define QUICKTIME_2VUY "2vuy"
71 /* Crazy YUV 4:2:0 configuration for early tests. NOT STANDARD. */
72 #define QUICKTIME_YUV4 "yuv4"
74 /* The following don't seem to work in Win but are documented. Only use
75 for intermediate storage since the documentation may be wrong. */
76 /* 8 bit Planar YUV 4:2:0 */
77 #define QUICKTIME_YUV420 "yv12"
79 /* 8 bit Planar YUV 4:1:1 */
80 #define QUICKTIME_YUV411 "y411"
82 /* 8 bit Packed YUV 4:2:2 */
83 #define QUICKTIME_YUV422 "yuv2"
85 /* 8 bit Planar YUV 4:4:4 */
86 #define QUICKTIME_YUV444 "v308"
88 /* 8 bit Planar YUVA 4:4:4:4 */
89 #define QUICKTIME_YUVA4444 "v408"
91 /* 10 bit Planar YUV 4:4:4 */
92 #define QUICKTIME_YUV444_10bit "v410"
94 /* ======== compression for which no codec exists ========== */
95 /* These are traditionally converted in hardware or not at all */
96 /* ======== Studies in different algorithms =============== */
98 /* YUV9. Too horrible to look at. */
99 #define QUICKTIME_YUV9 "YVU9"
101 /* RTjpeg, proprietary but fast? */
102 /* This is theoretically what nipple video uses. May get integrated later. */
103 #define QUICKTIME_RTJ0 "RTJ0"
105 /* =================== Audio formats ======================= */
107 /* Unsigned 8 bit but it uses the same fourcc as RGB uncompressed */
108 #ifndef QUICKTIME_RAW
109 #define QUICKTIME_RAW "raw "
110 #endif
112 /* IMA4 */
113 #define QUICKTIME_IMA4 "ima4"
115 /* Twos compliment 8, 16, 24 */
116 #define QUICKTIME_TWOS "twos"
118 /* ulaw */
119 #define QUICKTIME_ULAW "ulaw"
121 /* OGG Vorbis. NOT STANDARD */
122 #define QUICKTIME_VORBIS "OggS"
124 /* MP3 Doesn't play in Win for some reason */
125 #define QUICKTIME_MP3 ".mp3"
127 #define QUICKTIME_MP4A "mp4a"
129 /* Mike Row Soft */
130 /* AVI decode only */
131 #define QUICKTIME_WMA "WMA "
133 /* Some crazy derivative on ima4. NOT STANDARD */
134 #define QUICKTIME_WMX2 "wmx2"
136 /* =========================== public interface ========================= */
138 /* Get version information */
139 int quicktime_major(void);
140 int quicktime_minor(void);
141 int quicktime_release(void);
143 /* return 1 if the file is a quicktime file */
144 int quicktime_check_sig(char *path);
146 /* call this first to open the file and create all the objects */
147 quicktime_t* quicktime_open(char *filename, int rd, int wr);
149 /* After quicktime_open and quicktime_set for the audio and video call this */
150 /* to generate a Microsoft AVI file. */
151 /* The allmighty requires the codec information in the beginning of the file */
152 /* while the index can either be in the beginning or the end. Thus */
153 /* You need to set the audio and video first. */
154 void quicktime_set_avi(quicktime_t *file, int value);
155 int quicktime_is_avi(quicktime_t *file);
157 /* Another Microsoft file format */
158 void quicktime_set_asf(quicktime_t *file, int value);
161 /* make the quicktime file streamable */
162 int quicktime_make_streamable(char *in_path, char *out_path);
164 /* Set various options in the file. */
165 void quicktime_set_copyright(quicktime_t *file, char *string);
166 void quicktime_set_name(quicktime_t *file, char *string);
167 void quicktime_set_info(quicktime_t *file, char *string);
168 char* quicktime_get_copyright(quicktime_t *file);
169 char* quicktime_get_name(quicktime_t *file);
170 char* quicktime_get_info(quicktime_t *file);
172 /* Read all the information about the file. */
173 /* Requires a MOOV atom be present in the file. */
174 /* If no MOOV atom exists return 1 else return 0. */
175 int quicktime_read_info(quicktime_t *file);
177 /* set up tracks in a new file after opening and before writing */
178 /* returns the number of quicktime tracks allocated */
179 /* audio is stored two channels per quicktime track */
180 int quicktime_set_audio(quicktime_t *file,
181 int channels,
182 long sample_rate,
183 int bits,
184 char *compressor);
185 /* Samplerate can be set after file is created */
186 void quicktime_set_framerate(quicktime_t *file, double framerate);
188 /* Set aspect ratio. Only a few codecs support it. */
189 void quicktime_set_aspect(quicktime_t *file, double aspect);
191 /* video is stored one layer per quicktime track */
192 int quicktime_set_video(quicktime_t *file,
193 int tracks,
194 int frame_w,
195 int frame_h,
196 double frame_rate,
197 char *compressor);
199 /* routines for setting various video parameters */
200 /* should be called after set_video */
201 void quicktime_set_jpeg(quicktime_t *file, int quality, int use_float);
203 /* Configure codec parameters with this */
204 /* It iterates through every track and sets the key in that codec to */
205 /* the value. The value can be any data type and the key must be a */
206 /* string which the codec understands. */
207 void quicktime_set_parameter(quicktime_t *file, char *key, void *value);
209 /* Get the english title of a codec based on its fourcc. */
210 /* Used by info boxed. */
211 char* quicktime_acodec_title(char *fourcc);
212 char* quicktime_vcodec_title(char *fourcc);
215 /* Set the depth of the track. */
216 void quicktime_set_depth(quicktime_t *file,
217 int depth,
218 int track);
221 /* close the file and delete all the objects */
222 int quicktime_close(quicktime_t *file);
224 /* get length information */
225 long quicktime_audio_length(quicktime_t *file, int track);
226 long quicktime_video_length(quicktime_t *file, int track);
228 /* get position information */
229 long quicktime_audio_position(quicktime_t *file, int track);
230 long quicktime_video_position(quicktime_t *file, int track);
232 /* get file information */
233 int quicktime_video_tracks(quicktime_t *file);
234 int quicktime_audio_tracks(quicktime_t *file);
236 int quicktime_has_audio(quicktime_t *file);
238 /* Get the samples per second */
239 long quicktime_sample_rate(quicktime_t *file, int track);
241 /* Get the number of bits for the twos codec */
242 int quicktime_audio_bits(quicktime_t *file, int track);
244 /* Get the number of audio channels in an audio track */
245 int quicktime_track_channels(quicktime_t *file, int track);
246 char* quicktime_audio_compressor(quicktime_t *file, int track);
248 int quicktime_has_video(quicktime_t *file);
249 int quicktime_video_width(quicktime_t *file, int track);
250 int quicktime_video_height(quicktime_t *file, int track);
252 /* Number of bytes per pixel for the raw codec */
253 int quicktime_video_depth(quicktime_t *file, int track);
255 /* The interlace mode */
256 int quicktime_video_interlacemode(quicktime_t *file, int track);
258 /* Frames per second */
259 double quicktime_frame_rate(quicktime_t *file, int track);
260 /* Frames per second as numerator over denominator*/
261 int quicktime_frame_rate_n(quicktime_t *file, int track);
262 int quicktime_frame_rate_d(quicktime_t *file, int track);
264 /* FourCC of the video compressor */
265 char* quicktime_video_compressor(quicktime_t *file, int track);
267 /* number of bytes of raw data in this frame */
268 long quicktime_frame_size(quicktime_t *file, long frame, int track);
270 /* get the quicktime track and channel that the audio channel belongs to */
271 /* channels and tracks start on 0 */
272 int quicktime_channel_location(quicktime_t *file, int *quicktime_track, int *quicktime_channel, int channel);
274 /* file positioning */
275 int quicktime_seek_end(quicktime_t *file);
276 int quicktime_seek_start(quicktime_t *file);
278 /* set position of file descriptor relative to a track */
279 int quicktime_set_audio_position(quicktime_t *file, int64_t sample, int track);
280 int quicktime_set_video_position(quicktime_t *file, int64_t frame, int track);
282 /* ========================== Access to raw data follows. */
283 /* write data for one quicktime track */
284 /* the user must handle conversion to the channels in this track */
286 * int quicktime_write_audio(quicktime_t *file,
287 * char *audio_buffer,
288 * long samples,
289 * int track);
291 int quicktime_write_frame(quicktime_t *file,
292 unsigned char *video_buffer,
293 int64_t bytes,
294 int track);
296 /* Read an entire chunk. */
297 /* read the number of bytes starting at the byte_start in the specified chunk */
298 /* You must provide enough space to store the chunk. */
299 int quicktime_read_chunk(quicktime_t *file, char *output, int track, int64_t chunk, int64_t byte_start, int64_t byte_len);
301 /* read raw data */
302 long quicktime_read_audio(quicktime_t *file, char *audio_buffer, long samples, int track);
303 long quicktime_read_frame(quicktime_t *file, unsigned char *video_buffer, int track);
305 /* for reading frame using a library that needs a file descriptor */
306 /* Frame caching doesn't work here. */
307 int quicktime_read_frame_init(quicktime_t *file, int track);
308 int quicktime_read_frame_end(quicktime_t *file, int track);
310 /* One keyframe table for each track */
311 /* Returns -1 if no keyframe exists. In AVI this always returns -1 */
312 /* if the frame offset is over 1 Gig. McRowsoft you know. */
313 int64_t quicktime_get_keyframe_before(quicktime_t *file, int64_t frame, int track);
314 int64_t quicktime_get_keyframe_after(quicktime_t *file, int64_t frame, int track);
315 void quicktime_insert_keyframe(quicktime_t *file, int64_t frame, int track);
317 /* Track has keyframes */
318 int quicktime_has_keyframes(quicktime_t *file, int track);
320 /* ===================== Access to built in codecs follows. */
322 /* If the codec for this track is supported in the library return 1. */
323 int quicktime_supported_video(quicktime_t *file, int track);
324 int quicktime_supported_audio(quicktime_t *file, int track);
328 /* The codecs can all support RGB in and out. */
329 /* To find out if other color models are supported, use these functions. */
330 /* Returns 1 if the codec can generate the color model with no conversion */
331 int quicktime_reads_cmodel(quicktime_t *file,
332 int colormodel,
333 int track);
335 /* Returns 1 if the codec can write the color model with no conversion */
336 int quicktime_writes_cmodel(quicktime_t *file,
337 int colormodel,
338 int track);
341 /* Utilities for direct copy of MPEG-4 */
342 int quicktime_mpeg4_is_key(unsigned char *data, long size, char *codec_id);
343 int quicktime_mpeg4_write_vol(unsigned char *data_start,
344 int vol_width,
345 int vol_height,
346 int time_increment_resolution,
347 double frame_rate);
348 int quicktime_mpeg4_has_vol(unsigned char *data);
350 /* Direct copy of H264 */
351 int quicktime_h264_is_key(unsigned char *data, long size, char *codec_id);
360 /* These should be called right before a decode or encode function */
361 /* Set the colormodel for the encoder and decoder interface */
362 void quicktime_set_cmodel(quicktime_t *file, int colormodel);
364 /* Set row span in bytes for the encoder and decoder interface */
365 void quicktime_set_row_span(quicktime_t *file, int row_span);
367 /* Set the decoding window for the decoder interface. If the dimensions are */
368 /* all -1, no scaling is used. The default is no scaling. */
369 void quicktime_set_window(quicktime_t *file,
370 int in_x, /* Location of input frame to take picture */
371 int in_y,
372 int in_w,
373 int in_h,
374 int out_w, /* Dimensions of output frame */
375 int out_h);
377 /* Encode the frame into a frame buffer. */
378 int quicktime_encode_video(quicktime_t *file,
379 unsigned char **row_pointers,
380 int track);
382 /* Decode a frame */
383 long quicktime_decode_video(quicktime_t *file,
384 unsigned char **row_pointers,
385 int track);
387 /* Get memory used by video decoders. Only counts frame caches. */
388 int64_t quicktime_memory_usage(quicktime_t *file);
390 /* Decode or encode audio for a single channel into the buffer. */
391 /* Pass a buffer for the _i or the _f argument if you want int16 or float data. */
392 /* Notice that encoding requires an array of pointers to each channel. */
393 int quicktime_decode_audio(quicktime_t *file,
394 int16_t *output_i,
395 float *output_f,
396 long samples,
397 int channel);
398 int quicktime_encode_audio(quicktime_t *file,
399 int16_t **input_i,
400 float **input_f,
401 long samples);
409 /* Dump the file structures for the currently opened file. */
410 int quicktime_dump(quicktime_t *file);
412 /* Specify the number of cpus to utilize. */
413 int quicktime_set_cpus(quicktime_t *file, int cpus);
415 /* Specify whether to read contiguously or not. */
416 /* preload is the number of bytes to read ahead. */
417 /* This is no longer functional to the end user but is used to accelerate */
418 /* reading the header internally. */
419 void quicktime_set_preload(quicktime_t *file, int64_t preload);
421 int64_t quicktime_byte_position(quicktime_t *file);
423 /* Set frame offset for programme timecode */
424 void quicktime_set_frame_start(quicktime_t *file, int64_t value);
428 #ifdef __cplusplus
430 #endif
432 #endif