npolibvlc.h 9.37 KB
Newer Older
Rafaël Carré's avatar
Rafaël Carré committed
1 2 3
/*****************************************************************************
 * npolibvlc.h: official Javascript APIs
 *****************************************************************************
4
 * Copyright (C) 2002-2012 VLC authors and VideoLAN
Rafaël Carré's avatar
Rafaël Carré committed
5
 *
6 7 8
 * Authors: Rafaël Carré <funman@videolan.org>
 *          JP Dinger <jpd@videolan.org>
 *          Cyril Mathé <cmathe@actech-innovation.com>
Rafaël Carré's avatar
Rafaël Carré committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
 *
 * 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.
 *****************************************************************************/

/*
** defined runtime script objects
*/
28
#include <vlc/vlc.h>
Rafaël Carré's avatar
Rafaël Carré committed
29 30 31 32 33 34 35 36 37 38 39 40 41

#include "nporuntime.h"

class LibvlcRootNPObject: public RuntimeNPObject
{
protected:
    friend class RuntimeNPClass<LibvlcRootNPObject>;

    LibvlcRootNPObject(NPP instance, const NPClass *aClass) :
        RuntimeNPObject(instance, aClass),
    audioObj(NULL),
    inputObj(NULL),
    playlistObj(NULL),
42
    subtitleObj(NULL),
43 44
    videoObj(NULL),
    mediaDescriptionObj(NULL) { }
Rafaël Carré's avatar
Rafaël Carré committed
45 46 47 48 49 50

    virtual ~LibvlcRootNPObject();

    static const int propertyCount;
    static const NPUTF8 * const propertyNames[];

51
    InvokeResult getProperty(int index, npapi::OutVariant& result);
Rafaël Carré's avatar
Rafaël Carré committed
52 53 54 55

    static const int methodCount;
    static const NPUTF8 * const methodNames[];

56
    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, npapi::OutVariant &result) override;
Rafaël Carré's avatar
Rafaël Carré committed
57 58 59 60 61

private:
    NPObject *audioObj;
    NPObject *inputObj;
    NPObject *playlistObj;
62
    NPObject *subtitleObj;
Rafaël Carré's avatar
Rafaël Carré committed
63
    NPObject *videoObj;
64
    NPObject *mediaDescriptionObj;
Rafaël Carré's avatar
Rafaël Carré committed
65 66 67 68 69 70 71 72 73 74 75 76 77 78
};

class LibvlcAudioNPObject: public RuntimeNPObject
{
protected:
    LibvlcAudioNPObject(NPP instance, const NPClass *aClass) :
        RuntimeNPObject(instance, aClass) {};
    virtual ~LibvlcAudioNPObject() {};

    friend class RuntimeNPClass<LibvlcAudioNPObject>;

    static const int propertyCount;
    static const NPUTF8 * const propertyNames[];

79
    virtual InvokeResult getProperty(int index, npapi::OutVariant& result) override;
80
    virtual InvokeResult setProperty(int index, const NPVariant &value) override;
Rafaël Carré's avatar
Rafaël Carré committed
81 82 83 84

    static const int methodCount;
    static const NPUTF8 * const methodNames[];

85
    virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, npapi::OutVariant &result)  override;
Rafaël Carré's avatar
Rafaël Carré committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
};

class LibvlcInputNPObject: public RuntimeNPObject
{
protected:
    friend class RuntimeNPClass<LibvlcInputNPObject>;

    LibvlcInputNPObject(NPP instance, const NPClass *aClass) :
        RuntimeNPObject(instance, aClass) {};

    virtual ~LibvlcInputNPObject() {};

    static const int propertyCount;
    static const NPUTF8 * const propertyNames[];

101
    virtual InvokeResult getProperty(int index, npapi::OutVariant& result) override;
102
    virtual InvokeResult setProperty(int index, const NPVariant &value) override;
Rafaël Carré's avatar
Rafaël Carré committed
103 104 105

