]> git.sesse.net Git - vlc/commitdiff
mozilla: backporting from 0.8.6
authorDamien Fouilleul <damienf@videolan.org>
Thu, 7 Dec 2006 00:29:57 +0000 (00:29 +0000)
committerDamien Fouilleul <damienf@videolan.org>
Thu, 7 Dec 2006 00:29:57 +0000 (00:29 +0000)
mozilla/Makefile.am
mozilla/control/npolibvlc.cpp
mozilla/control/npolibvlc.h
mozilla/control/nporuntime.cpp
mozilla/npvlc_rc.rc
mozilla/support/npmac.cpp
mozilla/vlc.r
mozilla/vlcplugin.cpp
mozilla/vlcplugin.h
mozilla/vlcshell.cpp

index d8eb3247cbfcdb99fffec22d812ca6af4c607a2f..d640b3e34e5b8f9d610046a08a3d18316f8cbfff 100644 (file)
@@ -6,7 +6,7 @@ noinst_LIBRARIES = $(noinst_LIBRARIES_mozilla)
 
 MOSTLYCLEANFILES = $(npvlc_DATA)
 CLEANFILES = stamp-pic $(BUILT_SOURCES)
-EXTRA_DIST = $(DIST_sources) npvlc_rc.rc vlc.r
+EXTRA_DIST = $(DIST_sources) install.js npvlc_rc.rc vlc.r
 
 SOURCES_mozilla_common = \
        vlcshell.cpp \
index 60f9a0c26bb550624a4975cb96ede0248f951402..15837078ce50ffff0d2f049da96ea1dc6903cd21 100755 (executable)
@@ -61,6 +61,7 @@ const NPUTF8 * const LibvlcRootNPObject::propertyNames[] =
 {\r
     "audio",\r
     "input",\r
+    "log",\r
     "playlist",\r
     "video",\r
     "VersionInfo",\r
@@ -70,38 +71,54 @@ const int LibvlcRootNPObject::propertyCount = sizeof(LibvlcRootNPObject::propert
 \r
 enum LibvlcRootNPObjectPropertyIds\r
 {\r
-    ID_audio = 0,\r
-    ID_input,\r
-    ID_playlist,\r
-    ID_video,\r
-    ID_VersionInfo,\r
+    ID_root_audio = 0,\r
+    ID_root_input,\r
+    ID_root_log,\r
+    ID_root_playlist,\r
+    ID_root_video,\r
+    ID_root_VersionInfo,\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcRootNPObject::getProperty(int index, NPVariant &result)\r
 {\r
-    switch( index )\r
+    VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);\r
+    if( p_plugin )\r
     {\r
-        case ID_audio:\r
-            OBJECT_TO_NPVARIANT(NPN_RetainObject(audioObj), result);\r
-            return INVOKERESULT_NO_ERROR;\r
-        case ID_input:\r
-            OBJECT_TO_NPVARIANT(NPN_RetainObject(inputObj), result);\r
-            return INVOKERESULT_NO_ERROR;\r
-        case ID_playlist:\r
-            OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistObj), result);\r
-            return INVOKERESULT_NO_ERROR;\r
-        case ID_video:\r
-            OBJECT_TO_NPVARIANT(NPN_RetainObject(videoObj), result);\r
-            return INVOKERESULT_NO_ERROR;\r
-        case ID_VersionInfo:\r
-            NPUTF8 *versionStr = NULL;\r
-\r
-            versionStr = strdup( VLC_Version() );\r
-            if (!versionStr)\r
-                return INVOKERESULT_GENERIC_ERROR;\r
-\r
-            STRINGZ_TO_NPVARIANT(versionStr, result);\r
-            return INVOKERESULT_NO_ERROR;\r
+        switch( index )\r
+        {\r
+            case ID_root_audio:\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(audioObj), result);\r
+                return INVOKERESULT_NO_ERROR;\r
+            case ID_root_input:\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(inputObj), result);\r
+                return INVOKERESULT_NO_ERROR;\r
+            case ID_root_log:\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(logObj), result);\r
+                return INVOKERESULT_NO_ERROR;\r
+            case ID_root_playlist:\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistObj), result);\r
+                return INVOKERESULT_NO_ERROR;\r
+            case ID_root_video:\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(videoObj), result);\r
+                return INVOKERESULT_NO_ERROR;\r
+            case ID_root_VersionInfo:\r
+            {\r
+                int len = strlen(VLC_Version());\r
+                NPUTF8 *retval =(NPUTF8*)NPN_MemAlloc(len);\r
+                if( retval )\r
+                {\r
+                    memcpy(retval, VLC_Version(), len);\r
+                    STRINGN_TO_NPVARIANT(retval, len, result);\r
+                }\r
+                else\r
+                {\r
+                    NULL_TO_NPVARIANT(result);\r
+                }\r
+                return INVOKERESULT_NO_ERROR;\r
+            }\r
+            default:\r
+                ;\r
+        }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
 }\r
