[vlc-devel] [PATCH] npapi-vlc: Enable building npapi plugin on Mac OS X
James Bates
james.h.bates at gmail.com
Sat Oct 6 15:18:14 CEST 2012
---
.gitignore | 3 +
configure.ac | 4 +-
extras/macosx/Pre-Compile.sh | 284 ++++++++++++++++++++++++++++++++++++++++++
npapi/Makefile.am | 14 +--
npapi/support/npmac.cpp | 63 +++++++++-
npapi/vlcplugin.h | 2 +-
npapi/vlcplugin_base.cpp | 8 +-
npapi/vlcplugin_mac.cpp | 14 ++-
npapi/vlcplugin_mac.h | 2 +-
npapi/vlcshell.cpp | 14 ++-
10 files changed, 379 insertions(+), 29 deletions(-)
create mode 100644 extras/macosx/Pre-Compile.sh
diff --git a/.gitignore b/.gitignore
index ba1255c..2b1382c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,6 @@ libtool
Makefile
Makefile.in
stamp-*
+extras/macosx/Info.plist
+npapi/VLC Plugin*
+npapi/npvlc.rsrc
diff --git a/configure.ac b/configure.ac
index 40611e5..e2e9bc5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,7 +145,9 @@ glibc run-time.])
dnl
dnl libraries checks
AC_PATH_XTRA
-PKG_CHECK_MODULES([LIBVLC], [libvlc >= 1.1.0])
+PKG_CHECK_MODULES([LIBVLC], [libvlc >= 2.0], [
+ LIBVLC_PREFIX=`pkg-config --variable=prefix libvlc`
+ AC_SUBST(LIBVLC_PREFIX)])
dnl
diff --git a/extras/macosx/Pre-Compile.sh b/extras/macosx/Pre-Compile.sh
new file mode 100644
index 0000000..80a9f58
--- /dev/null
+++ b/extras/macosx/Pre-Compile.sh
@@ -0,0 +1,284 @@
+#!/bin/sh
+#
+# Pre-Compile.sh
+#
+# Script that install libvlc and its modules inside VLCKit.
+#
+# This is for some creepy reasons also used by legacy VLC.app or
+# the moz plugin.
+
+#
+# We are building VLC.app or the moz plugin
+#
+if test "${ACTION}" = "release-makefile"; then
+ echo "running Pre-Compile.sh in release-makefile mode"
+
+ FULL_PRODUCT_NAME="${PRODUCT}"
+ if [ "$FULL_PRODUCT_NAME" = "VLC-Plugin.plugin" ] ; then
+ TARGET_BUILD_DIR="${src_dir}"
+ else
+ TARGET_BUILD_DIR="${build_dir}"
+ fi
+ CONTENTS_FOLDER_PATH="${FULL_PRODUCT_NAME}/Contents/MacOS"
+ VLC_BUILD_DIR="${build_dir}"
+ VLC_SRC_DIR="${src_dir}"
+ ACTION="build"
+ RELEASE_MAKEFILE="yes"
+ use_archs="no"
+ main_build_dir="${VLC_BUILD_DIR}"
+else
+ use_archs="yes"
+ main_build_dir="${VLC_BUILD_DIR}/${ARCHS%% *}"
+ echo "Building for $ARCHS"
+fi
+
+if test "${ACTION}" = "clean"; then
+ rm -Rf "${VLC_BUILD_DIR}/tmp"
+ exit 0
+fi
+
+if test "${ACTION}" != "build"; then
+ echo "This script is supposed to run from xcodebuild or Xcode"
+ exit 1
+fi
+
+lib="lib"
+plugins="plugins"
+share="share"
+include="include"
+target="${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}"
+target_bin="${target}/bin"
+target_lib="${target}/${lib}" # Should we consider using a different well-known folder like shared resources?
+target_plugins="${target}/${plugins}" # Should we consider using a different well-known folder like shared resources?
+target_share="${target}/${share}" # Should we consider using a different well-known folder like shared resources?
+linked_libs=""
+prefix=".libs"
+suffix="dylib"
+num_archs=$(echo `echo $ARCHS | wc -w`)
+
+##########################
+# @function vlc_install_object(src_lib, dest_dir, type, lib_install_prefix, destination_name, suffix)
+# @description Installs the specified library into the destination folder, automatically changes the references to dependencies
+# @param src_lib source library to copy to the destination directory
+# @param dest_dir destination directory where the src_lib should be copied to
+vlc_install_object() {
+ local src_lib=${1}
+ local dest_dir=${2}
+ local type=${3}
+ local lib_install_prefix=${4}
+ local destination_name=${5}
+ local suffix=${6}
+
+ if [ $type = "library" ]; then
+ local install_name="@loader_path/lib"
+ elif [ $type = "module" ]; then
+ local install_name="@loader_path/plugins"
+ fi
+ if [ "$destination_name" != "" ]; then
+ local lib_dest="$dest_dir/$destination_name$suffix"
+ local lib_name=`basename $destination_name`
+ else
+ local lib_dest="$dest_dir/`basename $src_lib`$suffix"
+ local lib_name=`basename $src_lib`
+ fi
+
+ if [ "x$lib_install_prefix" != "x" ]; then
+ local lib_install_prefix="$lib_install_prefix"
+ else
+ local lib_install_prefix="@loader_path/../lib"
+ fi
+
+ if test ! -e ${src_lib}; then
+ return
+ fi
+
+ if ( (test ! -e ${lib_dest}) || test ${src_lib} -nt ${lib_dest} ); then
+
+ mkdir -p ${dest_dir}
+
+ # Lets copy the library from the source folder to our new destination folder
+ if [ "${type}" = "bin" ]; then
+ install -m 755 ${src_lib} ${lib_dest}
+ else
+ install -m 644 ${src_lib} ${lib_dest}
+ fi
+
+ # Update the dynamic library so it will know where to look for the other libraries
+ echo "Installing ${type} `basename ${lib_dest}`"
+
+ if [ "${type}" = "library" ]; then
+ # Change the reference of libvlc.1 stored in the usr directory to libvlc.dylib in the framework's library directory
+ install_name_tool -id "${install_name}/${lib_name}" ${lib_dest} > /dev/null
+ fi
+
+ if [ "${type}" != "data" ]; then
+ # Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory
+ for linked_lib in `otool -L ${lib_dest} | grep '(' | sed 's/\((.*)\)//'`; do
+ local name=`basename ${linked_lib}`
+ case "${linked_lib}" in
+ */vlc_build_dir/* | */vlc_install_dir/* | *vlc* | */extras/contrib/*)
+ if test -e ${linked_lib}; then
+ install_name_tool -change "$linked_lib" "${lib_install_prefix}/${name}" "${lib_dest}"
+ linked_libs="${linked_libs} ${ref_lib}"
+ vlc_install_object ${linked_lib} ${target_lib} "library"
+ fi
+ ;;
+ esac
+ done
+ fi
+ fi
+}
+# @function vlc_install_object
+##########################
+
+##########################
+# @function vlc_install(src_lib_dir, src_lib_name, dest_dir, type, lib_install_prefix)
+# @description Installs the specified library into the destination folder, automatically changes the references to dependencies
+# @param src_lib source library to copy to the destination directory
+# @param dest_dir destination directory where the src_lib should be copied to
+vlc_install() {
+ local src_dir=$1
+ local src=$2
+ local dest_dir=$3
+ local type=$4
+
+ if test "$use_archs" = "no"; then
+ vlc_install_object "$src_dir/$src" "$dest_dir" "$type" $5
+ else
+ if test $type = "data"; then
+ vlc_install_object "$main_build_dir/$src_dir/$src" "$dest_dir" "$type" $5
+ else
+ local fatdest="$dest_dir/$2"
+ local shouldUpdate="no"
+
+ # Determine what architectures are available in the destination image
+ local fatdest_archs=""
+ if [ -e ${fatdest} ]; then
+ fatdest_archs=`lipo -info "${fatdest}" 2> /dev/null | sed -E -e 's/[[:space:]]+$//' -e 's/.+:[[:space:]]*//' -e 's/[^[:space:]]+/(&)/g'`
+
+ # Check to see if the destination image needs to be reconstructed
+ for arch in $ARCHS; do
+ # Only install if the new image is newer than the one we have installed or the required arch is missing.
+ if test $shouldUpdate = "no" && (! [[ "$fatdest_archs" =~ \($arch\) ]] || test "$VLC_BUILD_DIR/$arch/$src_dir/$src" -nt "${fatdest}"); then
+ shouldUpdate="yes"
+ fi
+ fatdest_archs=${fatdest_archs//\($arch\)/}
+ done
+
+ # Reconstruct the destination image, if the update flag is set or if there are more archs in the desintation then we need
+ fatdest_archs=${fatdest_archs// /}
+ else
+ # If the destination image does not exist, then we have to reconstruct it
+ shouldUpdate="yes"
+ fi
+
+ # If we should update the destination image or if there were unexpected archs in the destination image, then reconstruct it
+ if test "$shouldUpdate" = "yes" || test -n "${fatdest_archs}"; then
+ # If the destination image exists, get rid of it so we can copy over the newly constructed image
+ if test -e ${fatdest}; then
+ rm "$fatdest"
+ fi
+
+ if test "$num_archs" = "1"; then
+ echo "Copying $ARCHS $type $fatdest"
+ local arch_src="$VLC_BUILD_DIR/$ARCHS/$src_dir/$src"
+ vlc_install_object "$arch_src" "$dest_dir" "$type" "$5" ""
+ else
+ # Create a temporary destination dir to store each ARCH object file
+ local tmp_dest_dir="$VLC_BUILD_DIR/tmp/$type"
+ rm -Rf "${tmp_dest_dir}/*"
+ mkdir -p "$tmp_dest_dir"
+
+ # Search for each ARCH object file used to construct a fat image
+ local objects=""
+ for arch in $ARCHS; do
+ local arch_src="$VLC_BUILD_DIR/$arch/$src_dir/$src"
+ vlc_install_object "$arch_src" "$tmp_dest_dir" "$type" "$5" "" ".$arch"
+ local dest="$tmp_dest_dir/$src.$arch"
+ if [ -e ${dest} ]; then
+ objects="${dest} $objects"
+ else
+ echo "Warning: building $arch_src without $arch"
+ fi
+ done;
+
+ echo "Creating fat $type $fatdest"
+ lipo $objects -output "$fatdest" -create
+ fi
+ fi
+ fi
+ fi
+}
+# @function vlc_install
+##########################
+
+##########################
+# Create a symbolic link in the root of the framework
+mkdir -p ${target_lib}
+mkdir -p ${target_plugins}
+mkdir -p ${target_bin}
+
+if [ "$RELEASE_MAKEFILE" != "yes" ] ; then
+ pushd `pwd` > /dev/null
+ cd ${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}
+
+ ln -sf Versions/Current/${lib} .
+ ln -sf Versions/Current/${plugins} .
+ ln -sf Versions/Current/${include} .
+ ln -sf Versions/Current/${share} .
+ ln -sf Versions/Current/bin .
+ ln -sf ../plugins Versions/Current/bin
+ ln -sf ../share Versions/Current/bin
+
+ popd > /dev/null
+fi
+
+##########################
+# Hack for VLC.app
+if [ "$FULL_PRODUCT_NAME" = "VLC.app" ] ; then
+ vlc_install "bin/${prefix}" "vlc" "${target}" "bin" "@loader_path/lib"
+ mv ${target}/vlc ${target}/VLC
+ chmod +x ${target}/VLC
+elif [ "$FULL_PRODUCT_NAME" = "VLC-Plugin.plugin" ] ; then
+ # install Safari webplugin
+ vlc_install "${src_dir}/${prefix}" "npvlc.${suffix}" "${target}" "lib" "@loader_path/lib"
+ mv ${target}/npvlc.${suffix} "${target}/VLC Plugin"
+ chmod +x "${target}/VLC Plugin"
+else
+ vlc_install "bin/${prefix}" "vlc" "${target}/bin" "bin" "@loader_path/../lib"
+fi
+
+##########################
+# Build the plugins folder (Same as VLCKit.framework/plugins in Makefile)
+echo "Building plugins folder..."
+# Figure out what plugins are available to install
+for module in `find ${libvlc_dir}/lib/vlc/plugins -name 'lib*_plugin.dylib' -print` ; do
+ # Check to see that the reported module actually exists
+ #if test -f ${module}; then
+ vlc_install `dirname ${module}` `basename ${module}` ${target_plugins} "module"
+ #fi
+done
+
+##########################
+# Build the lib folder
+vlc_install "${libvlc_dir}/lib" "libvlc.5.dylib" "${target_lib}" "library"
+vlc_install "${libvlc_dir}/lib" "libvlccore.5.dylib" "${target_lib}" "library"
+pushd `pwd` > /dev/null
+cd ${target_lib}
+ln -sf libvlc.5.dylib libvlc.dylib
+ln -sf libvlccore.5.dylib libvlccore.dylib
+popd > /dev/null
+
+##########################
+# Build the share folder
+if [ $PRODUCT != "VLC.app" ]; then
+ echo "Building share folder..."
+ #pbxcp="/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -resolve-src-symlinks -v -V"
+ pbxcp="cp -av"
+ mkdir -p ${target_share}
+ if test "$use_archs" = "no"; then
+ $pbxcp ${libvlc_dir}/share/vlc/lua ${target_share}
+ else
+ $pbxcp ${main_build_dir}/share/lua ${target_share}
+ fi
+fi
diff --git a/npapi/Makefile.am b/npapi/Makefile.am
index ac7f2ba..81c9291 100644
--- a/npapi/Makefile.am
+++ b/npapi/Makefile.am
@@ -104,25 +104,25 @@ else
lib_LTLIBRARIES = npvlc.la
AM_CPPFLAGS += -I. -I$(top_builddir) -c \
- -F/System/Library/Frameworks/CoreFoundation.framework \
- -I/Developer/Headers/FlatCarbon -fno-common -fpascal-strings \
-Wmost -Wno-four-char-constants -Wno-unknown-pragmas \
-DXP_UNIX -DXP_MACOSX=1 \
-DNO_X11=1 -DUSE_SYSTEM_CONSOLE=1 -pipe -fmessage-length=0
-SOURCES_support = support/npmac.cpp
+SOURCES_support = support/npmac.cpp \
+ vlcplugin_mac.cpp \
+ vlcplugin_mac.h
libvlcplugin_la_LDFLAGS += \
-bundle -Wl,-read_only_relocs -Wl,suppress \
-Wl,-headerpad_max_install_names \
-Wl,-framework,Carbon -Wl,-framework,System \
- -shrext $(LIBEXT)
+ -shrext .dylib
noinst_DATA = npvlc.rsrc VLC\ Plugin.plugin
MOSTLYCLEANFILES += npvlc.rsrc
CLEANFILES += VLC\ Plugin.plugin
npvlc.rsrc: vlc.r
- /Developer/Tools/Rez -useDF /Developer/Headers/FlatCarbon/Types.r $< -o $@
+ xcrun Rez -useDF /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers/FlatCarbon/Types.r $< -o $@
#
# Plugin uses shared libraries that are located relatively through @executable_path,
@@ -144,9 +144,9 @@ VLC\ Plugin.plugin: npvlc.rsrc $(lib_LTLIBRARIES)
rm -Rf "$@"
$(INSTALL) -d "VLC-Plugin.plugin/Contents/MacOS/lib"
$(INSTALL) -d "VLC-Plugin.plugin/Contents/Resources"
- ACTION="release-makefile" PRODUCT="VLC-Plugin.plugin" src_dir=$(srcdir) build_dir=$(top_builddir) sh "$(top_srcdir)/project/macosx/framework/Pre-Compile.sh"
+ ACTION="release-makefile" PRODUCT="VLC-Plugin.plugin" libvlc_dir=$(LIBVLC_PREFIX) src_dir=$(srcdir) build_dir=$(top_builddir) sh "$(top_srcdir)/extras/macosx/Pre-Compile.sh"
$(INSTALL) npvlc.rsrc "VLC-Plugin.plugin/Contents/Resources/VLC Plugin.rsrc"
- $(INSTALL) "$(top_builddir)/extras/package/macosx/plugin/Info.plist" "VLC-Plugin.plugin/Contents/Info.plist"
+ $(INSTALL) "$(top_builddir)/extras/macosx/Info.plist" "VLC-Plugin.plugin/Contents/Info.plist"
mv "VLC-Plugin.plugin" "VLC Plugin.plugin"
find "VLC Plugin.plugin" -type d -exec chmod ugo+rx '{}' \;
find "VLC Plugin.plugin" -type f -exec chmod ugo+r '{}' \;
diff --git a/npapi/support/npmac.cpp b/npapi/support/npmac.cpp
index b8e2d0e..7dc0893 100644
--- a/npapi/support/npmac.cpp
+++ b/npapi/support/npmac.cpp
@@ -27,14 +27,14 @@
#include "config.h"
#include <string.h>
-
+/*
#include <Processes.h>
#include <Gestalt.h>
#include <CodeFragments.h>
#include <Timer.h>
#include <Resources.h>
#include <ToolUtils.h>
-
+*/
#define XP_MACOSX 1
#undef TARGET_RT_MAC_CFM
@@ -665,8 +665,43 @@ void Private_Shutdown(void)
NPError Private_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
{
EnterCodeResource();
- NPError ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
PLUGINDEBUGSTR("\pNew;g;");
+
+ /*
+ * We should negotiate and setup uniform event & drawing models, so the 32- and 64-bit plugins behave
+ * identically
+ */
+ NPBool supportsCoreGraphics = FALSE;
+ NPError err = NPN_GetValue(instance, NPNVsupportsCoreGraphicsBool, &supportsCoreGraphics);
+ if (err != NPERR_NO_ERROR || !supportsCoreGraphics) {
+
+ PLUGINDEBUGSTR("\pNew: browser doesn't support CoreGraphics drawing model;g;");
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+ }
+
+ err = NPN_SetValue(instance, NPPVpluginDrawingModel, (void*)NPDrawingModelCoreGraphics);
+ if (err != NPERR_NO_ERROR) {
+
+ PLUGINDEBUGSTR("\pNew: couldn't activate CoreGraphics drawing model;g;");
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+ }
+
+ NPBool supportsCocoaEvents = FALSE;
+ err = NPN_GetValue(instance, NPNVsupportsCocoaBool, &supportsCocoaEvents);
+ if (err != NPERR_NO_ERROR || !supportsCocoaEvents) {
+
+ PLUGINDEBUGSTR("\pNew: browser doesn't support Cocoa event model;g;");
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+ }
+
+ err = NPN_SetValue(instance, NPPVpluginEventModel, (void*)NPEventModelCocoa);
+ if (err != NPERR_NO_ERROR) {
+
+ PLUGINDEBUGSTR("\pNew: couldn't activate Cocoa event model;g;");
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+ }
+
+ NPError ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
ExitCodeResource();
return ret;
}
@@ -903,6 +938,9 @@ typedef int main_return_t;
typedef NPError mainReturnType;
#endif
+
+typedef void (* NP_LOADDS NPP_ShutdownProcPtr)(void);
+
#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
typedef NPP_ShutdownUPP unloadupp_t;
#else
@@ -1102,8 +1140,11 @@ NPError NP_Initialize(NPNetscapeFuncs* nsTable)
/* validate input parameters */
- if( NULL == nsTable )
+ if( NULL == nsTable ) {
+
+ PLUGINDEBUGSTR("\pNP_Initialize error: NPERR_INVALID_FUNCTABLE_ERROR: table is null");
return NPERR_INVALID_FUNCTABLE_ERROR;
+ }
/*
* Check the major version passed in Netscape's function table.
@@ -1114,11 +1155,21 @@ NPError NP_Initialize(NPNetscapeFuncs* nsTable)
*
*/
- if ((nsTable->version >> 8) > NP_VERSION_MAJOR)
+ if ((nsTable->version >> 8) > NP_VERSION_MAJOR) {
+
+ PLUGINDEBUGSTR("\pNP_Initialize error: NPERR_INCOMPATIBLE_VERSION_ERROR");
return NPERR_INCOMPATIBLE_VERSION_ERROR;
+ }
+
+
+ // This check is too simplisitic: some browsers (e.g. Safari) update the NPAPI less frequently, and so
+ // provide a table containing all netspace functions we are interested, but not necessarily all defined
+ // in the newest version of the npapi against which this plugin is compiled.
+ /*if (nsTable->size < sizeof(NPNetscapeFuncs)) {
- if (nsTable->size < sizeof(NPNetscapeFuncs))
+ PLUGINDEBUGSTR("\pNP_Initialize error: NPERR_INVALID_FUNCTABLE_ERROR: table too small");
return NPERR_INVALID_FUNCTABLE_ERROR;
+ }*/
int navMinorVers = nsTable->version & 0xFF;
diff --git a/npapi/vlcplugin.h b/npapi/vlcplugin.h
index 154f5e7..d18b782 100644
--- a/npapi/vlcplugin.h
+++ b/npapi/vlcplugin.h
@@ -15,7 +15,7 @@
#elif defined(XP_WIN)
# include "vlcplugin_win.h"
typedef VlcPluginWin VlcPlugin;
-#elif defined(XP_MAC)
+#elif defined(XP_MACOSX)
# include "vlcplugin_mac.h"
typedef VlcPluginMac VlcPlugin;
#endif
diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp
index 3f6a00c..7bb57f9 100644
--- a/npapi/vlcplugin_base.cpp
+++ b/npapi/vlcplugin_base.cpp
@@ -386,7 +386,7 @@ void VlcPluginBase::event_callback(const libvlc_event_t* event,
NPN_PluginThreadAsyncCall(getBrowser(), eventAsync, this);
#else
# warning NPN_PluginThreadAsyncCall not implemented yet.
- printf("No NPN_PluginThreadAsyncCall(), doing nothing.\n");
+// printf("No NPN_PluginThreadAsyncCall(), doing nothing.\n");
#endif
}
@@ -398,12 +398,14 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[])
#ifndef NDEBUG
ppsz_argv[ppsz_argc++] = "--no-plugins-cache";
+#else
+# error "Debugging disabled"
#endif
/* locate VLC module path */
#ifdef XP_MACOSX
- ppsz_argv[ppsz_argc++] = "--plugin-path=/Library/Internet\\ Plug-Ins/VLC\\ Plugin.plugin/Contents/MacOS/plugins";
- ppsz_argv[ppsz_argc++] = "--vout=minimal_macosx";
+// ppsz_argv[ppsz_argc++] = "--plugin-path=/Library/Internet\\ Plug-Ins/VLC\\ Plugin.plugin/Contents/MacOS/plugins";
+ ppsz_argv[ppsz_argc++] = "--vout=vout_macosx";
#elif defined(XP_WIN)
HKEY h_key;
DWORD i_type, i_data = MAX_PATH + 1;
diff --git a/npapi/vlcplugin_mac.cpp b/npapi/vlcplugin_mac.cpp
index 7846bda..4054215 100644
--- a/npapi/vlcplugin_mac.cpp
+++ b/npapi/vlcplugin_mac.cpp
@@ -26,6 +26,8 @@
#include "vlcplugin_mac.h"
+#include <npapi.h>
+
VlcPluginMac::VlcPluginMac(NPP instance, NPuint16_t mode) :
VlcPluginBase(instance, mode)
{
@@ -44,21 +46,21 @@ void VlcPluginMac::toggle_fullscreen()
{
if (!get_options().get_enable_fs()) return;
if (playlist_isplaying())
- libvlc_toggle_fullscreen(libvlc_media_player);
+ libvlc_toggle_fullscreen(getMD());
}
void VlcPluginMac::set_fullscreen(int yes)
{
if (!get_options().get_enable_fs()) return;
if (playlist_isplaying())
- libvlc_set_fullscreen(libvlc_media_player, yes);
+ libvlc_set_fullscreen(getMD(), yes);
}
int VlcPluginMac::get_fullscreen()
{
int r = 0;
if (playlist_isplaying())
- r = libvlc_get_fullscreen(libvlc_media_player);
+ r = libvlc_get_fullscreen(getMD());
return r;
}
@@ -76,8 +78,8 @@ bool VlcPluginMac::resize_windows()
* relative to GrafPort window origin is set relative to document,
* which of little use for drawing
*/
- view.top = ((NP_Port*) (npwindow.window))->porty;
- view.left = ((NP_Port*) (npwindow.window))->portx;
+ view.top = 0; // ((NP_Port*) (npwindow.window))->porty;
+ view.left = 0; // ((NP_Port*) (npwindow.window))->portx;
view.bottom = npwindow.height+view.top;
view.right = npwindow.width+view.left;
@@ -96,5 +98,5 @@ bool VlcPluginMac::resize_windows()
bool VlcPluginMac::destroy_windows()
{
- window.window = NULL;
+ npwindow.window = NULL;
}
diff --git a/npapi/vlcplugin_mac.h b/npapi/vlcplugin_mac.h
index df8e573..c1cd4ea 100644
--- a/npapi/vlcplugin_mac.h
+++ b/npapi/vlcplugin_mac.h
@@ -29,7 +29,7 @@
#include "vlcplugin_base.h"
-#include <Quickdraw.h>
+//#include <Quickdraw.h>
class VlcPluginMac : public VlcPluginBase
{
diff --git a/npapi/vlcshell.cpp b/npapi/vlcshell.cpp
index 76c7013..7dc5ff4 100644
--- a/npapi/vlcshell.cpp
+++ b/npapi/vlcshell.cpp
@@ -138,7 +138,7 @@ int16_t NPP_HandleEvent( NPP instance, void * event )
return false;
}
-#ifndef __x86_64__
+#if 0
EventRecord *myEvent = (EventRecord*)event;
switch( myEvent->what )
@@ -230,7 +230,9 @@ int16_t NPP_HandleEvent( NPP instance, void * event )
default:
;
}
-#endif // __x86_64__
+#else // __x86_64__
+// TODO: implement Cocoa event model
+#endif
return false;
}
#endif /* XP_MACOSX */
@@ -342,8 +344,10 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
/* retrieve current window */
NPWindow& curr_window = p_plugin->getWindow();
- if (window && window->window) {
+ if (window/* && window->window */) {
+ ::DebugStr((const unsigned char*)"vlcshell: received window object from browser");
if (!curr_window.window) {
+ ::DebugStr((const unsigned char*)"vlcshell: no current window");
/* we've just been created */
p_plugin->setWindow(*window);
p_plugin->create_windows();
@@ -373,11 +377,13 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
p_plugin->update_controls();
} else {
if (window->window == curr_window.window) {
+ ::DebugStr((const unsigned char*)"Already have current window, and new window is the same");
/* resize / move notification */
p_plugin->setWindow(*window);
p_plugin->resize_windows();
} else {
/* plugin parent window was changed, notify plugin about it */
+ ::DebugStr((const unsigned char*)"Already have current window, but new window is different");
p_plugin->destroy_windows();
p_plugin->setWindow(*window);
p_plugin->create_windows();
@@ -387,12 +393,12 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
} else {
/* NOTE: on Windows, Opera does not call NPP_SetWindow
* on window destruction. */
+ ::DebugStr((const unsigned char*)"vlcshell: received no window object from browser");
if (curr_window.window) {
/* we've been destroyed */
p_plugin->destroy_windows();
}
}
-
return NPERR_NO_ERROR;
}
--
1.7.9.6 (Apple Git-31.1)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4364 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20121006/faf3924c/attachment.bin>
More information about the vlc-devel
mailing list