-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofile.c
80 lines (70 loc) · 2.24 KB
/
profile.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* This file is part of tframetest.
*
* Copyright (c) 2023-2025 Tuxera Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <string.h>
#include "profile.h"
/*
* All the "cmp" profiles tries to match similar profile in "frametest" which
* uses 4:3 ratio for 2k and 4k with 32 bit colors.
*/
static profile_t profiles[] = {
{ "invalid", PROF_INVALID, 0, 0, 0, 0 },
{ "SD-32bit-cmp", PROF_SD, 720, 480, 4, 0 },
{ "SD-24bit", PROF_SD, 720, 480, 3, 0 },
{ "FULLHD-32bit-cmp", PROF_HD, 1920, 1080, 4, 0 },
{ "HD-24bit", PROF_HD, 1280, 720, 3, 0 },
{ "FULLHD-24bit", PROF_FULLHD, 1920, 1080, 3, 0 },
{ "2K-32bit-cmp", PROF_2K, 2048, 1556, 4, 0 },
{ "2K-24bit", PROF_2K, 2048, 1080, 3, 0 },
{ "4K-32bit-cmp", PROF_4K, 4096, 3112, 4, 0 },
{ "4K-24bit", PROF_4K, 3840, 2160, 3, 0 },
{ "4K-16bit", PROF_4K, 3840, 2160, 2, 0 },
{ "4K-32bit", PROF_4K, 3840, 2160, 4, 0 },
{ "8K-24bit", PROF_8K, 7680, 4320, 3, 0 },
{ "empty", PROF_CUSTOM, 0, 0, 0, 0 },
};
static size_t profile_cnt = sizeof(profiles) / sizeof(profiles[0]);
size_t profile_count(void)
{
return profile_cnt;
}
profile_t profile_get_by_name(const char *name)
{
if (!name)
return profiles[0];
for (size_t i = 1; i < profile_cnt; i++) {
if (strcmp(profiles[i].name, name) == 0)
return profiles[i];
}
return profiles[0];
}
profile_t profile_get_by_type(enum ProfileType prof)
{
for (size_t i = 1; i < profile_cnt; i++) {
if (profiles[i].prof == prof)
return profiles[i];
}
return profiles[0];
}
profile_t profile_get_by_index(size_t idx)
{
if (idx < profile_cnt)
return profiles[idx];
return profiles[0];
}