lqt_codecinfo.h
/*******************************************************************************
lqt_codecinfo.h
libquicktime - A library for reading and writing quicktime/avi/mp4 files.
http://libquicktime.sourceforge.net
Copyright (C) 2002 Heroine Virtual Ltd.
Copyright (C) 2002-2011 Members of the libquicktime project.
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*******************************************************************************/
/*
* Codec info structure for libquicktime
* (first approximation)
*/
/* Type of a codec parameter */
#ifndef _LQT_CODEC_INFO_H_
#define _LQT_CODEC_INFO_H_
#pragma GCC visibility push(default)
#include <inttypes.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef enum
{
LQT_PARAMETER_INT,
LQT_PARAMETER_FLOAT,
LQT_PARAMETER_STRING,
LQT_PARAMETER_STRINGLIST,
/* This dummy type is used to separate sections (real_name will be on tab-label) */
LQT_PARAMETER_SECTION,
} lqt_parameter_type_t;
typedef union
{
int val_int;
char * val_string;
float val_float;
} lqt_parameter_value_t;
typedef struct
{
char * name;
char * real_name;
lqt_parameter_type_t type;
lqt_parameter_value_t val_default;
/*
* Minimum and maximum values:
* These are only valid for numeric types and if val_min < val_max
*/
lqt_parameter_value_t val_min;
lqt_parameter_value_t val_max;
int num_digits;
/*
* Possible options (only valid for LQT_STRINGLIST)
*/
int num_stringlist_options;
char ** stringlist_options;
char ** stringlist_labels;
char * help_string;
} lqt_parameter_info_t;
typedef enum
{
LQT_CODEC_AUDIO,
LQT_CODEC_VIDEO
} lqt_codec_type;
typedef enum
{
LQT_DIRECTION_ENCODE,
LQT_DIRECTION_DECODE,
LQT_DIRECTION_BOTH
} lqt_codec_direction;
typedef struct
{
int width;
int height;
} lqt_image_size_t;
#define LQT_CODEC_OBSOLETE (1<<24)
struct lqt_codec_info_s
{
int compatibility_flags;
/* These are set by the plugins */
char * name;
char * long_name;
char * description;
lqt_codec_type type;
lqt_codec_direction direction;
int num_fourccs;
char ** fourccs;
int num_wav_ids;
int * wav_ids;
int num_encoding_parameters;
lqt_parameter_info_t * encoding_parameters;
int num_decoding_parameters;
lqt_parameter_info_t * decoding_parameters;
/* The following members are set by libquicktime */
char * module_filename;
int module_index;
uint32_t file_time;
char * gettext_domain;
char * gettext_directory;
int num_encoding_colormodels;
int * encoding_colormodels;
int num_image_sizes;
lqt_image_size_t * image_sizes;
lqt_compression_id_t compression_id;
struct lqt_codec_info_s * next;
};
/* Global Entry points */
void lqt_registry_init();
void lqt_registry_destroy();
/* \ingroup codec_registry
*
* Save the registry file $HOME/.libquicktime_codecs.
* Under normal circumstances, you never need to call this function
*/
void lqt_registry_write();
/******************************************************
* Non thread save functions for querying the
* codec registry. Suitable for single threaded
* applications (might become obsolete)
******************************************************/
int lqt_get_num_audio_codecs();
int lqt_get_num_video_codecs();
const lqt_codec_info_t * lqt_get_audio_codec_info(int index);
const lqt_codec_info_t * lqt_get_video_codec_info(int index);
/********************************************************************
* Thread save function for getting codec parameters
* All these functions return a NULL terminated array of local
* copies of the codec data which must be freed using
* lqt_destroy_codec_info(lqt_codec_info_t ** info) declared below
********************************************************************/
lqt_codec_info_t ** lqt_query_registry(int audio, int video,
int encode, int decode);
lqt_codec_info_t ** lqt_find_audio_codec(char * fourcc, int encode);
lqt_codec_info_t ** lqt_find_audio_codec_by_wav_id(int wav_id, int encode);
lqt_codec_info_t ** lqt_find_video_codec(char * fourcc, int encode);
lqt_codec_info_t ** lqt_find_audio_codec_by_name(const char * name);
lqt_codec_info_t ** lqt_find_video_codec_by_name(const char * name);
lqt_codec_info_t ** lqt_audio_codec_from_file(quicktime_t * file, int track);
lqt_codec_info_t ** lqt_video_codec_from_file(quicktime_t * file, int track);
void lqt_destroy_codec_info(lqt_codec_info_t ** info);
void lqt_reorder_audio_codecs(lqt_codec_info_t ** codec_info);
void lqt_reorder_video_codecs(lqt_codec_info_t ** codec_info);
void lqt_set_default_parameter(lqt_codec_type type, int encode,
const char * codec_name,
const char * parameter_name,
lqt_parameter_value_t * val);
void lqt_restore_default_parameters(lqt_codec_info_t * codec_info,
int encode, int decode);
void lqt_dump_codec_info(const lqt_codec_info_t * info);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#pragma GCC visibility pop
#endif /* _LQT_CODEC_INFO_H_ */
lqt_codec_info_s::num_decoding_parameters
int num_decoding_parameters
Definition: lqt_codecinfo.h:210
lqt_codec_info_s::fourccs
char ** fourccs
Definition: lqt_codecinfo.h:201
lqt_codec_info_s::file_time
uint32_t file_time
Definition: lqt_codecinfo.h:218
lqt_codec_info_s::next
struct lqt_codec_info_s * next
Definition: lqt_codecinfo.h:232
lqt_codec_info_s::module_filename
char * module_filename
Definition: lqt_codecinfo.h:215
lqt_parameter_info_t::type
lqt_parameter_type_t type
Definition: lqt_codecinfo.h:114
lqt_codec_info_s::long_name
char * long_name
Definition: lqt_codecinfo.h:194
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:203
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:223
LQT_PARAMETER_STRINGLIST
Definition: lqt_codecinfo.h:83
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:198
lqt_codec_info_s::encoding_colormodels
int * encoding_colormodels
Definition: lqt_codecinfo.h:224
lqt_codec_direction
lqt_codec_direction
Direction of the codec.
Definition: lqt_codecinfo.h:154
lqt_codec_info_s::num_image_sizes
int num_image_sizes
Definition: lqt_codecinfo.h:226
lqt_parameter_value_t::val_float
float val_float
Definition: lqt_codecinfo.h:98
lqt_image_size_t
Image size.
Definition: lqt_codecinfo.h:170
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:126
lqt_codec_info_s::description
char * description
Definition: lqt_codecinfo.h:195
lqt_parameter_info_t::stringlist_options
char ** stringlist_options
Definition: lqt_codecinfo.h:133
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:124
LQT_PARAMETER_STRING
Definition: lqt_codecinfo.h:82
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:207
lqt_parameter_info_t
Structure describing a parameter.
Definition: lqt_codecinfo.h:108
lqt_codec_info_s::gettext_directory
char * gettext_directory
Definition: lqt_codecinfo.h:221
lqt_codec_info_s::decoding_parameters
lqt_parameter_info_t * decoding_parameters
Definition: lqt_codecinfo.h:211
lqt_parameter_info_t::help_string
char * help_string
Definition: lqt_codecinfo.h:136
lqt_codec_info_s
Structure describing a codec.
Definition: lqt_codecinfo.h:187
lqt_parameter_value_t::val_string
char * val_string
Definition: lqt_codecinfo.h:97
lqt_parameter_info_t::stringlist_labels
char ** stringlist_labels
Definition: lqt_codecinfo.h:134
lqt_codec_info_s::compatibility_flags
int compatibility_flags
Definition: lqt_codecinfo.h:189
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:204
lqt_parameter_info_t::real_name
char * real_name
Definition: lqt_codecinfo.h:112
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:197
lqt_parameter_info_t::num_stringlist_options
int num_stringlist_options
Definition: lqt_codecinfo.h:132
lqt_codec_info_s::gettext_domain
char * gettext_domain
Definition: lqt_codecinfo.h:220
lqt_parameter_type_t
lqt_parameter_type_t
Parameter types.
Definition: lqt_codecinfo.h:78
LQT_PARAMETER_SECTION
Definition: lqt_codecinfo.h:85
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:230
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:228
lqt_codec_info_s::name
char * name
Definition: lqt_codecinfo.h:193
lqt_codec_info_s::module_index
int module_index
Definition: lqt_codecinfo.h:216
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:94
quicktime_t
struct quicktime_s quicktime_t
Quicktime handle.
Definition: quicktime.h:306
lqt_codec_info_s::encoding_parameters
lqt_parameter_info_t * encoding_parameters
Definition: lqt_codecinfo.h:208
lqt_parameter_info_t::name
char * name
Definition: lqt_codecinfo.h:110
LQT_PARAMETER_INT
Definition: lqt_codecinfo.h:80
lqt_parameter_value_t::val_int
int val_int
Definition: lqt_codecinfo.h:96
lqt_parameter_info_t::val_min
lqt_parameter_value_t val_min
Definition: lqt_codecinfo.h:123
lqt_parameter_info_t::val_default
lqt_parameter_value_t val_default
Definition: lqt_codecinfo.h:116
lqt_codec_type
lqt_codec_type
Type of a codec (Audio or video)
Definition: lqt_codecinfo.h:144
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:200
LQT_PARAMETER_FLOAT
Definition: lqt_codecinfo.h:81
lqt_reorder_video_codecs
void lqt_reorder_video_codecs(lqt_codec_info_t **codec_info)
Reorder video codecs.