annotate fmt-conversion.c @ 37158:08bbd1e9036d

vd_ffmpeg: Rewrite ticket reference in comment Omit the issue tracking software's name. Despite the migration from Bugzilla to Trac we were able to keep the ticket numbers.
author al
date Fri, 15 Aug 2014 22:27:52 +0000
parents 6cc356239d4b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
33533
3552dac79b1a Add some missing libavutil #includes.
diego
parents: 33364
diff changeset
22 #include "libavutil/pixfmt.h"
32905
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
23 #include "libavutil/samplefmt.h"
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
24 #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
25 #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
26
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
27 static const struct {
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
28 int fmt;
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
29 enum AVPixelFormat pix_fmt;
28526
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
30 } conversion_map[] = {
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
31 { IMGFMT_ARGB, AV_PIX_FMT_ARGB },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
32 { IMGFMT_BGRA, AV_PIX_FMT_BGRA },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
33 { IMGFMT_BGR24, AV_PIX_FMT_BGR24 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
34 { IMGFMT_BGR16BE, AV_PIX_FMT_RGB565BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
35 { IMGFMT_BGR16LE, AV_PIX_FMT_RGB565LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
36 { IMGFMT_BGR15BE, AV_PIX_FMT_RGB555BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
37 { IMGFMT_BGR15LE, AV_PIX_FMT_RGB555LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
38 { IMGFMT_BGR12BE, AV_PIX_FMT_RGB444BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
39 { IMGFMT_BGR12LE, AV_PIX_FMT_RGB444LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
40 { IMGFMT_BGR8, AV_PIX_FMT_RGB8 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
41 { IMGFMT_BGR4, AV_PIX_FMT_RGB4 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
42 { IMGFMT_BGR1, AV_PIX_FMT_MONOBLACK },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
43 { IMGFMT_RGB1, AV_PIX_FMT_MONOBLACK },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
44 { IMGFMT_RG4B, AV_PIX_FMT_BGR4_BYTE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
45 { IMGFMT_BG4B, AV_PIX_FMT_RGB4_BYTE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
46 { IMGFMT_RGB48LE, AV_PIX_FMT_RGB48LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
47 { IMGFMT_RGB48BE, AV_PIX_FMT_RGB48BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
48 { IMGFMT_ABGR, AV_PIX_FMT_ABGR },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
49 { IMGFMT_RGBA, AV_PIX_FMT_RGBA },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
50 { IMGFMT_RGB24, AV_PIX_FMT_RGB24 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
51 { IMGFMT_RGB16BE, AV_PIX_FMT_BGR565BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
52 { IMGFMT_RGB16LE, AV_PIX_FMT_BGR565LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
53 { IMGFMT_RGB15BE, AV_PIX_FMT_BGR555BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
54 { IMGFMT_RGB15LE, AV_PIX_FMT_BGR555LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
55 { IMGFMT_RGB12BE, AV_PIX_FMT_BGR444BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
56 { IMGFMT_RGB12LE, AV_PIX_FMT_BGR444LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
57 { IMGFMT_RGB8, AV_PIX_FMT_BGR8 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
58 { IMGFMT_RGB4, AV_PIX_FMT_BGR4 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
59 { IMGFMT_BGR8, AV_PIX_FMT_PAL8 },
35718
821decdd28ad fmt-conversion: Fix PIX_FMT availability ifdefs to work as expected.
diego
parents: 35707
diff changeset
60 #if LIBAVUTIL_VERSION_MICRO >= 100
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
61 { IMGFMT_BGR32, AV_PIX_FMT_0RGB32 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
62 { IMGFMT_BGRA, AV_PIX_FMT_BGR0 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
63 { IMGFMT_RGBA, AV_PIX_FMT_RGB0 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
64 { IMGFMT_RGB64LE, AV_PIX_FMT_RGBA64LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
65 { IMGFMT_RGB64BE, AV_PIX_FMT_RGBA64BE },
35718
821decdd28ad fmt-conversion: Fix PIX_FMT availability ifdefs to work as expected.
diego
parents: 35707
diff changeset
66 #endif /* LIBAVUTIL_VERSION_MICRO >= 100 */
36104
4e3c56728d1e Support playback of JPEG 2000 digital cinema files.
cehoyos
parents: 35816
diff changeset
67 { IMGFMT_XYZ12LE, AV_PIX_FMT_XYZ12LE },
4e3c56728d1e Support playback of JPEG 2000 digital cinema files.
cehoyos
parents: 35816
diff changeset
68 { IMGFMT_XYZ12BE, AV_PIX_FMT_XYZ12BE },
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
69 { IMGFMT_422A, AV_PIX_FMT_YUVA422P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
70 { IMGFMT_444A, AV_PIX_FMT_YUVA444P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
71 { IMGFMT_GBR24P, AV_PIX_FMT_GBRP },
35718
821decdd28ad fmt-conversion: Fix PIX_FMT availability ifdefs to work as expected.
diego
parents: 35707
diff changeset
72 #if LIBAVUTIL_VERSION_MICRO >= 100
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
73 { IMGFMT_GBR12PLE, AV_PIX_FMT_GBRP12LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
74 { IMGFMT_GBR12PBE, AV_PIX_FMT_GBRP12BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
75 { IMGFMT_GBR14PLE, AV_PIX_FMT_GBRP14LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
76 { IMGFMT_GBR14PBE, AV_PIX_FMT_GBRP14BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
77 { IMGFMT_420P14_LE, AV_PIX_FMT_YUV420P14LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
78 { IMGFMT_420P14_BE, AV_PIX_FMT_YUV420P14BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
79 { IMGFMT_420P12_LE, AV_PIX_FMT_YUV420P12LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
80 { IMGFMT_420P12_BE, AV_PIX_FMT_YUV420P12BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
81 { IMGFMT_422P14_LE, AV_PIX_FMT_YUV422P14LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
82 { IMGFMT_422P14_BE, AV_PIX_FMT_YUV422P14BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
83 { IMGFMT_422P12_LE, AV_PIX_FMT_YUV422P12LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
84 { IMGFMT_422P12_BE, AV_PIX_FMT_YUV422P12BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
85 { IMGFMT_444P14_LE, AV_PIX_FMT_YUV444P14LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
86 { IMGFMT_444P14_BE, AV_PIX_FMT_YUV444P14BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
87 { IMGFMT_444P12_LE, AV_PIX_FMT_YUV444P12LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
88 { IMGFMT_444P12_BE, AV_PIX_FMT_YUV444P12BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
89 { IMGFMT_Y8A, AV_PIX_FMT_GRAY8A },
35718
821decdd28ad fmt-conversion: Fix PIX_FMT availability ifdefs to work as expected.
diego
parents: 35707
diff changeset
90 #endif /* LIBAVUTIL_VERSION_MICRO >= 100 */
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
91 { IMGFMT_Y16_LE, AV_PIX_FMT_GRAY16LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
92 { IMGFMT_Y16_BE, AV_PIX_FMT_GRAY16BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
93 { IMGFMT_YUY2, AV_PIX_FMT_YUYV422 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
94 { IMGFMT_UYVY, AV_PIX_FMT_UYVY422 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
95 { IMGFMT_NV12, AV_PIX_FMT_NV12 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
96 { IMGFMT_NV21, AV_PIX_FMT_NV21 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
97 { IMGFMT_Y800, AV_PIX_FMT_GRAY8 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
98 { IMGFMT_Y8, AV_PIX_FMT_GRAY8 },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
99 { IMGFMT_YVU9, AV_PIX_FMT_YUV410P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
100 { IMGFMT_IF09, AV_PIX_FMT_YUV410P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
101 { IMGFMT_YV12, AV_PIX_FMT_YUV420P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
102 { IMGFMT_I420, AV_PIX_FMT_YUV420P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
103 { IMGFMT_IYUV, AV_PIX_FMT_YUV420P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
104 { IMGFMT_411P, AV_PIX_FMT_YUV411P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
105 { IMGFMT_422P, AV_PIX_FMT_YUV422P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
106 { IMGFMT_444P, AV_PIX_FMT_YUV444P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
107 { IMGFMT_440P, AV_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
108
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
109 { IMGFMT_420A, AV_PIX_FMT_YUVA420P },
30115
ad61464d02a7 Add support for YUV format with alpha and fix the codecs.conf entry for vp6a
reimar
parents: 30110
diff changeset
110
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
111 { IMGFMT_420P16_LE, AV_PIX_FMT_YUV420P16LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
112 { IMGFMT_420P16_BE, AV_PIX_FMT_YUV420P16BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
113 { IMGFMT_420P10_LE, AV_PIX_FMT_YUV420P10LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
114 { IMGFMT_420P10_BE, AV_PIX_FMT_YUV420P10BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
115 { IMGFMT_420P9_LE, AV_PIX_FMT_YUV420P9LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
116 { IMGFMT_420P9_BE, AV_PIX_FMT_YUV420P9BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
117 { IMGFMT_422P16_LE, AV_PIX_FMT_YUV422P16LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
118 { IMGFMT_422P16_BE, AV_PIX_FMT_YUV422P16BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
119 { IMGFMT_422P10_LE, AV_PIX_FMT_YUV422P10LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
120 { IMGFMT_422P10_BE, AV_PIX_FMT_YUV422P10BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
121 { IMGFMT_422P9_LE, AV_PIX_FMT_YUV422P9LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
122 { IMGFMT_422P9_BE, AV_PIX_FMT_YUV422P9BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
123 { IMGFMT_444P16_LE, AV_PIX_FMT_YUV444P16LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
124 { IMGFMT_444P16_BE, AV_PIX_FMT_YUV444P16BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
125 { IMGFMT_444P10_LE, AV_PIX_FMT_YUV444P10LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
126 { IMGFMT_444P10_BE, AV_PIX_FMT_YUV444P10BE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
127 { IMGFMT_444P9_LE, AV_PIX_FMT_YUV444P9LE },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
128 { IMGFMT_444P9_BE, AV_PIX_FMT_YUV444P9BE },
28631
70a43ec47c61 Re-add accidentally discarded comment about YUVJ format.
reimar
parents: 28526
diff changeset
129
70a43ec47c61 Re-add accidentally discarded comment about YUVJ format.
reimar
parents: 28526
diff changeset
130 // 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
131 // 16 - 235 (see colorspaces.txt).
70a43ec47c61 Re-add accidentally discarded comment about YUVJ format.
reimar
parents: 28526
diff changeset
132 // Currently they are all treated the same way.
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
133 { IMGFMT_YV12, AV_PIX_FMT_YUVJ420P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
134 { IMGFMT_422P, AV_PIX_FMT_YUVJ422P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
135 { IMGFMT_444P, AV_PIX_FMT_YUVJ444P },
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
136 { IMGFMT_440P, AV_PIX_FMT_YUVJ440P },
37055
6cc356239d4b Update XvMC implementation to the changes in FFmpeg.
iive
parents: 36349
diff changeset
137 { IMGFMT_XVMC_IDCT_MPEG2, AV_PIX_FMT_XVMC },
36349
20b8efbdfba4 Restore support for old-style VDPAU.
reimar
parents: 36322
diff changeset
138 { IMGFMT_VDPAU_MPEG1, AV_PIX_FMT_VDPAU_MPEG1 },
20b8efbdfba4 Restore support for old-style VDPAU.
reimar
parents: 36322
diff changeset
139 { IMGFMT_VDPAU_MPEG2, AV_PIX_FMT_VDPAU_MPEG2 },
20b8efbdfba4 Restore support for old-style VDPAU.
reimar
parents: 36322
diff changeset
140 { IMGFMT_VDPAU_H264, AV_PIX_FMT_VDPAU_H264 },
20b8efbdfba4 Restore support for old-style VDPAU.
reimar
parents: 36322
diff changeset
141 { IMGFMT_VDPAU_WMV3, AV_PIX_FMT_VDPAU_WMV3 },
20b8efbdfba4 Restore support for old-style VDPAU.
reimar
parents: 36322
diff changeset
142 { IMGFMT_VDPAU_VC1, AV_PIX_FMT_VDPAU_VC1 },
20b8efbdfba4 Restore support for old-style VDPAU.
reimar
parents: 36322
diff changeset
143 { IMGFMT_VDPAU_MPEG4, AV_PIX_FMT_VDPAU_MPEG4 },
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
144 { 0, AV_PIX_FMT_NONE }
28526
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
145 };
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
146
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
147 enum AVPixelFormat imgfmt2pixfmt(int fmt)
28526
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
148 {
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
149 int i;
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
150 enum AVPixelFormat pix_fmt;
36322
d649e84ea8d5 Make VDPAU support work again with latest FFmpeg.
reimar
parents: 36172
diff changeset
151 if (IMGFMT_IS_VDPAU(fmt)) return AV_PIX_FMT_VDPAU;
28526
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
152 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
153 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
154 break;
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
155 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
156 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
157 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
158 return pix_fmt;
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
159 }
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
160
35707
4ba6b8d3197e Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents: 34932
diff changeset
161 int pixfmt2imgfmt(enum AVPixelFormat pix_fmt)
28526
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
162 {
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
163 int i;
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
164 int fmt;
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
165 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
166 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
167 break;
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
168 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
169 if (!fmt)
35816
f2bb2d68fe52 Be less verbose on unkown FFmpeg pixel formats.
cehoyos
parents: 35718
diff changeset
170 mp_msg(MSGT_GLOBAL, MSGL_DBG2, "Unsupported AVPixelFormat %i\n", pix_fmt);
28526
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
171 return fmt;
21efa4282730 Create a fmt-conversion.c file so fmt-conversion.h can be included by multiple files.
reimar
parents:
diff changeset
172 }
32905
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
173
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
174 static const struct {
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
175 int fmt;
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
176 enum AVSampleFormat sample_fmt;
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
177 } samplefmt_conversion_map[] = {
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
178 {AF_FORMAT_U8, AV_SAMPLE_FMT_U8},
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
179 {AF_FORMAT_S16_NE, AV_SAMPLE_FMT_S16},
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
180 {AF_FORMAT_S32_NE, AV_SAMPLE_FMT_S32},
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
181 {AF_FORMAT_FLOAT_NE, AV_SAMPLE_FMT_FLT},
36172
7bf03a973142 Do not pass random unsupported data to encoder.
reimar
parents: 36104
diff changeset
182 {AF_FORMAT_UNKNOWN, AV_SAMPLE_FMT_NONE}
32905
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
183 };
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
184
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
185 enum AVSampleFormat affmt2samplefmt(int fmt)
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
186 {
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
187 char str[50];
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
188 int i;
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
189 enum AVSampleFormat sample_fmt;
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
190 for (i = 0; samplefmt_conversion_map[i].fmt; i++)
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
191 if (samplefmt_conversion_map[i].fmt == fmt)
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
192 break;
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
193 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
194 if (sample_fmt == AV_SAMPLE_FMT_NONE)
32905
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
195 mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported format %s\n",
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
196 af_fmt2str(fmt, str, sizeof(str)));
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
197 return sample_fmt;
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
198 }
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
199
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
200 int samplefmt2affmt(enum AVSampleFormat sample_fmt)
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
201 {
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
202 int i;
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
203 int fmt;
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
204 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
205 if (samplefmt_conversion_map[i].sample_fmt == sample_fmt)
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
206 break;
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
207 fmt = samplefmt_conversion_map[i].fmt;
36172
7bf03a973142 Do not pass random unsupported data to encoder.
reimar
parents: 36104
diff changeset
208 if (fmt == AF_FORMAT_UNKNOWN)
32905
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
209 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
210 return fmt;
fd60388d370a Add conversion functions to and from AVSampleFormat.
reimar
parents: 31082
diff changeset
211 }