forked from zillevdr/vdr-plugin-softhddevice-drm
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconfig.cpp
More file actions
172 lines (154 loc) · 7.95 KB
/
Copy pathconfig.cpp
File metadata and controls
172 lines (154 loc) · 7.95 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// SPDX-License-Identifier: AGPL-3.0-or-later
/**
* @file config.cpp
* Plugin Configuration
*
* This file defines cSoftHdConfig, which is used to keep all
* the config settings, which are set via setup.conf, commandline
* or setup menu.
*
* @copyright 2011, 2015 by Johns. All Rights Reserved.
* @copyright 2018 zille. All Rights Reserved.
* @copyright 2025 - 2026 by Andreas Baierl. All Rights Reserved.
*
* @license{AGPL-3.0-or-later}
*/
#include <cstring>
#include <cstdlib>
#include <mutex>
#include "config.h"
#include "logger.h"
/**
* Parse setup parameters
*
* @param name paramter name (case sensetive)
* @param value value as string
*
* @return true if the parameter is supported, false otherwise
*/
bool cSoftHdConfig::SetupParse(const char *name, const char *value)
{
//LOGDEBUG("config: %s: '%s' = '%s'", __FUNCTION__, name, value);
// General
if (!strcasecmp(name, "HideMainMenuEntry")) { ConfigHideMainMenuEntry = atoi(value);
// Video
} else if (!strcasecmp(name, "VideoEnableHDR")) { ConfigVideoEnableHDR = atoi(value);
} else if (!strcasecmp(name, "VideoDisplayMode")) { ConfigVideoDisplayMode = std::min(atoi(value), static_cast<int>(CONFIG_DISPLAY_MODE_FOLLOW_VIDEO_INTERLACED));
} else if (!strcasecmp(name, "VideoChannelSwitchMode")){ ConfigVideoChannelSwitchMode = atoi(value);
// Audio
} else if (!strcasecmp(name, "AudioSoftvol")) { ConfigAudioSoftvol = atoi(value);
} else if (!strcasecmp(name, "AudioDownmix")) { ConfigAudioDownmix = atoi(value);
} else if (!strcasecmp(name, "AudioPassthrough")) { ConfigAudioPassthroughMask = abs(atoi(value));
ConfigAudioPassthroughState = atoi(value) > 0;
} else if (!strcasecmp(name, "AudioAutoAES")) { ConfigAudioAutoAES = atoi(value);
} else if (!strcasecmp(name, "AudioDelay")) { ConfigVideoAudioDelayMs = atoi(value);
} else if (!strcasecmp(name, "AudioNormalize")) { ConfigAudioNormalize = atoi(value);
} else if (!strcasecmp(name, "AudioMaxNormalize")) { ConfigAudioMaxNormalize = atoi(value);
} else if (!strcasecmp(name, "AudioCompression")) { ConfigAudioCompression = atoi(value);
} else if (!strcasecmp(name, "AudioMaxCompression")) { ConfigAudioMaxCompression = atoi(value);
} else if (!strcasecmp(name, "AudioStereoDescent")) { ConfigAudioStereoDescent = atoi(value);
// Audio Equalizer
} else if (!strcasecmp(name, "AudioEq")) { ConfigAudioEq = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand01b")) { ConfigAudioEqBand[0] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand02b")) { ConfigAudioEqBand[1] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand03b")) { ConfigAudioEqBand[2] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand04b")) { ConfigAudioEqBand[3] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand05b")) { ConfigAudioEqBand[4] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand06b")) { ConfigAudioEqBand[5] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand07b")) { ConfigAudioEqBand[6] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand08b")) { ConfigAudioEqBand[7] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand09b")) { ConfigAudioEqBand[8] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand10b")) { ConfigAudioEqBand[9] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand11b")) { ConfigAudioEqBand[10] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand12b")) { ConfigAudioEqBand[11] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand13b")) { ConfigAudioEqBand[12] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand14b")) { ConfigAudioEqBand[13] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand15b")) { ConfigAudioEqBand[14] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand16b")) { ConfigAudioEqBand[15] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand17b")) { ConfigAudioEqBand[16] = atoi(value);
} else if (!strcasecmp(name, "AudioEqBand18b")) { ConfigAudioEqBand[17] = atoi(value);
// PiP
} else if (!strcasecmp(name, "PipScalePercent")) { ConfigPipScalePercent = atoi(value);
} else if (!strcasecmp(name, "PipLeftPercent")) { ConfigPipLeftPercent = atoi(value);
} else if (!strcasecmp(name, "PipTopPercent")) { ConfigPipTopPercent = atoi(value);
} else if (!strcasecmp(name, "PipUseAlt")) { ConfigPipUseAlt = atoi(value);
} else if (!strcasecmp(name, "PipAltScalePercent")) { ConfigPipAltScalePercent = atoi(value);
} else if (!strcasecmp(name, "PipAltLeftPercent")) { ConfigPipAltLeftPercent = atoi(value);
} else if (!strcasecmp(name, "PipAltTopPercent")) { ConfigPipAltTopPercent = atoi(value);
// Logging
} else if (!strcasecmp(name, "LogLevel")) { ConfigLogLevels = abs(atoi(value));
ConfigLogState = atoi(value) > 0;
PrintLogLevel(ConfigLogState ? ConfigLogLevels : 0);
cSoftHdLogger::GetLogger()->SetLogLevel(ConfigLogState ? ConfigLogLevels : 0);
// Expert Settings
} else if (!strcasecmp(name, "AdditionalBufferLengthMs")) { ConfigAdditionalBufferLengthMs = atoi(value);
} else if (!strcasecmp(name, "DisableDeint")) { ConfigDisableDeint = atoi(value);
} else if (!strcasecmp(name, "DecoderFallbackToSw")) { ConfigDecoderFallbackToSw = atoi(value);
} else if (!strcasecmp(name, "DecoderFallbackToSwNumPkts")) { ConfigDecoderFallbackToSwNumPkts = atoi(value);
} else if (!strcasecmp(name, "DecoderNeedsIFrame")) { ConfigDecoderNeedsIFrame = atoi(value);
} else if (!strcasecmp(name, "ParseH264Dimensions")) { ConfigParseH264Dimensions = atoi(value);
} else if (!strcasecmp(name, "ParseH264StreamStart")) { ConfigParseH264StreamStart = atoi(value);
} else if (!strcasecmp(name, "DropInvalidH264PFrames")) { ConfigDropInvalidH264PFrames = atoi(value);
#ifdef USE_GLES
} else if (!strcasecmp(name, "MaxSizeGPUImageCache")) { ConfigMaxSizeGPUImageCache = atoi(value);
#endif
} else if (!strcasecmp(name, "ShowChannelSwitchDurationMessage")) { ConfigShowChannelSwitchDurationMessage = atoi(value);
} else
return false;
return true;
}
void cSoftHdConfig::PrintLogLevel(int loglevel)
{
if (!loglevel)
return;
char prefix[256] = "Set loglevels:";
if (loglevel & L_DEBUG)
strcat(prefix, " standard debugs,");
if (loglevel & L_AV_SYNC)
strcat(prefix, " AV-Sync,");
if (loglevel & L_SOUND)
strcat(prefix, " sound,");
if (loglevel & L_OSD)
strcat(prefix, " osd,");
if (loglevel & L_DRM)
strcat(prefix, " drm,");
if (loglevel & L_CODEC)
strcat(prefix, " codec,");
if (loglevel & L_FFMPEG)
strcat(prefix, " ffmpeg,");
if (loglevel & L_STILL)
strcat(prefix, " stillpicture,");
if (loglevel & L_TRICK)
strcat(prefix, " trickspeed,");
if (loglevel & L_MEDIA)
strcat(prefix, " mediaplayer,");
if ((loglevel & L_OPENGL) ||
(loglevel & L_OPENGL_TIME) ||
(loglevel & L_OPENGL_TIME_ALL))
strcat(prefix, " OpenGL OSD,");
if (loglevel & L_PACKET)
strcat(prefix, " packet tracking,");
if (loglevel & L_GRAB)
strcat(prefix, " grabbing");
LOGINFO("%s", prefix);
}
void cSoftHdConfig::SetDecoderNeedsMaxPackets(int num)
{
std::lock_guard<std::mutex> lock(m_mutex);
m_decoderNeedsMaxPackets = num;
}
int cSoftHdConfig::GetDecoderNeedsMaxPackets(void)
{
std::lock_guard<std::mutex> lock(m_mutex);
return m_decoderNeedsMaxPackets;
}
/**
* Return true, if the given mode is equal to the current display mode
*/
bool cSoftHdConfig::CompareCurrentMode(sDrmMode *newMode)
{
return (newMode->width == CurrentDrmMode.width &&
newMode->height == CurrentDrmMode.height &&
newMode->refreshRateHz == CurrentDrmMode.refreshRateHz &&
newMode->interlaced == CurrentDrmMode.interlaced);
}