lqt_codecinfo.h

00001 /*******************************************************************************
00002  lqt_codecinfo.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 /*
00026  *   Codec info structure for libquicktime
00027  *   (first approximation)
00028  */
00029 
00030 /* Type of a codec parameter */
00031 
00032 #ifndef _LQT_CODEC_INFO_H_
00033 #define _LQT_CODEC_INFO_H_
00034 
00035 #pragma GCC visibility push(default)
00036 
00037 #include <inttypes.h>
00038 
00039 
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif /* __cplusplus */
00044 
00078 typedef enum
00079   {
00080     LQT_PARAMETER_INT,     
00081     LQT_PARAMETER_FLOAT,   
00082     LQT_PARAMETER_STRING,  
00083     LQT_PARAMETER_STRINGLIST, 
00084     /* This dummy type is used to separate sections (real_name will be on tab-label) */
00085     LQT_PARAMETER_SECTION, 
00086   } lqt_parameter_type_t;
00087 
00094 typedef union
00095   {
00096   int val_int; 
00097   char * val_string; 
00098   float val_float; 
00099   } lqt_parameter_value_t;
00100 
00108 typedef struct
00109   {
00110   char * name;   
00112   char * real_name; 
00114   lqt_parameter_type_t type; 
00116   lqt_parameter_value_t val_default; 
00118   /*
00119    *   Minimum and maximum values:
00120    *   These are only valid for numeric types and if val_min < val_max
00121    */
00122   
00123   lqt_parameter_value_t val_min; 
00124   lqt_parameter_value_t val_max; 
00126   int num_digits; 
00128   /*
00129    *  Possible options (only valid for LQT_STRINGLIST)
00130    */
00131   
00132   int num_stringlist_options; 
00133   char ** stringlist_options; 
00134   char ** stringlist_labels;  
00136   char * help_string; 
00138   } lqt_parameter_info_t;
00139 
00144 typedef enum
00145   {
00146     LQT_CODEC_AUDIO,
00147     LQT_CODEC_VIDEO
00148   } lqt_codec_type;
00149 
00154 typedef enum
00155   {
00156     LQT_DIRECTION_ENCODE,
00157     LQT_DIRECTION_DECODE,
00158     LQT_DIRECTION_BOTH
00159   } lqt_codec_direction;
00160 
00165 typedef struct lqt_codec_info_s
00166   {
00167   int compatibility_flags; 
00169   /* These are set by the plugins */
00170   
00171   char * name;               
00172   char * long_name;          
00173   char * description;        
00175   lqt_codec_type type;           
00176   lqt_codec_direction direction; 
00178   int num_fourccs;      
00179   char ** fourccs;      
00181   int num_wav_ids; 
00182   int * wav_ids;   
00185   int num_encoding_parameters; 
00186   lqt_parameter_info_t * encoding_parameters; 
00188   int num_decoding_parameters; 
00189   lqt_parameter_info_t * decoding_parameters; 
00191   /* The following members are set by libquicktime      */
00192   
00193   char * module_filename;    
00194   int module_index;          
00196   uint32_t file_time;        
00198   char * gettext_domain;     
00199   char * gettext_directory;  
00201   struct lqt_codec_info_s * next;   
00202   } lqt_codec_info_t;
00203 
00204 
00205 /* Global Entry points */
00206 
00214 void lqt_registry_init();
00215 
00224 void lqt_registry_destroy();
00225 
00226 /* \ingroup codec_registry
00227  *
00228  * Save the registry file $HOME/.libquicktime_codecs.
00229  * Under normal circumstances, you never need to call this function
00230  */
00231 
00232 void lqt_registry_write();
00233 
00234 
00235 /******************************************************
00236  *  Non thread save functions for querying the
00237  *  codec registry. Suitable for single threaded
00238  *  applications (might become obsolete)
00239  ******************************************************/
00240 
00248 int lqt_get_num_audio_codecs();
00249 
00257 int lqt_get_num_video_codecs();
00258 
00267 const lqt_codec_info_t * lqt_get_audio_codec_info(int index);
00268 
00277 const lqt_codec_info_t * lqt_get_video_codec_info(int index);
00278 
00279 /********************************************************************
00280  *  Thread save function for getting codec parameters
00281  *  All these functions return a NULL terminated array of local
00282  *  copies of the codec data which must be freed using 
00283  *  lqt_destroy_codec_info(lqt_codec_info_t ** info) declared below
00284  ********************************************************************/
00285 
00298 lqt_codec_info_t ** lqt_query_registry(int audio, int video,
00299                                        int encode, int decode);
00300 
00311 lqt_codec_info_t ** lqt_find_audio_codec(char * fourcc, int encode);
00312 
00323 lqt_codec_info_t ** lqt_find_audio_codec_by_wav_id(int wav_id, int encode);
00324   
00335 lqt_codec_info_t ** lqt_find_video_codec(char * fourcc, int encode);
00336 
00337 
00338 
00339   
00340 
00341   
00351 lqt_codec_info_t ** lqt_find_audio_codec_by_name(const char * name);
00352 
00362 lqt_codec_info_t ** lqt_find_video_codec_by_name(const char * name);
00363 
00374 lqt_codec_info_t ** lqt_audio_codec_from_file(quicktime_t * file, int track);
00375 
00386 lqt_codec_info_t ** lqt_video_codec_from_file(quicktime_t * file, int track);
00387   
00396 void lqt_destroy_codec_info(lqt_codec_info_t ** info);
00397 
00409 void lqt_reorder_audio_codecs(lqt_codec_info_t ** codec_info);
00410 
00422 void lqt_reorder_video_codecs(lqt_codec_info_t ** codec_info);
00423 
00437 void lqt_set_default_parameter(lqt_codec_type type, int encode,
00438                                const char * codec_name,
00439                                const char * parameter_name,
00440                                lqt_parameter_value_t * val);
00441 
00452 void lqt_restore_default_parameters(lqt_codec_info_t * codec_info,
00453                                     int encode, int decode);
00454     
00455                                       
00464 void lqt_dump_codec_info(const lqt_codec_info_t * info);
00465 
00466 #ifdef __cplusplus
00467 }
00468 #endif /* __cplusplus */
00469 
00470 #pragma GCC visibility pop
00471 
00472 #endif /* _LQT_CODEC_INFO_H_ */

Generated on Sun Aug 30 13:05:26 2009 for libquicktime by  doxygen 1.6.1