19872
|
1 #include "avutil.h"
|
|
2 #include "img_format.h"
|
|
3
|
|
4 enum PixelFormat imgfmt2pixfmt(int fmt)
|
|
5 {
|
|
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 return PIX_FMT_GRAY8;
|
|
48 case IMGFMT_IF09:
|
|
49 case IMGFMT_YVU9:
|
|
50 return PIX_FMT_YUV410P;
|
|
51 case IMGFMT_YV12:
|
|
52 return PIX_FMT_YUV420P;
|
|
53 case IMGFMT_411P:
|
|
54 return PIX_FMT_YUV411P;
|
|
55 case IMGFMT_422P:
|
|
56 return PIX_FMT_YUV422P;
|
|
57 case IMGFMT_444P:
|
|
58 return PIX_FMT_YUV444P;
|
|
59 default:
|
|
60 fprintf(stderr, "Unsupported format %s\n", vo_format_name(fmt));
|
|
61 }
|
|
62
|
|
63 return PIX_FMT_NONE;
|
|
64 }
|