summaryrefslogtreecommitdiff
path: root/pvrinput.c
blob: b001c85b2b68471331187077f58b136503110379 (plain)
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
#include "common.h"

#if VDRVERSNUM < 10713
#ifndef PLUGINPARAMPATCHVERSNUM
#error "You must apply the pluginparam patch for VDR!"
#endif
#endif

static const char *VERSION        = "2014-01-11";
static const char *DESCRIPTION    = tr("use Hauppauge PVR as input device");
static const char *MAINMENUENTRY  = tr("PVR picture settings");


cPluginPvrInput *PluginPvrInput;

cPluginPvrInput::cPluginPvrInput(void)
{
  PluginPvrInput = this;
#ifdef __DYNAMIC_DEVICE_PROBE
  cPvrDeviceProbe::Init();
#endif
}

cPluginPvrInput::~cPluginPvrInput()
{
#ifdef __DYNAMIC_DEVICE_PROBE
  cPvrDeviceProbe::Shutdown();
#endif
  PluginPvrInput = NULL;
}

const char *cPluginPvrInput::Version(void)
{
  return VERSION;
}

const char *cPluginPvrInput::Description(void)
{
  return tr(DESCRIPTION);
}

const char *cPluginPvrInput::CommandLineHelp(void)
{
  return NULL;
}

bool cPluginPvrInput::ProcessArgs(int argc, char *argv[])
{
  return true;
}

bool cPluginPvrInput::Initialize(void)
{
#if VDRVERSNUM < 10507
  RegisterI18n(pvrinput_Phrases); 
#endif //VDRVERSNUM < 10507
  cPvrDevice::Initialize();
  return true;
}

bool cPluginPvrInput::Start(void)
{
/* Start() is called after the primary device and user interface has
   been set up, but before the main program loop is entered. Is called
   after Initialize(). */
  return true;
}

void cPluginPvrInput::Stop(void)
{
/* Any threads the plugin may have created shall be stopped
   in the Stop() function. See VDR/PLUGINS.html */
  cPvrDevice::StopAll();
};

void cPluginPvrInput::Housekeeping(void)
{
}

const char *cPluginPvrInput::MainMenuEntry(void)
{
  if (PvrSetup.HideMainMenuEntry)
     return NULL;
  return tr(MAINMENUENTRY);
}

cOsdObject *cPluginPvrInput::MainMenuAction(void)
{
  cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
#if VDRVERSNUM < 10713
  if (channel && channel->IsPlug())
     return new cPvrMenuMain();
#else
  // TODO: rework cPvrSourceParams for use with older vdr
  if (channel && ((channel->Source() >> 24) == 'V'))
     return new cPvrMenuMain();
#endif
  Skins.Message(mtError, tr("Setup.pvrinput$Not on an analogue channel!"), 2);
  return NULL;
}

cMenuSetupPage *cPluginPvrInput::SetupMenu(void)
{
  return new cPvrMenuSetup();
}

