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

# lqt.h

Go to the documentation of this file.

    00001 /*******************************************************************************
    00002  lqt.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 _LQT_H_
    00026 #define _LQT_H_
    00027
    00028 #include "quicktime.h"
    00029 #include "lqt_atoms.h"
    00030 #include "lqt_codecinfo.h"
    00031 #include "lqt_qtvr.h"
    00032
    00033 #pragma GCC visibility push(default)
    00034
    00035
    00036 #ifdef __cplusplus
    00037 extern "C" {
    00038 #endif /* __cplusplus */
    00039
    00045 void *lqt_bufalloc(size_t size);
    00046
    00047
    00048
    00055 void lqt_set_log_callback(lqt_log_callback_t cb, void * data);
    00056
    00057
    00069 int lqt_fileno(quicktime_t *file);
    00070
    00082 void lqt_set_audio_parameter(quicktime_t *file,int track, const char *key,const void *value);
    00083
    00095 void lqt_set_video_parameter(quicktime_t *file,int track, const char *key,const void *value);
    00096
    00107 int lqt_get_pixel_aspect(quicktime_t *file, int track, int * pixel_width,
    00108                          int * pixel_height);
    00109
    00120 int lqt_set_pixel_aspect(quicktime_t *file, int track, int pixel_width,
    00121                          int pixel_height);
    00122
    00135 lqt_interlace_mode_t lqt_get_interlace_mode(quicktime_t * file, int track);
    00136
    00149 int lqt_set_interlace_mode(quicktime_t * file, int track,
    00150                            lqt_interlace_mode_t mode);
    00151
    00152
    00158 const char * lqt_interlace_mode_to_string(lqt_interlace_mode_t mode);
    00159
    00170 lqt_chroma_placement_t lqt_get_chroma_placement(quicktime_t * file, int track);
    00171
    00178 const char * lqt_chroma_placement_to_string(lqt_chroma_placement_t chroma_placement);
    00179
    00190 int lqt_get_codec_api_version();
    00191
    00198 const char * lqt_channel_to_string(lqt_channel_t ch);
    00199
    00211 void lqt_set_channel_setup(quicktime_t * file, int track, lqt_channel_t * ch);
    00212
    00223 const lqt_channel_t * lqt_get_channel_setup(quicktime_t * file, int track);
    00224
    00225
    00258 int lqt_add_text_track(quicktime_t * file, int timescale);
    00259
    00269 void lqt_set_text_language(quicktime_t * file, int track, const char * language);
    00270
    00281 void lqt_set_chapter_track(quicktime_t * file, int track);
    00282
    00292 void lqt_set_text_box(quicktime_t * file, int track,
    00293                       uint16_t top, uint16_t left,
    00294                       uint16_t bottom, uint16_t right);
    00295
    00308 void lqt_set_text_fg_color(quicktime_t * file, int track,
    00309                            uint16_t r, uint16_t g,
    00310                            uint16_t b, uint16_t a);
    00311
    00325 void lqt_set_text_bg_color(quicktime_t * file, int track,
    00326                            uint16_t r, uint16_t g,
    00327                            uint16_t b, uint16_t a);
    00328
    00329
    00330
    00331
    00340 int lqt_write_text(quicktime_t * file, int track, const char * text, int64_t duration);
    00341
    00359 int lqt_text_tracks(quicktime_t * file);
    00360
    00371 int lqt_get_text_language(quicktime_t * file, int track, char * language);
    00372
    00379 int lqt_text_time_scale(quicktime_t * file, int track);
    00380
    00390 void lqt_get_text_box(quicktime_t * file, int track,
    00391                       uint16_t * top, uint16_t * left,
    00392                       uint16_t * bottom, uint16_t * right);
    00393
    00394
    00409 int lqt_read_text(quicktime_t * file, int track, char ** text, int * text_alloc,
    00410                   int64_t * timestamp, int64_t * duration);
    00411
    00419 int lqt_is_chapter_track(quicktime_t * file, int track);
    00420
    00427 int64_t lqt_text_samples(quicktime_t * file, int track);
    00428
    00435 void lqt_set_text_position(quicktime_t * file, int track, int64_t position);
    00436
    00447 void lqt_set_text_time(quicktime_t * file, int track, int64_t time);
    00448
    00460 void lqt_get_text_fg_color(quicktime_t * file, int track,
    00461                            uint16_t * r, uint16_t * g,
    00462                            uint16_t * b, uint16_t * a);
    00463
    00475 void lqt_get_text_bg_color(quicktime_t * file, int track,
    00476                            uint16_t * r, uint16_t * g,
    00477                            uint16_t * b, uint16_t * a);
    00478
    00494 #define LQT_TIMECODE_DROP    0x0001 //!< Indicates whether the timecode is drop frame
    00495 #define LQT_TIMECODE_24HMAX  0x0002 //!< Indicates whether the timecode wraps after 24 hours
    00496 #define LQT_TIMECODE_NEG_OK  0x0004 //!< Indicates whether negative time values are allowed
    00497 #define LQT_TIMECODE_COUNTER 0x0008 //!< Indicates whether the time value corresponds to a tape counter value
    00498
    00511 void lqt_add_timecode_track(quicktime_t * file, int track,
    00512                             uint32_t flags, int framerate);
    00513
    00523 void lqt_write_timecode(quicktime_t * file, int track,
    00524                         uint32_t timecode);
    00525
    00536 int lqt_has_timecode_track(quicktime_t * file, int track,
    00537                            uint32_t * flags, int * framerate);
    00538
    00553 int lqt_read_timecode(quicktime_t * file, int track,
    00554                       uint32_t * timecode);
    00555
    00567 const char * lqt_get_timecode_tape_name(quicktime_t * file, int track);
    00568
    00579 void lqt_set_timecode_tape_name(quicktime_t * file, int track,
    00580                                 const char * tapename);
    00581
    00590 int lqt_get_timecode_track_enabled(quicktime_t * file, int track);
    00591
    00600 void lqt_set_timecode_track_enabled(quicktime_t * file, int track,
    00601                                     int enabled);
    00602
    00609 /***********************************************
    00610  * Advanced colormodel handling.
    00611  * (defined in lqt_color.c)
    00612  ***********************************************/
    00613
    00619 #define LQT_COLORMODEL_NONE -1
    00620
    00621 /* Colormodel <-> string conversion (used by registry file routines) */
    00622
    00629 const char * lqt_colormodel_to_string(int colormodel);
    00630
    00637 int lqt_string_to_colormodel(const char * str);
    00638
    00639 /* Query information about the colormodel */
    00640
    00647 int lqt_colormodel_is_planar(int colormodel);
    00648
    00655 int lqt_colormodel_has_alpha(int colormodel);
    00656
    00663 int lqt_colormodel_is_rgb(int colormodel);
    00664
    00671 int lqt_colormodel_is_yuv(int colormodel);
    00672
    00681 void lqt_colormodel_get_chroma_sub(int colormodel, int * sub_h, int * sub_v);
    00682
    00696 void lqt_get_default_rowspan(int colormodel, int width, int * rowspan, int * rowspan_uv);
    00697
    00710 int lqt_colormodel_has_conversion(int in_cmodel, int out_cmodel);
    00711
    00712 /* Query supported colormodels */
    00713
    00719 int lqt_num_colormodels();
    00720
    00726 const char * lqt_get_colormodel_string(int index);
    00727
    00734 int lqt_get_colormodel(int index);
    00735
    00746 int lqt_get_decoder_colormodel(quicktime_t * file, int track);
    00747
    00764 int lqt_get_best_colormodel(quicktime_t * file, int track, int * supported);
    00765
    00776 int lqt_get_cmodel(quicktime_t * file, int track);
    00777
    00793 uint8_t ** lqt_rows_alloc(int width, int height, int colormodel, int * rowspan, int * rowspan_uv);
    00794
    00808 void lqt_rows_copy(uint8_t **out_rows, uint8_t **in_rows, int width, int height, int in_rowspan, int in_rowspan_uv,
    00809                    int out_rowspan, int out_rowspan_uv, int colormodel);
    00810
    00811
    00817 void lqt_rows_free(uint8_t ** rows);
    00818
    00819
    00820 /**************************************
    00821  * Set streams for encoding
    00822  **************************************/
    00823
    00837 int lqt_set_audio(quicktime_t *file, int channels,
    00838                   long sample_rate,  int bits,
    00839                   lqt_codec_info_t * codec_info);
    00840
    00841
    00859 int lqt_set_video(quicktime_t *file, int tracks,
    00860                   int frame_w, int frame_h,
    00861                   int frame_duration, int timescale,
    00862                   lqt_codec_info_t * codec_info);
    00863
    00864
    00878 int lqt_add_audio_track(quicktime_t *file,
    00879                         int channels, long sample_rate, int bits,
    00880                         lqt_codec_info_t * codec_info);
    00881
    00892 void lqt_set_audio_language(quicktime_t * file, int track, const char * language);
    00893
    00909 int lqt_add_video_track(quicktime_t *file,
    00910                         int frame_w, int frame_h,
    00911                         int frame_duration, int timescale,
    00912                         lqt_codec_info_t * codec_info);
    00913
    00931 int lqt_set_video_pass(quicktime_t *file,
    00932                        int pass, int total_passes,
    00933                        const char * stats_file, int track);
    00934
    00945 int64_t lqt_frame_time(quicktime_t * file, int track);
    00946
    00959 int lqt_decode_video(quicktime_t *file,
    00960                      unsigned char **row_pointers, int track);
    00961
    00979 int lqt_read_video_frame(quicktime_t * file,
    00980                          uint8_t ** buffer, int * buffer_alloc,
    00981                          int64_t frame, int64_t * time, int track);
    00982
    00998 int lqt_encode_video(quicktime_t *file,
    00999                      unsigned char **row_pointers,
    01000                      int track, int64_t time);
    01001
    01019 int lqt_encode_video_d(quicktime_t *file,
    01020                        unsigned char **row_pointers,
    01021                        int track, int64_t time, int duration);
    01022
    01031 int lqt_frame_duration(quicktime_t * file, int track, int *constant);
    01032
    01040 int lqt_video_time_scale(quicktime_t * file, int track);
    01041
    01051 int64_t lqt_video_duration(quicktime_t * file, int track);
    01052
    01067 void lqt_set_cmodel(quicktime_t *file, int track, int colormodel);
    01068
    01079 void lqt_set_row_span(quicktime_t *file, int track, int row_span);
    01080
    01091 void lqt_set_row_span_uv(quicktime_t *file, int track, int row_span_uv);
    01092
    01117 int lqt_decode_audio(quicktime_t *file,
    01118                      int16_t **output_i,
    01119                      float **output_f,
    01120                      long samples);
    01121
    01134 int64_t lqt_last_audio_position(quicktime_t * file, int track);
    01135
    01149 int lqt_encode_audio_track(quicktime_t *file,
    01150                            int16_t **output_i,
    01151                            float **output_f,
    01152                            long samples,
    01153                            int track);
    01154
    01172 int lqt_decode_audio_track(quicktime_t *file,
    01173                            int16_t **output_i,
    01174                            float **output_f,
    01175                            long samples,
    01176                            int track);
    01177
    01178 /*
    01179  *  Support for "raw" audio en-/decoding: This bypasses all
    01180  *  internal sampleformat conversions, and allows access to audio
    01181  *  samples in a format, which is closest to the internal representation.
    01182  */
    01183
    01184 /*
    01185  *  Query the internal sample format. Works for decoding (call after quicktime_open)
    01186  *  and encoding (call after lqt_add_audio_track, lqt_set_audio or quicktime_set_audio).
    01187  */
    01188
    01195 const char * lqt_sample_format_to_string(lqt_sample_format_t sampleformat);
    01196
    01212 lqt_sample_format_t lqt_get_sample_format(quicktime_t * file, int track);
    01213
    01214 /* The following return the actual number of en-/decoded frames */
    01215
    01232 int lqt_decode_audio_raw(quicktime_t *file,
    01233                          void * output,
    01234                          long samples,
    01235                          int track);
    01236
    01248 int lqt_get_audio_language(quicktime_t * file, int track, char * language);
    01249
    01250
    01264 int lqt_encode_audio_raw(quicktime_t *file,
    01265                          void * input,
    01266                          long samples,
    01267                          int track);
    01268
    01280 void lqt_seek_video(quicktime_t * file, int track,
    01281                     int64_t time);
    01282
    01283 /*
    01284  *  AVI Specific stuff
    01285  */
    01286
    01293 int lqt_is_avi(quicktime_t *file);
    01294
    01305 int lqt_get_wav_id(quicktime_t *file, int track);
    01306
    01317 int lqt_total_channels(quicktime_t *file);
    01318
    01319 /* Extended metadata support */
    01320
    01327 void lqt_set_album(quicktime_t *file, char *string);
    01328
    01335 void lqt_set_artist(quicktime_t *file, char *string);
    01336
    01343 void lqt_set_genre(quicktime_t *file, char *string);
    01344
    01352 void lqt_set_track(quicktime_t *file, char *string);
    01353
    01360 void lqt_set_comment(quicktime_t *file, char *string);
    01361
    01368 void lqt_set_author(quicktime_t *file, char *string);
    01369
    01376 void lqt_set_creation_time(quicktime_t *file, unsigned long time);
    01377
    01378
    01385 char * lqt_get_album(quicktime_t * file);
    01386
    01392 char * lqt_get_artist(quicktime_t * file);
    01393
    01400 char * lqt_get_genre(quicktime_t * file);
    01401
    01407 char * lqt_get_track(quicktime_t * file);
    01408
    01415 char * lqt_get_comment(quicktime_t *file);
    01416
    01422 char * lqt_get_author(quicktime_t *file);
    01423
    01429 unsigned long lqt_get_creation_time(quicktime_t * file);
    01430
    01431 /* get track number from track id */
    01432 int lqt_track_from_id(quicktime_t *file, int track_id);
    01433
    01440 const char * lqt_file_type_to_string(lqt_file_type_t type);
    01441
    01448 lqt_file_type_t lqt_get_file_type(quicktime_t * file);
    01449
    01450
    01458 quicktime_t * lqt_open_read(const char * filename);
    01459
    01469   quicktime_t * lqt_open_read_with_log(const char * filename, lqt_log_callback_t cb, void * log_data);
    01470
    01479 quicktime_t * lqt_open_write(const char * filename, lqt_file_type_t type);
    01480
    01491 quicktime_t * lqt_open_write_with_log(const char * filename, lqt_file_type_t type,
    01492                                       lqt_log_callback_t cb, void * log_data);
    01493
    01505 void lqt_set_max_riff_size(quicktime_t * file, int size);
    01506
    01507
    01508
    01509
    01510 #ifdef __cplusplus
    01511 }
    01512 #endif /* __cplusplus */
    01513
    01514 #pragma GCC visibility pop
    01515
    01516 #endif