libquicktime: /usr/ports/pobj/libquicktime-1.2.4/libquicktime-1.2.4/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
    01040 int64_t lqt_get_frame_time(quicktime_t * file, int track, int frame);
    01041
    01052 int64_t lqt_frame_time(quicktime_t * file, int track);
    01053
    01066 int lqt_decode_video(quicktime_t *file,
    01067                      unsigned char **row_pointers, int track);
    01068
    01086 int lqt_read_video_frame(quicktime_t * file,
    01087                          uint8_t ** buffer, int * buffer_alloc,
    01088                          int64_t frame, int64_t * time, int track);
    01089
    01105 int lqt_encode_video(quicktime_t *file,
    01106                      unsigned char **row_pointers,
    01107                      int track, int64_t time);
    01108
    01126 int lqt_encode_video_d(quicktime_t *file,
    01127                        unsigned char **row_pointers,
    01128                        int track, int64_t time, int duration);
    01129
    01138 int lqt_frame_duration(quicktime_t * file, int track, int *constant);
    01139
    01147 int lqt_video_time_scale(quicktime_t * file, int track);
    01148
    01158 int64_t lqt_video_duration(quicktime_t * file, int track);
    01159
    01174 void lqt_set_cmodel(quicktime_t *file, int track, int colormodel);
    01175
    01182 long lqt_video_edit_list_total_entries(quicktime_t * file, int track);
    01183
    01191 long lqt_video_edit_duration(quicktime_t * file, int track, int entry_index);
    01192
    01200 long lqt_video_edit_time(quicktime_t * file, int track, int entry_index);
    01201
    01209 float lqt_video_edit_rate(quicktime_t * file, int track, int entry_index);
    01210
    01221 void lqt_set_row_span(quicktime_t *file, int track, int row_span);
    01222
    01233 void lqt_set_row_span_uv(quicktime_t *file, int track, int row_span_uv);
    01234
    01259 int lqt_decode_audio(quicktime_t *file,
    01260                      int16_t **output_i,
    01261                      float **output_f,
    01262                      long samples);
    01263
    01276 int64_t lqt_last_audio_position(quicktime_t * file, int track);
    01277
    01291 int lqt_encode_audio_track(quicktime_t *file,
    01292                            int16_t **output_i,
    01293                            float **output_f,
    01294                            long samples,
    01295                            int track);
    01296
    01314 int lqt_decode_audio_track(quicktime_t *file,
    01315                            int16_t **output_i,
    01316                            float **output_f,
    01317                            long samples,
    01318                            int track);
    01319
    01320 /*
    01321  *  Support for "raw" audio en-/decoding: This bypasses all
    01322  *  internal sampleformat conversions, and allows access to audio
    01323  *  samples in a format, which is closest to the internal representation.
    01324  */
    01325
    01326 /*
    01327  *  Query the internal sample format. Works for decoding (call after quicktime_open)
    01328  *  and encoding (call after lqt_add_audio_track, lqt_set_audio or quicktime_set_audio).
    01329  */
    01330
    01337 const char * lqt_sample_format_to_string(lqt_sample_format_t sampleformat);
    01338
    01354 lqt_sample_format_t lqt_get_sample_format(quicktime_t * file, int track);
    01355
    01356 /* The following return the actual number of en-/decoded frames */
    01357
    01374 int lqt_decode_audio_raw(quicktime_t *file,
    01375                          void * output,
    01376                          long samples,
    01377                          int track);
    01378
    01390 int lqt_get_audio_language(quicktime_t * file, int track, char * language);
    01391
    01392
    01406 int lqt_encode_audio_raw(quicktime_t *file,
    01407                          void * input,
    01408                          long samples,
    01409                          int track);
    01410
    01422 void lqt_seek_video(quicktime_t * file, int track,
    01423                     int64_t time);
    01424
    01431 long lqt_audio_edit_list_total_entries(quicktime_t * file, int track);
    01432
    01440 long lqt_audio_edit_duration(quicktime_t * file, int track, int entry_index);
    01441
    01449 long lqt_audio_edit_time(quicktime_t * file, int track, int entry_index);
    01450
    01458 float lqt_audio_edit_rate(quicktime_t * file, int track, int entry_index);
    01459
    01460 /*
    01461  *  AVI Specific stuff
    01462  */
    01463
    01470 int lqt_is_avi(quicktime_t *file);
    01471
    01482 int lqt_get_wav_id(quicktime_t *file, int track);
    01483
    01494 int lqt_total_channels(quicktime_t *file);
    01495
    01496 /* Extended metadata support */
    01497
    01504 void lqt_set_album(quicktime_t *file, char *string);
    01505
    01512 void lqt_set_artist(quicktime_t *file, char *string);
    01513
    01520 void lqt_set_genre(quicktime_t *file, char *string);
    01521
    01529 void lqt_set_track(quicktime_t *file, char *string);
    01530
    01537 void lqt_set_comment(quicktime_t *file, char *string);
    01538
    01545 void lqt_set_author(quicktime_t *file, char *string);
    01546
    01553 void lqt_set_creation_time(quicktime_t *file, unsigned long time);
    01554
    01555
    01562 char * lqt_get_album(quicktime_t * file);
    01563
    01569 char * lqt_get_artist(quicktime_t * file);
    01570
    01577 char * lqt_get_genre(quicktime_t * file);
    01578
    01584 char * lqt_get_track(quicktime_t * file);
    01585
    01592 char * lqt_get_comment(quicktime_t *file);
    01593
    01599 char * lqt_get_author(quicktime_t *file);
    01600
    01606 unsigned long lqt_get_creation_time(quicktime_t * file);
    01607
    01608 /* get track number from track id */
    01609 int lqt_track_from_id(quicktime_t *file, int track_id);
    01610
    01617 const char * lqt_file_type_to_string(lqt_file_type_t type);
    01618
    01625 lqt_file_type_t lqt_get_file_type(quicktime_t * file);
    01626
    01627
    01635 quicktime_t * lqt_open_read(const char * filename);
    01636
    01646   quicktime_t * lqt_open_read_with_log(const char * filename, lqt_log_callback_t cb, void * log_data);
    01647
    01656 quicktime_t * lqt_open_write(const char * filename, lqt_file_type_t type);
    01657
    01668 quicktime_t * lqt_open_write_with_log(const char * filename, lqt_file_type_t type,
    01669                                       lqt_log_callback_t cb, void * log_data);
    01670
    01682 void lqt_set_max_riff_size(quicktime_t * file, int size);
    01683
    01684
    01692 void lqt_set_audio_pts_offset(quicktime_t * file, int track, int64_t offset);
    01693
    01701 int64_t lqt_get_audio_pts_offset(quicktime_t * file, int track);
    01702
    01710 void lqt_set_video_pts_offset(quicktime_t * file, int track, int64_t offset);
    01711
    01719 int64_t lqt_get_video_pts_offset(quicktime_t * file, int track);
    01720
    01728 void lqt_set_text_pts_offset(quicktime_t * file, int track, int64_t offset);
    01729
    01737 int64_t lqt_get_text_pts_offset(quicktime_t * file, int track);
    01738
    01739 #ifdef __cplusplus
    01740 }
    01741 #endif /* __cplusplus */
    01742
    01743 #pragma GCC visibility pop
    01744
    01745 #endif