Mozilla: Attempt to match libvlc input to media_instance changes.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Mon, 18 Jun 2007 19:58:16 +0000 (19:58 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Mon, 18 Jun 2007 19:58:16 +0000 (19:58 +0000)
mozilla/control/npolibvlc.cpp

index 20822b4..5b75aac 100755 (executable)
@@ -242,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -321,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_destroy_and_detach(p_md);\r
                     if( libvlc_exception_raised(&ex) )\r
                     {\r
                         NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -445,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
@@ -466,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -479,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -492,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -505,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -518,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -531,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -544,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -558,7 +558,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
             default:\r
                 ;\r
         }\r
-        libvlc_input_free(p_input);\r
+        libvlc_media_instance_destroy_and_detach(p_md);\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
 }\r
@@ -572,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
@@ -586,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_destroy_and_detach(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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -610,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_destroy_and_detach(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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -633,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_destroy_and_detach(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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -650,7 +650,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
             default:\r
                 ;\r
         }\r
-        libvlc_input_free(p_input);\r
+        libvlc_media_instance_destroy_and_detach(p_md);\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
 }\r
@@ -1813,7 +1813,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
@@ -1825,8 +1825,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1838,8 +1838,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1851,8 +1851,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1864,8 +1864,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1880,8 +1880,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1893,8 +1893,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_destroy_and_detach(p_md);\r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
                     NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1908,7 +1908,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
                 return INVOKERESULT_NO_ERROR;\r
             }\r
         }\r
-        libvlc_input_free(p_input);\r
+        libvlc_media_instance_destroy_and_detach(p_md);\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
 }\r
@@ -1922,7 +1922,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
@@ -1936,13 +1936,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_destroy_and_detach(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_destroy_and_detach(p_md);\r
 \r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
@@ -1958,20 +1958,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_destroy_and_detach(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_destroy_and_detach(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_destroy_and_detach(p_md);\r
 \r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
@@ -1985,9 +1985,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_destroy_and_detach(p_md);\r
                     if( libvlc_exception_raised(&ex) )\r
                     {\r
                         NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -1996,7 +1996,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
                     }\r
                     return INVOKERESULT_NO_ERROR;\r
                 }\r
-                libvlc_input_free(p_input);\r
+                libvlc_media_instance_destroy_and_detach(p_md);\r
                 return INVOKERESULT_INVALID_VALUE;\r
             }\r
             case ID_video_crop:\r
@@ -2005,20 +2005,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_destroy_and_detach(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_destroy_and_detach(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_destroy_and_detach(p_md);\r
 \r
                 if( libvlc_exception_raised(&ex) )\r
                 {\r
@@ -2029,7 +2029,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
                 return INVOKERESULT_NO_ERROR;\r
             }\r
         }\r
-        libvlc_input_free(p_input);\r
+        libvlc_media_instance_destroy_and_detach(p_md);\r
     }\r
     return INVOKERESULT_GENERIC_ERROR;\r
 }\r
@@ -2055,7 +2055,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
@@ -2068,8 +2068,8 @@ 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_destroy_and_detach(p_md);\r
                     if( libvlc_exception_raised(&ex) )\r
                     {\r
                         NPN_SetException(this, libvlc_exception_get_message(&ex));\r
@@ -2084,7 +2084,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