summaryrefslogtreecommitdiff
path: root/osdpip.c
blob: 9fba186b94748cdd0a7f4180d4cf3d1752bf7b30 (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
/*
 * OSD Picture in Picture plugin for the Video Disk Recorder
 *
 * Copyright (C) 2010        Mitchm at vdrportal.de
 * Copyright (C) 2004 - 2008 Andreas Regel <andreas.regel@powarman.de>
 * Copyright (C) 2004 - 2005 Sascha Volkenandt <sascha@akv-soft.de>
 *
 * 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 of the License, 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 this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include "decoder.h"
#include "osd.h"
#include "setup.h"
#if (APIVERSNUM < 10507)
#include "i18n.h"
#endif

#include <vdr/plugin.h>

static const char *VERSION        = "0.1.1";
static const char *DESCRIPTION    = trNOOP("OSD Picture-in-Picture");
static const char *MAINMENUENTRY  = trNOOP("Picture-in-Picture");

class cPluginOsdpip : public cPlugin
{
private:
    
public:
    cPluginOsdpip(void);
    virtual ~cPluginOsdpip();
    virtual const char *Version(void) { return VERSION; }
    virtual const char *Description(void) { return tr(DESCRIPTION); }
    virtual const char *CommandLineHelp(void);
    virtual bool ProcessArgs(int argc, char *argv[]);
    virtual bool Initialize(void);
    virtual bool Start(void);
    virtual void Housekeeping(void);
    virtual const char *MainMenuEntry(void) { return tr(MAINMENUENTRY); }
    virtual cOsdObject *MainMenuAction(void);
    virtual cMenuSetupPage *SetupMenu(void);
    virtual bool SetupParse(const char *Name, const char *Value);
};

cPluginOsdpip::cPluginOsdpip(void)
{
}

cPluginOsdpip::~cPluginOsdpip()
{
}

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

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

bool cPluginOsdpip::Initialize(void)
{
    // must be called before using avcodec lib
    avcodec_init();
    // register all the codecs (you can also register only the codec
    // you wish to have smaller code)
    avcodec_register_all();
    return true;
}

bool cPluginOsdpip::Start(void)
{
#if (APIVERSNUM < 10507)
    RegisterI18n(Phrases);
#endif
    return true;
}

void cPluginOsdpip::Housekeeping(void)
{
}

cOsdObject *cPluginOsdpip::MainMenuAction(void)
{
    const cChannel *chan;
    cDevice *dev;

    chan = cDevice::CurrentChannel() != 0 
        ? Channels.GetByNumber(cDevice::CurrentChannel()) : NULL;
    if (chan != NULL) {
#if (APIVERSNUM < 10500)
        dev = cDevice::GetDevice(chan, 1);
#else
        dev = cDevice::GetDevice(chan, 1, false);
#endif
        if (dev)
            return new cOsdPipObject(dev, chan);
    }
    return NULL;
}

cMenuSetupPage *cPluginOsdpip::SetupMenu(void)
{
    return new cOsdPipSetupPage;
}

bool cPluginOsdpip::SetupParse(const char *Name, const char *Value)
{
    return OsdPipSetup.SetupParse(Name, Value);
}

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