Newer
Older
* - encoding: set by user
* - decoding: unused
*/
float lumi_masking;
/**
* temporary complexity masking (0-> disabled).
* - encoding: set by user
* - decoding: unused
*/
float temporal_cplx_masking;
/**
* spatial complexity masking (0-> disabled).
* - encoding: set by user
* - decoding: unused
*/
float spatial_cplx_masking;
/**
* p block masking (0-> disabled).
* - encoding: set by user
* - decoding: unused
*/
float p_masking;
* darkness masking (0-> disabled).
* - encoding: set by user
* - decoding: unused
*/
float dark_masking;
/* for binary compatibility */
int unused;
/**
* idct algorithm, see FF_IDCT_* below.
* - encoding: set by user
* - decoding: set by user
*/
int idct_algo;
#define FF_IDCT_AUTO 0
#define FF_IDCT_INT 1
#define FF_IDCT_SIMPLE 2
#define FF_IDCT_SIMPLEMMX 3
#define FF_IDCT_LIBMPEG2MMX 4
#define FF_IDCT_PS2 5
#define FF_IDCT_MLIB 6
#define FF_IDCT_ARM 7
Michael Niedermayer
committed
#define FF_IDCT_ALTIVEC 8
#define FF_IDCT_SH4 9
Alex Beregszaszi
committed
#define FF_IDCT_SIMPLEARM 10
Michael Niedermayer
committed
/**
* slice count.
* - encoding: set by lavc
* - decoding: set by user (or 0)
Michael Niedermayer
committed
*/
int slice_count;
/**
* slice offsets in the frame in bytes.
* - encoding: set/allocated by lavc
* - decoding: set/allocated by user (or NULL)
Michael Niedermayer
committed
*/
int *slice_offset;
/**
* error concealment flags.
* - encoding: unused
* - decoding: set by user
*/
int error_concealment;
#define FF_EC_GUESS_MVS 1
#define FF_EC_DEBLOCK 2
* dsp_mask could be add used to disable unwanted CPU features
*
* with FORCE flag you may instead enable given CPU features
* (Dangerous: usable in case of misdetection, improper usage however will
* result into program crash)
*/
unsigned dsp_mask;
#define FF_MM_FORCE 0x80000000 /* force usage of selected flags (OR) */
/* lower 16 bits - CPU features */
#ifdef HAVE_MMX
#define FF_MM_MMX 0x0001 /* standard MMX */
#define FF_MM_3DNOW 0x0004 /* AMD 3DNOW */
#define FF_MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */
#define FF_MM_SSE 0x0008 /* SSE functions */
#define FF_MM_SSE2 0x0010 /* PIV SSE2 functions */
#endif /* HAVE_MMX */
* bits per sample/pixel from the demuxer (needed for huffyuv).
* - encoding: set by lavc
* - decoding: set by user
* prediction method (needed for huffyuv).
* - encoding: set by user
* - decoding: unused
*/
int prediction_method;
#define FF_PRED_LEFT 0
#define FF_PRED_PLANE 1
#define FF_PRED_MEDIAN 2
* numerator and denominator must be relative prime and smaller then 256 for some video standards
* - encoding: set by user.
* - decoding: set by lavc.
* the picture in the bitstream.
* - encoding: set by lavc
* - decoding: set by lavc
* debug.
* - encoding: set by user.
* - decoding: set by user.
*/
int debug;
#define FF_DEBUG_PICT_INFO 1
#define FF_DEBUG_RC 2
#define FF_DEBUG_BITSTREAM 4
#define FF_DEBUG_MB_TYPE 8
#define FF_DEBUG_QP 16
#define FF_DEBUG_MV 32
Wolfgang Hesseler
committed
//#define FF_DEBUG_VIS_MV 0x00000040
#define FF_DEBUG_SKIP 0x00000080
#define FF_DEBUG_STARTCODE 0x00000100
#define FF_DEBUG_PTS 0x00000200
#define FF_DEBUG_ER 0x00000400
#define FF_DEBUG_BUGS 0x00001000
#define FF_DEBUG_VIS_QP 0x00002000
#define FF_DEBUG_VIS_MB_TYPE 0x00004000
Wolfgang Hesseler
committed
/**
* debug.
* - encoding: set by user.
* - decoding: set by user.
*/
int debug_mv;
#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
* error.
* - encoding: set by lavc if flags&CODEC_FLAG_PSNR
* - decoding: unused
*/
uint64_t error[4];
* minimum MB quantizer.
* - encoding: set by user.
* - decoding: unused
* maximum MB quantizer.
* - encoding: set by user.
* - decoding: unused
* motion estimation compare function.
* - encoding: set by user.
* - decoding: unused
* subpixel motion estimation compare function.
* - encoding: set by user.
* - decoding: unused
* macroblock compare function (not supported yet).
* - encoding: set by user.
* - decoding: unused
/**
* interlaced dct compare function
* - encoding: set by user.
* - decoding: unused
*/
int ildct_cmp;
#define FF_CMP_SAD 0
#define FF_CMP_SSE 1
#define FF_CMP_SATD 2
#define FF_CMP_DCT 3
#define FF_CMP_PSNR 4
#define FF_CMP_BIT 5
#define FF_CMP_RD 6
#define FF_CMP_ZERO 7
#define FF_CMP_VSAD 8
#define FF_CMP_VSSE 9
* ME diamond size & shape.
* - encoding: set by user.
* - decoding: unused
* amount of previous MV predictors (2a+1 x 2a+1 square).
* - encoding: set by user.
* - decoding: unused
*/
int last_predictor_count;
* 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;
Michael Niedermayer
committed
#define FF_LAMBDA_SHIFT 7
#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
#define FF_LAMBDA_MAX (256*128-1)
#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
/**
* global quality for codecs which cannot change it per frame.
* this should be proportional to MPEG1/2/4 qscale.
* - encoding: set by user.
* - decoding: unused
*/
int global_quality;
#define FF_CODER_TYPE_VLC 0
#define FF_CODER_TYPE_AC 1
/**
* coder type
* - encoding: set by user.
* - decoding: unused
*/
int coder_type;
/**
* context model
* - encoding: set by user.
* - decoding: unused
*/
int context_model;
/**
* slice flags
* - encoding: unused
* - decoding: set by user.
*/
int slice_flags;
#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
/**
* XVideo Motion Acceleration
* - encoding: forbidden
* - decoding: set by decoder
*/
int xvmc_acceleration;
/**
* macroblock decision mode
* - encoding: set by user.
* - decoding: unused
*/
int mb_decision;
#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
#define FF_MB_DECISION_RD 2 ///< rate distoration
/**
* custom intra quantization matrix
* - encoding: set by user, can be NULL
* - decoding: set by lavc
*/
uint16_t *intra_matrix;
/**
* custom inter quantization matrix
* - encoding: set by user, can be NULL
* - decoding: set by lavc
*/
uint16_t *inter_matrix;
/**
* fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
* this is used to workaround some encoder bugs
* - encoding: unused
* - decoding: set by user, will be converted to upper case by lavc during init
*/
unsigned int stream_codec_tag;
/**
* scene change detection threshold.
* 0 is default, larger means fewer detected scene changes
* - encoding: set by user.
* - decoding: unused
*/
int scenechange_threshold;
Michael Niedermayer
committed
/**
* minimum lagrange multipler
* - encoding: set by user.
* - decoding: unused
*/
int lmin;
/**
* maximum lagrange multipler
* - encoding: set by user.
* - decoding: unused
*/
int lmax;
/**
* Palette control structure
* - encoding: ??? (no palette-enabled encoder yet)
* - decoding: set by user.
*/
struct AVPaletteControl *palctrl;
/**
* noise reduction strength
* - encoding: set by user.
* - decoding: unused
*/
int noise_reduction;
* called at the beginning of a frame to get cr buffer for it.
* buffer type (size, hints) must be the same. lavc won't check it.
* lavc will pass previous buffer in pic, function should return
* same buffer or new buffer with old frame "painted" into it.
* if pic.data[0] == NULL must behave like get_buffer().
* - decoding: set by lavc, user can override
int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
/**
* number of bits which should be loaded into the rc buffer before decoding starts
* - encoding: set by user.
* - decoding: unused
*/
int rc_initial_buffer_occupancy;
/**
*
* - encoding: set by user.
* - decoding: unused
*/
int inter_threshold;
/**
* CODEC_FLAG2_*.
* - encoding: set by user.
* - decoding: set by user.
*/
int flags2;
/**
* simulates errors in the bitstream to test error concealment.
* - encoding: set by user.
* - decoding: unused.
*/
int error_rate;
Michael Niedermayer
committed
/**
* MP3 antialias algorithm, see FF_AA_* below.
* - encoding: unused
* - decoding: set by user
*/
int antialias_algo;
#define FF_AA_AUTO 0
#define FF_AA_FASTINT 1 //not implemented yet
#define FF_AA_INT 2
#define FF_AA_FLOAT 3
/**
* Quantizer noise shaping.
* - encoding: set by user
* - decoding: unused
*/
int quantizer_noise_shaping;
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
/**
* Thread count.
* is used to decide how many independant tasks should be passed to execute()
* - encoding: set by user
* - decoding: set by user
*/
int thread_count;
/**
* the codec may call this to execute several independant things. it will return only after
* finishing all tasks, the user may replace this with some multithreaded implementation, the
* default implementation will execute the parts serially
* @param count the number of functions this will be identical to thread_count if possible
* - encoding: set by lavc, user can override
* - decoding: set by lavc, user can override
*/
int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void **arg2, int *ret, int count);
/**
* Thread opaque.
* can be used by execute() to store some per AVCodecContext stuff.
* - encoding: set by execute()
* - decoding: set by execute()
*/
void *thread_opaque;
/**
* 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
*/
/**
* 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];
extern AVCodec ac3_encoder;
extern AVCodec mp2_encoder;
extern AVCodec mp3lame_encoder;
extern AVCodec oggvorbis_encoder;
Michael Niedermayer
committed
extern AVCodec faac_encoder;
extern AVCodec h263_encoder;
extern AVCodec h263p_encoder;
Garrick Meeker
committed
extern AVCodec flv_encoder;
extern AVCodec ljpeg_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 msmpeg4v1_decoder;
extern AVCodec msmpeg4v2_decoder;
extern AVCodec msmpeg4v3_decoder;
extern AVCodec mpeg1video_decoder;
extern AVCodec mpeg2video_decoder;
Garrick Meeker
committed
extern AVCodec flv_decoder;
extern AVCodec wmav1_decoder;
extern AVCodec wmav2_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 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 qtrle_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_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);
#undef PCM_CODEC
/* dummy raw video codec */
extern AVCodec rawvideo_encoder;
extern AVCodec rawvideo_decoder;
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
/* 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);
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);
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(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);
void avcodec_default_free_buffers(AVCodecContext *s);
int avcodec_pthread_init(AVCodecContext *s, int thread_count);
void avcodec_pthread_free(AVCodecContext *s);
int avcodec_pthread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
//FIXME func typedef
/**
* 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,
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
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
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