api_usage.html

来自「这个库实现了录象功能」· HTML 代码 · 共 724 行 · 第 1/3 页

HTML
724
字号
<span style="font-family: monospace;">int lqt_colormodel_has_alpha(intcolormodel);</span><br style="font-family: monospace;"><span style="font-family: monospace;">int lqt_colormodel_is_rgb(intcolormodel);</span><br style="font-family: monospace;"><span style="font-family: monospace;">int lqt_colormodel_is_yuv(intcolormodel);</span><br style="font-family: monospace;"><span style="font-family: monospace;"><br>int lqt_num_colormodels();</span><br style="font-family: monospace;"><span style="font-family: monospace;">const char *lqt_get_colormodel_string(int index);</span><br style="font-family: monospace;"><span style="font-family: monospace;">int lqt_get_colormodel(int index);</span><br style="font-family: monospace;"><br>The best idea is to decide, which colormodels you want to support inyour application. <span style="font-family: monospace;">BC_RGB888</span>and <span style="font-family: monospace;">BC_YUV420P</span> shouldalways be supported. Please note, that libquicktimes internalcolorspace converter is not the fastest out there. The more colorspacesyou can handle yourself, the fewer time consuming internal conversionswill be used. A nice library, which converts manylibquicktime colormodels, is <a href="http://gmerlin.soutceforge.net/gavl.html">gavl</a>. Then callfor each video track:<br><br><span style="font-family: monospace;">intlqt_get_best_colormodel(quicktime_t * file, int track, int * supported);</span><br><br><span style="font-family: monospace;">supported</span> is an array ofthe colorspaces, you can handle terminated with <span style="font-family: monospace;">LQT_COLORMODEL_NONE</span>. Thefunction works for both en- and decoding and tries to minimizeconversion overhead and information loss.<br><h3><a name="6._Codec_registry_interface"></a>6. Codec registryinterface</h3>This allows you to access the codecs, which are installed on the systemalong with information about them. To query the registry about theinstalled codecs, use:<br><br><span style="font-family: monospace;">lqt_codec_info_t **lqt_query_registry(int audio, int video,</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int encode, int decode);</span><br style="font-family: monospace;"><br>The return value is a NULL terminated array of <span style="font-family: monospace;">lqt_codec_info_t</span> pointers. Thecodec info is defined in lqt_codecinfo.h:<br><br><span style="font-family: monospace;">typedef struct lqt_codec_info_slqt_codec_info_t;<br><br style="font-family: monospace;"></span><span style="font-family: monospace;">struct lqt_codec_info_s</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; {</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; int compatibility_flags;/* Compatibility flags (See defines above) */</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; </span><span style="font-family: monospace;">char *name;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Name of thecodec&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; char *long_name;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*Long name of the codec&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; char *description;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;</span><span style="font-family: monospace;"> lqt_codec_type type;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; lqt_codec_directiondirection;</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; intnum_fourccs;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Fourccs, this codec can handle */</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; char ** fourccs;</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; int num_wav_ids;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; int * wav_ids;</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; int num_encoding_parameters;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; lqt_parameter_info_t *encoding_parameters;</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; int num_decoding_parameters;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; lqt_parameter_info_t *decoding_parameters;</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; /* Colormodels this codec canhandle */</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; int num_encoding_colormodels;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; int * encoding_colormodels;</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;"></span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; int decoding_colormodel;</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; /* The following members areset by libquicktime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; char *module_filename;&nbsp;&nbsp;&nbsp; /* Filename of the module&nbsp; */</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; intmodule_index;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*Index inside the module */</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; uint32_tfile_time;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Filemodification time&nbsp; */</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; struct lqt_codec_info_s *next;&nbsp;&nbsp; /* For chaining */</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; };</span><br style="font-family: monospace;"><br style="font-family: monospace;">Most interesting are the name, long name and description. The <span style="font-family: monospace;">encoding_parameters</span> and <span style="font-family: monospace;">decoding_parameters</span> arrayscontain informations about the parameters you can pass tolqt_set_[audio|video]_parameter. The parameter infos are defined likethis:<br><br><span style="font-family: monospace;">typedef enum</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; {</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;LQT_PARAMETER_INT,</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;LQT_PARAMETER_STRING,</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;LQT_PARAMETER_STRINGLIST, /* String with options */</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; /* This dummytype is used to separate sections (real_name will be on tab-label) */</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;LQT_PARAMETER_SECTION</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; } lqt_parameter_type_t;</span><br style="font-family: monospace;"><br style="font-family: monospace;"><span style="font-family: monospace;">typedef union</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; {</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; int val_int;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; char * val_string;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; } lqt_parameter_value_t;</span><br style="font-family: monospace;"><br style="font-family: monospace;"><span style="font-family: monospace;">typedef struct</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; {</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; /* Parameter name (to bepassed to quicktime_set_parameter() ) */</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; char * name;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; char * real_name; /* Othername (for making dialogs) */</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; lqt_parameter_type_t type;</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; lqt_parameter_value_tval_default;</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; /*</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp; *&nbsp;&nbsp;Minimum and maximum values:</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp; *&nbsp;&nbsp; Theseare only valid for numeric types and if val_min &lt; val_max</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp; */</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; int val_min;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; int val_max;</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; /*</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp; *&nbsp; Possibleoptions (only valid for LQT_STRINGLIST)</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp; */</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; int num_stringlist_options;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp; char ** stringlist_options;</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;">&nbsp; } lqt_parameter_info_t;</span><br style="font-family: monospace;"><br>You can also get the codec infos, when you read a file:<br><br><span style="font-family: monospace;">lqt_codec_info_t **lqt_audio_codec_from_file(quicktime_t *, int track);</span><br style="font-family: monospace;"><span style="font-family: monospace;">lqt_codec_info_t **lqt_video_codec_from_file(quicktime_t *, int track);</span><br><br>Codec infos are returned as a local copy, so you must free them. Thisis done with:<br><br><span style="font-family: monospace;">voidlqt_destroy_codec_info(lqt_codec_info_t ** info);</span><br><br></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?