Commit 056c9fe3 authored by Damien Fouilleul's avatar Damien Fouilleul

- added log APIs to javascript for mozilla

parent 3a168d9e
This diff is collapsed.
......@@ -23,6 +23,7 @@
/*
** defined runtime script objects
*/
#include <vlc/libvlc.h>
#include "nporuntime.h"
......@@ -44,6 +45,7 @@ protected:
NPObject *audioObj;
NPObject *inputObj;
NPObject *logObj;
NPObject *playlistObj;
NPObject *videoObj;
};
......@@ -76,7 +78,7 @@ protected:
LibvlcInputNPObject(NPP instance, const NPClass *aClass) :
RuntimeNPObject(instance, aClass) {};
virtual ~LibvlcInputNPObject() {};
static const int propertyCount;
......@@ -89,6 +91,130 @@ protected:
static const NPUTF8 * const methodNames[];
};
class LibvlcMessageNPObject: public RuntimeNPObject
{
public:
void setMessage(struct libvlc_log_message_t &msg)
{
_msg = msg;
};
protected:
friend class RuntimeNPClass<LibvlcMessageNPObject>;
LibvlcMessageNPObject(NPP instance, const NPClass *aClass) :
RuntimeNPObject(instance, aClass) {};
virtual ~LibvlcMessageNPObject() {};
static const int propertyCount;
static const NPUTF8 * const propertyNames[];
InvokeResult getProperty(int index, NPVariant &result);
static const int methodCount;
static const NPUTF8 * const methodNames[];
private:
struct libvlc_log_message_t _msg;
};
class LibvlcLogNPObject;
class LibvlcMessageIteratorNPObject: public RuntimeNPObject
{
public:
void setLog(LibvlcLogNPObject* p_vlclog);
protected:
friend class RuntimeNPClass<LibvlcMessageIteratorNPObject>;
LibvlcMessageIteratorNPObject(NPP instance, const NPClass *aClass) :
RuntimeNPObject(instance, aClass) {};
virtual ~LibvlcMessageIteratorNPObject() {};
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:
LibvlcLogNPObject* _p_vlclog;
libvlc_log_iterator_t* _p_iter;
};
class LibvlcMessagesNPObject: public RuntimeNPObject
{
public:
void setLog(LibvlcLogNPObject *p_log)
{
_p_vlclog = p_log;
}
protected:
friend class RuntimeNPClass<LibvlcMessagesNPObject>;
LibvlcMessagesNPObject(NPP instance, const NPClass *aClass) :
_p_vlclog(NULL),
RuntimeNPObject(instance, aClass) {};
virtual ~LibvlcMessagesNPObject() {};
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:
LibvlcLogNPObject* _p_vlclog;
};
class LibvlcLogNPObject: public RuntimeNPObject
{
protected:
friend class RuntimeNPClass<LibvlcLogNPObject>;
friend class LibvlcMessagesNPObject;
friend class LibvlcMessageIteratorNPObject;
libvlc_log_t *_p_log;
LibvlcLogNPObject(NPP instance, const NPClass *aClass) :
RuntimeNPObject(instance, aClass),
_p_log(NULL)
{
_p_vlcmessages = static_cast<LibvlcMessagesNPObject*>(NPN_CreateObject(instance, RuntimeNPClass<LibvlcMessagesNPObject>::getClass()));
_p_vlcmessages->setLog(this);
};
virtual ~LibvlcLogNPObject()
{
NPN_ReleaseObject(_p_vlcmessages);
};
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[];
private:
LibvlcMessagesNPObject* _p_vlcmessages;
};
class LibvlcPlaylistNPObject: public RuntimeNPObject
{
protected:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment