libquicktime: /usr/obj/ports/libquicktime-1.1.5/libquicktime-1.1.5/include/quicktime/quicktime.h Source File

# quicktime.h

Go to the documentation of this file.

    00001 /*******************************************************************************
    00002  quicktime.h
    00003
    00004  libquicktime - A library for reading and writing quicktime/avi/mp4 files.
    00005  http://libquicktime.sourceforge.net
    00006
    00007  Copyright (C) 2002 Heroine Virtual Ltd.
    00008  Copyright (C) 2002-2010 Members of the libquicktime project.
    00009
    00010  This library is free software; you can redistribute it and/or modify it under
    00011  the terms of the GNU Lesser General Public License as published by the Free
    00012  Software Foundation; either version 2.1 of the License, or (at your option)
    00013  any later version.
    00014
    00015  This library is distributed in the hope that it will be useful, but WITHOUT
    00016  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00017  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
    00018  details.
    00019
    00020  You should have received a copy of the GNU Lesser General Public License along
    00021  with this library; if not, write to the Free Software Foundation, Inc., 51
    00022  Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
    00023 *******************************************************************************/
    00024
    00025 #ifndef QUICKTIME_H
    00026 #define QUICKTIME_H
    00027
    00028 #ifdef __cplusplus
    00029 extern "C" {
    00030 #endif
    00031
    00032 #include <inttypes.h>
    00033 #include <stddef.h>
    00034
    00035 #pragma GCC visibility push(default)
    00036
    00037 /* Some public enums needed by most subsequent headers */
    00038
    00121 typedef enum
    00122   {
    00123     LQT_LOG_ERROR   = (1<<0),
    00124     LQT_LOG_WARNING = (1<<1),
    00125     LQT_LOG_INFO    = (1<<2),
    00126     LQT_LOG_DEBUG   = (1<<3),
    00127   } lqt_log_level_t;
    00128
    00137 typedef void (*lqt_log_callback_t)(lqt_log_level_t level,
    00138                                    const char * domain,
    00139                                    const char * message,
    00140                                    void * data);
    00141
    00142
    00149 typedef enum
    00150   {
    00151     LQT_FILE_NONE = 0,
    00152     LQT_FILE_QT_OLD   = (1<<0),
    00153     LQT_FILE_QT       = (1<<1),
    00154     LQT_FILE_AVI      = (1<<2),
    00155     LQT_FILE_AVI_ODML = (1<<3),
    00156     LQT_FILE_MP4      = (1<<4),
    00157     LQT_FILE_M4A      = (1<<5),
    00158     LQT_FILE_3GP      = (1<<6),
    00159   } lqt_file_type_t;
    00160
    00161
    00172 typedef enum
    00173   {
    00174     LQT_CHANNEL_UNKNOWN,
    00175     LQT_CHANNEL_FRONT_LEFT,
    00176     LQT_CHANNEL_FRONT_RIGHT,
    00177     LQT_CHANNEL_FRONT_CENTER,
    00178     LQT_CHANNEL_FRONT_CENTER_LEFT,
    00179     LQT_CHANNEL_FRONT_CENTER_RIGHT,
    00180     LQT_CHANNEL_BACK_CENTER,
    00181     LQT_CHANNEL_BACK_LEFT,
    00182     LQT_CHANNEL_BACK_RIGHT,
    00183     LQT_CHANNEL_SIDE_LEFT,
    00184     LQT_CHANNEL_SIDE_RIGHT,
    00185     LQT_CHANNEL_LFE,
    00186   } lqt_channel_t;
    00187
    00188
    00252 typedef enum
    00253   {
    00254     LQT_INTERLACE_NONE = 0,
    00255     LQT_INTERLACE_TOP_FIRST,
    00256     LQT_INTERLACE_BOTTOM_FIRST
    00257   } lqt_interlace_mode_t;
    00258
    00268 typedef enum
    00269   {
    00270     LQT_CHROMA_PLACEMENT_DEFAULT = 0,
    00271     LQT_CHROMA_PLACEMENT_MPEG2,
    00272     LQT_CHROMA_PLACEMENT_DVPAL,
    00273   } lqt_chroma_placement_t;
    00274
    00284 typedef enum
    00285   {
    00286     LQT_SAMPLE_UNDEFINED = 0,
    00287     LQT_SAMPLE_INT8,
    00288     LQT_SAMPLE_UINT8,
    00289     LQT_SAMPLE_INT16,
    00290     LQT_SAMPLE_INT32,
    00291     LQT_SAMPLE_FLOAT,
    00292     LQT_SAMPLE_DOUBLE
    00293   } lqt_sample_format_t;
    00294
    00303 typedef struct quicktime_s quicktime_t;
    00304
    00305 /* This is the reference for all your library entry points. */
    00306
    00307 /* ===== compression formats for which codecs exist ====== */
    00308
    00328 #define QUICKTIME_DIVX "DIVX"
    00329
    00336 #define QUICKTIME_DIV3 "DIV3"
    00337
    00344 #define QUICKTIME_DV "dvc "
    00345 /* AVID DV codec can be processed with libdv as well */
    00346
    00353 #define QUICKTIME_DV_AVID "AVdv"
    00354
    00361 #define QUICKTIME_DV_AVID_A "dvcp"
    00362
    00370 /* RGB uncompressed.  Allows alpha */
    00371 #define QUICKTIME_RAW  "raw "
    00372
    00379 /* Jpeg Photo */
    00380 #define QUICKTIME_JPEG "jpeg"
    00381
    00382 /* Concatenated png images.  Allows alpha */
    00383
    00391 #define QUICKTIME_PNG "png "
    00392
    00400 #define QUICKTIME_MJPA "mjpa"
    00401
    00408 #define QUICKTIME_YUV2 "yuv2"
    00409
    00416 #define QUICKTIME_YUV4 "yuv4"
    00417
    00425 #define QUICKTIME_YUV420  "yv12"
    00426
    00433 #define QUICKTIME_2VUY "2vuy"
    00434
    00441 #define QUICKTIME_V308  "v308"
    00442
    00449 #define QUICKTIME_V408 "v408"
    00450
    00457 #define QUICKTIME_V210 "v210"
    00458
    00465 #define QUICKTIME_V410 "v410"
    00466
    00467 /* =================== Audio formats ======================= */
    00468
    00488 #define QUICKTIME_RAWAUDIO "raw "
    00489
    00496 #define QUICKTIME_IMA4 "ima4"
    00497
    00504 #define QUICKTIME_TWOS "twos"
    00505
    00512 #define QUICKTIME_ULAW "ulaw"
    00513
    00522 #define QUICKTIME_VORBIS "OggS"
    00523
    00531 #define QUICKTIME_MP3 ".mp3"
    00532
    00533 /* =========================== public interface ========================= // */
    00534
    00543   /* Get version information */
    00544 int quicktime_major();
    00545
    00553 int quicktime_minor();
    00554
    00563 int quicktime_release();
    00564
    00576 int quicktime_check_sig(char *path);
    00577
    00588 quicktime_t* quicktime_open(const char *filename, int rd, int wr);
    00589
    00602 int quicktime_make_streamable(char *in_path, char *out_path);
    00603
    00617 void quicktime_set_copyright(quicktime_t *file, char *string);
    00618
    00625 void quicktime_set_name(quicktime_t *file, char *string);
    00626
    00633 void quicktime_set_info(quicktime_t *file, char *string);
    00634
    00642 char* quicktime_get_copyright(quicktime_t *file);
    00643
    00651 char* quicktime_get_name(quicktime_t *file);
    00652
    00659 char* quicktime_get_info(quicktime_t *file);
    00660
    00661
    00677 int quicktime_set_audio(quicktime_t *file,
    00678         int channels,
    00679         long sample_rate,
    00680         int bits,
    00681         char *compressor);
    00682
    00693 void quicktime_set_framerate(quicktime_t *file, double framerate);
    00694
    00710 int quicktime_set_video(quicktime_t *file,
    00711         int tracks,
    00712         int frame_w,
    00713         int frame_h,
    00714         double frame_rate,
    00715         char *compressor);
    00716
    00730 void quicktime_set_jpeg(quicktime_t *file, int quality, int use_float);
    00731
    00746 void quicktime_set_parameter(quicktime_t *file, char *key, void *value);
    00747
    00758 void quicktime_set_depth(quicktime_t *file,
    00759         int depth,
    00760         int track);
    00761
    00771 void quicktime_set_cmodel(quicktime_t *file, int colormodel);
    00772
    00783 void quicktime_set_row_span(quicktime_t *file, int row_span);
    00784
    00790 int quicktime_close(quicktime_t *file);
    00791
    00792 /* get length information */
    00793 /* channel numbers start on 1 for audio and video */
    00794
    00803 long quicktime_audio_length(quicktime_t *file, int track);
    00804
    00816 long quicktime_video_length(quicktime_t *file, int track);
    00817
    00825   /* get position information */
    00826 long quicktime_audio_position(quicktime_t *file, int track);
    00827
    00837 long quicktime_video_position(quicktime_t *file, int track);
    00838
    00845 /* get file information */
    00846 int quicktime_video_tracks(quicktime_t *file);
    00847
    00854 int quicktime_audio_tracks(quicktime_t *file);
    00855
    00862 int quicktime_has_audio(quicktime_t *file);
    00863
    00871 long quicktime_sample_rate(quicktime_t *file, int track);
    00872
    00887 int quicktime_audio_bits(quicktime_t *file, int track);
    00888
    00896 int quicktime_track_channels(quicktime_t *file, int track);
    00897
    00910 char* quicktime_audio_compressor(quicktime_t *file, int track);
    00911
    00918 int quicktime_has_video(quicktime_t *file);
    00919
    00927 int quicktime_video_width(quicktime_t *file, int track);
    00928
    00936 int quicktime_video_height(quicktime_t *file, int track);
    00937
    00952 int quicktime_video_depth(quicktime_t *file, int track);
    00953
    00968 double quicktime_frame_rate(quicktime_t *file, int track);
    00969
    00980 char* quicktime_video_compressor(quicktime_t *file, int track);
    00981
    00982 /* number of bytes of raw data in this frame */
    00983
    00995 long quicktime_frame_size(quicktime_t *file, long frame, int track);
    00996
    01006 int quicktime_channel_location(quicktime_t *file, int *quicktime_track, int *quicktime_channel, int channel);
    01007
    01008 /* file positioning */
    01009 /* Remove these and see what happens :) */
    01010
    01011 // int quicktime_seek_end(quicktime_t *file);
    01012
    01021 int quicktime_seek_start(quicktime_t *file);
    01022
    01023 /* set position of file descriptor relative to a track */
    01024
    01033 int quicktime_set_audio_position(quicktime_t *file, int64_t sample, int track);
    01034
    01045 int quicktime_set_video_position(quicktime_t *file, int64_t frame, int track);
    01046
    01047 /* ========================== Access to raw data follows. */
    01048 /* write data for one quicktime track */
    01049 /* the user must handle conversion to the channels in this track */
    01050 int quicktime_write_audio(quicktime_t *file, uint8_t *audio_buffer, long samples, int track);
    01051
    01066 int quicktime_write_frame(quicktime_t *file, uint8_t *video_buffer, int64_t bytes, int track);
    01067
    01080 long quicktime_read_frame(quicktime_t *file, unsigned char *video_buffer, int track);
    01081
    01082 /* for reading frame using a library that needs a file descriptor */
    01083 /* Frame caching doesn't work here. */
    01084 int quicktime_read_frame_init(quicktime_t *file, int track);
    01085 int quicktime_read_frame_end(quicktime_t *file, int track);
    01086
    01087 /* One keyframe table for each track */
    01088 long quicktime_get_keyframe_before(quicktime_t *file, long frame, int track);
    01089 void quicktime_insert_keyframe(quicktime_t *file, long frame, int track);
    01090 /* Track has keyframes */
    01091 int quicktime_has_keyframes(quicktime_t *file, int track);
    01092
    01093 /* ===================== Access to built in codecs follows. */
    01094
    01095 /* If the codec for this track is supported in the library return 1. */
    01096
    01104 int quicktime_supported_video(quicktime_t *file, int track);
    01105
    01113 int quicktime_supported_audio(quicktime_t *file, int track);
    01114
    01126 int quicktime_reads_cmodel(quicktime_t *file,
    01127                 int colormodel,
    01128                 int track);
    01129
    01141 int quicktime_writes_cmodel(quicktime_t *file,
    01142                 int colormodel,
    01143                 int track);
    01144
    01145
    01146 /* Hacks for temporal codec */
    01147 int quicktime_divx_is_key(unsigned char *data, long size);
    01148 int quicktime_divx_write_vol(unsigned char *data_start,
    01149         int vol_width,
    01150         int vol_height,
    01151         int time_increment_resolution,
    01152         double frame_rate);
    01153 int quicktime_divx_has_vol(unsigned char *data);
    01154
    01155 int quicktime_div3_is_key(unsigned char *data, long size);
    01156
    01167 int quicktime_encode_video(quicktime_t *file,
    01168         unsigned char **row_pointers,
    01169         int track);
    01170
    01181 int quicktime_decode_video(quicktime_t *file,
    01182         unsigned char **row_pointers,
    01183         int track);
    01184
    01205 long quicktime_decode_scaled(quicktime_t *file,
    01206         int in_x,                    /* Location of input frame to take picture */
    01207         int in_y,
    01208         int in_w,
    01209         int in_h,
    01210         int out_w,                   /* Dimensions of output frame */
    01211         int out_h,
    01212         int color_model,             /* One of the color models defined above */
    01213         unsigned char **row_pointers,
    01214         int track);
    01215
    01216 /* Decode or encode audio for a single channel into the buffer. */
    01217 /* Pass a buffer for the _i or the _f argument if you want int16 or float data. */
    01218 /* Notice that encoding requires an array of pointers to each channel. */
    01219
    01237 int quicktime_decode_audio(quicktime_t *file, int16_t *output_i, float *output_f, long samples, int channel);
    01238
    01251 int quicktime_encode_audio(quicktime_t *file, int16_t **input_i, float **input_f, long samples);
    01252
    01260 int quicktime_dump(quicktime_t *file);
    01261
    01262 /* Specify the number of cpus to utilize. */
    01263
    01274 int quicktime_set_cpus(quicktime_t *file, int cpus);
    01275
    01276 /* Specify whether to read contiguously or not. */
    01277 /* preload is the number of bytes to read ahead. */
    01278 /* This is no longer functional to the end user but is used to accelerate */
    01279 /* reading the header internally. */
    01280 void quicktime_set_preload(quicktime_t *file, int64_t preload);
    01281
    01282 int64_t quicktime_byte_position(quicktime_t *file);
    01283
    01292 void quicktime_set_avi(quicktime_t *file, int value);
    01293
    01294 #pragma GCC visibility pop
    01295
    01296
    01297 #ifdef __cplusplus
    01298 }
    01299 #endif
    01300
    01301 #endif