* mozilla plugin on MacOSX. Not fully implemented yet.

* compiled with mozilla 1.4 (won't probably work with <1.4)
 * TODO:
 *     - make XPCOM work (play,pause,stop buttons)
 *     - fullscreen implementation (quite difficult on MacOSX because only
 *       the main thread can create windows)
This commit is contained in:
Simon Latapie 2003-08-14 12:38:04 +00:00
parent 10afbf8357
commit d86fd15629
15 changed files with 527 additions and 228 deletions

Binary file not shown.

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Vlc Plugin</string>
<key>CFBundleIdentifier</key>
<string>com.netscape.vlc</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>NSPL</string>
<key>CFBundleSignature</key>
<string>MOSS</string>
<key>CFBundleVersion</key>
<string>0.12</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PBXProjectSourcePath</key>
<string>/Users/garf/cavapasmerder/VlcPlugin.pbproj</string>
</dict>
</plist>

View File

@ -2,7 +2,7 @@
* vout.h: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.h,v 1.11 2003/05/01 01:11:17 hartman Exp $
* $Id: vout.h,v 1.12 2003/08/14 12:38:03 garf Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
@ -81,10 +81,15 @@ struct vout_sys_t
#ifdef __QUICKTIME__
CodecType i_codec;
CGrafPtr p_qdport;
CGrafPtr p_qdportold;
ImageSequence i_seq;
MatrixRecordPtr p_matrix;
DecompressorComponent img_dc;
ImageDescriptionHandle h_img_descr;
Ptr p_fullscreen_state;
RgnHandle mask;
int portx;
int porty;
int isplugin;
#endif
};

View File

