diff raw.c @ 2133:29f774bb85fe libavcodec

raw rgb support
author michael
date Wed, 21 Jul 2004 01:21:06 +0000
parents 141a9539e270
children caacb3f9ee51
line wrap: on
line diff
--- a/raw.c	Tue Jul 20 17:13:08 2004 +0000
+++ b/raw.c	Wed Jul 21 01:21:06 2004 +0000
@@ -83,6 +83,14 @@
 
     if (avctx->codec_tag)
         avctx->pix_fmt = findPixelFormat(avctx->codec_tag);
+    else if (avctx->bits_per_sample){
+        switch(avctx->bits_per_sample){
+        case 15: avctx->pix_fmt= PIX_FMT_RGB555; break;
+        case 16: avctx->pix_fmt= PIX_FMT_RGB565; break;
+        case 24: avctx->pix_fmt= PIX_FMT_BGR24 ; break;
+        case 32: avctx->pix_fmt= PIX_FMT_RGBA32; break;
+        }
+    }
     
     context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
     context->buffer = av_malloc(context->length);