cinelerra  4.4
About: Cinelerra is an advanced non-linear video editor and compositor. Community version.
  Fossies Dox: cinelerra-4.4-src.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
quicktime.h
Go to the documentation of this file.
1 #ifndef QUICKTIME_H
2 #define QUICKTIME_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 
9 #include "qtprivate.h"
10 
11 /* This is the reference for all your library entry points. */
12 
13 
14 
15 
16 
17 
18 /* ===== compression formats for which codecs exist ====== */
19 
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"
27 
28 #define QUICKTIME_H264 "avc1"
29 
30 
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"
37 
38 /* McRoesoft MPEG-4 */
39 #define QUICKTIME_DIV3 "DIV3"
40 #define QUICKTIME_DIV3_LOWER "div3"
41 
42 /* Mormon MPEG-4 */
43 #define QUICKTIME_SVQ1 "SVQ1"
44 #define QUICKTIME_SVQ3 "SVQ3"
45 #define QUICKTIME_H263 "h263"
46 
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
52 
53 /* RGB uncompressed. Allows alpha */
54 #define QUICKTIME_RAW "raw "
55 
56 /* Jpeg Photo */
57 #define QUICKTIME_JPEG "jpeg"
58 #define QUICKTIME_MJPG "MJPG"
59 
60 /* Concatenated png images. Allows alpha */
61 #define QUICKTIME_PNG "png "
62 
63 /* Motion JPEG-A. */
64 #define QUICKTIME_MJPA "mjpa"
65 
66 /* YUV 4:2:2 */
67 #define QUICKTIME_YUV2 "yuv2"
68 
69 /* 8 bit Packed YUV (video range) 4:2:2 */
70 #define QUICKTIME_2VUY "2vuy"
71 
72 /* Crazy YUV 4:2:0 configuration for early tests. NOT STANDARD. */
73 #define QUICKTIME_YUV4 "yuv4"
74 
75 /* The following don't seem to work in Win but are documented. Only use
76  for intermediate storage since the documentation may be wrong. */
77 /* 8 bit Planar YUV 4:2:0 */
78 #define QUICKTIME_YUV420 "yv12"
79 
80 /* 8 bit Planar YUV 4:1:1 */
81 #define QUICKTIME_YUV411 "y411"
82 
83 /* 8 bit Packed YUV 4:2:2 */
84 #define QUICKTIME_YUV422 "yuv2"
85 
86 /* 8 bit Planar YUV 4:4:4 */
87 #define QUICKTIME_YUV444 "v308"
88 
89 /* 8 bit Planar YUVA 4:4:4:4 */
90 #define QUICKTIME_YUVA4444 "v408"
91 
92 /* 10 bit Planar YUV 4:4:4 */
93 #define QUICKTIME_YUV444_10bit "v410"
94 
95 /* ======== compression for which no codec exists ========== */
96 /* These are traditionally converted in hardware or not at all */
97 /* ======== Studies in different algorithms =============== */
98 
99 /* YUV9. Too horrible to look at. */
100 #define QUICKTIME_YUV9 "YVU9"
101 
102 /* RTjpeg, proprietary but fast? */
103 /* This is theoretically what nipple video uses. May get integrated later. */
104 #define QUICKTIME_RTJ0 "RTJ0"
105 
106 /* =================== Audio formats ======================= */
107 
108 /* Unsigned 8 bit but it uses the same fourcc as RGB uncompressed */
109 #ifndef QUICKTIME_RAW
110 #define QUICKTIME_RAW "raw "
111 #endif
112 
113 /* IMA4 */
114 #define QUICKTIME_IMA4 "ima4"
115 
116 /* Twos compliment 8, 16, 24 */
117 #define QUICKTIME_TWOS "twos"
118 
119 /* ulaw */
120 #define QUICKTIME_ULAW "ulaw"
121 
122 /* OGG Vorbis. NOT STANDARD */
123 #define QUICKTIME_VORBIS "OggS"
124 
125 /* MP3 Doesn't play in Win for some reason */
126 #define QUICKTIME_MP3 ".mp3"
127 
128 #define QUICKTIME_MP4A "mp4a"
129 #define QUICKTIME_QDM2 "QDM2"
130 
131 /* Mike Row Soft */
132 /* AVI decode only */
133 #define QUICKTIME_WMA "WMA "
134 
135 /* Some crazy derivative on ima4. NOT STANDARD */
136 #define QUICKTIME_WMX2 "wmx2"
137 
138 /* =========================== public interface ========================= */
139 
140 /* Get version information */
141 int quicktime_major(void);
142 int quicktime_minor(void);
143 int quicktime_release(void);
144 
145 /* return 1 if the file is a quicktime file */
146 int quicktime_check_sig(char *path);
147 
148 /* call this first to open the file and create all the objects */
149 quicktime_t* quicktime_open(char *filename, int rd, int wr);
150 
151 /* After quicktime_open and quicktime_set for the audio and video call this */
152 /* to generate a Microsoft AVI file. */
153 /* The allmighty requires the codec information in the beginning of the file */
154 /* while the index can either be in the beginning or the end. Thus */
155 /* You need to set the audio and video first. */
158 
159 /* Another Microsoft file format */
161 
162 
163 /* make the quicktime file streamable */
164 int quicktime_make_streamable(char *in_path, char *out_path);
165 
166 /* Set various options in the file. */
167 void quicktime_set_copyright(quicktime_t *file, const char *string);
168 void quicktime_set_name(quicktime_t *file, const char *string);
169 void quicktime_set_info(quicktime_t *file, const char *string);
173 
174 /* Read all the information about the file. */
175 /* Requires a MOOV atom be present in the file. */
176 /* If no MOOV atom exists return 1 else return 0. */
178 
179 /* set up tracks in a new file after opening and before writing */
180 /* returns the number of quicktime tracks allocated */
181 /* audio is stored two channels per quicktime track */
183  int channels,
184  long sample_rate,
185  int bits,
186  char *compressor);
187 /* Samplerate can be set after file is created */
188 void quicktime_set_framerate(quicktime_t *file, double framerate);
189 
190 /* Set aspect ratio. Only a few codecs support it. */
191 void quicktime_set_aspect(quicktime_t *file, double aspect);
192 
193 /* video is stored one layer per quicktime track */
195  int tracks,
196  int frame_w,
197  int frame_h,
198  double frame_rate,
199  char *compressor);
200 
201 /* routines for setting various video parameters */
202 /* should be called after set_video */
203 void quicktime_set_jpeg(quicktime_t *file, int quality, int use_float);
204 
205 /* Configure codec parameters with this */
206 /* It iterates through every track and sets the key in that codec to */
207 /* the value. The value can be any data type and the key must be a */
208 /* string which the codec understands. */
209 void quicktime_set_parameter(quicktime_t *file, const char *key, void *value);
210 
211 /* Get the english title of a codec based on its fourcc. */
212 /* Used by info boxed. */
213 char* quicktime_acodec_title(char *fourcc);
214 char* quicktime_vcodec_title(char *fourcc);
215 
216 
217 /* Set the depth of the track. */
219  int depth,
220  int track);
221 
222 
223 /* close the file and delete all the objects */
225 
226 /* get length information */
229 
230 /* get position information */
233 
234 /* get file information */
237 
239 
240 /* Get the samples per second */
242 
243 /* Get the number of bits for the twos codec */
245 
246 /* Get the number of audio channels in an audio track */
249 
253 
254 /* Number of bytes per pixel for the raw codec */
256 
257 /* Frames per second */
259 /* Frames per second as numerator over denominator*/
262 
263 /* FourCC of the video compressor */
265 
266 /* number of bytes of raw data in this frame */
268 
269 /* get the quicktime track and channel that the audio channel belongs to */
270 /* channels and tracks start on 0 */
271 int quicktime_channel_location(quicktime_t *file, int *quicktime_track, int *quicktime_channel, int channel);
272 
273 /* file positioning */
276 
277 /* set position of file descriptor relative to a track */
280 
281 /* ========================== Access to raw data follows. */
282 /* write data for one quicktime track */
283 /* the user must handle conversion to the channels in this track */
284 /*
285  * int quicktime_write_audio(quicktime_t *file,
286  * char *audio_buffer,
287  * long samples,
288  * int track);
289  */
291  unsigned char *video_buffer,
292  int64_t bytes,
293  int track);
294 
295 /* Read an entire chunk. */
296 /* read the number of bytes starting at the byte_start in the specified chunk */
297 /* You must provide enough space to store the chunk. */
298 int quicktime_read_chunk(quicktime_t *file, char *output, int track, int64_t chunk, int64_t byte_start, int64_t byte_len);
299 
300 /* read raw data */
302 long quicktime_read_frame(quicktime_t *file, unsigned char *video_buffer, int track);
303 
304 /* for reading frame using a library that needs a file descriptor */
305 /* Frame caching doesn't work here. */
308 
309 /* One keyframe table for each track */
310 /* Returns -1 if no keyframe exists. In AVI this always returns -1 */
311 /* if the frame offset is over 1 Gig. McRowsoft you know. */
315 
316 /* Track has keyframes */
318 
319 /* ===================== Access to built in codecs follows. */
320 
321 /* If the codec for this track is supported in the library return 1. */
324 
325 
326 
327 /* The codecs can all support RGB in and out. */
328 /* To find out if other color models are supported, use these functions. */
329 /* Returns 1 if the codec can generate the color model with no conversion */
331  int colormodel,
332  int track);
333 
334 /* Returns 1 if the codec can write the color model with no conversion */
336  int colormodel,
337  int track);
338 
339 
340 /* Utilities for direct copy of MPEG-4 */
341 int quicktime_mpeg4_is_key(unsigned char *data, long size, char *codec_id);
342 int quicktime_mpeg4_write_vol(unsigned char *data_start,
343  int vol_width,
344  int vol_height,
345  int time_increment_resolution,
346  double frame_rate);
347 int quicktime_mpeg4_has_vol(unsigned char *data);
348 
349 /* Direct copy of H264 */
350 int quicktime_h264_is_key(unsigned char *data, long size, char *codec_id);
351 
352 
353 
354 
355 
356 
357 
358 
359 /* These should be called right before a decode or encode function */
360 /* Set the colormodel for the encoder and decoder interface */
361 void quicktime_set_cmodel(quicktime_t *file, int colormodel);
362 
363 /* Set row span in bytes for the encoder and decoder interface */
364 void quicktime_set_row_span(quicktime_t *file, int row_span);
365 
366 /* Set the decoding window for the decoder interface. If the dimensions are */
367 /* all -1, no scaling is used. The default is no scaling. */
369  int in_x, /* Location of input frame to take picture */
370  int in_y,
371  int in_w,
372  int in_h,
373  int out_w, /* Dimensions of output frame */
374  int out_h);
375 
376 /* Encode the frame into a frame buffer. */
378  unsigned char **row_pointers,
379  int track);
380 
381 /* Decode a frame */
383  unsigned char **row_pointers,
384  int track);
385 
386 /* Get memory used by video decoders. Only counts frame caches. */
389 
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. */
394  int16_t *output_i,
395  float *output_f,
396  long samples,
397  int channel);
399  int16_t **input_i,
400  float **input_f,
401  long samples);
402 
403 
404 
405 
406 
407 
408 
409 /* Dump the file structures for the currently opened file. */
411 
412 /* Specify the number of cpus to utilize. */
413 int quicktime_set_cpus(quicktime_t *file, int cpus);
414 
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. */
420 
422 
423 
424 
425 #ifdef __cplusplus
426 }
427 #endif
428 
429 #endif