]> git.sesse.net Git - vlc/blobdiff - mozilla/control/npolibvlc.cpp
Makefile.am: add vlc_pgpkey.h
[vlc] / mozilla / control / npolibvlc.cpp
index f7d7d8e8e1722709dfff6a67c1f1eb3e9be59f48..7ff456eae9e5336e3d6f771c007a37d9845d9e98 100755 (executable)
@@ -48,11 +48,11 @@ LibvlcRootNPObject::~LibvlcRootNPObject()
     */\r
     if( isValid() )\r
     {\r
-       if( audioObj    ) NPN_ReleaseObject(audioObj);\r
-       if( inputObj    ) NPN_ReleaseObject(inputObj);\r
-       if( logObj      ) NPN_ReleaseObject(logObj);\r
-       if( playlistObj ) NPN_ReleaseObject(playlistObj);\r
-       if( videoObj    ) NPN_ReleaseObject(videoObj);\r
+        if( audioObj    ) NPN_ReleaseObject(audioObj);\r
+        if( inputObj    ) NPN_ReleaseObject(inputObj);\r
+        if( logObj      ) NPN_ReleaseObject(logObj);\r
+        if( playlistObj ) NPN_ReleaseObject(playlistObj);\r
+        if( videoObj    ) NPN_ReleaseObject(videoObj);\r
     }\r
 }\r
 \r
@@ -86,44 +86,34 @@ RuntimeNPObject::InvokeResult LibvlcRootNPObject::getProperty(int index, NPVaria
         switch( index )\r
         {\r
             case ID_root_audio:\r
-               // create child object in lazyman fashion to avoid ownership problem with firefox\r
-               if( audioObj )\r
-                   NPN_RetainObject(audioObj);\r
-               else\r
-                   audioObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcAudioNPObject>::getClass());\r
-                OBJECT_TO_NPVARIANT(audioObj, result);\r
+                // create child object in lazyman fashion to avoid ownership problem with firefox\r
+                if( ! audioObj )\r
+                    audioObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcAudioNPObject>::getClass());\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(audioObj), result);\r
                 return INVOKERESULT_NO_ERROR;\r
             case ID_root_input:\r
-               // create child object in lazyman fashion to avoid ownership problem with firefox\r
-               if( inputObj )\r
-                   NPN_RetainObject(inputObj);\r
-               else\r
-                   inputObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcInputNPObject>::getClass());\r
-                OBJECT_TO_NPVARIANT(inputObj, result);\r
+                // create child object in lazyman fashion to avoid ownership problem with firefox\r
+                if( ! inputObj )\r
+                    inputObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcInputNPObject>::getClass());\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(inputObj), result);\r
                 return INVOKERESULT_NO_ERROR;\r
             case ID_root_log:\r
-               // create child object in lazyman fashion to avoid ownership problem with firefox\r
-               if( logObj )\r
-                   NPN_RetainObject(logObj);\r
-               else\r
-                   logObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcLogNPObject>::getClass());\r
-                OBJECT_TO_NPVARIANT(logObj, result);\r
+                // create child object in lazyman fashion to avoid ownership problem with firefox\r
+                if( ! logObj )\r
+                    logObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcLogNPObject>::getClass());\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(logObj), result);\r
                 return INVOKERESULT_NO_ERROR;\r
             case ID_root_playlist:\r
-               // create child object in lazyman fashion to avoid ownership problem with firefox\r
-               if( playlistObj )\r
-                   NPN_RetainObject(playlistObj);\r
-               else\r
-                   playlistObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcPlaylistNPObject>::getClass());\r
-                OBJECT_TO_NPVARIANT(playlistObj, result);\r
+                // create child object in lazyman fashion to avoid ownership problem with firefox\r
+                if( ! playlistObj )\r
+                    playlistObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcPlaylistNPObject>::getClass());\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistObj), result);\r
                 return INVOKERESULT_NO_ERROR;\r
             case ID_root_video:\r
