]> git.sesse.net Git - vlc/blobdiff - projects/mozilla/vlcshell.cpp
Support H.264 SEI recovery points.
[vlc] / projects / mozilla / vlcshell.cpp
index 9d45abde955e8fce598b3df211c5687b7d0b647b..829ae7a5da3de60cb804dcad00420dbf83defa36 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 
-/* Mozilla stuff */
-#ifdef HAVE_MOZILLA_CONFIG_H
-#   include <mozilla-config.h>
-#endif
-
-/* This is from mozilla java, do we really need it? */
-#if 0
-#include <jri.h>
-#endif
-
 #include "vlcplugin.h"
 #include "vlcshell.h"
 
@@ -115,7 +105,7 @@ NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
     VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
     if( NULL == p_plugin )
     {
-        // plugin has not been initialized yet !
+        /* plugin has not been initialized yet ! */
         return NPERR_INVALID_INSTANCE_ERROR;
     }
 
@@ -154,7 +144,7 @@ NPError NPP_SetValue( NPP instance, NPNVariable variable, void *value )
  * Mac-only API calls
  *****************************************************************************/
 #ifdef XP_MACOSX
-int16 NPP_HandleEvent( NPP instance, void * event )
+int16_t NPP_HandleEvent( NPP instance, void * event )
 {
     static UInt32 lastMouseUp = 0;
     if( instance == NULL )
@@ -168,6 +158,7 @@ int16 NPP_HandleEvent( NPP instance, void * event )
         return false;
     }
 
+#ifndef __x86_64__  
     EventRecord *myEvent = (EventRecord*)event;
 
     switch( myEvent->what )
@@ -199,26 +190,25 @@ int16 NPP_HandleEvent( NPP instance, void * event )
 
                 if( p_plugin->playlist_isplaying() )
                 {
-                    hasVout = p_plugin->player_has_vout(NULL);
+                    hasVout = p_plugin->player_has_vout();
+#if 0
                     if( hasVout )
                     {
-#ifdef NOT_WORKING
                         libvlc_rectangle_t area;
                         area.left = 0;
                         area.top = 0;
                         area.right = npwindow.width;
                         area.bottom = npwindow.height;
                         libvlc_video_redraw_rectangle(p_plugin->getMD(), &area, NULL);
+                    }
 #else
 #warning disabled code
 #endif
-                    }
                 }
 
                 if( ! hasVout )
                 {
-                    /* draw the beautiful "No Picture" */
-
+                    /* draw the text from p_plugin->psz_text */
                     ForeColor(blackColor);
                     PenMode( patCopy );
 
@@ -260,6 +250,7 @@ int16 NPP_HandleEvent( NPP instance, void * event )
         default:
             ;
     }
+#endif // __x86_64__
     return false;
 }
 #endif /* XP_MACOSX */
@@ -272,17 +263,24 @@ NPError NPP_Initialize( void )
     return NPERR_NO_ERROR;
 }
 
+#ifdef OJI
 jref NPP_GetJavaClass( void )
 {
     return NULL;
 }
+#endif
 
 void NPP_Shutdown( void )
 {
     ;
 }
 
-NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
+NPError NPP_New( NPMIMEType pluginType, NPP instance,
+#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
+                 uint16 mode, int16 argc,
+#else
+                 uint16_t mode, int16_t argc,
+#endif
                  char* argn[], char* argv[], NPSavedData* saved )
 {
     NPError status;
@@ -408,7 +406,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
         libvlc_video_set_viewport(p_vlc, p_plugin->getMD(), &view, &clip);
 #else
 #warning disabled code
-#endif        
+#endif
         /* remember new window */
         p_plugin->setWindow(*window);
     }
@@ -553,7 +551,11 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
 }
 
 NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream *stream,
+#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
                        NPBool seekable, uint16 *stype )
+#else
+                       NPBool seekable, uint16_t *stype )
+#endif
 {
     if( NULL == instance  )
     {
@@ -582,14 +584,23 @@ NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream *stream,
     return NPERR_GENERIC_ERROR;
 }
 
+#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
 int32 NPP_WriteReady( NPP instance, NPStream *stream )
+#else
+int32_t NPP_WriteReady( NPP instance, NPStream *stream )
+#endif
 {
     /* TODO */
     return 8*1024;
 }
 
+#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
 int32 NPP_Write( NPP instance, NPStream *stream, int32 offset,
                  int32 len, void *buffer )
+#else
+int32_t NPP_Write( NPP instance, NPStream *stream, int32_t offset,
+                 int32_t len, void *buffer )
+#endif
 {
     /* TODO */
     return len;
@@ -830,7 +841,8 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
             case clicked_Mute:
             case clicked_Unmute:
             {
-                libvlc_audio_toggle_mute( p_md );
+                if( p_md )
+                    libvlc_audio_toggle_mute( p_md );
             }
             break;