11 /* This is the reference for all your library entry points. */
18 /* ===== compression formats for which codecs exist ====== */
21 #define QUICKTIME_DIVX "DIVX"
23 /* Basterdization of MPEG-4 which encodes alternating fields in series */
25 #define QUICKTIME_HV60 "HV60"
27 /* McRoesoft MPEG-4 */
28 #define QUICKTIME_DIV3 "DIV3"
29 #define QUICKTIME_DIV3_LOWER "div3"
32 #define QUICKTIME_SVQ1 "SVQ1"
35 #define QUICKTIME_DV "dvc "
36 #define QUICKTIME_DVSD "dvsd"
38 /* RGB uncompressed. Allows alpha */
39 #define QUICKTIME_RAW "raw "
42 #define QUICKTIME_JPEG "jpeg"
44 /* Concatenated png images. Allows alpha */
45 #define QUICKTIME_PNG "png "
48 #define QUICKTIME_MJPA "mjpa"
51 #define QUICKTIME_YUV2 "yuv2"
53 /* Crazy YUV 4:2:0 configuration for early tests. NOT STANDARD. */
54 #define QUICKTIME_YUV4 "yuv4"
56 /* The following don't seem to work in Win but are documented. Only use
57 for intermediate storage since the documentation may be wrong. */
58 /* 8 bit Planar YUV 4:2:0 */
59 #define QUICKTIME_YUV420 "yv12"
61 /* 8 bit Planar YUV 4:1:1 */
62 #define QUICKTIME_YUV411 "y411"
64 /* 8 bit Packed YUV 4:2:2 */
65 #define QUICKTIME_YUV422 "yuv2"
67 /* 8 bit Planar YUV 4:4:4 */
68 #define QUICKTIME_YUV444 "v308"
70 /* 8 bit Planar YUVA 4:4:4:4 */
71 #define QUICKTIME_YUVA4444 "v408"
73 /* 10 bit Planar YUV 4:4:4 */
74 #define QUICKTIME_YUV444_10bit "v410"
76 /* ======== compression for which no codec exists ========== */
77 /* These are traditionally converted in hardware or not at all */
78 /* ======== Studies in different algorithms =============== */
80 /* YUV9. Too horrible to look at. */
81 #define QUICKTIME_YUV9 "YVU9"
83 /* RTjpeg, proprietary but fast? */
84 /* This is theoretically what nipple video uses. May get integrated later. */
85 #define QUICKTIME_RTJ0 "RTJ0"
87 /* =================== Audio formats ======================= */
89 /* Unsigned 8 bit but it uses the same fourcc as RGB uncompressed */
91 #define QUICKTIME_RAW "raw "
95 #define QUICKTIME_IMA4 "ima4"
97 /* Twos compliment 8, 16, 24 */
98 #define QUICKTIME_TWOS "twos"
101 #define QUICKTIME_ULAW "ulaw"
103 /* OGG Vorbis. NOT STANDARD */
104 #define QUICKTIME_VORBIS "OggS"
106 /* MP3 Doesn't play in Win for some reason */
107 #define QUICKTIME_MP3 ".mp3"
110 /* AVI decode only */
111 #define QUICKTIME_WMA "WMA "
113 /* Some crazy derivative on ima4. NOT STANDARD */
114 #define QUICKTIME_WMX2 "wmx2"
116 /* =========================== public interface ========================= */
118 /* Get version information */
119 int quicktime_major(void);
120 int quicktime_minor(void);
121 int quicktime_release(void);
123 /* return 1 if the file is a quicktime file */
124 int quicktime_check_sig(char *path
);
126 /* call this first to open the file and create all the objects */
127 quicktime_t
* quicktime_open(char *filename
, int rd
, int wr
);
129 /* After quicktime_open and quicktime_set for the audio and video call this */
130 /* to generate a Microsoft AVI file. */
131 /* The allmighty requires the codec information in the beginning of the file */
132 /* while the index can either be in the beginning or the end. Thus */
133 /* You need to set the audio and video first. */
134 void quicktime_set_avi(quicktime_t
*file
, int value
);
135 int quicktime_is_avi(quicktime_t
*file
);
137 /* Another Microsoft file format */
138 void quicktime_set_asf(quicktime_t
*file
, int value
);
141 /* make the quicktime file streamable */
142 int quicktime_make_streamable(char *in_path
, char *out_path
);
144 /* Set various options in the file. */
145 void quicktime_set_copyright(quicktime_t
*file
, char *string
);
146 void quicktime_set_name(quicktime_t
*file
, char *string
);
147 void quicktime_set_info(quicktime_t
*file
, char *string
);
148 char* quicktime_get_copyright(quicktime_t
*file
);
149 char* quicktime_get_name(quicktime_t
*file
);
150 char* quicktime_get_info(quicktime_t
*file
);
152 /* Read all the information about the file. */
153 /* Requires a MOOV atom be present in the file. */
154 /* If no MOOV atom exists return 1 else return 0. */
155 int quicktime_read_info(quicktime_t
*file
);
157 /* set up tracks in a new file after opening and before writing */
158 /* returns the number of quicktime tracks allocated */
159 /* audio is stored two channels per quicktime track */
160 int quicktime_set_audio(quicktime_t
*file
,
165 /* Samplerate can be set after file is created */
166 void quicktime_set_framerate(quicktime_t
*file
, double framerate
);
168 /* video is stored one layer per quicktime track */
169 int quicktime_set_video(quicktime_t
*file
,
176 /* routines for setting various video parameters */
177 /* should be called after set_video */
178 void quicktime_set_jpeg(quicktime_t
*file
, int quality
, int use_float
);
180 /* Configure codec parameters with this */
181 /* It iterates through every track and sets the key in that codec to */
182 /* the value. The value can be any data type and the key must be a */
183 /* string which the codec understands. */
184 void quicktime_set_parameter(quicktime_t
*file
, char *key
, void *value
);
186 /* Set the depth of the track. */
187 void quicktime_set_depth(quicktime_t
*file
,
192 /* close the file and delete all the objects */
193 int quicktime_close(quicktime_t
*file
);
195 /* get length information */
196 long quicktime_audio_length(quicktime_t
*file
, int track
);
197 long quicktime_video_length(quicktime_t
*file
, int track
);
199 /* get position information */
200 long quicktime_audio_position(quicktime_t
*file
, int track
);
201 long quicktime_video_position(quicktime_t
*file
, int track
);
203 /* get file information */
204 int quicktime_video_tracks(quicktime_t
*file
);
205 int quicktime_audio_tracks(quicktime_t
*file
);
207 int quicktime_has_audio(quicktime_t
*file
);
209 /* Get the samples per second */
210 long quicktime_sample_rate(quicktime_t
*file
, int track
);
212 /* Get the number of bits for the twos codec */
213 int quicktime_audio_bits(quicktime_t
*file
, int track
);
215 /* Get the number of audio channels in an audio track */
216 int quicktime_track_channels(quicktime_t
*file
, int track
);
217 char* quicktime_audio_compressor(quicktime_t
*file
, int track
);
219 int quicktime_has_video(quicktime_t
*file
);
220 int quicktime_video_width(quicktime_t
*file
, int track
);
221 int quicktime_video_height(quicktime_t
*file
, int track
);
223 /* Number of bytes per pixel for the raw codec */
224 int quicktime_video_depth(quicktime_t
*file
, int track
);
226 /* Frames per second */
227 double quicktime_frame_rate(quicktime_t
*file
, int track
);
229 /* FourCC of the video compressor */
230 char* quicktime_video_compressor(quicktime_t
*file
, int track
);
232 /* number of bytes of raw data in this frame */
233 long quicktime_frame_size(quicktime_t
*file
, long frame
, int track
);
235 /* get the quicktime track and channel that the audio channel belongs to */
236 /* channels and tracks start on 0 */
237 int quicktime_channel_location(quicktime_t
*file
, int *quicktime_track
, int *quicktime_channel
, int channel
);
239 /* file positioning */
240 int quicktime_seek_end(quicktime_t
*file
);
241 int quicktime_seek_start(quicktime_t
*file
);
243 /* set position of file descriptor relative to a track */
244 int quicktime_set_audio_position(quicktime_t
*file
, int64_t sample
, int track
);
245 int quicktime_set_video_position(quicktime_t
*file
, int64_t frame
, int track
);
247 /* ========================== Access to raw data follows. */
248 /* write data for one quicktime track */
249 /* the user must handle conversion to the channels in this track */
251 * int quicktime_write_audio(quicktime_t *file,
252 * char *audio_buffer,
256 int quicktime_write_frame(quicktime_t
*file
,
257 unsigned char *video_buffer
,
261 /* Read an entire chunk. */
262 /* read the number of bytes starting at the byte_start in the specified chunk */
263 /* You must provide enough space to store the chunk. */
264 int quicktime_read_chunk(quicktime_t
*file
, char *output
, int track
, int64_t chunk
, int64_t byte_start
, int64_t byte_len
);
267 long quicktime_read_audio(quicktime_t
*file
, char *audio_buffer
, long samples
, int track
);
268 long quicktime_read_frame(quicktime_t
*file
, unsigned char *video_buffer
, int track
);
270 /* for reading frame using a library that needs a file descriptor */
271 /* Frame caching doesn't work here. */
272 int quicktime_read_frame_init(quicktime_t
*file
, int track
);
273 int quicktime_read_frame_end(quicktime_t
*file
, int track
);
275 /* One keyframe table for each track */
276 /* Returns -1 if no keyframe exists. In AVI this always returns -1 */
277 /* if the frame offset is over 1 Gig. McRowsoft you know. */
278 long quicktime_get_keyframe_before(quicktime_t
*file
, long frame
, int track
);
279 long quicktime_get_keyframe_after(quicktime_t
*file
, long frame
, int track
);
280 void quicktime_insert_keyframe(quicktime_t
*file
, long frame
, int track
);
282 /* Track has keyframes */
283 int quicktime_has_keyframes(quicktime_t
*file
, int track
);
285 /* ===================== Access to built in codecs follows. */
287 /* If the codec for this track is supported in the library return 1. */
288 int quicktime_supported_video(quicktime_t
*file
, int track
);
289 int quicktime_supported_audio(quicktime_t
*file
, int track
);
293 /* The codecs can all support RGB in and out. */
294 /* To find out if other color models are supported, use these functions. */
295 /* The codec can generate the color model with no downsampling */
296 int quicktime_reads_cmodel(quicktime_t
*file
,
300 /* The codec can write the color model with no upsampling */
301 int quicktime_writes_cmodel(quicktime_t
*file
,
306 /* Utilities for direct copy of MPEG-4 */
307 int quicktime_mpeg4_is_key(unsigned char *data
, long size
, char *codec_id
);
308 int quicktime_mpeg4_write_vol(unsigned char *data_start
,
311 int time_increment_resolution
,
313 int quicktime_mpeg4_has_vol(unsigned char *data
);
323 /* These should be called right before a decode or encode function */
324 /* Set the colormodel for the encoder and decoder interface */
325 void quicktime_set_cmodel(quicktime_t
*file
, int colormodel
);
327 /* Set row span in bytes for the encoder and decoder interface */
328 void quicktime_set_row_span(quicktime_t
*file
, int row_span
);
330 /* Set the decoding window for the decoder interface. If the dimensions are */
331 /* all -1, no scaling is used. The default is no scaling. */
332 void quicktime_set_window(quicktime_t
*file
,
333 int in_x
, /* Location of input frame to take picture */
337 int out_w
, /* Dimensions of output frame */
340 /* Encode the frame into a frame buffer. */
341 int quicktime_encode_video(quicktime_t
*file
,
342 unsigned char **row_pointers
,
346 long quicktime_decode_video(quicktime_t
*file
,
347 unsigned char **row_pointers
,
350 /* Decode or encode audio for a single channel into the buffer. */
351 /* Pass a buffer for the _i or the _f argument if you want int16 or float data. */
352 /* Notice that encoding requires an array of pointers to each channel. */
353 int quicktime_decode_audio(quicktime_t
*file
,
358 int quicktime_encode_audio(quicktime_t
*file
,
369 /* Dump the file structures for the currently opened file. */
370 int quicktime_dump(quicktime_t
*file
);
372 /* Specify the number of cpus to utilize. */
373 int quicktime_set_cpus(quicktime_t
*file
, int cpus
);
375 /* Specify whether to read contiguously or not. */
376 /* preload is the number of bytes to read ahead. */
377 /* This is no longer functional to the end user but is used to accelerate */
378 /* reading the header internally. */
379 void quicktime_set_preload(quicktime_t
*file
, int64_t preload
);
381 int64_t quicktime_byte_position(quicktime_t
*file
);