@@ -115,7 +132,7 @@ const int LibvlcRootNPObject::methodCount = sizeof(LibvlcRootNPObject::methodNam
 \r
 enum LibvlcRootNPObjectMethodIds\r
 {\r
-    ID_version,\r
+    ID_root_versionInfo,\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcRootNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)\r
@@ -128,21 +145,25 @@ RuntimeNPObject::InvokeResult LibvlcRootNPObject::invoke(int index, const NPVari
 \r
         switch( index )\r
         {\r
-            case ID_version:\r
+            case ID_root_versionInfo:\r
                 if( argCount == 0 )\r
                 {\r
-                    NPUTF8 *versionStr = NULL;\r
-\r
-                    versionStr = strdup( VLC_Version() );\r
-                    if (!versionStr)\r
-                        return INVOKERESULT_GENERIC_ERROR;\r
-\r
-                    STRINGZ_TO_NPVARIANT(versionStr, result);\r
+                    int len = strlen(VLC_Version());\r
+                    NPUTF8 *retval =(NPUTF8*)NPN_MemAlloc(len);\r
+                    if( retval )\r
+                    {\r
+                        memcpy(retval, VLC_Version(), len);\r
+                        STRINGN_TO_NPVARIANT(retval, len, result);\r
+                    }\r
+                    else\r
+                    {\r
+                        NULL_TO_NPVARIANT(result);\r
+                    }\r
                     return INVOKERESULT_NO_ERROR;\r
                 }\r
                 return INVOKERESULT_NO_SUCH_METHOD;\r
             default:\r
-                return INVOKERESULT_NO_SUCH_METHOD;\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -162,8 +183,8 @@ const int LibvlcAudioNPObject::propertyCount = sizeof(LibvlcAudioNPObject::prope
 \r
 enum LibvlcAudioNPObjectPropertyIds\r
 {\r
-    ID_mute,\r
-    ID_volume,\r
+    ID_audio_mute,\r
+    ID_audio_volume,\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVariant &result)\r
@@ -176,7 +197,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
 \r
         switch( index )\r
         {\r
-            case ID_mute:\r
+            case ID_audio_mute:\r
             {\r
                 vlc_bool_t muted = libvlc_audio_get_mute(p_plugin->getVLC(), &ex);\r
                 if( libvlc_exception_raised(&ex) )\r
@@ -188,7 +209,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
                 BOOLEAN_TO_NPVARIANT(muted, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_volume:\r
+            case ID_audio_volume:\r
             {\r
                 int volume = libvlc_audio_get_volume(p_plugin->getVLC(), &ex);\r
                 if( libvlc_exception_raised(&ex) )\r
@@ -200,6 +221,8 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
                 INT32_TO_NPVARIANT(volume, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
+            default:\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -215,7 +238,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
 \r
         switch( index )\r
         {\r
-            case ID_mute:\r
+            case ID_audio_mute:\r
                 if( NPVARIANT_IS_BOOLEAN(value) )\r
                 {\r
                     libvlc_audio_set_mute(p_plugin->getVLC(),\r
@@ -229,7 +252,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
                     return INVOKERESULT_NO_ERROR;\r
                 }\r
                 return INVOKERESULT_INVALID_VALUE;\r
-            case ID_volume:\r
+            case ID_audio_volume:\r
                 if( isNumberValue(value) )\r
                 {\r
                     libvlc_audio_set_volume(p_plugin->getVLC(),\r
@@ -243,6 +266,8 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
                     return INVOKERESULT_NO_ERROR;\r
                 }\r
                 return INVOKERESULT_INVALID_VALUE;\r
+            default:\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -257,7 +282,7 @@ const int LibvlcAudioNPObject::methodCount = sizeof(LibvlcAudioNPObject::methodN
 \r
 enum LibvlcAudioNPObjectMethodIds\r
 {\r
-    ID_togglemute,\r
+    ID_audio_togglemute,\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcAudioNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)\r
@@ -270,7 +295,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::invoke(int index, const NPVar
 \r
         switch( index )\r
         {\r
-            case ID_togglemute:\r
+            case ID_audio_togglemute:\r
                 if( argCount == 0 )\r
                 {\r
                     libvlc_audio_toggle_mute(p_plugin->getVLC(), &ex);\r
@@ -288,7 +313,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::invoke(int index, const NPVar
                 }\r
                 return INVOKERESULT_NO_SUCH_METHOD;\r
             default:\r
-                return INVOKERESULT_NO_SUCH_METHOD;\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -313,13 +338,13 @@ const int LibvlcInputNPObject::propertyCount = sizeof(LibvlcInputNPObject::prope
 \r
 enum LibvlcInputNPObjectPropertyIds\r
 {\r
-    ID_length,\r
-    ID_position,\r
-    ID_time,\r
-    ID_state,\r
-    ID_rate,\r
-    ID_fps,\r
-    ID_hasvout,\r
+    ID_input_length,\r
+    ID_input_position,\r
+    ID_input_time,\r
+    ID_input_state,\r
+    ID_input_rate,\r
+    ID_input_fps,\r
+    ID_input_hasvout,\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVariant &result)\r
@@ -333,7 +358,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
         libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);\r
         if( libvlc_exception_raised(&ex) )\r
         {\r
-            if( index != ID_state )\r
+            if( index != ID_input_state )\r
             {\r
                 NPN_SetException(this, libvlc_exception_get_message(&ex));\r
                 libvlc_exception_clear(&ex);\r
@@ -349,7 +374,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
 \r
         switch( index )\r
         {\r
-            case ID_length:\r
+            case ID_input_length:\r
             {\r
                 double val = (double)libvlc_input_get_length(p_input, &ex);\r
                 libvlc_input_free(p_input);\r
@@ -362,7 +387,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
                 DOUBLE_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_position:\r
+            case ID_input_position:\r
             {\r
                 double val = libvlc_input_get_position(p_input, &ex);\r
                 libvlc_input_free(p_input);\r
@@ -375,7 +400,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
                 DOUBLE_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_time:\r
+            case ID_input_time:\r
             {\r
                 double val = (double)libvlc_input_get_time(p_input, &ex);\r
                 libvlc_input_free(p_input);\r
@@ -388,7 +413,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
                 DOUBLE_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_state:\r
+            case ID_input_state:\r
             {\r
                 int val = libvlc_input_get_state(p_input, &ex);\r
                 libvlc_input_free(p_input);\r
@@ -401,7 +426,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
                 INT32_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_rate:\r
+            case ID_input_rate:\r
             {\r
                 float val = libvlc_input_get_rate(p_input, &ex);\r
                 libvlc_input_free(p_input);\r
@@ -414,7 +439,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
                 DOUBLE_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_fps:\r
+            case ID_input_fps:\r
             {\r
                 double val = libvlc_input_get_fps(p_input, &ex);\r
                 libvlc_input_free(p_input);\r
@@ -427,7 +452,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
                 DOUBLE_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_hasvout:\r
+            case ID_input_hasvout:\r
             {\r
                 vlc_bool_t val = libvlc_input_has_vout(p_input, &ex);\r
                 libvlc_input_free(p_input);\r
@@ -440,6 +465,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
                 BOOLEAN_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
+            default:\r
+                ;\r
         }\r
         libvlc_input_free(p_input);\r
     }\r
@@ -464,7 +491,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
 \r
         switch( index )\r
         {\r
-            case ID_position:\r
+            case ID_input_position:\r
             {\r
                 if( ! NPVARIANT_IS_DOUBLE(value) )\r
                 {\r
@@ -483,7 +510,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
                 }\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_time:\r
+            case ID_input_time:\r
             {\r
                 vlc_int64_t val;\r
                 if( NPVARIANT_IS_INT32(value) )\r
@@ -506,7 +533,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
                 }\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_rate:\r
+            case ID_input_rate:\r
             {\r
                 float val;\r
                 if( NPVARIANT_IS_INT32(value) )\r
@@ -529,6 +556,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
                 }\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
+            default:\r
+                ;\r
         }\r
         libvlc_input_free(p_input);\r
     }\r
@@ -559,93 +588,99 @@ const int LibvlcMessageNPObject::propertyCount = sizeof(LibvlcMessageNPObject::p
 \r
 enum LibvlcMessageNPObjectPropertyIds\r
 {\r
-    ID_severity,\r
-    ID_type,\r
-    ID_name,\r
-    ID_header,\r
-    ID_message,\r
+    ID_message_severity,\r
+    ID_message_type,\r
+    ID_message_name,\r
+    ID_message_header,\r
+    ID_message_message,\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcMessageNPObject::getProperty(int index, NPVariant &result)\r
 {\r
-    switch( index )\r
+    VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);\r
+    if( p_plugin )\r
     {\r
-        case ID_severity:\r
-        {\r
-            INT32_TO_NPVARIANT(_msg.i_severity, result);\r
-            return INVOKERESULT_NO_ERROR;\r
-        }\r
-        case ID_type:\r
+        switch( index )\r
         {\r
-            if( _msg.psz_type )\r
-            {\r
-                int len = strlen(_msg.psz_type);\r
-                NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);\r
-                if( retval )\r
-                {\r
-                    memcpy(retval, _msg.psz_type, len);\r
-                    STRINGN_TO_NPVARIANT(retval, len, result);\r
-                }\r
-            }\r
-            else\r
+            case ID_message_severity:\r
             {\r
-                NULL_TO_NPVARIANT(result);\r
+                INT32_TO_NPVARIANT(_msg.i_severity, result);\r
+                return INVOKERESULT_NO_ERROR;\r
             }\r
-            return INVOKERESULT_NO_ERROR;\r
-        }\r
-        case ID_name:\r
-        {\r
-            if( _msg.psz_name )\r
+            case ID_message_type:\r
             {\r
-                int len = strlen(_msg.psz_name);\r
-                NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);\r
-                if( retval )\r
+                if( _msg.psz_type )\r
                 {\r
-                    memcpy(retval, _msg.psz_name, len);\r
-                    STRINGN_TO_NPVARIANT(retval, len, result);\r
+                    int len = strlen(_msg.psz_type);\r
+                    NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);\r
+                    if( retval )\r
+                    {\r
+                        memcpy(retval, _msg.psz_type, len);\r
+                        STRINGN_TO_NPVARIANT(retval, len, result);\r
+                    }\r
                 }\r
-            }\r
-            else\r
-            {\r
-                NULL_TO_NPVARIANT(result);\r
-            }\r
-            return INVOKERESULT_NO_ERROR;\r
-        }\r
-        case ID_header:\r
-        {\r
-            if( _msg.psz_header )\r
-            {\r
-                int len = strlen(_msg.psz_header);\r
-                NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);\r
-                if( retval )\r
+                else\r
                 {\r
-                    memcpy(retval, _msg.psz_header, len);\r
-                    STRINGN_TO_NPVARIANT(retval, len, result);\r
+                    NULL_TO_NPVARIANT(result);\r
                 }\r
+                return INVOKERESULT_NO_ERROR;\r
             }\r
-            else\r
+            case ID_message_name:\r
             {\r
-                NULL_TO_NPVARIANT(result);\r
+                if( _msg.psz_name )\r
+                {\r
+                    int len = strlen(_msg.psz_name);\r
+                    NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);\r
+                    if( retval )\r
+                    {\r
+                        memcpy(retval, _msg.psz_name, len);\r
+                        STRINGN_TO_NPVARIANT(retval, len, result);\r
+                    }\r
+                }\r
+                else\r
+                {\r
+                    NULL_TO_NPVARIANT(result);\r
+                }\r
+                return INVOKERESULT_NO_ERROR;\r
             }\r
-            return INVOKERESULT_NO_ERROR;\r
-        }\r
-        case ID_message:\r
-        {\r
-            if( _msg.psz_message )\r
+            case ID_message_header:\r
             {\r
-                int len = strlen(_msg.psz_message);\r
-                NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);\r
-                if( retval )\r
+                if( _msg.psz_header )\r
                 {\r
-                    memcpy(retval, _msg.psz_message, len);\r
-                    STRINGN_TO_NPVARIANT(retval, len, result);\r
+                    int len = strlen(_msg.psz_header);\r
+                    NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);\r
+                    if( retval )\r
+                    {\r
+                        memcpy(retval, _msg.psz_header, len);\r
+                        STRINGN_TO_NPVARIANT(retval, len, result);\r
+                    }\r
+                }\r
+                else\r
+                {\r
+                    NULL_TO_NPVARIANT(result);\r
                 }\r
+                return INVOKERESULT_NO_ERROR;\r
             }\r
-            else\r
+            case ID_message_message:\r
             {\r
-                NULL_TO_NPVARIANT(result);\r
+                if( _msg.psz_message )\r
+                {\r
+                    int len = strlen(_msg.psz_message);\r
+                    NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);\r
+                    if( retval )\r
+                    {\r
+                        memcpy(retval, _msg.psz_message, len);\r
+                        STRINGN_TO_NPVARIANT(retval, len, result);\r
+                    }\r
+                }\r
+                else\r
+                {\r
+                    NULL_TO_NPVARIANT(result);\r
+                }\r
+                return INVOKERESULT_NO_ERROR;\r
             }\r
-            return INVOKERESULT_NO_ERROR;\r
+            default:\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -662,17 +697,27 @@ const int LibvlcMessageNPObject::methodCount = sizeof(LibvlcMessageNPObject::met
 ** implementation of libvlc message iterator object\r
 */\r
 \r
-void LibvlcMessageIteratorNPObject::setLog(LibvlcLogNPObject* p_vlclog)\r
+LibvlcMessageIteratorNPObject::LibvlcMessageIteratorNPObject(NPP instance, const NPClass *aClass) :\r
+    RuntimeNPObject(instance, aClass),\r
+    _p_iter(NULL)\r
 {\r
-    _p_vlclog = p_vlclog;\r
-    if( p_vlclog->_p_log )\r
+    VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);\r
+    if( p_plugin )\r
     {\r
-        _p_iter = libvlc_log_get_iterator(p_vlclog->_p_log, NULL);\r
+        libvlc_log_t *p_log = p_plugin->getLog();\r
+        if( p_log )\r
+        {\r
+            _p_iter = libvlc_log_get_iterator(p_log, NULL);\r
+        }\r
     }\r
-    else\r
-        _p_iter = NULL;\r
 };\r
 \r
+LibvlcMessageIteratorNPObject::~LibvlcMessageIteratorNPObject()\r
+{\r
+    if( _p_iter )\r
+        libvlc_log_iterator_free(_p_iter, NULL);\r
+}\r
+\r
 const NPUTF8 * const LibvlcMessageIteratorNPObject::propertyNames[] = \r
 {\r
     "hasNext",\r
@@ -682,33 +727,39 @@ const int LibvlcMessageIteratorNPObject::propertyCount = sizeof(LibvlcMessageIte
 \r
 enum LibvlcMessageIteratorNPObjectPropertyIds\r
 {\r
-    ID_hasNext,\r
+    ID_messageiterator_hasNext,\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcMessageIteratorNPObject::getProperty(int index, NPVariant &result)\r
 {\r
-    switch( index )\r
+    VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);\r
+    if( p_plugin )\r
     {\r
-        case ID_hasNext:\r
+        switch( index )\r
         {\r
-            if( _p_iter &&  _p_vlclog->_p_log )\r
+            case ID_messageiterator_hasNext:\r
             {\r
-                libvlc_exception_t ex;\r
-                libvlc_exception_init(&ex);\r
+                if( _p_iter && p_plugin->getLog() )\r
+                {\r
+                    libvlc_exception_t ex;\r
+                    libvlc_exception_init(&ex);\r
 \r
-                BOOLEAN_TO_NPVARIANT(libvlc_log_iterator_has_next(_p_iter, &ex), result);\r
-                if( libvlc_exception_raised(&ex) )\r
+                    BOOLEAN_TO_NPVARIANT(libvlc_log_iterator_has_next(_p_iter, &ex), result);\r
+                    if( libvlc_exception_raised(&ex) )\r
+                    {\r
+                        NPN_SetException(this, libvlc_exception_get_message(&ex));\r
+                        libvlc_exception_clear(&ex);\r
+                        return INVOKERESULT_GENERIC_ERROR;\r
+                    }\r
+                }\r
+                else\r
                 {\r
-                    NPN_SetException(this, libvlc_exception_get_message(&ex));\r
-                    libvlc_exception_clear(&ex);\r
-                    return INVOKERESULT_GENERIC_ERROR;\r
+                    BOOLEAN_TO_NPVARIANT(0, result);\r
                 }\r
+                return INVOKERESULT_NO_ERROR;\r
             }\r
-            else\r
-            {\r
-                BOOLEAN_TO_NPVARIANT(0, result);\r
-            }\r
-            return INVOKERESULT_NO_ERROR;\r
+            default:\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -728,7 +779,8 @@ enum LibvlcMessageIteratorNPObjectMethodIds
 \r
 RuntimeNPObject::InvokeResult LibvlcMessageIteratorNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)\r
 {\r
-    if( _p_iter &&  _p_vlclog->_p_log )\r
+    VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);\r
+    if( p_plugin )\r
     {\r
         libvlc_exception_t ex;\r
         libvlc_exception_init(&ex);\r
@@ -738,32 +790,37 @@ RuntimeNPObject::InvokeResult LibvlcMessageIteratorNPObject::invoke(int index, c
             case ID_messageiterator_next:\r
                 if( argCount == 0 )\r
                 {\r
-                    struct libvlc_log_message_t buffer;\r
+                    if( _p_iter && p_plugin->getLog() )\r
+                    {\r
+                        struct libvlc_log_message_t buffer;\r
 \r
-                    buffer.sizeof_msg = sizeof(buffer);\r
+                        buffer.sizeof_msg = sizeof(buffer);\r
 \r
-                    libvlc_log_iterator_next(_p_iter, &buffer, &ex);\r
-                    if( libvlc_exception_raised(&ex) )\r
-                    {\r
-                        NPN_SetException(this, libvlc_exception_get_message(&ex));\r
-                        libvlc_exception_clear(&ex);\r
-                        return INVOKERESULT_GENERIC_ERROR;\r
-                    }\r
-                    else\r
-                    {\r
-                        LibvlcMessageNPObject* message =\r
-                            static_cast<LibvlcMessageNPObject*>(NPN_CreateObject(_instance, RuntimeNPClass<LibvlcMessageNPObject>::getClass()));\r
-                        if( message )\r
+                        libvlc_log_iterator_next(_p_iter, &buffer, &ex);\r
+                        if( libvlc_exception_raised(&ex) )\r
                         {\r
-                            message->setMessage(buffer);\r
-                            OBJECT_TO_NPVARIANT(message, result);\r
-                            return INVOKERESULT_NO_ERROR;\r
+                            NPN_SetException(this, libvlc_exception_get_message(&ex));\r
+                            libvlc_exception_clear(&ex);\r
+                            return INVOKERESULT_GENERIC_ERROR;\r
+                        }\r
+                        else\r
+                        {\r
+                            LibvlcMessageNPObject* message =\r
+                                static_cast<LibvlcMessageNPObject*>(NPN_CreateObject(_instance, RuntimeNPClass<LibvlcMessageNPObject>::getClass()));\r
+                            if( message )\r
+                            {\r
+                                message->setMessage(buffer);\r
+                                OBJECT_TO_NPVARIANT(message, result);\r
+                                return INVOKERESULT_NO_ERROR;\r
+                            }\r
+                            return INVOKERESULT_OUT_OF_MEMORY;\r
                         }\r
-                        return INVOKERESULT_OUT_OF_MEMORY;\r
                     }\r
+                    return INVOKERESULT_GENERIC_ERROR;\r
                 }\r
-            default:\r
                 return INVOKERESULT_NO_SUCH_METHOD;\r
+            default:\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -782,34 +839,40 @@ const int LibvlcMessagesNPObject::propertyCount = sizeof(LibvlcMessagesNPObject:
 \r
 enum LibvlcMessagesNPObjectPropertyIds\r
 {\r
-    ID_count,\r
+    ID_messages_count,\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcMessagesNPObject::getProperty(int index, NPVariant &result)\r
 {\r
-    switch( index )\r
+    VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);\r
+    if( p_plugin )\r
     {\r
-        case ID_count:\r
+        switch( index )\r
         {\r
-            libvlc_log_t *p_log = _p_vlclog->_p_log;\r
-            if( p_log )\r
+            case ID_messages_count:\r
             {\r
-                libvlc_exception_t ex;\r
-                libvlc_exception_init(&ex);\r
+                libvlc_log_t *p_log = p_plugin->getLog();\r
+                if( p_log )\r
+                {\r
+                    libvlc_exception_t ex;\r
+                    libvlc_exception_init(&ex);\r
 \r
-                INT32_TO_NPVARIANT(libvlc_log_count(p_log, &ex), result);\r
-                if( libvlc_exception_raised(&ex) )\r
+                    INT32_TO_NPVARIANT(libvlc_log_count(p_log, &ex), result);\r
+                    if( libvlc_exception_raised(&ex) )\r
+                    {\r
+                        NPN_SetException(this, libvlc_exception_get_message(&ex));\r
+                        libvlc_exception_clear(&ex);\r
+                        return INVOKERESULT_GENERIC_ERROR;\r
+                    }\r
+                }\r
+                else\r
                 {\r
-                    NPN_SetException(this, libvlc_exception_get_message(&ex));\r
-                    libvlc_exception_clear(&ex);\r
-                    return INVOKERESULT_GENERIC_ERROR;\r
+                    INT32_TO_NPVARIANT(0, result);\r
                 }\r
+                return INVOKERESULT_NO_ERROR;\r
             }\r
-            else\r
-            {\r
-                INT32_TO_NPVARIANT(0, result);\r
-            }\r
-            return INVOKERESULT_NO_ERROR;\r
+            default:\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -826,59 +889,75 @@ const int LibvlcMessagesNPObject::methodCount = sizeof(LibvlcMessagesNPObject::m
 enum LibvlcMessagesNPObjectMethodIds\r
 {\r
     ID_messages_clear,\r
-    ID_iterator,\r
+    ID_messages_iterator,\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcMessagesNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)\r
 {\r
-    libvlc_exception_t ex;\r
-    libvlc_exception_init(&ex);\r
-\r
-    switch( index )\r
+    VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);\r
+    if( p_plugin )\r
     {\r
-        case ID_messages_clear:\r
-            if( argCount == 0 )\r
-            {\r
-                libvlc_log_t *p_log = _p_vlclog->_p_log;\r
-                if( p_log )\r
+        libvlc_exception_t ex;\r
+        libvlc_exception_init(&ex);\r
+\r
+        switch( index )\r
+        {\r
+            case ID_messages_clear:\r
+                if( argCount == 0 )\r
                 {\r
-                    libvlc_log_clear(p_log, &ex);\r
-                    if( libvlc_exception_raised(&ex) )\r
+                    libvlc_log_t *p_log = p_plugin->getLog();\r
+                    if( p_log )\r
                     {\r
-                        NPN_SetException(this, libvlc_exception_get_message(&ex));\r
-                        libvlc_exception_clear(&ex);\r
-                        return INVOKERESULT_GENERIC_ERROR;\r
+                        libvlc_log_clear(p_log, &ex);\r
+                        if( libvlc_exception_raised(&ex) )\r
+                        {\r
+                            NPN_SetException(this, libvlc_exception_get_message(&ex));\r
+                            libvlc_exception_clear(&ex);\r
+                            return INVOKERESULT_GENERIC_ERROR;\r
+                        }\r
                     }\r
+                    return INVOKERESULT_NO_ERROR;\r
                 }\r
-                return INVOKERESULT_NO_ERROR;\r
-            }\r
-            return INVOKERESULT_NO_SUCH_METHOD;\r
+                return INVOKERESULT_NO_SUCH_METHOD;\r
 \r
-        case ID_iterator:\r
-            if( argCount == 0 )\r
-            {\r
-                LibvlcMessageIteratorNPObject* iter =\r
-                    static_cast<LibvlcMessageIteratorNPObject*>(NPN_CreateObject(_instance, RuntimeNPClass<LibvlcMessageIteratorNPObject>::getClass()));\r
-                if( iter )\r
+            case ID_messages_iterator:\r
+                if( argCount == 0 )\r
                 {\r
-                    iter->setLog(_p_vlclog);\r
-                    OBJECT_TO_NPVARIANT(iter, result);\r
-                    return INVOKERESULT_NO_ERROR;\r
+                    LibvlcMessageIteratorNPObject* iter =\r
+                        static_cast<LibvlcMessageIteratorNPObject*>(NPN_CreateObject(_instance, RuntimeNPClass<LibvlcMessageIteratorNPObject>::getClass()));\r
+                    if( iter )\r
+                    {\r
+                        OBJECT_TO_NPVARIANT(iter, result);\r
+                        return INVOKERESULT_NO_ERROR;\r
+                    }\r
+                    return INVOKERESULT_OUT_OF_MEMORY;\r
                 }\r
-                return INVOKERESULT_OUT_OF_MEMORY;\r
-            }\r
-            return INVOKERESULT_NO_SUCH_METHOD;\r
+                return INVOKERESULT_NO_SUCH_METHOD;\r
 \r
-        default:\r
-            return INVOKERESULT_NO_SUCH_METHOD;\r
+            default:\r
+                ;\r
+        }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
 }\r
+\r
  \r
 /*\r
 ** implementation of libvlc message object\r
 */\r
 \r
+\r
+LibvlcLogNPObject::LibvlcLogNPObject(NPP instance, const NPClass *aClass) :\r
+    RuntimeNPObject(instance, aClass)\r
+{\r
+    _p_vlcmessages = static_cast<LibvlcMessagesNPObject*>(NPN_CreateObject(instance, RuntimeNPClass<LibvlcMessagesNPObject>::getClass()));\r
+};\r
+    \r
+LibvlcLogNPObject::~LibvlcLogNPObject()\r
+{\r
+    NPN_ReleaseObject(_p_vlcmessages);\r
+};\r
+\r
 const NPUTF8 * const LibvlcLogNPObject::propertyNames[] = \r
 {\r
     "messages",\r
@@ -889,8 +968,8 @@ const int LibvlcLogNPObject::propertyCount = sizeof(LibvlcLogNPObject::propertyN
 \r
 enum LibvlcLogNPObjectPropertyIds\r
 {\r
-    ID_messages,\r
-    ID_verbosity,\r
+    ID_log_messages,\r
+    ID_log_verbosity,\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcLogNPObject::getProperty(int index, NPVariant &result)\r
@@ -903,14 +982,14 @@ RuntimeNPObject::InvokeResult LibvlcLogNPObject::getProperty(int index, NPVarian
 \r
         switch( index )\r
         {\r
-            case ID_messages:\r
+            case ID_log_messages:\r
             {\r
                 OBJECT_TO_NPVARIANT(NPN_RetainObject(_p_vlcmessages), result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_verbosity:\r
+            case ID_log_verbosity:\r
             {\r
-                if( _p_log )\r
+                if( p_plugin->getLog() )\r
                 {\r
                     INT32_TO_NPVARIANT(libvlc_get_log_verbosity(p_plugin->getVLC(),\r
                                                                     &ex), result);\r
@@ -928,6 +1007,8 @@ RuntimeNPObject::InvokeResult LibvlcLogNPObject::getProperty(int index, NPVarian
                 }\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
+            default:\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -943,22 +1024,24 @@ RuntimeNPObject::InvokeResult LibvlcLogNPObject::setProperty(int index, const NP
 \r
         switch( index )\r
         {\r
-            case ID_verbosity:\r
+            case ID_log_verbosity:\r
                 if( isNumberValue(value) )\r
                 {\r
                     libvlc_instance_t* p_libvlc = p_plugin->getVLC();\r
+                    libvlc_log_t *p_log = p_plugin->getLog();\r
                     int verbosity = numberValue(value);\r
                     if( verbosity >= 0 )\r
                     {\r
-                        if( ! _p_log )\r
+                        if( ! p_log )\r
                         {\r
-                            _p_log = libvlc_log_open(p_libvlc, &ex);\r
+                            p_log = libvlc_log_open(p_libvlc, &ex);\r
                             if( libvlc_exception_raised(&ex) )\r
                             {\r
                                 NPN_SetException(this, libvlc_exception_get_message(&ex));\r
                                 libvlc_exception_clear(&ex);\r
                                 return INVOKERESULT_GENERIC_ERROR;\r
                             }\r
+                            p_plugin->setLog(p_log);\r
                         }\r
                         libvlc_set_log_verbosity(p_libvlc, (unsigned)verbosity, &ex);\r
                         if( libvlc_exception_raised(&ex) )\r
@@ -968,11 +1051,11 @@ RuntimeNPObject::InvokeResult LibvlcLogNPObject::setProperty(int index, const NP
                             return INVOKERESULT_GENERIC_ERROR;\r
                         }\r
                     }\r
-                    else if( _p_log )\r
+                    else if( p_log )\r
                     {\r
                         /* close log  when verbosity is set to -1 */\r
-                        libvlc_log_close(_p_log, &ex);\r
-                        _p_log = NULL;\r
+                        p_plugin->setLog(NULL);\r
+                        libvlc_log_close(p_log, &ex);\r
                         if( libvlc_exception_raised(&ex) )\r
                         {\r
                             NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -983,6 +1066,8 @@ RuntimeNPObject::InvokeResult LibvlcLogNPObject::setProperty(int index, const NP
                     return INVOKERESULT_NO_ERROR;\r
                 }\r
                 return INVOKERESULT_INVALID_VALUE;\r
+            default:\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -995,23 +1080,146 @@ const NPUTF8 * const LibvlcLogNPObject::methodNames[] =
 \r
 const int LibvlcLogNPObject::methodCount = sizeof(LibvlcLogNPObject::methodNames)/sizeof(NPUTF8 *);\r
 \r
+/*\r
+** implementation of libvlc playlist items object\r
+*/\r
+\r
+const NPUTF8 * const LibvlcPlaylistItemsNPObject::propertyNames[] = \r
+{\r
+    "count",\r
+};\r
+\r
+const int LibvlcPlaylistItemsNPObject::propertyCount = sizeof(LibvlcPlaylistItemsNPObject::propertyNames)/sizeof(NPUTF8 *);\r
+\r
+enum LibvlcPlaylistItemsNPObjectPropertyIds\r
+{\r
+    ID_playlistitems_count,\r
+};\r
+\r
+RuntimeNPObject::InvokeResult LibvlcPlaylistItemsNPObject::getProperty(int index, NPVariant &result)\r
+{\r
+    VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);\r
+    if( p_plugin )\r
+    {\r
+        libvlc_exception_t ex;\r
+        libvlc_exception_init(&ex);\r
+\r
+        switch( index )\r
+        {\r
+            case ID_playlistitems_count:\r
+            {\r
+                int val = libvlc_playlist_items_count(p_plugin->getVLC(), &ex);\r
+                if( libvlc_exception_raised(&ex) )\r
+                {\r
+                    NPN_SetException(this, libvlc_exception_get_message(&ex));\r
+                    libvlc_exception_clear(&ex);\r
+                    return INVOKERESULT_GENERIC_ERROR;\r
+                }\r
+                INT32_TO_NPVARIANT(val, result);\r
+                return INVOKERESULT_NO_ERROR;\r
+            }\r
+            default:\r
+                ;\r
+        }\r
+    }\r
+    return INVOKERESULT_GENERIC_ERROR;\r
+}\r
+\r
+const NPUTF8 * const LibvlcPlaylistItemsNPObject::methodNames[] =\r
+{\r
+    "clear",\r
+    "remove",\r
+};\r
+\r
+const int LibvlcPlaylistItemsNPObject::methodCount = sizeof(LibvlcPlaylistItemsNPObject::methodNames)/sizeof(NPUTF8 *);\r
+\r
+enum LibvlcPlaylistItemsNPObjectMethodIds\r
+{\r
+    ID_playlistitems_clear,\r
+    ID_playlistitems_remove,\r
+};\r
+\r
+RuntimeNPObject::InvokeResult LibvlcPlaylistItemsNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)\r
+{\r
+    VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);\r
+    if( p_plugin )\r
+    {\r
+        libvlc_exception_t ex;\r
+        libvlc_exception_init(&ex);\r
+\r
+        switch( index )\r
+        {\r
+            case ID_playlistitems_clear:\r
+                if( argCount == 0 )\r
+                {\r
+                    libvlc_playlist_clear(p_plugin->getVLC(), &ex);\r
+                    if( libvlc_exception_raised(&ex) )\r
+                    {\r
+                        NPN_SetException(this, libvlc_exception_get_message(&ex));\r
+                        libvlc_exception_clear(&ex);\r
+                        return INVOKERESULT_GENERIC_ERROR;\r
+                    }\r
+                    else\r
+                    {\r
+                        VOID_TO_NPVARIANT(result);\r
+                        return INVOKERESULT_NO_ERROR;\r
+                    }\r
+                }\r
+                return INVOKERESULT_NO_SUCH_METHOD;\r
+            case ID_playlistitems_remove:\r
+                if( (argCount == 1) && isNumberValue(args[0]) )\r
+                {\r
+                    libvlc_playlist_delete_item(p_plugin->getVLC(), numberValue(args[0]), &ex);\r
+                    if( libvlc_exception_raised(&ex) )\r
+                    {\r
+                        NPN_SetException(this, libvlc_exception_get_message(&ex));\r
+                        libvlc_exception_clear(&ex);\r
+                        return INVOKERESULT_GENERIC_ERROR;\r
+                    }\r
+                    else\r
+                    {\r
+                        VOID_TO_NPVARIANT(result);\r
+                        return INVOKERESULT_NO_ERROR;\r
+                    }\r
+                }\r
+                return INVOKERESULT_NO_SUCH_METHOD;\r
+            default:\r
+                ;\r
+        }\r
+    }\r
+    return INVOKERESULT_GENERIC_ERROR;\r
+}\r
+\r
 /*\r
 ** implementation of libvlc playlist object\r
 */\r
 \r
 \r
+LibvlcPlaylistNPObject::LibvlcPlaylistNPObject(NPP instance, const NPClass *aClass) :\r
+    RuntimeNPObject(instance, aClass)\r
+{\r
+    _p_vlcplaylistitems = static_cast<LibvlcPlaylistItemsNPObject*>(NPN_CreateObject(instance, RuntimeNPClass<LibvlcPlaylistItemsNPObject>::getClass()));\r
+};\r
+    \r
+LibvlcPlaylistNPObject::~LibvlcPlaylistNPObject()\r
+{\r
+    NPN_ReleaseObject(_p_vlcplaylistitems);\r
+};\r
+\r
 const NPUTF8 * const LibvlcPlaylistNPObject::propertyNames[] = \r
 {\r
-    "itemCount",\r
+    "itemCount", /* deprecated */\r
     "isPlaying",\r
+    "items",\r
 };\r
 \r
 const int LibvlcPlaylistNPObject::propertyCount = sizeof(LibvlcPlaylistNPObject::propertyNames)/sizeof(NPUTF8 *);\r
 \r
 enum LibvlcPlaylistNPObjectPropertyIds\r
 {\r
-    ID_itemcount,\r
-    ID_isplaying,\r
+    ID_playlist_itemcount,\r
+    ID_playlist_isplaying,\r
+    ID_playlist_items,\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPVariant &result)\r
@@ -1024,7 +1232,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
 \r
         switch( index )\r
         {\r
-            case ID_itemcount:\r
+            case ID_playlist_itemcount: /* deprecated */\r
             {\r
                 int val = libvlc_playlist_items_count(p_plugin->getVLC(), &ex);\r
                 if( libvlc_exception_raised(&ex) )\r
@@ -1036,7 +1244,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
                 INT32_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_isplaying:\r
+            case ID_playlist_isplaying:\r
             {\r
                 int val = libvlc_playlist_isplaying(p_plugin->getVLC(), &ex);\r
                 if( libvlc_exception_raised(&ex) )\r
@@ -1048,6 +1256,13 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
                 BOOLEAN_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
+            case ID_playlist_items:\r
+            {\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(_p_vlcplaylistitems), result);\r
+                return INVOKERESULT_NO_ERROR;\r
+            }\r
+            default:\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -1062,23 +1277,23 @@ const NPUTF8 * const LibvlcPlaylistNPObject::methodNames[] =
     "stop",\r
     "next",\r
     "prev",\r
-    "clear",\r
-    "removeItem"\r
+    "clear", /* deprecated */\r
+    "removeItem", /* deprecated */\r
 };\r
 \r
 const int LibvlcPlaylistNPObject::methodCount = sizeof(LibvlcPlaylistNPObject::methodNames)/sizeof(NPUTF8 *);\r
 \r
 enum LibvlcPlaylistNPObjectMethodIds\r
 {\r
-    ID_add,\r
-    ID_play,\r
-    ID_playItem,\r
-    ID_togglepause,\r
-    ID_stop,\r
-    ID_next,\r
-    ID_prev,\r
-    ID_clear,\r
-    ID_removeitem\r
+    ID_playlist_add,\r
+    ID_playlist_play,\r
+    ID_playlist_playItem,\r
+    ID_playlist_togglepause,\r
+    ID_playlist_stop,\r
+    ID_playlist_next,\r
+    ID_playlist_prev,\r
+    ID_playlist_clear,\r
+    ID_playlist_removeitem\r
 };\r
 \r
 RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)\r
@@ -1091,7 +1306,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
 \r
         switch( index )\r
         {\r
-            case ID_add:\r
+            case ID_playlist_add:\r
             {\r
                 if( (argCount < 1) || (argCount > 3) )\r
                     return INVOKERESULT_NO_SUCH_METHOD;\r
@@ -1105,10 +1320,11 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     if( s )\r
                     {\r
                         url = p_plugin->getAbsoluteURL(s);\r
-                        delete s;\r
-                        if( ! url )\r
-                            // what happened ?\r
-                            return INVOKERESULT_GENERIC_ERROR;\r
+                        if( url )\r
+                            delete s;\r
+                        else\r
+                            // problem with combining url, use argument\r
+                            url = s;\r
                     }\r
                     else\r
                         return INVOKERESULT_OUT_OF_MEMORY;\r
@@ -1181,7 +1397,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     return INVOKERESULT_NO_ERROR;\r
                 }\r
             }\r
-            case ID_play:\r
+            case ID_playlist_play:\r
                 if( argCount == 0 )\r
                 {\r
                     libvlc_playlist_play(p_plugin->getVLC(), -1, 0, NULL, &ex);\r
@@ -1198,7 +1414,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     }\r
                 }\r
                 return INVOKERESULT_NO_SUCH_METHOD;\r
-            case ID_playItem:\r
+            case ID_playlist_playItem:\r
                 if( (argCount == 1) && isNumberValue(args[0]) )\r
                 {\r
                     libvlc_playlist_play(p_plugin->getVLC(), numberValue(args[0]), 0, NULL, &ex);\r
@@ -1215,7 +1431,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     }\r
                 }\r
                 return INVOKERESULT_NO_SUCH_METHOD;\r
-            case ID_togglepause:\r
+            case ID_playlist_togglepause:\r
                 if( argCount == 0 )\r
                 {\r
                     libvlc_playlist_pause(p_plugin->getVLC(), &ex);\r
@@ -1232,7 +1448,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     }\r
                 }\r
                 return INVOKERESULT_NO_SUCH_METHOD;\r
-            case ID_stop:\r
+            case ID_playlist_stop:\r
                 if( argCount == 0 )\r
                 {\r
                     libvlc_playlist_stop(p_plugin->getVLC(), &ex);\r
@@ -1249,7 +1465,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     }\r
                 }\r
                 return INVOKERESULT_NO_SUCH_METHOD;\r
-            case ID_next:\r
+            case ID_playlist_next:\r
                 if( argCount == 0 )\r
                 {\r
                     libvlc_playlist_next(p_plugin->getVLC(), &ex);\r
@@ -1266,7 +1482,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     }\r
                 }\r
                 return INVOKERESULT_NO_SUCH_METHOD;\r
-            case ID_prev:\r
+            case ID_playlist_prev:\r
                 if( argCount == 0 )\r
                 {\r
                     libvlc_playlist_prev(p_plugin->getVLC(), &ex);\r
@@ -1283,7 +1499,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     }\r
                 }\r
                 return INVOKERESULT_NO_SUCH_METHOD;\r
-            case ID_clear:\r
+            case ID_playlist_clear: /* deprecated */\r
                 if( argCount == 0 )\r
                 {\r
                     libvlc_playlist_clear(p_plugin->getVLC(), &ex);\r
@@ -1300,7 +1516,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     }\r
                 }\r
                 return INVOKERESULT_NO_SUCH_METHOD;\r
-            case ID_removeitem:\r
+            case ID_playlist_removeitem: /* deprecated */\r
                 if( (argCount == 1) && isNumberValue(args[0]) )\r
                 {\r
                     libvlc_playlist_delete_item(p_plugin->getVLC(), numberValue(args[0]), &ex);\r
@@ -1318,7 +1534,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                 }\r
                 return INVOKERESULT_NO_SUCH_METHOD;\r
             default:\r
-                return INVOKERESULT_NO_SUCH_METHOD;\r
+                ;\r
         }\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
@@ -1465,10 +1681,10 @@ const NPUTF8 * const LibvlcVideoNPObject::propertyNames[] =
 \r
 enum LibvlcVideoNPObjectPropertyIds\r
 {\r
-    ID_fullscreen,\r
-    ID_height,\r
-    ID_width,\r
-    ID_aspectratio\r
+    ID_video_fullscreen,\r
+    ID_video_height,\r
+    ID_video_width,\r
+    ID_video_aspectratio\r
 };\r
 \r
 const int LibvlcVideoNPObject::propertyCount = sizeof(LibvlcVideoNPObject::propertyNames)/sizeof(NPUTF8 *);\r
@@ -1491,7 +1707,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
 \r
         switch( index )\r
         {\r
-            case ID_fullscreen:\r
+            case ID_video_fullscreen:\r
             {\r
                 int val = libvlc_get_fullscreen(p_input, &ex);\r
                 libvlc_input_free(p_input);\r
@@ -1504,7 +1720,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
                 BOOLEAN_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_height:\r
+            case ID_video_height:\r
             {\r
                 int val = libvlc_video_get_height(p_input, &ex);\r
                 libvlc_input_free(p_input);\r
@@ -1517,7 +1733,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
                 INT32_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_width:\r
+            case ID_video_width:\r
             {\r
                 int val = libvlc_video_get_width(p_input, &ex);\r
                 libvlc_input_free(p_input);\r
@@ -1530,7 +1746,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
                 INT32_TO_NPVARIANT(val, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_aspectratio:\r
+            case ID_video_aspectratio:\r
             {\r
                 NPUTF8 *psz_aspect = libvlc_video_get_aspect_ratio(p_input, &ex);\r
                 libvlc_input_free(p_input);\r
@@ -1570,7 +1786,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
 \r
         switch( index )\r
         {\r
-            case ID_fullscreen:\r
+            case ID_video_fullscreen:\r
             {\r
                 if( ! NPVARIANT_IS_BOOLEAN(value) )\r
                 {\r
@@ -1589,7 +1805,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
                 }\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
-            case ID_aspectratio:\r
+            case ID_video_aspectratio:\r
             {\r
                 char *psz_aspect = NULL;\r
 \r
@@ -1629,7 +1845,7 @@ const NPUTF8 * const LibvlcVideoNPObject::methodNames[] =
 \r
 enum LibvlcVideoNPObjectMethodIds\r
 {\r
-    ID_togglefullscreen,\r
+    ID_video_togglefullscreen,\r
 };\r
 \r
 const int LibvlcVideoNPObject::methodCount = sizeof(LibvlcVideoNPObject::methodNames)/sizeof(NPUTF8 *);\r
@@ -1652,7 +1868,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::invoke(int index, const NPVar
 \r
         switch( index )\r
         {\r
-            case ID_togglefullscreen:\r
+            case ID_video_togglefullscreen:\r
                 if( argCount == 0 )\r
                 {\r
                     libvlc_toggle_fullscreen(p_input, &ex);\r
index 80c767353a975de795de1f40132b43a5a6c9641a..d9f635fb01fcd3ac90e0ab721c93a49038cd63f7 100755 (executable)
@@ -125,16 +125,11 @@ class LibvlcLogNPObject;
 \r
 class LibvlcMessageIteratorNPObject: public RuntimeNPObject\r
 {\r
-public:\r
-    void setLog(LibvlcLogNPObject* p_vlclog);\r
-\r
 protected:\r
     friend class RuntimeNPClass<LibvlcMessageIteratorNPObject>;\r
 \r
-    LibvlcMessageIteratorNPObject(NPP instance, const NPClass *aClass) :\r
-        RuntimeNPObject(instance, aClass) {};\r
-        \r
-    virtual ~LibvlcMessageIteratorNPObject() {};\r
+    LibvlcMessageIteratorNPObject(NPP instance, const NPClass *aClass);\r
+    virtual ~LibvlcMessageIteratorNPObject();\r
 \r
     static const int propertyCount;\r
     static const NPUTF8 * const propertyNames[];\r
@@ -147,23 +142,15 @@ protected:
     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
 \r
 private:\r
-    LibvlcLogNPObject*      _p_vlclog;\r
     libvlc_log_iterator_t*  _p_iter;\r
 };\r
 \r
 class LibvlcMessagesNPObject: public RuntimeNPObject\r
 {\r
-public:\r
-    void setLog(LibvlcLogNPObject *p_log)\r
-    {\r
-        _p_vlclog = p_log;\r
-    }\r
-    \r
 protected:\r
     friend class RuntimeNPClass<LibvlcMessagesNPObject>;\r
 \r
     LibvlcMessagesNPObject(NPP instance, const NPClass *aClass) :\r
-        _p_vlclog(NULL),\r
         RuntimeNPObject(instance, aClass) {};\r
         \r
     virtual ~LibvlcMessagesNPObject() {};\r
@@ -177,32 +164,15 @@ protected:
     static const NPUTF8 * const methodNames[];\r
 \r
     InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
-\r
-private:\r
-    LibvlcLogNPObject* _p_vlclog;\r
 };\r
 \r
 class LibvlcLogNPObject: public RuntimeNPObject\r
 {\r
 protected:\r
     friend class RuntimeNPClass<LibvlcLogNPObject>;\r
-    friend class LibvlcMessagesNPObject;\r
-    friend class LibvlcMessageIteratorNPObject;\r
 \r
-    libvlc_log_t    *_p_log;\r
-\r
-    LibvlcLogNPObject(NPP instance, const NPClass *aClass) :\r
-        RuntimeNPObject(instance, aClass),\r
-        _p_log(NULL)\r
-    {\r
-        _p_vlcmessages = static_cast<LibvlcMessagesNPObject*>(NPN_CreateObject(instance, RuntimeNPClass<LibvlcMessagesNPObject>::getClass()));\r
-        _p_vlcmessages->setLog(this);\r
-    };\r
-        \r
-    virtual ~LibvlcLogNPObject()\r
-    {\r
-        NPN_ReleaseObject(_p_vlcmessages);\r
-    };\r
+    LibvlcLogNPObject(NPP instance, const NPClass *aClass);\r
+    virtual ~LibvlcLogNPObject();\r
 \r
     static const int propertyCount;\r
     static const NPUTF8 * const propertyNames[];\r
@@ -217,14 +187,33 @@ private:
     LibvlcMessagesNPObject* _p_vlcmessages;\r
 };\r
 \r
+class LibvlcPlaylistItemsNPObject: public RuntimeNPObject\r
+{\r
+protected:\r
+    friend class RuntimeNPClass<LibvlcPlaylistItemsNPObject>;\r
+\r
+    LibvlcPlaylistItemsNPObject(NPP instance, const NPClass *aClass) :\r
+        RuntimeNPObject(instance, aClass) {};\r
+    virtual ~LibvlcPlaylistItemsNPObject() {};\r
+\r
+    static const int propertyCount;\r
+    static const NPUTF8 * const propertyNames[];\r
+\r
+    InvokeResult getProperty(int index, NPVariant &result);\r
+\r
+    static const int methodCount;\r
+    static const NPUTF8 * const methodNames[];\r
+\r
+    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);\r
+};\r
+\r
 class LibvlcPlaylistNPObject: public RuntimeNPObject\r
 {\r
 protected:\r
     friend class RuntimeNPClass<LibvlcPlaylistNPObject>;\r
 \r
-    LibvlcPlaylistNPObject(NPP instance, const NPClass *aClass) :\r
-        RuntimeNPObject(instance, aClass) {};\r
-    virtual ~LibvlcPlaylistNPObject() {};\r
+    LibvlcPlaylistNPObject(NPP instance, const NPClass *aClass);\r
+    virtual ~LibvlcPlaylistNPObject();\r
 \r
     static const int propertyCount;\r
     static const NPUTF8 * const propertyNames[];\r
@@ -238,6 +227,9 @@ protected:
 \r
     void parseOptions(const NPString &s, int *i_options, char*** ppsz_options);\r
     void parseOptions(NPObject *obj, int *i_options, char*** ppsz_options);\r
+\r
+private:\r
+    LibvlcPlaylistItemsNPObject* _p_vlcplaylistitems;\r
 };\r
 \r
 class LibvlcVideoNPObject: public RuntimeNPObject\r
index 20195987b0b66dbb75c350e6c55a1dfbc55ec6ca..859ce3ef9c6c4531eb0412a52101e904ab663aa2 100755 (executable)
@@ -110,4 +110,3 @@ bool RuntimeNPObject::returnInvokeResult(RuntimeNPObject::InvokeResult result)
     }
     return false;
 }
-
index 1f3f7d9be68b0949eef276aca3ac90f80779a0b5..16626913c402906647b4922a40e7119c81880fd0 100644 (file)
@@ -31,17 +31,17 @@ BEGIN
     BEGIN
         BLOCK "040904e4"
         BEGIN
-            VALUE "ProductName", "VLC multimedia plugin\0"
+            VALUE "ProductName", "VLC Multimedia Plugin\0"
             VALUE "ProductVersion", STRINGIFY( VERSION )
             VALUE "OriginalFilename", "npvlc.dll\0"
             VALUE "FileVersion", STRINGIFY( VERSION )
-            VALUE "FileDescription", "VLC multimedia plugin Version "STRINGIFY( VERSION )"<br><br>VideoLAN WWW: <a href=""http://www.videolan.org/"">http://www.videolan.org/</a>\0"
+            VALUE "FileDescription", "Version " STRINGIFY( VERSION ) ", copyright 1996-2006 The VideoLAN Team<br><a href=""http://www.videolan.org/"">http://www.videolan.org/</a>\0"
             VALUE "InternalName", "npvlc\0"
             VALUE "CompanyName", "VideoLAN Team\0"
-            VALUE "LegalCopyright", "Copyright VideoLAN \251 1996-2006\0"
-            VALUE "MIMEType", "audio/mpeg|audio/x-mpeg|video/mpeg|video/x-mpeg|video/mpeg-system|video/x-mpeg-system|video/mpeg4|audio/mpeg4|application/mpeg4-iod|application/mpeg4-muxcodetable|video/x-msvideo|video/quicktime|application/x-ogg|application/ogg|application/x-vlc-plugin|video/x-ms-asf-plugin|video/x-ms-asf|application/x-mplayer2|video/x-ms-wmv|application/x-google-vlc-plugin|audio/wav|audio/x-wav\0"
-            VALUE "FileExtents", "mp2,mp3,mpga,mpega|mp2,mp3,mpga,mpega|mpg,mpeg,mpe|mpg,mpeg,mpe|mpg,mpeg,vob|mpg,mpeg,vob|mp4,mpg4|mp4,mpg4|mp4,mpg4|mp4,mpg4|avi|mov,qt|ogg|ogg|vlc||||wmv||wav|wav\0"
-            VALUE "FileOpenName", "MPEG audio|MPEG audio|MPEG video|MPEG video|MPEG video|MPEG video|MPEG-4 video|MPEG-4 audio|MPEG-4 video|MPEG-4 video|AVI video|QuickTime video|Ogg stream|Ogg stream|VLC plugin|||||Google VLC plugin|WAV audio|WAV audio\0"
+            VALUE "LegalCopyright", "Copyright \251 1996-2006 The VideoLAN Team\0"
+            VALUE "MIMEType", "audio/mpeg|audio/x-mpeg|video/mpeg|video/x-mpeg|video/mpeg-system|video/x-mpeg-system|video/mpeg4|audio/mpeg4|application/mpeg4-iod|application/mpeg4-muxcodetable|video/x-msvideo|video/quicktime|application/x-ogg|application/ogg|application/x-vlc-plugin|video/x-ms-asf-plugin|video/x-ms-asf|application/x-mplayer2|video/x-ms-wmv|application/x-google-vlc-plugin|audio/wav|audio/x-wav|audio/3gpp|video/3gpp|audio/3gpp2|video/3gpp2\0"
+            VALUE "FileExtents", "mp2,mp3,mpga,mpega|mp2,mp3,mpga,mpega|mpg,mpeg,mpe|mpg,mpeg,mpe|mpg,mpeg,vob|mpg,mpeg,vob|mp4,mpg4|mp4,mpg4|mp4,mpg4|mp4,mpg4|avi|mov,qt|ogg|ogg|vlc|asf,asx|asf,asx||wmv||wav|wav|3gp,3gpp|3gp,3gpp|3g2,3gpp2|3g2,3gpp2\0"
+            VALUE "FileOpenName", "MPEG audio|MPEG audio|MPEG video|MPEG video|MPEG video|MPEG video|MPEG-4 video|MPEG-4 audio|MPEG-4 video|MPEG-4 video|AVI video|QuickTime video|Ogg stream|Ogg stream|VLC plugin|Windows Media video|Windows Media video|Windows Media plugin|Windows Media video|Google VLC plugin|WAV audio|WAV audio|3GPP audio|3GPP video|3GPP2 audio|3GPP2 video\0"
         END
     END
     BLOCK "VarFileInfo"
index a62b48b314210bfbbfeb35351f414e630e63bc04..e02385a6bfc72997ff8dbafe5ed3e0d159225519 100644 (file)
@@ -97,7 +97,7 @@
 #if defined(XP_MACOSX) && defined(__POWERPC__) && (!defined(TARGET_RT_MAC_CFM))
 
 // glue for mapping outgoing Macho function pointers to TVectors
-struct TFPtoTVGlue{
+struct TFPtoTVGlue {
     void* glue[2];
 };
 
@@ -235,7 +235,7 @@ NPError NPN_GetURLNotify(NPP instance, const char* url, const char* window, void
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     NPError err;
-    
+
     if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
     {
         err = CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData);
@@ -256,7 +256,7 @@ NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uin
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     NPError err;
-    
+
     if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
     {
         err = CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify, instance, url, 
@@ -283,7 +283,7 @@ NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* window, NPStrea
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     NPError err;
-    
+
     if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
     {
         err = CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance, type, window, stream);
@@ -299,7 +299,7 @@ int32 NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     NPError err;
-    
+
     if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
     {
         err = CallNPN_WriteProc(gNetscapeFuncs.write, instance, stream, len, buffer);
@@ -315,7 +315,7 @@ NPError    NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     NPError err;
-    
+
     if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
     {
         err = CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream, instance, stream, reason);
@@ -398,7 +398,7 @@ NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_GetStringIdentifierProc( gNetscapeFuncs.getstringidentifier, name);
     }
     return NULL;
@@ -408,7 +408,7 @@ void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentif
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         CallNPN_GetStringIdentifiersProc( gNetscapeFuncs.getstringidentifiers, names, nameCount, identifiers);
     }
 }
@@ -417,7 +417,7 @@ NPIdentifier NPN_GetIntIdentifier(int32_t intid)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_GetIntIdentifierProc( gNetscapeFuncs.getintidentifier, intid);
     }
     return NULL;
@@ -427,7 +427,7 @@ bool NPN_IdentifierIsString(NPIdentifier identifier)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_IdentifierIsStringProc( gNetscapeFuncs.identifierisstring, identifier);
     }
     return false;
@@ -437,7 +437,7 @@ NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_UTF8FromIdentifierProc( gNetscapeFuncs.utf8fromidentifier, identifier);
     }
     return NULL;
@@ -447,7 +447,7 @@ int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_IntFromIdentifierProc( gNetscapeFuncs.intfromidentifier, identifier);
     }
     return 0;
@@ -457,7 +457,7 @@ NPObject *NPN_CreateObject(NPP instance, NPClass *aClass)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_CreateObjectProc( gNetscapeFuncs.createobject, instance, aClass);
     }
     return NULL;
@@ -467,7 +467,7 @@ NPObject *NPN_RetainObject(NPObject *npobj)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_RetainObjectProc( gNetscapeFuncs.retainobject, npobj);
     }
     return NULL;
@@ -477,7 +477,7 @@ void NPN_ReleaseObject(NPObject *npobj)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         CallNPN_ReleaseObjectProc( gNetscapeFuncs.releaseobject, npobj);
     }
 }
@@ -486,7 +486,7 @@ bool NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName, const NP
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_InvokeProc( gNetscapeFuncs.invoke, instance, npobj, methodName, args, argCount, result);
     }
     return false;
@@ -496,7 +496,7 @@ bool NPN_InvokeDefault(NPP instance, NPObject *npobj, const NPVariant *args, uin
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_InvokeDefaultProc( gNetscapeFuncs.invokeDefault, instance, npobj, args, argCount, result);
     }
     return false;
@@ -506,7 +506,7 @@ bool NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *re
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_EvaluateProc( gNetscapeFuncs.evaluate, instance, npobj, script, result);
     }
     return false;
@@ -516,7 +516,7 @@ bool NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, N
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_GetPropertyProc( gNetscapeFuncs.getproperty, instance, npobj, propertyName, result);
     }
     return false;
@@ -526,7 +526,7 @@ bool NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, c
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_SetPropertyProc( gNetscapeFuncs.setproperty, instance, npobj, propertyName, value);
     }
     return false;
@@ -536,7 +536,7 @@ bool NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_RemovePropertyProc( gNetscapeFuncs.removeproperty, instance, npobj, propertyName);
     }
     return false;
@@ -546,7 +546,7 @@ bool NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_HasPropertyProc( gNetscapeFuncs.hasproperty, instance, npobj, propertyName);
     }
     return false;
@@ -556,7 +556,7 @@ bool NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         return CallNPN_HasMethodProc( gNetscapeFuncs.hasmethod, instance, npobj, methodName);
     }
     return false;
@@ -566,7 +566,7 @@ void NPN_ReleaseVariantValue(NPVariant *variant)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         CallNPN_ReleaseVariantValueProc( gNetscapeFuncs.releasevariantvalue, variant);
     }
 }
@@ -575,7 +575,7 @@ void NPN_SetException(NPObject *npobj, const NPUTF8 *message)
 {
     int navMinorVers = gNetscapeFuncs.version & 0xFF;
     if( navMinorVers >= 14 )
-    {   
+    {
         CallNPN_SetExceptionProc( gNetscapeFuncs.setexception, npobj, message);
     }
 }
@@ -633,7 +633,6 @@ void Private_Shutdown(void)
     ExitCodeResource();
 }
 
-
 NPError    Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved)
 {
     EnterCodeResource();
@@ -721,7 +720,6 @@ void Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
     ExitCodeResource();
 }
 
-
 NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason)
 {
     NPError err;
@@ -786,14 +784,14 @@ void SetUpQD(void)
     OSErr               result = noErr;
     CFragConnectionID   connID;
     Str255              errName;
-#endif    
+#endif
 
     //
     // Memorize the plugin’s resource file 
     // refnum for later use.
     //
     gResFile = CurResFile();
-    
+
 #if !TARGET_API_MAC_CARBON
     //
     // Ask the system if CFM is available.
@@ -815,11 +813,11 @@ void SetUpQD(void)
         infoRec.processInfoLength = sizeof(ProcessInfoRec);
         infoRec.processName = name;
         infoRec.processAppSpec = &myFSSpec;
-        
+
         ProcessSerialNumber PSN;
         PSN.highLongOfPSN = 0;
         PSN.lowLongOfPSN = kCurrentProcess;
-        
+
         result = GetProcessInformation(&PSN, &infoRec);
         if (result != noErr)
             PLUGINDEBUGSTR("\pFailed in GetProcessInformation");
@@ -828,8 +826,8 @@ void SetUpQD(void)
         //
         // If no CFM installed, assume it must be a 68K app.
         //
-        result = -1;        
-        
+        result = -1;
+
     CFragConnectionID connID;
     if (result == noErr)
     {
@@ -839,7 +837,7 @@ void SetUpQD(void)
         // return the address of “main” in app, which we ignore).  If GetDiskFragment 
         // returns an error, we assume the app must be 68K.
         //
-        Ptr mainAddr;   
+        Ptr mainAddr;
         Str255 errName;
         result =  GetDiskFragment(infoRec.processAppSpec, 0L, 0L, infoRec.processName,
                                   kLoadCFrag, &connID, (Ptr*)&mainAddr, errName);
@@ -903,13 +901,13 @@ DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs,
 #endif
 
     NPError err = NPERR_NO_ERROR;
-    
+
     //
     // Ensure that everything Netscape passed us is valid!
     //
     if ((nsTable == NULL) || (pluginFuncs == NULL) || (unloadUpp == NULL))
         err = NPERR_INVALID_FUNCTABLE_ERROR;
-    
+
     //
     // Check the “major” version passed in Netscape’s function table.
     // We won’t load if the major version is newer than what we expect.
@@ -922,8 +920,7 @@ DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs,
         if ((nsTable->version >> 8) > NP_VERSION_MAJOR)     // Major version is in high byte
             err = NPERR_INCOMPATIBLE_VERSION_ERROR;
     }
-        
-    
+
     if (err == NPERR_NO_ERROR)
     {
         //
@@ -933,7 +930,7 @@ DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs,
         // the whole structure, because the Netscape function table
         // could actually be bigger than what we expect.
         //
-        
+
         int navMinorVers = nsTable->version & 0xFF;
 
         gNetscapeFuncs.version          = nsTable->version;
@@ -956,7 +953,7 @@ DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs,
             gNetscapeFuncs.getJavaPeer  = (NPN_GetJavaPeerUPP)HOST_TO_PLUGIN_GLUE(getJavaPeer, nsTable->getJavaPeer);
         }
         if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
-        {   
+        {
             gNetscapeFuncs.geturlnotify = (NPN_GetURLNotifyUPP)HOST_TO_PLUGIN_GLUE(geturlnotify, nsTable->geturlnotify);
             gNetscapeFuncs.posturlnotify    = (NPN_PostURLNotifyUPP)HOST_TO_PLUGIN_GLUE(posturlnotify, nsTable->posturlnotify);
         }
@@ -966,7 +963,7 @@ DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs,
         gNetscapeFuncs.invalidateregion = (NPN_InvalidateRegionUPP)HOST_TO_PLUGIN_GLUE(invalidateregion, nsTable->invalidateregion);
         gNetscapeFuncs.forceredraw      = (NPN_ForceRedrawUPP)HOST_TO_PLUGIN_GLUE(forceredraw, nsTable->forceredraw);
         if( navMinorVers >= 14 )
-        {   
+        {
             // NPRuntime support 
             gNetscapeFuncs.getstringidentifier  = (NPN_GetStringIdentifierUPP)HOST_TO_PLUGIN_GLUE(getstringidentifier, nsTable->getstringidentifier);
             gNetscapeFuncs.getstringidentifiers = (NPN_GetStringIdentifiersUPP)HOST_TO_PLUGIN_GLUE(getstringidentifiers, nsTable->getstringidentifiers);
@@ -1005,11 +1002,11 @@ DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs,
         pluginFuncs->writeready     = NewNPP_WriteReadyProc(PLUGIN_TO_HOST_GLUE(writeready, Private_WriteReady));
         pluginFuncs->write          = NewNPP_WriteProc(PLUGIN_TO_HOST_GLUE(write, Private_Write));
         pluginFuncs->print          = NewNPP_PrintProc(PLUGIN_TO_HOST_GLUE(print, Private_Print));
-        pluginFuncs->event          = NewNPP_HandleEventProc(PLUGIN_TO_HOST_GLUE(event, Private_HandleEvent));  
-        pluginFuncs->getvalue       = NewNPP_GetValueProc(PLUGIN_TO_HOST_GLUE(getvalue, Private_GetValue)); 
+        pluginFuncs->event          = NewNPP_HandleEventProc(PLUGIN_TO_HOST_GLUE(event, Private_HandleEvent));
+        pluginFuncs->getvalue       = NewNPP_GetValueProc(PLUGIN_TO_HOST_GLUE(getvalue, Private_GetValue));
         if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
-        {   
-            pluginFuncs->urlnotify = NewNPP_URLNotifyProc(PLUGIN_TO_HOST_GLUE(urlnotify, Private_URLNotify));           
+        {
+            pluginFuncs->urlnotify = NewNPP_URLNotifyProc(PLUGIN_TO_HOST_GLUE(urlnotify, Private_URLNotify));
         }
 #ifdef OJI
         if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
@@ -1024,7 +1021,7 @@ DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs,
         SetUpQD();
         err = Private_Initialize();
     }
-    
+
     ExitCodeResource();
     return err;
 }
@@ -1048,12 +1045,12 @@ extern "C" {
 NPError NP_Initialize(NPNetscapeFuncs* nsTable)
 {
     PLUGINDEBUGSTR("\pNP_Initialize");
-    
+
     /* validate input parameters */
 
     if( NULL == nsTable  )
         return NPERR_INVALID_FUNCTABLE_ERROR;
-    
+
     /*
      * Check the major version passed in Netscape's function table.
      * We won't load if the major version is newer than what we expect.
@@ -1068,8 +1065,7 @@ NPError NP_Initialize(NPNetscapeFuncs* nsTable)
 
     if (nsTable->size < sizeof(NPNetscapeFuncs))
         return NPERR_INVALID_FUNCTABLE_ERROR;
-        
-    
+
     int navMinorVers = nsTable->version & 0xFF;
 
     /*
@@ -1099,7 +1095,7 @@ NPError NP_Initialize(NPNetscapeFuncs* nsTable)
         gNetscapeFuncs.getJavaPeer  = nsTable->getJavaPeer;
     }
     if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
-    {    
+    {
         gNetscapeFuncs.geturlnotify     = nsTable->geturlnotify;
         gNetscapeFuncs.posturlnotify    = nsTable->posturlnotify;
     }
@@ -1110,7 +1106,7 @@ NPError NP_Initialize(NPNetscapeFuncs* nsTable)
     gNetscapeFuncs.invalidateregion = nsTable->invalidateregion;
     gNetscapeFuncs.forceredraw      = nsTable->forceredraw;
     if( navMinorVers >= 14 )
-    {   
+    {
         // NPRuntime support 
         gNetscapeFuncs.getstringidentifier  = nsTable->getstringidentifier;
         gNetscapeFuncs.getstringidentifiers = nsTable->getstringidentifiers;
@@ -1169,8 +1165,8 @@ NPError NP_GetEntryPoints(NPPluginFuncs* pluginFuncs)
     pluginFuncs->getvalue   = NewNPP_GetValueProc(Private_GetValue);
     pluginFuncs->setvalue   = NewNPP_SetValueProc(Private_SetValue);
     if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
-    {    
-        pluginFuncs->urlnotify = Private_URLNotify;         
+    {
+        pluginFuncs->urlnotify = Private_URLNotify;
     }
 #ifdef OJI
     if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
index b6db6c003ac8e675a6bacc9bf495161cfa8e38cb..7c1ce8520e0c0e6fe7f18d6f0ffd08940eaace98 100644 (file)
@@ -13,7 +13,7 @@ data 'carb' (0)
 resource 'STR#' (126)
 {
     {
-        "Version 0.8.6, Copyright 2006, The VideoLAN Team"
+        "Version 0.9.0, copyright 1996-2006 The VideoLAN Team"
         "<BR><A HREF='http://www.videolan.org'>http://www.videolan.org</A>",
         "VLC Multimedia Plugin"
     };
@@ -23,28 +23,43 @@ resource 'STR#' (126)
 resource 'STR#' (127)
 {
     {
+        /* MPEG-1 and MPEG-2 */
         "MPEG audio",
         "MPEG audio",
         "MPEG video",
         "MPEG video",
         "MPEG video",
         "MPEG video",
+        /* MPEG-4 */
         "MPEG-4 video",
         "MPEG-4 audio",
         "MPEG-4 video",
         "MPEG-4 video",
+        /* AVI */
         "AVI video",
+        /* Quicktime */
 /*        "QuickTime video", */
+        /* OGG */
         "Ogg stream",
         "Ogg stream",
+        /* VLC */
         "VLC plugin",
-        "ASF stream",
-        "ASF stream",
-        "",
-        "",
-        "Google VLC Plugin",
+        /* Windows Media */
+        "Windows Media video",
+        "Windows Media video",
+        "Windows Media plugin",
+        "Windows Media video",
+        /* Google VLC */
+        "Google VLC plugin",
+        /* WAV audio */
         "WAV audio",
-        "WAV audio"
+        "WAV audio",
+        /* 3GPP */
+        "3GPP audio",
+        "3GPP video",
+        /* 3GPP2 */
+        "3GPP2 audio",
+        "3GPP2 video",
     };
 };
 
@@ -52,28 +67,43 @@ resource 'STR#' (127)
 resource 'STR#' (128,"MIME Type")
 {
     {
+        /* MPEG-1 and MPEG-2 */
         "audio/mpeg", "mp2,mp3,mpga,mpega",
         "audio/x-mpeg", "mp2,mp3,mpga,mpega",
         "video/mpeg", "mpg,mpeg,mpe",
         "video/x-mpeg", "mpg,mpeg,mpe",
         "video/mpeg-system", "mpg,mpeg,vob",
         "video/x-mpeg-system", "mpg,mpeg,vob",
+        /* MPEG-4 */
         "video/mpeg4", "mp4,mpg4",
         "audio/mpeg4", "mp4,mpg4",
         "application/mpeg4-iod", "mp4,mpg4",
         "application/mpeg4-muxcodetable", "mp4,mpg4",
+        /* AVI */
         "video/x-msvideo", "avi",
-/*        "video/quicktime", "mov, qt", */
+        /* Quicktime */
+/*        "video/quicktime", "mov,qt", */
+        /* OGG */
         "application/ogg", "ogg",
         "application/x-ogg", "ogg",
+        /* VLC */
         "application/x-vlc-plugin", "vlc",
-        "video/x-ms-asf-plugin", "",
-        "video/x-ms-asf", "",
+        /* Windows Media */
+        "video/x-ms-asf-plugin", "asf,asx",
+        "video/x-ms-asf", "asf,asx",
         "application/x-mplayer2", "",
         "video/x-ms-wmv", "wmv",
+        /* Google VLC */
         "video/x-google-vlc-plugin", "",
+        /* WAV audio */
         "audio/wav", "wav",
         "audio/x-wav", "wav",
+        /* 3GPP */
+        "audio/3gpp", "3gp,3gpp",
+        "video/3gpp", "3gp,3gpp",
+        /* 3GPP2 */
+        "audio/3gpp2", "3g2,3gpp2",
+        "video/3gpp2", "3g2,3gpp2",
     };
 };
 
index f83ebec3f3fec401d02458a465e1ed39f5a1daa4..71af56480913a4cbfdeda879c8222f5f927d53fc 100644 (file)
 #include "control/npovlc.h"
 #include "control/npolibvlc.h"
 
+#include <ctype.h>
+
 /*****************************************************************************
  * VlcPlugin constructor and destructor
  *****************************************************************************/
 VlcPlugin::VlcPlugin( NPP instance, uint16 mode ) :
     i_npmode(mode),
     b_stream(0),
-    b_autoplay(0),
+    b_autoplay(1),
     psz_target(NULL),
     libvlc_instance(NULL),
-    scriptClass(NULL),
+    libvlc_log(NULL),
+    p_scriptClass(NULL),
+    p_scriptObject(NULL),
     p_browser(instance),
     psz_baseURL(NULL)
 #if XP_WIN
@@ -58,7 +62,7 @@ VlcPlugin::VlcPlugin( NPP instance, uint16 mode ) :
     memset(&npwindow, 0, sizeof(NPWindow));
 }
 
-static int boolValue(const char *value) {
+static bool boolValue(const char *value) {
     return ( !strcmp(value, "1") || 
              !strcasecmp(value, "true") ||
              !strcasecmp(value, "yes") );
@@ -123,7 +127,7 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
     ppsz_argv[ppsz_argc++] = "--intf";
     ppsz_argv[ppsz_argc++] = "dummy";
 
-    const char *version = NULL;
+    const char *progid = NULL;
 
     /* parse plugin arguments */
     for( int i = 0; i < argc ; i++ )
@@ -172,9 +176,10 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
                 ppsz_argv[ppsz_argc++] = "--no-loop";
             }
         }
-        else if( !strcmp( argn[i], "version") )
+        else if( !strcmp( argn[i], "version")
+              || !strcmp( argn[i], "progid") )
         {
-            version = argv[i];
+            progid = argv[i];
         }
     }
 
@@ -224,19 +229,20 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
     if( psz_target )
     {
         // get absolute URL from src
-        psz_target = getAbsoluteURL(psz_target);
+        char *psz_absurl = getAbsoluteURL(psz_target);
+        psz_target = psz_absurl ? psz_absurl : strdup(psz_target);
     }
 
     /* assign plugin script root class */
-    if( (NULL != version) && (!strcmp(version, "VideoLAN.VLCPlugin.2")) )
+    if( (NULL != progid) && (!strcmp(progid, "VideoLAN.VLCPlugin.2")) )
     {
         /* new APIs */
-        scriptClass = RuntimeNPClass<LibvlcRootNPObject>::getClass();
+        p_scriptClass = RuntimeNPClass<LibvlcRootNPObject>::getClass();
     }
     else
     {
         /* legacy APIs */
-        scriptClass = RuntimeNPClass<VlcNPObject>::getClass();
+        p_scriptClass = RuntimeNPClass<VlcNPObject>::getClass();
     }
 
     return NPERR_NO_ERROR;
@@ -279,6 +285,10 @@ VlcPlugin::~VlcPlugin()
 {
     delete psz_baseURL;
     delete psz_target;
+    if( p_scriptObject )
+        NPN_ReleaseObject(p_scriptObject);
+    if( libvlc_log )
+        libvlc_log_close(libvlc_log, NULL);
     if( libvlc_instance )
         libvlc_destroy(libvlc_instance, NULL );
 }
@@ -298,20 +308,22 @@ char *VlcPlugin::getAbsoluteURL(const char *url)
             // validate protocol header
             const char *start = url;
             while( start != end ) {
-                char c = *start | 0x20;
+                char c = tolower(*start);
                 if( (c < 'a') || (c > 'z') )
                     // not valid protocol header, assume relative URL
-                    break;
+                    goto relativeurl;
                 ++start;
             }
             /* we have a protocol header, therefore URL is absolute */
             return strdup(url);
         }
 
+relativeurl:
+
         if( psz_baseURL )
         {
             size_t baseLen = strlen(psz_baseURL);
-            char *href = new char[baseLen+strlen(url)];
+            char *href = new char[baseLen+strlen(url)+1];
             if( href )
             {
                 /* prepend base URL */
@@ -331,21 +343,35 @@ char *VlcPlugin::getAbsoluteURL(const char *url)
                 /* skip over protocol part  */
                 char *pathstart = strchr(href, ':');
                 char *pathend;
-                if( '/' == *(++pathstart) )
+                if( pathstart )
                 {
                     if( '/' == *(++pathstart) )
                     {
-                        ++pathstart;
+                        if( '/' == *(++pathstart) )
+                        {
+                            ++pathstart;
+                        }
+                    }
+                    /* skip over host part */
+                    pathstart = strchr(pathstart, '/');
+                    pathend = href+baseLen;
+                    if( ! pathstart )
+                    {
+                        // no path, add a / past end of url (over '\0')
+                        pathstart = pathend;
+                        *pathstart = '/';
                     }
                 }
-                /* skip over host part */
-                pathstart = strchr(pathstart, '/');
-                pathend = href+baseLen;
-                if( ! pathstart )
+                else
                 {
-                    // no path, add a / past end of url (over '\0')
-                    pathstart = pathend;
-                    *pathstart = '/';
+                    /* baseURL is just a UNIX path */
+                    if( '/' != *href )
+                    {
+                        /* baseURL is not an absolute path */
+                        return NULL;
+                    }
+                    pathstart = href;
+                    pathend = href+baseLen;
                 }
 
                 /* relative URL made of an absolute path ? */
@@ -357,7 +383,8 @@ char *VlcPlugin::getAbsoluteURL(const char *url)
                 }
 
                 /* find last path component and replace it */ 
-                while( '/' != *pathend) --pathend;
+                while( '/' != *pathend)
+                    --pathend;
 
                 /*
                 ** if relative url path starts with one or more '../',
@@ -370,17 +397,43 @@ char *VlcPlugin::getAbsoluteURL(const char *url)
                     if( '.' != *p )
                         break;
                     ++p;
-                    if( '.' != *p ) 
+                    if( '\0' == *p  )
+                    {
+                        /* relative url is just '.' */
+                        url = p;
                         break;
-                    ++p;
-                    if( '/' != *p ) 
+                    }
+                    if( '/' == *p  )
+                    {
+                        /* relative url starts with './' */
+                        url = ++p;
+                        continue;
+                    }
+                    if( '.' != *p ) 
                         break;
                     ++p;
+                    if( '\0' == *p )
+                    {
+                        /* relative url is '..' */
+                    }
+                    else
+                    {
+                        if( '/' != *p ) 
+                            break;
+                        /* relative url starts with '../' */
+                        ++p;
+                    }
                     url = p;
-                    while( '/' != *pathend ) --pathend;
+                    do
+                    {
+                        --pathend;
+                    }
+                    while( '/' != *pathend );
                 }
+                /* skip over '/' separator */
+                ++pathend;
                 /* concatenate remaining base URL and relative URL */
-                strcpy(pathend+1, url);
+                strcpy(pathend, url);
             }
             return href;
         }
@@ -388,6 +441,15 @@ char *VlcPlugin::getAbsoluteURL(const char *url)
     return NULL;
 }
 
+NPObject* VlcPlugin::getScriptObject()
+{
+    if( NULL == p_scriptObject )
+    {
+        p_scriptObject = NPN_CreateObject(p_browser, p_scriptClass);
+    }
+    return NPN_RetainObject(p_scriptObject);
+}
+
 #if XP_UNIX
 int  VlcPlugin::setSize(unsigned width, unsigned height)
 {
index ca31cf75d5337a2ac5248ced6a282101b0715b0c..4977d41ad038f71f58589ec07dd15e55d9e57c35 100644 (file)
@@ -71,9 +71,12 @@ public:
     void                setWindow(const NPWindow *window)
                             { npwindow = *window; };
 
-    NPClass*            getScriptClass()
-                            { return scriptClass; };
+    NPObject*           getScriptObject();
 
+    void                setLog(libvlc_log_t *log)
+                            { libvlc_log = log; };
+    libvlc_log_t*       getLog()
+                            { return libvlc_log; };
 #if XP_WIN
     WNDPROC             getWindowProc()
                             { return pf_wndproc; };
@@ -94,8 +97,10 @@ public:
 
 private:
     /* VLC reference */
-    libvlc_instance_t *libvlc_instance;
-    NPClass           *scriptClass;
+    libvlc_instance_t   *libvlc_instance;
+    libvlc_log_t        *libvlc_log;
+    NPClass             *p_scriptClass;
+    NPObject            *p_scriptObject;
 
     /* browser reference */
     NPP     p_browser;
@@ -114,12 +119,10 @@ private:
 /*******************************************************************************
  * Plugin properties.
  ******************************************************************************/
-#define PLUGIN_NAME         "VLC multimedia plugin"
+#define PLUGIN_NAME         "VLC Multimedia Plugin"
 #define PLUGIN_DESCRIPTION \
-    "VLC multimedia plugin <br>" \
-    " <br>" \
-    "version %s <br>" \
-    "VideoLAN WWW: <a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>"
+    "Version %s, copyright 1996-2006 The VideoLAN Team" \
+    "<br><a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>"
 
 #define PLUGIN_MIMETYPES \
     /* MPEG-1 and MPEG-2 */ \
@@ -138,20 +141,26 @@ private:
     "video/x-msvideo:avi:AVI video;" \
     /* QuickTime */ \
     "video/quicktime:mov,qt:QuickTime video;" \
-    /* Ogg */ \
+    /* OGG */ \
     "application/x-ogg:ogg:Ogg stream;" \
     "application/ogg:ogg:Ogg stream;" \
-    /* explicit plugin call */ \
-    "application/x-vlc-plugin::VLC plugin;" \
-    /* windows media */ \
+    /* VLC */ \
+    "application/x-vlc-plugin:vlc:VLC plugin;" \
+    /* Windows Media */ \
     "video/x-ms-asf-plugin:asf,asx:Windows Media Video;" \
     "video/x-ms-asf:asf,asx:Windows Media Video;" \
     "application/x-mplayer2::Windows Media;" \
     "video/x-ms-wmv:wmv:Windows Media;" \
-    /* Google VLC mime */ \
-    "application/x-google-vlc-plugin::Google VLC plugin" \
-    /* Misc */ \
-    "audio/wav::WAV audio" \
-    "audio/x-wav::WAV audio" \
+    /* Google VLC */ \
+    "application/x-google-vlc-plugin::Google VLC plugin;" \
+    /* WAV audio */ \
+    "audio/wav:wav:WAV audio;" \
+    "audio/x-wav:wav:WAV audio;" \
+    /* 3GPP */ \
+    "audio/3gpp:3gp,3gpp:3GPP audio;" \
+    "video/3gpp:3gp,3gpp:3GPP video;" \
+    /* 3GPP2 */ \
+    "audio/3gpp2:3g2,3gpp2:3GPP2 audio;" \
+    "video/3gpp2:3g2,3gpp2:3GPP2 video;" \
 
 #endif
index 6f4313ffef3dd39a9115c06b1ff7271072e20417..57e3c2b2724539c7161ee4b6b87b662839de7244 100644 (file)
@@ -120,7 +120,7 @@ NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
     {
         case NPPVpluginScriptableNPObject:
             /* create an instance and return it */
-            *(NPObject**)value = NPN_CreateObject(instance, p_plugin->getScriptClass());
+            *(NPObject**)value = p_plugin->getScriptObject();
             if( NULL == *(NPObject**)value )
             {
                 return NPERR_OUT_OF_MEMORY_ERROR;
@@ -139,6 +139,8 @@ NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
 #ifdef XP_MACOSX
 int16 NPP_HandleEvent( NPP instance, void * event )
 {
+    static UInt32 lastMouseUp = 0;
+
     if( instance == NULL )
     {
         return false;
@@ -152,7 +154,29 @@ int16 NPP_HandleEvent( NPP instance, void * event )
         case nullEvent:
             break;
         case mouseDown:
+        {
+            if( (myEvent->when - lastMouseUp) < GetDblTime() )
+            {
+                /* double click */
+                libvlc_instance_t *p_vlc = p_plugin->getVLC();
+
+                if( p_vlc )
+                {
+                    if( libvlc_playlist_isplaying(p_vlc, NULL) )
+                    {
+                        libvlc_input_t *p_input = libvlc_playlist_get_input(p_vlc, NULL);
+                        if( p_input )
+                        {
+                            libvlc_toggle_fullscreen(p_input, NULL);
+                            libvlc_input_free(p_input);
+                        }
+                    }
+                }
+            }
+            return true;
+        }
         case mouseUp:
+            lastMouseUp = myEvent->when;
             return true;
         case keyUp:
         case keyDown:
@@ -268,12 +292,14 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
 
 NPError NPP_Destroy( NPP instance, NPSavedData** save )
 {
-    if( instance == NULL )
-    {
+    if( NULL == instance )
         return NPERR_INVALID_INSTANCE_ERROR;
-    }
 
     VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
+    if( NULL == p_plugin )
+        return NPERR_NO_ERROR;
+
+    instance->pdata = NULL;
 
 #if XP_WIN
     HWND win = (HWND)p_plugin->getWindow()->window;
@@ -288,8 +314,6 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
     if( p_plugin )
         delete p_plugin;
 
-    instance->pdata = NULL;
-
     return NPERR_NO_ERROR;
 }
 
@@ -433,14 +457,14 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
     {
         if( p_plugin->psz_target )
         {
-            if( VLC_SUCCESS == libvlc_playlist_add( p_vlc, p_plugin->psz_target, NULL, NULL ) )
+            if( libvlc_playlist_add( p_vlc, p_plugin->psz_target, NULL, NULL ) != -1 )
             {
                 if( p_plugin->b_autoplay )
                 {
                     libvlc_playlist_play(p_vlc, 0, 0, NULL, NULL);
                 }
-                p_plugin->b_stream = VLC_TRUE;
             }
+            p_plugin->b_stream = VLC_TRUE;
         }
     }
     return NPERR_NO_ERROR;
@@ -506,7 +530,7 @@ void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname )
 
     VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(instance->pdata);
 
-    if( VLC_SUCCESS == libvlc_playlist_add( p_plugin->getVLC(), fname, stream->url, NULL ) )
+    if( libvlc_playlist_add( p_plugin->getVLC(), fname, stream->url, NULL ) != -1 )
     {
         if( p_plugin->b_autoplay )
         {