extern "C" {
#endif
-#include "common.h"
-#include "rational.h"
+#include "avutil.h"
#include <sys/types.h> /* size_t */
+//FIXME the following 2 really dont belong in here
#define FFMPEG_VERSION_INT 0x000409
-#define FFMPEG_VERSION "0.4.9-pre1"
-#define LIBAVCODEC_BUILD 4755
-
-#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
-#define LIBAVCODEC_VERSION FFMPEG_VERSION
+#define FFMPEG_VERSION "CVS"
#define AV_STRINGIFY(s) AV_TOSTRING(s)
#define AV_TOSTRING(s) #s
-#define LIBAVCODEC_IDENT "FFmpeg" LIBAVCODEC_VERSION "b" AV_STRINGIFY(LIBAVCODEC_BUILD)
+
+#define LIBAVCODEC_VERSION_INT ((50<<16)+(1<<8)+0)
+#define LIBAVCODEC_VERSION 50.1.0
+#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
+
+#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
#define AV_NOPTS_VALUE int64_t_C(0x8000000000000000)
#define AV_TIME_BASE 1000000
CODEC_ID_AASC,
CODEC_ID_INDEO2,
CODEC_ID_FRAPS,
+ CODEC_ID_TRUEMOTION2,
+ CODEC_ID_BMP,
/* various pcm "codecs" */
CODEC_ID_PCM_S16LE= 0x10000,
CODEC_ID_PCM_U8,
CODEC_ID_PCM_MULAW,
CODEC_ID_PCM_ALAW,
+ CODEC_ID_PCM_S32LE,
+ CODEC_ID_PCM_S32BE,
+ CODEC_ID_PCM_U32LE,
+ CODEC_ID_PCM_U32BE,
+ CODEC_ID_PCM_S24LE,
+ CODEC_ID_PCM_S24BE,
+ CODEC_ID_PCM_U24LE,
+ CODEC_ID_PCM_U24BE,
+ CODEC_ID_PCM_S24DAUD,
/* various adpcm codecs */
CODEC_ID_ADPCM_IMA_QT= 0x11000,
CODEC_ID_ADPCM_G726,
CODEC_ID_ADPCM_CT,
CODEC_ID_ADPCM_SWF,
+ CODEC_ID_ADPCM_YAMAHA,
/* AMR */
CODEC_ID_AMR_NB= 0x12000,
CODEC_ID_ALAC,
CODEC_ID_WESTWOOD_SND1,
CODEC_ID_GSM,
+ CODEC_ID_QDM2,
CODEC_ID_OGGTHEORA= 0x16000,
+
+ /* subtitle codecs */
+ CODEC_ID_DVD_SUBTITLE= 0x17000,
+ CODEC_ID_DVB_SUBTITLE,
CODEC_ID_MPEG2TS= 0x20000, /* _FAKE_ codec to indicate a raw MPEG2 transport
stream (only used by libavformat) */
CODEC_TYPE_VIDEO,
CODEC_TYPE_AUDIO,
CODEC_TYPE_DATA,
+ CODEC_TYPE_SUBTITLE,
};
/**
ME_X1
};
-enum AVRounding {
- AV_ROUND_ZERO = 0, ///< round toward zero
- AV_ROUND_INF = 1, ///< round away from zero
- AV_ROUND_DOWN = 2, ///< round toward -infinity
- AV_ROUND_UP = 3, ///< round toward +infinity
- AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero
+enum AVDiscard{
+//we leave some space between them for extensions (drop some keyframes for intra only or drop just some bidir frames)
+ AVDISCARD_NONE =-16, ///< discard nothing
+ AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi
+ AVDISCARD_NONREF = 8, ///< discard all non reference
+ AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
+ AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
+ AVDISCARD_ALL = 48, ///< discard all
};
typedef struct RcOverride{
/* encoding support
these flags can be passed in AVCodecContext.flags before initing
- Note: note not everything is supported yet
+ Note: not everything is supported yet.
*/
#define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale
#define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode
#define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg)
#define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale
-#define CODEC_FLAG_EMU_EDGE 0x4000///< dont draw edges
+#define CODEC_FLAG_EMU_EDGE 0x4000///< don't draw edges
#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding
#define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead
of only at frame boundaries */
#define CODEC_FLAG2_FAST 0x00000001 ///< allow non spec compliant speedup tricks
#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< strictly enforce GOP size
#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< skip bitstream encoding
+#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< place global headers at every keyframe instead of in extradata
/* Unsupported options :
* Syntax Arithmetic coding (SAC)
*/
#define CODEC_CAP_DELAY 0x0020
-//the following defines might change, so dont expect compatibility if u use them
+//the following defines may change, don't expect compatibility if you use them
#define MB_TYPE_INTRA4x4 0x0001
#define MB_TYPE_INTRA16x16 0x0002 //FIXME h264 specific
#define MB_TYPE_INTRA_PCM 0x0004 //FIXME h264 specific
int linesize[4];\
/**\
* pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\
- * this isnt used by lavc unless the default get/release_buffer() is used\
+ * this isn't used by lavc unless the default get/release_buffer() is used\
* - encoding: \
* - decoding: \
*/\
#define FF_BUFFER_TYPE_INTERNAL 1
#define FF_BUFFER_TYPE_USER 2 ///< Direct rendering buffers (image is (de)allocated by user)
-#define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewher else, dont dealloc image (data/base), all other tables are not shared
-#define FF_BUFFER_TYPE_COPY 8 ///< just a (modified) copy of some other buffer, dont dealloc anything
+#define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewhere else, don't dealloc image (data/base), all other tables are not shared
+#define FF_BUFFER_TYPE_COPY 8 ///< just a (modified) copy of some other buffer, don't dealloc anything
#define FF_I_TYPE 1 // Intra
or AVFormatContext, which begin with an AVClass.
Needed because av_log is in libavcodec and has no visibility
of AVIn/OutputFormat */
+ struct AVOption *option;
};
/**
* mpeg4: global headers (they can be in the bitstream or here)
* the allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
* then extradata_size to avoid prolems if its read with the bitstream reader
+ * the bytewise contents of extradata must not depend on the architecture or cpu endianness
* - encoding: set/allocated/freed by lavc.
* - decoding: set/allocated/freed by user.
*/
void *extradata;
int extradata_size;
- /* video only */
/**
- * time base in which the timestamps are specified.
+ * this is the fundamental unit of time (in seconds) in terms
+ * of which frame timestamps are represented. for fixed-fps content,
+ * timebase should be 1/framerate and timestamp increments should be
+ * identically 1.
* - encoding: MUST be set by user
* - decoding: set by lavc.
*/
AVRational time_base;
+ /* video only */
/**
* picture width / height.
* - encoding: MUST be set by user.
enum SampleFormat sample_fmt; ///< sample format, currenly unused
/* the following data should not be initialized */
- int frame_size; ///< in samples, initialized when calling 'init'
+ /**
+ * samples per packet. initialized when calling 'init'
+ */
+ int frame_size;
int frame_number; ///< audio or video frame number
int real_pict_num; ///< returns the real picture number of previous encoded frame
/**
* hurry up amount.
+ * deprecated in favor of skip_idct and skip_frame
* - encoding: unused
* - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header
*/
/* unused, FIXME remove*/
int rtp_mode;
- int rtp_payload_size; /* The size of the RTP payload, the coder will */
+ int rtp_payload_size; /* The size of the RTP payload: the coder will */
/* do it's best to deliver a chunk with size */
/* below rtp_payload_size, the chunk will start */
/* with a start code on some codecs like H.263 */
/* headers inside the transmited RTP payload */
- /* The RTP callcack: This function is called */
- /* every time the encoder as a packet to send */
- /* Depends on the encoder if the data starts */
- /* with a Start Code (it should) H.263 does. */
- /* mb_nb contains the number of macroblocks */
- /* encoded in the RTP payload */
+ /* The RTP callback: This function is called */
+ /* every time the encoder has a packet to send */
+ /* Depends on the encoder if the data starts */
+ /* with a Start Code (it should) H.263 does. */
+ /* mb_nb contains the number of macroblocks */
+ /* encoded in the RTP payload */
void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
/* statistics, used for 2-pass encoding */
* - decoding: set by user
*/
int error_resilience;
-#define FF_ER_CAREFULL 1
+#define FF_ER_CAREFUL 1
#define FF_ER_COMPLIANT 2
#define FF_ER_AGGRESSIVE 3
#define FF_ER_VERY_AGGRESSIVE 4
* - decoding: set by lavc
*/
int has_b_frames;
-
- int block_align; ///< used by some WAV based audio codecs
+
+ /**
+ * number of bytes per packet if constant and known or 0
+ * used by some WAV based audio codecs
+ */
+ int block_align;
int parse_only; /* - decoding only: if true, only parsing is done
(function avcodec_parse_frame()). The frame
#define FF_IDCT_SIMPLEARM 10
#define FF_IDCT_H264 11
#define FF_IDCT_VP3 12
-#define FP_IDCT_IPP 13
+#define FF_IDCT_IPP 13
+#define FF_IDCT_XVIDMMX 14
/**
* slice count.
#define FF_MM_SSE2 0x0010 /* PIV SSE2 functions */
#define FF_MM_3DNOWEXT 0x0020 /* AMD 3DNowExt */
#endif /* HAVE_MMX */
+#ifdef HAVE_IWMMXT
+#define FF_MM_IWMMXT 0x0100 /* XScale IWMMXT */
+#endif /* HAVE_IWMMXT */
/**
* bits per sample/pixel from the demuxer (needed for huffyuv).
/**
* internal_buffer count.
- * Dont touch, used by lavc default_get_buffer()
+ * Don't touch, used by lavc default_get_buffer()
*/
int internal_buffer_count;
/**
* internal_buffers.
- * Dont touch, used by lavc default_get_buffer()
+ * Don't touch, used by lavc default_get_buffer()
*/
void *internal_buffer;
* - decoding: unused
*/
int me_penalty_compensation;
-} AVCodecContext;
+ /**
+ *
+ * - encoding: unused
+ * - decoding: set by user.
+ */
+ enum AVDiscard skip_loop_filter;
-/**
- * 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;
+ /**
+ *
+ * - encoding: unused
+ * - decoding: set by user.
+ */
+ enum AVDiscard skip_idct;
+
+ /**
+ *
+ * - encoding: unused
+ * - decoding: set by user.
+ */
+ enum AVDiscard skip_frame;
+} AVCodecContext;
/**
* AVCodec.
int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
uint8_t *buf, int buf_size);
int capabilities;
+#if LIBAVCODEC_VERSION_INT < ((50<<16)+(0<<8)+0)
void *dummy; // FIXME remove next time we break binary compatibility
+#endif
struct AVCodec *next;
void (*flush)(AVCodecContext *);
const AVRational *supported_framerates; ///array of supported framerates, or NULL if any, array is terminated by {0,0}
} AVPaletteControl;
+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;
+} AVSubtitle;
+
extern AVCodec ac3_encoder;
extern AVCodec mp2_encoder;
extern AVCodec mp3lame_encoder;
extern AVCodec mp3_decoder;
extern AVCodec mp3adu_decoder;
extern AVCodec mp3on4_decoder;
+extern AVCodec qdm2_decoder;
extern AVCodec mace3_decoder;
extern AVCodec mace6_decoder;
extern AVCodec huffyuv_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;
extern AVCodec ra_144_decoder;
extern AVCodec fraps_decoder;
extern AVCodec libgsm_encoder;
extern AVCodec libgsm_decoder;
+extern AVCodec bmp_decoder;
/* pcm codecs */
#define PCM_CODEC(id, name) \
extern AVCodec name ## _decoder; \
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_ADPCM_G726, adpcm_g726);
PCM_CODEC(CODEC_ID_ADPCM_CT, adpcm_ct);
PCM_CODEC(CODEC_ID_ADPCM_SWF, adpcm_swf);
+PCM_CODEC(CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha);
#undef PCM_CODEC
extern AVCodec ac3_decoder;
extern AVCodec dts_decoder;
+/* subtitles */
+extern AVCodec dvdsub_encoder;
+extern AVCodec dvdsub_decoder;
+extern AVCodec dvbsub_encoder;
+extern AVCodec dvbsub_decoder;
+
/* resample.c */
struct ReSampleContext;
int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
int *got_picture_ptr,
uint8_t *buf, int buf_size);
+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,
int *data_size_ptr,
uint8_t *buf, int buf_size);
const short *samples);
int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const AVFrame *pict);
+int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
+ const AVSubtitle *sub);
int avcodec_close(AVCodecContext *avctx);
*/
char av_get_pict_type_char(int pict_type);
-/**
- * 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 with rounding to nearest.
- * a simple a*b/c isnt possible as it can overflow
- */
-int64_t av_rescale(int64_t a, int64_t b, int64_t c);
-
-/**
- * rescale a 64bit integer with specified rounding.
- * a simple a*b/c isnt possible as it can overflow
- */
-int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding);
-
-/**
- * rescale a 64bit integer by 2 rational numbers.
- */
-int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq);
/* frame parsing */
typedef struct AVCodecParserContext {
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 {
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size);
void (*parser_close)(AVCodecParserContext *s);
+ int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
struct AVCodecParser *next;
} AVCodecParser;
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size,
int64_t pts, int64_t dts);
+int av_parser_change(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size, int keyframe);
void av_parser_close(AVCodecParserContext *s);
extern AVCodecParser mpegvideo_parser;
extern AVCodecParser pnm_parser;
extern AVCodecParser mpegaudio_parser;
extern AVCodecParser ac3_parser;
+extern AVCodecParser dvdsub_parser;
+extern AVCodecParser dvbsub_parser;
/* memory */
void *av_malloc(unsigned int size);