Newer
Older
* pre pass for motion estimation.
* - encoding: set by user.
* - decoding: unused
* motion estimation pre pass compare function.
* - encoding: set by user.
* - decoding: unused
* ME pre pass diamond size & shape.
* - encoding: set by user.
* - decoding: unused
* subpel ME quality.
* - encoding: set by user.
* - decoding: unused
* callback to negotiate the pixelFormat.
* @param fmt is the list of formats which are supported by the codec,
* its terminated by -1 as 0 is a valid format, the formats are ordered by quality
* the first is allways the native one
* @return the choosen format
* - encoding: unused
* - decoding: set by user, if not set then the native format will always be choosen
*/
enum PixelFormat (*get_format)(struct AVCodecContext *s, enum PixelFormat * fmt);
/**
* DTG active format information (additionnal aspect ratio
* information only used in DVB MPEG2 transport streams). 0 if
* not set.
*
* - encoding: unused.
* - decoding: set by decoder
*/
int dtg_active_format;
#define FF_DTG_AFD_SAME 8
#define FF_DTG_AFD_4_3 9
#define FF_DTG_AFD_16_9 10
#define FF_DTG_AFD_14_9 11
#define FF_DTG_AFD_4_3_SP_14_9 13
#define FF_DTG_AFD_16_9_SP_14_9 14
#define FF_DTG_AFD_SP_4_3 15
/**
* Maximum motion estimation search range in subpel units.
* if 0 then no limit
*
* - encoding: set by user.
* - decoding: unused.
/**
* frame_rate_base.
* for variable fps this is 1
* - encoding: set by user.
* - decoding: set by lavc.
* @todo move this after frame_rate
*/
int frame_rate_base;
/**
* intra quantizer bias.
* - encoding: set by user.
* - decoding: unused
*/
int intra_quant_bias;
#define FF_DEFAULT_QUANT_BIAS 999999
/**
* inter quantizer bias.
* - encoding: set by user.
* - decoding: unused
*/
int inter_quant_bias;
/**
* color table ID.
* - encoding: unused.
* - decoding: which clrtable should be used for 8bit RGB images
* table have to be stored somewhere FIXME
*/
int color_table_id;
/**
* internal_buffer count.
* Dont touch, used by lavc default_get_buffer()
*/
int internal_buffer_count;
/**
* internal_buffers.
* Dont touch, used by lavc default_get_buffer()
*/
void *internal_buffer;
/**
* AVOption.
*/
typedef struct AVOption {
/** options' name */
const char *name; /* if name is NULL, it indicates a link to next */
/** short English text help or const struct AVOption* subpointer */
const char *help; // const struct AVOption* sub;
/** offset to context structure where the parsed value should be stored */
int offset;
/** options' type */
int type;
#define FF_OPT_TYPE_BOOL 1 ///< boolean - true,1,on (or simply presence)
#define FF_OPT_TYPE_DOUBLE 2 ///< double
#define FF_OPT_TYPE_INT 3 ///< integer
#define FF_OPT_TYPE_STRING 4 ///< string (finished with \0)
#define FF_OPT_TYPE_MASK 0x1f ///< mask for types - upper bits are various flags
//#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
#define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
#define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
/** min value (min == max -> no limits) */
double min;
/** maximum value for double/int */
double max;
/** default boo [0,1]l/double/int value */
double defval;
/**
* default string value (with optional semicolon delimited extra option-list
* i.e. option1;option2;option3
* defval might select other then first argument as default
*/
const char *defstr;
#define FF_OPT_MAX_DEPTH 10
} AVOption;
/**
* Parse option(s) and sets fields in passed structure
* @param strct structure where the parsed results will be written
* @param list list with AVOptions
* @param opts string with options for parsing
*/
int avoption_parse(void* strct, const AVOption* list, const char* opts);
/**
* AVCodec.
*/
int id;
int priv_data_size;
int (*init)(AVCodecContext *);
int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
* four components are given, that's all.
* the last component is alpha
*/
int linesize[4];
} AVPicture;
extern AVCodec ac3_encoder;
extern AVCodec mp2_encoder;
extern AVCodec mp3lame_encoder;
extern AVCodec oggvorbis_encoder;
extern AVCodec mpeg1video_encoder;
extern AVCodec h263_encoder;
extern AVCodec h263p_encoder;
extern AVCodec rv10_encoder;
extern AVCodec mjpeg_encoder;
extern AVCodec msmpeg4v1_encoder;
extern AVCodec msmpeg4v2_encoder;
extern AVCodec msmpeg4v3_encoder;
extern AVCodec wmv1_encoder;
extern AVCodec wmv2_encoder;
extern AVCodec msmpeg4v1_decoder;
extern AVCodec msmpeg4v2_decoder;
extern AVCodec msmpeg4v3_decoder;
extern AVCodec mpeg_decoder;
extern AVCodec h263i_decoder;
extern AVCodec rv10_decoder;
extern AVCodec dvvideo_decoder;
extern AVCodec dvaudio_decoder;
extern AVCodec wmav1_decoder;
extern AVCodec wmav2_decoder;
extern AVCodec mace3_decoder;
extern AVCodec mace6_decoder;
Michael Niedermayer
committed
extern AVCodec cyuv_decoder;
extern AVCodec amr_nb_decoder;
extern AVCodec aac_decoder;
extern AVCodec mpeg4aac_decoder;
/* pcm codecs */
#define PCM_CODEC(id, name) \
extern AVCodec name ## _decoder; \
Michael Niedermayer
committed
extern AVCodec name ## _encoder
PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le);
PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be);
PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le);
PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be);
PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8);
PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8);
PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw);
PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw);
/* adpcm codecs */
PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
#undef PCM_CODEC
/* dummy raw video codec */
extern AVCodec rawvideo_encoder;
extern AVCodec rawvideo_decoder;
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
/* the following codecs use external GPL libs */
extern AVCodec ac3_decoder;
/* resample.c */
struct ReSampleContext;
typedef struct ReSampleContext ReSampleContext;
ReSampleContext *audio_resample_init(int output_channels, int input_channels,
int output_rate, int input_rate);
int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
void audio_resample_close(ReSampleContext *s);
/* YUV420 format is assumed ! */
struct ImgReSampleContext;
typedef struct ImgReSampleContext ImgReSampleContext;
ImgReSampleContext *img_resample_init(int output_width, int output_height,
int input_width, int input_height);
Michael Niedermayer
committed
ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
int iwidth, int iheight,
int topBand, int bottomBand,
int leftBand, int rightBand);
void img_resample(ImgReSampleContext *s,
AVPicture *output, AVPicture *input);
void img_resample_close(ImgReSampleContext *s);
int avpicture_fill(AVPicture *picture, uint8_t *ptr,
int pix_fmt, int width, int height);
int avpicture_layout(AVPicture* src, int pix_fmt, int width, int height,
unsigned char *dest, int dest_size);
int avpicture_get_size(int pix_fmt, int width, int height);
void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
const char *avcodec_get_pix_fmt_name(int pix_fmt);
enum PixelFormat avcodec_get_pix_fmt(const char* name);
Fabrice Bellard
committed
#define FF_LOSS_RESOLUTION 0x0001 /* loss due to resolution change */
#define FF_LOSS_DEPTH 0x0002 /* loss due to color depth change */
#define FF_LOSS_COLORSPACE 0x0004 /* loss due to color space conversion */
#define FF_LOSS_ALPHA 0x0008 /* loss of alpha bits */
#define FF_LOSS_COLORQUANT 0x0010 /* loss due to color quantization */
#define FF_LOSS_CHROMA 0x0020 /* loss of chroma (e.g. rgb to gray conversion) */
int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
int has_alpha);
int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
int has_alpha, int *loss_ptr);
#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
int img_get_alpha_info(AVPicture *src, int pix_fmt, int width, int height);
/* convert among pixel formats */
int img_convert(AVPicture *dst, int dst_pix_fmt,
AVPicture *src, int pix_fmt,
int width, int height);
/* deinterlace a picture */
int avpicture_deinterlace(AVPicture *dst, AVPicture *src,
int pix_fmt, int width, int height);
/* external high level API */
extern AVCodec *first_avcodec;
unsigned avcodec_version(void);
unsigned avcodec_build(void);
void avcodec_init(void);
void register_avcodec(AVCodec *format);
AVCodec *avcodec_find_encoder(enum CodecID id);
AVCodec *avcodec_find_encoder_by_name(const char *name);
AVCodec *avcodec_find_decoder(enum CodecID id);
AVCodec *avcodec_find_decoder_by_name(const char *name);
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
void avcodec_default_free_buffers(AVCodecContext *s);
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
uint8_t *buf, int buf_size);
int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
Fabrice Bellard
committed
int *data_size_ptr,
uint8_t *buf, int buf_size);
int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
int avcodec_close(AVCodecContext *avctx);
void avcodec_register_all(void);
void avcodec_flush_buffers(AVCodecContext *avctx);
Michael Niedermayer
committed
/* misc usefull functions */
/**
* returns a single letter to describe the picture type
*/
char av_get_pict_type_char(int pict_type);
Michael Niedermayer
committed
/**
* reduce a fraction.
* this is usefull for framerate calculations
* @param max the maximum allowed for dst_nom & dst_den
* @return 1 if exact, 0 otherwise
*/
int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max);
/**
* rescale a 64bit integer.
* a simple a*b/c isnt possible as it can overflow
*/
int64_t av_rescale(int64_t a, int b, int c);
/**
* Interface for 0.5.0 version
*
* do not even think about it's usage for this moment
*/
typedef struct {
/// compressed size used from given memory buffer
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
int size;
/// I/P/B frame type
int frame_type;
} avc_enc_result_t;
/**
* Commands
* order can't be changed - once it was defined
*/
typedef enum {
// general commands
AVC_OPEN_BY_NAME = 0xACA000,
AVC_OPEN_BY_CODEC_ID,
AVC_OPEN_BY_FOURCC,
AVC_CLOSE,
AVC_FLUSH,
// pin - struct { uint8_t* src, uint_t src_size }
// pout - struct { AVPicture* img, consumed_bytes,
AVC_DECODE,
// pin - struct { AVPicture* img, uint8_t* dest, uint_t dest_size }
// pout - uint_t used_from_dest_size
AVC_ENCODE,
// query/get video commands
AVC_GET_VERSION = 0xACB000,
AVC_GET_WIDTH,
AVC_GET_HEIGHT,
AVC_GET_DELAY,
AVC_GET_QUANT_TABLE,
// ...
// query/get audio commands
AVC_GET_FRAME_SIZE = 0xABC000,
// maybe define some simple structure which
// might be passed to the user - but they can't
// contain any codec specific parts and these
// calls are usualy necessary only few times
// set video commands
AVC_SET_WIDTH = 0xACD000,
AVC_SET_HEIGHT,
// set video encoding commands
AVC_SET_FRAME_RATE = 0xACD800,
AVC_SET_QUALITY,
AVC_SET_HURRY_UP,
// set audio commands
AVC_SET_SAMPLE_RATE = 0xACE000,
AVC_SET_CHANNELS,
} avc_cmd_t;
/**
* \param handle allocated private structure by libavcodec
* for initialization pass NULL - will be returned pout
* user is supposed to know nothing about its structure
* \param cmd type of operation to be performed
* \param pint input parameter
* \param pout output parameter
*
* \returns command status - eventually for query command it might return
* integer resulting value
*/
int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
void *av_malloc(unsigned int size);
void *av_mallocz(unsigned int size);
void *av_realloc(void *ptr, unsigned int size);
char *av_strdup(const char *s);
void __av_freep(void **ptr);
#define av_freep(p) __av_freep((void **)(p))
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
/* for static data only */
/* call av_free_static to release all staticaly allocated tables */
void av_free_static(void);
void *__av_mallocz_static(void** location, unsigned int size);
#define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
#ifdef __cplusplus
}
#endif