annotate libmpcodecs/vd_raw.c @ 5037:0ef48d850bc9

hopefully fixed divx5 header + xvid conflict
author arpi
date Mon, 11 Mar 2002 00:39:40 +0000
parents eb57973314ae
children 3dcbf67c0de0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4969
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
1 #include <stdio.h>
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
2 #include <stdlib.h>
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
3
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
4 #include "config.h"
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
5 #include "mp_msg.h"
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
6
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
7 #include "vd_internal.h"
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
8
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
9 static vd_info_t info = {
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
10 "RAW Uncompressed Video",
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
11 "raw",
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
12 VFM_RAW,
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
13 "A'rpi",
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
14 "A'rpi & Alex",
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
15 "uncompressed"
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
16 };
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
17
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
18 LIBVD_EXTERN(raw)
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
19
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
20 // to set/get/query special features/parameters
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
21 static int control(sh_video_t *sh,int cmd,void* arg,...){
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
22 switch(cmd){
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
23 case VDCTRL_QUERY_FORMAT:
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
24 if( (*((int*)arg)) == sh->format ) return CONTROL_TRUE;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
25 return CONTROL_FALSE;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
26 }
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
27 return CONTROL_UNKNOWN;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
28 }
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
29
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
30 // init driver
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
31 static int init(sh_video_t *sh){
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
32 // set format fourcc for raw RGB:
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
33 if(sh->format==0){
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
34 switch(sh->bih->biBitCount){
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
35 case 15:
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
36 case 16: sh->format=IMGFMT_BGR15; break;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
37 case 24: sh->format=IMGFMT_BGR24; break;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
38 case 32: sh->format=IMGFMT_BGR32; break;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
39 default:
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
40 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"RAW: depth %d not supported\n",sh->bih->biBitCount);
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
41 }
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
42 }
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
43 mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,sh->format);
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
44 return 1;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
45 }
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
46
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
47 // uninit driver
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
48 static void uninit(sh_video_t *sh){
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
49 }
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
50
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
51 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
52
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
53 // decode a frame
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
54 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
55 mp_image_t* mpi;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
56 if(len<=0) return NULL; // skipped frame
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
57
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
58 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0,
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
59 sh->disp_w, sh->disp_h);
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
60 if(!mpi) return NULL;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
61
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
62 if(mpi->flags&MP_IMGFLAG_PLANAR){
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
63 // TODO !!!
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
64 mpi->planes[0]=data;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
65 mpi->stride[0]=mpi->width;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
66 } else {
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
67 mpi->planes[0]=data;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
68 mpi->stride[0]=mpi->width*(mpi->bpp/8);
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
69 }
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
70
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
71 return mpi;
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
72 }
db86fcf25ede xanim, raw, rle added
arpi
parents:
diff changeset
73