-               // create child object in lazyman fashion to avoid ownership problem with firefox\r
-               if( videoObj )\r
-                   NPN_RetainObject(videoObj);\r
-               else\r
-                   videoObj = NPN_CreateObject(_instance,RuntimeNPClass<LibvlcVideoNPObject>::getClass());\r
-                OBJECT_TO_NPVARIANT(videoObj, result);\r
+                // create child object in lazyman fashion to avoid ownership problem with firefox\r
+                if( ! videoObj )\r
+                    videoObj = NPN_CreateObject(_instance,RuntimeNPClass<LibvlcVideoNPObject>::getClass());\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(videoObj), result);\r
                 return INVOKERESULT_NO_ERROR;\r
             case ID_root_VersionInfo:\r
             {\r
@@ -252,15 +242,15 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
             }\r
             case ID_audio_track:\r
             {\r
-                libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);\r
+                libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(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
-                int track = libvlc_audio_get_track(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                int track = libvlc_audio_get_track(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -331,16 +321,16 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
             case ID_audio_track:\r
                 if( isNumberValue(value) )\r
                 {\r
-                    libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);\r
+                    libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(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
-                    libvlc_audio_set_track(p_input,\r
+                    libvlc_audio_set_track(p_md,\r
                                            numberValue(value), &ex);\r
-                    libvlc_input_free(p_input);\r
+                    libvlc_media_instance_release(p_md);\r
                     if( libvlc_exception_raised(&ex) )\r
                     {\r
                         NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -455,7 +445,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
         libvlc_exception_t ex;\r
         libvlc_exception_init(&ex);\r
 \r
-        libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);\r
+        libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);\r
         if( libvlc_exception_raised(&ex) )\r
         {\r
             if( index != ID_input_state )\r
@@ -476,8 +466,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
         {\r
             case ID_input_length:\r
             {\r
-                double val = (double)libvlc_input_get_length(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                double val = (double)libvlc_media_instance_get_length(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -489,8 +479,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
             }\r
             case ID_input_position:\r
             {\r
-                double val = libvlc_input_get_position(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                double val = libvlc_media_instance_get_position(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -502,8 +492,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
             }\r
             case ID_input_time:\r
             {\r
-                double val = (double)libvlc_input_get_time(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                double val = (double)libvlc_media_instance_get_time(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -515,8 +505,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
             }\r
             case ID_input_state:\r
             {\r
-                int val = libvlc_input_get_state(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                int val = libvlc_media_instance_get_state(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -528,8 +518,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
             }\r
             case ID_input_rate:\r
             {\r
-                float val = libvlc_input_get_rate(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                float val = libvlc_media_instance_get_rate(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -541,8 +531,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
             }\r
             case ID_input_fps:\r
             {\r
-                double val = libvlc_input_get_fps(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                double val = libvlc_media_instance_get_fps(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -554,8 +544,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
             }\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
+                vlc_bool_t val = libvlc_media_instance_has_vout(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -568,7 +558,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
             default:\r
                 ;\r
         }\r
-        libvlc_input_free(p_input);\r
+        libvlc_media_instance_release(p_md);\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
 }\r
@@ -582,7 +572,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
         libvlc_exception_t ex;\r
         libvlc_exception_init(&ex);\r
 \r
-        libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);\r
+        libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);\r
         if( libvlc_exception_raised(&ex) )\r
         {\r
             NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -596,13 +586,13 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
             {\r
                 if( ! NPVARIANT_IS_DOUBLE(value) )\r
                 {\r
-                    libvlc_input_free(p_input);\r
+                    libvlc_media_instance_release(p_md);\r
                     return INVOKERESULT_INVALID_VALUE;\r
                 }\r
 \r
                 float val = (float)NPVARIANT_TO_DOUBLE(value);\r
-                libvlc_input_set_position(p_input, val, &ex);\r
-                libvlc_input_free(p_input);\r
+                libvlc_media_instance_set_position(p_md, val, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -620,12 +610,12 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
                     val = (vlc_int64_t)NPVARIANT_TO_DOUBLE(value);\r
                 else\r
                 {\r
-                    libvlc_input_free(p_input);\r
+                    libvlc_media_instance_release(p_md);\r
                     return INVOKERESULT_INVALID_VALUE;\r
                 }\r
 \r
-                libvlc_input_set_time(p_input, val, &ex);\r
-                libvlc_input_free(p_input);\r
+                libvlc_media_instance_set_time(p_md, val, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -643,12 +633,12 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
                     val = (float)NPVARIANT_TO_DOUBLE(value);\r
                 else\r
                 {\r
-                    libvlc_input_free(p_input);\r
+                    libvlc_media_instance_release(p_md);\r
                     return INVOKERESULT_INVALID_VALUE;\r
                 }\r
 \r
-                libvlc_input_set_rate(p_input, val, &ex);\r
-                libvlc_input_free(p_input);\r
+                libvlc_media_instance_set_rate(p_md, val, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -660,7 +650,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
             default:\r
                 ;\r
         }\r
-        libvlc_input_free(p_input);\r
+        libvlc_media_instance_release(p_md);\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
 }\r
@@ -1057,7 +1047,7 @@ LibvlcLogNPObject::~LibvlcLogNPObject()
 {\r
     if( isValid() )\r
     {\r
-       if( messagesObj ) NPN_ReleaseObject(messagesObj);\r
+        if( messagesObj ) NPN_ReleaseObject(messagesObj);\r
     }\r
 };\r
 \r
@@ -1088,12 +1078,10 @@ RuntimeNPObject::InvokeResult LibvlcLogNPObject::getProperty(int index, NPVarian
         {\r
             case ID_log_messages:\r
             {\r
-               // create child object in lazyman fashion to avoid ownership problem with firefox\r
-               if( messagesObj )\r
-                   NPN_RetainObject(messagesObj);\r
-               else\r
-                   messagesObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcMessagesNPObject>::getClass());\r
-                OBJECT_TO_NPVARIANT(messagesObj, result);\r
+                // create child object in lazyman fashion to avoid ownership problem with firefox\r
+                if( ! messagesObj )\r
+                    messagesObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcMessagesNPObject>::getClass());\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(messagesObj), result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
             case ID_log_verbosity:\r
@@ -1311,7 +1299,7 @@ LibvlcPlaylistNPObject::~LibvlcPlaylistNPObject()
 {\r
     if( isValid() )\r
     {\r
-       if( playlistItemsObj ) NPN_ReleaseObject(playlistItemsObj);\r
+        if( playlistItemsObj ) NPN_ReleaseObject(playlistItemsObj);\r
     }\r
 };\r
 \r
@@ -1368,12 +1356,10 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
             }\r
             case ID_playlist_items:\r
             {\r
-               // create child object in lazyman fashion to avoid ownership problem with firefox\r
-               if( playlistItemsObj )\r
-                   NPN_RetainObject(playlistItemsObj);\r
-               else\r
-                   playlistItemsObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcPlaylistItemsNPObject>::getClass());\r
-                OBJECT_TO_NPVARIANT(playlistItemsObj, result);\r
+                // create child object in lazyman fashion to avoid ownership problem with firefox\r
+                if( ! playlistItemsObj )\r
+                    playlistItemsObj = NPN_CreateObject(_instance, RuntimeNPClass<LibvlcPlaylistItemsNPObject>::getClass());\r
+                OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistItemsObj), result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
             default:\r
@@ -1664,11 +1650,12 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
     return INVOKERESULT_GENERIC_ERROR;\r
 }\r
 \r
-void LibvlcPlaylistNPObject::parseOptions(const NPString &s, int *i_options, char*** ppsz_options)\r
+void LibvlcPlaylistNPObject::parseOptions(const NPString &nps, int *i_options, char*** ppsz_options)\r
 {\r
-    if( s.utf8length )\r
+    if( nps.utf8length )\r
     {\r
-        char *val = stringValue(s);\r
+        char *s = stringValue(nps);\r
+        char *val = s;\r
         if( val )\r
         {\r
             long capacity = 16;\r
@@ -1677,7 +1664,7 @@ void LibvlcPlaylistNPObject::parseOptions(const NPString &s, int *i_options, cha
             {\r
                 int nOptions = 0;\r
 \r
-                char *end = val + s.utf8length;\r
+                char *end = val + nps.utf8length;\r
                 while( val < end )\r
                 {\r
                     // skip leading blanks\r
@@ -1708,11 +1695,11 @@ void LibvlcPlaylistNPObject::parseOptions(const NPString &s, int *i_options, cha
                             if( ! moreOptions )\r
                             {\r
                                 /* failed to allocate more memory */\r
-                                delete val;\r
+                                delete s;\r
                                 /* return what we got so far */\r
                                 *i_options = nOptions;\r
                                 *ppsz_options = options;\r
-                                break;\r
+                                return;\r
                             }\r
                             options = moreOptions;\r
                         }\r
@@ -1726,7 +1713,7 @@ void LibvlcPlaylistNPObject::parseOptions(const NPString &s, int *i_options, cha
                 *i_options = nOptions;\r
                 *ppsz_options = options;\r
             }\r
-            delete val;\r
+            delete s;\r
         }\r
     }\r
 }\r
@@ -1802,7 +1789,8 @@ const NPUTF8 * const LibvlcVideoNPObject::propertyNames[] =
     "width",\r
     "aspectRatio",\r
     "subtitle",\r
-    "crop"\r
+    "crop",\r
+    "teletext"\r
 };\r
 \r
 enum LibvlcVideoNPObjectPropertyIds\r
@@ -1812,7 +1800,8 @@ enum LibvlcVideoNPObjectPropertyIds
     ID_video_width,\r
     ID_video_aspectratio,\r
     ID_video_subtitle,\r
-    ID_video_crop\r
+    ID_video_crop,\r
+    ID_video_teletext\r
 };\r
 \r
 const int LibvlcVideoNPObject::propertyCount = sizeof(LibvlcVideoNPObject::propertyNames)/sizeof(NPUTF8 *);\r
@@ -1826,7 +1815,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
         libvlc_exception_t ex;\r
         libvlc_exception_init(&ex);\r
 \r
-        libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);\r
+        libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);\r
         if( libvlc_exception_raised(&ex) )\r
         {\r
             NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1838,8 +1827,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
         {\r
             case ID_video_fullscreen:\r
             {\r
-                int val = libvlc_get_fullscreen(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                int val = libvlc_get_fullscreen(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1851,8 +1840,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
             }\r
             case ID_video_height:\r
             {\r
-                int val = libvlc_video_get_height(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                int val = libvlc_video_get_height(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1864,8 +1853,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
             }\r
             case ID_video_width:\r
             {\r
-                int val = libvlc_video_get_width(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                int val = libvlc_video_get_width(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1877,8 +1866,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
             }\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
+                NPUTF8 *psz_aspect = libvlc_video_get_aspect_ratio(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1893,8 +1882,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
             }\r
             case ID_video_subtitle:\r
             {\r
-                int i_spu = libvlc_video_get_spu(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                int i_spu = libvlc_video_get_spu(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1906,8 +1895,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
             }\r
             case ID_video_crop:\r
             {\r
-                NPUTF8 *psz_geometry = libvlc_video_get_crop_geometry(p_input, &ex);\r
-                libvlc_input_free(p_input);\r
+                NPUTF8 *psz_geometry = libvlc_video_get_crop_geometry(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1920,8 +1909,21 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
                 STRINGZ_TO_NPVARIANT(psz_geometry, result);\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
+            case ID_video_teletext:\r
+            {\r
+                int i_page = libvlc_video_get_teletext(p_md, &ex);\r
+                libvlc_media_instance_release(p_md);\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(i_page, result);\r
+                return INVOKERESULT_NO_ERROR;\r
+            }\r
         }\r
-        libvlc_input_free(p_input);\r
+        libvlc_media_instance_release(p_md);\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
 }\r
@@ -1935,7 +1937,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
         libvlc_exception_t ex;\r
         libvlc_exception_init(&ex);\r
 \r
-        libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);\r
+        libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);\r
         if( libvlc_exception_raised(&ex) )\r
         {\r
             NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1949,13 +1951,13 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
             {\r
                 if( ! NPVARIANT_IS_BOOLEAN(value) )\r
                 {\r
-                    libvlc_input_free(p_input);\r
+                    libvlc_media_instance_release(p_md);\r
                     return INVOKERESULT_INVALID_VALUE;\r
                 }\r
 \r
                 int val = NPVARIANT_TO_BOOLEAN(value);\r
-                libvlc_set_fullscreen(p_input, val, &ex);\r
-                libvlc_input_free(p_input);\r
+                libvlc_set_fullscreen(p_md, val, &ex);\r
+                libvlc_media_instance_release(p_md);\r
 \r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
@@ -1971,20 +1973,20 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
 \r
                 if( ! NPVARIANT_IS_STRING(value) )\r
                 {\r
-                    libvlc_input_free(p_input);\r
+                    libvlc_media_instance_release(p_md);\r
                     return INVOKERESULT_INVALID_VALUE;\r
                 }\r
 \r
                 psz_aspect = stringValue(NPVARIANT_TO_STRING(value));\r
                 if( !psz_aspect )\r
                 {\r
-                    libvlc_input_free(p_input);\r
+                    libvlc_media_instance_release(p_md);\r
                     return INVOKERESULT_GENERIC_ERROR;\r
                 }\r
 \r
-                libvlc_video_set_aspect_ratio(p_input, psz_aspect, &ex);\r
+                libvlc_video_set_aspect_ratio(p_md, psz_aspect, &ex);\r
                 delete psz_aspect;\r
-                libvlc_input_free(p_input);\r
+                libvlc_media_instance_release(p_md);\r
 \r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
@@ -1998,9 +2000,9 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
             {\r
                 if( isNumberValue(value) )\r
                 {\r
-                    libvlc_video_set_spu(p_input,\r
+                    libvlc_video_set_spu(p_md,\r
                                          numberValue(value), &ex);\r
-                    libvlc_input_free(p_input);\r
+                    libvlc_media_instance_release(p_md);\r
                     if( libvlc_exception_raised(&ex) )\r
                     {\r
                         NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -2009,7 +2011,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
                     }\r
                     return INVOKERESULT_NO_ERROR;\r
                 }\r
-                libvlc_input_free(p_input);\r
+                libvlc_media_instance_release(p_md);\r
                 return INVOKERESULT_INVALID_VALUE;\r
             }\r
             case ID_video_crop:\r
@@ -2018,20 +2020,20 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
 \r
                 if( ! NPVARIANT_IS_STRING(value) )\r
                 {\r
-                    libvlc_input_free(p_input);\r
+                    libvlc_media_instance_release(p_md);\r
                     return INVOKERESULT_INVALID_VALUE;\r
                 }\r
 \r
                 psz_geometry = stringValue(NPVARIANT_TO_STRING(value));\r
                 if( !psz_geometry )\r
                 {\r
-                    libvlc_input_free(p_input);\r
+                    libvlc_media_instance_release(p_md);\r
                     return INVOKERESULT_GENERIC_ERROR;\r
                 }\r
 \r
-                libvlc_video_set_crop_geometry(p_input, psz_geometry, &ex);\r
+                libvlc_video_set_crop_geometry(p_md, psz_geometry, &ex);\r
                 delete psz_geometry;\r
-                libvlc_input_free(p_input);\r
+                libvlc_media_instance_release(p_md);\r
 \r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
@@ -2041,8 +2043,26 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
                 }\r
                 return INVOKERESULT_NO_ERROR;\r
             }\r
+            case ID_video_teletext:\r
+            {\r
+                if( isNumberValue(value) )\r
+                {\r
+                    libvlc_video_set_teletext(p_md,\r
+                                         numberValue(value), &ex);\r
+                    libvlc_media_instance_release(p_md);\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
+                    return INVOKERESULT_NO_ERROR;\r
+                }\r
+                libvlc_media_instance_release(p_md);\r
+                return INVOKERESULT_INVALID_VALUE;\r
+            }\r
         }\r
-        libvlc_input_free(p_input);\r
+        libvlc_media_instance_release(p_md);\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
 }\r
@@ -2050,11 +2070,13 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
 const NPUTF8 * const LibvlcVideoNPObject::methodNames[] =\r
 {\r
     "toggleFullscreen",\r
+    "toggleTeletext"\r
 };\r
 \r
 enum LibvlcVideoNPObjectMethodIds\r
 {\r
     ID_video_togglefullscreen,\r
+    ID_video_toggleteletext\r
 };\r
 \r
 const int LibvlcVideoNPObject::methodCount = sizeof(LibvlcVideoNPObject::methodNames)/sizeof(NPUTF8 *);\r
@@ -2068,7 +2090,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::invoke(int index, const NPVar
         libvlc_exception_t ex;\r
         libvlc_exception_init(&ex);\r
 \r
-        libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);\r
+        libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);\r
         if( libvlc_exception_raised(&ex) )\r
         {\r
             NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -2081,8 +2103,36 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::invoke(int index, const NPVar
             case ID_video_togglefullscreen:\r
                 if( argCount == 0 )\r
                 {\r
-                    libvlc_toggle_fullscreen(p_input, &ex);\r
-                    libvlc_input_free(p_input);\r
+                    libvlc_toggle_fullscreen(p_md, &ex);\r
+                    libvlc_media_instance_release(p_md);\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
+                else\r
+                {\r
+                    /* cannot get md, probably not playing */\r
+                    if( libvlc_exception_raised(&ex) )\r
+                    {\r
+                        NPN_SetException(this, libvlc_exception_get_message(&ex));\r
+                        libvlc_exception_clear(&ex);\r
+                    }\r
+                    return INVOKERESULT_GENERIC_ERROR;\r
+                }\r
+                return INVOKERESULT_NO_SUCH_METHOD;\r
+            case ID_video_toggleteletext:\r
+                if( argCount == 0 )\r
+                {\r
+                    libvlc_toggle_teletext(p_md, &ex);\r
+                    libvlc_media_instance_release(p_md);\r
                     if( libvlc_exception_raised(&ex) )\r
                     {\r
                         NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -2097,7 +2147,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::invoke(int index, const NPVar
                 }\r
                 else\r
                 {\r
-                    /* cannot get input, probably not playing */\r
+                    /* cannot get md, probably not playing */\r
                     if( libvlc_exception_raised(&ex) )\r
                     {\r
                         NPN_SetException(this, libvlc_exception_get_message(&ex));\r