forked from FernetMenta/vdr-plugin-vnsiserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.c
117 lines (93 loc) · 4.23 KB
/
setup.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
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
/*
* vdr-plugin-vnsi - KODI server plugin for VDR
*
* Copyright (C) 2005-2012 Team XBMC
* Copyright (C) 2015 Team KODI
*
* http://kodi.tv
*
* 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, 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 KODI; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "setup.h"
#include "vnsicommand.h"
int PmtTimeout = 0;
int TimeshiftMode = 0;
int TimeshiftBufferSize = 5;
int TimeshiftBufferFileSize = 6;
char TimeshiftBufferDir[PATH_MAX] = "\0";
int PlayRecording = 0;
int GroupRecordings = 1;
int AvoidEPGScan = 1;
int DisableScrambleTimeout = 0;
int DisableCamBlacklist = 0;
int EdlMode = 0;
cMenuSetupVNSI::cMenuSetupVNSI(void)
{
timeshiftModesTexts[0] = tr("Off");
timeshiftModesTexts[1] = tr("RAM");
timeshiftModesTexts[2] = tr("File");
newTimeshiftMode = TimeshiftMode;
Add(new cMenuEditStraItem( tr("Time Shift Mode"), &newTimeshiftMode, 3, timeshiftModesTexts));
newTimeshiftBufferSize = TimeshiftBufferSize;
Add(new cMenuEditIntItem( tr("TS Buffersize (RAM) (1-80) x 100MB"), &newTimeshiftBufferSize));
newTimeshiftBufferFileSize = TimeshiftBufferFileSize;
Add(new cMenuEditIntItem( tr("TS Buffersize (File) (1-10) x 1GB"), &newTimeshiftBufferFileSize));
strn0cpy(newTimeshiftBufferDir, TimeshiftBufferDir, sizeof(newTimeshiftBufferDir));
Add(new cMenuEditStrItem(tr("TS Buffer Directory"), newTimeshiftBufferDir, sizeof(newTimeshiftBufferDir)));
newPlayRecording = PlayRecording;
Add(new cMenuEditBoolItem( tr("Play Recording instead of live"), &newPlayRecording));
newGroupRecordings = GroupRecordings;
Add(new cMenuEditBoolItem( tr("Group series recordings"), &newGroupRecordings));
newAvoidEPGScan = AvoidEPGScan;
Add(new cMenuEditBoolItem( tr("Avoid EPG scan while streaming"), &newAvoidEPGScan));
newDisableScrambleTimeout = DisableScrambleTimeout;
Add(new cMenuEditBoolItem( tr("Disable scramble timeout"), &newDisableScrambleTimeout));
newDisableCamBlacklist = DisableCamBlacklist;
Add(new cMenuEditBoolItem( tr("Disable cam blacklist"), &newDisableCamBlacklist));
edlModesTexts[0] = tr("scene");
edlModesTexts[1] = tr("comskip");
edlModesTexts[2] = tr("cut");
newEdlMode = EdlMode;
Add(new cMenuEditStraItem( tr("EDL Mode"), &newEdlMode, 3, edlModesTexts));
}
void cMenuSetupVNSI::Store(void)
{
if (newPmtTimeout > 10 || newPmtTimeout < 0)
newPmtTimeout = 2;
SetupStore(CONFNAME_PMTTIMEOUT, PmtTimeout = newPmtTimeout);
SetupStore(CONFNAME_TIMESHIFT, TimeshiftMode = newTimeshiftMode);
if (newTimeshiftBufferSize > 80)
newTimeshiftBufferSize = 80;
else if (newTimeshiftBufferSize < 1)
newTimeshiftBufferSize = 1;
SetupStore(CONFNAME_TIMESHIFTBUFFERSIZE, TimeshiftBufferSize = newTimeshiftBufferSize);
if (newTimeshiftBufferFileSize > 20)
newTimeshiftBufferFileSize = 20;
else if (newTimeshiftBufferFileSize < 1)
newTimeshiftBufferFileSize = 1;
SetupStore(CONFNAME_TIMESHIFTBUFFERFILESIZE, TimeshiftBufferFileSize = newTimeshiftBufferFileSize);
strn0cpy(TimeshiftBufferDir, newTimeshiftBufferDir, sizeof(TimeshiftBufferDir));
if (*TimeshiftBufferDir && TimeshiftBufferDir[strlen(TimeshiftBufferDir)-1] == '/')
/* strip trailing slash */
TimeshiftBufferDir[strlen(TimeshiftBufferDir)-1] = 0;
SetupStore(CONFNAME_TIMESHIFTBUFFERDIR, TimeshiftBufferDir);
SetupStore(CONFNAME_PLAYRECORDING, PlayRecording = newPlayRecording);
SetupStore(CONFNAME_GROUPRECORDINGS, GroupRecordings = newGroupRecordings);
SetupStore(CONFNAME_AVOIDEPGSCAN, AvoidEPGScan = newAvoidEPGScan);
SetupStore(CONFNAME_DISABLESCRAMBLETIMEOUT, DisableScrambleTimeout = newDisableScrambleTimeout);
SetupStore(CONFNAME_DISABLECAMBLACKLIST, DisableCamBlacklist = newDisableCamBlacklist);
SetupStore(CONFNAME_EDL, EdlMode = newEdlMode);
}