summaryrefslogtreecommitdiff
path: root/common.c
diff options
context:
space:
mode:
authorschmirl <schmirl>2009-09-18 10:41:41 +0000
committerschmirl <schmirl>2009-09-18 10:41:41 +0000
commit1cf41fb16f8a0ea06fa0dd8cabadc8a3e3610dc6 (patch)
tree252d15da3ce3dbe8813a70854fe67537c5037c83 /common.c
parent6fb88f8d99af82c301ace0f0448eb7dbb964f2be (diff)
downloadvdr-plugin-streamdev-1cf41fb16f8a0ea06fa0dd8cabadc8a3e3610dc6.tar.gz
vdr-plugin-streamdev-1cf41fb16f8a0ea06fa0dd8cabadc8a3e3610dc6.tar.bz2
- cleaned up common.h / common.c
- dropped cStreamdevMenuSetupPage
Diffstat (limited to 'common.c')
-rw-r--r--common.c137
1 files changed, 2 insertions, 135 deletions
diff --git a/common.c b/common.c
index cd19d75..279e909 100644
--- a/common.c
+++ b/common.c
@@ -1,5 +1,5 @@
/*
- * $Id: common.c,v 1.10 2009/06/19 06:32:38 schmirl Exp $
+ * $Id: common.c,v 1.11 2009/09/18 10:41:41 schmirl Exp $
*/
#include <vdr/channels.h>
@@ -12,140 +12,7 @@ using namespace std;
const char *VERSION = "0.5.0-pre";
-const char *StreamTypes[st_Count] = {
- "TS",
- "PES",
- "PS",
- "ES",
- "Extern",
- "", // used internally only
-};
-
-const char *SuspendModes[sm_Count] = {
- trNOOP("Offer suspend mode"),
- trNOOP("Always suspended"),
- trNOOP("Never suspended")
-};
-
-const char IpCharacters[] = "0123456789.";
-
-char *GetNextLine(char *String, uint Length, uint &Offset) {
- char *last, *first;
-
- first = String + Offset;
- for (last = first; last < String + Length; ++last) {
- if (*last == '\012') {
- if (*(last - 1) == '\015')
- *(last - 1) = '\0';
-
- *last++ = '\0';
- Dprintf("IN: |%s|\n", first);
- Offset = last - String;
- return first;
- }
- }
- return NULL;
-}
-
-const cChannel *ChannelFromString(const char *String, int *Apid) {
- const cChannel *channel = NULL;
- char *string = strdup(String);
- char *ptr, *end;
- int apididx = 0;
-
- if ((ptr = strrchr(string, '+')) != NULL) {
- *(ptr++) = '\0';
- apididx = strtoul(ptr, &end, 10);
- Dprintf("found apididx: %d\n", apididx);
- }
-
- if (isnumber(string)) {
- int temp = strtol(String, NULL, 10);
- if (temp >= 1 && temp <= Channels.MaxNumber())
- channel = Channels.GetByNumber(temp);
- } else {
- channel = Channels.GetByChannelID(tChannelID::FromString(string));
-
- if (channel == NULL) {
- int i = 1;
- while ((channel = Channels.GetByNumber(i, 1)) != NULL) {
- if (String == channel->Name())
- break;
-
- i = channel->Number() + 1;
- }
- }
- }
-
- if (channel != NULL && apididx > 0) {
- int apid = 0, index = 1;
-
- for (int i = 0; channel->Apid(i) != 0; ++i, ++index) {
- if (index == apididx) {
- apid = channel->Apid(i);
- break;
- }
- }
-
- if (apid == 0) {
- for (int i = 0; channel->Dpid(i) != 0; ++i, ++index) {
- if (index == apididx) {
- apid = channel->Dpid(i);
- break;
- }
- }
- }
-
- if (Apid != NULL)
- *Apid = apid;
- }
-
- free(string);
- return channel;
-}
-
-void cStreamdevMenuSetupPage::AddCategory(const char *Title) {
- char *buffer = NULL;
-
- asprintf(&buffer, "--- %s -------------------------------------------------"
- "---------------", Title );
-
- cOsdItem *item = new cOsdItem(buffer);
- free(buffer);
- item->SetSelectable(false);
- Add(item);
-}
-
-void cStreamdevMenuSetupPage::AddBoolEdit(const char *Title, int &Value) {
- Add(new cMenuEditBoolItem(Title, &Value));
-}
-
-void cStreamdevMenuSetupPage::AddIpEdit(const char *Title, char *Value) {
- Add(new cMenuEditIpItem(Title, Value));
-}
-
-void cStreamdevMenuSetupPage::AddShortEdit(const char *Title, int &Value) {
- AddRangeEdit(Title, Value, 0, 65535);
-}
-
-void cStreamdevMenuSetupPage::AddRangeEdit(const char *Title, int &Value,
- int Min, int Max) {
- Add(new cMenuEditIntItem(Title, &Value, Min, Max));
-}
-
-void cStreamdevMenuSetupPage::AddSuspEdit(const char *Title, int &Value) {
- static const char *SuspendModesTR[sm_Count] = { NULL };
-
- if (SuspendModesTR[0] == NULL) {
- for (int i = 0; i < sm_Count; ++i)
- SuspendModesTR[i] = tr(SuspendModes[i]);
- }
-
- Add(new cMenuEditStraItem(Title, &Value, sm_Count, SuspendModesTR));
-}
-void cStreamdevMenuSetupPage::AddTypeEdit(const char *Title, int &Value) {
- Add(new cMenuEditStraItem(Title, &Value, st_CountSetup, StreamTypes));
-}
+const char cMenuEditIpItem::IpCharacters[] = "0123456789.";
cMenuEditIpItem::cMenuEditIpItem(const char *Name, char *Value):
cMenuEditItem(Name) {