Newer
Older
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
/**
* LPC coefficient precision - used by FLAC encoder
* - encoding: set by user.
* - decoding: unused.
*/
int lpc_coeff_precision;
/**
* - encoding: set by user.
* - decoding: unused.
*/
int min_prediction_order;
/**
* - encoding: set by user.
* - decoding: unused.
*/
int max_prediction_order;
/**
* search method for selecting prediction order
* - encoding: set by user.
* - decoding: unused.
*/
int prediction_order_method;
/**
* - encoding: set by user.
* - decoding: unused.
*/
int min_partition_order;
/**
* - encoding: set by user.
* - decoding: unused.
*/
int max_partition_order;
/**
* AVCodec.
*/
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,
#if LIBAVCODEC_VERSION_INT < ((50<<16)+(0<<8)+0)
Michael Niedermayer
committed
void *dummy; // FIXME remove next time we break binary compatibility
const AVRational *supported_framerates; ///array of supported framerates, or NULL if any, array is terminated by {0,0}
const enum PixelFormat *pix_fmts; ///array of supported pixel formats, or NULL if unknown, array is terminanted by -1
* four components are given, that's all.
* the last component is alpha
*/
/**
* AVPaletteControl
* This structure defines a method for communicating palette changes
* between and demuxer and a decoder.
*/
#define AVPALETTE_SIZE 1024
typedef struct AVPaletteControl {
/* demuxer sets this to 1 to indicate the palette has changed;
* decoder resets to 0 */
int palette_changed;
/* 4-byte ARGB palette entries, stored in native byte order; note that
* the individual palette components should be on a 8-bit scale; if
* the palette data comes from a IBM VGA native format, the component
* data is probably 6 bits in size and needs to be scaled */
unsigned int palette[AVPALETTE_COUNT];
typedef struct AVSubtitleRect {
uint16_t x;
uint16_t y;
uint16_t w;
uint16_t h;
uint16_t nb_colors;
int linesize;
uint32_t *rgba_palette;
uint8_t *bitmap;
} AVSubtitleRect;
typedef struct AVSubtitle {
uint16_t format; /* 0 = graphics */
uint32_t start_display_time; /* relative to packet pts, in ms */
uint32_t end_display_time; /* relative to packet pts, in ms */
uint32_t num_rects;
AVSubtitleRect *rects;
extern AVCodec ac3_encoder;
extern AVCodec mp2_encoder;
extern AVCodec mp3lame_encoder;
extern AVCodec oggvorbis_encoder;
Michael Niedermayer
committed
extern AVCodec faac_encoder;
Michael Niedermayer
committed
extern AVCodec flac_encoder;
extern AVCodec xvid_encoder;
Michael Niedermayer
committed
extern AVCodec h261_encoder;
extern AVCodec h263_encoder;
extern AVCodec h263p_encoder;
Garrick Meeker
committed
extern AVCodec flv_encoder;
Roman Shaposhnik
committed
extern AVCodec dvvideo_encoder;
extern AVCodec ljpeg_encoder;
extern AVCodec jpegls_encoder;
extern AVCodec png_encoder;
extern AVCodec ppm_encoder;
extern AVCodec pgm_encoder;
extern AVCodec pgmyuv_encoder;
extern AVCodec pbm_encoder;
extern AVCodec pam_encoder;
extern AVCodec msmpeg4v1_encoder;
extern AVCodec msmpeg4v2_encoder;
extern AVCodec msmpeg4v3_encoder;
extern AVCodec wmv1_encoder;
extern AVCodec wmv2_encoder;
Michael Niedermayer
committed
extern AVCodec ffv1_encoder;
Michael Niedermayer
committed
extern AVCodec mdec_encoder;
extern AVCodec sonic_encoder;
extern AVCodec sonic_ls_encoder;
extern AVCodec svq1_encoder;
extern AVCodec x264_encoder;
Michael Niedermayer
committed
extern AVCodec h261_decoder;
extern AVCodec msmpeg4v1_decoder;
extern AVCodec msmpeg4v2_decoder;
extern AVCodec msmpeg4v3_decoder;
extern AVCodec vc1_decoder;
Alex Beregszaszi
committed
extern AVCodec wmv3_decoder;
extern AVCodec mpeg1video_decoder;
extern AVCodec mpeg2video_decoder;
Garrick Meeker
committed
extern AVCodec flv_decoder;
extern AVCodec rv30_decoder;
extern AVCodec rv40_decoder;
extern AVCodec wmav1_decoder;
extern AVCodec wmav2_decoder;
extern AVCodec png_decoder;
extern AVCodec mp3on4_decoder;
extern AVCodec cook_decoder;
extern AVCodec truespeech_decoder;
Alex Beregszaszi
committed
extern AVCodec tta_decoder;
extern AVCodec mace3_decoder;
extern AVCodec mace6_decoder;
Michael Niedermayer
committed
extern AVCodec cyuv_decoder;
Alex Beregszaszi
committed
extern AVCodec theora_decoder;
extern AVCodec amr_nb_decoder;
extern AVCodec amr_wb_encoder;
extern AVCodec amr_wb_decoder;
extern AVCodec aac_decoder;
extern AVCodec mpeg4aac_decoder;
Michael Niedermayer
committed
extern AVCodec ffv1_decoder;
Michael Niedermayer
committed
extern AVCodec mdec_decoder;
extern AVCodec roq_decoder;
extern AVCodec interplay_video_decoder;
extern AVCodec xan_wc3_decoder;
extern AVCodec rpza_decoder;
extern AVCodec cinepak_decoder;
extern AVCodec msrle_decoder;
extern AVCodec msvideo1_decoder;
extern AVCodec vmdvideo_decoder;
extern AVCodec vmdaudio_decoder;
extern AVCodec truemotion1_decoder;
extern AVCodec truemotion2_decoder;
extern AVCodec mszh_decoder;
extern AVCodec zlib_decoder;
Nick Kurshev
committed
extern AVCodec ra_144_decoder;
extern AVCodec ra_288_decoder;
extern AVCodec roq_dpcm_decoder;
extern AVCodec interplay_dpcm_decoder;
extern AVCodec xan_dpcm_decoder;
extern AVCodec sol_dpcm_decoder;
extern AVCodec sonic_decoder;
extern AVCodec qtrle_decoder;
extern AVCodec tscc_decoder;
extern AVCodec cscd_decoder;
extern AVCodec nuv_decoder;
extern AVCodec ulti_decoder;
extern AVCodec qdraw_decoder;
extern AVCodec xl_decoder;
extern AVCodec qpeg_decoder;
extern AVCodec shorten_decoder;
extern AVCodec wnv1_decoder;
extern AVCodec aasc_decoder;
extern AVCodec alac_decoder;
extern AVCodec ws_snd1_decoder;
extern AVCodec indeo2_decoder;
extern AVCodec vorbis_decoder;
extern AVCodec fraps_decoder;
extern AVCodec libgsm_encoder;
extern AVCodec libgsm_decoder;
extern AVCodec mmvideo_decoder;
extern AVCodec zmbv_decoder;
extern AVCodec avs_decoder;
extern AVCodec smacker_decoder;
extern AVCodec smackaud_decoder;
extern AVCodec kmvc_decoder;
extern AVCodec flashsv_decoder;
Stefan Gehrer
committed
extern AVCodec cavs_decoder;
/* pcm codecs */
#define PCM_CODEC(id, name) \
extern AVCodec name ## _decoder; \
Michael Niedermayer
committed
extern AVCodec name ## _encoder
PCM_CODEC(CODEC_ID_PCM_S32LE, pcm_s32le);
PCM_CODEC(CODEC_ID_PCM_S32BE, pcm_s32be);
PCM_CODEC(CODEC_ID_PCM_U32LE, pcm_u32le);
PCM_CODEC(CODEC_ID_PCM_U32BE, pcm_u32be);
PCM_CODEC(CODEC_ID_PCM_S24LE, pcm_s24le);
PCM_CODEC(CODEC_ID_PCM_S24BE, pcm_s24be);
PCM_CODEC(CODEC_ID_PCM_U24LE, pcm_u24le);
PCM_CODEC(CODEC_ID_PCM_U24BE, pcm_u24be);
PCM_CODEC(CODEC_ID_PCM_S24DAUD, pcm_s24daud);
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_IMA_DK3, adpcm_ima_dk3);
PCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
PCM_CODEC(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws);
PCM_CODEC(CODEC_ID_ADPCM_SMJPEG, adpcm_ima_smjpeg);
PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
PCM_CODEC(CODEC_ID_ADPCM_XA, adpcm_xa);
PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx);
PCM_CODEC(CODEC_ID_ADPCM_EA, adpcm_ea);
PCM_CODEC(CODEC_ID_ADPCM_G726, adpcm_g726);
PCM_CODEC(CODEC_ID_ADPCM_CT, adpcm_ct);
PCM_CODEC(CODEC_ID_ADPCM_SWF, adpcm_swf);
Vidar Madsen
committed
PCM_CODEC(CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha);
PCM_CODEC(CODEC_ID_ADPCM_SBPRO_4, adpcm_sbpro_4);
PCM_CODEC(CODEC_ID_ADPCM_SBPRO_3, adpcm_sbpro_3);
PCM_CODEC(CODEC_ID_ADPCM_SBPRO_2, adpcm_sbpro_2);
#undef PCM_CODEC
/* dummy raw video codec */
extern AVCodec rawvideo_encoder;
extern AVCodec rawvideo_decoder;
/* the following codecs use external GPL libs */
extern AVCodec ac3_decoder;
extern AVCodec dts_decoder;
Wolfram Gloger
committed
extern AVCodec dvdsub_encoder;
extern AVCodec dvdsub_decoder;
extern AVCodec dvbsub_encoder;
extern AVCodec dvbsub_decoder;
Michael Niedermayer
committed
struct AVResampleContext;
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);
struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
Michael Niedermayer
committed
int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
William Juwono
committed
void av_resample_close(struct AVResampleContext *c);
Michael Niedermayer
committed
/* 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,
Todd Kirby
committed
int leftBand, int rightBand,
int padtop, int padbottom,
int padleft, int padright);
Michael Niedermayer
committed
void img_resample(ImgReSampleContext *s,
AVPicture *output, const AVPicture *input);
void img_resample_close(ImgReSampleContext *s);
/**
* Allocate memory for a picture. Call avpicture_free to free it.
*
* @param picture the picture to be filled in.
* @param pix_fmt the format of the picture.
* @param width the width of the picture.
* @param height the height of the picture.
* @return 0 if successful, -1 if not.
*/
int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height);
/* Free a picture previously allocated by avpicture_alloc. */
void avpicture_free(AVPicture *picture);
int avpicture_fill(AVPicture *picture, uint8_t *ptr,
int pix_fmt, int width, int height);
int avpicture_layout(const 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);
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
enum PixelFormat avcodec_get_pix_fmt(const char* name);
unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p);
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(const AVPicture *src,
int pix_fmt, int width, int height);
/* convert among pixel formats */
int img_convert(AVPicture *dst, int dst_pix_fmt,
const AVPicture *src, int pix_fmt,
int width, int height);
/* deinterlace a picture */
int avpicture_deinterlace(AVPicture *dst, const 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);
int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h);
enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
int avcodec_thread_init(AVCodecContext *s, int thread_count);
void avcodec_thread_free(AVCodecContext *s);
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
/**
* opens / inits the AVCodecContext.
* not thread save!
*/
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
int *got_sub_ptr,
const uint8_t *buf, int buf_size);
int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
Fabrice Bellard
committed
int *data_size_ptr,
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_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
int avcodec_close(AVCodecContext *avctx);
void avcodec_register_all(void);
void avcodec_flush_buffers(AVCodecContext *avctx);
void avcodec_default_free_buffers(AVCodecContext *s);
Michael Niedermayer
committed
/* misc usefull functions */
/**
* returns a single letter to describe the picture type
*/
char av_get_pict_type_char(int pict_type);
/* frame parsing */
typedef struct AVCodecParserContext {
void *priv_data;
struct AVCodecParser *parser;
int64_t frame_offset; /* offset of the current frame */
int64_t cur_offset; /* current offset
(incremented by each av_parser_parse()) */
int64_t last_frame_offset; /* offset of the last frame */
/* video info */
int pict_type; /* XXX: put it back in AVCodecContext */
int repeat_pict; /* XXX: put it back in AVCodecContext */
int64_t pts; /* pts of the current frame */
int64_t dts; /* dts of the current frame */
/* private data */
int64_t last_pts;
int64_t last_dts;
#define AV_PARSER_PTS_NB 4
int cur_frame_start_index;
int64_t cur_frame_offset[AV_PARSER_PTS_NB];
int64_t cur_frame_pts[AV_PARSER_PTS_NB];
int64_t cur_frame_dts[AV_PARSER_PTS_NB];
int flags;
#define PARSER_FLAG_COMPLETE_FRAMES 0x0001
} AVCodecParserContext;
typedef struct AVCodecParser {
int codec_ids[5]; /* several codec IDs are permitted */
int priv_data_size;
int (*parser_init)(AVCodecParserContext *s);
int (*parser_parse)(AVCodecParserContext *s,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size);
void (*parser_close)(AVCodecParserContext *s);
Michael Niedermayer
committed
int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
struct AVCodecParser *next;
} AVCodecParser;
extern AVCodecParser *av_first_parser;
void av_register_codec_parser(AVCodecParser *parser);
AVCodecParserContext *av_parser_init(int codec_id);
int av_parser_parse(AVCodecParserContext *s,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size,
int64_t pts, int64_t dts);
Michael Niedermayer
committed
int av_parser_change(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
Michael Niedermayer
committed
const uint8_t *buf, int buf_size, int keyframe);
void av_parser_close(AVCodecParserContext *s);
extern AVCodecParser mpegvideo_parser;
extern AVCodecParser mpeg4video_parser;
Stefan Gehrer
committed
extern AVCodecParser cavsvideo_parser;
Michael Niedermayer
committed
extern AVCodecParser h261_parser;
extern AVCodecParser h263_parser;
extern AVCodecParser h264_parser;
extern AVCodecParser mpegaudio_parser;
extern AVCodecParser ac3_parser;
extern AVCodecParser dvbsub_parser;
Michael Niedermayer
committed
typedef struct AVBitStreamFilterContext {
Michael Niedermayer
committed
struct AVBitStreamFilter *filter;
AVCodecParserContext *parser;
struct AVBitStreamFilterContext *next;
} AVBitStreamFilterContext;
typedef struct AVBitStreamFilter {
const char *name;
Michael Niedermayer
committed
int (*filter)(AVBitStreamFilterContext *bsfc,
AVCodecContext *avctx, const char *args,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size, int keyframe);
struct AVBitStreamFilter *next;
} AVBitStreamFilter;
extern AVBitStreamFilter *av_first_bitstream_filter;
void av_register_bitstream_filter(AVBitStreamFilter *bsf);
AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
AVCodecContext *avctx, const char *args,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size, int keyframe);
void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
extern AVBitStreamFilter dump_extradata_bsf;
extern AVBitStreamFilter remove_extradata_bsf;
Michael Niedermayer
committed
Michael Niedermayer
committed
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_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(unsigned int size);
Burkhard Plaum
committed
void *av_realloc_static(void *ptr, unsigned int size);
void img_copy(AVPicture *dst, const AVPicture *src,
int pix_fmt, int width, int height);
int img_crop(AVPicture *dst, const AVPicture *src,
int pix_fmt, int top_band, int left_band);
int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt,
int padtop, int padbottom, int padleft, int padright, int *color);
/* av_log API */
#include <stdarg.h>
#define AV_LOG_QUIET -1
#define AV_LOG_ERROR 0
#define AV_LOG_INFO 1
#define AV_LOG_DEBUG 2
Michael Niedermayer
committed
#ifdef __GNUC__
extern void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
Michael Niedermayer
committed
#else
extern void av_log(void*, int level, const char *fmt, ...);
#endif
extern void av_vlog(void*, int level, const char *fmt, va_list);
extern int av_log_get_level(void);
extern void av_log_set_level(int);
extern void av_log_set_callback(void (*)(void*, int, const char*, va_list));
/* endian macros */
Michael Niedermayer
committed
#if !defined(BE_16) || !defined(BE_32) || !defined(LE_16) || !defined(LE_32)
#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
(((uint8_t*)(x))[1] << 16) | \
(((uint8_t*)(x))[2] << 8) | \
((uint8_t*)(x))[3])
#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \
(((uint8_t*)(x))[2] << 16) | \
(((uint8_t*)(x))[1] << 8) | \
((uint8_t*)(x))[0])
Michael Niedermayer
committed
#endif
extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
#ifdef __cplusplus
}
#endif