11 /* This is the reference for all your library entry points. */
18 /* ===== compression formats for which codecs exist ====== */
21 #define QUICKTIME_DX50 "DX50"
22 #define QUICKTIME_MPG4 "MPG4"
23 #define QUICKTIME_MP42 "MP42"
24 #define QUICKTIME_DIVX "DIVX"
25 #define QUICKTIME_MP4V "mp4v"
27 /* Basterdization of MPEG-4 which encodes alternating fields in series */
29 #define QUICKTIME_HV60 "HV60"
31 /* McRoesoft MPEG-4 */
32 #define QUICKTIME_DIV3 "DIV3"
33 #define QUICKTIME_DIV3_LOWER "div3"
36 #define QUICKTIME_SVQ1 "SVQ1"
37 #define QUICKTIME_SVQ3 "SVQ3"
38 #define QUICKTIME_H263 "h263"
41 #define QUICKTIME_DV "dvc "
42 #define QUICKTIME_DV25 "dv25"
43 #define QUICKTIME_DVSD "dvsd"
45 /* RGB uncompressed. Allows alpha */
46 #define QUICKTIME_RAW "raw "
49 #define QUICKTIME_JPEG "jpeg"
51 /* Concatenated png images. Allows alpha */
52 #define QUICKTIME_PNG "png "
55 #define QUICKTIME_MJPA "mjpa"
58 #define QUICKTIME_YUV2 "yuv2"
60 /* Crazy YUV 4:2:0 configuration for early tests. NOT STANDARD. */
61 #define QUICKTIME_YUV4 "yuv4"
63 /* The following don't seem to work in Win but are documented. Only use
64 for intermediate storage since the documentation may be wrong. */
65 /* 8 bit Planar YUV 4:2:0 */
66 #define QUICKTIME_YUV420 "yv12"
68 /* 8 bit Planar YUV 4:1:1 */
69 #define QUICKTIME_YUV411 "y411"
71 /* 8 bit Packed YUV 4:2:2 */
72 #define QUICKTIME_YUV422 "yuv2"
74 /* 8 bit Planar YUV 4:4:4 */
75 #define QUICKTIME_YUV444 "v308"
77 /* 8 bit Planar YUVA 4:4:4:4 */
78 #define QUICKTIME_YUVA4444 "v408"
80 /* 10 bit Planar YUV 4:4:4 */
81 #define QUICKTIME_YUV444_10bit "v410"
83 /* ======== compression for which no codec exists ========== */
84 /* These are traditionally converted in hardware or not at all */
85 /* ======== Studies in different algorithms =============== */
87 /* YUV9. Too horrible to look at. */
88 #define QUICKTIME_YUV9 "YVU9"
90 /* RTjpeg, proprietary but fast? */
91 /* This is theoretically what nipple video uses. May get integrated later. */
92 #define QUICKTIME_RTJ0 "RTJ0"
94 /* =================== Audio formats ======================= */
96 /* Unsigned 8 bit but it uses the same fourcc as RGB uncompressed */
98 #define QUICKTIME_RAW "raw "
102 #define QUICKTIME_IMA4 "ima4"
104 /* Twos compliment 8, 16, 24 */
105 #define QUICKTIME_TWOS "twos"
108 #define QUICKTIME_ULAW "ulaw"
110 /* OGG Vorbis. NOT STANDARD */
111 #define QUICKTIME_VORBIS "OggS"
113 /* MP3 Doesn't play in Win for some reason */
114 #define QUICKTIME_MP3 ".mp3"
116 #define QUICKTIME_MP4A "mp4a"
119 /* AVI decode only */
120 #define QUICKTIME_WMA "WMA "
122 /* Some crazy derivative on ima4. NOT STANDARD */
123 #define QUICKTIME_WMX2 "wmx2"
125 /* =========================== public interface ========================= */
127 /* Get version information */
128 int quicktime_major(void);
129 int quicktime_minor(void);
130 int quicktime_release(void);
132 /* return 1 if the file is a quicktime file */
133 int quicktime_check_sig(char *path
);
135 /* call this first to open the file and create all the objects */
136 quicktime_t
* quicktime_open(char *filename
, int rd
, int wr
);
138 /* After quicktime_open and quicktime_set for the audio and video call this */
139 /* to generate a Microsoft AVI file. */
140 /* The allmighty requires the codec information in the beginning of the file */
141 /* while the index can either be in the beginning or the end. Thus */
142 /* You need to set the audio and video first. */
143 void quicktime_set_avi(quicktime_t
*file
, int value
);
144 int quicktime_is_avi(quicktime_t
*file
);
146 /* Another Microsoft file format */
147 void quicktime_set_asf(quicktime_t
*file
, int value
);
150 /* make the quicktime file streamable */
151 int quicktime_make_streamable(char *in_path
, char *out_path
);
153 /* Set various options in the file. */
154 void quicktime_set_copyright(quicktime_t
*file
, char *string
);
155 void quicktime_set_name(quicktime_t
*file
, char *string
);
156 void quicktime_set_info(quicktime_t
*file
, char *string
);
157 char* quicktime_get_copyright(quicktime_t
*file
);
158 char* quicktime_get_name(quicktime_t
*file
);
159 char* quicktime_get_info(quicktime_t
*file
);
161 /* Read all the information about the file. */
162 /* Requires a MOOV atom be present in the file. */
163 /* If no MOOV atom exists return 1 else return 0. */
164 int quicktime_read_info(quicktime_t
*file
);
166 /* set up tracks in a new file after opening and before writing */
167 /* returns the number of quicktime tracks allocated */
168 /* audio is stored two channels per quicktime track */
169 int quicktime_set_audio(quicktime_t
*file
,
174 /* Samplerate can be set after file is created */
175 void quicktime_set_framerate(quicktime_t
*file
, double framerate
);
177 /* video is stored one layer per quicktime track */
178 int quicktime_set_video(quicktime_t
*file
,
185 /* routines for setting various video parameters */
186 /* should be called after set_video */
187 void quicktime_set_jpeg(quicktime_t
*file
, int quality
, int use_float
);
189 /* Configure codec parameters with this */
190 /* It iterates through every track and sets the key in that codec to */
191 /* the value. The value can be any data type and the key must be a */
192 /* string which the codec understands. */
193 void quicktime_set_parameter(quicktime_t
*file
, char *key
, void *value
);
195 /* Get the english title of a codec based on its fourcc. */
196 /* Used by info boxed. */
197 char* quicktime_acodec_title(char *fourcc
);
198 char* quicktime_vcodec_title(char *fourcc
);
201 /* Set the depth of the track. */
202 void quicktime_set_depth(quicktime_t
*file
,
207 /* close the file and delete all the objects */
208 int quicktime_close(quicktime_t
*file
);
210 /* get length information */
211 long quicktime_audio_length(quicktime_t
*file
, int track
);
212 long quicktime_video_length(quicktime_t
*file
, int track
);
214 /* get position information */
215 long quicktime_audio_position(quicktime_t
*file
, int track
);
216 long quicktime_video_position(quicktime_t
*file
, int track
);
218 /* get file information */
219 int quicktime_video_tracks(quicktime_t
*file
);
220 int quicktime_audio_tracks(quicktime_t
*file
);
222 int quicktime_has_audio(quicktime_t
*file
);
224 /* Get the samples per second */
225 long quicktime_sample_rate(quicktime_t
*file
, int track
);
227 /* Get the number of bits for the twos codec */
228 int quicktime_audio_bits(quicktime_t
*file
, int track
);
230 /* Get the number of audio channels in an audio track */
231 int quicktime_track_channels(quicktime_t
*file
, int track
);
232 char* quicktime_audio_compressor(quicktime_t
*file
, int track
);
234 int quicktime_has_video(quicktime_t
*file
);
235 int quicktime_video_width(quicktime_t
*file
, int track
);
236 int quicktime_video_height(quicktime_t
*file
, int track
);
238 /* Number of bytes per pixel for the raw codec */
239 int quicktime_video_depth(quicktime_t
*file
, int track
);
241 /* The interlace mode */
242 int quicktime_video_interlacemode(quicktime_t
*file
, int track
);
244 /* Frames per second */
245 double quicktime_frame_rate(quicktime_t
*file
, int track
);
247 /* FourCC of the video compressor */
248 char* quicktime_video_compressor(quicktime_t
*file
, int track
);
250 /* number of bytes of raw data in this frame */
251 long quicktime_frame_size(quicktime_t
*file
, long frame
, int track
);
253 /* get the quicktime track and channel that the audio channel belongs to */
254 /* channels and tracks start on 0 */
255 int quicktime_channel_location(quicktime_t
*file
, int *quicktime_track
, int *quicktime_channel
, int channel
);
257 /* file positioning */
258 int quicktime_seek_end(quicktime_t
*file
);
259 int quicktime_seek_start(quicktime_t
*file
);
261 /* set position of file descriptor relative to a track */
262 int quicktime_set_audio_position(quicktime_t
*file
, int64_t sample
, int track
);
263 int quicktime_set_video_position(quicktime_t
*file
, int64_t frame
, int track
);
265 /* ========================== Access to raw data follows. */
266 /* write data for one quicktime track */
267 /* the user must handle conversion to the channels in this track */
269 * int quicktime_write_audio(quicktime_t *file,
270 * char *audio_buffer,
274 int quicktime_write_frame(quicktime_t
*file
,
275 unsigned char *video_buffer
,
279 /* Read an entire chunk. */
280 /* read the number of bytes starting at the byte_start in the specified chunk */
281 /* You must provide enough space to store the chunk. */
282 int quicktime_read_chunk(quicktime_t
*file
, char *output
, int track
, int64_t chunk
, int64_t byte_start
, int64_t byte_len
);
285 long quicktime_read_audio(quicktime_t
*file
, char *audio_buffer
, long samples
, int track
);
286 long quicktime_read_frame(quicktime_t
*file
, unsigned char *video_buffer
, int track
);
288 /* for reading frame using a library that needs a file descriptor */
289 /* Frame caching doesn't work here. */
290 int quicktime_read_frame_init(quicktime_t
*file
, int track
);
291 int quicktime_read_frame_end(quicktime_t
*file
, int track
);
293 /* One keyframe table for each track */
294 /* Returns -1 if no keyframe exists. In AVI this always returns -1 */
295 /* if the frame offset is over 1 Gig. McRowsoft you know. */
296 long quicktime_get_keyframe_before(quicktime_t
*file
, long frame
, int track
);
297 long quicktime_get_keyframe_after(quicktime_t
*file
, long frame
, int track
);
298 void quicktime_insert_keyframe(quicktime_t
*file
, long frame
, int track
);
300 /* Track has keyframes */
301 int quicktime_has_keyframes(quicktime_t
*file
, int track
);
303 /* ===================== Access to built in codecs follows. */
305 /* If the codec for this track is supported in the library return 1. */
306 int quicktime_supported_video(quicktime_t
*file
, int track
);
307 int quicktime_supported_audio(quicktime_t
*file
, int track
);
311 /* The codecs can all support RGB in and out. */
312 /* To find out if other color models are supported, use these functions. */
313 /* The codec can generate the color model with no downsampling */
314 int quicktime_reads_cmodel(quicktime_t
*file
,
318 /* The codec can write the color model with no upsampling */
319 int quicktime_writes_cmodel(quicktime_t
*file
,
324 /* Utilities for direct copy of MPEG-4 */
325 int quicktime_mpeg4_is_key(unsigned char *data
, long size
, char *codec_id
);
326 int quicktime_mpeg4_write_vol(unsigned char *data_start
,
329 int time_increment_resolution
,
331 int quicktime_mpeg4_has_vol(unsigned char *data
);
341 /* These should be called right before a decode or encode function */
342 /* Set the colormodel for the encoder and decoder interface */
343 void quicktime_set_cmodel(quicktime_t
*file
, int colormodel
);
345 /* Set row span in bytes for the encoder and decoder interface */
346 void quicktime_set_row_span(quicktime_t
*file
, int row_span
);
348 /* Set the decoding window for the decoder interface. If the dimensions are */
349 /* all -1, no scaling is used. The default is no scaling. */
350 void quicktime_set_window(quicktime_t
*file
,
351 int in_x
, /* Location of input frame to take picture */
355 int out_w
, /* Dimensions of output frame */
358 /* Encode the frame into a frame buffer. */
359 int quicktime_encode_video(quicktime_t
*file
,
360 unsigned char **row_pointers
,
364 long quicktime_decode_video(quicktime_t
*file
,
365 unsigned char **row_pointers
,
368 /* Decode or encode audio for a single channel into the buffer. */
369 /* Pass a buffer for the _i or the _f argument if you want int16 or float data. */
370 /* Notice that encoding requires an array of pointers to each channel. */
371 int quicktime_decode_audio(quicktime_t
*file
,
376 int quicktime_encode_audio(quicktime_t
*file
,
387 /* Dump the file structures for the currently opened file. */
388 int quicktime_dump(quicktime_t
*file
);
390 /* Specify the number of cpus to utilize. */
391 int quicktime_set_cpus(quicktime_t
*file
, int cpus
);
393 /* Specify whether to read contiguously or not. */
394 /* preload is the number of bytes to read ahead. */
395 /* This is no longer functional to the end user but is used to accelerate */
396 /* reading the header internally. */
397 void quicktime_set_preload(quicktime_t
*file
, int64_t preload
);
399 int64_t quicktime_byte_position(quicktime_t
*file
);
401 /* Set frame offset for programme timecode */
402 void quicktime_set_frame_start(quicktime_t
*file
, int64_t value
);