changeset 998:6129c88a6393 libavcodec

get_format()
author michaelni
date Sun, 12 Jan 2003 00:48:29 +0000
parents 4dfe15ae0078
children 74dc4105e147
files avcodec.h mpegvideo.c mpegvideo.h utils.c
diffstat 4 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 {
--- 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)
 {
--- 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;
 
--- 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;
 }