vdr-plugin-softhddevice-drm-gles 1.6.7
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
44 // Audio
45 } else if (!strcasecmp(name, "AudioSoftvol")) { ConfigAudioSoftvol = atoi(value);
46 } else if (!strcasecmp(name, "AudioDownmix")) { ConfigAudioDownmix = atoi(value);
47 } else if (!strcasecmp(name, "AudioPassthrough")) { ConfigAudioPassthroughMask = abs(atoi(value));
49 } else if (!strcasecmp(name, "AudioAutoAES")) { ConfigAudioAutoAES = atoi(value);
50 } else if (!strcasecmp(name, "AudioDelay")) { ConfigVideoAudioDelayMs = atoi(value);
51 } else if (!strcasecmp(name, "AudioNormalize")) { ConfigAudioNormalize = atoi(value);
52 } else if (!strcasecmp(name, "AudioMaxNormalize")) { ConfigAudioMaxNormalize = atoi(value);
53 } else if (!strcasecmp(name, "AudioCompression")) { ConfigAudioCompression = atoi(value);
54 } else if (!strcasecmp(name, "AudioMaxCompression")) { ConfigAudioMaxCompression = atoi(value);
55 } else if (!strcasecmp(name, "AudioStereoDescent")) { ConfigAudioStereoDescent = atoi(value);
56
57 // Audio Equalizer
58 } else if (!strcasecmp(name, "AudioEq")) { ConfigAudioEq = atoi(value);
59 } else if (!strcasecmp(name, "AudioEqBand01b")) { ConfigAudioEqBand[0] = atoi(value);
60 } else if (!strcasecmp(name, "AudioEqBand02b")) { ConfigAudioEqBand[1] = atoi(value);
61 } else if (!strcasecmp(name, "AudioEqBand03b")) { ConfigAudioEqBand[2] = atoi(value);
62 } else if (!strcasecmp(name, "AudioEqBand04b")) { ConfigAudioEqBand[3] = atoi(value);
63 } else if (!strcasecmp(name, "AudioEqBand05b")) { ConfigAudioEqBand[4] = atoi(value);
64 } else if (!strcasecmp(name, "AudioEqBand06b")) { ConfigAudioEqBand[5] = atoi(value);
65 } else if (!strcasecmp(name, "AudioEqBand07b")) { ConfigAudioEqBand[6] = atoi(value);
66 } else if (!strcasecmp(name, "AudioEqBand08b")) { ConfigAudioEqBand[7] = atoi(value);
67 } else if (!strcasecmp(name, "AudioEqBand09b")) { ConfigAudioEqBand[8] = atoi(value);
68 } else if (!strcasecmp(name, "AudioEqBand10b")) { ConfigAudioEqBand[9] = atoi(value);
69 } else if (!strcasecmp(name, "AudioEqBand11b")) { ConfigAudioEqBand[10] = atoi(value);
70 } else if (!strcasecmp(name, "AudioEqBand12b")) { ConfigAudioEqBand[11] = atoi(value);
71 } else if (!strcasecmp(name, "AudioEqBand13b")) { ConfigAudioEqBand[12] = atoi(value);
72 } else if (!strcasecmp(name, "AudioEqBand14b")) { ConfigAudioEqBand[13] = atoi(value);
73 } else if (!strcasecmp(name, "AudioEqBand15b")) { ConfigAudioEqBand[14] = atoi(value);
74 } else if (!strcasecmp(name, "AudioEqBand16b")) { ConfigAudioEqBand[15] = atoi(value);
75 } else if (!strcasecmp(name, "AudioEqBand17b")) { ConfigAudioEqBand[16] = atoi(value);
76 } else if (!strcasecmp(name, "AudioEqBand18b")) { ConfigAudioEqBand[17] = atoi(value);
77
78 // PiP
79 } else if (!strcasecmp(name, "PipScalePercent")) { ConfigPipScalePercent = atoi(value);
80 } else if (!strcasecmp(name, "PipLeftPercent")) { ConfigPipLeftPercent = atoi(value);
81 } else if (!strcasecmp(name, "PipTopPercent")) { ConfigPipTopPercent = atoi(value);
82 } else if (!strcasecmp(name, "PipUseAlt")) { ConfigPipUseAlt = atoi(value);
83 } else if (!strcasecmp(name, "PipAltScalePercent")) { ConfigPipAltScalePercent = atoi(value);
84 } else if (!strcasecmp(name, "PipAltLeftPercent")) { ConfigPipAltLeftPercent = atoi(value);
85 } else if (!strcasecmp(name, "PipAltTopPercent")) { ConfigPipAltTopPercent = atoi(value);
86
87 // Logging
88 } else if (!strcasecmp(name, "LogLevel")) { ConfigLogLevels = abs(atoi(value));
92
93 // Expert Settings
94 } else if (!strcasecmp(name, "AdditionalBufferLengthMs")) { ConfigAdditionalBufferLengthMs = atoi(value);
95 } else if (!strcasecmp(name, "DisableDeint")) { ConfigDisableDeint = atoi(value);
96 } else if (!strcasecmp(name, "DecoderFallbackToSw")) { ConfigDecoderFallbackToSw = atoi(value);
97 } else if (!strcasecmp(name, "DecoderFallbackToSwNumPkts")) { ConfigDecoderFallbackToSwNumPkts = atoi(value);
98 } else if (!strcasecmp(name, "DecoderNeedsIFrame")) { ConfigDecoderNeedsIFrame = atoi(value);
99 } else if (!strcasecmp(name, "ParseH264Dimensions")) { ConfigParseH264Dimensions = atoi(value);
100 } else if (!strcasecmp(name, "ParseH264StreamStart")) { ConfigParseH264StreamStart = atoi(value);
101 } else if (!strcasecmp(name, "DropInvalidH264PFrames")) { ConfigDropInvalidH264PFrames = atoi(value);
102#ifdef USE_GLES
103 } else if (!strcasecmp(name, "MaxSizeGPUImageCache")) { ConfigMaxSizeGPUImageCache = atoi(value);
104#endif
105 } else if (!strcasecmp(name, "ShowChannelSwitchDurationMessage")) { ConfigShowChannelSwitchDurationMessage = atoi(value);
106 } else
107 return false;
108
109 return true;
110}
111
113{
114 if (!loglevel)
115 return;
116
117 char prefix[256] = "Set loglevels:";
118 if (loglevel & L_DEBUG)
119 strcat(prefix, " standard debugs,");
120 if (loglevel & L_AV_SYNC)
121 strcat(prefix, " AV-Sync,");
122 if (loglevel & L_SOUND)
123 strcat(prefix, " sound,");
124 if (loglevel & L_OSD)
125 strcat(prefix, " osd,");
126 if (loglevel & L_DRM)
127 strcat(prefix, " drm,");
128 if (loglevel & L_CODEC)
129 strcat(prefix, " codec,");
130 if (loglevel & L_FFMPEG)
131 strcat(prefix, " ffmpeg,");
132 if (loglevel & L_STILL)
133 strcat(prefix, " stillpicture,");
134 if (loglevel & L_TRICK)
135 strcat(prefix, " trickspeed,");
136 if (loglevel & L_MEDIA)
137 strcat(prefix, " mediaplayer,");
138 if ((loglevel & L_OPENGL) ||
141 strcat(prefix, " OpenGL OSD,");
142 if (loglevel & L_PACKET)
143 strcat(prefix, " packet tracking,");
144 if (loglevel & L_GRAB)
145 strcat(prefix, " grabbing");
146
147 LOGINFO("%s", prefix);
148}
149
151{
152 std::lock_guard<std::mutex> lock(m_mutex);
154}
155
157{
158 std::lock_guard<std::mutex> lock(m_mutex);
160}
161
166{
167 return (newMode->width == CurrentDrmMode.width &&
168 newMode->height == CurrentDrmMode.height &&
169 newMode->refreshRateHz == CurrentDrmMode.refreshRateHz &&
170 newMode->interlaced == CurrentDrmMode.interlaced);
171}
bool ConfigParseH264Dimensions
parse h264 stream for width and height for decoder init
Definition config.h:102
int ConfigVideoAudioDelayMs
config audio delay
Definition config.h:68
void PrintLogLevel(int)
Definition config.cpp:112
int ConfigVideoDisplayMode
display mode (enum ConfigDisplayMode)
Definition config.h:60
bool ConfigLogState
flag logging on/off
Definition config.h:93
bool ConfigAudioNormalize
config use normalize volume
Definition config.h:69
int ConfigAudioAutoAES
config automatic AES handling
Definition config.h:67
int ConfigAudioStereoDescent
config reduce stereo loudness
Definition config.h:73
int ConfigMaxSizeGPUImageCache
config max gpu image cache size
Definition config.h:106
int m_decoderNeedsMaxPackets
Definition config.h:147
int ConfigParseH264StreamStart
log frames at stream start up to the given number of I-Frames
Definition config.h:103
int ConfigDecoderFallbackToSwNumPkts
maximum number of packets sent before fallback to sw decoder
Definition config.h:100
void SetDecoderNeedsMaxPackets(int)
Definition config.cpp:150
bool ConfigAudioCompression
config use volume compression
Definition config.h:71
bool ConfigAudioPassthroughState
flag audio-passthrough on/off
Definition config.h:66
bool ConfigAudioSoftvol
config use software volume
Definition config.h:63
bool ConfigDisableDeint
disable deinterlacer
Definition config.h:98
int ConfigVideoEnableHDR
enable HDR
Definition config.h:59
int ConfigPipAltTopPercent
0 = aligned to top, 100 = aligned to bottom
Definition config.h:90
int ConfigAudioEqBand[18]
config equalizer filter bands
Definition config.h:77
int ConfigPipLeftPercent
0 = aligned to left, 100 = aligned to right
Definition config.h:84
int ConfigAdditionalBufferLengthMs
config size ms of a/v buffer
Definition config.h:97
int ConfigAudioMaxCompression
config max volume compression
Definition config.h:72
int ConfigPipAltLeftPercent
0 = aligned to left, 100 = aligned to right
Definition config.h:89
int ConfigLogLevels
loglevel config
Definition config.h:94
int ConfigPipAltScalePercent
alternative scale factor of pip video
Definition config.h:88
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:165
int ConfigShowChannelSwitchDurationMessage
let the skin show a short message about the channel switch duration
Definition config.h:108
int ConfigPipTopPercent
0 = aligned to top, 100 = aligned to bottom
Definition config.h:85
bool ConfigDecoderNeedsIFrame
start h264 decoder only when an I-Frame arrives
Definition config.h:101
bool ConfigDecoderFallbackToSw
fallback to software decoder if the hardware decoder fails
Definition config.h:99
int GetDecoderNeedsMaxPackets(void)
Definition config.cpp:156
int ConfigAudioEq
config equalizer filter
Definition config.h:76
int ConfigPipScalePercent
scale factor of pip video
Definition config.h:83
int ConfigPipUseAlt
Definition config.h:86
int ConfigAudioPassthroughMask
config audio pass-through mask
Definition config.h:65
std::mutex m_mutex
Definition config.h:148
bool ConfigHideMainMenuEntry
config hide main menu entry
Definition config.h:56
bool ConfigAudioDownmix
config ffmpeg audio downmix
Definition config.h:64
int ConfigAudioMaxNormalize
config max normalize factor
Definition config.h:70
sDrmMode CurrentDrmMode
currently used drm mode on the current connector
Definition config.h:135
int ConfigDropInvalidH264PFrames
drop P-Frames with invalid references on stream start up to the given number of I-Frames
Definition config.h:104
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:40
#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