    static const int methodCount;
    static const NPUTF8 * const methodNames[];
106 107

    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
Rafaël Carré's avatar
Rafaël Carré committed
108 109
};

110 111 112 113 114 115 116 117 118 119 120
class LibvlcMediaDescriptionNPObject: public RuntimeNPObject
{
protected:
    friend class RuntimeNPClass<LibvlcMediaDescriptionNPObject>;
    LibvlcMediaDescriptionNPObject(NPP instance, const NPClass *aClass) :
        RuntimeNPObject(instance, aClass) {};
    virtual ~LibvlcMediaDescriptionNPObject() {};

    static const int propertyCount;
    static const NPUTF8 * const propertyNames[];

121
    virtual InvokeResult getProperty(int index, npapi::OutVariant& result) override;
122

123 124 125 126
    static const int methodCount;
    static const NPUTF8 * const methodNames[];
};

Rafaël Carré's avatar
Rafaël Carré committed
127 128 129 130 131 132 133 134 135 136 137 138
class LibvlcPlaylistItemsNPObject: public RuntimeNPObject
{
protected:
    friend class RuntimeNPClass<LibvlcPlaylistItemsNPObject>;

    LibvlcPlaylistItemsNPObject(NPP instance, const NPClass *aClass) :
        RuntimeNPObject(instance, aClass) {};
    virtual ~LibvlcPlaylistItemsNPObject() {};

    static const int propertyCount;
    static const NPUTF8 * const propertyNames[];

139
    virtual InvokeResult getProperty(int index, npapi::OutVariant& result) override;
Rafaël Carré's avatar
Rafaël Carré committed
140 141 142 143

    static const int methodCount;
    static const NPUTF8 * const methodNames[];

144
    virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, npapi::OutVariant &result) override;
Rafaël Carré's avatar
Rafaël Carré committed
145 146 147 148 149 150 151 152 153 154
};

class LibvlcPlaylistNPObject: public RuntimeNPObject
{
protected:
    friend class RuntimeNPClass<LibvlcPlaylistNPObject>;

    LibvlcPlaylistNPObject(NPP instance, const NPClass *aClass) :
    RuntimeNPObject(instance, aClass),
    playlistItemsObj(NULL) {};
155

Rafaël Carré's avatar
Rafaël Carré committed
156 157 158 159 160
    virtual ~LibvlcPlaylistNPObject();

    static const int propertyCount;
    static const NPUTF8 * const propertyNames[];

161
    virtual InvokeResult getProperty(int index, npapi::OutVariant& result) override;
Rafaël Carré's avatar
Rafaël Carré committed
162 163 164 165

    static const int methodCount;
    static const NPUTF8 * const methodNames[];

166
    virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, npapi::OutVariant &result) override;
Rafaël Carré's avatar
Rafaël Carré committed
167

168
    void parseOptions(const NPString& s, int *i_options, char*** ppsz_options);
Rafaël Carré's avatar
Rafaël Carré committed
169 170 171 172 173 174
    void parseOptions(NPObject *obj, int *i_options, char*** ppsz_options);

private:
    NPObject*  playlistItemsObj;
};

175 176 177 178 179 180 181 182 183 184 185 186
class LibvlcSubtitleNPObject: public RuntimeNPObject
{
protected:
    friend class RuntimeNPClass<LibvlcSubtitleNPObject>;

    LibvlcSubtitleNPObject(NPP instance, const NPClass *aClass) :
        RuntimeNPObject(instance, aClass) {};
    virtual ~LibvlcSubtitleNPObject() {};

    static const int propertyCount;
    static const NPUTF8 * const propertyNames[];

187
    virtual InvokeResult getProperty(int index, npapi::OutVariant& result) override;
188
    virtual InvokeResult setProperty(int index, const NPVariant &value) override;
189 190 191 192

