vdr-plugin-softhddevice-drm-gles 1.6.8-daba64b
config.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-or-later
2
18#include <cstring>
19#include <cstdlib>
20#include <mutex>
21
22#include "config.h"
23#include "logger.h"
24
33bool cSoftHdConfig::SetupParse(const char *name, const char *value)
34{
35 //LOGDEBUG("config: %s: '%s' = '%s'", __FUNCTION__, name, value);
36
37 // General
38 if (!strcasecmp(name, "HideMainMenuEntry")) { ConfigHideMainMenuEntry = atoi(value);
39
40 // Video
41 } else if (!strcasecmp(name, "VideoEnableHDR")) { ConfigVideoEnableHDR = atoi(value);
42 } else if (!strcasecmp(name, "VideoDisplayMode")) { ConfigVideoDisplayMode = std::min(atoi(value), static_cast<int>(CONFIG_DISPLAY_MODE_FOLLOW_VIDEO_INTERLACED));
43 } else if (!strcasecmp(name, "VideoChannelSwitchMode")){ ConfigVideoChannelSwitchMode = atoi(value);
44
45 // Audio
46 } else if (!strcasecmp(name, "AudioSoftvol")) { ConfigAudioSoftvol = atoi(value);
47 } else if (!strcasecmp(name, "AudioDownmix")) { ConfigAudioDownmix = atoi(value);
48 } else if (!strcasecmp(name, "AudioPassthrough")) { ConfigAudioPassthroughMask = abs(atoi(value));
50 } else if (!strcasecmp(name, "AudioAutoAES")) { ConfigAudioAutoAES = atoi(value);
51 } else if (!strcasecmp(name, "AudioDelay")) { ConfigVideoAudioDelayMs = atoi(value);
52 } else if (!strcasecmp(name, "AudioNormalize")) { ConfigAudioNormalize = atoi(value);
53 } else if (!strcasecmp(name, "AudioMaxNormalize")) { ConfigAudioMaxNormalize = atoi(value);
54 } else if (!strcasecmp(name, "AudioCompression")) { ConfigAudioCompression = atoi(value);
55 } else if (!strcasecmp(name, "AudioMaxCompression")) { ConfigAudioMaxCompression = atoi(value);
56 } else if (!strcasecmp(name, "AudioStereoDescent")) { ConfigAudioStereoDescent = atoi(value);
57
58 // Audio Equalizer
59 } else if (!strcasecmp(name, "AudioEq")) { ConfigAudioEq = atoi(value);
60 } else if (!strcasecmp(name, "AudioEqBand01b")) { ConfigAudioEqBand[0] = atoi(value);
61 } else if (!strcasecmp(name, "AudioEqBand02b")) { ConfigAudioEqBand[1] = atoi(value);
62 } else if (!strcasecmp(name, "AudioEqBand03b")) { ConfigAudioEqBand[2] = atoi(value);
63 } else if (!strcasecmp(name, "AudioEqBand04b")) { ConfigAudioEqBand[3] = atoi(value);
64 } else if (!strcasecmp(name, "AudioEqBand05b")) { ConfigAudioEqBand[4] = atoi(value);
65 } else if (!strcasecmp(name, "AudioEqBand06b")) { ConfigAudioEqBand[5] = atoi(value);
66 } else if (!strcasecmp(name, "AudioEqBand07b")) { ConfigAudioEqBand[6] = atoi(value);
67 } else if (!strcasecmp(name, "AudioEqBand08b")) { ConfigAudioEqBand[7] = atoi(value);
68 } else if (!strcasecmp(name, "AudioEqBand09b")) { ConfigAudioEqBand[8] = atoi(value);
69 } else if (!strcasecmp(name, "AudioEqBand10b")) { ConfigAudioEqBand[9] = atoi(value);
70 } else if (!strcasecmp(name, "AudioEqBand11b")) { ConfigAudioEqBand[10] = atoi(value);
71 } else if (!strcasecmp(name, "AudioEqBand12b")) { ConfigAudioEqBand[11] = atoi(value);
72 } else if (!strcasecmp(name, "AudioEqBand13b")) { ConfigAudioEqBand[12] = atoi(value);
73 } else if (!strcasecmp(name, "AudioEqBand14b")) { ConfigAudioEqBand[13] = atoi(value);
74 } else if (!strcasecmp(name, "AudioEqBand15b")) { ConfigAudioEqBand[14] = atoi(value);
75 } else if (!strcasecmp(name, "AudioEqBand16b")) { ConfigAudioEqBand[15] = atoi(value);
76 } else if (!strcasecmp(name, "AudioEqBand17b")) { ConfigAudioEqBand[16] = atoi(value);
77 } else if (!strcasecmp(name, "AudioEqBand18b")) { ConfigAudioEqBand[17] = atoi(value);
78
79 // PiP
80 } else if (!strcasecmp(name, "PipScalePercent")) { ConfigPipScalePercent = atoi(value);
81 } else if (!strcasecmp(name, "PipLeftPercent")) { ConfigPipLeftPercent = atoi(value);
82 } else if (!strcasecmp(name, "PipTopPercent")) { ConfigPipTopPercent = atoi(value);
83 } else if (!strcasecmp(name, "PipUseAlt")) { ConfigPipUseAlt = atoi(value);
84 } else if (!strcasecmp(name, "PipAltScalePercent")) { ConfigPipAltScalePercent = atoi(value);
85 } else if (!strcasecmp(name, "PipAltLeftPercent")) { ConfigPipAltLeftPercent = atoi(value);
86 } else if (!strcasecmp(name, "PipAltTopPercent")) { ConfigPipAltTopPercent = atoi(value);
87
88 // Logging
89 } else if (!strcasecmp(name, "LogLevel")) { ConfigLogLevels = abs(atoi(value));
93
94 // Expert Settings
95 } else if (!strcasecmp(name, "AdditionalBufferLengthMs")) { ConfigAdditionalBufferLengthMs = atoi(value);
96 } else if (!strcasecmp(name, "DisableDeint")) { ConfigDisableDeint = atoi(value);
97 } else if (!strcasecmp(name, "DecoderFallbackToSw")) { ConfigDecoderFallbackToSw = atoi(value);
98 } else if (!strcasecmp(name, "DecoderFallbackToSwNumPkts")) { ConfigDecoderFallbackToSwNumPkts = atoi(value);
99 } else if (!strcasecmp(name, "DecoderNeedsIFrame")) { ConfigDecoderNeedsIFrame = atoi(value);
100 } else if (!strcasecmp(name, "ParseH264Dimensions")) { ConfigParseH264Dimensions = atoi(value);
101 } else if (!strcasecmp(name, "ParseH264StreamStart")) { ConfigParseH264StreamStart = atoi(value);
102 } else if (!strcasecmp(name, "DropInvalidH264PFrames")) { ConfigDropInvalidH264PFrames = atoi(value);
103#ifdef USE_GLES
104 } else if (!strcasecmp(name, "MaxSizeGPUImageCache")) { ConfigMaxSizeGPUImageCache = atoi(value);
105#endif
106 } else if (!strcasecmp(name, "ShowChannelSwitchDurationMessage")) { ConfigShowChannelSwitchDurationMessage = atoi(value);
107 } else
108 return false;
109
110 return true;
111}
112
114{
115 if (!loglevel)
116 return;
117
118 char prefix[256] = "Set loglevels:";
119 if (loglevel & L_DEBUG)
120 strcat(prefix, " standard debugs,");
121 if (loglevel & L_AV_SYNC)
122 strcat(prefix, " AV-Sync,");
123 if (loglevel & L_SOUND)
124 strcat(prefix, " sound,");
125 if (loglevel & L_OSD)
126 strcat(prefix, " osd,");
127 if (loglevel & L_DRM)
128 strcat(prefix, " drm,");
129 if (loglevel & L_CODEC)
130 strcat(prefix, " codec,");
131 if (loglevel & L_FFMPEG)
132 strcat(prefix, " ffmpeg,");
133 if (loglevel & L_STILL)
134 strcat(prefix, " stillpicture,");
135 if (loglevel & L_TRICK)
136 strcat(prefix, " trickspeed,");
137 if (loglevel & L_MEDIA)
138 strcat(prefix, " mediaplayer,");
139 if ((loglevel & L_OPENGL) ||
142 strcat(prefix, " OpenGL OSD,");
143 if (loglevel & L_PACKET)
144 strcat(prefix, " packet tracking,");
145 if (loglevel & L_GRAB)
146 strcat(prefix, " grabbing");
147
148 LOGINFO("%s", prefix);
149}
150
152{
153 std::lock_guard<std::mutex> lock(m_mutex);
155}
156
158{
159 std::lock_guard<std::mutex> lock(m_mutex);
161}
162
167{
168 return (newMode->width == CurrentDrmMode.width &&
169 newMode->height == CurrentDrmMode.height &&
170 newMode->refreshRateHz == CurrentDrmMode.refreshRateHz &&
171 newMode->interlaced == CurrentDrmMode.interlaced);
172}
bool ConfigParseH264Dimensions
parse h264 stream for width and height for decoder init
Definition config.h:119
int ConfigVideoAudioDelayMs
config audio delay
Definition config.h:85
void PrintLogLevel(int)
Definition config.cpp:113
int ConfigVideoDisplayMode
display mode (enum ConfigDisplayModes)
Definition config.h:76
bool ConfigLogState
flag logging on/off
Definition config.h:110
bool ConfigAudioNormalize
config use normalize volume
Definition config.h:86
int ConfigAudioAutoAES
config automatic AES handling
Definition config.h:84
int ConfigVideoChannelSwitchMode
channel switch mode (enum ChannelSwitchMode)
Definition config.h:77
int ConfigAudioStereoDescent
config reduce stereo loudness
Definition config.h:90
int ConfigMaxSizeGPUImageCache
config max gpu image cache size
Definition config.h:123
int m_decoderNeedsMaxPackets
Definition config.h:164
int ConfigParseH264StreamStart
log frames at stream start up to the given number of I-Frames
Definition config.h:120
int ConfigDecoderFallbackToSwNumPkts
maximum number of packets sent before fallback to sw decoder
Definition config.h:117
void SetDecoderNeedsMaxPackets(int)
Definition config.cpp:151
bool ConfigAudioCompression
config use volume compression
Definition config.h:88
bool ConfigAudioPassthroughState
flag audio-passthrough on/off
Definition config.h:83
bool ConfigAudioSoftvol
config use software volume
Definition config.h:80
bool ConfigDisableDeint
disable deinterlacer
Definition config.h:115
int ConfigVideoEnableHDR
enable HDR
Definition config.h:75
int ConfigPipAltTopPercent
0 = aligned to top, 100 = aligned to bottom
Definition config.h:107
int ConfigAudioEqBand[18]
config equalizer filter bands
Definition config.h:94
int ConfigPipLeftPercent
0 = aligned to left, 100 = aligned to right
Definition config.h:101
int ConfigAdditionalBufferLengthMs
config size ms of a/v buffer
Definition config.h:114
int ConfigAudioMaxCompression
config max volume compression
Definition config.h:89
int ConfigPipAltLeftPercent
0 = aligned to left, 100 = aligned to right
Definition config.h:106
int ConfigLogLevels
loglevel config
Definition config.h:111
int ConfigPipAltScalePercent
alternative scale factor of pip video
Definition config.h:105
bool SetupParse(const char *, const char *)
Parse setup parameters.
Definition config.cpp:33
bool CompareCurrentMode(sDrmMode *)
Return true, if the given mode is equal to the current display mode.
Definition config.cpp:166
int ConfigShowChannelSwitchDurationMessage
let the skin show a short message about the channel switch duration
Definition config.h:125
int ConfigPipTopPercent
0 = aligned to top, 100 = aligned to bottom
Definition config.h:102
bool ConfigDecoderNeedsIFrame
start h264 decoder only when an I-Frame arrives
Definition config.h:118
bool ConfigDecoderFallbackToSw
fallback to software decoder if the hardware decoder fails
Definition config.h:116
int GetDecoderNeedsMaxPackets(void)
Definition config.cpp:157
int ConfigAudioEq
config equalizer filter
Definition config.h:93
int ConfigPipScalePercent
scale factor of pip video
Definition config.h:100
int ConfigPipUseAlt
Definition config.h:103
int ConfigAudioPassthroughMask
config audio pass-through mask
Definition config.h:82
std::mutex m_mutex
Definition config.h:165
bool ConfigHideMainMenuEntry
config hide main menu entry
Definition config.h:72
bool ConfigAudioDownmix
config ffmpeg audio downmix
Definition config.h:81
int ConfigAudioMaxNormalize
config max normalize factor
Definition config.h:87
sDrmMode CurrentDrmMode
currently used drm mode on the current connector
Definition config.h:152
int ConfigDropInvalidH264PFrames
drop P-Frames with invalid references on stream start up to the given number of I-Frames
Definition config.h:121
static std::shared_ptr< cSoftHdLogger > GetLogger()
Get an instance to the global logger.
Definition logger.cpp:43
Plugin Configuration Header File.
@ CONFIG_DISPLAY_MODE_FOLLOW_VIDEO_INTERLACED
Definition config.h:45
#define LOGINFO
log to LOG_INFO
Definition logger.h:43
@ L_PACKET
decoder packet/frame tracking logs
Definition logger.h:68
@ L_DRM
drm logs
Definition logger.h:60
@ L_OPENGL_TIME
opengl osd flush time measurement
Definition logger.h:66
@ L_STILL
stillpicture logs
Definition logger.h:62
@ L_FFMPEG
ffmpeg logs
Definition logger.h:70
@ L_AV_SYNC
audio/video sync logs
Definition logger.h:57
@ L_MEDIA
mediaplayer logs
Definition logger.h:64
@ L_OSD
osd logs
Definition logger.h:59
@ L_TRICK
trickspeed logs
Definition logger.h:63
@ L_OPENGL
opengl osd logs
Definition logger.h:65
@ L_DEBUG
common debug logs
Definition logger.h:56
@ L_OPENGL_TIME_ALL
opengl osd all commands time measurement
Definition logger.h:67
@ L_CODEC
codec logs
Definition logger.h:61
@ L_SOUND
sound logs
Definition logger.h:58
@ L_GRAB
grabbing logs
Definition logger.h:69
Logger Header File.
Holds possible display configurations.
Definition config.h:30
int width
display width
Definition config.h:31
bool interlaced
is this an interlaced mode?
Definition config.h:34
int height
display height
Definition config.h:32
double refreshRateHz
display refresh rate
Definition config.h:33