bool cPluginPvrInput::SetupParse(const char *Name, const char *Value)
{
  if      (!strcasecmp(Name, "LogLevel"))                     PvrSetup.LogLevel                       = atoi(Value);
  else if (!strcasecmp(Name, "UseOnlyCard"))                  PvrSetup.UseOnlyCard                    = atoi(Value);
  else if (!strcasecmp(Name, "SliceVBI"))                     PvrSetup.SliceVBI                       = atoi(Value);
  else if (!strcasecmp(Name, "TunerAudioMode"))               PvrSetup.TunerAudioMode                 = atoi(Value);
  else if (!strcasecmp(Name, "Brightness"))                   PvrSetup.Brightness.value               = atoi(Value);
  else if (!strcasecmp(Name, "Contrast"))                     PvrSetup.Contrast.value                 = atoi(Value);
  else if (!strcasecmp(Name, "Saturation"))                   PvrSetup.Saturation.value               = atoi(Value);
  else if (!strcasecmp(Name, "Hue"))                          PvrSetup.Hue.value                      = atoi(Value);
  else if (!strcasecmp(Name, "AudioVolumeTVCommon"))          PvrSetup.AudioVolumeTVCommon.value      = atoi(Value);
  else if (!strcasecmp(Name, "AudioVolumeTVException"))       PvrSetup.AudioVolumeTVException.value   = atoi(Value);
  else if (!strcasecmp(Name, "AudioVolumeTVExceptionCard"))   PvrSetup.AudioVolumeTVExceptionCard     = atoi(Value);
  else if (!strcasecmp(Name, "AudioVolumeFM"))                PvrSetup.AudioVolumeFM.value            = atoi(Value);
  else if (!strcasecmp(Name, "AudioSampling"))                PvrSetup.AudioSampling.value            = atoi(Value);
  else if (!strcasecmp(Name, "VideoBitrateTV"))               PvrSetup.VideoBitrateTV.value           = atoi(Value) * 1000;
  else if (!strcasecmp(Name, "AudioBitrate"))                 PvrSetup.AudioBitrate.value             = atoi(Value);
  else if (!strcasecmp(Name, "BitrateMode"))                  PvrSetup.BitrateMode.value              = atoi(Value);
  else if (!strcasecmp(Name, "AspectRatio"))                  PvrSetup.AspectRatio.value              = atoi(Value);
  else if (!strcasecmp(Name, "StreamType"))                   PvrSetup.StreamType.value               = atoi(Value);
  else if (!strcasecmp(Name, "FilterSpatialMode"))            PvrSetup.FilterSpatialMode.value        = atoi(Value);
  else if (!strcasecmp(Name, "FilterSpatial"))                PvrSetup.FilterSpatial.value            = atoi(Value);
  else if (!strcasecmp(Name, "FilterLumaSpatialType"))        PvrSetup.FilterLumaSpatialType.value    = atoi(Value);
  else if (!strcasecmp(Name, "FilterChromaSpatialType"))      PvrSetup.FilterChromaSpatialType.value  = atoi(Value);
  else if (!strcasecmp(Name, "FilterTemporalMode"))           PvrSetup.FilterTemporalMode.value       = atoi(Value);
  else if (!strcasecmp(Name, "FilterTemporal"))               PvrSetup.FilterTemporal.value           = atoi(Value);
  else if (!strcasecmp(Name, "FilterMedianType"))             PvrSetup.FilterMedianType.value         = atoi(Value);
  else if (!strcasecmp(Name, "FilterLumaMedianBottom"))       PvrSetup.FilterLumaMedianBottom.value   = atoi(Value);
  else if (!strcasecmp(Name, "FilterLumaMedianTop"))          PvrSetup.FilterLumaMedianTop.value      = atoi(Value);
  else if (!strcasecmp(Name, "FilterChromaMedianBottom"))     PvrSetup.FilterChromaMedianBottom.value = atoi(Value);
  else if (!strcasecmp(Name, "FilterChromaMedianTop"))        PvrSetup.FilterChromaMedianTop.value    = atoi(Value);
  else if (!strcasecmp(Name, "HideMainMenuEntry"))            PvrSetup.HideMainMenuEntry              = atoi(Value);
  else if (!strcasecmp(Name, "ReadBufferSizeKB"))             PvrSetup.ReadBufferSizeKB               = atoi(Value);
  else if (!strcasecmp(Name, "TsBufferSizeMB"))               PvrSetup.TsBufferSizeMB                 = atoi(Value);
  else if (!strcasecmp(Name, "TsBufferPrefillRatio"))         PvrSetup.TsBufferPrefillRatio           = atoi(Value);
  else if (!strcasecmp(Name, "UseExternChannelSwitchScript")) PvrSetup.UseExternChannelSwitchScript   = atoi(Value);
  else if (!strcasecmp(Name, "ExternChannelSwitchSleep"))     PvrSetup.ExternChannelSwitchSleep       = atoi(Value);
  else if (!strcasecmp(Name, "HDPVR_AudioEncoding"))          PvrSetup.HDPVR_AudioEncoding.value      = atoi(Value) + 3;
  else if (!strcasecmp(Name, "HDPVR_AudioInput"))             PvrSetup.HDPVR_AudioInput               = atoi(Value);
  else return false;
  return true;
}

VDRPLUGINCREATOR(cPluginPvrInput); // Don't touch this!