libquicktime: /home/pix/Software/gmerlin-dependencies/libquicktime/libquicktime/include/quicktime/lqt.h Source File

- Main Page
- Modules
- Data Structures
- Files
- Directories

# 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-2007 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 #ifdef __cplusplus
    00034 extern "C" {
    00035 #endif /* __cplusplus */
    00036
    00042 void *lqt_bufalloc(size_t size);
    00043
    00044
    00045
    00052 void lqt_set_log_callback(lqt_log_callback_t cb, void * data);
    00053
    00054
    00066 int lqt_fileno(quicktime_t *file);
    00067
    00079 void lqt_set_audio_parameter(quicktime_t *file,int track, const char *key,const void *value);
    00080
    00092 void lqt_set_video_parameter(quicktime_t *file,int track, const char *key,const void *value);
    00093
    00104 int lqt_get_pixel_aspect(quicktime_t *file, int track, int * pixel_width,
    00105                          int * pixel_height);
    00106
    00117 int lqt_set_pixel_aspect(quicktime_t *file, int track, int pixel_width,
    00118                          int pixel_height);
    00119
    00132 lqt_interlace_mode_t lqt_get_interlace_mode(quicktime_t * file, int track);
    00133
    00146 int lqt_set_interlace_mode(quicktime_t * file, int track,
    00147                            lqt_interlace_mode_t mode);
    00148
    00149
    00155 const char * lqt_interlace_mode_to_string(lqt_interlace_mode_t mode);
    00156
    00167 lqt_chroma_placement_t lqt_get_chroma_placement(quicktime_t * file, int track);
    00168
    00175 const char * lqt_chroma_placement_to_string(lqt_chroma_placement_t chroma_placement);
    00176
    00187 int lqt_get_codec_api_version();
    00188
    00195 const char * lqt_channel_to_string(lqt_channel_t ch);
    00196
    00208 void lqt_set_channel_setup(quicktime_t * file, int track, lqt_channel_t * ch);
    00209
    00220 const lqt_channel_t * lqt_get_channel_setup(quicktime_t * file, int track);
    00221
    00222
    00255 int lqt_add_text_track(quicktime_t * file, int timescale);
    00256
    00266 void lqt_set_text_language(quicktime_t * file, int track, const char * language);
    00267
    00278 void lqt_set_chapter_track(quicktime_t * file, int track);
    00279
    00289 void lqt_set_text_box(quicktime_t * file, int track,
    00290                       uint16_t top, uint16_t left,
    00291                       uint16_t bottom, uint16_t right);
    00292
    00305 void lqt_set_text_fg_color(quicktime_t * file, int track,
    00306                            uint16_t r, uint16_t g,
    00307                            uint16_t b, uint16_t a);
    00308
    00322 void lqt_set_text_bg_color(quicktime_t * file, int track,
    00323                            uint16_t r, uint16_t g,
    00324                            uint16_t b, uint16_t a);
    00325
    00326
    00327
    00328
    00337 int lqt_write_text(quicktime_t * file, int track, const char * text, int64_t duration);
    00338
    00356 int lqt_text_tracks(quicktime_t * file);
    00357
    00368 int lqt_get_text_language(quicktime_t * file, int track, char * language);
    00369
    00376 int lqt_text_time_scale(quicktime_t * file, int track);
    00377
    00387 void lqt_get_text_box(quicktime_t * file, int track,
    00388                       uint16_t * top, uint16_t * left,
    00389                       uint16_t * bottom, uint16_t * right);
    00390
    00391
    00406 int lqt_read_text(quicktime_t * file, int track, char ** text, int * text_alloc,
    00407                   int64_t * timestamp, int64_t * duration);
    00408
    00416 int lqt_is_chapter_track(quicktime_t * file, int track);
    00417
    00424 int64_t lqt_text_samples(quicktime_t * file, int track);
    00425
    00432 void lqt_set_text_position(quicktime_t * file, int track, int64_t position);
    00433
    00444 void lqt_set_text_time(quicktime_t * file, int track, int64_t time);
    00445
    00457 void lqt_get_text_fg_color(quicktime_t * file, int track,
    00458                            uint16_t * r, uint16_t * g,
    00459                            uint16_t * b, uint16_t * a);
    00460
    00472 void lqt_get_text_bg_color(quicktime_t * file, int track,
    00473                            uint16_t * r, uint16_t * g,
    00474                            uint16_t * b, uint16_t * a);
    00475
    00481 /***********************************************
    00482  * Advanced colormodel handling.
    00483  * (defined in lqt_color.c)
    00484  ***********************************************/
    00485
    00491 #define LQT_COLORMODEL_NONE -1
    00492
    00493 /* Colormodel <-> string conversion (used by registry file routines) */
    00494
    00501 const char * lqt_colormodel_to_string(int colormodel);
    00502
    00509 int lqt_string_to_colormodel(const char * str);
    00510
    00511 /* Query information about the colormodel */
    00512
    00519 int lqt_colormodel_is_planar(int colormodel);
    00520
    00527 int lqt_colormodel_has_alpha(int colormodel);
    00528
    00535 int lqt_colormodel_is_rgb(int colormodel);
    00536
    00543 int lqt_colormodel_is_yuv(int colormodel);
    00544
    00553 void lqt_colormodel_get_chroma_sub(int colormodel, int * sub_h, int * sub_v);
    00554
    00568 void lqt_get_default_rowspan(int colormodel, int width, int * rowspan, int * rowspan_uv);
    00569
    00582 int lqt_colormodel_has_conversion(int in_cmodel, int out_cmodel);
    00583
    00584 /* Query supported colormodels */
    00585
    00591 int lqt_num_colormodels();
    00592
    00598 const char * lqt_get_colormodel_string(int index);
    00599
    00606 int lqt_get_colormodel(int index);
    00607
    00618 int lqt_get_decoder_colormodel(quicktime_t * file, int track);
    00619
    00636 int lqt_get_best_colormodel(quicktime_t * file, int track, int * supported);
    00637
    00648 int lqt_get_cmodel(quicktime_t * file, int track);
    00649
    00665 uint8_t ** lqt_rows_alloc(int width, int height, int colormodel, int * rowspan, int * rowspan_uv);
    00666
    00680 void lqt_rows_copy(uint8_t **out_rows, uint8_t **in_rows, int width, int height, int in_rowspan, int in_rowspan_uv,
    00681                    int out_rowspan, int out_rowspan_uv, int colormodel);
    00682
    00683
    00689 void lqt_rows_free(uint8_t ** rows);
    00690
    00691
    00692 /**************************************
    00693  * Set streams for encoding
    00694  **************************************/
    00695
    00709 int lqt_set_audio(quicktime_t *file, int channels,
    00710                   long sample_rate,  int bits,
    00711                   lqt_codec_info_t * codec_info);
    00712
    00713
    00731 int lqt_set_video(quicktime_t *file, int tracks,
    00732                   int frame_w, int frame_h,
    00733                   int frame_duration, int timescale,
    00734                   lqt_codec_info_t * codec_info);
    00735
    00736
    00750 int lqt_add_audio_track(quicktime_t *file,
    00751                         int channels, long sample_rate, int bits,
    00752                         lqt_codec_info_t * codec_info);
    00753
    00764 void lqt_set_audio_language(quicktime_t * file, int track, const char * language);
    00765
    00781 int lqt_add_video_track(quicktime_t *file,
    00782                         int frame_w, int frame_h,
    00783                         int frame_duration, int timescale,
    00784                         lqt_codec_info_t * codec_info);
    00785
    00803 int lqt_set_video_pass(quicktime_t *file,
    00804                        int pass, int total_passes,
    00805                        const char * stats_file, int track);
    00806
    00817 int64_t lqt_frame_time(quicktime_t * file, int track);
    00818
    00831 int lqt_decode_video(quicktime_t *file,
    00832                      unsigned char **row_pointers, int track);
    00833
    00851 int lqt_read_video_frame(quicktime_t * file,
    00852                          uint8_t ** buffer, int * buffer_alloc,
    00853                          int64_t frame, int64_t * time, int track);
    00854
    00870 int lqt_encode_video(quicktime_t *file,
    00871                      unsigned char **row_pointers,
    00872                      int track, int64_t time);
    00873
    00882 int lqt_frame_duration(quicktime_t * file, int track, int *constant);
    00883
    00891 int lqt_video_time_scale(quicktime_t * file, int track);
    00892
    00902 int64_t lqt_video_duration(quicktime_t * file, int track);
    00903
    00918 void lqt_set_cmodel(quicktime_t *file, int track, int colormodel);
    00919
    00930 void lqt_set_row_span(quicktime_t *file, int track, int row_span);
    00931
    00942 void lqt_set_row_span_uv(quicktime_t *file, int track, int row_span_uv);
    00943
    00968 int lqt_decode_audio(quicktime_t *file,
    00969                      int16_t **output_i,
    00970                      float **output_f,
    00971                      long samples);
    00972
    00985 int64_t lqt_last_audio_position(quicktime_t * file, int track);
    00986
    01000 int lqt_encode_audio_track(quicktime_t *file,
    01001                            int16_t **output_i,
    01002                            float **output_f,
    01003                            long samples,
    01004                            int track);
    01005
    01023 int lqt_decode_audio_track(quicktime_t *file,
    01024                            int16_t **output_i,
    01025                            float **output_f,
    01026                            long samples,
    01027                            int track);
    01028
    01029 /*
    01030  *  Support for "raw" audio en-/decoding: This bypasses all
    01031  *  internal sampleformat conversions, and allows access to audio
    01032  *  samples in a format, which is closest to the internal representation.
    01033  */
    01034
    01035 /*
    01036  *  Query the internal sample format. Works for decoding (call after quicktime_open)
    01037  *  and encoding (call after lqt_add_audio_track, lqt_set_audio or quicktime_set_audio).
    01038  */
    01039
    01046 const char * lqt_sample_format_to_string(lqt_sample_format_t sampleformat);
    01047
    01063 lqt_sample_format_t lqt_get_sample_format(quicktime_t * file, int track);
    01064
    01065 /* The following return the actual number of en-/decoded frames */
    01066
    01083 int lqt_decode_audio_raw(quicktime_t *file,
    01084                          void * output,
    01085                          long samples,
    01086                          int track);
    01087
    01099 int lqt_get_audio_language(quicktime_t * file, int track, char * language);
    01100
    01101
    01115 int lqt_encode_audio_raw(quicktime_t *file,
    01116                          void * input,
    01117                          long samples,
    01118                          int track);
    01119
    01131 void lqt_seek_video(quicktime_t * file, int track,
    01132                     int64_t time);
    01133
    01134 /*
    01135  *  AVI Specific stuff
    01136  */
    01137
    01144 int lqt_is_avi(quicktime_t *file);
    01145
    01156 int lqt_get_wav_id(quicktime_t *file, int track);
    01157
    01168 int lqt_total_channels(quicktime_t *file);
    01169
    01170 /* Extended metadata support */
    01171
    01178 void lqt_set_album(quicktime_t *file, char *string);
    01179
    01186 void lqt_set_artist(quicktime_t *file, char *string);
    01187
    01194 void lqt_set_genre(quicktime_t *file, char *string);
    01195
    01203 void lqt_set_track(quicktime_t *file, char *string);
    01204
    01211 void lqt_set_comment(quicktime_t *file, char *string);
    01212
    01219 void lqt_set_author(quicktime_t *file, char *string);
    01220
    01227 void lqt_set_creation_time(quicktime_t *file, unsigned long time);
    01228
    01229
    01236 char * lqt_get_album(quicktime_t * file);
    01237
    01243 char * lqt_get_artist(quicktime_t * file);
    01244
    01251 char * lqt_get_genre(quicktime_t * file);
    01252
    01258 char * lqt_get_track(quicktime_t * file);
    01259
    01266 char * lqt_get_comment(quicktime_t *file);
    01267
    01273 char * lqt_get_author(quicktime_t *file);
    01274
    01280 unsigned long lqt_get_creation_time(quicktime_t * file);
    01281
    01282 /* get track number from track id */
    01283 int lqt_track_from_id(quicktime_t *file, int track_id);
    01284
    01291 const char * lqt_file_type_to_string(lqt_file_type_t type);
    01292
    01299 lqt_file_type_t lqt_get_file_type(quicktime_t * file);
    01300
    01301
    01309 quicktime_t * lqt_open_read(const char * filename);
    01310
    01320   quicktime_t * lqt_open_read_with_log(const char * filename, lqt_log_callback_t cb, void * log_data);
    01321
    01330 quicktime_t * lqt_open_write(const char * filename, lqt_file_type_t type);
    01331
    01342 quicktime_t * lqt_open_write_with_log(const char * filename, lqt_file_type_t type,
    01343                                       lqt_log_callback_t cb, void * log_data);
    01344
    01356 void lqt_set_max_riff_size(quicktime_t * file, int size);
    01357
    01358
    01359
    01360
    01361 #ifdef __cplusplus
    01362 }
    01363 #endif /* __cplusplus */
    01364
    01365
    01366 #endif