synced with r20176
[mplayer/glamo.git] / fmt-conversion.h
blob0103365e8bd574d381ddf7e6c7f78698124b47ed
1 #include "avutil.h"
2 #include "img_format.h"
4 enum PixelFormat imgfmt2pixfmt(int fmt)
6 switch (fmt) {
7 case IMGFMT_BGR32:
8 return PIX_FMT_RGB32;
9 case IMGFMT_BGR24:
10 return PIX_FMT_BGR24;
11 case IMGFMT_BGR16:
12 return PIX_FMT_BGR565;
13 case IMGFMT_BGR15:
14 return PIX_FMT_BGR555;
15 case IMGFMT_BGR8:
16 return PIX_FMT_BGR8;
17 case IMGFMT_BGR4:
18 return PIX_FMT_BGR4;
19 case IMGFMT_BGR1:
20 case IMGFMT_RGB1:
21 return PIX_FMT_MONOBLACK;
22 case IMGFMT_RG4B:
23 return PIX_FMT_RGB4_BYTE;
24 case IMGFMT_BG4B:
25 return PIX_FMT_BGR4_BYTE;
26 case IMGFMT_RGB32:
27 return PIX_FMT_BGR32;
28 case IMGFMT_RGB24:
29 return PIX_FMT_RGB24;
30 case IMGFMT_RGB16:
31 return PIX_FMT_RGB565;
32 case IMGFMT_RGB15:
33 return PIX_FMT_RGB555;
34 case IMGFMT_RGB8:
35 return PIX_FMT_RGB8;
36 case IMGFMT_RGB4:
37 return PIX_FMT_RGB4;
38 case IMGFMT_YUY2:
39 return PIX_FMT_YUYV422;
40 case IMGFMT_UYVY:
41 return PIX_FMT_UYVY422;
42 case IMGFMT_NV12:
43 return PIX_FMT_NV12;
44 case IMGFMT_NV21:
45 return PIX_FMT_NV21;
46 case IMGFMT_Y800:
47 case IMGFMT_Y8:
48 return PIX_FMT_GRAY8;
49 case IMGFMT_IF09:
50 case IMGFMT_YVU9:
51 return PIX_FMT_YUV410P;
52 case IMGFMT_I420:
53 case IMGFMT_YV12:
54 return PIX_FMT_YUV420P;
55 case IMGFMT_411P:
56 return PIX_FMT_YUV411P;
57 case IMGFMT_422P:
58 return PIX_FMT_YUV422P;
59 case IMGFMT_444P:
60 return PIX_FMT_YUV444P;
61 default:
62 fprintf(stderr, "Unsupported format %s\n", vo_format_name(fmt));
65 return PIX_FMT_NONE;