npolibvlc.h 8.7 KB
Newer Older
Rafaël Carré's avatar
Rafaël Carré committed
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
/*****************************************************************************
 * npolibvlc.h: official Javascript APIs
 *****************************************************************************
 * Copyright (C) 2002-2006 the VideoLAN team
 *
 * Authors: Damien Fouilleul <damien.fouilleul@laposte.net>
 *
 * 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
*/
26
#include <vlc/vlc.h>
Rafaël Carré's avatar
Rafaël Carré committed
27 28 29 30 31 32 33 34 35 36 37 38 39

#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),
40
    subtitleObj(NULL),
41 42
    videoObj(NULL),
    mediaDescriptionObj(NULL) { }
Rafaël Carré's avatar
Rafaël Carré committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

    virtual ~LibvlcRootNPObject();

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

    InvokeResult getProperty(int index, NPVariant &result);

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

    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);

private:
    NPObject *audioObj;
    NPObject *inputObj;
    NPObject *playlistObj;
60
    NPObject *subtitleObj;
Rafaël Carré's avatar
Rafaël Carré committed
61
    NPObject *videoObj;
62
    NPObject *mediaDescriptionObj;
Rafaël Carré's avatar
Rafaël Carré committed
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
};

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[];

    InvokeResult getProperty(int index, NPVariant &result);
    InvokeResult setProperty(int index, const NPVariant &value);

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

    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
};

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[];

    InvokeResult getProperty(int index, NPVariant &result);
    InvokeResult setProperty(int index, const NPVariant &value);

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

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

108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
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[];

    InvokeResult getProperty(int index, NPVariant &result);
    static const int methodCount;
    static const NPUTF8 * const methodNames[];
};

Rafaël Carré's avatar
Rafaël Carré committed
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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
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[];

    InvokeResult getProperty(int index, NPVariant &result);

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

    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
};

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

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

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

    InvokeResult getProperty(int index, NPVariant &result);

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

    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);

    void parseOptions(const NPString &s, int *i_options, char*** ppsz_options);
    void parseOptions(NPObject *obj, int *i_options, char*** ppsz_options);

private:
    NPObject*  playlistItemsObj;
};

172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
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[];

    InvokeResult getProperty(int index, NPVariant &result);
    InvokeResult setProperty(int index, const NPVariant &value);

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

    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
};


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

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

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

    InvokeResult getProperty(int index, NPVariant &result);
    InvokeResult setProperty(int index, const NPVariant &value);

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

213 214 215 216
    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);

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

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[];

    InvokeResult getProperty(int index, NPVariant &result);
    InvokeResult setProperty(int index, const NPVariant &value);

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

Rafaël Carré's avatar
Rafaël Carré committed
239 240
    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
};
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261

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[];

    InvokeResult getProperty(int index, NPVariant &result);
    InvokeResult setProperty(int index, const NPVariant &value);

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

    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
};
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282

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[];

    InvokeResult getProperty(int index, NPVariant &result);
    InvokeResult setProperty(int index, const NPVariant &value);

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

    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
};
283