    static const int methodCount;
    static const NPUTF8 * const methodNames[];

193
    virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, npapi::OutVariant &result) override;
194 195 196
};


Rafaël Carré's avatar
Rafaël Carré committed
197 198 199 200 201 202
class LibvlcVideoNPObject: public RuntimeNPObject
{
protected:
    friend class RuntimeNPClass<LibvlcVideoNPObject>;

    LibvlcVideoNPObject(NPP instance, const NPClass *aClass) :
203
        RuntimeNPObject(instance, aClass),
204 205
        marqueeObj(NULL), logoObj(NULL), deintObj(NULL) { }
    virtual ~LibvlcVideoNPObject();
Rafaël Carré's avatar
Rafaël Carré committed
206 207 208 209

    static const int propertyCount;
    static const NPUTF8 * const propertyNames[];

210
    virtual InvokeResult getProperty(int index, npapi::OutVariant& result) override;
211
    virtual InvokeResult setProperty(int index, const NPVariant &value) override;
Rafaël Carré's avatar
Rafaël Carré committed
212 213 214 215

    static const int methodCount;
    static const NPUTF8 * const methodNames[];

216
    virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, npapi::OutVariant &result) override;
217 218 219

private:
    NPObject *marqueeObj;
220
    NPObject *logoObj;
221
    NPObject *deintObj;
222 223 224 225 226 227 228 229 230 231 232 233 234 235
};

class LibvlcMarqueeNPObject: public RuntimeNPObject
{
protected:
    friend class RuntimeNPClass<LibvlcMarqueeNPObject>;

    LibvlcMarqueeNPObject(NPP instance, const NPClass *aClass) :
        RuntimeNPObject(instance, aClass) {};
    virtual ~LibvlcMarqueeNPObject() {};

    static const int propertyCount;
    static const NPUTF8 * const propertyNames[];

236
    virtual InvokeResult getProperty(int index, npapi::OutVariant& result) override;
237
    virtual InvokeResult setProperty(int index, const NPVariant &value) override;
238 239 240 241

    static const int methodCount;
    static const NPUTF8 * const methodNames[];

242
    virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, npapi::OutVariant &result) override;
Rafaël Carré's avatar
Rafaël Carré committed
243
};
244 245 246 247 248 249 250 251 252 253 254 255 256

class LibvlcLogoNPObject: public RuntimeNPObject
{
protected:
    friend class RuntimeNPClass<LibvlcLogoNPObject>;

    LibvlcLogoNPObject(NPP instance, const NPClass *aClass) :
        RuntimeNPObject(instance, aClass) { }
    virtual ~LibvlcLogoNPObject() { }

    static const int propertyCount;
    static const NPUTF8 * const propertyNames[];

257
    virtual InvokeResult getProperty(int index, npapi::OutVariant& result) override;
258
    virtual InvokeResult setProperty(int index, const NPVariant &value) override;
259 260 261 262

    static const int methodCount;
    static const NPUTF8 * const methodNames[];

263
    virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, npapi::OutVariant& result) override;
264
};
265 266 267 268 269 270 271 272 273 274 275 276 277

class LibvlcDeinterlaceNPObject: public RuntimeNPObject
{
protected:
    friend class RuntimeNPClass<LibvlcDeinterlaceNPObject>;

    LibvlcDeinterlaceNPObject(NPP instance, const NPClass *aClass) :
        RuntimeNPObject(instance, aClass) { }
    virtual ~LibvlcDeinterlaceNPObject() { }

    static const int propertyCount;
    static const NPUTF8 * const propertyNames[];

278
    virtual InvokeResult getProperty(int index, npapi::OutVariant& result) override;
279
    virtual InvokeResult setProperty(int index, const NPVariant &value) override;
280 281 282 283

    static const int methodCount;
    static const NPUTF8 * const methodNames[];

284
    virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, npapi::OutVariant &result) override;
285
};
286