Mercurial > mplayer.hg
annotate fmt-conversion.c @ 33448:5e2569e52969
Do not call functions through a function pointer specifying more
arguments. It is theoretically possible to have calling models
where this would break horribly.
author | reimar |
---|---|
date | Wed, 01 Jun 2011 19:07:30 +0000 |
parents | e1ee4895e500 |
children | 3552dac79b1a |
rev | line source |
---|---|
28526
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
1 /* |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
2 * This file is part of MPlayer. |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
3 * |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
7 * (at your option) any later version. |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
8 * |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
12 * GNU General Public License for more details. |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
13 * |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
17 */ |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
18 |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
19 #include "mp_msg.h" |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
20 #include "libavutil/avutil.h" |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
21 #include "libmpcodecs/img_format.h" |
32905
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
22 #include "libavutil/samplefmt.h" |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
23 #include "libaf/af_format.h" |
28526
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
24 #include "fmt-conversion.h" |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
25 |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
26 static const struct { |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
27 int fmt; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
28 enum PixelFormat pix_fmt; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
29 } conversion_map[] = { |
30309
ddd809228aef
More format support in fmt-conversion.c: split RGB32 and BGR32
reimar
parents:
30115
diff
changeset
|
30 {IMGFMT_ARGB, PIX_FMT_ARGB}, |
ddd809228aef
More format support in fmt-conversion.c: split RGB32 and BGR32
reimar
parents:
30115
diff
changeset
|
31 {IMGFMT_BGRA, PIX_FMT_BGRA}, |
28526
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
32 {IMGFMT_BGR24, PIX_FMT_BGR24}, |
30311
8a67140f5fc1
Add big- and little-endian variants of the 15 and 16 bit RGB/BGR formats.
reimar
parents:
30309
diff
changeset
|
33 {IMGFMT_BGR16BE, PIX_FMT_RGB565BE}, |
8a67140f5fc1
Add big- and little-endian variants of the 15 and 16 bit RGB/BGR formats.
reimar
parents:
30309
diff
changeset
|
34 {IMGFMT_BGR16LE, PIX_FMT_RGB565LE}, |
8a67140f5fc1
Add big- and little-endian variants of the 15 and 16 bit RGB/BGR formats.
reimar
parents:
30309
diff
changeset
|
35 {IMGFMT_BGR15BE, PIX_FMT_RGB555BE}, |
8a67140f5fc1
Add big- and little-endian variants of the 15 and 16 bit RGB/BGR formats.
reimar
parents:
30309
diff
changeset
|
36 {IMGFMT_BGR15LE, PIX_FMT_RGB555LE}, |
31082
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30311
diff
changeset
|
37 {IMGFMT_BGR12BE, PIX_FMT_RGB444BE}, |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30311
diff
changeset
|
38 {IMGFMT_BGR12LE, PIX_FMT_RGB444LE}, |
28526
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
39 {IMGFMT_BGR8, PIX_FMT_RGB8}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
40 {IMGFMT_BGR4, PIX_FMT_RGB4}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
41 {IMGFMT_BGR1, PIX_FMT_MONOBLACK}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
42 {IMGFMT_RGB1, PIX_FMT_MONOBLACK}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
43 {IMGFMT_RG4B, PIX_FMT_BGR4_BYTE}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
44 {IMGFMT_BG4B, PIX_FMT_RGB4_BYTE}, |
29445 | 45 {IMGFMT_RGB48LE, PIX_FMT_RGB48LE}, |
46 {IMGFMT_RGB48BE, PIX_FMT_RGB48BE}, | |
30309
ddd809228aef
More format support in fmt-conversion.c: split RGB32 and BGR32
reimar
parents:
30115
diff
changeset
|
47 {IMGFMT_ABGR, PIX_FMT_ABGR}, |
ddd809228aef
More format support in fmt-conversion.c: split RGB32 and BGR32
reimar
parents:
30115
diff
changeset
|
48 {IMGFMT_RGBA, PIX_FMT_RGBA}, |
28526
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
49 {IMGFMT_RGB24, PIX_FMT_RGB24}, |
30311
8a67140f5fc1
Add big- and little-endian variants of the 15 and 16 bit RGB/BGR formats.
reimar
parents:
30309
diff
changeset
|
50 {IMGFMT_RGB16BE, PIX_FMT_BGR565BE}, |
8a67140f5fc1
Add big- and little-endian variants of the 15 and 16 bit RGB/BGR formats.
reimar
parents:
30309
diff
changeset
|
51 {IMGFMT_RGB16LE, PIX_FMT_BGR565LE}, |
8a67140f5fc1
Add big- and little-endian variants of the 15 and 16 bit RGB/BGR formats.
reimar
parents:
30309
diff
changeset
|
52 {IMGFMT_RGB15BE, PIX_FMT_BGR555BE}, |
8a67140f5fc1
Add big- and little-endian variants of the 15 and 16 bit RGB/BGR formats.
reimar
parents:
30309
diff
changeset
|
53 {IMGFMT_RGB15LE, PIX_FMT_BGR555LE}, |
31082
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30311
diff
changeset
|
54 {IMGFMT_RGB12BE, PIX_FMT_BGR444BE}, |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30311
diff
changeset
|
55 {IMGFMT_RGB12LE, PIX_FMT_BGR444LE}, |
28526
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
56 {IMGFMT_RGB8, PIX_FMT_BGR8}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
57 {IMGFMT_RGB4, PIX_FMT_BGR4}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
58 {IMGFMT_BGR8, PIX_FMT_PAL8}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
59 {IMGFMT_YUY2, PIX_FMT_YUYV422}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
60 {IMGFMT_UYVY, PIX_FMT_UYVY422}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
61 {IMGFMT_NV12, PIX_FMT_NV12}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
62 {IMGFMT_NV21, PIX_FMT_NV21}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
63 {IMGFMT_Y800, PIX_FMT_GRAY8}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
64 {IMGFMT_Y8, PIX_FMT_GRAY8}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
65 {IMGFMT_YVU9, PIX_FMT_YUV410P}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
66 {IMGFMT_IF09, PIX_FMT_YUV410P}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
67 {IMGFMT_YV12, PIX_FMT_YUV420P}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
68 {IMGFMT_I420, PIX_FMT_YUV420P}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
69 {IMGFMT_IYUV, PIX_FMT_YUV420P}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
70 {IMGFMT_411P, PIX_FMT_YUV411P}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
71 {IMGFMT_422P, PIX_FMT_YUV422P}, |
28631
70a43ec47c61
Re-add accidentally discarded comment about YUVJ format.
reimar
parents:
28526
diff
changeset
|
72 {IMGFMT_444P, PIX_FMT_YUV444P}, |
30098 | 73 {IMGFMT_440P, PIX_FMT_YUV440P}, |
30115
ad61464d02a7
Add support for YUV format with alpha and fix the codecs.conf entry for vp6a
reimar
parents:
30110
diff
changeset
|
74 |
ad61464d02a7
Add support for YUV format with alpha and fix the codecs.conf entry for vp6a
reimar
parents:
30110
diff
changeset
|
75 {IMGFMT_420A, PIX_FMT_YUVA420P}, |
ad61464d02a7
Add support for YUV format with alpha and fix the codecs.conf entry for vp6a
reimar
parents:
30110
diff
changeset
|
76 |
30110 | 77 {IMGFMT_420P16_LE, PIX_FMT_YUV420P16LE}, |
78 {IMGFMT_420P16_BE, PIX_FMT_YUV420P16BE}, | |
33364
e1ee4895e500
Support displaying of 9- and 10-bit pixel formats,
cehoyos
parents:
32908
diff
changeset
|
79 {IMGFMT_420P10_LE, PIX_FMT_YUV420P10LE}, |
e1ee4895e500
Support displaying of 9- and 10-bit pixel formats,
cehoyos
parents:
32908
diff
changeset
|
80 {IMGFMT_420P10_BE, PIX_FMT_YUV420P10BE}, |
e1ee4895e500
Support displaying of 9- and 10-bit pixel formats,
cehoyos
parents:
32908
diff
changeset
|
81 {IMGFMT_420P9_LE, PIX_FMT_YUV420P9LE}, |
e1ee4895e500
Support displaying of 9- and 10-bit pixel formats,
cehoyos
parents:
32908
diff
changeset
|
82 {IMGFMT_420P9_BE, PIX_FMT_YUV420P9BE}, |
30110 | 83 {IMGFMT_422P16_LE, PIX_FMT_YUV422P16LE}, |
84 {IMGFMT_422P16_BE, PIX_FMT_YUV422P16BE}, | |
33364
e1ee4895e500
Support displaying of 9- and 10-bit pixel formats,
cehoyos
parents:
32908
diff
changeset
|
85 {IMGFMT_422P10_LE, PIX_FMT_YUV422P10LE}, |
e1ee4895e500
Support displaying of 9- and 10-bit pixel formats,
cehoyos
parents:
32908
diff
changeset
|
86 {IMGFMT_422P10_BE, PIX_FMT_YUV422P10BE}, |
30110 | 87 {IMGFMT_444P16_LE, PIX_FMT_YUV444P16LE}, |
88 {IMGFMT_444P16_BE, PIX_FMT_YUV444P16BE}, | |
28631
70a43ec47c61
Re-add accidentally discarded comment about YUVJ format.
reimar
parents:
28526
diff
changeset
|
89 |
70a43ec47c61
Re-add accidentally discarded comment about YUVJ format.
reimar
parents:
28526
diff
changeset
|
90 // YUVJ are YUV formats that use the full Y range and not just |
70a43ec47c61
Re-add accidentally discarded comment about YUVJ format.
reimar
parents:
28526
diff
changeset
|
91 // 16 - 235 (see colorspaces.txt). |
70a43ec47c61
Re-add accidentally discarded comment about YUVJ format.
reimar
parents:
28526
diff
changeset
|
92 // Currently they are all treated the same way. |
70a43ec47c61
Re-add accidentally discarded comment about YUVJ format.
reimar
parents:
28526
diff
changeset
|
93 {IMGFMT_YV12, PIX_FMT_YUVJ420P}, |
28526
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
94 {IMGFMT_422P, PIX_FMT_YUVJ422P}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
95 {IMGFMT_444P, PIX_FMT_YUVJ444P}, |
30098 | 96 {IMGFMT_440P, PIX_FMT_YUVJ440P}, |
28631
70a43ec47c61
Re-add accidentally discarded comment about YUVJ format.
reimar
parents:
28526
diff
changeset
|
97 |
28526
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
98 {IMGFMT_XVMC_MOCO_MPEG2, PIX_FMT_XVMC_MPEG2_MC}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
99 {IMGFMT_XVMC_IDCT_MPEG2, PIX_FMT_XVMC_MPEG2_IDCT}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
100 {IMGFMT_VDPAU_MPEG1, PIX_FMT_VDPAU_MPEG1}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
101 {IMGFMT_VDPAU_MPEG2, PIX_FMT_VDPAU_MPEG2}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
102 {IMGFMT_VDPAU_H264, PIX_FMT_VDPAU_H264}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
103 {IMGFMT_VDPAU_WMV3, PIX_FMT_VDPAU_WMV3}, |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
104 {IMGFMT_VDPAU_VC1, PIX_FMT_VDPAU_VC1}, |
29843
f6d56a15f1d8
Support VDPAU hardware accelerated decoding of MPEG-4 ASP on capable
cehoyos
parents:
29445
diff
changeset
|
105 {IMGFMT_VDPAU_MPEG4, PIX_FMT_VDPAU_MPEG4}, |
28526
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
106 {0, PIX_FMT_NONE} |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
107 }; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
108 |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
109 enum PixelFormat imgfmt2pixfmt(int fmt) |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
110 { |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
111 int i; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
112 enum PixelFormat pix_fmt; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
113 for (i = 0; conversion_map[i].fmt; i++) |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
114 if (conversion_map[i].fmt == fmt) |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
115 break; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
116 pix_fmt = conversion_map[i].pix_fmt; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
117 if (pix_fmt == PIX_FMT_NONE) |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
118 mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported format %s\n", vo_format_name(fmt)); |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
119 return pix_fmt; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
120 } |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
121 |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
122 int pixfmt2imgfmt(enum PixelFormat pix_fmt) |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
123 { |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
124 int i; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
125 int fmt; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
126 for (i = 0; conversion_map[i].pix_fmt != PIX_FMT_NONE; i++) |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
127 if (conversion_map[i].pix_fmt == pix_fmt) |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
128 break; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
129 fmt = conversion_map[i].fmt; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
130 if (!fmt) |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
131 mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported PixelFormat %i\n", pix_fmt); |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
132 return fmt; |
21efa4282730
Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff
changeset
|
133 } |
32905
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
134 |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
135 static const struct { |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
136 int fmt; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
137 enum AVSampleFormat sample_fmt; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
138 } samplefmt_conversion_map[] = { |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
139 {AF_FORMAT_U8, AV_SAMPLE_FMT_U8}, |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
140 {AF_FORMAT_S16_NE, AV_SAMPLE_FMT_S16}, |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
141 {AF_FORMAT_S32_NE, AV_SAMPLE_FMT_S32}, |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
142 {AF_FORMAT_FLOAT_NE, AV_SAMPLE_FMT_FLT}, |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
143 {0, AV_SAMPLE_FMT_NONE} |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
144 }; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
145 |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
146 enum AVSampleFormat affmt2samplefmt(int fmt) |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
147 { |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
148 char str[50]; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
149 int i; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
150 enum AVSampleFormat sample_fmt; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
151 for (i = 0; samplefmt_conversion_map[i].fmt; i++) |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
152 if (samplefmt_conversion_map[i].fmt == fmt) |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
153 break; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
154 sample_fmt = samplefmt_conversion_map[i].sample_fmt; |
32908
c93ae40fb504
Fix copy-and-paste error: Should be AV_SAMPLE_FMT_NONE instead of PIX_FMT_NONE.
reimar
parents:
32905
diff
changeset
|
155 if (sample_fmt == AV_SAMPLE_FMT_NONE) |
32905
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
156 mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported format %s\n", |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
157 af_fmt2str(fmt, str, sizeof(str))); |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
158 return sample_fmt; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
159 } |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
160 |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
161 int samplefmt2affmt(enum AVSampleFormat sample_fmt) |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
162 { |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
163 int i; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
164 int fmt; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
165 for (i = 0; samplefmt_conversion_map[i].sample_fmt != AV_SAMPLE_FMT_NONE; i++) |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
166 if (samplefmt_conversion_map[i].sample_fmt == sample_fmt) |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
167 break; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
168 fmt = samplefmt_conversion_map[i].fmt; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
169 if (!fmt) |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
170 mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported AVSampleFormat %i\n", sample_fmt); |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
171 return fmt; |
fd60388d370a
Add conversion functions to and from AVSampleFormat.
reimar
parents:
31082
diff
changeset
|
172 } |