libquicktime

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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 #ifdef __GNUC__
36 #pragma GCC visibility push(default)
37 #endif
38
39 #include <inttypes.h>
40
41
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif /* __cplusplus */
46
80 typedef enum
81 {
82 LQT_PARAMETER_INT,
83 LQT_PARAMETER_FLOAT,
84 LQT_PARAMETER_STRING,
85 LQT_PARAMETER_STRINGLIST,
86 /* This dummy type is used to separate sections (real_name will be on tab-label) */
87 LQT_PARAMETER_SECTION,
88 } lqt_parameter_type_t;
89
96 typedef union
97 {
98 int val_int;
99 char * val_string;
100 float val_float;
101 } lqt_parameter_value_t;
102
110 typedef struct
111 {
112 char * name;
114 char * real_name;
116 lqt_parameter_type_t type;
118 lqt_parameter_value_t val_default;
120 /*
121 * Minimum and maximum values:
122 * These are only valid for numeric types and if val_min < val_max
123 */
124
125 lqt_parameter_value_t val_min;
126 lqt_parameter_value_t val_max;
128 int num_digits;
130 /*
131 * Possible options (only valid for LQT_STRINGLIST)
132 */
133
134 int num_stringlist_options;
135 char ** stringlist_options;
136 char ** stringlist_labels;
138 char * help_string;
140 } lqt_parameter_info_t;
141
146 typedef enum
147 {
148 LQT_CODEC_AUDIO,
149 LQT_CODEC_VIDEO
150 } lqt_codec_type;
151
156 typedef enum
157 {
158 LQT_DIRECTION_ENCODE,
159 LQT_DIRECTION_DECODE,
160 LQT_DIRECTION_BOTH
161 } lqt_codec_direction;
162
172 typedef struct
173 {
174 int width;
175 int height;
176 } lqt_image_size_t;
177
178
183 #define LQT_CODEC_OBSOLETE (1<<24)
184
189 struct lqt_codec_info_s
190 {
191 int compatibility_flags;
193 /* These are set by the plugins */
194
195 char * name;
196 char * long_name;
197 char * description;
199 lqt_codec_type type;
200 lqt_codec_direction direction;
202 int num_fourccs;
203 char ** fourccs;
205 int num_wav_ids;
206 int * wav_ids;
209 int num_encoding_parameters;
210 lqt_parameter_info_t * encoding_parameters;
212 int num_decoding_parameters;
213 lqt_parameter_info_t * decoding_parameters;
215 /* The following members are set by libquicktime */
216
217 char * module_filename;
218 int module_index;
220 uint32_t file_time;
222 char * gettext_domain;
223 char * gettext_directory;
225 int num_encoding_colormodels;
226 int * encoding_colormodels;
228 int num_image_sizes;
230 lqt_image_size_t * image_sizes;
232 lqt_compression_id_t compression_id;
234 struct lqt_codec_info_s * next;
235 };
236
237
238 /* Global Entry points */
239
247 void lqt_registry_init();
248
257 void lqt_registry_destroy();
258
259 /* \ingroup codec_registry
260 *
261 * Save the registry file $HOME/.libquicktime_codecs.
262 * Under normal circumstances, you never need to call this function
263 */
264
265 void lqt_registry_write();
266
267
268 /******************************************************
269 * Non thread save functions for querying the
270 * codec registry. Suitable for single threaded
271 * applications (might become obsolete)
272 ******************************************************/
273
281 int lqt_get_num_audio_codecs();
282
290 int lqt_get_num_video_codecs();
291
300 const lqt_codec_info_t * lqt_get_audio_codec_info(int index);
301
310 const lqt_codec_info_t * lqt_get_video_codec_info(int index);
311
312 /********************************************************************
313 * Thread save function for getting codec parameters
314 * All these functions return a NULL terminated array of local
315 * copies of the codec data which must be freed using
316 * lqt_destroy_codec_info(lqt_codec_info_t ** info) declared below
317 ********************************************************************/
318
331 lqt_codec_info_t ** lqt_query_registry(int audio, int video,
332 int encode, int decode);
333
344 lqt_codec_info_t ** lqt_find_audio_codec(char * fourcc, int encode);
345
356 lqt_codec_info_t ** lqt_find_audio_codec_by_wav_id(int wav_id, int encode);
357
368 lqt_codec_info_t ** lqt_find_video_codec(char * fourcc, int encode);
369
370
371
372
373
374
384 lqt_codec_info_t ** lqt_find_audio_codec_by_name(const char * name);
385
395 lqt_codec_info_t ** lqt_find_video_codec_by_name(const char * name);
396
407 lqt_codec_info_t ** lqt_audio_codec_from_file(quicktime_t * file, int track);
408
419 lqt_codec_info_t ** lqt_video_codec_from_file(quicktime_t * file, int track);
420
429 void lqt_destroy_codec_info(lqt_codec_info_t ** info);
430
442 void lqt_reorder_audio_codecs(lqt_codec_info_t ** codec_info);
443
455 void lqt_reorder_video_codecs(lqt_codec_info_t ** codec_info);
456
470 void lqt_set_default_parameter(lqt_codec_type type, int encode,
471 const char * codec_name,
472 const char * parameter_name,
473 lqt_parameter_value_t * val);
474
485 void lqt_restore_default_parameters(lqt_codec_info_t * codec_info,
486 int encode, int decode);
487
488
497 void lqt_dump_codec_info(const lqt_codec_info_t * info);
498
499 #ifdef __cplusplus
500 }
501 #endif /* __cplusplus */
502
503 #ifdef __GNUC__
504 #pragma GCC visibility pop
505 #endif
506
507 #endif /* _LQT_CODEC_INFO_H_ */
lqt_codec_info_s::num_decoding_parameters
int num_decoding_parameters
Definition: lqt_codecinfo.h:212
lqt_codec_info_s::fourccs
char ** fourccs
Definition: lqt_codecinfo.h:203
lqt_codec_info_s::file_time
uint32_t file_time
Definition: lqt_codecinfo.h:220
lqt_codec_info_s::next
struct lqt_codec_info_s * next
Definition: lqt_codecinfo.h:234
lqt_codec_info_s::module_filename
char * module_filename
Definition: lqt_codecinfo.h:217
lqt_parameter_info_t::type
lqt_parameter_type_t type
Definition: lqt_codecinfo.h:116
lqt_codec_info_s::long_name
char * long_name
Definition: lqt_codecinfo.h:196
lqt_get_video_codec_info
const lqt_codec_info_t * lqt_get_video_codec_info(int index)
Return a video codec.
lqt_get_num_video_codecs
int lqt_get_num_video_codecs()
Return the number of installed video codecs.
lqt_codec_info_s::num_wav_ids
int num_wav_ids
Definition: lqt_codecinfo.h:205
lqt_find_audio_codec_by_name
lqt_codec_info_t ** lqt_find_audio_codec_by_name(const char *name)
Find an audio codec by its name.
lqt_audio_codec_from_file
lqt_codec_info_t ** lqt_audio_codec_from_file(quicktime_t *file, int track)
Get an audio codec from an open file.
lqt_codec_info_s::num_encoding_colormodels
int num_encoding_colormodels
Definition: lqt_codecinfo.h:225
LQT_PARAMETER_STRINGLIST
Definition: lqt_codecinfo.h:85
lqt_find_video_codec
lqt_codec_info_t ** lqt_find_video_codec(char *fourcc, int encode)
Find a video codec for a given fourcc.
lqt_codec_info_s::direction
lqt_codec_direction direction
Definition: lqt_codecinfo.h:200
lqt_codec_info_s::encoding_colormodels
int * encoding_colormodels
Definition: lqt_codecinfo.h:226
lqt_codec_direction
lqt_codec_direction
Direction of the codec.
Definition: lqt_codecinfo.h:156
lqt_codec_info_s::num_image_sizes
int num_image_sizes
Definition: lqt_codecinfo.h:228
lqt_parameter_value_t::val_float
float val_float
Definition: lqt_codecinfo.h:100
lqt_image_size_t
Image size.
Definition: lqt_codecinfo.h:172
lqt_get_audio_codec_info
const lqt_codec_info_t * lqt_get_audio_codec_info(int index)
Return an audio codec.
lqt_parameter_info_t::num_digits
int num_digits
Definition: lqt_codecinfo.h:128
lqt_codec_info_s::description
char * description
Definition: lqt_codecinfo.h:197
lqt_parameter_info_t::stringlist_options
char ** stringlist_options
Definition: lqt_codecinfo.h:135
lqt_dump_codec_info
void lqt_dump_codec_info(const lqt_codec_info_t *info)
Dump a codec info to stderr.
lqt_parameter_info_t::val_max
lqt_parameter_value_t val_max
Definition: lqt_codecinfo.h:126
LQT_PARAMETER_STRING
Definition: lqt_codecinfo.h:84
lqt_query_registry
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.
lqt_codec_info_s::num_encoding_parameters
int num_encoding_parameters
Definition: lqt_codecinfo.h:209
lqt_parameter_info_t
Structure describing a parameter.
Definition: lqt_codecinfo.h:110
lqt_codec_info_s::gettext_directory
char * gettext_directory
Definition: lqt_codecinfo.h:223
lqt_codec_info_s::decoding_parameters
lqt_parameter_info_t * decoding_parameters
Definition: lqt_codecinfo.h:213
lqt_parameter_info_t::help_string
char * help_string
Definition: lqt_codecinfo.h:138
lqt_codec_info_s
Structure describing a codec.
Definition: lqt_codecinfo.h:189
lqt_parameter_value_t::val_string
char * val_string
Definition: lqt_codecinfo.h:99
lqt_parameter_info_t::stringlist_labels
char ** stringlist_labels
Definition: lqt_codecinfo.h:136
lqt_codec_info_s::compatibility_flags
int compatibility_flags
Definition: lqt_codecinfo.h:191
lqt_set_default_parameter
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.
lqt_registry_destroy
void lqt_registry_destroy()
Destroy the codec registry.
lqt_codec_info_s::wav_ids
int * wav_ids
Definition: lqt_codecinfo.h:206
lqt_parameter_info_t::real_name
char * real_name
Definition: lqt_codecinfo.h:114
lqt_video_codec_from_file
lqt_codec_info_t ** lqt_video_codec_from_file(quicktime_t *file, int track)
Get a video codec from an open file.
lqt_registry_init
void lqt_registry_init()
Initialize the codec registry.
lqt_codec_info_s::type
lqt_codec_type type
Definition: lqt_codecinfo.h:199
lqt_parameter_info_t::num_stringlist_options
int num_stringlist_options
Definition: lqt_codecinfo.h:134
lqt_codec_info_s::gettext_domain
char * gettext_domain
Definition: lqt_codecinfo.h:222
lqt_parameter_type_t
lqt_parameter_type_t
Parameter types.
Definition: lqt_codecinfo.h:80
LQT_PARAMETER_SECTION
Definition: lqt_codecinfo.h:87
lqt_find_audio_codec_by_wav_id
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.
lqt_get_num_audio_codecs
int lqt_get_num_audio_codecs()
Return the number of installed audio codecs.
lqt_codec_info_s::compression_id
lqt_compression_id_t compression_id
Definition: lqt_codecinfo.h:232
lqt_reorder_audio_codecs
void lqt_reorder_audio_codecs(lqt_codec_info_t **codec_info)
Reorder audio codecs.
lqt_codec_info_s::image_sizes
lqt_image_size_t * image_sizes
Definition: lqt_codecinfo.h:230
lqt_codec_info_s::name
char * name
Definition: lqt_codecinfo.h:195
lqt_codec_info_s::module_index
int module_index
Definition: lqt_codecinfo.h:218
lqt_restore_default_parameters
void lqt_restore_default_parameters(lqt_codec_info_t *codec_info, int encode, int decode)
Restore a default parameter from the codec module.
lqt_parameter_value_t
Union for holding parameter values.
Definition: lqt_codecinfo.h:96
quicktime_t
struct quicktime_s quicktime_t
Quicktime handle.
Definition: quicktime.h:313
lqt_codec_info_s::encoding_parameters
lqt_parameter_info_t * encoding_parameters
Definition: lqt_codecinfo.h:210
lqt_parameter_info_t::name
char * name
Definition: lqt_codecinfo.h:112
LQT_PARAMETER_INT
Definition: lqt_codecinfo.h:82
lqt_parameter_value_t::val_int
int val_int
Definition: lqt_codecinfo.h:98
lqt_parameter_info_t::val_min
lqt_parameter_value_t val_min
Definition: lqt_codecinfo.h:125
lqt_parameter_info_t::val_default
lqt_parameter_value_t val_default
Definition: lqt_codecinfo.h:118
lqt_codec_type
lqt_codec_type
Type of a codec (Audio or video)
Definition: lqt_codecinfo.h:146
lqt_destroy_codec_info
void lqt_destroy_codec_info(lqt_codec_info_t **info)
Destroy a codec info array.
lqt_find_video_codec_by_name
lqt_codec_info_t ** lqt_find_video_codec_by_name(const char *name)
Find a video codec by its name.
lqt_find_audio_codec
lqt_codec_info_t ** lqt_find_audio_codec(char *fourcc, int encode)
Find an audio codec for a given fourcc.
lqt_codec_info_s::num_fourccs
int num_fourccs
Definition: lqt_codecinfo.h:202
LQT_PARAMETER_FLOAT
Definition: lqt_codecinfo.h:83
lqt_reorder_video_codecs
void lqt_reorder_video_codecs(lqt_codec_info_t **codec_info)
Reorder video codecs.