libquicktime: /usr/ports/pobj/libquicktime-1.2.3/libquicktime-1.2.3/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-2011 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 "compression.h"
    00031 #include "lqt_codecinfo.h"
    00032 #include "lqt_qtvr.h"
    00033
    00034 #pragma GCC visibility push(default)
    00035
    00036
    00037 #ifdef __cplusplus
    00038 extern "C" {
    00039 #endif /* __cplusplus */
    00040
    00046 void *lqt_bufalloc(size_t size);
    00047
    00048
    00049
    00056 void lqt_set_log_callback(lqt_log_callback_t cb, void * data);
    00057
    00058
    00070 int lqt_fileno(quicktime_t *file);
    00071
    00083 void lqt_set_audio_parameter(quicktime_t *file,int track, const char *key,const void *value);
    00084
    00096 void lqt_set_video_parameter(quicktime_t *file,int track, const char *key,const void *value);
    00097
    00108 int lqt_get_pixel_aspect(quicktime_t *file, int track, int * pixel_width,
    00109                          int * pixel_height);
    00110
    00121 int lqt_set_pixel_aspect(quicktime_t *file, int track, int pixel_width,
    00122                          int pixel_height);
    00123
    00136 lqt_interlace_mode_t lqt_get_interlace_mode(quicktime_t * file, int track);
    00137
    00150 int lqt_set_interlace_mode(quicktime_t * file, int track,
    00151                            lqt_interlace_mode_t mode);
    00152
    00153
    00159 const char * lqt_interlace_mode_to_string(lqt_interlace_mode_t mode);
    00160
    00171 lqt_chroma_placement_t lqt_get_chroma_placement(quicktime_t * file, int track);
    00172
    00179 const char * lqt_chroma_placement_to_string(lqt_chroma_placement_t chroma_placement);
    00180
    00191 int lqt_get_codec_api_version();
    00192
    00199 const char * lqt_channel_to_string(lqt_channel_t ch);
    00200
    00212 void lqt_set_channel_setup(quicktime_t * file, int track, lqt_channel_t * ch);
    00213
    00224 const lqt_channel_t * lqt_get_channel_setup(quicktime_t * file, int track);
    00225
    00226
    00259 int lqt_add_text_track(quicktime_t * file, int timescale);
    00260
    00270 void lqt_set_text_language(quicktime_t * file, int track, const char * language);
    00271
    00282 void lqt_set_chapter_track(quicktime_t * file, int track);
    00283
    00293 void lqt_set_text_box(quicktime_t * file, int track,
    00294                       uint16_t top, uint16_t left,
    00295                       uint16_t bottom, uint16_t right);
    00296
    00309 void lqt_set_text_fg_color(quicktime_t * file, int track,
    00310                            uint16_t r, uint16_t g,
    00311                            uint16_t b, uint16_t a);
    00312
    00326 void lqt_set_text_bg_color(quicktime_t * file, int track,
    00327                            uint16_t r, uint16_t g,
    00328                            uint16_t b, uint16_t a);
    00329
    00330
    00331
    00332
    00341 int lqt_write_text(quicktime_t * file, int track, const char * text, int64_t duration);
    00342
    00360 int lqt_text_tracks(quicktime_t * file);
    00361
    00372 int lqt_get_text_language(quicktime_t * file, int track, char * language);
    00373
    00380 int lqt_text_time_scale(quicktime_t * file, int track);
    00381
    00391 void lqt_get_text_box(quicktime_t * file, int track,
    00392                       uint16_t * top, uint16_t * left,
    00393                       uint16_t * bottom, uint16_t * right);
    00394
    00395
    00410 int lqt_read_text(quicktime_t * file, int track, char ** text, int * text_alloc,
    00411                   int64_t * timestamp, int64_t * duration);
    00412
    00420 int lqt_is_chapter_track(quicktime_t * file, int track);
    00421
    00428 int64_t lqt_text_samples(quicktime_t * file, int track);
    00429
    00436 void lqt_set_text_position(quicktime_t * file, int track, int64_t position);
    00437
    00448 void lqt_set_text_time(quicktime_t * file, int track, int64_t time);
    00449
    00461 void lqt_get_text_fg_color(quicktime_t * file, int track,
    00462                            uint16_t * r, uint16_t * g,
    00463                            uint16_t * b, uint16_t * a);
    00464
    00476 void lqt_get_text_bg_color(quicktime_t * file, int track,
    00477                            uint16_t * r, uint16_t * g,
    00478                            uint16_t * b, uint16_t * a);
    00479
    00495 #define LQT_TIMECODE_DROP    0x0001 //!< Indicates whether the timecode is drop frame
    00496 #define LQT_TIMECODE_24HMAX  0x0002 //!< Indicates whether the timecode wraps after 24 hours
    00497 #define LQT_TIMECODE_NEG_OK  0x0004 //!< Indicates whether negative time values are allowed
    00498 #define LQT_TIMECODE_COUNTER 0x0008 //!< Indicates whether the time value corresponds to a tape counter value
    00499
    00512 void lqt_add_timecode_track(quicktime_t * file, int track,
    00513                             uint32_t flags, int framerate);
    00514
    00524 void lqt_write_timecode(quicktime_t * file, int track,
    00525                         uint32_t timecode);
    00526
    00537 int lqt_has_timecode_track(quicktime_t * file, int track,
    00538                            uint32_t * flags, int * framerate);
    00539
    00554 int lqt_read_timecode(quicktime_t * file, int track,
    00555                       uint32_t * timecode);
    00556
    00568 const char * lqt_get_timecode_tape_name(quicktime_t * file, int track);
    00569
    00580 void lqt_set_timecode_tape_name(quicktime_t * file, int track,
    00581                                 const char * tapename);
    00582
    00591 int lqt_get_timecode_track_enabled(quicktime_t * file, int track);
    00592
    00601 void lqt_set_timecode_track_enabled(quicktime_t * file, int track,
    00602                                     int enabled);
    00603
    00610 /***********************************************
    00611  * Advanced colormodel handling.
    00612  * (defined in lqt_color.c)
    00613  ***********************************************/
    00614
    00620 #define LQT_COLORMODEL_NONE -1
    00621
    00622 /* Colormodel <-> string conversion (used by registry file routines) */
    00623
    00630 const char * lqt_colormodel_to_string(int colormodel);
    00631
    00638 int lqt_string_to_colormodel(const char * str);
    00639
    00640 /* Query information about the colormodel */
    00641
    00648 int lqt_colormodel_is_planar(int colormodel);
    00649
    00656 int lqt_colormodel_has_alpha(int colormodel);
    00657
    00664 int lqt_colormodel_is_rgb(int colormodel);
    00665
    00672 int lqt_colormodel_is_yuv(int colormodel);
    00673
    00682 void lqt_colormodel_get_chroma_sub(int colormodel, int * sub_h, int * sub_v);
    00683
    00697 void lqt_get_default_rowspan(int colormodel, int width, int * rowspan, int * rowspan_uv);
    00698
    00711 int lqt_colormodel_has_conversion(int in_cmodel, int out_cmodel);
    00712
    00713 /* Query supported colormodels */
    00714
    00720 int lqt_num_colormodels();
    00721
    00727 const char * lqt_get_colormodel_string(int index);
    00728
    00735 int lqt_get_colormodel(int index);
    00736
    00747 int lqt_get_decoder_colormodel(quicktime_t * file, int track);
    00748
    00760 int lqt_get_best_source_colormodel(int const* source_options, int target);
    00761
    00773 int lqt_get_best_target_colormodel(int source, int const* target_options);
    00774
    00791 int lqt_get_best_colormodel(quicktime_t * file, int track, int * supported);
    00792
    00803 int lqt_get_cmodel(quicktime_t * file, int track);
    00804
    00820 uint8_t ** lqt_rows_alloc(int width, int height, int colormodel, int * rowspan, int * rowspan_uv);
    00821
    00835 void lqt_rows_copy(uint8_t **out_rows, uint8_t **in_rows, int width, int height, int in_rowspan, int in_rowspan_uv,
    00836                    int out_rowspan, int out_rowspan_uv, int colormodel);
    00837
    00857 void lqt_rows_copy_sub(uint8_t **out_rows, uint8_t **in_rows,
    00858                        int width, int height, int in_rowspan,
    00859                        int in_rowspan_uv, int out_rowspan,
    00860                        int out_rowspan_uv, int colormodel, int src_x, int src_y, int dst_x, int dst_y);
    00861
    00878 void lqt_rows_clear(uint8_t **rows,
    00879                     int width, int height, int rowspan, int rowspan_uv, int colormodel);
    00880
    00881
    00887 void lqt_rows_free(uint8_t ** rows);
    00888
    00889
    00890 /**************************************
    00891  * Set streams for encoding
    00892  **************************************/
    00893
    00907 int lqt_set_audio(quicktime_t *file, int channels,
    00908                   long sample_rate,  int bits,
    00909                   lqt_codec_info_t * codec_info);
    00910
    00911
    00929 int lqt_set_video(quicktime_t *file, int tracks,
    00930                   int frame_w, int frame_h,
    00931                   int frame_duration, int timescale,
    00932                   lqt_codec_info_t * codec_info);
    00933
    00934
    00951 int lqt_add_audio_track(quicktime_t *file,
    00952                         int channels, long sample_rate, int bits,
    00953                         lqt_codec_info_t * codec_info);
    00954
    00962 int lqt_set_audio_codec(quicktime_t *file, int track,
    00963                         lqt_codec_info_t * info);
    00964
    00965
    00976 void lqt_set_audio_language(quicktime_t * file, int track, const char * language);
    00977
    00996 int lqt_add_video_track(quicktime_t *file,
    00997                         int frame_w, int frame_h,
    00998                         int frame_duration, int timescale,
    00999                         lqt_codec_info_t * codec_info);
    01000
    01008 int lqt_set_video_codec(quicktime_t *file, int track,
    01009                         lqt_codec_info_t * info);
    01010
    01011
    01029 int lqt_set_video_pass(quicktime_t *file,
    01030                        int pass, int total_passes,
    01031                        const char * stats_file, int track);
    01032
    01043 int64_t lqt_frame_time(quicktime_t * file, int track);
    01044
    01057 int lqt_decode_video(quicktime_t *file,
    01058                      unsigned char **row_pointers, int track);
    01059
    01077 int lqt_read_video_frame(quicktime_t * file,
    01078                          uint8_t ** buffer, int * buffer_alloc,
    01079                          int64_t frame, int64_t * time, int track);
    01080
    01096 int lqt_encode_video(quicktime_t *file,
    01097                      unsigned char **row_pointers,
    01098                      int track, int64_t time);
    01099
    01117 int lqt_encode_video_d(quicktime_t *file,
    01118                        unsigned char **row_pointers,
    01119                        int track, int64_t time, int duration);
    01120
    01129 int lqt_frame_duration(quicktime_t * file, int track, int *constant);
    01130
    01138 int lqt_video_time_scale(quicktime_t * file, int track);
    01139
    01149 int64_t lqt_video_duration(quicktime_t * file, int track);
    01150
    01165 void lqt_set_cmodel(quicktime_t *file, int track, int colormodel);
    01166
    01177 void lqt_set_row_span(quicktime_t *file, int track, int row_span);
    01178
    01189 void lqt_set_row_span_uv(quicktime_t *file, int track, int row_span_uv);
    01190
    01215 int lqt_decode_audio(quicktime_t *file,
    01216                      int16_t **output_i,
    01217                      float **output_f,
    01218                      long samples);
    01219
    01232 int64_t lqt_last_audio_position(quicktime_t * file, int track);
    01233
    01247 int lqt_encode_audio_track(quicktime_t *file,
    01248                            int16_t **output_i,
    01249                            float **output_f,
    01250                            long samples,
    01251                            int track);
    01252
    01270 int lqt_decode_audio_track(quicktime_t *file,
    01271                            int16_t **output_i,
    01272                            float **output_f,
    01273                            long samples,
    01274                            int track);
    01275
    01276 /*
    01277  *  Support for "raw" audio en-/decoding: This bypasses all
    01278  *  internal sampleformat conversions, and allows access to audio
    01279  *  samples in a format, which is closest to the internal representation.
    01280  */
    01281
    01282 /*
    01283  *  Query the internal sample format. Works for decoding (call after quicktime_open)
    01284  *  and encoding (call after lqt_add_audio_track, lqt_set_audio or quicktime_set_audio).
    01285  */
    01286
    01293 const char * lqt_sample_format_to_string(lqt_sample_format_t sampleformat);
    01294
    01310 lqt_sample_format_t lqt_get_sample_format(quicktime_t * file, int track);
    01311
    01312 /* The following return the actual number of en-/decoded frames */
    01313
    01330 int lqt_decode_audio_raw(quicktime_t *file,
    01331                          void * output,
    01332                          long samples,
    01333                          int track);
    01334
    01346 int lqt_get_audio_language(quicktime_t * file, int track, char * language);
    01347
    01348
    01362 int lqt_encode_audio_raw(quicktime_t *file,
    01363                          void * input,
    01364                          long samples,
    01365                          int track);
    01366
    01378 void lqt_seek_video(quicktime_t * file, int track,
    01379                     int64_t time);
    01380
    01381 /*
    01382  *  AVI Specific stuff
    01383  */
    01384
    01391 int lqt_is_avi(quicktime_t *file);
    01392
    01403 int lqt_get_wav_id(quicktime_t *file, int track);
    01404
    01415 int lqt_total_channels(quicktime_t *file);
    01416
    01417 /* Extended metadata support */
    01418
    01425 void lqt_set_album(quicktime_t *file, char *string);
    01426
    01433 void lqt_set_artist(quicktime_t *file, char *string);
    01434
    01441 void lqt_set_genre(quicktime_t *file, char *string);
    01442
    01450 void lqt_set_track(quicktime_t *file, char *string);
    01451
    01458 void lqt_set_comment(quicktime_t *file, char *string);
    01459
    01466 void lqt_set_author(quicktime_t *file, char *string);
    01467
    01474 void lqt_set_creation_time(quicktime_t *file, unsigned long time);
    01475
    01476
    01483 char * lqt_get_album(quicktime_t * file);
    01484
    01490 char * lqt_get_artist(quicktime_t * file);
    01491
    01498 char * lqt_get_genre(quicktime_t * file);
    01499
    01505 char * lqt_get_track(quicktime_t * file);
    01506
    01513 char * lqt_get_comment(quicktime_t *file);
    01514
    01520 char * lqt_get_author(quicktime_t *file);
    01521
    01527 unsigned long lqt_get_creation_time(quicktime_t * file);
    01528
    01529 /* get track number from track id */
    01530 int lqt_track_from_id(quicktime_t *file, int track_id);
    01531
    01538 const char * lqt_file_type_to_string(lqt_file_type_t type);
    01539
    01546 lqt_file_type_t lqt_get_file_type(quicktime_t * file);
    01547
    01548
    01556 quicktime_t * lqt_open_read(const char * filename);
    01557
    01567   quicktime_t * lqt_open_read_with_log(const char * filename, lqt_log_callback_t cb, void * log_data);
    01568
    01577 quicktime_t * lqt_open_write(const char * filename, lqt_file_type_t type);
    01578
    01589 quicktime_t * lqt_open_write_with_log(const char * filename, lqt_file_type_t type,
    01590                                       lqt_log_callback_t cb, void * log_data);
    01591
    01603 void lqt_set_max_riff_size(quicktime_t * file, int size);
    01604
    01605
    01606
    01607
    01608 #ifdef __cplusplus
    01609 }
    01610 #endif /* __cplusplus */
    01611
    01612 #pragma GCC visibility pop
    01613
    01614 #endif