# HG changeset patch # User michaelni # Date 1042332509 0 # Node ID 6129c88a6393484576733e94af5a18281793b820 # Parent 4dfe15ae00780cdca2e2f609282519dbf9521e67 get_format() diff -r 4dfe15ae0078 -r 6129c88a6393 avcodec.h --- a/avcodec.h Sat Jan 11 22:32:56 2003 +0000 +++ b/avcodec.h Sun Jan 12 00:48:29 2003 +0000 @@ -923,6 +923,16 @@ */ int me_subpel_quality; + /** + * 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); } AVCodecContext; typedef struct AVCodec { diff -r 4dfe15ae0078 -r 6129c88a6393 mpegvideo.c --- a/mpegvideo.c Sat Jan 11 22:32:56 2003 +0000 +++ b/mpegvideo.c Sun Jan 12 00:48:29 2003 +0000 @@ -86,6 +86,8 @@ static UINT16 (*default_mv_penalty)[MAX_MV*2+1]=NULL; static UINT8 default_fcode_tab[MAX_MV*2+1]; +enum PixelFormat ff_yuv420p_list[2]= {PIX_FMT_YUV420P, -1}; + static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[64], uint16_t (*qmat16_bias)[64], const UINT16 *quant_matrix, int bias, int qmin, int qmax) { diff -r 4dfe15ae0078 -r 6129c88a6393 mpegvideo.h --- a/mpegvideo.h Sat Jan 11 22:32:56 2003 +0000 +++ b/mpegvideo.h Sun Jan 12 00:48:29 2003 +0000 @@ -597,6 +597,7 @@ int src_x, int src_y, int w, int h); char ff_get_pict_type_char(int pict_type); +extern enum PixelFormat ff_yuv420p_list[2]; extern int ff_bit_exact; diff -r 4dfe15ae0078 -r 6129c88a6393 utils.c --- a/utils.c Sat Jan 11 22:32:56 2003 +0000 +++ b/utils.c Sun Jan 12 00:48:29 2003 +0000 @@ -185,6 +185,10 @@ //printf("R%X\n", pic->opaque); } +enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, enum PixelFormat * fmt){ + return fmt[0]; +} + void avcodec_get_context_defaults(AVCodecContext *s){ s->bit_rate= 800*1000; s->bit_rate_tolerance= s->bit_rate*10; @@ -207,6 +211,7 @@ s->me_method= ME_EPZS; s->get_buffer= avcodec_default_get_buffer; s->release_buffer= avcodec_default_release_buffer; + s->get_format= avcodec_default_get_format; s->me_subpel_quality=8; }