1 /*
2 * Copyright 2013-2016 Rinat Ibragimov
3 *
4 * This file is part of libvdpau-va-gl
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
25 #include "reverse-constant.hh"
26
27
28 #define CASE(q) case q: return #q
29
30
31 const char *
reverse_rgba_format(VdpRGBAFormat rgba_format)32 reverse_rgba_format(VdpRGBAFormat rgba_format)
33 {
34 switch (rgba_format) {
35 CASE(VDP_RGBA_FORMAT_B8G8R8A8);
36 CASE(VDP_RGBA_FORMAT_R8G8B8A8);
37 CASE(VDP_RGBA_FORMAT_R10G10B10A2);
38 CASE(VDP_RGBA_FORMAT_B10G10R10A2);
39 CASE(VDP_RGBA_FORMAT_A8);
40 default:
41 return "Unknown RGBA format";
42 }
43 }
44
45 const char *
reverse_ycbcr_format(VdpYCbCrFormat ycbcr_format)46 reverse_ycbcr_format(VdpYCbCrFormat ycbcr_format)
47 {
48 switch (ycbcr_format) {
49 CASE(VDP_YCBCR_FORMAT_NV12);
50 CASE(VDP_YCBCR_FORMAT_YV12);
51 CASE(VDP_YCBCR_FORMAT_UYVY);
52 CASE(VDP_YCBCR_FORMAT_YUYV);
53 CASE(VDP_YCBCR_FORMAT_Y8U8V8A8);
54 CASE(VDP_YCBCR_FORMAT_V8U8Y8A8);
55 default:
56 return "Unknown YCbCr format";
57 }
58 }
59
60 const char *
reverse_decoder_profile(VdpDecoderProfile profile)61 reverse_decoder_profile(VdpDecoderProfile profile)
62 {
63 switch (profile) {
64 CASE(VDP_DECODER_PROFILE_MPEG1);
65 CASE(VDP_DECODER_PROFILE_MPEG2_SIMPLE);
66 CASE(VDP_DECODER_PROFILE_MPEG2_MAIN);
67 CASE(VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE);
68 CASE(VDP_DECODER_PROFILE_H264_BASELINE);
69 CASE(VDP_DECODER_PROFILE_H264_MAIN);
70 CASE(VDP_DECODER_PROFILE_H264_HIGH);
71 CASE(VDP_DECODER_PROFILE_VC1_SIMPLE);
72 CASE(VDP_DECODER_PROFILE_VC1_MAIN);
73 CASE(VDP_DECODER_PROFILE_VC1_ADVANCED);
74 CASE(VDP_DECODER_PROFILE_MPEG4_PART2_SP);
75 CASE(VDP_DECODER_PROFILE_MPEG4_PART2_ASP);
76 CASE(VDP_DECODER_PROFILE_DIVX4_QMOBILE);
77 CASE(VDP_DECODER_PROFILE_DIVX4_MOBILE);
78 CASE(VDP_DECODER_PROFILE_DIVX4_HOME_THEATER);
79 CASE(VDP_DECODER_PROFILE_DIVX4_HD_1080P);
80 CASE(VDP_DECODER_PROFILE_DIVX5_QMOBILE);
81 CASE(VDP_DECODER_PROFILE_DIVX5_MOBILE);
82 CASE(VDP_DECODER_PROFILE_DIVX5_HOME_THEATER);
83 CASE(VDP_DECODER_PROFILE_DIVX5_HD_1080P);
84 default:
85 return "Unknown decoder profile";
86 }
87 }
88
89 const char *
reverse_status(VdpStatus status)90 reverse_status(VdpStatus status)
91 {
92 switch (status) {
93 CASE(VDP_STATUS_OK);
94 CASE(VDP_STATUS_NO_IMPLEMENTATION);
95 CASE(VDP_STATUS_DISPLAY_PREEMPTED);
96 CASE(VDP_STATUS_INVALID_HANDLE);
97 CASE(VDP_STATUS_INVALID_POINTER);
98 CASE(VDP_STATUS_INVALID_CHROMA_TYPE);
99 CASE(VDP_STATUS_INVALID_Y_CB_CR_FORMAT);
100 CASE(VDP_STATUS_INVALID_RGBA_FORMAT);
101 CASE(VDP_STATUS_INVALID_INDEXED_FORMAT);
102 CASE(VDP_STATUS_INVALID_COLOR_STANDARD);
103 CASE(VDP_STATUS_INVALID_COLOR_TABLE_FORMAT);
104 CASE(VDP_STATUS_INVALID_BLEND_FACTOR);
105 CASE(VDP_STATUS_INVALID_BLEND_EQUATION);
106 CASE(VDP_STATUS_INVALID_FLAG);
107 CASE(VDP_STATUS_INVALID_DECODER_PROFILE);
108 CASE(VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE);
109 CASE(VDP_STATUS_INVALID_VIDEO_MIXER_PARAMETER);
110 CASE(VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE);
111 CASE(VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE);
112 CASE(VDP_STATUS_INVALID_FUNC_ID);
113 CASE(VDP_STATUS_INVALID_SIZE);
114 CASE(VDP_STATUS_INVALID_VALUE);
115 CASE(VDP_STATUS_INVALID_STRUCT_VERSION);
116 CASE(VDP_STATUS_RESOURCES);
117 CASE(VDP_STATUS_HANDLE_DEVICE_MISMATCH);
118 CASE(VDP_STATUS_ERROR);
119 default:
120 return "Unknown VDP error";
121 }
122 }
123
124 const char *
reverse_indexed_format(VdpIndexedFormat indexed_format)125 reverse_indexed_format(VdpIndexedFormat indexed_format)
126 {
127 switch (indexed_format) {
128 CASE(VDP_INDEXED_FORMAT_A4I4);
129 CASE(VDP_INDEXED_FORMAT_I4A4);
130 CASE(VDP_INDEXED_FORMAT_A8I8);
131 CASE(VDP_INDEXED_FORMAT_I8A8);
132 default:
133 return "Unknown indexed format";
134 }
135 }
136