summaryrefslogtreecommitdiff
path: root/libavcodec/raw.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-07-21 01:21:06 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-07-21 01:21:06 +0000
commit627c50b7fc3c9634921c90cd7bfdde02fd5622bc (patch)
treee2e6b54b46a87aed0781497a2e6578ff06b8be38 /libavcodec/raw.c
parentf1dc14a9fa364fa0532bc38103cfaab6d4161da8 (diff)
raw rgb support
Originally committed as revision 3330 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/raw.c')
-rw-r--r--libavcodec/raw.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index 8c554c41c5..b6fe0534ef 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -83,6 +83,14 @@ static int raw_init_decoder(AVCodecContext *avctx)
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);