libquicktime
lqt_codecinfo.h
1 /*******************************************************************************
2  lqt_codecinfo.h
3 
4  libquicktime - A library for reading and writing quicktime/avi/mp4 files.
5  http://libquicktime.sourceforge.net
6 
7  Copyright (C) 2002 Heroine Virtual Ltd.
8  Copyright (C) 2002-2011 Members of the libquicktime project.
9 
10  This library is free software; you can redistribute it and/or modify it under
11  the terms of the GNU Lesser General Public License as published by the Free
12  Software Foundation; either version 2.1 of the License, or (at your option)
13  any later version.
14 
15  This library is distributed in the hope that it will be useful, but WITHOUT
16  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18  details.
19 
20  You should have received a copy of the GNU Lesser General Public License along
21  with this library; if not, write to the Free Software Foundation, Inc., 51
22  Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 *******************************************************************************/
24 
25 /*
26  * Codec info structure for libquicktime
27  * (first approximation)
28  */
29 
30 /* Type of a codec parameter */
31 
32 #ifndef _LQT_CODEC_INFO_H_
33 #define _LQT_CODEC_INFO_H_
34 
35 #pragma GCC visibility push(default)
36 
37 #include <inttypes.h>
38 
39 
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif /* __cplusplus */
44 
78 typedef enum
79  {
84  /* This dummy type is used to separate sections (real_name will be on tab-label) */
87 
94 typedef union
95  {
96  int val_int;
97  char * val_string;
98  float val_float;
100 
108 typedef struct
109  {
110  char * name;
112  char * real_name;
114  lqt_parameter_type_t type;
118  /*
119  * Minimum and maximum values:
120  * These are only valid for numeric types and if val_min < val_max
121  */
122 
128  /*
129  * Possible options (only valid for LQT_STRINGLIST)
130  */
131 
136  char * help_string;
139 
144 typedef enum
145  {
146  LQT_CODEC_AUDIO,
147  LQT_CODEC_VIDEO
148  } lqt_codec_type;
149 
154 typedef enum
155  {
156  LQT_DIRECTION_ENCODE,
157  LQT_DIRECTION_DECODE,
158  LQT_DIRECTION_BOTH
160 
170 typedef struct
171  {
172  int width;
173  int height;
175 
176 
181 #define LQT_CODEC_OBSOLETE (1<<24)
182 
188  {
191  /* These are set by the plugins */
192 
193  char * name;
194  char * long_name;
195  char * description;
197  lqt_codec_type type;
198  lqt_codec_direction direction;
201  char ** fourccs;
204  int * wav_ids;
213  /* The following members are set by libquicktime */
214 
218  uint32_t file_time;
220  char * gettext_domain;
230  lqt_compression_id_t compression_id;
233  };
234 
235 
236 /* Global Entry points */
237 
245 void lqt_registry_init();
246 
255 void lqt_registry_destroy();
256 
257 /* \ingroup codec_registry
258  *
259  * Save the registry file $HOME/.libquicktime_codecs.
260  * Under normal circumstances, you never need to call this function
261  */
262 
263 void lqt_registry_write();
264 
265 
266 /******************************************************
267  * Non thread save functions for querying the
268  * codec registry. Suitable for single threaded
269  * applications (might become obsolete)
270  ******************************************************/
271 
280 
289 
298 const lqt_codec_info_t * lqt_get_audio_codec_info(int index);
299 
308 const lqt_codec_info_t * lqt_get_video_codec_info(int index);
309 
310 /********************************************************************
311  * Thread save function for getting codec parameters
312  * All these functions return a NULL terminated array of local
313  * copies of the codec data which must be freed using
314  * lqt_destroy_codec_info(lqt_codec_info_t ** info) declared below
315  ********************************************************************/
316 
329 lqt_codec_info_t ** lqt_query_registry(int audio, int video,
330  int encode, int decode);
331 
342 lqt_codec_info_t ** lqt_find_audio_codec(char * fourcc, int encode);
343 
354 lqt_codec_info_t ** lqt_find_audio_codec_by_wav_id(int wav_id, int encode);
355 
366 lqt_codec_info_t ** lqt_find_video_codec(char * fourcc, int encode);
367 
368 
369 
370 
371 
372 
383 
394 
406 
418 
428 
440 void lqt_reorder_audio_codecs(lqt_codec_info_t ** codec_info);
441 
453 void lqt_reorder_video_codecs(lqt_codec_info_t ** codec_info);
454 
468 void lqt_set_default_parameter(lqt_codec_type type, int encode,
469  const char * codec_name,
470  const char * parameter_name,
471  lqt_parameter_value_t * val);
472 
484  int encode, int decode);
485 
486 
495 void lqt_dump_codec_info(const lqt_codec_info_t * info);
496 
497 #ifdef __cplusplus
498 }
499 #endif /* __cplusplus */
500 
501 #pragma GCC visibility pop
502 
503 #endif /* _LQT_CODEC_INFO_H_ */
int num_decoding_parameters
Definition: lqt_codecinfo.h:210
char ** fourccs
Definition: lqt_codecinfo.h:201
uint32_t file_time
Definition: lqt_codecinfo.h:218
struct lqt_codec_info_s * next
Definition: lqt_codecinfo.h:232
char * module_filename
Definition: lqt_codecinfo.h:215
lqt_parameter_type_t type
Definition: lqt_codecinfo.h:114
char * long_name
Definition: lqt_codecinfo.h:194
const lqt_codec_info_t * lqt_get_video_codec_info(int index)
Return a video codec.
int lqt_get_num_video_codecs()
Return the number of installed video codecs.
int num_wav_ids
Definition: lqt_codecinfo.h:203
lqt_codec_info_t ** lqt_find_audio_codec_by_name(const char *name)
Find an audio codec by its name.
lqt_codec_info_t ** lqt_audio_codec_from_file(quicktime_t *file, int track)
Get an audio codec from an open file.
int num_encoding_colormodels
Definition: lqt_codecinfo.h:223
Definition: lqt_codecinfo.h:83
lqt_codec_info_t ** lqt_find_video_codec(char *fourcc, int encode)
Find a video codec for a given fourcc.
lqt_codec_direction direction
Definition: lqt_codecinfo.h:198
int * encoding_colormodels
Definition: lqt_codecinfo.h:224
lqt_codec_direction
Direction of the codec.
Definition: lqt_codecinfo.h:154
int num_image_sizes
Definition: lqt_codecinfo.h:226
float val_float
Definition: lqt_codecinfo.h:98
Image size.
Definition: lqt_codecinfo.h:170
const lqt_codec_info_t * lqt_get_audio_codec_info(int index)
Return an audio codec.
int num_digits
Definition: lqt_codecinfo.h:126
char * description
Definition: lqt_codecinfo.h:195
char ** stringlist_options
Definition: lqt_codecinfo.h:133
void lqt_dump_codec_info(const lqt_codec_info_t *info)
Dump a codec info to stderr.
lqt_parameter_value_t val_max
Definition: lqt_codecinfo.h:124
Definition: lqt_codecinfo.h:82
lqt_codec_info_t ** lqt_query_registry(int audio, int video, int encode, int decode)
Return an array of any combination of audio/video en/decoders.
int num_encoding_parameters
Definition: lqt_codecinfo.h:207
Structure describing a parameter.
Definition: lqt_codecinfo.h:108
char * gettext_directory
Definition: lqt_codecinfo.h:221
lqt_parameter_info_t * decoding_parameters
Definition: lqt_codecinfo.h:211
char * help_string
Definition: lqt_codecinfo.h:136
Structure describing a codec.
Definition: lqt_codecinfo.h:187
char * val_string
Definition: lqt_codecinfo.h:97
char ** stringlist_labels
Definition: lqt_codecinfo.h:134
int compatibility_flags
Definition: lqt_codecinfo.h:189
void lqt_set_default_parameter(lqt_codec_type type, int encode, const char *codec_name, const char *parameter_name, lqt_parameter_value_t *val)
Change a default value for a codec parameter.
void lqt_registry_destroy()
Destroy the codec registry.
int * wav_ids
Definition: lqt_codecinfo.h:204
char * real_name
Definition: lqt_codecinfo.h:112
lqt_codec_info_t ** lqt_video_codec_from_file(quicktime_t *file, int track)
Get a video codec from an open file.
void lqt_registry_init()
Initialize the codec registry.
lqt_codec_type type
Definition: lqt_codecinfo.h:197
int num_stringlist_options
Definition: lqt_codecinfo.h:132
char * gettext_domain
Definition: lqt_codecinfo.h:220
lqt_parameter_type_t
Parameter types.
Definition: lqt_codecinfo.h:78
Definition: lqt_codecinfo.h:85
lqt_codec_info_t ** lqt_find_audio_codec_by_wav_id(int wav_id, int encode)
Find an audio codec for a given WAV ID.
int lqt_get_num_audio_codecs()
Return the number of installed audio codecs.
lqt_compression_id_t compression_id
Definition: lqt_codecinfo.h:230
void lqt_reorder_audio_codecs(lqt_codec_info_t **codec_info)
Reorder audio codecs.
lqt_image_size_t * image_sizes
Definition: lqt_codecinfo.h:228
char * name
Definition: lqt_codecinfo.h:193
int module_index
Definition: lqt_codecinfo.h:216
void lqt_restore_default_parameters(lqt_codec_info_t *codec_info, int encode, int decode)
Restore a default parameter from the codec module.
Union for holding parameter values.
Definition: lqt_codecinfo.h:94
struct quicktime_s quicktime_t
Quicktime handle.
Definition: quicktime.h:306
lqt_parameter_info_t * encoding_parameters
Definition: lqt_codecinfo.h:208
char * name
Definition: lqt_codecinfo.h:110
Definition: lqt_codecinfo.h:80
int val_int
Definition: lqt_codecinfo.h:96
lqt_parameter_value_t val_min
Definition: lqt_codecinfo.h:123
lqt_parameter_value_t val_default
Definition: lqt_codecinfo.h:116
lqt_codec_type
Type of a codec (Audio or video)
Definition: lqt_codecinfo.h:144
void lqt_destroy_codec_info(lqt_codec_info_t **info)
Destroy a codec info array.
lqt_codec_info_t ** lqt_find_video_codec_by_name(const char *name)
Find a video codec by its name.
lqt_codec_info_t ** lqt_find_audio_codec(char *fourcc, int encode)
Find an audio codec for a given fourcc.
int num_fourccs
Definition: lqt_codecinfo.h:200
Definition: lqt_codecinfo.h:81
void lqt_reorder_video_codecs(lqt_codec_info_t **codec_info)
Reorder video codecs.