@ -1,8 +1,8 @@
/*****************************************************************************
* vout.m: MacOS X video output plugin
/* vout.m: MacOS X video output plugin
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m,v 1.50 2003/06/03 23:17:43 massiot Exp $
* $Id: vout.m,v 1.51 2003/08/14 12:38:03 garf Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
@ -51,6 +51,7 @@ struct picture_sys_t
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int vout_Init ( vout_thread_t * );
static void vout_End ( vout_thread_t * );
static int vout_Manage ( vout_thread_t * );
@ -79,6 +80,9 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
vout_thread_t * p_vout = (vout_thread_t *)p_this;
OSErr err;
int i_timeout;
vlc_value_t value_drawable;
var_Get( p_vout->p_vlc, "drawable", &value_drawable );
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
@ -89,41 +93,46 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
/* Wait for a MacOS X interface to appear. Timeout is 2 seconds. */
for( i_timeout = 20 ; i_timeout-- ; )
/* We don't need an intf in mozilla plugin */
if( value_drawable.i_int == 0 )
{
if( NSApp == NULL )
/* Wait for a MacOS X interface to appear. Timeout is 2 seconds. */
for( i_timeout = 20 ; i_timeout-- ; )
{
msleep( INTF_IDLE_SLEEP );
}
}
if( NSApp == NULL )
{
/* no MacOS X intf, unable to communicate with MT */
msg_Err( p_vout, "no MacOS X interface present" );
free( p_vout->p_sys );
return( 1 );
}
if( [NSApp respondsToSelector: @selector(getIntf)] )
{
intf_thread_t * p_intf;
for( i_timeout = 10 ; i_timeout-- ; )
{
if( ( p_intf = [NSApp getIntf] ) == NULL )
if( NSApp == NULL )
{
msleep( INTF_IDLE_SLEEP );
}
}
if( p_intf == NULL )
if( NSApp == NULL )
{
msg_Err( p_vout, "MacOS X intf has getIntf, but is NULL" );
/* no MacOS X intf, unable to communicate with MT */
msg_Err( p_vout, "no MacOS X interface present" );
free( p_vout->p_sys );
return( 1 );
}
if( [NSApp respondsToSelector: @selector(getIntf)] )
{
intf_thread_t * p_intf;
for( i_timeout = 10 ; i_timeout-- ; )
{
if( ( p_intf = [NSApp getIntf] ) == NULL )
{
msleep( INTF_IDLE_SLEEP );
}
}
if( p_intf == NULL )
{
msg_Err( p_vout, "MacOS X intf has getIntf, but is NULL" );
free( p_vout->p_sys );
return( 1 );
}
}
}
p_vout->p_sys->h_img_descr =
@ -135,6 +144,17 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
p_vout->p_sys->b_mouse_moved = YES;
p_vout->p_sys->i_time_mouse_last_moved = mdate();
if( value_drawable.i_int != 0 )
{
p_vout->p_sys->mask = NewRgn();
p_vout->p_sys->isplugin = 1 ;
} else
{
p_vout->p_sys->mask = NULL;
p_vout->p_sys->isplugin = 0 ;
}
/* set window size */
p_vout->p_sys->s_rect.size.width = p_vout->i_window_width;
p_vout->p_sys->s_rect.size.height = p_vout->i_window_height;
@ -219,13 +239,17 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
}
[o_pool release];
if( CoCreateWindow( p_vout ) )
/* We don't need a window either in the mozilla plugin */
if( p_vout->p_sys->isplugin == 0 )
{
msg_Err( p_vout, "unable to create window" );
free( p_vout->p_sys->p_matrix );
DisposeHandle( (Handle)p_vout->p_sys->h_img_descr );
free( p_vout->p_sys );
return( 1 );
if( CoCreateWindow( p_vout ) )
{
msg_Err( p_vout, "unable to create window" );
free( p_vout->p_sys->p_matrix );
DisposeHandle( (Handle)p_vout->p_sys->h_img_descr );
free( p_vout->p_sys );
return( 1 );
}
}
p_vout->pf_init = vout_Init;
@ -244,6 +268,7 @@ static int vout_Init( vout_thread_t *p_vout )
{
int i_index;
picture_t *p_pic;
vlc_value_t val;
I_OUTPUTPICTURES = 0;
@ -254,6 +279,13 @@ static int vout_Init( vout_thread_t *p_vout )
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
var_Get( p_vout->p_vlc, "drawable", &val );
if( p_vout->p_sys->isplugin )
{
p_vout->p_sys->p_qdport = val.i_int;
}
SetPort( p_vout->p_sys->p_qdport );
QTScaleMatrix( p_vout );
@ -317,11 +349,14 @@ static void vout_End( vout_thread_t *p_vout )
*****************************************************************************/
void E_(CloseVideo) ( vlc_object_t *p_this )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
vout_thread_t * p_vout = (vout_thread_t *)p_this;
if( CoDestroyWindow( p_vout ) )
if ( p_vout->p_sys->isplugin == 0)
{
msg_Err( p_vout, "unable to destroy window" );
if( CoDestroyWindow( p_vout ) )
{
msg_Err( p_vout, "unable to destroy window" );
}
}
if ( p_vout->p_sys->p_fullscreen_state != NULL )
@ -343,6 +378,9 @@ void E_(CloseVideo) ( vlc_object_t *p_this )
*****************************************************************************/
static int vout_Manage( vout_thread_t *p_vout )
{
vlc_value_t val1;
var_Get( p_vout->p_vlc, "drawableredraw", &val1 );
if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
{
if( CoToggleFullscreen( p_vout ) )
@ -353,13 +391,21 @@ static int vout_Manage( vout_thread_t *p_vout )
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
if( p_vout->i_changes & VOUT_SIZE_CHANGE )
if( (p_vout->i_changes & VOUT_SIZE_CHANGE) || (val1.i_int == 1))
{
if (val1.i_int == 1)
{
val1.i_int = 0;
var_Set( p_vout->p_vlc, "drawableredraw", val1 );
SetDSequenceMask( p_vout->p_sys->i_seq , p_vout->p_sys->mask );
} else if (p_vout->i_changes & VOUT_SIZE_CHANGE)
{
p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
}
QTScaleMatrix( p_vout );
SetDSequenceMatrix( p_vout->p_sys->i_seq,
p_vout->p_sys->p_matrix );
p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
}
/* hide/show mouse cursor
@ -421,17 +467,45 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
OSErr err;
CodecFlags flags;
if( ( err = DecompressSequenceFrameS(
p_vout->p_sys->i_seq,
p_pic->p_sys->p_info,
p_pic->p_sys->i_size,
codecFlagUseImageBuffer, &flags, nil ) != noErr ) )
if( p_vout->p_sys->isplugin )
{
msg_Warn( p_vout, "DecompressSequenceFrameS failed: %d", err );
/* In mozilla plugin, mozilla browser also draws things in
* the windows. So we have to update the port/Origin for each
* picture. FIXME : the vout should lock something ! */
GetPort( &p_vout->p_sys->p_qdportold );
SetPort( p_vout->p_sys->p_qdport );
SetOrigin( p_vout->p_sys->portx , p_vout->p_sys->porty );
if( ( err = DecompressSequenceFrameS(
p_vout->p_sys->i_seq,
p_pic->p_sys->p_info,
p_pic->p_sys->i_size,
codecFlagUseImageBuffer, &flags, nil ) != noErr ) )
{
msg_Warn( p_vout, "DecompressSequenceFrameS failed: %d", err );
}
else
{
QDFlushPortBuffer( p_vout->p_sys->p_qdport, nil );
}
SetPort( p_vout->p_sys->p_qdportold );
}
else
{
QDFlushPortBuffer( p_vout->p_sys->p_qdport, nil );
{
if( ( err = DecompressSequenceFrameS(
p_vout->p_sys->i_seq,
p_pic->p_sys->p_info,
p_pic->p_sys->i_size,
codecFlagUseImageBuffer, &flags, nil ) != noErr ) )
{
msg_Warn( p_vout, "DecompressSequenceFrameS failed: %d", err );
}
else
{
QDFlushPortBuffer( p_vout->p_sys->p_qdport, nil );
}
}
}
@ -518,9 +592,6 @@ static int CoToggleFullscreen( vout_thread_t *p_vout )
return( 1 );
}
SetPort( p_vout->p_sys->p_qdport );
QTScaleMatrix( p_vout );
if( QTCreateSequence( p_vout ) )
{
msg_Err( p_vout, "unable to create sequence" );
@ -572,12 +643,45 @@ static void QTScaleMatrix( vout_thread_t *p_vout )
Fixed factor_x, factor_y;
unsigned int i_offset_x = 0;
unsigned int i_offset_y = 0;
vlc_value_t val;
vlc_value_t valt;
vlc_value_t vall;
vlc_value_t valb;
vlc_value_t valr;
vlc_value_t valx;
vlc_value_t valy;
vlc_value_t valw;
vlc_value_t valh;
vlc_value_t valportx;
vlc_value_t valporty;
GetPortBounds( p_vout->p_sys->p_qdport, &s_rect );
i_width = s_rect.right - s_rect.left;
i_height = s_rect.bottom - s_rect.top;
var_Get( p_vout->p_vlc, "drawable", &val );
var_Get( p_vout->p_vlc, "drawablet", &valt );
var_Get( p_vout->p_vlc, "drawablel", &vall );
var_Get( p_vout->p_vlc, "drawableb", &valb );
var_Get( p_vout->p_vlc, "drawabler", &valr );
var_Get( p_vout->p_vlc, "drawablex", &valx );
var_Get( p_vout->p_vlc, "drawabley", &valy );
var_Get( p_vout->p_vlc, "drawablew", &valw );
var_Get( p_vout->p_vlc, "drawableh", &valh );
var_Get( p_vout->p_vlc, "drawableportx", &valportx );
var_Get( p_vout->p_vlc, "drawableporty", &valporty );
if( p_vout->p_sys->isplugin )
{
p_vout->p_sys->portx = valportx.i_int;
p_vout->p_sys->porty = valporty.i_int;
p_vout->p_sys->p_qdport = val.i_int;
i_width = valw.i_int;
i_height = valh.i_int;
SetRectRgn( p_vout->p_sys->mask , 0 , 0 , valr.i_int - vall.i_int , valb.i_int - valt.i_int );
}
if( i_height * p_vout->output.i_aspect < i_width * VOUT_ASPECT_FACTOR )
{
int i_adj_width = i_height * p_vout->output.i_aspect /
@ -588,7 +692,7 @@ static void QTScaleMatrix( vout_thread_t *p_vout )
factor_y = FixDiv( Long2Fix( i_height ),
Long2Fix( p_vout->output.i_height ) );
i_offset_x = (i_width - i_adj_width) / 2;
i_offset_x = (i_width - i_adj_width) / 2 + i_offset_x;
}
else
{
@ -600,7 +704,7 @@ static void QTScaleMatrix( vout_thread_t *p_vout )
factor_y = FixDiv( Long2Fix( i_adj_height ),
Long2Fix( p_vout->output.i_height ) );
i_offset_y = (i_height - i_adj_height) / 2;
i_offset_y = (i_height - i_adj_height) / 2 + i_offset_y;
}
SetIdentityMatrix( p_vout->p_sys->p_matrix );
@ -612,6 +716,7 @@ static void QTScaleMatrix( vout_thread_t *p_vout )
TranslateMatrix( p_vout->p_sys->p_matrix,
Long2Fix(i_offset_x),
Long2Fix(i_offset_y) );
}
/*****************************************************************************
@ -642,8 +747,10 @@ static int QTCreateSequence( vout_thread_t *p_vout )
p_descr->dataSize = 0;
p_descr->depth = 24;
HUnlock( (Handle)p_vout->p_sys->h_img_descr );
if( ( err = DecompressSequenceBeginS(
&p_vout->p_sys->i_seq,
p_vout->p_sys->h_img_descr,
@ -651,7 +758,7 @@ static int QTCreateSequence( vout_thread_t *p_vout )
p_vout->p_sys->p_qdport,
NULL, NULL,
p_vout->p_sys->p_matrix,
0, NULL,
0, p_vout->p_sys->mask,
codecFlagUseImageBuffer,
codecLosslessQuality,
p_vout->p_sys->img_dc ) ) )
@ -660,6 +767,7 @@ static int QTCreateSequence( vout_thread_t *p_vout )
return( 1 );
}
return( 0 );
}
@ -810,7 +918,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
newsize.width = (int) ( p_vout->render.i_width * factor );
newsize.height = (int) ( i_corrected_height * factor );
}
[self setContentSize: newsize];
[self setFrameTopLeftPoint: topleftscreen];
@ -1309,12 +1417,14 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
}
o_view = [[VLCView alloc] init];
/* FIXME: [o_view setMenu:] */
[p_vout->p_sys->o_window setContentView: o_view];
[o_view autorelease];
[o_view lockFocus];
p_vout->p_sys->p_qdport = [o_view qdPort];
[o_view unlockFocus];
[p_vout->p_sys->o_window updateTitle];

View File

@ -29,8 +29,13 @@ SOURCES_win32 = support/npwin.cpp
CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
else
if HAVE_DARWIN
# We don't define LIBRARIES_mozilla because we'll be using project builder
SOURCES_macosx = support/npmac.cpp
# We don't define LIBRARIES_mozilla because we'll be using project builder, or not...
BUNDLE_mozilla = VLC\ Plugin.plugin
vlc_moz_FLAGS = `$(VLC_CONFIG) --libs vlc builtin pic mozilla`
moz_CFLAGS = `$(MOZILLA_CONFIG) --cflags plugin java nspr/obsolete nspr oji xpcom xpconnect`
moz_plugin_FLAGS = -c -F/System/Library/Frameworks/CoreFoundation.framework $(moz_CFLAGS) -I/Developer/Headers/FlatCarbon -arch ppc -fno-common -fpascal-strings -O0 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -DXP_MACOSX=1 -DNO_X11=1 -DUSE_SYSTEM_CONSOLE=1 -pipe -fmessage-length=0 -g -include mozilla-config.h
else
LIBRARIES_mozilla = libvlcplugin$(LIBEXT)
SOURCES_unix = support/npunix.c
@ -52,7 +57,7 @@ libplugin_a_DEPENDENCIES = $(DATA_npvlc_rc)
BUILT_SOURCES_mozilla = vlcintf.h
$(SOURCES_mozilla): vlcintf.h
plugin_DATA = $(LIBRARIES_mozilla)
plugin_DATA = $(LIBRARIES_mozilla) $(BUNDLE_mozilla)
plugindir = $(libdir)/mozilla/plugins
$(LIBRARIES_mozilla): $(libplugin_a_OBJECTS) \
$(libplugin_a_DEPENDENCIES) stamp-pic
@ -75,14 +80,29 @@ DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
noinst_npvlc_rcdir = $(libdir)
npvlc_rc.$(OBJEXT): npvlc_rc.rc
$(WINDRES) --include-dir $(srcdir)/mozilla -i $< -o $@
$(WINDRES) --include-dir $(srcdir) -i $< -o $@
endif
if HAVE_DARWIN
VLC\ Plugin.plugin:
rm -rf $(srcdir)/VLC\ Plugin.plugin
mkdir -p $(srcdir)/VLC\ Plugin.plugin/Contents/MacOS
mkdir -p $(srcdir)/VLC\ Plugin.plugin/Contents/Resources
/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcplugin.cpp -o $(srcdir)/libplugin_a-vlcplugin.o
/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcshell.cpp -o $(srcdir)/libplugin_a-vlcshell.o
/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcpeer.cpp -o $(srcdir)/libplugin_a-vlcpeer.o
/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/support/npmac.cpp -o $(srcdir)/libplugin_a-npmac.o
/usr/bin/g++3 $(srcdir)/libplugin_a-vlcplugin.o $(srcdir)/libplugin_a-vlcshell.o $(srcdir)/libplugin_a-vlcpeer.o $(srcdir)/libplugin_a-npmac.o -o $(srcdir)/VLC\ Plugin.plugin/Contents/MacOS/VLC\ Plugin -L/usr/lib -F/System/Library/Frameworks/CoreFoundation.framework -framework CoreFoundation -arch ppc -bundle -read_only_relocs suppress $(top_srcdir)/lib/libvlc_pic.a -dylib $(vlc_moz_FLAGS)
cp $(top_srcdir)/extras/MacOSX/plugin/Info.plist $(srcdir)/VLC\ Plugin.plugin/Contents/Info.plist
cp $(top_srcdir)/extras/MacOSX/plugin/pbdevelopment.plist $(srcdir)/VLC\ Plugin.plugin/Contents/pbdevelopment.plist
cp -r $(top_srcdir)/extras/MacOSX/plugin/English.lproj $(srcdir)/VLC\ Plugin.plugin/Contents/Resources/
Rez /Developer/Headers/FlatCarbon/Types.r $(srcdir)/vlc.r -o $(srcdir)/VLC\ Plugin.plugin/Contents/Resources/Vlc\ Plugin.rsrc
endif
endif
###############################################################################
# Stamp rules
###############################################################################
clean: clean-stamp
clean: clean-stamp clean-bundle
clean-stamp:
rm -f stamp-pic
@ -95,6 +115,9 @@ stamp-pic: FORCE
done
@if test ! -f $@; then printf "" > $@; fi
clean-bundle:
rm -rf $(srcdir)/VLC\ Plugin.plugin
###############################################################################
# Force rule
###############################################################################

View File

@ -1,45 +1,11 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
// npmac.cpp
//
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#include <string.h>
#include <Processes.h>
#include <Gestalt.h>
#include <CodeFragments.h>
@ -48,26 +14,23 @@
#include <ToolUtils.h>
#define XP_MAC 1
#define NDEBUG 1
//
// A4Stuff.h contains the definition of EnterCodeResource and
// EnterCodeResource, used for setting up the code resource¹s
// EnterCodeResource, used for setting up the code resourceÕs
// globals for 68K (analagous to the function SetCurrentA5
// defined by the toolbox).
//
// A4Stuff does not exist as of CW 7. Define them to nothing.
//
#if defined(XP_MACOSX) || (defined(__MWERKS__) && (__MWERKS__ >= 0x2400))
#if (defined(__MWERKS__) && (__MWERKS__ >= 0x2400)) || defined(__GNUC__)
#define EnterCodeResource()
#define ExitCodeResource()
#else
#include <A4Stuff.h>
#endif
#include "nscore.h"
#include "jri.h"
#include "npapi.h"
//
@ -94,7 +57,7 @@
#endif
#endif
// The following fix for static initializers (which fixes a preious
// The following fix for static initializers (which fixes a previous
// incompatibility with some parts of PowerPlant, was submitted by
// Jan Ulbrich.
#ifdef __MWERKS__
@ -117,7 +80,7 @@
// Define PLUGIN_TRACE to 1 to have the wrapper functions emit
// DebugStr messages whenever they are called.
//
#define PLUGIN_TRACE 0
//#define PLUGIN_TRACE 1
#if PLUGIN_TRACE
#define PLUGINDEBUGSTR(msg) ::DebugStr(msg)
@ -126,8 +89,91 @@
#endif
#ifdef XP_MACOSX
// glue for mapping outgoing Macho function pointers to TVectors
struct TFPtoTVGlue{
void* glue[2];
};
struct {
TFPtoTVGlue newp;
TFPtoTVGlue destroy;
TFPtoTVGlue setwindow;
TFPtoTVGlue newstream;
TFPtoTVGlue destroystream;
TFPtoTVGlue asfile;
TFPtoTVGlue writeready;
TFPtoTVGlue write;
TFPtoTVGlue print;
TFPtoTVGlue event;
TFPtoTVGlue urlnotify;
TFPtoTVGlue getvalue;
TFPtoTVGlue setvalue;
TFPtoTVGlue shutdown;
} gPluginFuncsGlueTable;
static inline void* SetupFPtoTVGlue(TFPtoTVGlue* functionGlue, void* fp)
{
functionGlue->glue[0] = fp;
functionGlue->glue[1] = 0;
return functionGlue;
}
#define PLUGIN_TO_HOST_GLUE(name, fp) (SetupFPtoTVGlue(&gPluginFuncsGlueTable.name, (void*)fp))
// glue for mapping netscape TVectors to Macho function pointers
struct TTVtoFPGlue {
uint32 glue[6];
};
struct {
TTVtoFPGlue geturl;
TTVtoFPGlue posturl;
TTVtoFPGlue requestread;
TTVtoFPGlue newstream;
TTVtoFPGlue write;
TTVtoFPGlue destroystream;
TTVtoFPGlue status;
TTVtoFPGlue uagent;
TTVtoFPGlue memalloc;
TTVtoFPGlue memfree;
TTVtoFPGlue memflush;
TTVtoFPGlue reloadplugins;
TTVtoFPGlue getJavaEnv;
TTVtoFPGlue getJavaPeer;
TTVtoFPGlue geturlnotify;
TTVtoFPGlue posturlnotify;
TTVtoFPGlue getvalue;
TTVtoFPGlue setvalue;
TTVtoFPGlue invalidaterect;
TTVtoFPGlue invalidateregion;
TTVtoFPGlue forceredraw;
} gNetscapeFuncsGlueTable;
static void* SetupTVtoFPGlue(TTVtoFPGlue* functionGlue, void* tvp)
{
static const TTVtoFPGlue glueTemplate = { 0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420 };
memcpy(functionGlue, &glueTemplate, sizeof(TTVtoFPGlue));
functionGlue->glue[0] |= ((UInt32)tvp >> 16);
functionGlue->glue[1] |= ((UInt32)tvp & 0xFFFF);
::MakeDataExecutable(functionGlue, sizeof(TTVtoFPGlue));
return functionGlue;
}
#define HOST_TO_PLUGIN_GLUE(name, fp) (SetupTVtoFPGlue(&gNetscapeFuncsGlueTable.name, (void*)fp))
#else
#define PLUGIN_TO_HOST_GLUE(name, fp) (fp)
#define HOST_TO_PLUGIN_GLUE(name, fp) (fp)
#endif /* XP_MACOSX */
#pragma mark -
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@ -136,13 +182,12 @@
//
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#if !OPAQUE_TOOLBOX_STRUCTS || !TARGET_API_MAC_CARBON
QDGlobals* gQDPtr; // Pointer to Netscape¹s QuickDraw globals
#if !TARGET_API_MAC_CARBON
QDGlobals* gQDPtr; // Pointer to NetscapeÕs QuickDraw globals
#endif
short gResFile; // Refnum of the plugin¹s resource file
short gResFile; // Refnum of the pluginÕs resource file
NPNetscapeFuncs gNetscapeFuncs; // Function table for procs in Netscape called by plugin
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
// Wrapper functions for all calls from the plugin to Netscape.
@ -267,24 +312,14 @@ const char* NPN_UserAgent(NPP instance)
return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance);
}
#define DEBUG_MEMORY 0
void* NPN_MemAlloc(uint32 size)
{
#if DEBUG_MEMORY
return (void*) NewPtrClear(size);
#else
return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
#endif
}
void NPN_MemFree(void* ptr)
{
#if DEBUG_MEMORY
DisposePtr(Ptr(ptr));
#else
CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
#endif
}
uint32 NPN_MemFlush(uint32 size)
@ -297,16 +332,17 @@ void NPN_ReloadPlugins(NPBool reloadPages)
CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages);
}
#ifdef OJI
JRIEnv* NPN_GetJavaEnv(void)
{
return CallNPN_GetJavaEnvProc( gNetscapeFuncs.getJavaEnv );
}
jref NPN_GetJavaPeer(NPP instance)
jobject NPN_GetJavaPeer(NPP instance)
{
return CallNPN_GetJavaPeerProc( gNetscapeFuncs.getJavaPeer, instance );
}
#endif
NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value)
{
@ -333,6 +369,8 @@ void NPN_ForceRedraw(NPP instance)
CallNPN_ForceRedrawProc( gNetscapeFuncs.forceredraw, instance);
}
#pragma mark -
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
// Wrapper functions for all calls from Netscape to the plugin.
@ -356,7 +394,7 @@ void Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
void Private_Print(NPP instance, NPPrint* platformPrint);
int16 Private_HandleEvent(NPP instance, void* event);
void Private_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData);
jref Private_GetJavaClass(void);
jobject Private_GetJavaClass(void);
NPError Private_Initialize(void)
@ -375,7 +413,7 @@ void Private_Shutdown(void)
PLUGINDEBUGSTR("\pShutdown;g;");
NPP_Shutdown();
#ifndef XP_MACOSX
#ifdef __MWERKS__
__destroy_global_chain();
#endif
@ -487,49 +525,51 @@ void Private_URLNotify(NPP instance, const char* url, NPReason reason, void* not
ExitCodeResource();
}
jref Private_GetJavaClass(void)
#ifdef OJI
jobject Private_GetJavaClass(void)
{
EnterCodeResource();
PLUGINDEBUGSTR("\pGetJavaClass;g;");
jref clazz = NPP_GetJavaClass();
jobject clazz = NPP_GetJavaClass();
ExitCodeResource();
if (clazz)
{
JRIEnv* env = NPN_GetJavaEnv();
return (jref)JRI_NewGlobalRef(env, clazz);
return (jobject)JRI_NewGlobalRef(env, clazz);
}
return NULL;
}
#endif
void SetUpQD(void);
void SetUpQD(void)
{
#if !OPAQUE_TOOLBOX_STRUCTS || !TARGET_API_MAC_CARBON
#if !TARGET_API_MAC_CARBON
ProcessSerialNumber PSN;
FSSpec myFSSpec;
Str63 name;
ProcessInfoRec infoRec;
OSErr result = noErr;
CFragConnectionID connID;
CFragConnectionID connID;
Str255 errName;
#endif
//
// Memorize the plugin¹s resource file
// Memorize the pluginÕs resource file
// refnum for later use.
//
gResFile = CurResFile();
#if !TARGET_API_MAC_CARBON
//
// Ask the system if CFM is available.
//
long response;
OSErr err = Gestalt(gestaltCFMAttr, &response);
Boolean hasCFM = BitTst(&response, 31-gestaltCFMPresent);
ProcessInfoRec infoRec;
if (hasCFM)
{
//
@ -537,10 +577,13 @@ void SetUpQD(void)
// will give us back the name and FSSpec of the application.
// See the Process Manager in IM.
//
Str63 name;
FSSpec myFSSpec;
infoRec.processInfoLength = sizeof(ProcessInfoRec);
infoRec.processName = name;
infoRec.processAppSpec = &myFSSpec;
ProcessSerialNumber PSN;
PSN.highLongOfPSN = 0;
PSN.lowLongOfPSN = kCurrentProcess;
@ -554,30 +597,33 @@ void SetUpQD(void)
//
result = -1;
CFragConnectionID connID;
if (result == noErr)
{
//
// Now that we know the app name and FSSpec, we can call GetDiskFragment
// to get a connID to use in a subsequent call to FindSymbol (it will also
// return the address of ³main² in app, which we ignore). If GetDiskFragment
// return the address of ÒmainÓ in app, which we ignore). If GetDiskFragment
// returns an error, we assume the app must be 68K.
//
Ptr mainAddr;
Str255 errName;
result = GetDiskFragment(infoRec.processAppSpec, 0L, 0L, infoRec.processName,
kReferenceCFrag, &connID, (Ptr*)&mainAddr, errName);
kLoadCFrag, &connID, (Ptr*)&mainAddr, errName);
}
if (result == noErr)
{
//
// The app is a PPC code fragment, so call FindSymbol
// to get the exported ³qd² symbol so we can access its
// to get the exported ÒqdÓ symbol so we can access its
// QuickDraw globals.
//
CFragSymbolClass symClass;
result = FindSymbol(connID, "\pqd", (Ptr*)&gQDPtr, &symClass);
if (result != noErr)
PLUGINDEBUGSTR("\pFailed in FindSymbol qd");
if (result != noErr) { // this fails if we are in NS 6
gQDPtr = &qd; // so we default to the standard QD globals
}
}
else
{
@ -591,33 +637,34 @@ void SetUpQD(void)
}
#if TARGET_RT_MAC_CFM && !TARGET_API_MAC_CARBON
NPError
#ifdef __GNUC__
// gcc requires that main have an 'int' return type
int main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp);
#else
int
NPError main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp);
#endif
main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp);
#if !TARGET_API_MAC_CARBON
#pragma export on
#if TARGET_RT_MAC_CFM && !TARGET_API_MAC_CARBON
#if GENERATINGCFM
RoutineDescriptor mainRD = BUILD_ROUTINE_DESCRIPTOR(uppNPP_MainEntryProcInfo, main);
#endif
#pragma export off
#endif /* !TARGET_API_MAC_CARBON */
#if TARGET_RT_MAC_CFM && !TARGET_API_MAC_CARBON
NPError
#ifdef __GNUC__
DEFINE_API_C(int) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp)
#else
int
DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp)
#endif
main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp)
{
EnterCodeResource();
PLUGINDEBUGSTR("\pmain");
#ifdef __MWERKS__
__InitCode__();
#endif
NPError err = NPERR_NO_ERROR;
//
@ -627,27 +674,23 @@ main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unlo
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.
// Check the ÒmajorÓ version passed in NetscapeÕs function table.
// We wonÕt load if the major version is newer than what we expect.
// Also check that the function tables passed in are big enough for
// all the functions we need (they could be bigger, if Netscape added
// new APIs, but that¹s OK with us -- we¹ll just ignore them).
// new APIs, but thatÕs OK with us -- weÕll just ignore them).
//
if (err == NPERR_NO_ERROR)
{
if ((nsTable->version >> 8) > NP_VERSION_MAJOR) // Major version is in high byte
err = NPERR_INCOMPATIBLE_VERSION_ERROR;
// if (nsTable->size < sizeof(NPNetscapeFuncs))
// err = NPERR_INVALID_FUNCTABLE_ERROR;
// if (pluginFuncs->size < sizeof(NPPluginFuncs))
// err = NPERR_INVALID_FUNCTABLE_ERROR;
}
if (err == NPERR_NO_ERROR)
{
//
// Copy all the fields of Netscape¹s function table into our
// Copy all the fields of NetscapeÕs function table into our
// copy so we can call back into Netscape later. Note that
// we need to copy the fields one by one, rather than assigning
// the whole structure, because the Netscape function table
@ -656,67 +699,67 @@ main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unlo
int navMinorVers = nsTable->version & 0xFF;
gNetscapeFuncs.version = nsTable->version;
gNetscapeFuncs.size = nsTable->size;
gNetscapeFuncs.posturl = nsTable->posturl;
gNetscapeFuncs.geturl = nsTable->geturl;
gNetscapeFuncs.requestread = nsTable->requestread;
gNetscapeFuncs.newstream = nsTable->newstream;
gNetscapeFuncs.write = nsTable->write;
gNetscapeFuncs.destroystream = nsTable->destroystream;
gNetscapeFuncs.status = nsTable->status;
gNetscapeFuncs.uagent = nsTable->uagent;
gNetscapeFuncs.memalloc = nsTable->memalloc;
gNetscapeFuncs.memfree = nsTable->memfree;
gNetscapeFuncs.memflush = nsTable->memflush;
gNetscapeFuncs.reloadplugins = nsTable->reloadplugins;
gNetscapeFuncs.version = nsTable->version;
gNetscapeFuncs.size = nsTable->size;
gNetscapeFuncs.posturl = (NPN_PostURLUPP)HOST_TO_PLUGIN_GLUE(posturl, nsTable->posturl);
gNetscapeFuncs.geturl = (NPN_GetURLUPP)HOST_TO_PLUGIN_GLUE(geturl, nsTable->geturl);
gNetscapeFuncs.requestread = (NPN_RequestReadUPP)HOST_TO_PLUGIN_GLUE(requestread, nsTable->requestread);
gNetscapeFuncs.newstream = (NPN_NewStreamUPP)HOST_TO_PLUGIN_GLUE(newstream, nsTable->newstream);
gNetscapeFuncs.write = (NPN_WriteUPP)HOST_TO_PLUGIN_GLUE(write, nsTable->write);
gNetscapeFuncs.destroystream = (NPN_DestroyStreamUPP)HOST_TO_PLUGIN_GLUE(destroystream, nsTable->destroystream);
gNetscapeFuncs.status = (NPN_StatusUPP)HOST_TO_PLUGIN_GLUE(status, nsTable->status);
gNetscapeFuncs.uagent = (NPN_UserAgentUPP)HOST_TO_PLUGIN_GLUE(uagent, nsTable->uagent);
gNetscapeFuncs.memalloc = (NPN_MemAllocUPP)HOST_TO_PLUGIN_GLUE(memalloc, nsTable->memalloc);
gNetscapeFuncs.memfree = (NPN_MemFreeUPP)HOST_TO_PLUGIN_GLUE(memfree, nsTable->memfree);
gNetscapeFuncs.memflush = (NPN_MemFlushUPP)HOST_TO_PLUGIN_GLUE(memflush, nsTable->memflush);
gNetscapeFuncs.reloadplugins = (NPN_ReloadPluginsUPP)HOST_TO_PLUGIN_GLUE(reloadplugins, nsTable->reloadplugins);
if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
{
gNetscapeFuncs.getJavaEnv = nsTable->getJavaEnv;
gNetscapeFuncs.getJavaPeer = nsTable->getJavaPeer;
gNetscapeFuncs.getJavaEnv = (NPN_GetJavaEnvUPP)HOST_TO_PLUGIN_GLUE(getJavaEnv, nsTable->getJavaEnv);
gNetscapeFuncs.getJavaPeer = (NPN_GetJavaPeerUPP)HOST_TO_PLUGIN_GLUE(getJavaPeer, nsTable->getJavaPeer);
}
if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
{
gNetscapeFuncs.geturlnotify = nsTable->geturlnotify;
gNetscapeFuncs.posturlnotify = nsTable->posturlnotify;
gNetscapeFuncs.geturlnotify = (NPN_GetURLNotifyUPP)HOST_TO_PLUGIN_GLUE(geturlnotify, nsTable->geturlnotify);
gNetscapeFuncs.posturlnotify = (NPN_PostURLNotifyUPP)HOST_TO_PLUGIN_GLUE(posturlnotify, nsTable->posturlnotify);
}
gNetscapeFuncs.getvalue = nsTable->getvalue;
gNetscapeFuncs.setvalue = nsTable->setvalue;
gNetscapeFuncs.invalidaterect = nsTable->invalidaterect;
gNetscapeFuncs.invalidateregion = nsTable->invalidateregion;
gNetscapeFuncs.forceredraw = nsTable->forceredraw;
// defer static constructors until the global functions are initialized.
#ifndef XP_MACOSX
__InitCode__();
#endif
gNetscapeFuncs.getvalue = (NPN_GetValueUPP)HOST_TO_PLUGIN_GLUE(getvalue, nsTable->getvalue);
gNetscapeFuncs.setvalue = (NPN_SetValueUPP)HOST_TO_PLUGIN_GLUE(setvalue, nsTable->setvalue);
gNetscapeFuncs.invalidaterect = (NPN_InvalidateRectUPP)HOST_TO_PLUGIN_GLUE(invalidaterect, nsTable->invalidaterect);
gNetscapeFuncs.invalidateregion = (NPN_InvalidateRegionUPP)HOST_TO_PLUGIN_GLUE(invalidateregion, nsTable->invalidateregion);
gNetscapeFuncs.forceredraw = (NPN_ForceRedrawUPP)HOST_TO_PLUGIN_GLUE(forceredraw, nsTable->forceredraw);
//
// Set up the plugin function table that Netscape will use to
// call us. Netscape needs to know about our version and size
// and have a UniversalProcPointer for every function we implement.
//
pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
pluginFuncs->size = sizeof(NPPluginFuncs);
pluginFuncs->newp = NewNPP_NewProc(Private_New);
pluginFuncs->destroy = NewNPP_DestroyProc(Private_Destroy);
pluginFuncs->setwindow = NewNPP_SetWindowProc(Private_SetWindow);
pluginFuncs->newstream = NewNPP_NewStreamProc(Private_NewStream);
pluginFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream);
pluginFuncs->asfile = NewNPP_StreamAsFileProc(Private_StreamAsFile);
pluginFuncs->writeready = NewNPP_WriteReadyProc(Private_WriteReady);
pluginFuncs->write = NewNPP_WriteProc(Private_Write);
pluginFuncs->print = NewNPP_PrintProc(Private_Print);
pluginFuncs->event = NewNPP_HandleEventProc(Private_HandleEvent);
pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
pluginFuncs->size = sizeof(NPPluginFuncs);
pluginFuncs->newp = NewNPP_NewProc(PLUGIN_TO_HOST_GLUE(newp, Private_New));
pluginFuncs->destroy = NewNPP_DestroyProc(PLUGIN_TO_HOST_GLUE(destroy, Private_Destroy));
pluginFuncs->setwindow = NewNPP_SetWindowProc(PLUGIN_TO_HOST_GLUE(setwindow, Private_SetWindow));
pluginFuncs->newstream = NewNPP_NewStreamProc(PLUGIN_TO_HOST_GLUE(newstream, Private_NewStream));
pluginFuncs->destroystream = NewNPP_DestroyStreamProc(PLUGIN_TO_HOST_GLUE(destroystream, Private_DestroyStream));
pluginFuncs->asfile = NewNPP_StreamAsFileProc(PLUGIN_TO_HOST_GLUE(asfile, Private_StreamAsFile));
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));
if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
{
pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify);
pluginFuncs->urlnotify = NewNPP_URLNotifyProc(PLUGIN_TO_HOST_GLUE(urlnotify, Private_URLNotify));
}
#ifdef OJI
if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
{
pluginFuncs->javaClass = (JRIGlobalRef) Private_GetJavaClass();
}
*unloadUpp = NewNPP_ShutdownProc(Private_Shutdown);
#else
pluginFuncs->javaClass = NULL;
#endif
*unloadUpp = NewNPP_ShutdownProc(PLUGIN_TO_HOST_GLUE(shutdown, Private_Shutdown));
SetUpQD();
err = Private_Initialize();
}

View File

@ -3,7 +3,6 @@
*****************************************************************************/
/* Definitions of system resource types */
#include <Types.r>
/* The first string in the array is a plugin description,
* the second is the plugin name */

View File

@ -2,7 +2,7 @@
* vlcplugin.h: a VLC plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlcplugin.h,v 1.11 2003/07/17 09:25:58 sigmunau Exp $
* $Id: vlcplugin.h,v 1.12 2003/08/14 12:38:03 garf Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
@ -24,6 +24,12 @@
/*******************************************************************************
* Instance state information about the plugin.
******************************************************************************/
/* No, I really don't want to use XP_UNIX stuff on MacOSX */
#ifdef XP_MACOSX
#undef XP_UNIX
#endif
class VlcPlugin
{
public:
@ -53,6 +59,12 @@ public:
Display *p_display;
#endif
#ifdef XP_MACOSX
/* MACOS data members */
NPWindow *window;
#endif
/* vlc data members */
int i_vlc;
int b_stream;

View File

@ -2,7 +2,7 @@
* vlcshell.cpp: a VLC plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlcshell.cpp,v 1.15 2003/07/23 01:13:48 gbazin Exp $
* $Id: vlcshell.cpp,v 1.16 2003/08/14 12:38:03 garf Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
@ -45,14 +45,7 @@
/* Windows stuff */
#endif
#ifdef XP_UNIX
/* X11 stuff */
# include <X11/Xlib.h>
# include <X11/Intrinsic.h>
# include <X11/StringDefs.h>
#endif
#ifdef XP_MAC
#ifdef XP_MACOSX
/* Mac OS X stuff */
# include <QuickDraw.h>
#endif
@ -66,6 +59,18 @@
# define WINDOW_TEXT "(no libvlc)"
#endif
/* No, I really don't want to use XP_UNIX stuff on MacOSX */
#ifdef XP_MACOSX
#undef XP_UNIX
#endif
#ifdef XP_UNIX
/* X11 stuff */
# include <X11/Xlib.h>
# include <X11/Intrinsic.h>
# include <X11/StringDefs.h>
#endif
/*****************************************************************************
* Unix-only declarations
******************************************************************************/
@ -76,6 +81,15 @@
static void Redraw( Widget w, XtPointer closure, XEvent *event );
#endif
/*****************************************************************************
* MacOS-only declarations
******************************************************************************/
#ifdef XP_MACOSX
# define VOUT_PLUGINS "macosx"
# define AOUT_PLUGINS "macosx"
#endif
/*****************************************************************************
* Windows-only declarations
*****************************************************************************/
@ -176,23 +190,28 @@ NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
/******************************************************************************
* Mac-only API calls
*****************************************************************************/
#ifdef XP_MAC
#ifdef XP_MACOSX
int16 NPP_HandleEvent( NPP instance, void * event )
{
VlcPlugin *p_plugin = (VlcPlugin*)instance->pdata;
vlc_value_t value;
if( instance == NULL )
{
return false;
}
Boolean eventHandled = false;
EventRecord *pouetEvent = (EventRecord*)event;
#if 0
TPlugin *pPlugin = (TPlugin*)instance->pdata;
if( pPlugin != NULL && event != NULL )
if (pouetEvent->what == 6)
{
eventHandled = pPlugin->HandleEvent( *(EventRecord*)event );
value.i_int = 1;
VLC_Set( p_plugin->i_vlc, "drawableredraw", value );
return true;
}
#endif
Boolean eventHandled = false;
return eventHandled;
}
@ -381,6 +400,20 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
NPError NPP_SetWindow( NPP instance, NPWindow* window )
{
#ifdef XP_MACOSX
vlc_value_t value;
vlc_value_t valuex;
vlc_value_t valuey;
vlc_value_t valuew;
vlc_value_t valueh;
vlc_value_t valuet;
vlc_value_t valuel;
vlc_value_t valueb;
vlc_value_t valuer;
vlc_value_t valueportx;
vlc_value_t valueporty;
#endif
if( instance == NULL )
{
return NPERR_INVALID_INSTANCE_ERROR;
@ -390,11 +423,42 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
/* Write the window ID for vlc */
#if USE_LIBVLC
vlc_value_t value;
#ifdef XP_MACOSX
value.i_int = ((NP_Port*) (window->window))->port;
VLC_Set( p_plugin->i_vlc, "drawable", value );
valueportx.i_int = ((NP_Port*) (window->window))->portx;
valueporty.i_int = ((NP_Port*) (window->window))->porty;
VLC_Set( p_plugin->i_vlc, "drawableportx", valueportx );
VLC_Set( p_plugin->i_vlc, "drawableporty", valueporty );
valuex.i_int = window->x;
valuey.i_int = window->y;
valuew.i_int = window->width;
valueh.i_int = window->height;
valuet.i_int = window->clipRect.top;
valuel.i_int = window->clipRect.left;
valueb.i_int = window->clipRect.bottom;
valuer.i_int = window->clipRect.right;
VLC_Set( p_plugin->i_vlc, "drawablet", valuet );
VLC_Set( p_plugin->i_vlc, "drawablel", valuel );
VLC_Set( p_plugin->i_vlc, "drawableb", valueb );
VLC_Set( p_plugin->i_vlc, "drawabler", valuer );
VLC_Set( p_plugin->i_vlc, "drawablex", valuex );
VLC_Set( p_plugin->i_vlc, "drawabley", valuey );
VLC_Set( p_plugin->i_vlc, "drawablew", valuew );
VLC_Set( p_plugin->i_vlc, "drawableh", valueh );
p_plugin->window = window;
#else
/* FIXME: this cast sucks */
value.i_int = (int) (ptrdiff_t) (void *) window->window;
VLC_Set( p_plugin->i_vlc, "drawable", value );
#endif
#endif
/*

View File

@ -17,7 +17,6 @@
msgid ""
msgstr ""
"Project-Id-Version: vlc\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2003-08-11 21:05+0200\n"
"PO-Revision-Date: 2002-04-22 09:56+0200\n"
"Last-Translator: Samuel Hocevar <sam@zoy.org>\n"
@ -25,6 +24,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
"Report-Msgid-Bugs-To: \n"
#: include/vlc_interface.h:105
msgid ""

View File

@ -6,7 +6,6 @@
msgid ""
msgstr ""
"Project-Id-Version: vlc\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2003-08-11 21:05+0200\n"
"PO-Revision-Date: 2001-12-10 13:32+0100\n"
"Last-Translator: Jean-Pierre Kuypers <Kuypers@sri.ucl.ac.be> 2003-07-27\n"
@ -14,6 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8-bit\n"
"Report-Msgid-Bugs-To: \n"
#: include/vlc_interface.h:105
msgid ""

View File

@ -6,7 +6,6 @@
msgid ""
msgstr ""
"Project-Id-Version: vlc\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2003-08-11 21:05+0200\n"
"PO-Revision-Date: 2003-07-24 15:00+0100\n"
"Last-Translator: Vella Bruno\n"
@ -14,6 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
"Report-Msgid-Bugs-To: \n"
#: include/vlc_interface.h:105
msgid ""

View File

@ -4,7 +4,6 @@
msgid ""
msgstr ""
"Project-Id-Version: vlc\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2003-08-11 21:05+0200\n"
"PO-Revision-Date: 2003-01-09 02:37+0900\n"
"Last-Translator: Fumio Nakayama <endymion@ca2.so-net.ne.jp>\n"
@ -12,6 +11,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=euc-jp\n"
"Content-Transfer-Encoding: 8bit\n"
"Report-Msgid-Bugs-To: \n"
#: include/vlc_interface.h:105
#, fuzzy

View File

@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.94 2003/07/23 01:13:48 gbazin Exp $
* $Id: libvlc.c,v 1.95 2003/08/14 12:38:04 garf Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
@ -564,7 +564,18 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
* FIXME: kludge to use a p_vlc-local variable for the Mozilla plugin
*/
var_Create( p_vlc, "drawable", VLC_VAR_INTEGER );
var_Create( p_vlc, "drawableredraw", VLC_VAR_INTEGER );
var_Create( p_vlc, "drawablet", VLC_VAR_INTEGER );
var_Create( p_vlc, "drawablel", VLC_VAR_INTEGER );
var_Create( p_vlc, "drawableb", VLC_VAR_INTEGER );
var_Create( p_vlc, "drawabler", VLC_VAR_INTEGER );
var_Create( p_vlc, "drawablex", VLC_VAR_INTEGER );
var_Create( p_vlc, "drawabley", VLC_VAR_INTEGER );
var_Create( p_vlc, "drawablew", VLC_VAR_INTEGER );
var_Create( p_vlc, "drawableh", VLC_VAR_INTEGER );
var_Create( p_vlc, "drawableportx", VLC_VAR_INTEGER );
var_Create( p_vlc, "drawableporty", VLC_VAR_INTEGER );
/*
* Get input filenames given as commandline arguments
*/
@ -893,6 +904,7 @@ int VLC_Stop( int i_object )
* Ask the interfaces to stop and destroy them
*/
msg_Dbg( p_vlc, "removing all interfaces" );
while( (p_intf = vlc_object_find( p_vlc, VLC_OBJECT_INTF, FIND_CHILD )) )
{
intf_StopThread( p_intf );
@ -904,6 +916,7 @@ int VLC_Stop( int i_object )
/*
* Free playlists
*/
msg_Dbg( p_vlc, "removing all playlists" );
while( (p_playlist = vlc_object_find( p_vlc, VLC_OBJECT_PLAYLIST,
FIND_CHILD )) )
@ -912,7 +925,7 @@ int VLC_Stop( int i_object )
vlc_object_release( p_playlist );
playlist_Destroy( p_playlist );
}
/*
* Free video outputs
*/