# SUBDIRS stores the directories where a "make" is required when building
# something. DIST_SUBDIRS stores the directories where nothing is built but
# which have makefiles with distribution information.
-# - src (libvlc) is nedeed by modules, mozilla and bindings
+# - src (libvlc) is nedeed by modules
# - libs/* are needed by modules
BASE_SUBDIRS = po compat src bin modules share doc test
EXTRA_SUBDIRS = m4 \
libs/loader libs/srtp libs/unzip \
- projects/mozilla projects/activex
+ projects/activex
DIST_SUBDIRS = $(BASE_SUBDIRS) $(EXTRA_SUBDIRS)
SUBDIRS = po compat src
SUBDIRS += bin
endif
SUBDIRS += modules share doc test
-if BUILD_MOZILLA
-SUBDIRS += projects/mozilla
-endif
if BUILD_ACTIVEX
SUBDIRS += projects/activex
endif
extras/package/macosx/Delete_Preferences.app/Contents/Resources/applet.icns \
extras/package/macosx/Delete_Preferences.app/Contents/Resources/applet.rsrc \
extras/package/macosx/Delete_Preferences.app/Contents/Resources/Scripts/main.scpt \
- extras/package/macosx/plugin/Info.plist.in \
- extras/package/macosx/plugin/InstallerInfo.plist.in \
- extras/package/macosx/plugin/InstallerDescription.plist \
- extras/package/macosx/plugin/pbdevelopment.plist \
extras/package/macosx/eyetvplugin/EyeTVPluginDefs.h \
extras/package/macosx/eyetvplugin/Info.plist \
extras/package/macosx/eyetvplugin/eyetvplugin.c \
rm -f -- "$$file.tmp"; \
done
endif
-if BUILD_MOZILLA
- cp $(top_srcdir)/projects/mozilla/npvlc.dll.manifest $(win32_destdir)
-endif
+#if BUILD_MOZILLA
+# cp $(top_srcdir)/projects/mozilla/npvlc.dll.manifest $(win32_destdir)
+#endif
if BUILD_ACTIVEX
cp $(top_srcdir)/projects/activex/axvlc.dll.manifest $(win32_destdir)
endif
done
package-win32-webplugin-common: package-win-base
-if BUILD_MOZILLA
- mkdir -p "$(win32_xpi_destdir)/plugins"
- find $(destdir) -maxdepth 4 -name "*$(LIBEXT)" -exec cp {} "$(win32_xpi_destdir)/" \;
- cp $(top_srcdir)/projects/mozilla/npvlc.dll.manifest "$(win32_xpi_destdir)/plugins"
- cp "$(top_srcdir)/extras/package/win32/libvlc.dll.manifest" "$(win32_xpi_destdir)/plugins"
- cp -r $(win32_destdir)/plugins/ "$(win32_xpi_destdir)/plugins"
- rm -rf "$(win32_xpi_destdir)/plugins/plugins/*qt*"
- rm -rf "$(win32_xpi_destdir)/plugins/plugins/*skins*"
-endif
+#if BUILD_MOZILLA
+# mkdir -p "$(win32_xpi_destdir)/plugins"
+# find $(destdir) -maxdepth 4 -name "*$(LIBEXT)" -exec cp {} "$(win32_xpi_destdir)/" \;
+# cp $(top_srcdir)/projects/mozilla/npvlc.dll.manifest "$(win32_xpi_destdir)/plugins"
+# cp "$(top_srcdir)/extras/package/win32/libvlc.dll.manifest" "$(win32_xpi_destdir)/plugins"
+# cp -r $(win32_destdir)/plugins/ "$(win32_xpi_destdir)/plugins"
+# rm -rf "$(win32_xpi_destdir)/plugins/plugins/*qt*"
+# rm -rf "$(win32_xpi_destdir)/plugins/plugins/*skins*"
+#endif
package-win32-xpi: package-win32-webplugin-common
-if BUILD_MOZILLA
- cp $(top_builddir)/projects/mozilla/install.rdf "$(win32_xpi_destdir)"
- cd $(win32_xpi_destdir) && zip -r "../vlc-$(VERSION).xpi" install.rdf plugins
-endif
+#if BUILD_MOZILLA
+# cp $(top_builddir)/projects/mozilla/install.rdf "$(win32_xpi_destdir)"
+# cd $(win32_xpi_destdir) && zip -r "../vlc-$(VERSION).xpi" install.rdf plugins
+#endif
package-win32-crx: package-win32-webplugin-common
-if BUILD_MOZILLA
- cp $(top_builddir)/projects/mozilla/manifest.json "$(win32_xpi_destdir)"
- crxmake --pack-extension "$(win32_xpi_destdir)" \
- --extension-output "$(win32_destdir)/vlc-$(VERSION).crx" --ignore-file install.rdf
-endif
+#if BUILD_MOZILLA
+# cp $(top_builddir)/projects/mozilla/manifest.json "$(win32_xpi_destdir)"
+# crxmake --pack-extension "$(win32_xpi_destdir)" \
+# --extension-output "$(win32_destdir)/vlc-$(VERSION).crx" --ignore-file install.rdf
+#endif
package-win32-base-exe: package-win-base
# Script installer
zip -r -y -9 $(top_builddir)/vlckit-$(VERSION).zip $(top_builddir)/vlckit-$(VERSION)
rm -Rf $(top_builddir)/vlc-$(VERSION)
-package-macosx-plugin:
-if BUILD_MOZILLA
-# Create Installer
- rm -rf "$(top_builddir)/macosx-plugin-instdata/"; true
- mkdir -p "$(top_builddir)/macosx-plugin-instdata"
- rm -f "$(top_builddir)/projects/mozilla/VLC Plugin.plugin/Contents/MacOS/modules/libmacosx_plugin.dylib"
- cp -R "$(top_builddir)/projects/mozilla/VLC Plugin.plugin" "$(top_builddir)/macosx-plugin-instdata"
- rm -rf "$(top_builddir)/VLC Internet Plug-In.pkg"
- export PACKAGEMAKER=
- if test -x /Developer/Tools/packagemaker; then \
- export PACKAGEMAKER=/Developer/Tools/packagemaker; \
- fi; \
- if test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then \
- export PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; \
- fi; \
- $${PACKAGEMAKER} -build -ds -p "$(top_builddir)/VLC Internet Plug-In.pkg" \
- -f "$(top_builddir)/macosx-plugin-instdata" \
- -i "$(top_builddir)/extras/package/macosx/plugin/InstallerInfo.plist" \
- -d "$(top_srcdir)/extras/package/macosx/plugin/InstallerDescription.plist"; true
- rm -rf "$(top_builddir)/macosx-plugin-instdata/"
-
-# Create disk image
- rm -f "$(top_builddir)/vlc-plugin-$(VERSION).dmg"; true
- rm -rf "$(top_builddir)/vlc-plugin-$(VERSION)/"; true
- mkdir -p "$(top_builddir)/vlc-plugin-$(VERSION)/"
- mv "$(top_builddir)/VLC Internet Plug-In.pkg" "$(top_builddir)/vlc-plugin-$(VERSION)/"
- hdiutil create -srcfolder "$(top_builddir)/vlc-plugin-$(VERSION)" \
- "$(top_builddir)/vlc-plugin-$(VERSION).dmg" -format UDBZ \
- -scrub -imagekey zlib-level=9
- echo "Disk image creation completed:"
- rm -rf "$(top_builddir)/vlc-plugin-$(VERSION)"
-endif
-
-package-macosx-xpi:
-if BUILD_MOZILLA
- mkdir -p "$(top_builddir)/macosx-xpi/plugins"
- cp $(top_builddir)/projects/mozilla/install.rdf \
- "$(top_builddir)/macosx-xpi/"
- cp -R "$(top_builddir)/projects/mozilla/VLC Plugin.plugin" \
- "$(top_builddir)/macosx-xpi/plugins"
- cd "$(top_builddir)/macosx-xpi" && zip -r vlc-$(VERSION).xpi install.rdf plugins
-endif
-
package-translations:
@if test -e "$(srcdir)/vlc-translations-$(VERSION)"; then \
echo "Error: please remove $(srcdir)/vlc-translations-$(VERSION), it is in the way"; \
LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
LDFLAGS_save="${LDFLAGS_save} -L${CONTRIB_DIR}/lib"
- if test -z "$with_mozilla_sdk_path"; then
- with_mozilla_sdk_path="${CONTRIB_DIR}/gecko-sdk"
- fi
-
if test "${SYS}" = "darwin"; then
export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
# add ws2_32 for closesocket, select, recv
VLC_ADD_LIBS([libvlccore],[-lws2_32 -lnetapi32 -lwinmm])
VLC_ADD_LDFLAGS([vlc],[-mwindows])
- VLC_ADD_LIBS([activex mozilla win32text],[-lgdi32])
+ VLC_ADD_LIBS([activex win32text],[-lgdi32])
VLC_ADD_LIBS([cdda vcdx sdl_image aout_sdl vout_sdl],[-lwinmm])
VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout access_output_rtmp sap oldhttp stream_out_standard stream_out_rtp stream_out_raop vod_rtsp access_realrtsp rtp oldrc netsync gnutls growl_udp flac ts audioscrobbler lua remoteosd zvbi audiobargraph_a netsync],[-lws2_32])
VLC_ADD_LIBS([filesystem], [-lshlwapi])
AC_MSG_RESULT([not present])
], [
AC_MSG_RESULT([found])
- AS_IF([test "x${enable_nls}" != "xno" || test "x${enable_mozilla}" != "xno"], [
+ AS_IF([test "x${enable_nls}" != "xno"], [
AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
work-around for this. Check with your distribution vendor on how to update the
-glibc run-time. Alternatively, build with --disable-nls --disable-mozilla and
-be sure to not use LibVLC from other applications/wrappers.])
+glibc run-time. Alternatively, build with --disable-nls.])
], [
AC_DEFINE(DISABLE_BUGGY_GLIBC_CHECK, 1, [Disables runtime check for buggy glibc.])
])
AM_CONDITIONAL(HAS_WIDL_COMPILER, test "${WIDL}" != "no")
AM_CONDITIONAL(BUILD_ACTIVEX,${activex})
-dnl
-dnl Mozilla plugin
-dnl
-mozilla=false
-AC_ARG_ENABLE(mozilla,
- AS_HELP_STRING([--enable-mozilla],[build a vlc-based Firefox/Mozilla plugin
- (default disabled)]))
-AC_ARG_WITH(mozilla-sdk-path,
- [ --with-mozilla-sdk-path=PATH path to mozilla sdk])
-AC_ARG_WITH(mozilla-pkg,
- [ --with-mozilla-pkg=PKG look for PKG.pc to build the mozilla plugin.])
-AC_LANG_PUSH(C++)
-if test "${enable_mozilla}" = "yes"
-then
- AS_IF([test "${with_mozilla_sdk_path}" = "" -o "${with_mozilla_sdk_path}" = "no"],
- [
- dnl pkg-config
- dnl As we want to do a loop due to the number of name possible for the .pc
- dnl we can't use the pkg-config macros.
-
- AC_ARG_VAR([MOZILLA_CFLAGS], [C compiler flags for Mozilla, overriding pkg-config])
- AC_ARG_VAR([MOZILLA_LIBS], [linker flags for Mozilla, overriding pkg-config])
- AC_MSG_NOTICE([Checking for Mozilla])
- found=0
- if test -n "$MOZILLA_CFLAGS" -o -n "$MOZILLA_LIBS"
- then
- found=1
- else
- if test -n "$PKG_CONFIG"; then
- for i in "${with_mozilla_pkg}" libxul {seamonkey,iceape,xulrunner,firefox,iceweasel,mozilla}-plugin; do
- if test -n "$i"
- then
- echo "Trying to find $i package" >&AS_MESSAGE_LOG_FD
- AC_MSG_CHECKING([for $i >= 1.9.2])
- if $PKG_CONFIG --exists --print-errors "$i >= 1.9.2" 2>&AS_MESSAGE_LOG_FD
- then
- echo "Using $i pkg-config package." >&AS_MESSAGE_LOG_FD
- echo "Using $i package." >&AS_MESSAGE_FD
- found=1
- MOZILLA_CFLAGS=$(eval $PKG_CONFIG --cflags "$i" )
- MOZILLA_LIBS=$(eval $PKG_CONFIG --libs "$i" )
- AC_MSG_RESULT([yes])
- break
- fi
- AC_MSG_RESULT([no])
- fi
- done
- fi
- fi
- AS_IF( [test $found = 1],[
- CPPFLAGS="${CPPFLAGS_save} ${MOZILLA_CFLAGS}"
- MOZILLA_REQUIRED_HEADERS=1
- AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0)
- AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0,
- [#if HAVE_NPAPI_H
- # include <npapi.h>
- #endif
- ])
- if test "${MOZILLA_REQUIRED_HEADERS}" = "0"; then
- AC_MSG_ERROR([Please install the Firefox development tools; plugin/npapi.h and/or plugin/npruntime.h were not found.])
- fi
- MOZILLA_REQUIRED_HEADERS=
- mozilla=:
- AS_IF([ test "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"],[
- VLC_ADD_CPPFLAGS([mozilla],[-DXP_UNIX])
- AS_IF([ test "${SYS}" != "darwin"],[
- PKG_CHECK_MODULES(XPM, [xpm xt],[
- VLC_ADD_CPPFLAGS([mozilla],[-DMOZ_X11])
- ],[
- AC_MSG_ERROR([Please install the libXpm and libXt development files.])
- ])
- AS_IF([test "${have_xcb_keysyms}" != "yes"], [
- AC_MSG_ERROR([Please install xcb-keysyms from xcb-utils.])
- ])
- ])
- ])
- VLC_ADD_CPPFLAGS([mozilla],[${CPPFLAGS} ${XPM_CFLAGS}])
- VLC_ADD_LIBS([mozilla],[${MOZILLA_LIBS} ${XPM_LIBS}])
- VLC_ADD_PLUGIN([mozilla])
- PLUGINS_BINDINGS="${PLUGINS_BINDINGS} mozilla"
- MOZILLA_CONFIG=
- CPPFLAGS="${CPPFLAGS_save}"
- ],
- [
- AC_PATH_PROGS(MOZILLA_CONFIG,
- [mozilla-config seamonkey-config xulrunner-config],
- [no])
- test "${MOZILLA_CONFIG}" = "no" && AC_MSG_ERROR([Please install the Mozilla development tools (version 1.9.2 or higher) or use --disable-mozilla.])
- ]
- )
- dnl pkg-config failed but we might have found a mozilla-config
- AS_IF( [test ! -z "${MOZILLA_CONFIG}"],[
- if ${MOZILLA_CONFIG} --defines | grep -q 'MOZ_X11=1'; then
- LDFLAGS="${LDFLAGS_save} ${X_LIBS} ${X_PRE_LIBS}"
- AC_CHECK_LIB(Xt,XtStrings,
- [
- VLC_ADD_CPPFLAGS([mozilla],[${X_CFLAGS}])
- VLC_ADD_LIBS([mozilla],[${X_LIBS} ${X_PRE_LIBS} -lXt -lX11 -lSM -lICE -lXpm])
- ],
- [],
- [[${X_LIBS} ${X_PRE_LIBS} -lX11 -lSM -lICE -lXpm]
- ])
- AC_CHECK_HEADERS(X11/xpm.h,,AC_MSG_ERROR([Please install libXpm-devel library for required X11/xpm.h]))
- AS_IF([test "${have_xcb_keysyms}" != "yes"], [
- AC_MSG_ERROR([Please install xcb-keysyms from xcb-utils.])
- ])
- LDFLAGS="${LDFLAGS_save}"
- fi
-
- mozilla=:
- PLUGINS_BINDINGS="${PLUGINS_BINDINGS} mozilla"
- VLC_ADD_CPPFLAGS([mozilla],[[`${MOZILLA_CONFIG} --cflags plugin java`]])
- VLC_ADD_LIBS([mozilla],[`${MOZILLA_CONFIG} --libs plugin`])
- CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mozilla}"
- MOZILLA_REQUIRED_HEADERS=1
- AC_CHECK_HEADERS(mozilla-config.h,,MOZILLA_REQUIRED_HEADERS=0)
- AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0)
- AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0,
- [#if HAVE_NPAPI_H
- # include <npapi.h>
- #endif
- ])
- if test "${MOZILLA_REQUIRED_HEADERS}" = "0"
- then
- AC_MSG_ERROR([Please install the Mozilla development tools, required headers were not found.])
- fi
- MOZILLA_REQUIRED_HEADERS=
- CPPFLAGS="${CPPFLAGS_save}"
- MOZILLA_SDK_PATH="`${MOZILLA_CONFIG} --prefix`"
- ])
- dnl End of moz_sdk = ""
- ],[
- dnl special case for mingw32
- if test "${SYS}" = "mingw32"
- then
- AC_CHECK_TOOL(CYGPATH, cygpath, "")
- dnl latest gecko sdk does not have an xpcom directory
- if test -d "${with_mozilla_sdk_path}/xpcom"; then
- mozilla_sdk_xpcom="/xpcom"
- fi
- fi
-
- real_mozilla_sdk="`cd ${with_mozilla_sdk_path} 2>/dev/null && pwd`"
- CPPFLAGS="${CPPFLAGS_save} -I${real_mozilla_sdk}/include"
- MOZILLA_REQUIRED_HEADERS=1
- AC_CHECK_HEADERS(npapi.h,,MOZILLA_REQUIRED_HEADERS=0)
- AC_CHECK_HEADERS(npruntime.h,,MOZILLA_REQUIRED_HEADERS=0,
- [#if HAVE_NPAPI_H
- #include <npapi.h>
- #endif
- ])
- if test "${MOZILLA_REQUIRED_HEADERS}" = "0"
- then
- AC_MSG_ERROR([Please install the Mozilla development tools, required headers were not found.])
- fi
- MOZILLA_REQUIRED_HEADERS=
- mozilla=:
- PLUGINS_BINDINGS="${PLUGINS_BINDINGS} mozilla"
- VLC_ADD_CPPFLAGS([mozilla],[-DXPCOM_GLUE -DHAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX -I${real_mozilla_sdk}/include])
- MOZILLA_SDK_PATH="${real_mozilla_sdk}"
-
- if test -n "${CYGPATH}"; then
- real_mozilla_sdk="`${CYGPATH} -w ${real_mozilla_sdk}`"
- fi
- CPPFLAGS="${CPPFLAGS_save}"
- ])
-fi
-AC_LANG_POP(C++)
-AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
dnl
dnl Plugin and builtin checks
AC_SUBST(RCC)
AC_SUBST(UIC)
AC_SUBST(WINDRES)
-AC_SUBST(MOZILLA_SDK_PATH)
AC_SUBST(WINE_SDK_PATH)
AC_SUBST(LIBEXT)
AC_SUBST(AM_CPPFLAGS)
libs/srtp/Makefile
libs/unzip/Makefile
modules/Makefile
- projects/mozilla/Makefile
m4/Makefile
po/Makefile.in
share/Makefile
modules/arm_neon/Makefile
])
-AM_COND_IF([BUILD_MOZILLA], [
- AC_CONFIG_FILES([
- projects/mozilla/install.js
- projects/mozilla/install.rdf
- projects/mozilla/manifest.json
- ])
-])
-
AM_COND_IF([HAVE_WIN32], [
AC_CONFIG_FILES([
extras/package/win32/spad.nsi
projects/activex/axvlc_rc.rc
])
])
- AM_COND_IF([BUILD_MOZILLA], [
- AC_CONFIG_FILES([
- projects/mozilla/npvlc_rc.rc
- ])
- ])
])
AM_COND_IF([HAVE_DARWIN], [
AC_CONFIG_FILES([
extras/package/macosx/Info.plist
extras/package/macosx/Resources/English.lproj/InfoPlist.strings
- extras/package/macosx/plugin/Info.plist
- extras/package/macosx/plugin/InstallerInfo.plist
- ])
- AM_COND_IF([BUILD_MOZILLA], [
- AC_CONFIG_FILES([
- projects/mozilla/vlc.r
- ])
])
])
+++ /dev/null
-InstallerInfo.plist
+++ /dev/null
-<?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>CFBundleGetInfoString</key>
- <string>VLC Webbrowser Plugin - Version @VERSION@ - (c) @COPYRIGHT_YEARS@ The VideoLAN Team.</string>
- <key>CFHumanReadableCopyright</key>
- <string>Copyright (c) @COPYRIGHT_YEARS@ the VideoLAN Team</string>
- <key>CFBundleIdentifier</key>
- <string>com.netscape.vlc</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>VideoLAN VLC Plug-in</string>
- <key>CFBundlePackageType</key>
- <string>BRPL</string>
- <key>CFBundleSignature</key>
- <string>MOSS</string>
- <key>CFBundleVersion</key>
- <string>@VERSION@</string>
- <key>CFBundleShortVersionString</key>
- <string>@VERSION@</string>
- <key>CSResourcesFileMapped</key>
- <true/>
- <key>LSMinimumSystemVersion</key>
- <string>10.5.0</string>
-</dict>
-</plist>
+++ /dev/null
-<?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>IFPkgDescriptionDescription</key>
- <string>Safari and Firefox Plug-In for the VideoLAN VLC Multimedia player.</string>
- <key>IFPkgDescriptionTitle</key>
- <string>VideoLAN VLC Internet Plug-In</string>
-</dict>
-</plist>
+++ /dev/null
-<?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>CFBundleGetInfoString</key>
- <string>@VERSION@, The VideoLAN Team</string>
- <key>CFBundleIdentifier</key>
- <string>org.videolan.vlc</string>
- <key>CFBundleShortVersionString</key>
- <string>@VERSION@</string>
- <key>IFMajorVersion</key>
- <integer>0</integer>
- <key>IFMinorVersion</key>
- <integer>8</integer>
- <key>IFPkgFlagAllowBackRev</key>
- <false/>
- <key>IFPkgFlagAuthorizationAction</key>
- <string>AdminAuthorization</string>
- <key>IFPkgFlagBackgroundAlignment</key>
- <string>topleft</string>
- <key>IFPkgFlagBackgroundScaling</key>
- <string>none</string>
- <key>IFPkgFlagDefaultLocation</key>
- <string>/Library/Internet Plug-Ins</string>
- <key>IFPkgFlagFollowLinks</key>
- <true/>
- <key>IFPkgFlagInstallFat</key>
- <false/>
- <key>IFPkgFlagInstalledSize</key>
- <integer>30212</integer>
- <key>IFPkgFlagIsRequired</key>
- <false/>
- <key>IFPkgFlagOverwritePermissions</key>
- <false/>
- <key>IFPkgFlagRelocatable</key>
- <false/>
- <key>IFPkgFlagRestartAction</key>
- <string>NoRestart</string>
- <key>IFPkgFlagRootVolumeOnly</key>
- <true/>
- <key>IFPkgFlagUpdateInstalledLanguages</key>
- <false/>
- <key>IFPkgFormatVersion</key>
- <real>0.10000000149011612</real>
-</dict>
-</plist>
+++ /dev/null
-<?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>
+++ /dev/null
-install.js
-npvlc_rc.rc
-vlc.r
-install.rdf
-manifest.json
+++ /dev/null
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-\f
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-\f
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-\f
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-\f
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-\f
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-\f
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-\f
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-\f
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-\f
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
+++ /dev/null
-###############################################################################
-# Building the Mozilla plugin
-###############################################################################
-
-MOSTLYCLEANFILES =
-CLEANFILES = $(BUILT_SOURCES)
-EXTRA_DIST = $(DIST_sources) npvlc_rc.rc.in COPYING npvlc.dll.manifest
-
-SOURCES_mozilla_common = \
- vlcshell.cpp \
- vlcshell.h \
- vlcplugin.cpp \
- vlcplugin.h \
- control/npolibvlc.cpp \
- control/npolibvlc.h \
- control/nporuntime.cpp \
- control/nporuntime.h \
- control/position.h \
- support/classinfo.h
-
-DIST_sources = $(SOURCES_mozilla_common) \
- support/npwin.cpp support/npmac.cpp support/npunix.c
-
-if BUILD_MOZILLA
-
-LIBRARIES_libvlc = $(top_builddir)/src/libvlc.la \
- $(top_builddir)/src/libvlccore.la
-
-if HAVE_WIN32
-
-# Under Win32, Mozilla plugins need to be named NP******.DLL, but under Unix
-# the common naming scheme is lib******plugin.so. Also, we need npwin.cpp
-# under Win32 and npunix.c under Unix.
-#
-lib_LTLIBRARIES = npvlc.la
-
-SOURCES_support = support/npwin.cpp
-CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
-LDFLAGS_mozilla_EXTRA = -no-undefined -Wl,--kill-at -Wl,$(DATA_npvlc_rc)
-
-npvlc_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
-npvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla` $(CPPFLAGS_mozilla_extra)
-npvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla` $(CPPFLAGS_mozilla_extra)
-npvlc_la_DEPENDENCIES = $(DATA_npvlc_rc) $(LIBRARIES_libvlc)
-npvlc_la_LDFLAGS = `$(VLC_CONFIG) --ldflags mozilla` -module -avoid-version \
- $(LDFLAGS_mozilla_EXTRA)
-npvlc_la_LIBADD = `$(VLC_CONFIG) -libs mozilla` $(LIBRARIES_libvlc)
-
-DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
-noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
-noinst_npvlc_rcdir =
-
-npvlc_rc.$(OBJEXT): npvlc_rc.rc
- $(WINDRES) --include-dir $(srcdir) -i $< -o $@
-
-else
-if HAVE_DARWIN
-
-#
-# MacOS X
-#
-
-lib_LTLIBRARIES = npvlc.la
-
-SOURCES_support = support/npmac.cpp
-CPPFLAGS_mozilla_EXTRA = -I. -I$(top_builddir) -I$(srcdir)/../include -c \
- -F/System/Library/Frameworks/CoreFoundation.framework $(moz_CFLAGS) \
- -I/Developer/Headers/FlatCarbon -fno-common -fpascal-strings \
- -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -DXP_MACOSX=1 \
- -DNO_X11=1 -DUSE_SYSTEM_CONSOLE=1 -pipe -fmessage-length=0
-LDFLAGS_mozilla_EXTRA = -no-undefined -bundle -Wl,-read_only_relocs -Wl,suppress \
- -Wl,-headerpad_max_install_names -shrext $(LIBEXT) -Wl,-framework,Carbon -Wl,-framework,System
-
-npvlc_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
-npvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla` $(CPPFLAGS_mozilla_EXTRA)
-npvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla` $(CPPFLAGS_mozilla_EXTRA)
-npvlc_la_DEPENDENCIES = $(LIBRARIES_libvlc)
-npvlc_la_LDFLAGS = `$(VLC_CONFIG) --ldflags mozilla` -module -avoid-version \
- $(LDFLAGS_mozilla_EXTRA)
-npvlc_la_LIBADD = `$(VLC_CONFIG) -libs mozilla` $(LIBRARIES_libvlc)
-
-
-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 $@
-
-#
-# Plugin uses shared libraries that are located relatively through @executable_path,
-# which unfortunately references the path of the App using the Plugin, rather than the
-# Plugin itself. Since this Plugin should always be installed in '/Library/Internet Plug-Ins',
-# it is safer to force dylibs to locate dependents through a fixed path
-#
-define FIXEXECPATH
- otool -L "$$dylib" | \
- awk -v libdylib="$$dylib" ' \
- /@executable_path/ { \
- newpath=$$1 ; \
- sub("@executable_path","/Library/Internet Plug-Ins/VLC Plugin.plugin/Contents/MacOS",newpath) ; \
- print "install_name_tool -change \""$$1"\" \""newpath"\" \""libdylib"\"" ; \
- }' | sh -x
-endef
-
-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)/projects/macosx/framework/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"
- 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 '{}' \;
-
-# uncomment if dependencies on XPCOM libs is sought
-# if test -d "$(MOZILLA_SDK_PATH)/lib"; then \
-# for i in "$(MOZILLA_SDK_PATH)"/lib/*.dylib ; do \
-# dylib="$(srcdir)/$@/Contents/MacOS/`basename $${i}`" ; \
-# $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
-# $(FIXEXECPATH); \
-# done ; \
-# fi
-
-else
-
-#
-# UNIX/Others platforms
-#
-
-CPPFLAGS_mozilla_EXTRA = -DDATA_PATH=\"$(pkgdatadir)\"
-
-npvlc_LTLIBRARIES = libvlcplugin.la
-
-npvlc = libvlcplugin$(LIBEXT)
-npvlcdir = $(libdir)/mozilla/plugins
-SOURCES_support = support/npunix.c
-
-libvlcplugin_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
-libvlcplugin_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla` $(CPPFLAGS_mozilla_EXTRA)
-libvlcplugin_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla` $(CPPFLAGS_mozilla_EXTRA)
-libvlcplugin_la_LDFLAGS = `$(VLC_CONFIG) --ldflags mozilla` -module -avoid-version -shrext $(LIBEXT)
-libvlcplugin_la_LIBADD = $(LIBRARIES_libvlc) `$(VLC_CONFIG) -libs mozilla`
-# automake gets confused by the ../..
-libvlcplugin_la_DEPENDENCIES = $(AM_LIBADD)
-endif
-endif
-endif
-
+++ /dev/null
-/*****************************************************************************
- * npolibvlc.cpp: official Javascript APIs
- *****************************************************************************
- * Copyright (C) 2002-2009 the VideoLAN team
- * Copyright (C) 2010 M2X BV
- *
- * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
- * JP Dinger <jpd@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include "config.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "vlcplugin.h"
-#include "npolibvlc.h"
-
-#include "position.h"
-
-/*
-** Local helper macros and function
-*/
-#define COUNTNAMES(a,b,c) const int a::b = sizeof(a::c)/sizeof(NPUTF8 *)
-#define RETURN_ON_ERROR \
- do { \
- NPN_SetException(this, libvlc_errmsg()); \
- return INVOKERESULT_GENERIC_ERROR; \
- }while(0)
-
-#define ERROR_EVENT_NOT_FOUND "ERROR: One or more events could not be found."
-#define ERROR_API_VERSION "ERROR: NPAPI version not high enough. (Gecko >= 1.9 needed)"
-
-// Make a copy of an NPVariant.
-NPVariant copyNPVariant(const NPVariant& original)
-{
- NPVariant res;
-
- if (NPVARIANT_IS_STRING(original))
- STRINGZ_TO_NPVARIANT(strdup(NPVARIANT_TO_STRING(original).UTF8Characters), res);
- else if (NPVARIANT_IS_INT32(original))
- INT32_TO_NPVARIANT(NPVARIANT_TO_INT32(original), res);
- else if (NPVARIANT_IS_DOUBLE(original))
- DOUBLE_TO_NPVARIANT(NPVARIANT_TO_DOUBLE(original), res);
- else if (NPVARIANT_IS_OBJECT(original))
- {
- NPObject *obj = NPVARIANT_TO_OBJECT(original);
- NPN_RetainObject(obj);
- OBJECT_TO_NPVARIANT(obj, res);
- }
- else if (NPVARIANT_IS_BOOLEAN(original))
- BOOLEAN_TO_NPVARIANT(NPVARIANT_TO_BOOLEAN(original), res);
-
- return res;
-}
-
-/*
-** implementation of libvlc root object
-*/
-
-LibvlcRootNPObject::~LibvlcRootNPObject()
-{
- /*
- ** When the plugin is destroyed, firefox takes it upon itself to
- ** destroy all 'live' script objects and ignores refcounting.
- ** Therefore we cannot safely assume that refcounting will control
- ** lifespan of objects. Hence they are only lazily created on
- ** request, so that firefox can take ownership, and are not released
- ** when the plugin is destroyed.
- */
- if( isValid() )
- {
- if( audioObj ) NPN_ReleaseObject(audioObj);
- if( inputObj ) NPN_ReleaseObject(inputObj);
- if( playlistObj ) NPN_ReleaseObject(playlistObj);
- if( subtitleObj ) NPN_ReleaseObject(subtitleObj);
- if( videoObj ) NPN_ReleaseObject(videoObj);
- }
-}
-
-const NPUTF8 * const LibvlcRootNPObject::propertyNames[] =
-{
- "audio",
- "input",
- "playlist",
- "subtitle",
- "video",
- "VersionInfo",
-};
-COUNTNAMES(LibvlcRootNPObject,propertyCount,propertyNames);
-
-enum LibvlcRootNPObjectPropertyIds
-{
- ID_root_audio = 0,
- ID_root_input,
- ID_root_playlist,
- ID_root_subtitle,
- ID_root_video,
- ID_root_VersionInfo,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcRootNPObject::getProperty(int index, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- switch( index )
- {
- case ID_root_audio:
- InstantObj<LibvlcAudioNPObject>( audioObj );
- OBJECT_TO_NPVARIANT(NPN_RetainObject(audioObj), result);
- return INVOKERESULT_NO_ERROR;
- case ID_root_input:
- InstantObj<LibvlcInputNPObject>( inputObj );
- OBJECT_TO_NPVARIANT(NPN_RetainObject(inputObj), result);
- return INVOKERESULT_NO_ERROR;
- case ID_root_playlist:
- InstantObj<LibvlcPlaylistNPObject>( playlistObj );
- OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistObj), result);
- return INVOKERESULT_NO_ERROR;
- case ID_root_subtitle:
- InstantObj<LibvlcSubtitleNPObject>( subtitleObj );
- OBJECT_TO_NPVARIANT(NPN_RetainObject(subtitleObj), result);
- return INVOKERESULT_NO_ERROR;
- case ID_root_video:
- InstantObj<LibvlcVideoNPObject>( videoObj );
- OBJECT_TO_NPVARIANT(NPN_RetainObject(videoObj), result);
- return INVOKERESULT_NO_ERROR;
- case ID_root_VersionInfo:
- return invokeResultString(libvlc_get_version(),result);
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-const NPUTF8 * const LibvlcRootNPObject::methodNames[] =
-{
- "versionInfo",
- "addEventListener",
- "removeEventListener",
-};
-COUNTNAMES(LibvlcRootNPObject,methodCount,methodNames);
-
-enum LibvlcRootNPObjectMethodIds
-{
- ID_root_versionInfo,
- ID_root_addeventlistener,
- ID_root_removeeventlistener,
-};
-
-RuntimeNPObject::InvokeResult LibvlcRootNPObject::invoke(int index,
- const NPVariant *args, uint32_t argCount, NPVariant &result)
-{
- /* is plugin still running */
- if( !isPluginRunning() )
- return INVOKERESULT_GENERIC_ERROR;
-
- switch( index )
- {
- case ID_root_versionInfo:
- if( 0 != argCount )
- return INVOKERESULT_NO_SUCH_METHOD;
- return invokeResultString(libvlc_get_version(),result);
-
- case ID_root_addeventlistener:
- case ID_root_removeeventlistener:
- if( (3 != argCount) ||
- !NPVARIANT_IS_STRING(args[0]) ||
- !NPVARIANT_IS_OBJECT(args[1]) ||
- !NPVARIANT_IS_BOOLEAN(args[2]) )
- break;
-
- if( !VlcPlugin::canUseEventListener() )
- {
- NPN_SetException(this, ERROR_API_VERSION);
- return INVOKERESULT_GENERIC_ERROR;
- }
-
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
-
- bool b;
- if( ID_root_addeventlistener == index )
- {
- NPN_RetainObject( NPVARIANT_TO_OBJECT(args[1]) );
- b = p_plugin->events.insert( NPVARIANT_TO_STRING(args[0]),
- NPVARIANT_TO_OBJECT(args[1]),
- NPVARIANT_TO_BOOLEAN(args[2]) );
- if( !b )
- NPN_ReleaseObject( NPVARIANT_TO_OBJECT(args[1]) );
- }
- else
- {
- b = p_plugin->events.remove( NPVARIANT_TO_STRING(args[0]),
- NPVARIANT_TO_OBJECT(args[1]),
- NPVARIANT_TO_BOOLEAN(args[2]) );
- if( b )
- NPN_ReleaseObject( NPVARIANT_TO_OBJECT(args[1]) );
- }
- VOID_TO_NPVARIANT(result);
-
- return b ? INVOKERESULT_NO_ERROR : INVOKERESULT_GENERIC_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
-}
-
-/*
-** implementation of libvlc audio object
-*/
-
-const NPUTF8 * const LibvlcAudioNPObject::propertyNames[] =
-{
- "mute",
- "volume",
- "track",
- "count",
- "channel",
-};
-COUNTNAMES(LibvlcAudioNPObject,propertyCount,propertyNames);
-
-enum LibvlcAudioNPObjectPropertyIds
-{
- ID_audio_mute,
- ID_audio_volume,
- ID_audio_track,
- ID_audio_count,
- ID_audio_channel,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcAudioNPObject::getProperty(int index, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
-
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_audio_mute:
- {
- bool muted = libvlc_audio_get_mute(p_md);
- BOOLEAN_TO_NPVARIANT(muted, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_audio_volume:
- {
- int volume = libvlc_audio_get_volume(p_md);
- INT32_TO_NPVARIANT(volume, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_audio_track:
- {
- int track = libvlc_audio_get_track(p_md);
- INT32_TO_NPVARIANT(track, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_audio_count:
- {
- // get the number of audio track available
- int i_track = libvlc_audio_get_track_count(p_md);
- // return it
- INT32_TO_NPVARIANT(i_track, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_audio_channel:
- {
- int channel = libvlc_audio_get_channel(p_md);
- INT32_TO_NPVARIANT(channel, result);
- return INVOKERESULT_NO_ERROR;
- }
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-RuntimeNPObject::InvokeResult
-LibvlcAudioNPObject::setProperty(int index, const NPVariant &value)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
-
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_audio_mute:
- if( NPVARIANT_IS_BOOLEAN(value) )
- {
- libvlc_audio_set_mute(p_md,
- NPVARIANT_TO_BOOLEAN(value));
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_INVALID_VALUE;
- case ID_audio_volume:
- if( isNumberValue(value) )
- {
- libvlc_audio_set_volume(p_md, numberValue(value));
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_INVALID_VALUE;
- case ID_audio_track:
- if( isNumberValue(value) )
- {
- libvlc_audio_set_track(p_md, numberValue(value));
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_INVALID_VALUE;
- case ID_audio_channel:
- if( isNumberValue(value) )
- {
- libvlc_audio_set_channel(p_md, numberValue(value));
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_INVALID_VALUE;
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-const NPUTF8 * const LibvlcAudioNPObject::methodNames[] =
-{
- "toggleMute",
- "description",
-};
-COUNTNAMES(LibvlcAudioNPObject,methodCount,methodNames);
-
-enum LibvlcAudioNPObjectMethodIds
-{
- ID_audio_togglemute,
- ID_audio_description,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcAudioNPObject::invoke(int index, const NPVariant *args,
- uint32_t argCount, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_audio_togglemute:
- if( argCount == 0 )
- {
- libvlc_audio_toggle_mute(p_md);
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- case ID_audio_description:
- {
- if( argCount == 1)
- {
- char *psz_name;
- int i_trackID, i_limit, i;
- libvlc_track_description_t *p_trackDesc;
-
- /* get tracks description */
- p_trackDesc = libvlc_audio_get_track_description(p_md);
- if( !p_trackDesc )
- return INVOKERESULT_GENERIC_ERROR;
-
- /* get the number of track available */
- i_limit = libvlc_audio_get_track_count(p_md);
-
- /* check if a number is given by the user
- * and get the track number */
- if( isNumberValue(args[0]) )
- i_trackID = numberValue(args[0]);
- else
- return INVOKERESULT_INVALID_VALUE;
-
- /* if bad number is given return invalid value */
- if ( ( i_trackID > ( i_limit - 1 ) ) || ( i_trackID < 0 ) )
- return INVOKERESULT_INVALID_VALUE;
-
- /* get the good trackDesc */
- for( i = 0 ; i < i_trackID ; i++ )
- {
- p_trackDesc = p_trackDesc->p_next;
- }
- psz_name = p_trackDesc->psz_name;
-
- /* display the name of the track chosen */
- return invokeResultString( psz_name, result );
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- }
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-/*
-** implementation of libvlc input object
-*/
-
-const NPUTF8 * const LibvlcInputNPObject::propertyNames[] =
-{
- "length",
- "position",
- "time",
- "state",
- "rate",
- "fps",
- "hasVout",
-};
-COUNTNAMES(LibvlcInputNPObject,propertyCount,propertyNames);
-
-enum LibvlcInputNPObjectPropertyIds
-{
- ID_input_length,
- ID_input_position,
- ID_input_time,
- ID_input_state,
- ID_input_rate,
- ID_input_fps,
- ID_input_hasvout,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcInputNPObject::getProperty(int index, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- {
- if( index != ID_input_state )
- RETURN_ON_ERROR;
- else
- {
- /* for input state, return CLOSED rather than an exception */
- INT32_TO_NPVARIANT(0, result);
- return INVOKERESULT_NO_ERROR;
- }
- }
-
- switch( index )
- {
- case ID_input_length:
- {
- double val = (double)libvlc_media_player_get_length(p_md);
- DOUBLE_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_input_position:
- {
- double val = libvlc_media_player_get_position(p_md);
- DOUBLE_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_input_time:
- {
- double val = (double)libvlc_media_player_get_time(p_md);
- DOUBLE_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_input_state:
- {
- int val = libvlc_media_player_get_state(p_md);
- INT32_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_input_rate:
- {
- float val = libvlc_media_player_get_rate(p_md);
- DOUBLE_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_input_fps:
- {
- double val = libvlc_media_player_get_fps(p_md);
- DOUBLE_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_input_hasvout:
- {
- bool val = p_plugin->player_has_vout();
- BOOLEAN_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-RuntimeNPObject::InvokeResult
-LibvlcInputNPObject::setProperty(int index, const NPVariant &value)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_input_position:
- {
- if( ! NPVARIANT_IS_DOUBLE(value) )
- {
- return INVOKERESULT_INVALID_VALUE;
- }
-
- float val = (float)NPVARIANT_TO_DOUBLE(value);
- libvlc_media_player_set_position(p_md, val);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_input_time:
- {
- int64_t val;
- if( NPVARIANT_IS_INT32(value) )
- val = (int64_t)NPVARIANT_TO_INT32(value);
- else if( NPVARIANT_IS_DOUBLE(value) )
- val = (int64_t)NPVARIANT_TO_DOUBLE(value);
- else
- {
- return INVOKERESULT_INVALID_VALUE;
- }
-
- libvlc_media_player_set_time(p_md, val);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_input_rate:
- {
- float val;
- if( NPVARIANT_IS_INT32(value) )
- val = (float)NPVARIANT_TO_INT32(value);
- else if( NPVARIANT_IS_DOUBLE(value) )
- val = (float)NPVARIANT_TO_DOUBLE(value);
- else
- {
- return INVOKERESULT_INVALID_VALUE;
- }
-
- libvlc_media_player_set_rate(p_md, val);
- return INVOKERESULT_NO_ERROR;
- }
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-const NPUTF8 * const LibvlcInputNPObject::methodNames[] =
-{
- /* no methods */
- "none",
-};
-COUNTNAMES(LibvlcInputNPObject,methodCount,methodNames);
-
-enum LibvlcInputNPObjectMethodIds
-{
- ID_none,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcInputNPObject::invoke(int index, const NPVariant *args,
- uint32_t argCount, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- switch( index )
- {
- case ID_none:
- return INVOKERESULT_NO_SUCH_METHOD;
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-/*
-** implementation of libvlc playlist items object
-*/
-
-const NPUTF8 * const LibvlcPlaylistItemsNPObject::propertyNames[] =
-{
- "count",
-};
-COUNTNAMES(LibvlcPlaylistItemsNPObject,propertyCount,propertyNames);
-
-enum LibvlcPlaylistItemsNPObjectPropertyIds
-{
- ID_playlistitems_count,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcPlaylistItemsNPObject::getProperty(int index, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
-
- switch( index )
- {
- case ID_playlistitems_count:
- {
- int val = p_plugin->playlist_count();
- INT32_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-const NPUTF8 * const LibvlcPlaylistItemsNPObject::methodNames[] =
-{
- "clear",
- "remove",
-};
-COUNTNAMES(LibvlcPlaylistItemsNPObject,methodCount,methodNames);
-
-enum LibvlcPlaylistItemsNPObjectMethodIds
-{
- ID_playlistitems_clear,
- ID_playlistitems_remove,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcPlaylistItemsNPObject::invoke(int index, const NPVariant *args,
- uint32_t argCount, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
-
- switch( index )
- {
- case ID_playlistitems_clear:
- if( argCount == 0 )
- {
- p_plugin->playlist_clear();
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- case ID_playlistitems_remove:
- if( (argCount == 1) && isNumberValue(args[0]) )
- {
- if( !p_plugin->playlist_delete_item(numberValue(args[0])) )
- return INVOKERESULT_GENERIC_ERROR;
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-/*
-** implementation of libvlc playlist object
-*/
-
-LibvlcPlaylistNPObject::~LibvlcPlaylistNPObject()
-{
- // Why the isValid()?
- if( isValid() && playlistItemsObj )
- NPN_ReleaseObject(playlistItemsObj);
-};
-
-const NPUTF8 * const LibvlcPlaylistNPObject::propertyNames[] =
-{
- "itemCount", /* deprecated */
- "isPlaying",
- "items",
-};
-COUNTNAMES(LibvlcPlaylistNPObject,propertyCount,propertyNames);
-
-enum LibvlcPlaylistNPObjectPropertyIds
-{
- ID_playlist_itemcount,
- ID_playlist_isplaying,
- ID_playlist_items,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcPlaylistNPObject::getProperty(int index, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
-
- switch( index )
- {
- case ID_playlist_itemcount: /* deprecated */
- {
- int val = p_plugin->playlist_count();
- INT32_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_playlist_isplaying:
- {
- int val = p_plugin->playlist_isplaying();
- BOOLEAN_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_playlist_items:
- {
- InstantObj<LibvlcPlaylistItemsNPObject>( playlistItemsObj );
- OBJECT_TO_NPVARIANT(NPN_RetainObject(playlistItemsObj), result);
- return INVOKERESULT_NO_ERROR;
- }
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-const NPUTF8 * const LibvlcPlaylistNPObject::methodNames[] =
-{
- "add",
- "play",
- "playItem",
- "togglePause",
- "stop",
- "next",
- "prev",
- "clear", /* deprecated */
- "removeItem", /* deprecated */
-};
-COUNTNAMES(LibvlcPlaylistNPObject,methodCount,methodNames);
-
-enum LibvlcPlaylistNPObjectMethodIds
-{
- ID_playlist_add,
- ID_playlist_play,
- ID_playlist_playItem,
- ID_playlist_togglepause,
- ID_playlist_stop,
- ID_playlist_next,
- ID_playlist_prev,
- ID_playlist_clear,
- ID_playlist_removeitem
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcPlaylistNPObject::invoke(int index, const NPVariant *args,
- uint32_t argCount, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
-
- switch( index )
- {
- // XXX FIXME this needs squashing into something much smaller
- case ID_playlist_add:
- {
- if( (argCount < 1) || (argCount > 3) )
- return INVOKERESULT_NO_SUCH_METHOD;
- if( !NPVARIANT_IS_STRING(args[0]) )
- return INVOKERESULT_NO_SUCH_METHOD;
-
- // grab URL
- if( NPVARIANT_IS_NULL(args[0]) )
- return INVOKERESULT_NO_SUCH_METHOD;
-
- char *s = stringValue(NPVARIANT_TO_STRING(args[0]));
- if( !s )
- return INVOKERESULT_OUT_OF_MEMORY;
-
- char *url = p_plugin->getAbsoluteURL(s);
- if( url )
- free(s);
- else
- // problem with combining url, use argument
- url = s;
-
- char *name = NULL;
-
- // grab name if available
- if( argCount > 1 )
- {
- if( NPVARIANT_IS_NULL(args[1]) )
- {
- // do nothing
- }
- else if( NPVARIANT_IS_STRING(args[1]) )
- {
- name = stringValue(NPVARIANT_TO_STRING(args[1]));
- }
- else
- {
- free(url);
- return INVOKERESULT_INVALID_VALUE;
- }
- }
-
- int i_options = 0;
- char** ppsz_options = NULL;
-
- // grab options if available
- if( argCount > 2 )
- {
- if( NPVARIANT_IS_NULL(args[2]) )
- {
- // do nothing
- }
- else if( NPVARIANT_IS_STRING(args[2]) )
- {
- parseOptions(NPVARIANT_TO_STRING(args[2]),
- &i_options, &ppsz_options);
-
- }
- else if( NPVARIANT_IS_OBJECT(args[2]) )
- {
- parseOptions(NPVARIANT_TO_OBJECT(args[2]),
- &i_options, &ppsz_options);
- }
- else
- {
- free(url);
- free(name);
- return INVOKERESULT_INVALID_VALUE;
- }
- }
-
- int item = p_plugin->playlist_add_extended_untrusted(url, name,
- i_options, const_cast<const char **>(ppsz_options));
- free(url);
- free(name);
- if( item == -1 )
- RETURN_ON_ERROR;
-
- for( int i=0; i< i_options; ++i )
- {
- free(ppsz_options[i]);
- }
- free(ppsz_options);
-
- INT32_TO_NPVARIANT(item, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_playlist_play:
- if( argCount == 0 )
- {
- p_plugin->playlist_play();
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- case ID_playlist_playItem:
- if( (argCount == 1) && isNumberValue(args[0]) )
- {
- p_plugin->playlist_play_item(numberValue(args[0]));
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- case ID_playlist_togglepause:
- if( argCount == 0 )
- {
- p_plugin->playlist_pause();
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- case ID_playlist_stop:
- if( argCount == 0 )
- {
- p_plugin->playlist_stop();
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- case ID_playlist_next:
- if( argCount == 0 )
- {
- p_plugin->playlist_next();
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- case ID_playlist_prev:
- if( argCount == 0 )
- {
- p_plugin->playlist_prev();
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- case ID_playlist_clear: /* deprecated */
- if( argCount == 0 )
- {
- p_plugin->playlist_clear();
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- case ID_playlist_removeitem: /* deprecated */
- if( (argCount == 1) && isNumberValue(args[0]) )
- {
- if( !p_plugin->playlist_delete_item(numberValue(args[0])) )
- return INVOKERESULT_GENERIC_ERROR;
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-// XXX FIXME The new playlist_add creates a media instance and feeds it
-// XXX FIXME these options one at a time, so this hunk of code does lots
-// XXX FIXME of unnecessairy work. Break out something that can do one
-// XXX FIXME option at a time and doesn't need to realloc().
-// XXX FIXME Same for the other version of parseOptions.
-
-void LibvlcPlaylistNPObject::parseOptions(const NPString &nps,
- int *i_options, char*** ppsz_options)
-{
- if( nps.UTF8Length )
- {
- char *s = stringValue(nps);
- char *val = s;
- if( val )
- {
- long capacity = 16;
- char **options = (char **)malloc(capacity*sizeof(char *));
- if( options )
- {
- int nOptions = 0;
-
- char *end = val + nps.UTF8Length;
- while( val < end )
- {
- // skip leading blanks
- while( (val < end)
- && ((*val == ' ' ) || (*val == '\t')) )
- ++val;
-
- char *start = val;
- // skip till we get a blank character
- while( (val < end)
- && (*val != ' ' )
- && (*val != '\t') )
- {
- char c = *(val++);
- if( ('\'' == c) || ('"' == c) )
- {
- // skip till end of string
- while( (val < end) && (*(val++) != c ) );
- }
- }
-
- if( val > start )
- {
- if( nOptions == capacity )
- {
- capacity += 16;
- char **moreOptions = (char **)realloc(options, capacity*sizeof(char*));
- if( ! moreOptions )
- {
- /* failed to allocate more memory */
- free(s);
- /* return what we got so far */
- *i_options = nOptions;
- *ppsz_options = options;
- return;
- }
- options = moreOptions;
- }
- *(val++) = '\0';
- options[nOptions++] = strdup(start);
- }
- else
- // must be end of string
- break;
- }
- *i_options = nOptions;
- *ppsz_options = options;
- }
- free(s);
- }
- }
-}
-
-// XXX FIXME See comment at the other parseOptions variant.
-void LibvlcPlaylistNPObject::parseOptions(NPObject *obj, int *i_options,
- char*** ppsz_options)
-{
- /* WARNING: Safari does not implement NPN_HasProperty/NPN_HasMethod */
-
- NPVariant value;
-
- /* we are expecting to have a Javascript Array object */
- NPIdentifier propId = NPN_GetStringIdentifier("length");
- if( NPN_GetProperty(_instance, obj, propId, &value) )
- {
- int count = numberValue(value);
- NPN_ReleaseVariantValue(&value);
-
- if( count )
- {
- long capacity = 16;
- char **options = (char **)malloc(capacity*sizeof(char *));
- if( options )
- {
- int nOptions = 0;
-
- while( nOptions < count )
- {
- propId = NPN_GetIntIdentifier(nOptions);
- if( ! NPN_GetProperty(_instance, obj, propId, &value) )
- /* return what we got so far */
- break;
-
- if( ! NPVARIANT_IS_STRING(value) )
- {
- /* return what we got so far */
- NPN_ReleaseVariantValue(&value);
- break;
- }
-
- if( nOptions == capacity )
- {
- capacity += 16;
- char **moreOptions = (char **)realloc(options, capacity*sizeof(char*));
- if( ! moreOptions )
- {
- /* failed to allocate more memory */
- NPN_ReleaseVariantValue(&value);
- /* return what we got so far */
- *i_options = nOptions;
- *ppsz_options = options;
- break;
- }
- options = moreOptions;
- }
-
- options[nOptions++] = stringValue(value);
- NPN_ReleaseVariantValue(&value);
- }
- *i_options = nOptions;
- *ppsz_options = options;
- }
- }
- }
-}
-
-/*
-** implementation of libvlc subtitle object
-*/
-
-const NPUTF8 * const LibvlcSubtitleNPObject::propertyNames[] =
-{
- "track",
- "count",
-};
-
-enum LibvlcSubtitleNPObjectPropertyIds
-{
- ID_subtitle_track,
- ID_subtitle_count,
-};
-COUNTNAMES(LibvlcSubtitleNPObject,propertyCount,propertyNames);
-
-RuntimeNPObject::InvokeResult
-LibvlcSubtitleNPObject::getProperty(int index, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_subtitle_track:
- {
- /* get the current subtitle ID */
- int i_spu = libvlc_video_get_spu(p_md);
- /* return it */
- INT32_TO_NPVARIANT(i_spu, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_subtitle_count:
- {
- /* get the number of subtitles available */
- int i_spu = libvlc_video_get_spu_count(p_md);
- /* return it */
- INT32_TO_NPVARIANT(i_spu, result);
- return INVOKERESULT_NO_ERROR;
- }
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-RuntimeNPObject::InvokeResult
-LibvlcSubtitleNPObject::setProperty(int index, const NPVariant &value)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_subtitle_track:
- {
- if( isNumberValue(value) )
- {
- /* set the new subtitle track to show */
- libvlc_video_set_spu(p_md, numberValue(value));
-
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_INVALID_VALUE;
- }
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-const NPUTF8 * const LibvlcSubtitleNPObject::methodNames[] =
-{
- "description"
-};
-COUNTNAMES(LibvlcSubtitleNPObject,methodCount,methodNames);
-
-enum LibvlcSubtitleNPObjectMethodIds
-{
- ID_subtitle_description
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcSubtitleNPObject::invoke(int index, const NPVariant *args,
- uint32_t argCount, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_subtitle_description:
- {
- if( argCount == 1)
- {
- char *psz_name;
- int i_spuID, i_limit, i;
- libvlc_track_description_t *p_spuDesc;
-
- /* get subtitles description */
- p_spuDesc = libvlc_video_get_spu_description(p_md);
- if( !p_spuDesc )
- return INVOKERESULT_GENERIC_ERROR;
-
- /* get the number of subtitle available */
- i_limit = libvlc_video_get_spu_count(p_md);
-
- /* check if a number is given by the user
- * and get the subtitle number */
- if( isNumberValue(args[0]) )
- i_spuID = numberValue(args[0]);
- else
- return INVOKERESULT_INVALID_VALUE;
-
- /* if bad number is given return invalid value */
- if ( ( i_spuID > ( i_limit -1 ) ) || ( i_spuID < 0 ) )
- return INVOKERESULT_INVALID_VALUE;
-
- /* get the good spuDesc */
- for( i = 0 ; i < i_spuID ; i++ )
- {
- p_spuDesc = p_spuDesc->p_next;
- }
- psz_name = p_spuDesc->psz_name;
-
- /* return the name of the track chosen */
- return invokeResultString(psz_name, result);
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- }
- default:
- return INVOKERESULT_NO_SUCH_METHOD;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-/*
-** implementation of libvlc video object
-*/
-
-LibvlcVideoNPObject::~LibvlcVideoNPObject()
-{
- if( isValid() )
- {
- if( marqueeObj ) NPN_ReleaseObject(marqueeObj);
- if( logoObj ) NPN_ReleaseObject(logoObj);
- if( deintObj ) NPN_ReleaseObject(deintObj);
- }
-}
-
-const NPUTF8 * const LibvlcVideoNPObject::propertyNames[] =
-{
- "fullscreen",
- "height",
- "width",
- "aspectRatio",
- "subtitle",
- "crop",
- "teletext",
- "marquee",
- "logo",
- "deinterlace",
-};
-
-enum LibvlcVideoNPObjectPropertyIds
-{
- ID_video_fullscreen,
- ID_video_height,
- ID_video_width,
- ID_video_aspectratio,
- ID_video_subtitle,
- ID_video_crop,
- ID_video_teletext,
- ID_video_marquee,
- ID_video_logo,
- ID_video_deinterlace,
-};
-COUNTNAMES(LibvlcVideoNPObject,propertyCount,propertyNames);
-
-RuntimeNPObject::InvokeResult
-LibvlcVideoNPObject::getProperty(int index, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_video_fullscreen:
- {
- int val = p_plugin->get_fullscreen();
- BOOLEAN_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_height:
- {
- int val = libvlc_video_get_height(p_md);
- INT32_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_width:
- {
- int val = libvlc_video_get_width(p_md);
- INT32_TO_NPVARIANT(val, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_aspectratio:
- {
- NPUTF8 *psz_aspect = libvlc_video_get_aspect_ratio(p_md);
- if( !psz_aspect )
- return INVOKERESULT_GENERIC_ERROR;
-
- STRINGZ_TO_NPVARIANT(psz_aspect, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_subtitle:
- {
- int i_spu = libvlc_video_get_spu(p_md);
- INT32_TO_NPVARIANT(i_spu, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_crop:
- {
- NPUTF8 *psz_geometry = libvlc_video_get_crop_geometry(p_md);
- if( !psz_geometry )
- return INVOKERESULT_GENERIC_ERROR;
-
- STRINGZ_TO_NPVARIANT(psz_geometry, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_teletext:
- {
- int i_page = libvlc_video_get_teletext(p_md);
- if( i_page < 0 )
- return INVOKERESULT_GENERIC_ERROR;
- INT32_TO_NPVARIANT(i_page, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_marquee:
- {
- InstantObj<LibvlcMarqueeNPObject>( marqueeObj );
- OBJECT_TO_NPVARIANT(NPN_RetainObject(marqueeObj), result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_logo:
- {
- InstantObj<LibvlcLogoNPObject>( logoObj );
- OBJECT_TO_NPVARIANT(NPN_RetainObject(logoObj), result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_deinterlace:
- {
- InstantObj<LibvlcDeinterlaceNPObject>( deintObj );
- OBJECT_TO_NPVARIANT(NPN_RetainObject(deintObj), result);
- return INVOKERESULT_NO_ERROR;
- }
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-RuntimeNPObject::InvokeResult
-LibvlcVideoNPObject::setProperty(int index, const NPVariant &value)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_video_fullscreen:
- {
- if( ! NPVARIANT_IS_BOOLEAN(value) )
- {
- return INVOKERESULT_INVALID_VALUE;
- }
-
- int val = NPVARIANT_TO_BOOLEAN(value);
- p_plugin->set_fullscreen(val);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_aspectratio:
- {
- char *psz_aspect = NULL;
-
- if( ! NPVARIANT_IS_STRING(value) )
- {
- return INVOKERESULT_INVALID_VALUE;
- }
-
- psz_aspect = stringValue(NPVARIANT_TO_STRING(value));
- if( !psz_aspect )
- {
- return INVOKERESULT_GENERIC_ERROR;
- }
-
- libvlc_video_set_aspect_ratio(p_md, psz_aspect);
- free(psz_aspect);
-
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_subtitle:
- {
- if( isNumberValue(value) )
- {
- libvlc_video_set_spu(p_md, numberValue(value));
-
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_INVALID_VALUE;
- }
- case ID_video_crop:
- {
- char *psz_geometry = NULL;
-
- if( ! NPVARIANT_IS_STRING(value) )
- {
- return INVOKERESULT_INVALID_VALUE;
- }
-
- psz_geometry = stringValue(NPVARIANT_TO_STRING(value));
- if( !psz_geometry )
- {
- return INVOKERESULT_GENERIC_ERROR;
- }
-
- libvlc_video_set_crop_geometry(p_md, psz_geometry);
- free(psz_geometry);
-
- return INVOKERESULT_NO_ERROR;
- }
- case ID_video_teletext:
- {
- if( isNumberValue(value) )
- {
- libvlc_video_set_teletext(p_md, numberValue(value));
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_INVALID_VALUE;
- }
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-const NPUTF8 * const LibvlcVideoNPObject::methodNames[] =
-{
- "toggleFullscreen",
- "toggleTeletext",
-};
-COUNTNAMES(LibvlcVideoNPObject,methodCount,methodNames);
-
-enum LibvlcVideoNPObjectMethodIds
-{
- ID_video_togglefullscreen,
- ID_video_toggleteletext,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcVideoNPObject::invoke(int index, const NPVariant *args,
- uint32_t argCount, NPVariant &result)
-{
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_video_togglefullscreen:
- {
- if( argCount == 0 )
- {
- p_plugin->toggle_fullscreen();
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- }
- case ID_video_toggleteletext:
- {
- if( argCount == 0 )
- {
- libvlc_toggle_teletext(p_md);
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- }
- default:
- return INVOKERESULT_NO_SUCH_METHOD;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-/*
-** implementation of libvlc marquee object
-*/
-
-const NPUTF8 * const LibvlcMarqueeNPObject::propertyNames[] =
-{
- "color",
- "opacity",
- "position",
- "refresh",
- "size",
- "text",
- "timeout",
- "x",
- "y",
-};
-
-enum LibvlcMarqueeNPObjectPropertyIds
-{
- ID_marquee_color,
- ID_marquee_opacity,
- ID_marquee_position,
- ID_marquee_refresh,
- ID_marquee_size,
- ID_marquee_text,
- ID_marquee_timeout,
- ID_marquee_x,
- ID_marquee_y,
-};
-
-COUNTNAMES(LibvlcMarqueeNPObject,propertyCount,propertyNames);
-
-static const unsigned char marquee_idx[] = {
- libvlc_marquee_Color,
- libvlc_marquee_Opacity,
- libvlc_marquee_Position,
- libvlc_marquee_Refresh,
- libvlc_marquee_Size,
- 0,
- libvlc_marquee_Timeout,
- libvlc_marquee_X,
- libvlc_marquee_Y,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcMarqueeNPObject::getProperty(int index, NPVariant &result)
-{
- char *psz;
-
- if( !isPluginRunning() )
- return INVOKERESULT_GENERIC_ERROR;
-
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_marquee_color:
- case ID_marquee_opacity:
- case ID_marquee_refresh:
- case ID_marquee_timeout:
- case ID_marquee_size:
- case ID_marquee_x:
- case ID_marquee_y:
- INT32_TO_NPVARIANT(
- libvlc_video_get_marquee_int(p_md, marquee_idx[index]),
- result );
- return INVOKERESULT_NO_ERROR;
-
- case ID_marquee_position:
- STRINGZ_TO_NPVARIANT( position_bynumber(
- libvlc_video_get_marquee_int(p_md, libvlc_marquee_Position) ),
- result );
-
- break;
-
- case ID_marquee_text:
- psz = libvlc_video_get_marquee_string(p_md, libvlc_marquee_Text);
- if( psz )
- {
- STRINGZ_TO_NPVARIANT(psz, result);
- return INVOKERESULT_NO_ERROR;
- }
- break;
- }
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-RuntimeNPObject::InvokeResult
-LibvlcMarqueeNPObject::setProperty(int index, const NPVariant &value)
-{
- size_t i;
-
- if( !isPluginRunning() )
- return INVOKERESULT_GENERIC_ERROR;
-
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_marquee_color:
- case ID_marquee_opacity:
- case ID_marquee_refresh:
- case ID_marquee_timeout:
- case ID_marquee_x:
- case ID_marquee_y:
- if( NPVARIANT_IS_INT32( value ) )
- {
- libvlc_video_set_marquee_int(p_md, marquee_idx[index],
- NPVARIANT_TO_INT32( value ));
- return INVOKERESULT_NO_ERROR;
- }
- break;
-
- case ID_marquee_position:
- if( !NPVARIANT_IS_STRING(value) ||
- !position_byname( NPVARIANT_TO_STRING(value).UTF8Characters, i ) )
- return INVOKERESULT_INVALID_VALUE;
-
- libvlc_video_set_marquee_int(p_md, libvlc_marquee_Position, i);
- return INVOKERESULT_NO_ERROR;
-
- case ID_marquee_text:
- if( NPVARIANT_IS_STRING( value ) )
- {
- char *psz_text = stringValue( NPVARIANT_TO_STRING( value ) );
- libvlc_video_set_marquee_string(p_md, libvlc_marquee_Text,
- psz_text);
- free(psz_text);
- return INVOKERESULT_NO_ERROR;
- }
- break;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
-}
-
-const NPUTF8 * const LibvlcMarqueeNPObject::methodNames[] =
-{
- "enable",
- "disable",
-};
-COUNTNAMES(LibvlcMarqueeNPObject,methodCount,methodNames);
-
-enum LibvlcMarqueeNPObjectMethodIds
-{
- ID_marquee_enable,
- ID_marquee_disable,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcMarqueeNPObject::invoke(int index, const NPVariant *args,
- uint32_t argCount, NPVariant &result)
-{
- if( !isPluginRunning() )
- return INVOKERESULT_GENERIC_ERROR;
-
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_marquee_enable:
- case ID_marquee_disable:
- libvlc_video_set_marquee_int(p_md, libvlc_marquee_Enable,
- index!=ID_marquee_disable);
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
-}
-
-const NPUTF8 * const LibvlcLogoNPObject::propertyNames[] = {
- "delay",
- "repeat",
- "opacity",
- "position",
- "x",
- "y",
-};
-enum LibvlcLogoNPObjectPropertyIds {
- ID_logo_delay,
- ID_logo_repeat,
- ID_logo_opacity,
- ID_logo_position,
- ID_logo_x,
- ID_logo_y,
-};
-COUNTNAMES(LibvlcLogoNPObject,propertyCount,propertyNames);
-static const unsigned char logo_idx[] = {
- libvlc_logo_delay,
- libvlc_logo_repeat,
- libvlc_logo_opacity,
- 0,
- libvlc_logo_x,
- libvlc_logo_y,
-};
-
-RuntimeNPObject::InvokeResult
-LibvlcLogoNPObject::getProperty(int index, NPVariant &result)
-{
- if( !isPluginRunning() )
- return INVOKERESULT_GENERIC_ERROR;
-
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_logo_delay:
- case ID_logo_repeat:
- case ID_logo_opacity:
- case ID_logo_x:
- case ID_logo_y:
-
- INT32_TO_NPVARIANT(
- libvlc_video_get_logo_int(p_md, logo_idx[index]), result);
- break;
-
- case ID_logo_position:
- STRINGZ_TO_NPVARIANT( position_bynumber(
- libvlc_video_get_logo_int(p_md, libvlc_logo_position) ),
- result );
- break;
- default:
- return INVOKERESULT_GENERIC_ERROR;
- }
- return INVOKERESULT_NO_ERROR;
-}
-
-RuntimeNPObject::InvokeResult
-LibvlcLogoNPObject::setProperty(int index, const NPVariant &value)
-{
- size_t i;
-
- if( !isPluginRunning() )
- return INVOKERESULT_GENERIC_ERROR;
-
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_media_player_t *p_md = p_plugin->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_logo_delay:
- case ID_logo_repeat:
- case ID_logo_opacity:
- case ID_logo_x:
- case ID_logo_y:
- if( !NPVARIANT_IS_INT32(value) )
- return INVOKERESULT_INVALID_VALUE;
-
- libvlc_video_set_logo_int(p_md, logo_idx[index],
- NPVARIANT_TO_INT32( value ));
- break;
-
- case ID_logo_position:
- if( !NPVARIANT_IS_STRING(value) ||
- !position_byname( NPVARIANT_TO_STRING(value).UTF8Characters, i ) )
- return INVOKERESULT_INVALID_VALUE;
-
- libvlc_video_set_logo_int(p_md, libvlc_logo_position, i);
- break;
- default:
- return INVOKERESULT_GENERIC_ERROR;
- }
- return INVOKERESULT_NO_ERROR;
-}
-
-
-const NPUTF8 * const LibvlcLogoNPObject::methodNames[] = {
- "enable",
- "disable",
- "file",
-};
-enum LibvlcLogoNPObjectMethodIds {
- ID_logo_enable,
- ID_logo_disable,
- ID_logo_file,
-};
-COUNTNAMES(LibvlcLogoNPObject,methodCount,methodNames);
-
-RuntimeNPObject::InvokeResult
-LibvlcLogoNPObject::invoke(int index, const NPVariant *args,
- uint32_t argCount, NPVariant &result)
-{
- char *buf, *h;
- size_t i, len;
-
- if( !isPluginRunning() )
- return INVOKERESULT_GENERIC_ERROR;
-
- libvlc_media_player_t *p_md = getPrivate<VlcPlugin>()->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_logo_enable:
- case ID_logo_disable:
- if( argCount != 0 )
- return INVOKERESULT_GENERIC_ERROR;
-
- libvlc_video_set_logo_int(p_md, libvlc_logo_enable,
- index != ID_logo_disable);
- VOID_TO_NPVARIANT(result);
- break;
-
- case ID_logo_file:
- if( argCount == 0 )
- return INVOKERESULT_GENERIC_ERROR;
-
- for( len=0,i=0;i<argCount;++i )
- {
- if( !NPVARIANT_IS_STRING(args[i]) )
- return INVOKERESULT_INVALID_VALUE;
- len+=NPVARIANT_TO_STRING(args[i]).UTF8Length+1;
- }
-
- buf = (char *)malloc( len+1 );
- if( !buf )
- return INVOKERESULT_OUT_OF_MEMORY;
-
- for( h=buf,i=0;i<argCount;++i )
- {
- if(i) *h++=';';
- len=NPVARIANT_TO_STRING(args[i]).UTF8Length;
- memcpy(h,NPVARIANT_TO_STRING(args[i]).UTF8Characters,len);
- h+=len;
- }
- *h='\0';
-
- libvlc_video_set_logo_string(p_md, libvlc_logo_file, buf);
- free( buf );
- VOID_TO_NPVARIANT(result);
- break;
- default:
- return INVOKERESULT_NO_SUCH_METHOD;
- }
- return INVOKERESULT_NO_ERROR;
-}
-
-
-const NPUTF8 * const LibvlcDeinterlaceNPObject::propertyNames[] = {
-};
-enum LibvlcDeinterlaceNPObjectPropertyIds {
-};
-COUNTNAMES(LibvlcDeinterlaceNPObject,propertyCount,propertyNames);
-
-RuntimeNPObject::InvokeResult
-LibvlcDeinterlaceNPObject::getProperty(int index, NPVariant &result)
-{
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-RuntimeNPObject::InvokeResult
-LibvlcDeinterlaceNPObject::setProperty(int index, const NPVariant &value)
-{
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-
-const NPUTF8 * const LibvlcDeinterlaceNPObject::methodNames[] = {
- "enable",
- "disable",
-};
-enum LibvlcDeinterlaceNPObjectMethodIds {
- ID_deint_enable,
- ID_deint_disable,
-};
-COUNTNAMES(LibvlcDeinterlaceNPObject,methodCount,methodNames);
-
-RuntimeNPObject::InvokeResult
-LibvlcDeinterlaceNPObject::invoke(int index, const NPVariant *args,
- uint32_t argCount, NPVariant &result)
-{
- char *psz;
-
- if( !isPluginRunning() )
- return INVOKERESULT_GENERIC_ERROR;
-
- libvlc_media_player_t *p_md = getPrivate<VlcPlugin>()->getMD();
- if( !p_md )
- RETURN_ON_ERROR;
-
- switch( index )
- {
- case ID_deint_disable:
- libvlc_video_set_deinterlace(p_md, NULL);
- break;
-
- case ID_deint_enable:
- if( argCount != 1 || !NPVARIANT_IS_STRING( args[0] ) )
- return INVOKERESULT_INVALID_VALUE;
-
- psz = stringValue( NPVARIANT_TO_STRING( args[0] ) );
- libvlc_video_set_deinterlace(p_md, psz);
- free(psz);
- break;
-
- default:
- return INVOKERESULT_NO_SUCH_METHOD;
- }
- return INVOKERESULT_NO_ERROR;
-}
+++ /dev/null
-/*****************************************************************************
- * npolibvlc.h: official Javascript APIs
- *****************************************************************************
- * Copyright (C) 2002-2006 the VideoLAN team
- *
- * Authors: Damien Fouilleul <damien.fouilleul@laposte.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*
-** defined runtime script objects
-*/
-#include <vlc/vlc.h>
-
-#include "nporuntime.h"
-
-class LibvlcRootNPObject: public RuntimeNPObject
-{
-protected:
- friend class RuntimeNPClass<LibvlcRootNPObject>;
-
- LibvlcRootNPObject(NPP instance, const NPClass *aClass) :
- RuntimeNPObject(instance, aClass),
- audioObj(NULL),
- inputObj(NULL),
- playlistObj(NULL),
- subtitleObj(NULL),
- videoObj(NULL) { }
-
- virtual ~LibvlcRootNPObject();
-
- static const int propertyCount;
- static const NPUTF8 * const propertyNames[];
-
- InvokeResult getProperty(int index, NPVariant &result);
-
- static const int methodCount;
- static const NPUTF8 * const methodNames[];
-
- InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
-
-private:
- NPObject *audioObj;
- NPObject *inputObj;
- NPObject *playlistObj;
- NPObject *subtitleObj;
- NPObject *videoObj;
-};
-
-class LibvlcAudioNPObject: public RuntimeNPObject
-{
-protected:
- LibvlcAudioNPObject(NPP instance, const NPClass *aClass) :
- RuntimeNPObject(instance, aClass) {};
- virtual ~LibvlcAudioNPObject() {};
-
- friend class RuntimeNPClass<LibvlcAudioNPObject>;
-
- static const int propertyCount;
- static const NPUTF8 * const propertyNames[];
-
- InvokeResult getProperty(int index, NPVariant &result);
- InvokeResult setProperty(int index, const NPVariant &value);
-
- static const int methodCount;
- static const NPUTF8 * const methodNames[];
-
- InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
-};
-
-class LibvlcInputNPObject: public RuntimeNPObject
-{
-protected:
- friend class RuntimeNPClass<LibvlcInputNPObject>;
-
- LibvlcInputNPObject(NPP instance, const NPClass *aClass) :
- RuntimeNPObject(instance, aClass) {};
-
- virtual ~LibvlcInputNPObject() {};
-
- static const int propertyCount;
- static const NPUTF8 * const propertyNames[];
-
- InvokeResult getProperty(int index, NPVariant &result);
- InvokeResult setProperty(int index, const NPVariant &value);
-
- static const int methodCount;
- static const NPUTF8 * const methodNames[];
-
- InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
-};
-
-class LibvlcPlaylistItemsNPObject: public RuntimeNPObject
-{
-protected:
- friend class RuntimeNPClass<LibvlcPlaylistItemsNPObject>;
-
- LibvlcPlaylistItemsNPObject(NPP instance, const NPClass *aClass) :
- RuntimeNPObject(instance, aClass) {};
- virtual ~LibvlcPlaylistItemsNPObject() {};
-
- static const int propertyCount;
- static const NPUTF8 * const propertyNames[];
-
- InvokeResult getProperty(int index, NPVariant &result);
-
- static const int methodCount;
- static const NPUTF8 * const methodNames[];
-
- InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
-};
-
-class LibvlcPlaylistNPObject: public RuntimeNPObject
-{
-protected:
- friend class RuntimeNPClass<LibvlcPlaylistNPObject>;
-
- LibvlcPlaylistNPObject(NPP instance, const NPClass *aClass) :
- RuntimeNPObject(instance, aClass),
- playlistItemsObj(NULL) {};
-
- virtual ~LibvlcPlaylistNPObject();
-
- static const int propertyCount;
- static const NPUTF8 * const propertyNames[];
-
- InvokeResult getProperty(int index, NPVariant &result);
-
- static const int methodCount;
- static const NPUTF8 * const methodNames[];
-
- InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
-
- void parseOptions(const NPString &s, int *i_options, char*** ppsz_options);
- void parseOptions(NPObject *obj, int *i_options, char*** ppsz_options);
-
-private:
- NPObject* playlistItemsObj;
-};
-
-class LibvlcSubtitleNPObject: public RuntimeNPObject
-{
-protected:
- friend class RuntimeNPClass<LibvlcSubtitleNPObject>;
-
- LibvlcSubtitleNPObject(NPP instance, const NPClass *aClass) :
- RuntimeNPObject(instance, aClass) {};
- virtual ~LibvlcSubtitleNPObject() {};
-
- static const int propertyCount;
- static const NPUTF8 * const propertyNames[];
-
- InvokeResult getProperty(int index, NPVariant &result);
- InvokeResult setProperty(int index, const NPVariant &value);
-
- static const int methodCount;
- static const NPUTF8 * const methodNames[];
-
- InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
-};
-
-
-class LibvlcVideoNPObject: public RuntimeNPObject
-{
-protected:
- friend class RuntimeNPClass<LibvlcVideoNPObject>;
-
- LibvlcVideoNPObject(NPP instance, const NPClass *aClass) :
- RuntimeNPObject(instance, aClass),
- marqueeObj(NULL), logoObj(NULL), deintObj(NULL) { }
- virtual ~LibvlcVideoNPObject();
-
- static const int propertyCount;
- static const NPUTF8 * const propertyNames[];
-
- InvokeResult getProperty(int index, NPVariant &result);
- InvokeResult setProperty(int index, const NPVariant &value);
-
- static const int methodCount;
- static const NPUTF8 * const methodNames[];
-
- InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
-
-private:
- NPObject *marqueeObj;
- NPObject *logoObj;
- NPObject *deintObj;
-};
-
-class LibvlcMarqueeNPObject: public RuntimeNPObject
-{
-protected:
- friend class RuntimeNPClass<LibvlcMarqueeNPObject>;
-
- LibvlcMarqueeNPObject(NPP instance, const NPClass *aClass) :
- RuntimeNPObject(instance, aClass) {};
- virtual ~LibvlcMarqueeNPObject() {};
-
- static const int propertyCount;
- static const NPUTF8 * const propertyNames[];
-
- InvokeResult getProperty(int index, NPVariant &result);
- InvokeResult setProperty(int index, const NPVariant &value);
-
- static const int methodCount;
- static const NPUTF8 * const methodNames[];
-
- InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
-};
-
-class LibvlcLogoNPObject: public RuntimeNPObject
-{
-protected:
- friend class RuntimeNPClass<LibvlcLogoNPObject>;
-
- LibvlcLogoNPObject(NPP instance, const NPClass *aClass) :
- RuntimeNPObject(instance, aClass) { }
- virtual ~LibvlcLogoNPObject() { }
-
- static const int propertyCount;
- static const NPUTF8 * const propertyNames[];
-
- InvokeResult getProperty(int index, NPVariant &result);
- InvokeResult setProperty(int index, const NPVariant &value);
-
- static const int methodCount;
- static const NPUTF8 * const methodNames[];
-
- InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
-};
-
-class LibvlcDeinterlaceNPObject: public RuntimeNPObject
-{
-protected:
- friend class RuntimeNPClass<LibvlcDeinterlaceNPObject>;
-
- LibvlcDeinterlaceNPObject(NPP instance, const NPClass *aClass) :
- RuntimeNPObject(instance, aClass) { }
- virtual ~LibvlcDeinterlaceNPObject() { }
-
- static const int propertyCount;
- static const NPUTF8 * const propertyNames[];
-
- InvokeResult getProperty(int index, NPVariant &result);
- InvokeResult setProperty(int index, const NPVariant &value);
-
- static const int methodCount;
- static const NPUTF8 * const methodNames[];
-
- InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
-};
-
+++ /dev/null
-/*****************************************************************************
- * runtime.cpp: support for NPRuntime API for Netscape Script-able plugins
- * FYI: http://www.mozilla.org/projects/plugins/npruntime.html
- *****************************************************************************
- * Copyright (C) 2005 the VideoLAN team
- *
- * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include "config.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "nporuntime.h"
-#include "vlcplugin.h"
-
-char* RuntimeNPObject::stringValue(const NPString &s)
-{
- NPUTF8 *val = static_cast<NPUTF8*>(malloc((s.UTF8Length+1) * sizeof(*val)));
- if( val )
- {
- strncpy(val, s.UTF8Characters, s.UTF8Length);
- val[s.UTF8Length] = '\0';
- }
- return val;
-}
-
-char* RuntimeNPObject::stringValue(const NPVariant &v)
-{
- char *s = NULL;
- if( NPVARIANT_IS_STRING(v) )
- {
- return stringValue(NPVARIANT_TO_STRING(v));
- }
- return s;
-}
-
-RuntimeNPObject::InvokeResult RuntimeNPObject::getProperty(int index, NPVariant &result)
-{
- /* default behaviour */
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-RuntimeNPObject::InvokeResult RuntimeNPObject::setProperty(int index, const NPVariant &value)
-{
- /* default behaviour */
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-RuntimeNPObject::InvokeResult RuntimeNPObject::removeProperty(int index)
-{
- /* default behaviour */
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-RuntimeNPObject::InvokeResult RuntimeNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)
-{
- /* default beahviour */
- return INVOKERESULT_GENERIC_ERROR;
-}
-
-RuntimeNPObject::InvokeResult RuntimeNPObject::invokeDefault(const NPVariant *args, uint32_t argCount, NPVariant &result)
-{
- /* return void */
- VOID_TO_NPVARIANT(result);
- return INVOKERESULT_NO_ERROR;
-}
-
-bool RuntimeNPObject::returnInvokeResult(RuntimeNPObject::InvokeResult result)
-{
- switch( result )
- {
- case INVOKERESULT_NO_ERROR:
- return true;
- case INVOKERESULT_GENERIC_ERROR:
- break;
- case INVOKERESULT_NO_SUCH_METHOD:
- NPN_SetException(this, "No such method or arguments mismatch");
- break;
- case INVOKERESULT_INVALID_ARGS:
- NPN_SetException(this, "Invalid arguments");
- break;
- case INVOKERESULT_INVALID_VALUE:
- NPN_SetException(this, "Invalid value in assignment");
- break;
- case INVOKERESULT_OUT_OF_MEMORY:
- NPN_SetException(this, "Out of memory");
- break;
- }
- return false;
-}
-
-RuntimeNPObject::InvokeResult
-RuntimeNPObject::invokeResultString(const char *psz, NPVariant &result)
-{
- if( !psz )
- NULL_TO_NPVARIANT(result);
- else
- {
- size_t len = strlen(psz);
- NPUTF8* retval = (NPUTF8*)NPN_MemAlloc(len);
- if( !retval )
- return INVOKERESULT_OUT_OF_MEMORY;
- else
- {
- memcpy(retval, psz, len);
- STRINGN_TO_NPVARIANT(retval, len, result);
- }
- }
- return INVOKERESULT_NO_ERROR;
-}
+++ /dev/null
-/*****************************************************************************
- * runtime.cpp: support for NPRuntime API for Netscape Script-able plugins
- * FYI: http://www.mozilla.org/projects/plugins/npruntime.html
- *****************************************************************************
- * Copyright (C) 2002-2005 the VideoLAN team
- * $Id$
- *
- * Authors: Damien Fouilleul <damien.fouilleul@laposte.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef __NPORUNTIME_H__
-#define __NPORUNTIME_H__
-
-/*
-** support framework for runtime script objects
-*/
-
-#include <npapi.h>
-#include <npruntime.h>
-
-static void RuntimeNPClassDeallocate(NPObject *npobj);
-static void RuntimeNPClassInvalidate(NPObject *npobj);
-static bool RuntimeNPClassInvokeDefault(NPObject *npobj,
- const NPVariant *args,
- uint32_t argCount,
- NPVariant *result);
-
-class RuntimeNPObject : public NPObject
-{
-public:
- // Lazy child object cration helper. Doing this avoids
- // ownership problems with firefox.
- template<class T> void InstantObj( NPObject *&obj );
-
- /*
- ** utility functions
- */
-
- static bool isNumberValue(const NPVariant &v)
- {
- return NPVARIANT_IS_INT32(v)
- || NPVARIANT_IS_DOUBLE(v);
- };
-
- static int numberValue(const NPVariant &v)
- {
- switch( v.type ) {
- case NPVariantType_Int32:
- return NPVARIANT_TO_INT32(v);
- case NPVariantType_Double:
- return(int)NPVARIANT_TO_DOUBLE(v);
- default:
- return 0;
- }
- };
-
- static char* stringValue(const NPString &v);
- static char* stringValue(const NPVariant &v);
-
-protected:
- void *operator new(size_t n)
- {
- /*
- ** Assume that browser has a smarter memory allocator
- ** than plain old malloc() and use it instead.
- */
- return NPN_MemAlloc(n);
- };
-
- void operator delete(void *p)
- {
- NPN_MemFree(p);
- };
-
- bool isValid()
- {
- return _instance != NULL;
- };
-
- RuntimeNPObject(NPP instance, const NPClass *aClass) :
- _instance(instance)
- {
- _class = const_cast<NPClass *>(aClass);
- referenceCount = 1;
- };
- virtual ~RuntimeNPObject() {};
-
- enum InvokeResult
- {
- INVOKERESULT_NO_ERROR = 0, /* returns no error */
- INVOKERESULT_GENERIC_ERROR = 1, /* returns error */
- INVOKERESULT_NO_SUCH_METHOD = 2, /* throws method does not exist */
- INVOKERESULT_INVALID_ARGS = 3, /* throws invalid arguments */
- INVOKERESULT_INVALID_VALUE = 4, /* throws invalid value in assignment */
- INVOKERESULT_OUT_OF_MEMORY = 5, /* throws out of memory */
- };
-
- friend void RuntimeNPClassDeallocate(NPObject *npobj);
- friend void RuntimeNPClassInvalidate(NPObject *npobj);
- template <class RuntimeNPObject> friend bool RuntimeNPClassGetProperty(NPObject *npobj, NPIdentifier name, NPVariant *result);
- template <class RuntimeNPObject> friend bool RuntimeNPClassSetProperty(NPObject *npobj, NPIdentifier name, const NPVariant *value);
- template <class RuntimeNPObject> friend bool RuntimeNPClassRemoveProperty(NPObject *npobj, NPIdentifier name);
- template <class RuntimeNPObject> friend bool RuntimeNPClassInvoke(NPObject *npobj, NPIdentifier name,
- const NPVariant *args, uint32_t argCount,
- NPVariant *result);
- friend bool RuntimeNPClassInvokeDefault(NPObject *npobj,
- const NPVariant *args,
- uint32_t argCount,
- NPVariant *result);
-
- virtual InvokeResult getProperty(int index, NPVariant &result);
- virtual InvokeResult setProperty(int index, const NPVariant &value);
- virtual InvokeResult removeProperty(int index);
- virtual InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
- virtual InvokeResult invokeDefault(const NPVariant *args, uint32_t argCount, NPVariant &result);
-
- bool returnInvokeResult(InvokeResult result);
-
- static InvokeResult invokeResultString(const char *,NPVariant &);
-
- bool isPluginRunning()
- {
- return (_instance->pdata != NULL);
- }
- template<class T> T *getPrivate()
- {
- return reinterpret_cast<T *>(_instance->pdata);
- }
-
- NPP _instance;
-};
-
-template<class T> class RuntimeNPClass : public NPClass
-{
-public:
- static NPClass *getClass()
- {
- static NPClass *singleton = new RuntimeNPClass<T>;
- return singleton;
- }
-
-protected:
- RuntimeNPClass();
- virtual ~RuntimeNPClass();
-
- template <class RuntimeNPObject> friend NPObject *RuntimeNPClassAllocate(NPP instance, NPClass *aClass);
- template <class RuntimeNPObject> friend bool RuntimeNPClassHasMethod(NPObject *npobj, NPIdentifier name);
- template <class RuntimeNPObject> friend bool RuntimeNPClassHasProperty(NPObject *npobj, NPIdentifier name);
- template <class RuntimeNPObject> friend bool RuntimeNPClassGetProperty(NPObject *npobj, NPIdentifier name, NPVariant *result);
- template <class RuntimeNPObject> friend bool RuntimeNPClassSetProperty(NPObject *npobj, NPIdentifier name, const NPVariant *value);
- template <class RuntimeNPObject> friend bool RuntimeNPClassRemoveProperty(NPObject *npobj, NPIdentifier name);
- template <class RuntimeNPObject> friend bool RuntimeNPClassInvoke(NPObject *npobj, NPIdentifier name,
- const NPVariant *args, uint32_t argCount,
- NPVariant *result);
-
- RuntimeNPObject *create(NPP instance) const;
-
- int indexOfMethod(NPIdentifier name) const;
- int indexOfProperty(NPIdentifier name) const;
-
-private:
- NPIdentifier *propertyIdentifiers;
- NPIdentifier *methodIdentifiers;
-};
-
-template<class T>
-inline void RuntimeNPObject::InstantObj( NPObject *&obj )
-{
- if( !obj )
- obj = NPN_CreateObject(_instance, RuntimeNPClass<T>::getClass());
-}
-
-template<class T>
-static NPObject *RuntimeNPClassAllocate(NPP instance, NPClass *aClass)
-{
- const RuntimeNPClass<T> *vClass = static_cast<RuntimeNPClass<T> *>(aClass);
- return vClass->create(instance);
-}
-
-static void RuntimeNPClassDeallocate(NPObject *npobj)
-{
- RuntimeNPObject *vObj = static_cast<RuntimeNPObject *>(npobj);
- vObj->_class = NULL;
- delete vObj;
-}
-
-static void RuntimeNPClassInvalidate(NPObject *npobj)
-{
- RuntimeNPObject *vObj = static_cast<RuntimeNPObject *>(npobj);
- vObj->_instance = NULL;
-}
-
-template<class T>
-static bool RuntimeNPClassHasMethod(NPObject *npobj, NPIdentifier name)
-{
- const RuntimeNPClass<T> *vClass = static_cast<RuntimeNPClass<T> *>(npobj->_class);
- return vClass->indexOfMethod(name) != -1;
-}
-
-template<class T>
-static bool RuntimeNPClassHasProperty(NPObject *npobj, NPIdentifier name)
-{
- const RuntimeNPClass<T> *vClass = static_cast<RuntimeNPClass<T> *>(npobj->_class);
- return vClass->indexOfProperty(name) != -1;
-}
-
-template<class T>
-static bool RuntimeNPClassGetProperty(NPObject *npobj, NPIdentifier name, NPVariant *result)
-{
- RuntimeNPObject *vObj = static_cast<RuntimeNPObject *>(npobj);
- if( vObj->isValid() )
- {
- const RuntimeNPClass<T> *vClass = static_cast<RuntimeNPClass<T> *>(npobj->_class);
- int index = vClass->indexOfProperty(name);
- if( index != -1 )
- {
- return vObj->returnInvokeResult(vObj->getProperty(index, *result));
- }
- }
- return false;
-}
-
-template<class T>
-static bool RuntimeNPClassSetProperty(NPObject *npobj, NPIdentifier name, const NPVariant *value)
-{
- RuntimeNPObject *vObj = static_cast<RuntimeNPObject *>(npobj);
- if( vObj->isValid() )
- {
- const RuntimeNPClass<T> *vClass = static_cast<RuntimeNPClass<T> *>(npobj->_class);
- int index = vClass->indexOfProperty(name);
- if( index != -1 )
- {
- return vObj->returnInvokeResult(vObj->setProperty(index, *value));
- }
- }
- return false;
-}
-
-template<class T>
-static bool RuntimeNPClassRemoveProperty(NPObject *npobj, NPIdentifier name)
-{
- RuntimeNPObject *vObj = static_cast<RuntimeNPObject *>(npobj);
- if( vObj->isValid() )
- {
- const RuntimeNPClass<T> *vClass = static_cast<RuntimeNPClass<T> *>(npobj->_class);
- int index = vClass->indexOfProperty(name);
- if( index != -1 )
- {
- return vObj->returnInvokeResult(vObj->removeProperty(index));
- }
- }
- return false;
-}
-
-template<class T>
-static bool RuntimeNPClassInvoke(NPObject *npobj, NPIdentifier name,
- const NPVariant *args, uint32_t argCount,
- NPVariant *result)
-{
- RuntimeNPObject *vObj = static_cast<RuntimeNPObject *>(npobj);
- if( vObj->isValid() )
- {
- const RuntimeNPClass<T> *vClass = static_cast<RuntimeNPClass<T> *>(npobj->_class);
- int index = vClass->indexOfMethod(name);
- if( index != -1 )
- {
- return vObj->returnInvokeResult(vObj->invoke(index, args, argCount, *result));
-
- }
- }
- return false;
-}
-
-static bool RuntimeNPClassInvokeDefault(NPObject *npobj,
- const NPVariant *args,
- uint32_t argCount,
- NPVariant *result)
-{
- RuntimeNPObject *vObj = static_cast<RuntimeNPObject *>(npobj);
- if( vObj->isValid() )
- {
- return vObj->returnInvokeResult(vObj->invokeDefault(args, argCount, *result));
- }
- return false;
-}
-
-template<class T>
-RuntimeNPClass<T>::RuntimeNPClass()
-{
- // retreive property identifiers from names
- if( T::propertyCount > 0 )
- {
- propertyIdentifiers = new NPIdentifier[T::propertyCount];
- if( propertyIdentifiers )
- NPN_GetStringIdentifiers(const_cast<const NPUTF8**>(T::propertyNames),
- T::propertyCount, propertyIdentifiers);
- }
-
- // retreive method identifiers from names
- if( T::methodCount > 0 )
- {
- methodIdentifiers = new NPIdentifier[T::methodCount];
- if( methodIdentifiers )
- NPN_GetStringIdentifiers(const_cast<const NPUTF8**>(T::methodNames),
- T::methodCount, methodIdentifiers);
- }
-
- // fill in NPClass structure
- structVersion = NP_CLASS_STRUCT_VERSION;
- allocate = &RuntimeNPClassAllocate<T>;
- deallocate = &RuntimeNPClassDeallocate;
- invalidate = &RuntimeNPClassInvalidate;
- hasMethod = &RuntimeNPClassHasMethod<T>;
- invoke = &RuntimeNPClassInvoke<T>;
- invokeDefault = &RuntimeNPClassInvokeDefault;
- hasProperty = &RuntimeNPClassHasProperty<T>;
- getProperty = &RuntimeNPClassGetProperty<T>;
- setProperty = &RuntimeNPClassSetProperty<T>;
- removeProperty = &RuntimeNPClassRemoveProperty<T>;
-}
-
-template<class T>
-RuntimeNPClass<T>::~RuntimeNPClass()
-{
- delete[] propertyIdentifiers;
- delete[] methodIdentifiers;
-}
-
-template<class T>
-RuntimeNPObject *RuntimeNPClass<T>::create(NPP instance) const
-{
- return new T(instance, this);
-}
-
-template<class T>
-int RuntimeNPClass<T>::indexOfMethod(NPIdentifier name) const
-{
- if( methodIdentifiers )
- {
- for(int c=0; c< T::methodCount; ++c )
- {
- if( name == methodIdentifiers[c] )
- return c;
- }
- }
- return -1;
-}
-
-template<class T>
-int RuntimeNPClass<T>::indexOfProperty(NPIdentifier name) const
-{
- if( propertyIdentifiers )
- {
- for(int c=0; c< T::propertyCount; ++c )
- {
- if( name == propertyIdentifiers[c] )
- return c;
- }
- }
- return -1;
-}
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * position.h: Support routines for logo and marquee plugin objects
- *****************************************************************************
- * Copyright (C) 2010 M2X BV
- *
- * Authors: JP Dinger <jpd (at) videolan (dot) org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-#ifndef POSITION_H
-#define POSITION_H
-
-struct posidx_s { const char *n; size_t i; };
-static const posidx_s posidx[] = {
- { "center", 0 },
- { "left", 1 },
- { "right", 2 },
- { "top", 4 },
- { "bottom", 8 },
- { "top-left", 5 },
- { "top-right", 6 },
- { "bottom-left", 9 },
- { "bottom-right", 10 },
-};
-enum { num_posidx = sizeof(posidx)/sizeof(*posidx) };
-
-static inline const char *position_bynumber( size_t i )
-{
- for( const posidx_s *h=posidx; h<posidx+num_posidx; ++h )
- if( h->i == i )
- return h->n;
- return "undefined";
-}
-
-static inline bool position_byname( const char *n, size_t &i )
-{
- for( const posidx_s *h=posidx; h<posidx+num_posidx; ++h )
- if( !strcasecmp( n, h->n ) )
- { i=h->i; return true; }
- return false;
-}
-#endif
+++ /dev/null
-var version = "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@@VERSION_EXTRA@";
-
-initInstall( "VideoLAN", "VLC", version, 1);
-
-var tmpFolder = getFolder( "Temporary" );
-
-if ( !fileExists( tmpFolder) )
-{
- logComment( "Cannot find Temporary Folder!" );
- cancelInstall();
-}
-
-setPackageFolder( tmpFolder );
-
-addFile( "http://downloads.videolan.org/pub/videolan/testing/@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@@VERSION_EXTRA@/win32/vlc-@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@@VERSION_EXTRA@-win32.exe" );
-
-var exe = getFolder(tmpFolder, "vlc-@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@@VERSION_EXTRA@-win32.exe");
-File.execute( exe );
-
-performInstall();
-
+++ /dev/null
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
- <Description about="urn:mozilla:install-manifest">
- <em:id>vlc-plugin@videolan.org</em:id>
- <em:name>VLC Web Plugin</em:name>
- <em:version>@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@@VERSION_EXTRA@</em:version>
- <em:targetApplication>
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>1.5</em:minVersion>
- <em:maxVersion>3.6.*</em:maxVersion>
- </Description>
- </em:targetApplication>
- </Description>
-</RDF>
-
+++ /dev/null
-{
- "name": "VLC Web Plugin",
- "version": "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@.@VERSION_EXTRA_RC@",
- "description": "VLC Web Plugin Bundle, by VideoLAN",
- "plugins": [{"path":"plugins/npvlc.dll", "public":true }]
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <assemblyIdentity
- version="1.0.0.0"
- processorArchitecture="x86"
- name="npvlc.dll"
- type="win32"
- />
- <description>VLC Mozilla plugin</description>
-</assembly>
\ No newline at end of file
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-//
-// VLC Plugin description.
-//
-#define VERSION_NUMBER @VERSION_MAJOR@,@VERSION_MINOR@,@VERSION_REVISION@,@VERSION_EXTRA_RC@
-
-//VS_VERSION_INFO VERSIONINFO
-1 VERSIONINFO
- FILEVERSION VERSION_NUMBER
- PRODUCTVERSION VERSION_NUMBER
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904e4"
- BEGIN
- VALUE "ProductName", "VLC Web Plugin\0"
- VALUE "ProductVersion", "@VERSION@"
- VALUE "OriginalFilename", "npvlc.dll\0"
- VALUE "FileVersion", "@VERSION@"
- VALUE "FileDescription", "Version @VERSION@, copyright @COPYRIGHT_YEARS@ The VideoLAN Team<br><a href=""http://www.videolan.org/"">http://www.videolan.org/</a>\0"
- VALUE "InternalName", "npvlc\0"
- VALUE "CompanyName", "VideoLAN\0"
- VALUE "LegalCopyright", "Copyright \251 @COPYRIGHT_YEARS@ VideoLAN and Authors\0"
- VALUE "MIMEType", "audio/mpeg|audio/x-mpeg|video/mpeg|video/x-mpeg|video/mpeg-system|video/x-mpeg-system|video/mp4|audio/mp4|application/mpeg4-iod|application/mpeg4-muxcodetable|video/x-msvideo|video/quicktime|application/x-ogg|application/ogg|application/x-vlc-plugin|video/x-ms-asf-plugin|video/x-ms-asf|application/x-mplayer2|video/x-ms-wmv|application/x-google-vlc-plugin|audio/wav|audio/x-wav|audio/3gpp|video/3gpp|audio/3gpp2|video/3gpp2|video/divx|video/flv|video/x-flv|video/x-matroska|audio/x-matroska|application/xspf+xml|audio/x-m4a|audio/x-mpegurl|audio/x-ms-wma\0"
- VALUE "FileExtents", "mp2,mp3,mpga,mpega|mp2,mp3,mpga,mpega|mpg,mpeg,mpe|mpg,mpeg,mpe|mpg,mpeg,vob|mpg,mpeg,vob|mp4,mpg4|mp4,mpg4|mp4,mpg4|mp4,mpg4|avi|mov,qt|ogg|ogg|vlc|asf,asx|asf,asx||wmv||wav|wav|3gp,3gpp|3gp,3gpp|3g2,3gpp2|3g2,3gpp2|divx|flv|flv|mkv|mka|xspf|m4a|m3u|wma\0"
- VALUE "FileOpenName", "MPEG audio|MPEG audio|MPEG video|MPEG video|MPEG video|MPEG video|MPEG-4 video|MPEG-4 audio|MPEG-4 video|MPEG-4 video|AVI video|QuickTime video|Ogg stream|Ogg stream|VLC plug-in|Windows Media video|Windows Media video|Windows Media plug-in|Windows Media video|Google VLC plug-in|WAV audio|WAV audio|3GPP audio|3GPP video|3GPP2 audio|3GPP2 video|DivX video|FLV video|FLV video|Matroska video|Matroska audio|Playlist xspf|MPEG-4 audio|Playlist M3U|Windows Media Audio\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1252
- END
-END
+++ /dev/null
-#include "nsIClassInfo.h"
-
-// helper class to implement all necessary nsIClassInfo method stubs
-// and to set flags used by the security system
-class ClassInfo : public nsIClassInfo
-{
- // These flags are used by the DOM and security systems to signal that
- // JavaScript callers are allowed to call this object's scritable methods.
- NS_IMETHOD GetFlags(PRUint32 *aFlags)
- {*aFlags = nsIClassInfo::PLUGIN_OBJECT | nsIClassInfo::DOM_OBJECT;
- return NS_OK;}
- NS_IMETHOD GetImplementationLanguage(PRUint32 *aImplementationLanguage)
- {*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
- return NS_OK;}
-
- // The rest of the methods can safely return error codes...
- NS_IMETHOD GetInterfaces(PRUint32 *count, nsIID * **array)
- {return NS_ERROR_NOT_IMPLEMENTED;}
- NS_IMETHOD GetHelperForLanguage(PRUint32 language, nsISupports **_retval)
- {return NS_ERROR_NOT_IMPLEMENTED;}
- NS_IMETHOD GetContractID(char * *aContractID)
- {return NS_ERROR_NOT_IMPLEMENTED;}
- NS_IMETHOD GetClassDescription(char * *aClassDescription)
- {return NS_ERROR_NOT_IMPLEMENTED;}
- NS_IMETHOD GetClassID(nsCID * *aClassID)
- {return NS_ERROR_NOT_IMPLEMENTED;}
- NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
- {return NS_ERROR_NOT_IMPLEMENTED;}
-};
-
+++ /dev/null
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * Safari/Mozilla/Firefox plugin for VLC
- * Copyright (C) 2009, Jean-Paul Saman <jpsaman@videolan.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-//
-// npmac.cpp
-//
-//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-#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
-
-//
-// A4Stuff.h contains the definition of EnterCodeResource and
-// 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(__MWERKS__) && (__MWERKS__ >= 0x2400)) || defined(__GNUC__)
- #define EnterCodeResource()
- #define ExitCodeResource()
-#else
- #include <A4Stuff.h>
-#endif
-
-#include "npapi.h"
-
-//
-// The Mixed Mode procInfos defined in npupp.h assume Think C-
-// style calling conventions. These conventions are used by
-// Metrowerks with the exception of pointer return types, which
-// in Metrowerks 68K are returned in A0, instead of the standard
-// D0. Thus, since NPN_MemAlloc and NPN_UserAgent return pointers,
-// Mixed Mode will return the values to a 68K plugin in D0, but
-// a 68K plugin compiled by Metrowerks will expect the result in
-// A0. The following pragma forces Metrowerks to use D0 instead.
-//
-#ifdef __MWERKS__
-#ifndef powerc
-#pragma pointers_in_D0
-#endif
-#endif
-
-#ifdef XP_UNIX
-#undef XP_UNIX
-#endif
-
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
-#include "npupp.h"
-// e.g. CALL_NPN(CallNPN_GetURLNotify, x, y, z) -> CallNPN_GetURLNotify(x, y, z);
-#define CALL_NPN(__CallNPNFunc__, ...) (__CallNPNFunc__(__VA_ARGS__))
-#else
-#include "npfunctions.h"
-#define CALL_NPN(unused, FN, ...) ((*FN)(__VA_ARGS__))
-#endif
-
-#include "../vlcshell.h"
-
-#ifdef __MWERKS__
-#ifndef powerc
-#pragma pointers_in_A0
-#endif
-#endif
-
-// The following fix for static initializers (which fixes a previous
-// incompatibility with some parts of PowerPlant, was submitted by
-// Jan Ulbrich.
-#ifdef __MWERKS__
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifndef powerc
- extern void __InitCode__(void);
- #else
- extern void __sinit(void);
- #define __InitCode__ __sinit
- #endif
- extern void __destroy_global_chain(void);
- #ifdef __cplusplus
- }
- #endif // __cplusplus
-#endif // __MWERKS__
-
-//
-// Define PLUGIN_TRACE to 1 to have the wrapper functions emit
-// DebugStr messages whenever they are called.
-//
-#define PLUGIN_TRACE 0
-
-#if PLUGIN_TRACE
-#define PLUGINDEBUGSTR(msg) ::DebugStr(msg)
-#else
-#define PLUGINDEBUGSTR(msg) {}
-#endif
-
-#if defined(XP_MACOSX) && defined(__POWERPC__) && (!defined(TARGET_RT_MAC_CFM))
-
-// glue for mapping outgoing Macho function pointers to TVectors
-struct TFPtoTVGlue {
- void* glue[2];
-};
-
-static 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_t glue[6];
-};
-
-static 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;
- // NPRuntime support
- TTVtoFPGlue getstringidentifier;
- TTVtoFPGlue getstringidentifiers;
- TTVtoFPGlue getintidentifier;
- TTVtoFPGlue identifierisstring;
- TTVtoFPGlue utf8fromidentifier;
- TTVtoFPGlue intfromidentifier;
- TTVtoFPGlue createobject;
- TTVtoFPGlue retainobject;
- TTVtoFPGlue releaseobject;
- TTVtoFPGlue invoke;
- TTVtoFPGlue invokeDefault;
- TTVtoFPGlue evaluate;
- TTVtoFPGlue getproperty;
- TTVtoFPGlue setproperty;
- TTVtoFPGlue removeproperty;
- TTVtoFPGlue hasproperty;
- TTVtoFPGlue hasmethod;
- TTVtoFPGlue releasevariantvalue;
- TTVtoFPGlue setexception;
-} 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) ((UniversalProcPtr)(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 -
-
-//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-//
-// Globals
-//
-//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-#if !TARGET_API_MAC_CARBON
-QDGlobals* gQDPtr; // Pointer to Netscape’s QuickDraw globals
-#endif
-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.
-// These functions let the plugin developer just call the APIs
-// as documented and defined in npapi.h, without needing to know
-// about the function table and call macros in npupp.h.
-//
-//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor)
-{
- *plugin_major = NP_VERSION_MAJOR;
- *plugin_minor = NP_VERSION_MINOR;
- *netscape_major = gNetscapeFuncs.version >> 8; // Major version is in high byte
- *netscape_minor = gNetscapeFuncs.version & 0xFF; // Minor version is in low byte
-}
-
-NPError NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- NPError err;
-
- if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
- {
- err = CALL_NPN(CallNPN_GetURLNotifyProc, gNetscapeFuncs.geturlnotify, instance, url, window, notifyData);
- }
- else
- {
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- return err;
-}
-
-NPError NPN_GetURL(NPP instance, const char* url, const char* window)
-{
- return CALL_NPN(CallNPN_GetURLProc, gNetscapeFuncs.geturl, instance, url, window);
-}
-
-NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- NPError err;
-
- if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
- {
- err = CALL_NPN(CallNPN_PostURLNotifyProc, gNetscapeFuncs.posturlnotify, instance, url,
- window, len, buf, file, notifyData);
- }
- else
- {
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- return err;
-}
-
-NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file)
-{
- return CALL_NPN(CallNPN_PostURLProc, gNetscapeFuncs.posturl, instance, url, window, len, buf, file);
-}
-
-NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
-{
- return CALL_NPN(CallNPN_RequestReadProc, gNetscapeFuncs.requestread, stream, rangeList);
-}
-
-NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* window, NPStream** stream)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- NPError err;
-
- if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
- {
- err = CALL_NPN(CallNPN_NewStreamProc, gNetscapeFuncs.newstream, instance, type, window, stream);
- }
- else
- {
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- return err;
-}
-
-int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- NPError err;
-
- if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
- {
- err = CALL_NPN(CallNPN_WriteProc, gNetscapeFuncs.write, instance, stream, len, buffer);
- }
- else
- {
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- return err;
-}
-
-NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- NPError err;
-
- if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
- {
- err = CALL_NPN(CallNPN_DestroyStreamProc, gNetscapeFuncs.destroystream, instance, stream, reason);
- }
- else
- {
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- return err;
-}
-
-void NPN_Status(NPP instance, const char* message)
-{
- CALL_NPN(CallNPN_StatusProc, gNetscapeFuncs.status, instance, message);
-}
-
-const char* NPN_UserAgent(NPP instance)
-{
- return CALL_NPN(CallNPN_UserAgentProc, gNetscapeFuncs.uagent, instance);
-}
-
-void* NPN_MemAlloc(uint32_t size)
-{
- return CALL_NPN(CallNPN_MemAllocProc, gNetscapeFuncs.memalloc, size);
-}
-
-void NPN_MemFree(void* ptr)
-{
- CALL_NPN(CallNPN_MemFreeProc, gNetscapeFuncs.memfree, ptr);
-}
-
-uint32_t NPN_MemFlush(uint32_t size)
-{
- return CALL_NPN(CallNPN_MemFlushProc, gNetscapeFuncs.memflush, size);
-}
-
-void NPN_ReloadPlugins(NPBool reloadPages)
-{
- CALL_NPN(CallNPN_ReloadPluginsProc, gNetscapeFuncs.reloadplugins, reloadPages);
-}
-
-#ifdef OJI
-JRIEnv* NPN_GetJavaEnv(void)
-{
- return CallNPN_GetJavaEnvProc( gNetscapeFuncs.getJavaEnv );
-}
-
-jobject NPN_GetJavaPeer(NPP instance)
-{
- return CallNPN_GetJavaPeerProc( gNetscapeFuncs.getJavaPeer, instance );
-}
-#endif
-
-NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value)
-{
- return CALL_NPN(CallNPN_GetValueProc, gNetscapeFuncs.getvalue, instance, variable, value);
-}
-
-NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
-{
- return CALL_NPN(CallNPN_SetValueProc, gNetscapeFuncs.setvalue, instance, variable, value);
-}
-
-void NPN_InvalidateRect(NPP instance, NPRect *rect)
-{
- CALL_NPN(CallNPN_InvalidateRectProc, gNetscapeFuncs.invalidaterect, instance, rect);
-}
-
-void NPN_InvalidateRegion(NPP instance, NPRegion region)
-{
- CALL_NPN(CallNPN_InvalidateRegionProc, gNetscapeFuncs.invalidateregion, instance, region);
-}
-
-void NPN_ForceRedraw(NPP instance)
-{
- CALL_NPN(CallNPN_ForceRedrawProc, gNetscapeFuncs.forceredraw, instance);
-}
-
-NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_GetStringIdentifierProc, gNetscapeFuncs.getstringidentifier, name);
- }
- return NULL;
-}
-
-void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- CALL_NPN(CallNPN_GetStringIdentifiersProc, gNetscapeFuncs.getstringidentifiers, names, nameCount, identifiers);
- }
-}
-
-NPIdentifier NPN_GetIntIdentifier(int32_t intid)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_GetIntIdentifierProc, gNetscapeFuncs.getintidentifier, intid);
- }
- return NULL;
-}
-
-bool NPN_IdentifierIsString(NPIdentifier identifier)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_IdentifierIsStringProc, gNetscapeFuncs.identifierisstring, identifier);
- }
- return false;
-}
-
-NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_UTF8FromIdentifierProc, gNetscapeFuncs.utf8fromidentifier, identifier);
- }
- return NULL;
-}
-
-int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_IntFromIdentifierProc, gNetscapeFuncs.intfromidentifier, identifier);
- }
- return 0;
-}
-
-NPObject *NPN_CreateObject(NPP instance, NPClass *aClass)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_CreateObjectProc, gNetscapeFuncs.createobject, instance, aClass);
- }
- return NULL;
-}
-
-NPObject *NPN_RetainObject(NPObject *npobj)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_RetainObjectProc, gNetscapeFuncs.retainobject, npobj);
- }
- return NULL;
-}
-
-void NPN_ReleaseObject(NPObject *npobj)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- CALL_NPN(CallNPN_ReleaseObjectProc, gNetscapeFuncs.releaseobject, npobj);
- }
-}
-
-bool NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_InvokeProc, gNetscapeFuncs.invoke, instance, npobj, methodName, args, argCount, result);
- }
- return false;
-}
-
-bool NPN_InvokeDefault(NPP instance, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_InvokeDefaultProc, gNetscapeFuncs.invokeDefault, instance, npobj, args, argCount, result);
- }
- return false;
-}
-
-bool NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *result)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_EvaluateProc, gNetscapeFuncs.evaluate, instance, npobj, script, result);
- }
- return false;
-}
-
-bool NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, NPVariant *result)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_GetPropertyProc, gNetscapeFuncs.getproperty, instance, npobj, propertyName, result);
- }
- return false;
-}
-
-bool NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, const NPVariant *value)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_SetPropertyProc, gNetscapeFuncs.setproperty, instance, npobj, propertyName, value);
- }
- return false;
-}
-
-bool NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_RemovePropertyProc, gNetscapeFuncs.removeproperty, instance, npobj, propertyName);
- }
- return false;
-}
-
-bool NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_HasPropertyProc, gNetscapeFuncs.hasproperty, instance, npobj, propertyName);
- }
- return false;
-}
-
-bool NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return CALL_NPN(CallNPN_HasMethodProc, gNetscapeFuncs.hasmethod, instance, npobj, methodName);
- }
- return false;
-}
-
-void NPN_ReleaseVariantValue(NPVariant *variant)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- CALL_NPN(CallNPN_ReleaseVariantValueProc, gNetscapeFuncs.releasevariantvalue, variant);
- }
-}
-
-void NPN_SetException(NPObject *npobj, const NPUTF8 *message)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
- if( navMinorVers >= 14 )
- {
- CALL_NPN(CallNPN_SetExceptionProc, gNetscapeFuncs.setexception, npobj, message);
- }
-}
-
-#pragma mark -
-
-//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-//
-// Wrapper functions for all calls from Netscape to the plugin.
-// These functions let the plugin developer just create the APIs
-// as documented and defined in npapi.h, without needing to
-// install those functions in the function table or worry about
-// setting up globals for 68K plugins.
-//
-//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
-NPError Private_Initialize(void);
-void Private_Shutdown(void);
-NPError Private_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
-NPError Private_Destroy(NPP instance, NPSavedData** save);
-NPError Private_SetWindow(NPP instance, NPWindow* window);
-NPError Private_GetValue( NPP instance, NPPVariable variable, void *value );
-NPError Private_SetValue( NPP instance, NPPVariable variable, void *value );
-NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
-NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason);
-int32_t Private_WriteReady(NPP instance, NPStream* stream);
-int32_t Private_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
-void Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
-void Private_Print(NPP instance, NPPrint* platformPrint);
-int16_t Private_HandleEvent(NPP instance, void* event);
-void Private_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData);
-#ifdef OJI
-jobject Private_GetJavaClass(void);
-#endif // OJI
-
-
-NPError Private_Initialize(void)
-{
- NPError err;
- EnterCodeResource();
- PLUGINDEBUGSTR("\pInitialize;g;");
- err = NPP_Initialize();
- ExitCodeResource();
- return err;
-}
-
-void Private_Shutdown(void)
-{
- EnterCodeResource();
- PLUGINDEBUGSTR("\pShutdown;g;");
- NPP_Shutdown();
-
-#ifdef __MWERKS__
- __destroy_global_chain();
-#endif
-
- ExitCodeResource();
-}
-
-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;");
- ExitCodeResource();
- return ret;
-}
-
-NPError Private_Destroy(NPP instance, NPSavedData** save)
-{
- NPError err;
- EnterCodeResource();
- PLUGINDEBUGSTR("\pDestroy;g;");
- err = NPP_Destroy(instance, save);
- ExitCodeResource();
- return err;
-}
-
-NPError Private_SetWindow(NPP instance, NPWindow* window)
-{
- NPError err;
- EnterCodeResource();
- PLUGINDEBUGSTR("\pSetWindow;g;");
- err = NPP_SetWindow(instance, window);
- ExitCodeResource();
- return err;
-}
-
-NPError Private_GetValue( NPP instance, NPPVariable variable, void *value )
-{
- NPError err;
- EnterCodeResource();
- PLUGINDEBUGSTR("\pGetValue;g;");
- err = NPP_GetValue(instance, variable, value);
- ExitCodeResource();
- return err;
-}
-
-NPError Private_SetValue( NPP instance, NPNVariable variable, void *value )
-{
- NPError err;
- EnterCodeResource();
- PLUGINDEBUGSTR("\pSetValue;g;");
- err = NPP_SetValue(instance, variable, value);
- ExitCodeResource();
- return err;
-}
-
-NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
-{
- NPError err;
- EnterCodeResource();
- PLUGINDEBUGSTR("\pNewStream;g;");
- err = NPP_NewStream(instance, type, stream, seekable, stype);
- ExitCodeResource();
- return err;
-}
-
-int32_t Private_WriteReady(NPP instance, NPStream* stream)
-{
- int32_t result;
- EnterCodeResource();
- PLUGINDEBUGSTR("\pWriteReady;g;");
- result = NPP_WriteReady(instance, stream);
- ExitCodeResource();
- return result;
-}
-
-int32_t Private_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer)
-{
- int32_t result;
- EnterCodeResource();
- PLUGINDEBUGSTR("\pWrite;g;");
- result = NPP_Write(instance, stream, offset, len, buffer);
- ExitCodeResource();
- return result;
-}
-
-void Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
-{
- EnterCodeResource();
- PLUGINDEBUGSTR("\pStreamAsFile;g;");
- NPP_StreamAsFile(instance, stream, fname);
- ExitCodeResource();
-}
-
-NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason)
-{
- NPError err;
- EnterCodeResource();
- PLUGINDEBUGSTR("\pDestroyStream;g;");
- err = NPP_DestroyStream(instance, stream, reason);
- ExitCodeResource();
- return err;
-}
-
-int16_t Private_HandleEvent(NPP instance, void* event)
-{
- int16_t result;
- EnterCodeResource();
- PLUGINDEBUGSTR("\pHandleEvent;g;");
- result = NPP_HandleEvent(instance, event);
- ExitCodeResource();
- return result;
-}
-
-void Private_Print(NPP instance, NPPrint* platformPrint)
-{
- EnterCodeResource();
- PLUGINDEBUGSTR("\pPrint;g;");
- NPP_Print(instance, platformPrint);
- ExitCodeResource();
-}
-
-void Private_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
-{
- EnterCodeResource();
- PLUGINDEBUGSTR("\pURLNotify;g;");
- NPP_URLNotify(instance, url, reason, notifyData);
- ExitCodeResource();
-}
-
-#ifdef OJI
-jobject Private_GetJavaClass(void)
-{
- EnterCodeResource();
- PLUGINDEBUGSTR("\pGetJavaClass;g;");
-
- jobject clazz = NPP_GetJavaClass();
- ExitCodeResource();
- if (clazz)
- {
- JRIEnv* env = NPN_GetJavaEnv();
- return (jobject)JRI_NewGlobalRef(env, clazz);
- }
- return NULL;
-}
-#endif
-
-void SetUpQD(void);
-void SetUpQD(void)
-{
-#if !TARGET_API_MAC_CARBON
- ProcessSerialNumber PSN;
- FSSpec myFSSpec;
- Str63 name;
- ProcessInfoRec infoRec;
- OSErr result = noErr;
- CFragConnectionID connID;
- Str255 errName;
-#endif
-
- //
- // 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)
- {
- //
- // GetProcessInformation takes a process serial number and
- // 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;
-
- result = GetProcessInformation(&PSN, &infoRec);
- if (result != noErr)
- PLUGINDEBUGSTR("\pFailed in GetProcessInformation");
- }
- else
- //
- // If no CFM installed, assume it must be a 68K app.
- //
- 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
- // returns an error, we assume the app must be 68K.
- //
- Ptr mainAddr;
- Str255 errName;
- result = GetDiskFragment(infoRec.processAppSpec, 0L, 0L, infoRec.processName,
- 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
- // QuickDraw globals.
- //
- CFragSymbolClass symClass;
- result = FindSymbol(connID, "\pqd", (Ptr*)&gQDPtr, &symClass);
- if (result != noErr) { // this fails if we are in NS 6
- gQDPtr = &qd; // so we default to the standard QD globals
- }
- }
- else
- {
- //
- // The app is 68K, so use its A5 to compute the address
- // of its QuickDraw globals.
- //
- gQDPtr = (QDGlobals*)(*((long*)SetCurrentA5()) - (sizeof(QDGlobals) - sizeof(GrafPtr)));
- }
-#endif
-}
-
-#ifdef __GNUC__
-// gcc requires that main have an 'int' return type
-typedef int main_return_t;
-#else
-typedef NPError mainReturnType;
-#endif
-
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
-typedef NPP_ShutdownUPP unloadupp_t;
-#else
-typedef NPP_ShutdownProcPtr unloadupp_t;
-#endif
-
-
-main_return_t main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, unloadupp_t* unloadUpp);
-
-#if !TARGET_API_MAC_CARBON
-#pragma export on
-
-#if TARGET_RT_MAC_CFM
-
-RoutineDescriptor mainRD = BUILD_ROUTINE_DESCRIPTOR(uppNPP_MainEntryProcInfo, main);
-
-#endif
-
-#pragma export off
-#endif /* !TARGET_API_MAC_CARBON */
-
-DEFINE_API_C(main_return_t) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, unloadupp_t* unloadUpp)
-{
- EnterCodeResource();
- PLUGINDEBUGSTR("\pmain");
-
-#ifdef __MWERKS__
- __InitCode__();
-#endif
-
- NPError err = NPERR_NO_ERROR;
-
- //
- // Ensure that everything Netscape passed us is valid!
- //
- if ((nsTable == NULL) || (pluginFuncs == NULL) || (unloadUpp == NULL))
- 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.
- // 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).
- //
- if (err == NPERR_NO_ERROR)
- {
- if ((nsTable->version >> 8) > NP_VERSION_MAJOR) // Major version is in high byte
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
-
- if (err == NPERR_NO_ERROR)
- {
- //
- // 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
- // could actually be bigger than what we expect.
- //
-
- int navMinorVers = nsTable->version & 0xFF;
-
- gNetscapeFuncs.version = nsTable->version;
- gNetscapeFuncs.size = nsTable->size;
- gNetscapeFuncs.posturl = HOST_TO_PLUGIN_GLUE(posturl, nsTable->posturl);
- gNetscapeFuncs.geturl = HOST_TO_PLUGIN_GLUE(geturl, nsTable->geturl);
- gNetscapeFuncs.requestread = HOST_TO_PLUGIN_GLUE(requestread, nsTable->requestread);
- gNetscapeFuncs.newstream = HOST_TO_PLUGIN_GLUE(newstream, nsTable->newstream);
- gNetscapeFuncs.write = HOST_TO_PLUGIN_GLUE(write, nsTable->write);
- gNetscapeFuncs.destroystream = HOST_TO_PLUGIN_GLUE(destroystream, nsTable->destroystream);
- gNetscapeFuncs.status = HOST_TO_PLUGIN_GLUE(status, nsTable->status);
- gNetscapeFuncs.uagent = HOST_TO_PLUGIN_GLUE(uagent, nsTable->uagent);
- gNetscapeFuncs.memalloc = HOST_TO_PLUGIN_GLUE(memalloc, nsTable->memalloc);
- gNetscapeFuncs.memfree = HOST_TO_PLUGIN_GLUE(memfree, nsTable->memfree);
- gNetscapeFuncs.memflush = HOST_TO_PLUGIN_GLUE(memflush, nsTable->memflush);
- gNetscapeFuncs.reloadplugins = HOST_TO_PLUGIN_GLUE(reloadplugins, nsTable->reloadplugins);
- if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
- {
- gNetscapeFuncs.getJavaEnv = HOST_TO_PLUGIN_GLUE(getJavaEnv, nsTable->getJavaEnv);
- gNetscapeFuncs.getJavaPeer = HOST_TO_PLUGIN_GLUE(getJavaPeer, nsTable->getJavaPeer);
- }
- if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
- {
- gNetscapeFuncs.geturlnotify = HOST_TO_PLUGIN_GLUE(geturlnotify, nsTable->geturlnotify);
- gNetscapeFuncs.posturlnotify = HOST_TO_PLUGIN_GLUE(posturlnotify, nsTable->posturlnotify);
- }
- gNetscapeFuncs.getvalue = HOST_TO_PLUGIN_GLUE(getvalue, nsTable->getvalue);
- gNetscapeFuncs.setvalue = HOST_TO_PLUGIN_GLUE(setvalue, nsTable->setvalue);
- gNetscapeFuncs.invalidaterect = HOST_TO_PLUGIN_GLUE(invalidaterect, nsTable->invalidaterect);
- gNetscapeFuncs.invalidateregion = HOST_TO_PLUGIN_GLUE(invalidateregion, nsTable->invalidateregion);
- gNetscapeFuncs.forceredraw = HOST_TO_PLUGIN_GLUE(forceredraw, nsTable->forceredraw);
- if( navMinorVers >= 14 )
- {
- // NPRuntime support
- gNetscapeFuncs.getstringidentifier = HOST_TO_PLUGIN_GLUE(getstringidentifier, nsTable->getstringidentifier);
- gNetscapeFuncs.getstringidentifiers = HOST_TO_PLUGIN_GLUE(getstringidentifiers, nsTable->getstringidentifiers);
- gNetscapeFuncs.getintidentifier = HOST_TO_PLUGIN_GLUE(getintidentifier, nsTable->getintidentifier);
- gNetscapeFuncs.identifierisstring = HOST_TO_PLUGIN_GLUE(identifierisstring, nsTable->identifierisstring);
- gNetscapeFuncs.utf8fromidentifier = HOST_TO_PLUGIN_GLUE(utf8fromidentifier, nsTable->utf8fromidentifier);
- gNetscapeFuncs.intfromidentifier = HOST_TO_PLUGIN_GLUE(intfromidentifier, nsTable->intfromidentifier);
- gNetscapeFuncs.createobject = HOST_TO_PLUGIN_GLUE(createobject, nsTable->createobject);
- gNetscapeFuncs.retainobject = HOST_TO_PLUGIN_GLUE(retainobject, nsTable->retainobject);
- gNetscapeFuncs.releaseobject = HOST_TO_PLUGIN_GLUE(releaseobject, nsTable->releaseobject);
- gNetscapeFuncs.invoke = HOST_TO_PLUGIN_GLUE(invoke, nsTable->invoke);
- gNetscapeFuncs.invokeDefault = HOST_TO_PLUGIN_GLUE(invokeDefault, nsTable->invokeDefault);
- gNetscapeFuncs.evaluate = HOST_TO_PLUGIN_GLUE(evaluate, nsTable->evaluate);
- gNetscapeFuncs.getproperty = HOST_TO_PLUGIN_GLUE(getproperty, nsTable->getproperty);
- gNetscapeFuncs.setproperty = HOST_TO_PLUGIN_GLUE(setproperty, nsTable->setproperty);
- gNetscapeFuncs.removeproperty = HOST_TO_PLUGIN_GLUE(removeproperty, nsTable->removeproperty);
- gNetscapeFuncs.hasproperty = HOST_TO_PLUGIN_GLUE(hasproperty, nsTable->hasproperty);
- gNetscapeFuncs.hasmethod = HOST_TO_PLUGIN_GLUE(hasmethod, nsTable->hasmethod);
- gNetscapeFuncs.releasevariantvalue = HOST_TO_PLUGIN_GLUE(releasevariantvalue, nsTable->releasevariantvalue);
- gNetscapeFuncs.setexception = HOST_TO_PLUGIN_GLUE(setexception, nsTable->setexception);
- }
-
- //
- // 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);
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- 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));
- pluginFuncs->getvalue = NewNPP_GetValueProc(PLUGIN_TO_HOST_GLUE(getvalue, Private_GetValue));
-#else
- pluginFuncs->newp = (NPP_NewProcPtr)(PLUGIN_TO_HOST_GLUE(newp, Private_New));
- pluginFuncs->destroy = (NPP_DestroyProcPtr)(PLUGIN_TO_HOST_GLUE(destroy, Private_Destroy));
- pluginFuncs->setwindow = (NPP_SetWindowProcPtr)(PLUGIN_TO_HOST_GLUE(setwindow, Private_SetWindow));
- pluginFuncs->newstream = (NPP_NewStreamProcPtr)(PLUGIN_TO_HOST_GLUE(newstream, Private_NewStream));
- pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)(PLUGIN_TO_HOST_GLUE(destroystream, Private_DestroyStream));
- pluginFuncs->asfile = (NPP_StreamAsFileProcPtr)(PLUGIN_TO_HOST_GLUE(asfile, Private_StreamAsFile));
- pluginFuncs->writeready = (NPP_WriteReadyProcPtr)(PLUGIN_TO_HOST_GLUE(writeready, Private_WriteReady));
- pluginFuncs->write = (NPP_WriteProcPtr)(PLUGIN_TO_HOST_GLUE(write, Private_Write));
- pluginFuncs->print = (NPP_PrintProcPtr)(PLUGIN_TO_HOST_GLUE(print, Private_Print));
- pluginFuncs->event = (NPP_HandleEventProcPtr)(PLUGIN_TO_HOST_GLUE(event, Private_HandleEvent));
- pluginFuncs->getvalue = (NPP_GetValueProcPtr)(PLUGIN_TO_HOST_GLUE(getvalue, Private_GetValue));
-#endif
- if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
- {
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- pluginFuncs->urlnotify = NewNPP_URLNotifyProc(PLUGIN_TO_HOST_GLUE(urlnotify, Private_URLNotify));
-#else
- pluginFuncs->urlnotify = (NPP_URLNotifyProcPtr)(PLUGIN_TO_HOST_GLUE(urlnotify, Private_URLNotify));
-#endif
- }
-#ifdef OJI
- if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
- {
- pluginFuncs->javaClass = (JRIGlobalRef) Private_GetJavaClass();
- }
-#else
- pluginFuncs->javaClass = NULL;
-#endif
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- *unloadUpp = NewNPP_ShutdownProc(PLUGIN_TO_HOST_GLUE(shutdown, Private_Shutdown));
-#else
- *unloadUpp = (NPP_ShutdownProcPtr)(PLUGIN_TO_HOST_GLUE(shutdown, Private_Shutdown));
-#endif
- SetUpQD();
- err = Private_Initialize();
- }
-
- ExitCodeResource();
- return err;
-}
-
-#ifdef __MACH__
-
-/*
-** netscape plugins functions when building Mach-O binary
-*/
-
-extern "C" {
- NPError NP_Initialize(NPNetscapeFuncs* nsTable);
- NPError NP_GetEntryPoints(NPPluginFuncs* pluginFuncs);
- NPError NP_Shutdown(void);
-}
-
-/*
-** netscape plugins functions when using Mach-O binary
-*/
-
-NPError NP_Initialize(NPNetscapeFuncs* nsTable)
-{
- PLUGINDEBUGSTR("\pNP_Initialize");
-
- /* validate input parameters */
-
- if( NULL == nsTable )
- return 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.
- * 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).
- *
- */
-
- if ((nsTable->version >> 8) > NP_VERSION_MAJOR)
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
-
- if (nsTable->size < sizeof(NPNetscapeFuncs))
- return NPERR_INVALID_FUNCTABLE_ERROR;
-
- int navMinorVers = nsTable->version & 0xFF;
-
- /*
- * Copy all the fields of Netscape 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
- * could actually be bigger than what we expect.
- */
- 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;
- if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
- {
- gNetscapeFuncs.getJavaEnv = nsTable->getJavaEnv;
- gNetscapeFuncs.getJavaPeer = nsTable->getJavaPeer;
- }
- if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
- {
- gNetscapeFuncs.geturlnotify = nsTable->geturlnotify;
- gNetscapeFuncs.posturlnotify = nsTable->posturlnotify;
- }
-
- gNetscapeFuncs.getvalue = nsTable->getvalue;
- gNetscapeFuncs.setvalue = nsTable->setvalue;
- gNetscapeFuncs.invalidaterect = nsTable->invalidaterect;
- gNetscapeFuncs.invalidateregion = nsTable->invalidateregion;
- gNetscapeFuncs.forceredraw = nsTable->forceredraw;
- if( navMinorVers >= 14 )
- {
- // NPRuntime support
- gNetscapeFuncs.getstringidentifier = nsTable->getstringidentifier;
- gNetscapeFuncs.getstringidentifiers = nsTable->getstringidentifiers;
- gNetscapeFuncs.getintidentifier = nsTable->getintidentifier;
- gNetscapeFuncs.identifierisstring = nsTable->identifierisstring;
- gNetscapeFuncs.utf8fromidentifier = nsTable->utf8fromidentifier;
- gNetscapeFuncs.intfromidentifier = nsTable->intfromidentifier;
- gNetscapeFuncs.createobject = nsTable->createobject;
- gNetscapeFuncs.retainobject = nsTable->retainobject;
- gNetscapeFuncs.releaseobject = nsTable->releaseobject;
- gNetscapeFuncs.invoke = nsTable->invoke;
- gNetscapeFuncs.invokeDefault = nsTable->invokeDefault;
- gNetscapeFuncs.evaluate = nsTable->evaluate;
- gNetscapeFuncs.getproperty = nsTable->getproperty;
- gNetscapeFuncs.setproperty = nsTable->setproperty;
- gNetscapeFuncs.removeproperty = nsTable->removeproperty;
- gNetscapeFuncs.hasproperty = nsTable->hasproperty;
- gNetscapeFuncs.hasmethod = nsTable->hasmethod;
- gNetscapeFuncs.releasevariantvalue = nsTable->releasevariantvalue;
- gNetscapeFuncs.setexception = nsTable->setexception;
- }
- return NPP_Initialize();
-}
-
-NPError NP_GetEntryPoints(NPPluginFuncs* pluginFuncs)
-{
- int navMinorVers = gNetscapeFuncs.version & 0xFF;
-
- PLUGINDEBUGSTR("\pNP_GetEntryPoints");
-
- if( pluginFuncs == NULL )
- return NPERR_INVALID_FUNCTABLE_ERROR;
-
- /*if (pluginFuncs->size < sizeof(NPPluginFuncs))
- return NPERR_INVALID_FUNCTABLE_ERROR;*/
-
- /*
- * 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);
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- 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->getvalue = NewNPP_GetValueProc(Private_GetValue);
- pluginFuncs->setvalue = NewNPP_SetValueProc(Private_SetValue);
-#else
- pluginFuncs->newp = (NPP_NewProcPtr)(Private_New);
- pluginFuncs->destroy = (NPP_DestroyProcPtr)(Private_Destroy);
- pluginFuncs->setwindow = (NPP_SetWindowProcPtr)(Private_SetWindow);
- pluginFuncs->newstream = (NPP_NewStreamProcPtr)(Private_NewStream);
- pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)(Private_DestroyStream);
- pluginFuncs->asfile = (NPP_StreamAsFileProcPtr)(Private_StreamAsFile);
- pluginFuncs->writeready = (NPP_WriteReadyProcPtr)(Private_WriteReady);
- pluginFuncs->write = (NPP_WriteProcPtr)(Private_Write);
- pluginFuncs->print = (NPP_PrintProcPtr)(Private_Print);
- pluginFuncs->event = (NPP_HandleEventProcPtr)(Private_HandleEvent);
- pluginFuncs->getvalue = (NPP_GetValueProcPtr)(Private_GetValue);
- pluginFuncs->setvalue = (NPP_SetValueProcPtr)(Private_SetValue);
-#endif
- if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
- {
- pluginFuncs->urlnotify = Private_URLNotify;
- }
-#ifdef OJI
- if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
- {
- pluginFuncs->javaClass = (JRIGlobalRef) Private_GetJavaClass();
- }
-#else
- pluginFuncs->javaClass = NULL;
-#endif
-
- return NPERR_NO_ERROR;
-}
-
-NPError NP_Shutdown(void)
-{
- PLUGINDEBUGSTR("\pNP_Shutdown");
- NPP_Shutdown();
- return NPERR_NO_ERROR;
-}
-
-#endif
+++ /dev/null
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * Mozilla/Firefox plugin for VLC
- * Copyright (C) 2009, Jean-Paul Saman <jpsaman@videolan.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * 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):
- * Stephen Mak <smak@sun.com>
- *
- */
-
-/*
- * npunix.c
- *
- * Netscape Client Plugin API
- * - Wrapper function to interface with the Netscape Navigator
- *
- * dp Suresh <dp@netscape.com>
- *
- *----------------------------------------------------------------------
- * PLUGIN DEVELOPERS:
- * YOU WILL NOT NEED TO EDIT THIS FILE.
- *----------------------------------------------------------------------
- */
-
-#include "config.h"
-
-#define XP_UNIX 1
-
-#include <npapi.h>
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
-#include "npupp.h"
-#else
-#include "npfunctions.h"
-#endif
-
-#include "../vlcshell.h"
-
-/*
- * Define PLUGIN_TRACE to have the wrapper functions print
- * messages to stderr whenever they are called.
- */
-
-#ifdef PLUGIN_TRACE
-#include <stdio.h>
-#define PLUGINDEBUGSTR(msg) fprintf(stderr, "%s\n", msg)
-#else
-#define PLUGINDEBUGSTR(msg)
-#endif
-
-/***********************************************************************
- *
- * Globals
- *
- ***********************************************************************/
-
-static NPNetscapeFuncs gNetscapeFuncs; /* Netscape Function table */
-
-/***********************************************************************
- *
- * Wrapper functions : plugin calling Netscape Navigator
- *
- * These functions let the plugin developer just call the APIs
- * as documented and defined in npapi.h, without needing to know
- * about the function table and call macros in npupp.h.
- *
- ***********************************************************************/
-
-void
-NPN_Version(int* plugin_major, int* plugin_minor,
- int* netscape_major, int* netscape_minor)
-{
- *plugin_major = NP_VERSION_MAJOR;
- *plugin_minor = NP_VERSION_MINOR;
-
- /* Major version is in high byte */
- *netscape_major = gNetscapeFuncs.version >> 8;
- /* Minor version is in low byte */
- *netscape_minor = gNetscapeFuncs.version & 0xFF;
-}
-
-void
-NPN_PluginThreadAsyncCall(NPP plugin,
- void (*func)(void *),
- void *userData)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) >= 20)
- return (*gNetscapeFuncs.pluginthreadasynccall)(plugin, func, userData);
-#endif
-}
-
-NPError
-NPN_GetValue(NPP instance, NPNVariable variable, void *r_value)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_GetValueProc(gNetscapeFuncs.getvalue,
- instance, variable, r_value);
-#else
- return (*gNetscapeFuncs.getvalue)(instance, variable, r_value);
-#endif
-}
-
-NPError
-NPN_SetValue(NPP instance, NPPVariable variable, void *value)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_SetValueProc(gNetscapeFuncs.setvalue,
- instance, variable, value);
-#else
- return (*gNetscapeFuncs.setvalue)(instance, variable, value);
-#endif
-}
-
-NPError
-NPN_GetURL(NPP instance, const char* url, const char* window)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window);
-#else
- return (*gNetscapeFuncs.geturl)(instance, url, window);
-#endif
-}
-
-NPError
-NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData);
-#else
- return (*gNetscapeFuncs.geturlnotify)(instance, url, window, notifyData);
-#endif
-}
-
-NPError
-NPN_PostURL(NPP instance, const char* url, const char* window,
- uint32_t len, const char* buf, NPBool file)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance,
- url, window, len, buf, file);
-#else
- return (*gNetscapeFuncs.posturl)(instance, url, window, len, buf, file);
-#endif
-}
-
-NPError
-NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len,
- const char* buf, NPBool file, void* notifyData)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify,
- instance, url, window, len, buf, file, notifyData);
-#else
- return (*gNetscapeFuncs.posturlnotify)(instance, url, window, len, buf, file, notifyData);
-
-#endif
-}
-
-NPError
-NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_RequestReadProc(gNetscapeFuncs.requestread,
- stream, rangeList);
-#else
- return (*gNetscapeFuncs.requestread)(stream, rangeList);
-#endif
-}
-
-NPError
-NPN_NewStream(NPP instance, NPMIMEType type, const char *window,
- NPStream** stream_ptr)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance,
- type, window, stream_ptr);
-#else
- return (*gNetscapeFuncs.newstream)(instance, type, window, stream_ptr);
-#endif
-}
-
-int32_t
-NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_WriteProc(gNetscapeFuncs.write, instance,
- stream, len, buffer);
-#else
- return (*gNetscapeFuncs.write)(instance, stream, len, buffer);
-#endif
-}
-
-NPError
-NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream,
- instance, stream, reason);
-#else
- return (*gNetscapeFuncs.destroystream)(instance, stream, reason);
-#endif
-}
-
-void
-NPN_Status(NPP instance, const char* message)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_StatusProc(gNetscapeFuncs.status, instance, message);
-#else
- (*gNetscapeFuncs.status)(instance, message);
-#endif
-}
-
-const char*
-NPN_UserAgent(NPP instance)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance);
-#else
- return (*gNetscapeFuncs.uagent)(instance);
-#endif
-}
-
-void *NPN_MemAlloc(uint32_t size)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
-#else
- return (*gNetscapeFuncs.memalloc)(size);
-#endif
-}
-
-void NPN_MemFree(void* ptr)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
-#else
- (*gNetscapeFuncs.memfree)(ptr);
-#endif
-}
-
-uint32_t NPN_MemFlush(uint32_t size)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size);
-#else
- return (*gNetscapeFuncs.memflush)(size);
-#endif
-}
-
-void NPN_ReloadPlugins(NPBool reloadPages)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages);
-#else
- (*gNetscapeFuncs.reloadplugins)(reloadPages);
-#endif
-}
-
-#ifdef OJI
-JRIEnv* NPN_GetJavaEnv()
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_GetJavaEnvProc(gNetscapeFuncs.getJavaEnv);
-#else
- return (*gNetscapeFuncs.getJavaEnv);
-#endif
-}
-
-jref NPN_GetJavaPeer(NPP instance)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_GetJavaPeerProc(gNetscapeFuncs.getJavaPeer,
- instance);
-#else
- return (*gNetscapeFuncs.getJavaPeer)(instance);
-#endif
-}
-#endif
-
-void
-NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_InvalidateRectProc(gNetscapeFuncs.invalidaterect, instance,
- invalidRect);
-#else
- (*gNetscapeFuncs.invalidaterect)(instance, invalidRect);
-#endif
-}
-
-void
-NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_InvalidateRegionProc(gNetscapeFuncs.invalidateregion, instance,
- invalidRegion);
-#else
- (*gNetscapeFuncs.invalidateregion)(instance, invalidRegion);
-#endif
-}
-
-void
-NPN_ForceRedraw(NPP instance)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_ForceRedrawProc(gNetscapeFuncs.forceredraw, instance);
-#else
- (*gNetscapeFuncs.forceredraw)(instance);
-#endif
-}
-
-void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_PushPopupsEnabledStateProc(gNetscapeFuncs.pushpopupsenabledstate,
- instance, enabled);
-#else
- (*gNetscapeFuncs.pushpopupsenabledstate)(instance, enabled);
-#endif
-}
-
-void NPN_PopPopupsEnabledState(NPP instance)
-{
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_PopPopupsEnabledStateProc(gNetscapeFuncs.poppopupsenabledstate,
- instance);
-#else
- (*gNetscapeFuncs.poppopupsenabledstate)(instance);
-#endif
-}
-
-NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
- {
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_GetStringIdentifierProc(
- gNetscapeFuncs.getstringidentifier, name);
-#else
- return (*gNetscapeFuncs.getstringidentifier)(name);
-#endif
- }
- return NULL;
-}
-
-void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
- NPIdentifier *identifiers)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
- {
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_GetStringIdentifiersProc(gNetscapeFuncs.getstringidentifiers,
- names, nameCount, identifiers);
-#else
- (*gNetscapeFuncs.getstringidentifiers)(names, nameCount, identifiers);
-#endif
- }
-}
-
-NPIdentifier NPN_GetIntIdentifier(int32_t intid)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
- {
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_GetIntIdentifierProc(gNetscapeFuncs.getintidentifier, intid);
-#else
- return (*gNetscapeFuncs.getintidentifier)(intid);
-#endif
- }
- return NULL;
-}
-
-bool NPN_IdentifierIsString(NPIdentifier identifier)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
- {
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_IdentifierIsStringProc(
- gNetscapeFuncs.identifierisstring,
- identifier);
-#else
- return (*gNetscapeFuncs.identifierisstring)(identifier);
-#endif
- }
- return false;
-}
-
-NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
- {
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_UTF8FromIdentifierProc(
- gNetscapeFuncs.utf8fromidentifier,
- identifier);
-#else
- return (*gNetscapeFuncs.utf8fromidentifier)(identifier);
-#endif
- }
- return NULL;
-}
-
-int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
- {
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_IntFromIdentifierProc(
- gNetscapeFuncs.intfromidentifier,
- identifier);
-#else
- return (*gNetscapeFuncs.intfromidentifier)(identifier);
-#endif
- }
- return 0;
-}
-
-NPObject *NPN_CreateObject(NPP npp, NPClass *aClass)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_CreateObjectProc(gNetscapeFuncs.createobject, npp, aClass);
-#else
- return (*gNetscapeFuncs.createobject)(npp, aClass);
-#endif
- return NULL;
-}
-
-NPObject *NPN_RetainObject(NPObject *obj)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_RetainObjectProc(gNetscapeFuncs.retainobject, obj);
-#else
- return (*gNetscapeFuncs.retainobject)(obj);
-#endif
- return NULL;
-}
-
-void NPN_ReleaseObject(NPObject *obj)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_ReleaseObjectProc(gNetscapeFuncs.releaseobject, obj);
-#else
- (*gNetscapeFuncs.releaseobject)(obj);
-#endif
-}
-
-bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName,
- const NPVariant *args, uint32_t argCount, NPVariant *result)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_InvokeProc(gNetscapeFuncs.invoke, npp, obj, methodName,
- args, argCount, result);
-#else
- return (*gNetscapeFuncs.invoke)(npp, obj, methodName, args, argCount, result);
-#endif
- return false;
-}
-
-bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args,
- uint32_t argCount, NPVariant *result)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_InvokeDefaultProc(gNetscapeFuncs.invokeDefault, npp, obj,
- args, argCount, result);
-#else
- return (*gNetscapeFuncs.invokeDefault)(npp, obj, args, argCount, result);
-#endif
- return false;
-}
-
-bool NPN_Evaluate(NPP npp, NPObject* obj, NPString *script,
- NPVariant *result)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_EvaluateProc(gNetscapeFuncs.evaluate, npp, obj,
- script, result);
-#else
- return (*gNetscapeFuncs.evaluate)(npp, obj, script, result);
-#endif
- return false;
-}
-
-bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
- NPVariant *result)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_GetPropertyProc(gNetscapeFuncs.getproperty, npp, obj,
- propertyName, result);
-#else
- return (*gNetscapeFuncs.getproperty)(npp, obj, propertyName, result);
-#endif
- return false;
-}
-
-bool NPN_SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
- const NPVariant *value)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_SetPropertyProc(gNetscapeFuncs.setproperty, npp, obj,
- propertyName, value);
-#else
- return (*gNetscapeFuncs.setproperty)(npp, obj, propertyName, value);
-#endif
- return false;
-}
-
-bool NPN_RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_RemovePropertyProc(gNetscapeFuncs.removeproperty, npp, obj,
- propertyName);
-#else
- return (*gNetscapeFuncs.removeproperty)(npp, obj, propertyName);
-#endif
- return false;
-}
-
-bool NPN_HasProperty(NPP npp, NPObject* obj, NPIdentifier propertyName)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_HasPropertyProc(gNetscapeFuncs.hasproperty, npp, obj,
- propertyName);
-#else
- return (*gNetscapeFuncs.hasproperty)(npp, obj, propertyName);
-#endif
- return false;
-}
-
-bool NPN_HasMethod(NPP npp, NPObject* obj, NPIdentifier methodName)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- return CallNPN_HasMethodProc(gNetscapeFuncs.hasmethod, npp,
- obj, methodName);
-#else
- return (*gNetscapeFuncs.hasmethod)(npp, obj, methodName);
-#endif
- return false;
-}
-
-void NPN_ReleaseVariantValue(NPVariant *variant)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_ReleaseVariantValueProc(gNetscapeFuncs.releasevariantvalue, variant);
-#else
- (*gNetscapeFuncs.releasevariantvalue)(variant);
-#endif
-}
-
-void NPN_SetException(NPObject* obj, const NPUTF8 *message)
-{
- int minor = gNetscapeFuncs.version & 0xFF;
- if( minor >= 14 )
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- CallNPN_SetExceptionProc(gNetscapeFuncs.setexception, obj, message);
-#else
- (*gNetscapeFuncs.setexception)(obj, message);
-#endif
-}
-
-/***********************************************************************
- *
- * Wrapper functions : Netscape Navigator -> plugin
- *
- * These functions let the plugin developer just create the APIs
- * as documented and defined in npapi.h, without needing to
- * install those functions in the function table or worry about
- * setting up globals for 68K plugins.
- *
- ***********************************************************************/
-
-/* Function prototypes */
-NPError Private_New(NPMIMEType pluginType, NPP instance, uint16_t mode,
- int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
-NPError Private_Destroy(NPP instance, NPSavedData** save);
-NPError Private_SetWindow(NPP instance, NPWindow* window);
-NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream,
- NPBool seekable, uint16_t* stype);
-int32_t Private_WriteReady(NPP instance, NPStream* stream);
-int32_t Private_Write(NPP instance, NPStream* stream, int32_t offset,
- int32_t len, void* buffer);
-void Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
-NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason);
-void Private_URLNotify(NPP instance, const char* url,
- NPReason reason, void* notifyData);
-void Private_Print(NPP instance, NPPrint* platformPrint);
-NPError Private_GetValue(NPP instance, NPPVariable variable, void *r_value);
-NPError Private_SetValue(NPP instance, NPPVariable variable, void *r_value);
-#ifdef OJI
-JRIGlobalRef Private_GetJavaClass(void);
-#endif
-
-/* function implementations */
-NPError
-Private_New(NPMIMEType pluginType, NPP instance, uint16_t mode,
- int16_t argc, char* argn[], char* argv[], NPSavedData* saved)
-{
- NPError ret;
- PLUGINDEBUGSTR("New");
- ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
- return ret;
-}
-
-NPError
-Private_Destroy(NPP instance, NPSavedData** save)
-{
- PLUGINDEBUGSTR("Destroy");
- return NPP_Destroy(instance, save);
-}
-
-NPError
-Private_SetWindow(NPP instance, NPWindow* window)
-{
- NPError err;
- PLUGINDEBUGSTR("SetWindow");
- err = NPP_SetWindow(instance, window);
- return err;
-}
-
-NPError
-Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream,
- NPBool seekable, uint16_t* stype)
-{
- NPError err;
- PLUGINDEBUGSTR("NewStream");
- err = NPP_NewStream(instance, type, stream, seekable, stype);
- return err;
-}
-
-int32_t
-Private_WriteReady(NPP instance, NPStream* stream)
-{
- unsigned int result;
- PLUGINDEBUGSTR("WriteReady");
- result = NPP_WriteReady(instance, stream);
- return result;
-}
-
-int32_t
-Private_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len,
- void* buffer)
-{
- unsigned int result;
- PLUGINDEBUGSTR("Write");
- result = NPP_Write(instance, stream, offset, len, buffer);
- return result;
-}
-
-void
-Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
-{
- PLUGINDEBUGSTR("StreamAsFile");
- NPP_StreamAsFile(instance, stream, fname);
-}
-
-
-NPError
-Private_DestroyStream(NPP instance, NPStream* stream, NPError reason)
-{
- NPError err;
- PLUGINDEBUGSTR("DestroyStream");
- err = NPP_DestroyStream(instance, stream, reason);
- return err;
-}
-
-void
-Private_URLNotify(NPP instance, const char* url,
- NPReason reason, void* notifyData)
-{
- PLUGINDEBUGSTR("URLNotify");
- NPP_URLNotify(instance, url, reason, notifyData);
-}
-
-void
-Private_Print(NPP instance, NPPrint* platformPrint)
-{
- PLUGINDEBUGSTR("Print");
- NPP_Print(instance, platformPrint);
-}
-
-NPError
-Private_GetValue(NPP instance, NPPVariable variable, void *r_value)
-{
- PLUGINDEBUGSTR("GetValue");
- return NPP_GetValue(instance, variable, r_value);
-}
-
-NPError
-Private_SetValue(NPP instance, NPPVariable variable, void *r_value)
-{
- PLUGINDEBUGSTR("SetValue");
- return NPP_SetValue(instance, variable, r_value);
-}
-
-#ifdef OJI
-JRIGlobalRef
-Private_GetJavaClass(void)
-{
- jref clazz = NPP_GetJavaClass();
- if (clazz) {
- JRIEnv* env = NPN_GetJavaEnv();
- return JRI_NewGlobalRef(env, clazz);
- }
- return NULL;
-}
-#endif
-
-/***********************************************************************
- *
- * These functions are located automagically by netscape.
- *
- ***********************************************************************/
-
-/*
- * NP_GetMIMEDescription
- * - Netscape needs to know about this symbol
- * - Netscape uses the return value to identify when an object instance
- * of this plugin should be created.
- */
-char *
-NP_GetMIMEDescription(void)
-{
- return NPP_GetMIMEDescription();
-}
-
-/*
- * NP_GetValue [optional]
- * - Netscape needs to know about this symbol.
- * - Interfaces with plugin to get values for predefined variables
- * that the navigator needs.
- */
-NPError
-NP_GetValue(void* future, NPPVariable variable, void *value)
-{
- return NPP_GetValue(future, variable, value);
-}
-
-/*
- * NP_Initialize
- * - Netscape needs to know about this symbol.
- * - It calls this function after looking up its symbol before it
- * is about to create the first ever object of this kind.
- *
- * PARAMETERS
- * nsTable - The netscape function table. If developers just use these
- * wrappers, they don't need to worry about all these function
- * tables.
- * RETURN
- * pluginFuncs
- * - This functions needs to fill the plugin function table
- * pluginFuncs and return it. Netscape Navigator plugin
- * library will use this function table to call the plugin.
- *
- */
-NPError
-NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
-{
- NPError err = NPERR_NO_ERROR;
-
- PLUGINDEBUGSTR("NP_Initialize");
-
- /* validate input parameters */
- if ((nsTable == NULL) || (pluginFuncs == NULL))
- 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.
- * 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).
- *
- */
- if (err == NPERR_NO_ERROR) {
- if ((nsTable->version >> 8) > NP_VERSION_MAJOR)
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- if (nsTable->size < ((char *)&nsTable->posturlnotify - (char *)nsTable))
- 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 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
- * could actually be bigger than what we expect.
- */
- int minor = 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;
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) >= 20)
- gNetscapeFuncs.pluginthreadasynccall =
- nsTable->pluginthreadasynccall;
-#endif
-#ifdef OJI
- if( minor >= NPVERS_HAS_LIVECONNECT )
- {
- gNetscapeFuncs.getJavaEnv = nsTable->getJavaEnv;
- gNetscapeFuncs.getJavaPeer = nsTable->getJavaPeer;
- }
-#endif
- gNetscapeFuncs.getvalue = nsTable->getvalue;
- gNetscapeFuncs.setvalue = nsTable->setvalue;
-
- if( minor >= NPVERS_HAS_NOTIFICATION )
- {
- gNetscapeFuncs.geturlnotify = nsTable->geturlnotify;
- gNetscapeFuncs.posturlnotify = nsTable->posturlnotify;
- }
-
- if (nsTable->size >= ((char *)&nsTable->setexception - (char *)nsTable))
- {
- gNetscapeFuncs.invalidaterect = nsTable->invalidaterect;
- gNetscapeFuncs.invalidateregion = nsTable->invalidateregion;
- gNetscapeFuncs.forceredraw = nsTable->forceredraw;
- /* npruntime support */
- if (minor >= 14)
- {
- gNetscapeFuncs.getstringidentifier = nsTable->getstringidentifier;
- gNetscapeFuncs.getstringidentifiers = nsTable->getstringidentifiers;
- gNetscapeFuncs.getintidentifier = nsTable->getintidentifier;
- gNetscapeFuncs.identifierisstring = nsTable->identifierisstring;
- gNetscapeFuncs.utf8fromidentifier = nsTable->utf8fromidentifier;
- gNetscapeFuncs.intfromidentifier = nsTable->intfromidentifier;
- gNetscapeFuncs.createobject = nsTable->createobject;
- gNetscapeFuncs.retainobject = nsTable->retainobject;
- gNetscapeFuncs.releaseobject = nsTable->releaseobject;
- gNetscapeFuncs.invoke = nsTable->invoke;
- gNetscapeFuncs.invokeDefault = nsTable->invokeDefault;
- gNetscapeFuncs.evaluate = nsTable->evaluate;
- gNetscapeFuncs.getproperty = nsTable->getproperty;
- gNetscapeFuncs.setproperty = nsTable->setproperty;
- gNetscapeFuncs.removeproperty = nsTable->removeproperty;
- gNetscapeFuncs.hasproperty = nsTable->hasproperty;
- gNetscapeFuncs.hasmethod = nsTable->hasmethod;
- gNetscapeFuncs.releasevariantvalue = nsTable->releasevariantvalue;
- gNetscapeFuncs.setexception = nsTable->setexception;
- }
- }
- else
- {
- gNetscapeFuncs.invalidaterect = NULL;
- gNetscapeFuncs.invalidateregion = NULL;
- gNetscapeFuncs.forceredraw = NULL;
- gNetscapeFuncs.getstringidentifier = NULL;
- gNetscapeFuncs.getstringidentifiers = NULL;
- gNetscapeFuncs.getintidentifier = NULL;
- gNetscapeFuncs.identifierisstring = NULL;
- gNetscapeFuncs.utf8fromidentifier = NULL;
- gNetscapeFuncs.intfromidentifier = NULL;
- gNetscapeFuncs.createobject = NULL;
- gNetscapeFuncs.retainobject = NULL;
- gNetscapeFuncs.releaseobject = NULL;
- gNetscapeFuncs.invoke = NULL;
- gNetscapeFuncs.invokeDefault = NULL;
- gNetscapeFuncs.evaluate = NULL;
- gNetscapeFuncs.getproperty = NULL;
- gNetscapeFuncs.setproperty = NULL;
- gNetscapeFuncs.removeproperty = NULL;
- gNetscapeFuncs.hasproperty = NULL;
- gNetscapeFuncs.releasevariantvalue = NULL;
- gNetscapeFuncs.setexception = NULL;
- }
- if (nsTable->size >=
- ((char *)&nsTable->poppopupsenabledstate - (char *)nsTable))
- {
- gNetscapeFuncs.pushpopupsenabledstate = nsTable->pushpopupsenabledstate;
- gNetscapeFuncs.poppopupsenabledstate = nsTable->poppopupsenabledstate;
- }
- else
- {
- gNetscapeFuncs.pushpopupsenabledstate = NULL;
- gNetscapeFuncs.poppopupsenabledstate = NULL;
- }
-
- /*
- * 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);
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- 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->getvalue = NewNPP_GetValueProc(Private_GetValue);
- pluginFuncs->setvalue = NewNPP_SetValueProc(Private_SetValue);
-#else
- pluginFuncs->newp = (NPP_NewProcPtr)(Private_New);
- pluginFuncs->destroy = (NPP_DestroyProcPtr)(Private_Destroy);
- pluginFuncs->setwindow = (NPP_SetWindowProcPtr)(Private_SetWindow);
- pluginFuncs->newstream = (NPP_NewStreamProcPtr)(Private_NewStream);
- pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)(Private_DestroyStream);
- pluginFuncs->asfile = (NPP_StreamAsFileProcPtr)(Private_StreamAsFile);
- pluginFuncs->writeready = (NPP_WriteReadyProcPtr)(Private_WriteReady);
- pluginFuncs->write = (NPP_WriteProcPtr)(Private_Write);
- pluginFuncs->print = (NPP_PrintProcPtr)(Private_Print);
- pluginFuncs->getvalue = (NPP_GetValueProcPtr)(Private_GetValue);
- pluginFuncs->setvalue = (NPP_SetValueProcPtr)(Private_SetValue);
-#endif
- pluginFuncs->event = NULL;
- if( minor >= NPVERS_HAS_NOTIFICATION )
- {
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify);
-#else
- pluginFuncs->urlnotify = (NPP_URLNotifyProcPtr)(Private_URLNotify);
-#endif
- }
-#ifdef OJI
- if( minor >= NPVERS_HAS_LIVECONNECT )
- pluginFuncs->javaClass = Private_GetJavaClass();
- else
- pluginFuncs->javaClass = NULL;
-#else
- pluginFuncs->javaClass = NULL;
-#endif
-
- err = NPP_Initialize();
- }
-
- return err;
-}
-
-/*
- * NP_Shutdown [optional]
- * - Netscape needs to know about this symbol.
- * - It calls this function after looking up its symbol after
- * the last object of this kind has been destroyed.
- *
- */
-NPError
-NP_Shutdown(void)
-{
- PLUGINDEBUGSTR("NP_Shutdown");
- NPP_Shutdown();
- return NPERR_NO_ERROR;
-}
+++ /dev/null
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * Mozilla/Firefox plugin for VLC
- * Copyright (C) 2009, Jean-Paul Saman <jpsaman@videolan.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * The Original Code is Mozilla Communicator client 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.
- *
- */
-
-#include "config.h"
-
-//#define OJI 1
-
-#include "../vlcplugin.h"
-
-#ifndef _NPAPI_H_
-# include "npapi.h"
-#endif
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
-#include "npupp.h"
-#else
-#include "npfunctions.h"
-#endif
-
-#include "../vlcshell.h"
-
-//\\// DEFINE
-#define NP_EXPORT
-
-//\\// GLOBAL DATA
-NPNetscapeFuncs* g_pNavigatorFuncs = 0;
-
-#ifdef OJI
-JRIGlobalRef Private_GetJavaClass(void);
-
-//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
-////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
-// Private_GetJavaClass (global function)
-//
-// Given a Java class reference (thru NPP_GetJavaClass) inform JRT
-// of this class existence
-//
-JRIGlobalRef
-Private_GetJavaClass(void)
-{
- jref clazz = NPP_GetJavaClass();
- if (clazz) {
- JRIEnv* env = NPN_GetJavaEnv();
- return JRI_NewGlobalRef(env, clazz);
- }
- return NULL;
-}
-#endif /* OJI */
-
-//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
-////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
-// PLUGIN DLL entry points
-//
-// These are the Windows specific DLL entry points. They must be exoprted
-//
-
-// we need these to be global since we have to fill one of its field
-// with a data (class) which requires knowlwdge of the navigator
-// jump-table. This jump table is known at Initialize time (NP_Initialize)
-// which is called after NP_GetEntryPoint
-static NPPluginFuncs* g_pluginFuncs;
-
-//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
-////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
-// NP_GetEntryPoints
-//
-// fills in the func table used by Navigator to call entry points in
-// plugin DLL. Note that these entry points ensure that DS is loaded
-// by using the NP_LOADDS macro, when compiling for Win16
-//
-#ifdef __MINGW32__
-extern "C" __declspec(dllexport) NPError WINAPI
-#else
-NPError WINAPI NP_EXPORT
-#endif
-NP_GetEntryPoints(NPPluginFuncs* pFuncs)
-{
- // trap a NULL ptr
- if(pFuncs == NULL)
- return NPERR_INVALID_FUNCTABLE_ERROR;
-
- // if the plugin's function table is smaller than the plugin expects,
- // then they are incompatible, and should return an error
-
- pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
- pFuncs->newp = NPP_New;
- pFuncs->destroy = NPP_Destroy;
- pFuncs->setwindow = NPP_SetWindow;
- pFuncs->newstream = NPP_NewStream;
- pFuncs->destroystream = NPP_DestroyStream;
- pFuncs->asfile = NPP_StreamAsFile;
- pFuncs->writeready = NPP_WriteReady;
- pFuncs->write = NPP_Write;
- pFuncs->print = NPP_Print;
- pFuncs->event = 0; /// reserved
- pFuncs->getvalue = NPP_GetValue;
- pFuncs->setvalue = NPP_SetValue;
-
- g_pluginFuncs = pFuncs;
-
- return NPERR_NO_ERROR;
-}
-
-//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
-////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
-// NP_Initialize
-//
-// called immediately after the plugin DLL is loaded
-//
-#ifdef __MINGW32__
-extern "C" __declspec(dllexport) NPError WINAPI
-#else
-NPError WINAPI NP_EXPORT
-#endif
-NP_Initialize(NPNetscapeFuncs* pFuncs)
-{
- // trap a NULL ptr
- if(pFuncs == NULL)
- return NPERR_INVALID_FUNCTABLE_ERROR;
-
- g_pNavigatorFuncs = pFuncs; // save it for future reference
-
- // if the plugin's major ver level is lower than the Navigator's,
- // then they are incompatible, and should return an error
- if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
- return NPERR_INCOMPATIBLE_VERSION_ERROR;
-
- // We have to defer these assignments until g_pNavigatorFuncs is set
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
-
- if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) {
- g_pluginFuncs->urlnotify = NPP_URLNotify;
- }
-#ifdef OJI
- if( navMinorVers >= NPVERS_HAS_LIVECONNECT ) {
- g_pluginFuncs->javaClass = Private_GetJavaClass();
- }
-#endif
- // NPP_Initialize is a standard (cross-platform) initialize function.
- return NPP_Initialize();
-}
-
-//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
-////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
-// NP_Shutdown
-//
-// called immediately before the plugin DLL is unloaded.
-// This function should check for some ref count on the dll to see if it is
-// unloadable or it needs to stay in memory.
-//
-#ifdef __MINGW32__
-extern "C" __declspec(dllexport) NPError WINAPI
-#else
-NPError WINAPI NP_EXPORT
-#endif
-NP_Shutdown()
-{
- NPP_Shutdown();
- g_pNavigatorFuncs = NULL;
- return NPERR_NO_ERROR;
-}
-
-char * NP_GetMIMEDescription()
-{
- return NPP_GetMIMEDescription();
-}
-
-// END - PLUGIN DLL entry points
-////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
-//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
-
-/* NAVIGATOR Entry points */
-
-/* These entry points expect to be called from within the plugin. The
- noteworthy assumption is that DS has already been set to point to the
- plugin's DLL data segment. Don't call these functions from outside
- the plugin without ensuring DS is set to the DLLs data segment first,
- typically using the NP_LOADDS macro
- */
-
-/* returns the major/minor version numbers of the Plugin API for the plugin
- and the Navigator
- */
-void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor)
-{
- *plugin_major = NP_VERSION_MAJOR;
- *plugin_minor = NP_VERSION_MINOR;
- *netscape_major = HIBYTE(g_pNavigatorFuncs->version);
- *netscape_minor = LOBYTE(g_pNavigatorFuncs->version);
-}
-
-NPError NPN_GetValue(NPP instance, NPNVariable variable, void *result)
-{
- return g_pNavigatorFuncs->getvalue(instance, variable, result);
-}
-
-NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
-{
- return g_pNavigatorFuncs->setvalue(instance, variable, value);
-}
-
-void NPN_InvalidateRect(NPP instance, NPRect *rect)
-{
- g_pNavigatorFuncs->invalidaterect(instance, rect);
-}
-
-void NPN_InvalidateRegion(NPP instance, NPRegion region)
-{
- g_pNavigatorFuncs->invalidateregion(instance, region);
-}
-
-void NPN_ForceRedraw(NPP instance)
-{
- g_pNavigatorFuncs->forceredraw(instance);
-}
-
-NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->getstringidentifier(name);
- }
- return NULL;
-}
-
-void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- g_pNavigatorFuncs->getstringidentifiers(names, nameCount, identifiers);
- }
-}
-
-NPIdentifier NPN_GetIntIdentifier(int32_t intid)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->getintidentifier(intid);
- }
- return NULL;
-}
-
-bool NPN_IdentifierIsString(NPIdentifier identifier)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->identifierisstring(identifier);
- }
- return false;
-}
-
-NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->utf8fromidentifier(identifier);
- }
- return NULL;
-}
-
-int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->intfromidentifier(identifier);
- }
- return 0;
-}
-
-NPObject *NPN_CreateObject(NPP instance, NPClass *aClass)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->createobject(instance, aClass);
- }
- return NULL;
-}
-
-NPObject *NPN_RetainObject(NPObject *npobj)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->retainobject(npobj);
- }
- return NULL;
-}
-
-void NPN_ReleaseObject(NPObject *npobj)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- g_pNavigatorFuncs->releaseobject(npobj);
- }
-}
-
-bool NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->invoke(instance, npobj, methodName, args, argCount, result);
- }
- return false;
-}
-
-bool NPN_InvokeDefault(NPP instance, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->invokeDefault(instance, npobj, args, argCount, result);
- }
- return false;
-}
-
-bool NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *result)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->evaluate(instance, npobj, script, result);
- }
- return false;
-}
-
-bool NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, NPVariant *result)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->getproperty(instance, npobj, propertyName, result);
- }
- return false;
-}
-
-bool NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, const NPVariant *value)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->setproperty(instance, npobj, propertyName, value);
- }
- return false;
-}
-
-bool NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->removeproperty(instance, npobj, propertyName);
- }
- return false;
-}
-
-bool NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->hasproperty(instance, npobj, propertyName);
- }
- return false;
-}
-
-bool NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- return g_pNavigatorFuncs->hasmethod(instance, npobj, methodName);
- }
- return false;
-}
-
-void NPN_ReleaseVariantValue(NPVariant *variant)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- g_pNavigatorFuncs->releasevariantvalue(variant);
- }
-}
-
-void NPN_SetException(NPObject *npobj, const NPUTF8 *message)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- if( navMinorVers >= 14 )
- {
- g_pNavigatorFuncs->setexception(npobj, message);
- }
-}
-
-/* causes the specified URL to be fetched and streamed in
- */
-NPError NPN_GetURLNotify(NPP instance, const char *url, const char *target, void* notifyData)
-
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- NPError err;
- if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) {
- err = g_pNavigatorFuncs->geturlnotify(instance, url, target, notifyData);
- }
- else {
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- return err;
-}
-
-NPError NPN_GetURL(NPP instance, const char *url, const char *target)
-{
- return g_pNavigatorFuncs->geturl(instance, url, target);
-}
-
-NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData)
-{
- int navMinorVers = g_pNavigatorFuncs->version & 0xFF;
- NPError err;
- if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) {
- err = g_pNavigatorFuncs->posturlnotify(instance, url, window, len, buf, file, notifyData);
- }
- else {
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- return err;
-}
-
-
-NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file)
-{
- return g_pNavigatorFuncs->posturl(instance, url, window, len, buf, file);
-}
-
-/* Requests that a number of bytes be provided on a stream. Typically
- this would be used if a stream was in "pull" mode. An optional
- position can be provided for streams which are seekable.
- */
-NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
-{
- return g_pNavigatorFuncs->requestread(stream, rangeList);
-}
-
-/* Creates a new stream of data from the plug-in to be interpreted
- * by Netscape in the current window.
- */
-NPError NPN_NewStream(NPP instance, NPMIMEType type,
- const char* target, NPStream** stream)
-{
- int navMinorVersion = g_pNavigatorFuncs->version & 0xFF;
- NPError err;
-
- if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) {
- err = g_pNavigatorFuncs->newstream(instance, type, target, stream);
- }
- else {
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- return err;
-}
-
-/* Provides len bytes of data.
- */
-int32_t NPN_Write(NPP instance, NPStream *stream,
- int32_t len, void *buffer)
-{
- int navMinorVersion = g_pNavigatorFuncs->version & 0xFF;
- int32_t result;
-
- if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) {
- result = g_pNavigatorFuncs->write(instance, stream, len, buffer);
- }
- else {
- result = -1;
- }
- return result;
-}
-
-/* Closes a stream object.
- * reason indicates why the stream was closed.
- */
-NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
-{
- int navMinorVersion = g_pNavigatorFuncs->version & 0xFF;
- NPError err;
-
- if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT ) {
- err = g_pNavigatorFuncs->destroystream(instance, stream, reason);
- }
- else {
- err = NPERR_INCOMPATIBLE_VERSION_ERROR;
- }
- return err;
-}
-
-/* Provides a text status message in the Netscape client user interface
- */
-void NPN_Status(NPP instance, const char *message)
-{
- g_pNavigatorFuncs->status(instance, message);
-}
-
-/* returns the user agent string of Navigator, which contains version info
- */
-const char* NPN_UserAgent(NPP instance)
-{
- return g_pNavigatorFuncs->uagent(instance);
-}
-
-/* allocates memory from the Navigator's memory space. Necessary so that
- * saved instance data may be freed by Navigator when exiting.
- */
-void *NPN_MemAlloc(uint32_t size)
-{
- return g_pNavigatorFuncs->memalloc(size);
-}
-
-/* reciprocal of MemAlloc() above
- */
-void NPN_MemFree(void* ptr)
-{
- g_pNavigatorFuncs->memfree(ptr);
-}
-
-#ifdef OJI
-/* private function to Netscape. do not use!
- */
-void NPN_ReloadPlugins(NPBool reloadPages)
-{
- g_pNavigatorFuncs->reloadplugins(reloadPages);
-}
-
-JRIEnv* NPN_GetJavaEnv(void)
-{
- return g_pNavigatorFuncs->getJavaEnv();
-}
-
-jref NPN_GetJavaPeer(NPP instance)
-{
- return g_pNavigatorFuncs->getJavaPeer(instance);
-}
-#endif
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<HTML>
-<TITLE>VLC Plugin test page</TITLE>
-<STYLE>
- .inputTrackerInput {
- height:20;
- width:30;
- font-family : Arial, Helvetica, sans-serif;
- font-size : 12px;
- }
-</STYLE>
-
-<SCRIPT language="JavaScript"><!--
-function init()
-{
- if( navigator.appName.indexOf("Microsoft Internet")==-1 )
- {
- onVLCPluginReady()
- }
- else if( document.readyState == 'complete' )
- {
- onVLCPluginReady();
- }
- else
- {
- /* Explorer loads plugins asynchronously */
- document.onreadystatechange=function()
- {
- if( document.readyState == 'complete' )
- {
- onVLCPluginReady();
- }
- }
- }
-}
-
-function getVLC(name)
-{
- if (window.document[name])
- {
- return window.document[name];
- }
- if (navigator.appName.indexOf("Microsoft Internet")==-1)
- {
- if (document.embeds && document.embeds[name])
- return document.embeds[name];
- }
- else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
- {
- return document.getElementById(name);
- }
-}
-
-function registerVLCEvent(event, handler)
-{
- var vlc = getVLC("vlc");
-
- if (vlc) {
- if (vlc.attachEvent) {
- // Microsoft
- vlc.attachEvent (event, handler);
- } else if (vlc.addEventListener) {
- // Mozilla: DOM level 2
- vlc.addEventListener (event, handler, true);
- } else {
- // DOM level 0
- eval("vlc.on" + event + " = handler");
- }
- }
-}
-
-function unregisterVLCEvent(event, handler)
-{
- var vlc = getVLC("vlc");
-
- if (vlc) {
- if (vlc.detachEvent) {
- // Microsoft
- vlc.detachEvent (event, handler);
- } else if (vlc.removeEventListener) {
- // Mozilla: DOM level 2
- vlc.removeEventListener (event, handler, true);
- } else {
- // DOM level 0
- eval("vlc.on" + event + " = null");
- }
- }
-}
-
-// JS VLC API callbacks
-function handleMediaPlayerMediaChanged()
-{
- document.getElementById("info").innerHTML = "Media Changed";
-}
-
-function handle_MediaPlayerNothingSpecial()
-{
- document.getElementById("state").innerHTML = "Idle...";
-}
-
-function handle_MediaPlayerOpening()
-{
- onOpen();
-}
-
-function handle_MediaPlayerBuffering(val)
-{
- document.getElementById("info").innerHTML = val + "%";
-}
-
-function handle_MediaPlayerPlaying()
-{
- onPlay();
-}
-
-function handle_MediaPlayerPaused()
-{
- onPause();
-}
-
-function handle_MediaPlayerStopped()
-{
- onStop();
-}
-
-function handle_MediaPlayerForward()
-{
- document.getElementById("state").innerHTML = "Forward...";
-}
-
-function handle_MediaPlayerBackward()
-{
- document.getElementById("state").innerHTML = "Backward...";
-}
-
-function handle_MediaPlayerEndReached()
-{
- onEnd();
-}
-
-function handle_MediaPlayerEncounteredError()
-{
- onError();
-}
-
-function handle_MediaPlayerTimeChanged(time)
-{
- var vlc = getVLC("vlc");
- var info = document.getElementById("info");
- if( vlc )
- {
- var mediaLen = vlc.input.length;
- if( mediaLen > 0 )
- {
- // seekable media
- info.innerHTML = formatTime(time)+"/"+formatTime(mediaLen);
- }
- }
-}
-
-function handle_MediaPlayerPositionChanged(val)
-{
- // set javascript slider to correct position
-}
-
-function handle_MediaPlayerSeekableChanged(val)
-{
- setSeekable(val);
-}
-
-function handle_MediaPlayerPausableChanged(val)
-{
- setPauseable(val);
-}
-
-function handle_MediaPlayerTitleChanged(val)
-{
- //setTitle(val);
- document.getElementById("info").innerHTML = "Title: " + val;
-}
-
-function handle_MediaPlayerLengthChanged(val)
-{
- //setMediaLength(val);
-}
-
-// VLC Plugin
-function onVLCPluginReady()
-{
- registerVLCEvent("MediaPlayerMediaChanged", handleMediaPlayerMediaChanged);
- registerVLCEvent("MediaPlayerNothingSpecial", handle_MediaPlayerNothingSpecial);
- registerVLCEvent("MediaPlayerOpening", handle_MediaPlayerOpening);
- registerVLCEvent("MediaPlayerBuffering", handle_MediaPlayerBuffering);
- registerVLCEvent("MediaPlayerPlaying", handle_MediaPlayerPlaying);
- registerVLCEvent("MediaPlayerPaused", handle_MediaPlayerPaused);
- registerVLCEvent("MediaPlayerStopped", handle_MediaPlayerStopped);
- registerVLCEvent("MediaPlayerForward", handle_MediaPlayerForward);
- registerVLCEvent("MediaPlayerBackward", handle_MediaPlayerBackward);
- registerVLCEvent("MediaPlayerEndReached", handle_MediaPlayerEndReached);
- registerVLCEvent("MediaPlayerEncounteredError", handle_MediaPlayerEncounteredError);
- registerVLCEvent("MediaPlayerTimeChanged", handle_MediaPlayerTimeChanged);
- registerVLCEvent("MediaPlayerPositionChanged", handle_MediaPlayerPositionChanged);
- registerVLCEvent("MediaPlayerSeekableChanged", handle_MediaPlayerSeekableChanged);
- registerVLCEvent("MediaPlayerPausableChanged", handle_MediaPlayerPausableChanged);
- registerVLCEvent("MediaPlayerTitleChanged", handle_MediaPlayerTitleChanged);
- registerVLCEvent("MediaPlayerLengthChanged", handle_MediaPlayerLengthChanged);
-}
-
-function close()
-{
- unregisterVLCEvent("MediaPlayerMediaChanged", handleMediaPlayerMediaChanged);
- unregisterVLCEvent("MediaPlayerNothingSpecial", handle_MediaPlayerNothingSpecial);
- unregisterVLCEvent("MediaPlayerOpening", handle_MediaPlayerOpening);
- unregisterVLCEvent("MediaPlayerBuffering", handle_MediaPlayerBuffering);
- unregisterVLCEvent("MediaPlayerPlaying", handle_MediaPlayerPlaying);
- unregisterVLCEvent("MediaPlayerPaused", handle_MediaPlayerPaused);
- unregisterVLCEvent("MediaPlayerStopped", handle_MediaPlayerStopped);
- unregisterVLCEvent("MediaPlayerForward", handle_MediaPlayerForward);
- unregisterVLCEvent("MediaPlayerBackward", handle_MediaPlayerBackward);
- unregisterVLCEvent("MediaPlayerEndReached", handle_MediaPlayerEndReached);
- unregisterVLCEvent("MediaPlayerEncounteredError", handle_MediaPlayerEncounteredError);
- unregisterVLCEvent("MediaPlayerTimeChanged", handle_MediaPlayerTimeChanged);
- unregisterVLCEvent("MediaPlayerPositionChanged", handle_MediaPlayerPositionChanged);
- unregisterVLCEvent("MediaPlayerSeekableChanged", handle_MediaPlayerSeekableChanged);
- unregisterVLCEvent("MediaPlayerPausableChanged", handle_MediaPlayerPausableChanged);
- unregisterVLCEvent("MediaPlayerTitleChanged", handle_MediaPlayerTitleChanged);
- unregisterVLCEvent("MediaPlayerLengthChanged", handle_MediaPlayerLengthChanged);
-}
-
-//--></SCRIPT>
-
-<BODY onLoad="init();" onClose="close();">
-<TABLE>
-<TR><TD colspan="2">
-MRL:
-<INPUT size="90" id="targetTextField" value="">
-<INPUT type=submit value="Go" onClick="doGo(document.getElementById('targetTextField').value);">
-<INPUT type=submit value="Add" onClick="doAdd(document.getElementById('targetTextField').value);">
-</TD></TR>
-<TR><TD align="center" colspan="2">
-<!--
-Insert VideoLAN.VLCPlugin.2
--->
-<OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"
- width="640"
- height="480"
- id="vlc"
- events="True">
-<param name="MRL" value="" />
-<param name="ShowDisplay" value="True" />
-<param name="AutoLoop" value="False" />
-<param name="AutoPlay" value="False" />
-<param name="Volume" value="50" />
-<param name="toolbar" value="true" />
-<param name="StartTime" value="0" />
-<EMBED pluginspage="http://www.videolan.org"
- type="application/x-vlc-plugin"
- version="VideoLAN.VLCPlugin.2"
- width="640"
- height="480"
- toolbar="true"
- text="Waiting for video"
- name="vlc">
-</EMBED>
-</OBJECT>
-</TD></TR>
-<TR><TD colspan="2">
-<TABLE><TR>
-<TD valign="top" width="550">
-<!--
-Insert Slider widget
--->
-<DIV id="inputTrackerDiv"</DIV>
-</TD><TD width="15%">
-<DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>
-<DIV id="state" style="text-align:center">Stopped...</DIV>
-</TD></TR></TABLE>
-</TD></TR>
-<TR><TD>
-<INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause();'>
-<INPUT type=button value="Stop" onClick='doStop();'>
-
-<INPUT type=button value=" << " onClick='doPlaySlower();'>
-<INPUT type=button value="Reverse" onClick='doReverse();'>
-<INPUT type=button value=" >> " onClick='doPlayFaster();'>
-
-<INPUT type=button value="Fullscreen" onClick='getVLC("vlc").video.toggleFullscreen();'>
-<INPUT type=button value="Version" onClick='alert("vlc " + getVLC("vlc").VersionInfo);'>
-<INPUT type=button value=" State " onClick='alert("state: " + getVLC("vlc").input.state);'>
-</TD><TD align="right">
-<SPAN style="text-align:center">Volume:</SPAN>
-<INPUT type=button value=" - " onClick='updateVolume(-10)'>
-<SPAN id="volumeTextField" style="text-align:center">--</SPAN>
-<INPUT type=button value=" + " onClick='updateVolume(+10)'>
-<INPUT type=button value="Mute" onClick='getVLC("vlc").audio.toggleMute();'>
-</TD>
-</TR>
-<TR><TD>Playlist:
-<INPUT type=button value="Prev" onClick='getVLC("vlc").playlist.prev();'>
-<INPUT type=button value="Next" onClick='getVLC("vlc").playlist.next();'>
-<INPUT type=button value="Clear All" onClick='doPlaylistClearAll();'>
- Aspect Ratio:
- <SELECT readonly onChange='doAspectRatio(this.value)'>
- <OPTION value="default">Default</OPTION>
- <OPTION value="1:1">1:1</OPTION>
- <OPTION value="4:3">4:3</OPTION>
- <OPTION value="16:9">16:9</OPTION>
- <OPTION value="221:100">221:100</OPTION>
- <OPTION value="5:4">5:4</OPTION>
- </SELECT>
-</TD><TD align="right">
-<INPUT type=button id="itemCount" value=" Items 0 " onClick='doItemCount();'>
-<INPUT size=4 value="" id="removeid"><INPUT type=submit value="Delete" onClick="doRemoveItem(document.getElementById('removeid').value);">
-</TD>
-</TR>
-<TR><TD>Audio Channel:
- <SELECT readonly onClick='doAudioChannel(this.value);'>
- <OPTION value=1>Stereo</OPTION>
- <OPTION value=2>Reverse Stereo</OPTION>
- <OPTION value=3>Left</OPTION>
- <OPTION value=4>Right</OPTION>
- <OPTION value=5>Dolby</OPTION>
- </SELECT>
-</TD>
-<TD>
-<INPUT type=button value="current channel" onClick='alert(getVLC("vlc").audio.channel);'>
-</TD>
-</TR>
-<TR><TD> Audio Track:
-<INPUT type=button value=" + " onClick='doAudioTrack(1);'>
-<SPAN id="trackTextField" style="text-align:center">--</SPAN>
-<INPUT type=button value=" - " onClick='doAudioTrack(-1);'>
-<INPUT type=button value="current track" onClick='alert(getVLC("vlc").audio.description(vlc.audio.track));'>
-<INPUT type=button value="number of track" onClick='alert(getVLC("vlc").audio.count);'>
-</TD>
-<TD>
-<INPUT type=button value="set slider" onClick='doSetSlider();'>
-<INPUT type=button value="get position" onClick='doGetPosition();'>
-</TD>
-</TR>
-<TR>
-<TD>Video Subtitle:
- <INPUT type=button value=" + " onClick='doSubtitle(1);'>
- <SPAN id="spuTextField" style="text-align:center">--</SPAN>
- <INPUT type=button value=" - " onClick='doSubtitle(-1);'>
- <INPUT type=button value="current subtitle" onClick='alert(getVLC("vlc").subtitle.description(vlc.subtitle.track));'>
- <INPUT type=button value="number of subtitle" onClick='alert(getVLC("vlc").subtitle.count);'>
-</TD>
-</TR>
-<TR>
-<TD>Deinterlacing:
- <INPUT type=button value="BLEND" onClick='getVLC("vlc").video.deinterlace.enable("blend");'>
- <INPUT type=button value=" X " onClick='getVLC("vlc").video.deinterlace.enable("x");'>
- <INPUT type=button value="Disable" onClick='getVLC("vlc").video.deinterlace.disable();'>
-</TD>
-</TR>
-<TR>
-<TD>Marquee video filter:
- <INPUT type=button value="Enable" onClick='getVLC("vlc").video.marquee.enable();'>
- <INPUT type=button value="Disable" onClick='getVLC("vlc").video.marquee.disable();'>
- <INPUT size=4 value="" id="marqueeIntValue">
- <SELECT readonly onClick="doMarqueeOption(this.value,document.getElementById('marqueeIntValue').value);">
- <OPTION value=1>Color</OPTION>
- <OPTION value=2>Opacity</OPTION>
- <OPTION value=3>Position</OPTION>
- <OPTION value=4>Refresh</OPTION>
- <OPTION value=5>Size</OPTION>
- <OPTION value=6>Text</OPTION>
- <OPTION value=7>Timeout</OPTION>
- <OPTION value=8>X</OPTION>
- <OPTION value=9>Y</OPTION>
- </SELECT>
-</TD>
-</TR>
-<TR>
-<TD>Logo video filter:
- <INPUT type=button value="Enable" onClick='getVLC("vlc").video.logo.enable();'>
- <INPUT type=button value="Disable" onClick='getVLC("vlc").video.logo.disable();'>
- <INPUT size=4 value="" id="logoIntValue">
- <SELECT readonly onClick="doLogoOption(this.value,document.getElementById('logoIntValue').value);">
- <OPTION value=1>File</OPTION>
- <OPTION value=2>Position</OPTION>
- <OPTION value=3>Opacity</OPTION>
- <OPTION value=4>Repeat</OPTION>
- <OPTION value=5>Delay</OPTION>
- <OPTION value=6>X</OPTION>
- <OPTION value=7>Y</OPTION>
- </SELECT>
-</TD>
-</TR>
-<TR>
-<TD>
- <INPUT type=button id="telx" value="Teletext off" onClick='doToggleTeletext();'>
- Teletext page:
- <INPUT size=4 value="100" id="telxPage" onClick='doTelxPage(document.getElementById("telxPage").value);'>
-</TD>
-</TR>
-</TABLE>
-<SCRIPT language="javascript">
-<!--
-
-var rate = 0;
-var prevState = 0;
-var telxState = false;
-var canPause = true;
-var canSeek = true;
-
-function setPauseable(val)
-{
- canPause = val;
-}
-
-function setSeekable(val)
-{
- canSeek = val;
-}
-
-function doSetSlider()
-{
- var vlc = getVLC("vlc");
-
- // set slider to new position
- if( vlc )
- vlc.input.time = (vlc.input.length/2);
-}
-
-function doGetPosition()
-{
- var vlc = getVLC("vlc");
-
- // set slider to new position
- if (vlc)
- alert( "position is " + vlc.input.time);
-}
-
-function doReverse(rate)
-{
- var vlc = getVLC("vlc");
- if( vlc )
- vlc.input.rate = -1.0 * vlc.input.rate;
-}
-
-function doAudioChannel(value)
-{
- var vlc = getVLC("vlc");
- if( vlc )
- vlc.audio.channel = parseInt(value);
-}
-
-function doAudioTrack(value)
-{
- var vlc = getVLC("vlc");
- if( vlc )
- {
- vlc.audio.track = vlc.audio.track + value;
- document.getElementById("trackTextField").innerHTML = vlc.audio.track;
- }
-}
-
-function doAspectRatio(value)
-{
- var vlc = getVLC("vlc");
- if( vlc )
- vlc.video.aspectRatio = value;
-}
-
-function doSubtitle(value)
-{
- var vlc = getVLC("vlc");
- if( vlc )
- {
- vlc.subtitle.track = vlc.subtitle.track + value;
- document.getElementById("spuTextField").innerHTML = vlc.subtitle.track;
- }
-}
-
-function doTelxPage(value)
-{
- var vlc = getVLC("vlc");
- if( vlc )
- vlc.video.teletext = parseInt(value);
-}
-
-function doToggleTeletext()
-{
- var vlc = getVLC("vlc");
-
- if( vlc )
- {
- vlc.video.toggleTeletext();
- if (telxState)
- {
- document.getElementById("telx").innerHTML = "Teletext on";
- telxState = true;
- }
- else
- {
- document.getElementById("telx").innerHTML = "Teletext off";
- telxState = false;
- }
- }
-}
-
-function doItemCount()
-{
- var vlc = getVLC("vlc");
- if( vlc )
- {
- var count = vlc.playlist.items.count;
- document.getElementById("itemCount").value = " Items " + count + " ";
- }
-}
-
-function doRemoveItem(item)
-{
- var vlc = getVLC("vlc");
- if( vlc )
- vlc.playlist.items.remove(item);
-}
-
-function doPlaylistClearAll()
-{
- var vlc = getVLC("vlc");
- if( vlc )
- {
- vlc.playlist.items.clear();
- while( vlc.playlist.items.count > 0)
- {
- // wait till playlist empties.
- }
- doItemCount();
- }
-}
-
-function updateVolume(deltaVol)
-{
- var vlc = getVLC("vlc");
- if( vlc )
- {
- vlc.audio.volume += deltaVol;
- document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
- }
-}
-
-function formatTime(timeVal)
-{
- if( typeof timeVal != 'number' )
- return "-:--:--";
-
- var timeHour = Math.round(timeVal / 1000);
- var timeSec = timeHour % 60;
- if( timeSec < 10 )
- timeSec = '0'+timeSec;
- timeHour = (timeHour - timeSec)/60;
- var timeMin = timeHour % 60;
- if( timeMin < 10 )
- timeMin = '0'+timeMin;
- timeHour = (timeHour - timeMin)/60;
- if( timeHour > 0 )
- return timeHour+":"+timeMin+":"+timeSec;
- else
- return timeMin+":"+timeSec;
-}
-
-// Old method of querying current state
-// function doState() - depreceated
-function doState()
-{
- var vlc = getVLC("vlc");
- var newState = 0;
-
- if( vlc )
- newState = vlc.input.state;
-
- if( newState == 0 )
- {
- // current media has stopped
- onEnd();
- }
- else if( newState == 1 )
- {
- // current media is openning/connecting
- onOpen();
- }
- else if( newState == 2 )
- {
- // current media is buffering data
- onBuffer();
- }
- else if( newState == 3 )
- {
- // current media is now playing
- onPlay();
- }
- else if( newState == 4 )
- {
- // current media is now paused
- onPause();
- }
- else if( newState == 5 )
- {
- // current media has stopped
- onStop();
- }
- else if( newState == 6 )
- {
- // current media has ended
- onEnd();
- }
- else if( newState == 7 )
- {
- // current media encountered error
- onError();
- }
-}
-
-/* actions */
-
-function doGo(targetURL)
-{
- var vlc = getVLC("vlc");
-
- if( vlc )
- {
- vlc.playlist.items.clear();
- while( vlc.playlist.items.count > 0 )
- {
- // clear() may return before the playlist has actually been cleared
- // just wait for it to finish its job
- }
- var options = [":rtsp-tcp"];
- var itemId = vlc.playlist.add(targetURL,"",options);
- options = [];
- if( itemId != -1 )
- {
- // play MRL
- vlc.playlist.playItem(itemId);
- }
- else
- {
- alert("cannot play at the moment !");
- }
- doItemCount();
- }
-}
-
-function doAdd(targetURL)
-{
- var vlc = getVLC("vlc");
- var options = [":vout-filter=deinterlace", ":deinterlace-mode=linear"];
- if( vlc )
- {
- vlc.playlist.add(targetURL, "", options);
- options = [];
- doItemCount();
- }
-}
-
-function doPlayOrPause()
-{
- var vlc = getVLC("vlc");
- if( vlc )
- {
- if( vlc.playlist.isPlaying && canPause )
- {
- vlc.playlist.togglePause();
- }
- else if( vlc.playlist.items.count > 0 )
- {
- vlc.playlist.play();
- }
- else
- {
- alert('nothing to play !');
- }
- }
-}
-
-function doStop()
-{
- var vlc = getVLC("vlc");
- if( vlc )
- vlc.playlist.stop();
-}
-
-function doPlaySlower()
-{
- var vlc = getVLC("vlc");
- if( vlc )
- vlc.input.rate = vlc.input.rate / 2;
-}
-
-function doPlayFaster()
-{
- var vlc = getVLC("vlc");
- if( vlc )
- vlc.input.rate = vlc.input.rate * 2;
-}
-
-function doMarqueeOption(option, value)
-{
- var vlc = getVLC("vlc");
- val = parseInt(value);
- if( vlc )
- {
- if (option == 1)
- vlc.video.marquee.color = val;
- if (option == 2)
- vlc.video.marquee.opacity = val;
- if (option == 3)
- vlc.video.marquee.position = value;
- if (option == 4)
- vlc.video.marquee.refresh = val;
- if (option == 5)
- vlc.video.marquee.size = val;
- if (option == 6)
- vlc.video.marquee.text = value;
- if (option == 7)
- vlc.video.marquee.timeout = val;
- if (option == 8)
- vlc.video.marquee.x = val;
- if (option == 9)
- vlc.video.marquee.y = val;
- }
-}
-
-function doLogoOption(option, value)
-{
- var vlc = getVLC("vlc");
- if( vlc )
- {
- if (option == 1)
- vlc.video.logo.file(value);
- if (option == 2)
- vlc.video.logo.position = value;
- val = parseInt(value);
- if (option == 3)
- vlc.video.logo.opacity = val;
- if (option == 4)
- vlc.video.logo.repeat = val;
- if (option == 5)
- vlc.video.logo.delay = val;
- if (option == 6)
- vlc.video.logo.x = val;
- if (option == 7)
- vlc.video.logo.y = val;
- }
-}
-
-/* events */
-
-function onOpen()
-{
- document.getElementById("state").innerHTML = "Opening...";
- document.getElementById("PlayOrPause").value = "Pause";
-}
-
-function onBuffer()
-{
- document.getElementById("state").innerHTML = "Buffering...";
- document.getElementById("PlayOrPause").value = "Pause";
-}
-
-function onPlay()
-{
- document.getElementById("state").innerHTML = "Playing...";
- document.getElementById("PlayOrPause").value = "Pause";
- onPlaying();
-}
-
-function onEnd()
-{
- document.getElementById("state").innerHTML = "End...";
-}
-
-var liveFeedText = ["Live", "((Live))", "(( Live ))", "(( Live ))"];
-var liveFeedRoll = 0;
-
-function onPlaying()
-{
- var vlc = getVLC("vlc");
- var info = document.getElementById("info");
- if( vlc )
- {
- var mediaLen = vlc.input.length;
- if( mediaLen > 0 )
- {
- // seekable media
- info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(mediaLen);
- }
- else
- {
- // non-seekable "live" media
- liveFeedRoll = liveFeedRoll & 3;
- info.innerHTML = liveFeedText[liveFeedRoll++];
- }
- }
-}
-
-function onPause()
-{
- document.getElementById("state").innerHTML = "Paused...";
- document.getElementById("PlayOrPause").value = " Play ";
-}
-
-function onStop()
-{
- var vlc = getVLC("vlc");
-
- document.getElementById("info").innerHTML = "-:--:--/-:--:--";
- document.getElementById("state").innerHTML = "Stopped...";
- document.getElementById("PlayOrPause").value = " Play ";
-}
-
-function onError()
-{
- var vlc = getVLC("vlc");
-
- document.getElementById("state").innerHTML = "Error...";
-}
-
-//-->
-</SCRIPT>
-</BODY>
-</HTML>
+++ /dev/null
-/*****************************************************************************
- * VLC Plugin description for OS X
- *****************************************************************************/
-
-/* Definitions of system resource types */
-
-data 'carb' (0)
-{
-};
-
-/* The first string in the array is a plugin description,
- * the second is the plugin name */
-resource 'STR#' (126)
-{
- {
- "@COPYRIGHT_MESSAGE@"
- "<BR><A HREF='http://www.videolan.org'>http://www.videolan.org</A>",
- "VLC Multimedia Plug-in"
- };
-};
-
-/* A description for each MIME type in resource 128 */
-resource 'STR#' (127)
-{
- {
- /* MPEG-1 and MPEG-2 */
- "MPEG audio",
- "MPEG audio",
- "MPEG video",
- "MPEG video",
- "MPEG video",
- "MPEG video",
- /* MPEG-4 */
- "MPEG-4 video",
- "MPEG-4 audio",
- "MPEG-4 video",
- "MPEG-4 video",
- /* AVI */
- "AVI video",
- /* Quicktime */
-/* "QuickTime video", */
- /* OGG */
- "Ogg stream",
- "Ogg stream",
- /* VLC */
- "VLC plug-in",
- /* Windows Media */
- "Windows Media video",
- "Windows Media video",
- "Windows Media plug-in",
- "Windows Media video",
- /* Google VLC */
- "Google VLC plug-in",
- /* WAV audio */
- "WAV audio",
- "WAV audio",
- /* 3GPP */
- "3GPP audio",
- "3GPP video",
- /* 3GPP2 */
- "3GPP2 audio",
- "3GPP2 video",
- /* DIVX */
- "DivX video",
- /* FLV */
- "FLV video",
- "FLV video",
- /* MkV */
- "MKV video",
- "MKV audio",
- };
-};
-
-/* A series of pairs of strings... first MIME type, then file extension(s) */
-resource 'STR#' (128,"MIME Type")
-{
- {
- /* MPEG-1 and MPEG-2 */
- "audio/mpeg", "mp2,mp3,mpga,mpega",
- "audio/x-mpeg", "mp2,mp3,mpga,mpega",
- "video/mpeg", "mpg,mpeg,mpe",
- "video/x-mpeg", "mpg,mpeg,mpe",
- "video/mpeg-system", "mpg,mpeg,vob",
- "video/x-mpeg-system", "mpg,mpeg,vob",
- /* MPEG-4 */
- "video/mp4", "mp4,mpg4",
- "audio/mp4", "mp4,mpg4",
- "application/mpeg4-iod", "mp4,mpg4",
- "application/mpeg4-muxcodetable", "mp4,mpg4",
- /* AVI */
- "video/x-msvideo", "avi",
- /* Quicktime */
-/* "video/quicktime", "mov,qt", */
- /* OGG */
- "application/ogg", "ogg",
- "application/x-ogg", "ogg",
- /* VLC */
- "application/x-vlc-plugin", "vlc",
- /* Windows Media */
- "video/x-ms-asf-plugin", "asf,asx",
- "video/x-ms-asf", "asf,asx",
- "application/x-mplayer2", "",
- "video/x-ms-wmv", "wmv",
- /* Google VLC */
- "video/x-google-vlc-plugin", "",
- /* WAV audio */
- "audio/wav", "wav",
- "audio/x-wav", "wav",
- /* 3GPP */
- "audio/3gpp", "3gp,3gpp",
- "video/3gpp", "3gp,3gpp",
- /* 3GPP2 */
- "audio/3gpp2", "3g2,3gpp2",
- "video/3gpp2", "3g2,3gpp2",
- /* DIVX */
- "video/divx", "divx",
- /* FLV */
- "video/flv", "flv",
- "video/x-flv", "flv",
- /* MKV */
- "video/x-matroska", "mkv",
- "audio/x-matroska", "mka",
- /* XSPF */
- "application/xspf+xml", "xspf",
-
- };
-};
-
+++ /dev/null
-/*****************************************************************************
- * vlcplugin.cpp: a VLC plugin for Mozilla
- *****************************************************************************
- * Copyright (C) 2002-2010 the VideoLAN team
- * $Id$
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- * Damien Fouilleul <damienf.fouilleul@laposte.net>
- * Jean-Paul Saman <jpsaman@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "config.h"
-
-#include "vlcplugin.h"
-
-#include "control/npolibvlc.h"
-
-#include <ctype.h>
-
-#if defined(XP_UNIX)
-# include <pthread.h>
-#elif defined(XP_WIN)
- /* windows headers */
-# include <winbase.h>
-#else
-#warning "locking not implemented for this platform"
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-
-/*****************************************************************************
- * utilitiy functions
- *****************************************************************************/
-static void plugin_lock_init(plugin_lock_t *lock)
-{
- assert(lock);
-
-#if defined(XP_UNIX)
- pthread_mutex_init(&lock->mutex, NULL);
-#elif defined(XP_WIN)
- InitializeCriticalSection(&lock->cs);
-#else
-#warning "locking not implemented in this platform"
-#endif
-}
-
-static void plugin_lock_destroy(plugin_lock_t *lock)
-{
- assert(lock);
-
-#if defined(XP_UNIX)
- pthread_mutex_destroy(&lock->mutex);
-#elif defined(XP_WIN)
- DeleteCriticalSection(&lock->cs);
-#else
-#warning "locking not implemented in this platform"
-#endif
-}
-
-static void plugin_lock(plugin_lock_t *lock)
-{
- assert(lock);
-
-#if defined(XP_UNIX)
- pthread_mutex_lock(&lock->mutex);
-#elif defined(XP_WIN)
- EnterCriticalSection(&lock->cs);
-#else
-#warning "locking not implemented in this platform"
-#endif
-}
-
-static void plugin_unlock(plugin_lock_t *lock)
-{
- assert(lock);
-
-#if defined(XP_UNIX)
- pthread_mutex_unlock(&lock->mutex);
-#elif defined(XP_WIN)
- LeaveCriticalSection(&lock->cs);
-#else
-#warning "locking not implemented in this platform"
-#endif
-}
-
-/*****************************************************************************
- * Event Object
- *****************************************************************************/
-static void handle_input_event(const libvlc_event_t* event, void *param);
-static void handle_changed_event(const libvlc_event_t* event, void *param);
-
-static vlcplugin_event_t vlcevents[] = {
- { "MediaPlayerMediaChanged", libvlc_MediaPlayerMediaChanged, handle_input_event },
- { "MediaPlayerNothingSpecial", libvlc_MediaPlayerNothingSpecial, handle_input_event },
- { "MediaPlayerOpening", libvlc_MediaPlayerOpening, handle_input_event },
- { "MediaPlayerBuffering", libvlc_MediaPlayerBuffering, handle_changed_event },
- { "MediaPlayerPlaying", libvlc_MediaPlayerPlaying, handle_input_event },
- { "MediaPlayerPaused", libvlc_MediaPlayerPaused, handle_input_event },
- { "MediaPlayerStopped", libvlc_MediaPlayerStopped, handle_input_event },
- { "MediaPlayerForward", libvlc_MediaPlayerForward, handle_input_event },
- { "MediaPlayerBackward", libvlc_MediaPlayerBackward, handle_input_event },
- { "MediaPlayerEndReached", libvlc_MediaPlayerEndReached, handle_input_event },
- { "MediaPlayerEncounteredError", libvlc_MediaPlayerEncounteredError, handle_input_event },
- { "MediaPlayerTimeChanged", libvlc_MediaPlayerTimeChanged, handle_changed_event },
- { "MediaPlayerPositionChanged", libvlc_MediaPlayerPositionChanged, handle_changed_event },
- { "MediaPlayerSeekableChanged", libvlc_MediaPlayerSeekableChanged, handle_changed_event },
- { "MediaPlayerPausableChanged", libvlc_MediaPlayerPausableChanged, handle_changed_event },
- { "MediaPlayerTitleChanged", libvlc_MediaPlayerTitleChanged, handle_changed_event },
- { "MediaPlayerLengthChanged", libvlc_MediaPlayerLengthChanged, handle_changed_event },
-};
-
-static void handle_input_event(const libvlc_event_t* event, void *param)
-{
- VlcPlugin *plugin = (VlcPlugin*)param;
- switch( event->type )
- {
- case libvlc_MediaPlayerNothingSpecial:
- case libvlc_MediaPlayerOpening:
- case libvlc_MediaPlayerPlaying:
- case libvlc_MediaPlayerPaused:
- case libvlc_MediaPlayerStopped:
- case libvlc_MediaPlayerForward:
- case libvlc_MediaPlayerBackward:
- case libvlc_MediaPlayerEndReached:
- case libvlc_MediaPlayerEncounteredError:
- plugin->event_callback(event, NULL, 0, param);
- break;
- default: /* ignore all other libvlc_event_type_t */
- break;
- }
-}
-
-static void handle_changed_event(const libvlc_event_t* event, void *param)
-{
- uint32_t npcount = 1;
- NPVariant *npparam = (NPVariant *) NPN_MemAlloc( sizeof(NPVariant) * npcount );
-
- VlcPlugin *plugin = (VlcPlugin*)param;
- switch( event->type )
- {
- case libvlc_MediaPlayerBuffering:
- DOUBLE_TO_NPVARIANT(event->u.media_player_buffering.new_cache, npparam[0]);
- break;
- case libvlc_MediaPlayerTimeChanged:
- DOUBLE_TO_NPVARIANT(event->u.media_player_time_changed.new_time, npparam[0]);
- break;
- case libvlc_MediaPlayerPositionChanged:
- DOUBLE_TO_NPVARIANT(event->u.media_player_position_changed.new_position, npparam[0]);
- break;
- case libvlc_MediaPlayerSeekableChanged:
- BOOLEAN_TO_NPVARIANT(event->u.media_player_seekable_changed.new_seekable, npparam[0]);
- break;
- case libvlc_MediaPlayerPausableChanged:
- BOOLEAN_TO_NPVARIANT(event->u.media_player_pausable_changed.new_pausable, npparam[0]);
- break;
- case libvlc_MediaPlayerTitleChanged:
- BOOLEAN_TO_NPVARIANT(event->u.media_player_title_changed.new_title, npparam[0]);
- break;
- case libvlc_MediaPlayerLengthChanged:
- DOUBLE_TO_NPVARIANT(event->u.media_player_length_changed.new_length, npparam[0]);
- break;
- default: /* ignore all other libvlc_event_type_t */
- NPN_MemFree( npparam );
- return;
- }
- plugin->event_callback(event, npparam, npcount, param);
-}
-
-bool EventObj::init()
-{
- plugin_lock_init(&lock);
- return true;
-}
-
-EventObj::~EventObj()
-{
- plugin_lock_destroy(&lock);
-}
-
-void EventObj::deliver(NPP browser)
-{
- plugin_lock(&lock);
-
- for( ev_l::iterator iter = _elist.begin(); iter != _elist.end(); ++iter )
- {
- for( lr_l::iterator j = _llist.begin(); j != _llist.end(); ++j )
- {
- if( j->event_type() == iter->event_type() )
- {
- NPVariant result;
- NPVariant *params = iter->params();
- uint32_t count = iter->count();
-
- NPObject *listener = j->listener();
- assert( listener );
-
- NPN_InvokeDefault( browser, listener, params, count, &result );
- NPN_ReleaseVariantValue( &result );
-
- for( uint32_t n = 0; n < count; n++ )
- {
- if( NPVARIANT_IS_STRING(params[n]) )
- NPN_MemFree( (void*) NPVARIANT_TO_STRING(params[n]).UTF8Characters );
- else if( NPVARIANT_IS_OBJECT(params[n]) )
- {
- NPN_ReleaseObject( NPVARIANT_TO_OBJECT(params[n]) );
- NPN_MemFree( (void*)NPVARIANT_TO_OBJECT(params[n]) );
- }
- }
- if (params) NPN_MemFree( params );
- }
- }
- }
- _elist.clear();
-
- plugin_unlock(&lock);
-}
-
-void EventObj::callback(const libvlc_event_t* event,
- NPVariant *npparams, uint32_t count)
-{
- plugin_lock(&lock);
- _elist.push_back(VLCEvent(event->type, npparams, count));
- plugin_unlock(&lock);
-}
-
-vlcplugin_event_t *EventObj::find_event(const char *s) const
-{
- for( int i = 0; i < ARRAY_SIZE(vlcevents); i++ )
- {
- if( strncmp(vlcevents[i].name, s, strlen(vlcevents[i].name)) == 0 )
- return &vlcevents[i];
- }
- return NULL;
-}
-
-const char *EventObj::find_name(const libvlc_event_t *event)
-{
- for( int i = 0; i < ARRAY_SIZE(vlcevents); i++ )
- {
- if( vlcevents[i].libvlc_type == event->type )
- return vlcevents[i].name;
- }
- return NULL;
-}
-
-bool EventObj::insert(const NPString &name, NPObject *listener, bool bubble)
-{
- vlcplugin_event_t *event = find_event(name.UTF8Characters);
- if( !event )
- return false;
-
- lr_l::iterator iter;
- for( iter = _llist.begin(); iter != _llist.end(); ++iter )
- if( iter->listener() == listener && iter->bubble() == bubble )
- break;
-
- if( iter == _llist.end() )
- {
- _llist.push_back(Listener(event, listener, bubble));
- return true;
- }
-
- return false;
-}
-
-bool EventObj::remove(const NPString &name, NPObject *listener, bool bubble)
-{
- vlcplugin_event_t *event = find_event(name.UTF8Characters);
- if( !event )
- return false;
-
- for( lr_l::iterator iter = _llist.begin(); iter !=_llist.end(); iter++ )
- {
- if( iter->event_type() == event->libvlc_type &&
- iter->listener() == listener &&
- iter->bubble() == bubble )
- {
- iter = _llist.erase(iter);
- return true;
- }
- }
-
- return false;
-}
-
-void EventObj::hook_manager( libvlc_event_manager_t *em, void *userdata )
-{
- _em = em;
-
- if( _em )
- {
- /* attach all libvlc events we care about */
- for( int i = 0; i < ARRAY_SIZE(vlcevents); i++ )
- {
- libvlc_event_attach( _em, vlcevents[i].libvlc_type,
- vlcevents[i].libvlc_callback,
- userdata );
- }
- }
-}
-
-void EventObj::unhook_manager( void *userdata )
-{
- if( _em )
- {
- /* detach all libvlc events we cared about */
- for( int i = 0; i < ARRAY_SIZE(vlcevents); i++ )
- {
- libvlc_event_detach( _em, vlcevents[i].libvlc_type,
- vlcevents[i].libvlc_callback,
- userdata );
- }
- }
-}
-
-/*****************************************************************************
- * VlcPlugin constructor and destructor
- *****************************************************************************/
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
-VlcPlugin::VlcPlugin( NPP instance, uint16 mode ) :
-#else
-VlcPlugin::VlcPlugin( NPP instance, uint16_t mode ) :
-#endif
- i_npmode(mode),
- b_stream(0),
- b_autoplay(1),
- b_toolbar(0),
- psz_text(NULL),
- psz_target(NULL),
- playlist_index(-1),
- libvlc_instance(NULL),
- libvlc_media_list(NULL),
- libvlc_media_player(NULL),
- p_scriptClass(NULL),
- p_browser(instance),
- psz_baseURL(NULL)
-#if defined(XP_WIN)
- ,pf_wndproc(NULL)
-#endif
-#if defined(XP_UNIX)
- ,i_width((unsigned)-1)
- ,i_height((unsigned)-1)
- ,i_tb_width(0)
- ,i_tb_height(0)
- ,i_last_position(0)
- ,p_btnPlay(NULL)
- ,p_btnPause(NULL)
- ,p_btnStop(NULL)
- ,p_btnMute(NULL)
- ,p_btnUnmute(NULL)
- ,p_btnFullscreen(NULL)
- ,p_btnTime(NULL)
- ,p_timeline(NULL)
-#endif
-{
- memset(&npwindow, 0, sizeof(NPWindow));
-#if defined(XP_UNIX)
- memset(&npvideo, 0, sizeof(Window));
- memset(&npcontrol, 0, sizeof(Window));
-#endif
-}
-
-static bool boolValue(const char *value) {
- return ( !strcmp(value, "1") ||
- !strcasecmp(value, "true") ||
- !strcasecmp(value, "yes") );
-}
-
-void VlcPlugin::eventAsync(void *param)
-{
- VlcPlugin *plugin = (VlcPlugin*)param;
- plugin->events.deliver(plugin->getBrowser());
-}
-
-void VlcPlugin::event_callback(const libvlc_event_t* event,
- NPVariant *npparams, uint32_t npcount, void *userdata)
-{
- VlcPlugin *plugin = (VlcPlugin*)userdata;
-#if defined(XP_UNIX)
- plugin->events.callback(event, npparams, npcount);
- NPN_PluginThreadAsyncCall(plugin->getBrowser(), eventAsync, plugin);
-#else
-#warning NPN_PluginThreadAsyncCall not implemented yet.
- printf("No NPN_PluginThreadAsyncCall(), doing nothing.\n");
-#endif
-}
-
-NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
-{
- /* prepare VLC command line */
- const char *ppsz_argv[32];
- int ppsz_argc = 0;
-
-#ifndef NDEBUG
- ppsz_argv[ppsz_argc++] = "--no-plugins-cache";
-#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";
-#elif defined(XP_WIN)
- HKEY h_key;
- DWORD i_type, i_data = MAX_PATH + 1;
- char p_data[MAX_PATH + 1];
- if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\VideoLAN\\VLC",
- 0, KEY_READ, &h_key ) == ERROR_SUCCESS )
- {
- if( RegQueryValueEx( h_key, "InstallDir", 0, &i_type,
- (LPBYTE)p_data, &i_data ) == ERROR_SUCCESS )
- {
- if( i_type == REG_SZ )
- {
- strcat( p_data, "\\plugins" );
- ppsz_argv[ppsz_argc++] = "--plugin-path";
- ppsz_argv[ppsz_argc++] = p_data;
- }
- }
- RegCloseKey( h_key );
- }
- ppsz_argv[ppsz_argc++] = "--no-one-instance";
-
-#endif /* XP_MACOSX */
-
- /* common settings */
- ppsz_argv[ppsz_argc++] = "-vv";
- ppsz_argv[ppsz_argc++] = "--no-stats";
- ppsz_argv[ppsz_argc++] = "--no-media-library";
- ppsz_argv[ppsz_argc++] = "--intf=dummy";
- ppsz_argv[ppsz_argc++] = "--no-video-title-show";
- ppsz_argv[ppsz_argc++] = "--no-xlib";
-
- const char *progid = NULL;
-
- /* parse plugin arguments */
- for( int i = 0; (i < argc) && (ppsz_argc < 32); i++ )
- {
- /* fprintf(stderr, "argn=%s, argv=%s\n", argn[i], argv[i]); */
-
- if( !strcmp( argn[i], "target" )
- || !strcmp( argn[i], "mrl")
- || !strcmp( argn[i], "filename")
- || !strcmp( argn[i], "src") )
- {
- psz_target = argv[i];
- }
- else if( !strcmp( argn[i], "text" ) )
- {
- free( psz_text );
- psz_text = strdup( argv[i] );
- }
- else if( !strcmp( argn[i], "autoplay")
- || !strcmp( argn[i], "autostart") )
- {
- b_autoplay = boolValue(argv[i]);
- }
- else if( !strcmp( argn[i], "fullscreen" ) )
- {
- if( boolValue(argv[i]) )
- {
- ppsz_argv[ppsz_argc++] = "--fullscreen";
- }
- else
- {
- ppsz_argv[ppsz_argc++] = "--no-fullscreen";
- }
- }
- else if( !strcmp( argn[i], "mute" ) )
- {
- if( boolValue(argv[i]) )
- {
- ppsz_argv[ppsz_argc++] = "--volume=0";
- }
- }
- else if( !strcmp( argn[i], "loop")
- || !strcmp( argn[i], "autoloop") )
- {
- if( boolValue(argv[i]) )
- {
- ppsz_argv[ppsz_argc++] = "--loop";
- }
- else
- {
- ppsz_argv[ppsz_argc++] = "--no-loop";
- }
- }
- else if( !strcmp( argn[i], "version")
- || !strcmp( argn[i], "progid") )
- {
- progid = argv[i];
- }
- else if( !strcmp( argn[i], "toolbar" ) )
- {
-/* FIXME: Remove this when toolbar functionality has been implemented on
- * MacOS X and Win32 for Firefox/Mozilla/Safari. */
-#ifdef XP_UNIX
- b_toolbar = boolValue(argv[i]);
-#endif
- }
- }
-
- libvlc_instance = libvlc_new(ppsz_argc, ppsz_argv);
- if( !libvlc_instance )
- return NPERR_GENERIC_ERROR;
- libvlc_media_list = libvlc_media_list_new(libvlc_instance);
-
- /*
- ** fetch plugin base URL, which is the URL of the page containing the plugin
- ** this URL is used for making absolute URL from relative URL that may be
- ** passed as an MRL argument
- */
- NPObject *plugin = NULL;
-
- if( NPERR_NO_ERROR == NPN_GetValue(p_browser, NPNVWindowNPObject, &plugin) )
- {
- /*
- ** is there a better way to get that info ?
- */
- static const char docLocHref[] = "document.location.href";
- NPString script;
- NPVariant result;
-
- script.UTF8Characters = docLocHref;
- script.UTF8Length = sizeof(docLocHref)-1;
-
- if( NPN_Evaluate(p_browser, plugin, &script, &result) )
- {
- if( NPVARIANT_IS_STRING(result) )
- {
- NPString &location = NPVARIANT_TO_STRING(result);
-
- psz_baseURL = (char *) malloc(location.UTF8Length+1);
- if( psz_baseURL )
- {
- strncpy(psz_baseURL, location.UTF8Characters, location.UTF8Length);
- psz_baseURL[location.UTF8Length] = '\0';
- }
- }
- NPN_ReleaseVariantValue(&result);
- }
- NPN_ReleaseObject(plugin);
- }
-
- if( psz_target )
- {
- // get absolute URL from src
- char *psz_absurl = getAbsoluteURL(psz_target);
- psz_target = psz_absurl ? psz_absurl : strdup(psz_target);
- }
-
- /* assign plugin script root class */
- /* new APIs */
- p_scriptClass = RuntimeNPClass<LibvlcRootNPObject>::getClass();
-
- if( !events.init() )
- return NPERR_GENERIC_ERROR;
-
- return NPERR_NO_ERROR;
-}
-
-VlcPlugin::~VlcPlugin()
-{
- free(psz_baseURL);
- free(psz_target);
- free(psz_text);
-
- if( libvlc_media_player )
- {
- if( playlist_isplaying() )
- playlist_stop();
- events.unhook_manager( this );
- libvlc_media_player_release( libvlc_media_player );
- }
- if( libvlc_media_list )
- libvlc_media_list_release( libvlc_media_list );
- if( libvlc_instance )
- libvlc_release( libvlc_instance );
-}
-
-/*****************************************************************************
- * VlcPlugin playlist replacement methods
- *****************************************************************************/
-void VlcPlugin::set_player_window()
-{
-#ifdef XP_UNIX
- libvlc_media_player_set_xwindow(libvlc_media_player,
- (uint32_t)getVideoWindow());
-#endif
-#ifdef XP_MACOSX
- // XXX FIXME insert appropriate call here
-#endif
-#ifdef XP_WIN
- libvlc_media_player_set_hwnd(libvlc_media_player,
- getWindow().window);
-#endif
-}
-
-int VlcPlugin::playlist_add( const char *mrl )
-{
- int item = -1;
- libvlc_media_t *p_m = libvlc_media_new_location(libvlc_instance,mrl);
- if( !p_m )
- return -1;
- assert( libvlc_media_list );
- libvlc_media_list_lock(libvlc_media_list);
- if( !libvlc_media_list_add_media(libvlc_media_list,p_m) )
- item = libvlc_media_list_count(libvlc_media_list)-1;
- libvlc_media_list_unlock(libvlc_media_list);
-
- libvlc_media_release(p_m);
-
- return item;
-}
-
-int VlcPlugin::playlist_add_extended_untrusted( const char *mrl, const char *name,
- int optc, const char **optv )
-{
- libvlc_media_t *p_m;
- int item = -1;
-
- assert( libvlc_media_list );
-
- p_m = libvlc_media_new_location(libvlc_instance, mrl);
- if( !p_m )
- return -1;
-
- for( int i = 0; i < optc; ++i )
- libvlc_media_add_option_flag(p_m, optv[i], libvlc_media_option_unique);
-
- libvlc_media_list_lock(libvlc_media_list);
- if( !libvlc_media_list_add_media(libvlc_media_list,p_m) )
- item = libvlc_media_list_count(libvlc_media_list)-1;
- libvlc_media_list_unlock(libvlc_media_list);
- libvlc_media_release(p_m);
-
- return item;
-}
-
-bool VlcPlugin::playlist_select( int idx )
-{
- libvlc_media_t *p_m = NULL;
-
- assert( libvlc_media_list );
-
- libvlc_media_list_lock(libvlc_media_list);
-
- int count = libvlc_media_list_count(libvlc_media_list);
- if( idx<0||idx>=count )
- goto bad_unlock;
-
- playlist_index = idx;
-
- p_m = libvlc_media_list_item_at_index(libvlc_media_list,playlist_index);
- libvlc_media_list_unlock(libvlc_media_list);
-
- if( !p_m )
- return false;
-
- if( libvlc_media_player )
- {
- if( playlist_isplaying() )
- playlist_stop();
- events.unhook_manager( this );
- libvlc_media_player_release( libvlc_media_player );
- libvlc_media_player = NULL;
- }
-
- libvlc_media_player = libvlc_media_player_new_from_media( p_m );
- if( libvlc_media_player )
- {
- set_player_window();
-
- libvlc_event_manager_t *p_em;
- p_em = libvlc_media_player_event_manager( libvlc_media_player );
- events.hook_manager( p_em, this );
- }
-
- libvlc_media_release( p_m );
- return true;
-
-bad_unlock:
- libvlc_media_list_unlock( libvlc_media_list );
- return false;
-}
-
-int VlcPlugin::playlist_delete_item( int idx )
-{
- if( !libvlc_media_list )
- return -1;
- libvlc_media_list_lock(libvlc_media_list);
- int ret = libvlc_media_list_remove_index(libvlc_media_list,idx);
- libvlc_media_list_unlock(libvlc_media_list);
- return ret;
-}
-
-void VlcPlugin::playlist_clear()
-{
- if( libvlc_media_list )
- libvlc_media_list_release(libvlc_media_list);
- libvlc_media_list = libvlc_media_list_new(getVLC());
-}
-
-int VlcPlugin::playlist_count()
-{
- int items_count = 0;
- if( !libvlc_media_list )
- return items_count;
- libvlc_media_list_lock(libvlc_media_list);
- items_count = libvlc_media_list_count(libvlc_media_list);
- libvlc_media_list_unlock(libvlc_media_list);
- return items_count;
-}
-
-void VlcPlugin::toggle_fullscreen()
-{
- if( playlist_isplaying() )
- libvlc_toggle_fullscreen(libvlc_media_player);
-}
-
-void VlcPlugin::set_fullscreen( int yes )
-{
- if( playlist_isplaying() )
- libvlc_set_fullscreen(libvlc_media_player,yes);
-}
-
-int VlcPlugin::get_fullscreen()
-{
- int r = 0;
- if( playlist_isplaying() )
- r = libvlc_get_fullscreen(libvlc_media_player);
- return r;
-}
-
-bool VlcPlugin::player_has_vout()
-{
- bool r = false;
- if( playlist_isplaying() )
- r = libvlc_media_player_has_vout(libvlc_media_player);
- return r;
-}
-
-/*****************************************************************************
- * VlcPlugin methods
- *****************************************************************************/
-
-char *VlcPlugin::getAbsoluteURL(const char *url)
-{
- if( NULL != url )
- {
- // check whether URL is already absolute
- const char *end=strchr(url, ':');
- if( (NULL != end) && (end != url) )
- {
- // validate protocol header
- const char *start = url;
- char c = *start;
- if( isalpha(c) )
- {
- ++start;
- while( start != end )
- {
- c = *start;
- if( ! (isalnum(c)
- || ('-' == c)
- || ('+' == c)
- || ('.' == c)
- || ('/' == c)) ) /* VLC uses / to allow user to specify a demuxer */
- // not valid protocol header, assume relative URL
- goto relativeurl;
- ++start;
- }
- /* we have a protocol header, therefore URL is absolute */
- return strdup(url);
- }
- // not a valid protocol header, assume relative URL
- }
-
-relativeurl:
-
- if( psz_baseURL )
- {
- size_t baseLen = strlen(psz_baseURL);
- char *href = (char *) malloc(baseLen+strlen(url)+1);
- if( href )
- {
- /* prepend base URL */
- memcpy(href, psz_baseURL, baseLen+1);
-
- /*
- ** relative url could be empty,
- ** in which case return base URL
- */
- if( '\0' == *url )
- return href;
-
- /*
- ** locate pathname part of base URL
- */
-
- /* skip over protocol part */
- char *pathstart = strchr(href, ':');
- char *pathend = href+baseLen;
- if( pathstart )
- {
- if( '/' == *(++pathstart) )
- {
- if( '/' == *(++pathstart) )
- {
- ++pathstart;
- }
- }
- /* skip over host part */
- pathstart = strchr(pathstart, '/');
- if( ! pathstart )
- {
- // no path, add a / past end of url (over '\0')
- pathstart = pathend;
- *pathstart = '/';
- }
- }
- else
- {
- /* baseURL is just a UNIX path */
- if( '/' != *href )
- {
- /* baseURL is not an absolute path */
- free(href);
- return NULL;
- }
- pathstart = href;
- }
-
- /* relative URL made of an absolute path ? */
- if( '/' == *url )
- {
- /* replace path completely */
- strcpy(pathstart, url);
- return href;
- }
-
- /* find last path component and replace it */
- while( '/' != *pathend)
- --pathend;
-
- /*
- ** if relative url path starts with one or more '../',
- ** factor them out of href so that we return a
- ** normalized URL
- */
- while( pathend != pathstart )
- {
- const char *p = url;
- if( '.' != *p )
- break;
- ++p;
- if( '\0' == *p )
- {
- /* relative url is just '.' */
- url = p;
- break;
- }
- if( '/' == *p )
- {
- /* relative url starts with './' */
- url = ++p;
- continue;
- }
- if( '.' != *p )
- break;
- ++p;
- if( '\0' == *p )
- {
- /* relative url is '..' */
- }
- else
- {
- if( '/' != *p )
- break;
- /* relative url starts with '../' */
- ++p;
- }
- url = p;
- do
- {
- --pathend;
- }
- while( '/' != *pathend );
- }
- /* skip over '/' separator */
- ++pathend;
- /* concatenate remaining base URL and relative URL */
- strcpy(pathend, url);
- }
- return href;
- }
- }
- return NULL;
-}
-
-#if defined(XP_UNIX)
-int VlcPlugin::setSize(unsigned width, unsigned height)
-{
- int diff = (width != i_width) || (height != i_height);
-
- i_width = width;
- i_height = height;
-
- /* return size */
- return diff;
-}
-
-#define BTN_SPACE ((unsigned int)4)
-void VlcPlugin::showToolbar()
-{
- const NPWindow& window = getWindow();
- Window control = getControlWindow();
- Window video = getVideoWindow();
- Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
- unsigned int i_height = 0, i_width = BTN_SPACE;
-
- /* load icons */
- if( !p_btnPlay )
- XpmReadFileToImage( p_display, DATA_PATH "/mozilla/play.xpm",
- &p_btnPlay, NULL, NULL);
- if( p_btnPlay )
- {
- i_height = __MAX( i_height, p_btnPlay->height );
- }
- if( !p_btnPause )
- XpmReadFileToImage( p_display, DATA_PATH "/mozilla/pause.xpm",
- &p_btnPause, NULL, NULL);
- if( p_btnPause )
- {
- i_height = __MAX( i_height, p_btnPause->height );
- }
- i_width += __MAX( p_btnPause->width, p_btnPlay->width );
-
- if( !p_btnStop )
- XpmReadFileToImage( p_display, DATA_PATH "/mozilla/stop.xpm",
- &p_btnStop, NULL, NULL );
- if( p_btnStop )
- {
- i_height = __MAX( i_height, p_btnStop->height );
- i_width += BTN_SPACE + p_btnStop->width;
- }
- if( !p_timeline )
- XpmReadFileToImage( p_display, DATA_PATH "/mozilla/time_line.xpm",
- &p_timeline, NULL, NULL);
- if( p_timeline )
- {
- i_height = __MAX( i_height, p_timeline->height );
- i_width += BTN_SPACE + p_timeline->width;
- }
- if( !p_btnTime )
- XpmReadFileToImage( p_display, DATA_PATH "/mozilla/time_icon.xpm",
- &p_btnTime, NULL, NULL);
- if( p_btnTime )
- {
- i_height = __MAX( i_height, p_btnTime->height );
- i_width += BTN_SPACE + p_btnTime->width;
- }
- if( !p_btnFullscreen )
- XpmReadFileToImage( p_display, DATA_PATH "/mozilla/fullscreen.xpm",
- &p_btnFullscreen, NULL, NULL);
- if( p_btnFullscreen )
- {
- i_height = __MAX( i_height, p_btnFullscreen->height );
- i_width += BTN_SPACE + p_btnFullscreen->width;
- }
- if( !p_btnMute )
- XpmReadFileToImage( p_display, DATA_PATH "/mozilla/volume_max.xpm",
- &p_btnMute, NULL, NULL);
- if( p_btnMute )
- {
- i_height = __MAX( i_height, p_btnMute->height );
- }
- if( !p_btnUnmute )
- XpmReadFileToImage( p_display, DATA_PATH "/mozilla/volume_mute.xpm",
- &p_btnUnmute, NULL, NULL);
- if( p_btnUnmute )
- {
- i_height = __MAX( i_height, p_btnUnmute->height );
- }
- i_width += BTN_SPACE + __MAX( p_btnUnmute->width, p_btnMute->width );
-
- setToolbarSize( i_width, i_height );
-
- if( !p_btnPlay || !p_btnPause || !p_btnStop || !p_timeline ||
- !p_btnTime || !p_btnFullscreen || !p_btnMute || !p_btnUnmute )
- fprintf(stderr, "Error: some button images not found in %s\n", DATA_PATH );
-
- /* reset panels position and size */
- /* XXX use i_width */
- XResizeWindow( p_display, video, window.width, window.height - i_height);
- XMoveWindow( p_display, control, 0, window.height - i_height );
- XResizeWindow( p_display, control, window.width, i_height -1);
-
- b_toolbar = 1; /* says toolbar is now shown */
- redrawToolbar();
-}
-
-void VlcPlugin::hideToolbar()
-{
- const NPWindow& window = getWindow();
- Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
- Window control = getControlWindow();
- Window video = getVideoWindow();
-
- i_tb_width = i_tb_height = 0;
-
- if( p_btnPlay ) XDestroyImage( p_btnPlay );
- if( p_btnPause ) XDestroyImage( p_btnPause );
- if( p_btnStop ) XDestroyImage( p_btnStop );
- if( p_timeline ) XDestroyImage( p_timeline );
- if( p_btnTime ) XDestroyImage( p_btnTime );
- if( p_btnFullscreen ) XDestroyImage( p_btnFullscreen );
- if( p_btnMute ) XDestroyImage( p_btnMute );
- if( p_btnUnmute ) XDestroyImage( p_btnUnmute );
-
- p_btnPlay = NULL;
- p_btnPause = NULL;
- p_btnStop = NULL;
- p_timeline = NULL;
- p_btnTime = NULL;
- p_btnFullscreen = NULL;
- p_btnMute = NULL;
- p_btnUnmute = NULL;
-
- /* reset panels position and size */
- /* XXX use i_width */
- XResizeWindow( p_display, video, window.width, window.height );
- XMoveWindow( p_display, control, 0, window.height-1 );
- XResizeWindow( p_display, control, window.width, 1 );
-
- b_toolbar = 0; /* says toolbar is now hidden */
- redrawToolbar();
-}
-
-void VlcPlugin::redrawToolbar()
-{
- int is_playing = 0;
- bool b_mute = false;
- unsigned int dst_x, dst_y;
- GC gc;
- XGCValues gcv;
- unsigned int i_tb_width, i_tb_height;
-
- /* This method does nothing if toolbar is hidden. */
- if( !b_toolbar || !libvlc_media_player )
- return;
-
- const NPWindow& window = getWindow();
- Window control = getControlWindow();
- Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
-
- getToolbarSize( &i_tb_width, &i_tb_height );
-
- /* get mute info */
- b_mute = libvlc_audio_get_mute( libvlc_media_player );
-
- gcv.foreground = BlackPixel( p_display, 0 );
- gc = XCreateGC( p_display, control, GCForeground, &gcv );
-
- XFillRectangle( p_display, control, gc,
- 0, 0, window.width, i_tb_height );
- gcv.foreground = WhitePixel( p_display, 0 );
- XChangeGC( p_display, gc, GCForeground, &gcv );
-
- /* position icons */
- dst_x = BTN_SPACE;
- dst_y = i_tb_height >> 1; /* baseline = vertical middle */
-
- if( p_btnPause && (is_playing == 1) )
- {
- XPutImage( p_display, control, gc, p_btnPause, 0, 0, dst_x,
- dst_y - (p_btnPause->height >> 1),
- p_btnPause->width, p_btnPause->height );
- dst_x += BTN_SPACE + p_btnPause->width;
- }
- else if( p_btnPlay )
- {
- XPutImage( p_display, control, gc, p_btnPlay, 0, 0, dst_x,
- dst_y - (p_btnPlay->height >> 1),
- p_btnPlay->width, p_btnPlay->height );
- dst_x += BTN_SPACE + p_btnPlay->width;
- }
-
- if( p_btnStop )
- XPutImage( p_display, control, gc, p_btnStop, 0, 0, dst_x,
- dst_y - (p_btnStop->height >> 1),
- p_btnStop->width, p_btnStop->height );
-
- dst_x += BTN_SPACE + ( p_btnStop ? p_btnStop->width : 0 );
-
- if( p_btnFullscreen )
- XPutImage( p_display, control, gc, p_btnFullscreen, 0, 0, dst_x,
- dst_y - (p_btnFullscreen->height >> 1),
- p_btnFullscreen->width, p_btnFullscreen->height );
-
- dst_x += BTN_SPACE + ( p_btnFullscreen ? p_btnFullscreen->width : 0 );
-
- if( p_btnUnmute && b_mute )
- {
- XPutImage( p_display, control, gc, p_btnUnmute, 0, 0, dst_x,
- dst_y - (p_btnUnmute->height >> 1),
- p_btnUnmute->width, p_btnUnmute->height );
-
- dst_x += BTN_SPACE + ( p_btnUnmute ? p_btnUnmute->width : 0 );
- }
- else if( p_btnMute )
- {
- XPutImage( p_display, control, gc, p_btnMute, 0, 0, dst_x,
- dst_y - (p_btnMute->height >> 1),
- p_btnMute->width, p_btnMute->height );
-
- dst_x += BTN_SPACE + ( p_btnMute ? p_btnMute->width : 0 );
- }
-
- if( p_timeline )
- XPutImage( p_display, control, gc, p_timeline, 0, 0, dst_x,
- dst_y - (p_timeline->height >> 1),
- (window.width-(dst_x+BTN_SPACE)), p_timeline->height );
-
- /* get movie position in % */
- if( playlist_isplaying() )
- {
- i_last_position = (int)((window.width-(dst_x+BTN_SPACE))*
- libvlc_media_player_get_position(libvlc_media_player));
- }
-
- if( p_btnTime )
- XPutImage( p_display, control, gc, p_btnTime,
- 0, 0, (dst_x+i_last_position),
- dst_y - (p_btnTime->height >> 1),
- p_btnTime->width, p_btnTime->height );
-
- XFreeGC( p_display, gc );
-}
-
-vlc_toolbar_clicked_t VlcPlugin::getToolbarButtonClicked( int i_xpos, int i_ypos )
-{
- unsigned int i_dest = BTN_SPACE;
- int is_playing = 0;
- bool b_mute = false;
-
-#ifndef NDEBUG
- fprintf( stderr, "ToolbarButtonClicked:: "
- "trying to match (%d,%d) (%d,%d)\n",
- i_xpos, i_ypos, i_tb_height, i_tb_width );
-#endif
- if( i_ypos >= i_tb_width )
- return clicked_Unknown;
-
- /* Note: the order of testing is dependend on the original
- * drawing positions of the icon buttons. Buttons are tested
- * left to right.
- */
-
- /* get isplaying */
- is_playing = playlist_isplaying();
-
- /* get mute info */
- if( libvlc_media_player )
- b_mute = libvlc_audio_get_mute( libvlc_media_player );
-
- /* is Pause of Play button clicked */
- if( (is_playing != 1) &&
- (i_xpos >= (BTN_SPACE>>1)) &&
- (i_xpos <= i_dest + p_btnPlay->width + (BTN_SPACE>>1)) )
- return clicked_Play;
- else if( (i_xpos >= (BTN_SPACE>>1)) &&
- (i_xpos <= i_dest + p_btnPause->width) )
- return clicked_Pause;
-
- /* is Stop button clicked */
- if( is_playing != 1 )
- i_dest += (p_btnPlay->width + (BTN_SPACE>>1));
- else
- i_dest += (p_btnPause->width + (BTN_SPACE>>1));
-
- if( (i_xpos >= i_dest) &&
- (i_xpos <= i_dest + p_btnStop->width + (BTN_SPACE>>1)) )
- return clicked_Stop;
-
- /* is Fullscreen button clicked */
- i_dest += (p_btnStop->width + (BTN_SPACE>>1));
- if( (i_xpos >= i_dest) &&
- (i_xpos <= i_dest + p_btnFullscreen->width + (BTN_SPACE>>1)) )
- return clicked_Fullscreen;
-
- /* is Mute or Unmute button clicked */
- i_dest += (p_btnFullscreen->width + (BTN_SPACE>>1));
- if( !b_mute && (i_xpos >= i_dest) &&
- (i_xpos <= i_dest + p_btnMute->width + (BTN_SPACE>>1)) )
- return clicked_Mute;
- else if( (i_xpos >= i_dest) &&
- (i_xpos <= i_dest + p_btnUnmute->width + (BTN_SPACE>>1)) )
- return clicked_Unmute;
-
- /* is timeline clicked */
- if( !b_mute )
- i_dest += (p_btnMute->width + (BTN_SPACE>>1));
- else
- i_dest += (p_btnUnmute->width + (BTN_SPACE>>1));
- if( (i_xpos >= i_dest) &&
- (i_xpos <= i_dest + p_timeline->width + (BTN_SPACE>>1)) )
- return clicked_timeline;
-
- /* is time button clicked */
- i_dest += (p_timeline->width + (BTN_SPACE>>1));
- if( (i_xpos >= i_dest) &&
- (i_xpos <= i_dest + p_btnTime->width + (BTN_SPACE>>1)) )
- return clicked_Time;
-
- return clicked_Unknown;
-}
-#undef BTN_SPACE
-#endif
-
-// Verifies the version of the NPAPI.
-// The eventListeners use a NPAPI function available
-// since Gecko 1.9.
-bool VlcPlugin::canUseEventListener()
-{
- int plugin_major, plugin_minor;
- int browser_major, browser_minor;
-
- NPN_Version(&plugin_major, &plugin_minor,
- &browser_major, &browser_minor);
-
- if (browser_minor >= 19 || browser_major > 0)
- return true;
- return false;
-}
+++ /dev/null
-/*****************************************************************************
- * vlcplugin.h: a VLC plugin for Mozilla
- *****************************************************************************
- * Copyright (C) 2002-2009 the VideoLAN team
- * $Id$
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- * Damien Fouilleul <damienf@videolan.org>
- * Jean-Paul Saman <jpsaman@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*******************************************************************************
- * Instance state information about the plugin.
- ******************************************************************************/
-#ifndef __VLCPLUGIN_H__
-#define __VLCPLUGIN_H__
-
-#include <vlc/vlc.h>
-
-// Setup XP_MACOSX, XP_UNIX, XP_WIN
-#if defined(_WIN32)
-#define XP_WIN 1
-#elif defined(__APPLE__)
-#define XP_MACOSX 1
-#else
-#define XP_UNIX 1
-#define MOZ_X11 1
-#endif
-
-#if !defined(XP_MACOSX) && !defined(XP_UNIX) && !defined(XP_WIN)
-#define XP_UNIX 1
-#elif defined(XP_MACOSX)
-#undef XP_UNIX
-#endif
-
-#ifdef XP_WIN
- /* Windows stuff */
-# include <windows.h>
-# include <winbase.h>
-#endif
-
-#ifdef XP_MACOSX
- /* Mac OS X stuff */
-# include <Quickdraw.h>
-#endif
-
-#ifdef XP_UNIX
-# include <pthread.h>
- /* X11 stuff */
-# include <X11/Xlib.h>
-# include <X11/Intrinsic.h>
-# include <X11/StringDefs.h>
-# include <X11/X.h>
-
-# ifndef __APPLE__
-# include <X11/xpm.h>
-# endif
-#endif
-
-#ifndef __MAX
-# define __MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
-#endif
-#ifndef __MIN
-# define __MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
-#endif
-
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
-#include <npapi.h>
-#include <vector>
-#include <assert.h>
-
-#include "control/nporuntime.h"
-
-typedef struct {
-#if defined(XP_UNIX)
- pthread_mutex_t mutex;
-#elif defined(XP_WIN)
- CRITICAL_SECTION cs;
-#else
-#warning "locking not implemented in this platform"
-#endif
-} plugin_lock_t;
-
-typedef enum vlc_toolbar_clicked_e {
- clicked_Unknown = 0,
- clicked_Play,
- clicked_Pause,
- clicked_Stop,
- clicked_timeline,
- clicked_Time,
- clicked_Fullscreen,
- clicked_Mute,
- clicked_Unmute
-} vlc_toolbar_clicked_t;
-
-typedef struct {
- const char *name; /* event name */
- const libvlc_event_type_t libvlc_type; /* libvlc event type */
- libvlc_callback_t libvlc_callback; /* libvlc callback function */
-} vlcplugin_event_t;
-
-class EventObj
-{
-private:
-
- class Listener
- {
- public:
- Listener(vlcplugin_event_t *event, NPObject *p_object, bool b_bubble):
- _event(event), _listener(p_object), _bubble(b_bubble)
- {
- assert(event);
- assert(p_object);
- }
- Listener(): _event(NULL), _listener(NULL), _bubble(false) { }
- ~Listener()
- {
- }
- const libvlc_event_type_t event_type() const { return _event->libvlc_type; }
- NPObject *listener() const { return _listener; }
- bool bubble() const { return _bubble; }
- private:
- vlcplugin_event_t *_event;
- NPObject *_listener;
- bool _bubble;
- };
-
- class VLCEvent
- {
- public:
- VLCEvent(libvlc_event_type_t libvlc_event_type, NPVariant *npparams, uint32_t npcount):
- _libvlc_event_type(libvlc_event_type), _npparams(npparams), _npcount(npcount)
- {
- }
- VLCEvent(): _libvlc_event_type(0), _npparams(NULL), _npcount(0) { }
- ~VLCEvent()
- {
- }
- const libvlc_event_type_t event_type() { return _libvlc_event_type; }
- NPVariant *params() const { return _npparams; }
- const uint32_t count() { return _npcount; }
- private:
- libvlc_event_type_t _libvlc_event_type;
- NPVariant *_npparams;
- uint32_t _npcount;
- };
- libvlc_event_manager_t *_em; /* libvlc media_player event manager */
-public:
- EventObj(): _em(NULL) { /* deferred to init() */ }
- bool init();
- ~EventObj();
-
- void deliver(NPP browser);
- void callback(const libvlc_event_t *event, NPVariant *npparams, uint32_t count);
- bool insert(const NPString &name, NPObject *listener, bool bubble);
- bool remove(const NPString &name, NPObject *listener, bool bubble);
- void unhook_manager(void *);
- void hook_manager(libvlc_event_manager_t *, void *);
-private:
- vlcplugin_event_t *find_event(const char *s) const;
- const char *find_name(const libvlc_event_t *event);
- typedef std::vector<Listener> lr_l;
- typedef std::vector<VLCEvent> ev_l;
- lr_l _llist; /* list of registered listeners with 'addEventListener' method */
- ev_l _elist; /* scheduled events list for delivery to browser */
-
- plugin_lock_t lock;
-};
-
-class VlcPlugin
-{
-public:
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- VlcPlugin( NPP, uint16 );
-#else
- VlcPlugin( NPP, uint16_t );
-#endif
- virtual ~VlcPlugin();
-
- NPError init(int argc, char* const argn[], char* const argv[]);
- libvlc_instance_t* getVLC()
- { return libvlc_instance; };
- libvlc_media_player_t* getMD()
- {
- if( !libvlc_media_player )
- {
- libvlc_printerr("no mediaplayer");
- }
- return libvlc_media_player;
- }
- NPP getBrowser()
- { return p_browser; };
- char* getAbsoluteURL(const char *url);
- NPWindow& getWindow()
- { return npwindow; };
- void setWindow(const NPWindow &window)
- { npwindow = window; };
-
- NPClass* getScriptClass()
- { return p_scriptClass; };
-
-#if defined(XP_WIN)
- WNDPROC getWindowProc()
- { return pf_wndproc; };
- void setWindowProc(WNDPROC wndproc)
- { pf_wndproc = wndproc; };
-#endif
-
-#if defined(XP_UNIX)
- int setSize(unsigned width, unsigned height);
- Window getVideoWindow()
- { return npvideo; };
- void setVideoWindow(Window window)
- { npvideo = window; };
- Window getControlWindow()
- { return npcontrol; };
- void setControlWindow(Window window)
- { npcontrol = window; };
-
- void showToolbar();
- void hideToolbar();
- void redrawToolbar();
- void getToolbarSize(unsigned int *width, unsigned int *height)
- { *width = i_tb_width; *height = i_tb_height; };
- int setToolbarSize(unsigned int width, unsigned int height)
- { i_tb_width = width; i_tb_height = height; return 1; };
- vlc_toolbar_clicked_t getToolbarButtonClicked( int i_xpos, int i_ypos );
-#endif
-
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
- uint16 i_npmode; /* either NP_EMBED or NP_FULL */
-#else
- uint16_t i_npmode; /* either NP_EMBED or NP_FULL */
-#endif
-
- /* plugin properties */
- int b_stream;
- int b_autoplay;
- int b_toolbar;
- char * psz_text;
- char * psz_target;
-
- void playlist_play()
- {
- if( playlist_isplaying() )
- playlist_stop();
- if( libvlc_media_player||playlist_select(0) )
- libvlc_media_player_play(libvlc_media_player);
- }
- void playlist_play_item(int idx)
- {
- if( playlist_select(idx) )
- libvlc_media_player_play(libvlc_media_player);
- }
- void playlist_stop()
- {
- if( libvlc_media_player )
- libvlc_media_player_stop(libvlc_media_player);
- }
- void playlist_next()
- {
- if( playlist_select(playlist_index+1) )
- libvlc_media_player_play(libvlc_media_player);
- }
- void playlist_prev()
- {
- if( playlist_select(playlist_index-1) )
- libvlc_media_player_play(libvlc_media_player);
- }
- void playlist_pause()
- {
- if( libvlc_media_player )
- libvlc_media_player_pause(libvlc_media_player);
- }
- int playlist_isplaying()
- {
- int is_playing = 0;
- if( libvlc_media_player )
- is_playing = libvlc_media_player_is_playing(
- libvlc_media_player );
- return is_playing;
- }
-
- int playlist_add( const char * );
- int playlist_add_extended_untrusted( const char *, const char *, int,
- const char ** );
- int playlist_delete_item( int );
- void playlist_clear();
- int playlist_count();
-
- void toggle_fullscreen();
- void set_fullscreen( int );
- int get_fullscreen();
-
- bool player_has_vout();
-
-
- static bool canUseEventListener();
-
- EventObj events;
- static void event_callback(const libvlc_event_t *, NPVariant *, uint32_t, void *);
-private:
- bool playlist_select(int);
- void set_player_window();
-
- /* VLC reference */
- int playlist_index;
- libvlc_instance_t *libvlc_instance;
- libvlc_media_list_t *libvlc_media_list;
- libvlc_media_player_t *libvlc_media_player;
- NPClass *p_scriptClass;
-
- /* browser reference */
- NPP p_browser;
- char* psz_baseURL;
-
- /* display settings */
- NPWindow npwindow;
-#if defined(XP_WIN)
- WNDPROC pf_wndproc;
-#endif
-#if defined(XP_UNIX)
- unsigned int i_width, i_height;
- unsigned int i_tb_width, i_tb_height;
- Window npvideo, npcontrol;
-
- XImage *p_btnPlay;
- XImage *p_btnPause;
- XImage *p_btnStop;
- XImage *p_timeline;
- XImage *p_btnTime;
- XImage *p_btnFullscreen;
- XImage *p_btnMute;
- XImage *p_btnUnmute;
-
- int i_last_position;
-#endif
-
- static void eventAsync(void *);
-};
-
-/*******************************************************************************
- * Plugin properties.
- ******************************************************************************/
-#define PLUGIN_NAME "VLC Web Plugin"
-#define PLUGIN_DESCRIPTION \
- "Version %s, copyright 1996-2010 VideoLAN and Authors" \
- "<br><a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>"
-
-#define PLUGIN_MIMETYPES \
- /* MPEG-1 and MPEG-2 */ \
- "audio/mpeg:mp2,mp3,mpga,mpega:MPEG audio;" \
- "audio/x-mpeg:mp2,mp3,mpga,mpega:MPEG audio;" \
- "video/mpeg:mpg,mpeg,mpe:MPEG video;" \
- "video/x-mpeg:mpg,mpeg,mpe:MPEG video;" \
- "video/mpeg-system:mpg,mpeg,mpe,vob:MPEG video;" \
- "video/x-mpeg-system:mpg,mpeg,mpe,vob:MPEG video;" \
- /* M3U */ \
- "audio/x-mpegurl:m3u:MPEG audio;" \
- /* MPEG-4 */ \
- "video/mp4:mp4,mpg4:MPEG-4 video;" \
- "audio/mp4:mp4,mpg4:MPEG-4 audio;" \
- "audio/x-m4a:m4a:MPEG-4 audio;" \
- "application/mpeg4-iod:mp4,mpg4:MPEG-4 video;" \
- "application/mpeg4-muxcodetable:mp4,mpg4:MPEG-4 video;" \
- /* AVI */ \
- "video/x-msvideo:avi:AVI video;" \
- /* QuickTime */ \
- "video/quicktime:mov,qt:QuickTime video;" \
- /* OGG */ \
- "application/x-ogg:ogg:Ogg stream;" \
- "application/ogg:ogg:Ogg stream;" \
- /* VLC */ \
- "application/x-vlc-plugin:vlc:VLC plug-in;" \
- /* Windows Media */ \
- "video/x-ms-asf-plugin:asf,asx:Windows Media Video;" \
- "video/x-ms-asf:asf,asx:Windows Media Video;" \
- "application/x-mplayer2::Windows Media;" \
- "video/x-ms-wmv:wmv:Windows Media;" \
- "video/x-ms-wvx:wvx:Windows Media Video;" \
- "audio/x-ms-wma:wma:Windows Media Audio;" \
- /* Google VLC */ \
- "application/x-google-vlc-plugin::Google VLC plug-in;" \
- /* WAV audio */ \
- "audio/wav:wav:WAV audio;" \
- "audio/x-wav:wav:WAV audio;" \
- /* 3GPP */ \
- "audio/3gpp:3gp,3gpp:3GPP audio;" \
- "video/3gpp:3gp,3gpp:3GPP video;" \
- /* 3GPP2 */ \
- "audio/3gpp2:3g2,3gpp2:3GPP2 audio;" \
- "video/3gpp2:3g2,3gpp2:3GPP2 video;" \
- /* DIVX */ \
- "video/divx:divx:DivX video;" \
- /* FLV */ \
- "video/flv:flv:FLV video;" \
- "video/x-flv:flv:FLV video;" \
- /* Matroska */ \
- "video/x-matroska:mkv:Matroska video;" \
- "audio/x-matroska:mka:Matroska audio;" \
- /* XSPF */ \
- "application/xspf+xml:xspf:Playlist xspf;" \
- /* Webm */ \
- "video/webm:webm:WebM video;" \
- "audio/webm:webm:WebM audio;" \
- /* Real Media */ \
- "application/vnd.rn-realmedia:rm:Real Media File;" \
- "audio/x-realaudio:ra:Real Media Audio;"
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * vlcshell.cpp: a VLC plugin for Mozilla
- *****************************************************************************
- * Copyright (C) 2002-2009 the VideoLAN team
- * $Id$
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- * Jean-Paul Saman <jpsaman@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "config.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "vlcplugin.h"
-#include "vlcshell.h"
-
-/* Enable/disable debugging printf's for X11 resizing */
-#undef X11_RESIZE_DEBUG
-
-/*****************************************************************************
- * Unix-only declarations
-******************************************************************************/
-#if defined(XP_UNIX)
-
-static void Redraw( Widget w, XtPointer closure, XEvent *event );
-static void ControlHandler( Widget w, XtPointer closure, XEvent *event );
-static void Resize( Widget w, XtPointer closure, XEvent *event );
-
-#endif
-
-/*****************************************************************************
- * MacOS-only declarations
-******************************************************************************/
-#ifdef XP_MACOSX
-#endif
-
-/*****************************************************************************
- * Windows-only declarations
- *****************************************************************************/
-#ifdef XP_WIN
-
-static LRESULT CALLBACK Manage( HWND p_hwnd, UINT i_msg, WPARAM wpar, LPARAM lpar );
-
-#endif
-
-/******************************************************************************
- * UNIX-only API calls
- *****************************************************************************/
-char * NPP_GetMIMEDescription( void )
-{
- static char mimetype[] = PLUGIN_MIMETYPES;
- return mimetype;
-}
-
-NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
-{
- static char psz_name[] = PLUGIN_NAME;
- static char psz_desc[1000];
-
- /* plugin class variables */
- switch( variable )
- {
- case NPPVpluginNameString:
- *((char **)value) = psz_name;
- return NPERR_NO_ERROR;
-
- case NPPVpluginDescriptionString:
- snprintf( psz_desc, sizeof(psz_desc), PLUGIN_DESCRIPTION,
- libvlc_get_version() );
- *((char **)value) = psz_desc;
- return NPERR_NO_ERROR;
-
- default:
- /* move on to instance variables ... */
- ;
- }
-
- if( instance == NULL )
- {
- return NPERR_INVALID_INSTANCE_ERROR;
- }
-
- /* plugin instance variables */
-
- VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
- if( NULL == p_plugin )
- {
- /* plugin has not been initialized yet ! */
- return NPERR_INVALID_INSTANCE_ERROR;
- }
-
- switch( variable )
- {
- case NPPVpluginScriptableNPObject:
- {
- /* retrieve plugin root class */
- NPClass *scriptClass = p_plugin->getScriptClass();
- if( scriptClass )
- {
- /* create an instance and return it */
- *(NPObject**)value = NPN_CreateObject(instance, scriptClass);
- return NPERR_NO_ERROR;
- }
- break;
- }
-
- default:
- ;
- }
- return NPERR_GENERIC_ERROR;
-}
-
-/*
- * there is some confusion in gecko headers regarding definition of this API
- * NPPVariable is wrongly defined as NPNVariable, which sounds incorrect.
- */
-
-NPError NPP_SetValue( NPP instance, NPNVariable variable, void *value )
-{
- return NPERR_GENERIC_ERROR;
-}
-
-/******************************************************************************
- * Mac-only API calls
- *****************************************************************************/
-#ifdef XP_MACOSX
-int16_t NPP_HandleEvent( NPP instance, void * event )
-{
- static UInt32 lastMouseUp = 0;
- if( instance == NULL )
- {
- return false;
- }
-
- VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
- if( p_plugin == NULL )
- {
- return false;
- }
-
-#ifndef __x86_64__
- EventRecord *myEvent = (EventRecord*)event;
-
- switch( myEvent->what )
- {
- case nullEvent:
- return true;
- case mouseDown:
- {
- if( (myEvent->when - lastMouseUp) < GetDblTime() )
- {
- /* double click */
- p_plugin->toggle_fullscreen();
- }
- return true;
- }
- case mouseUp:
- lastMouseUp = myEvent->when;
- return true;
- case keyUp:
- case keyDown:
- case autoKey:
- return true;
- case updateEvt:
- {
- const NPWindow& npwindow = p_plugin->getWindow();
- if( npwindow.window )
- {
- bool hasVout = false;
-
- if( p_plugin->playlist_isplaying() )
- {
- hasVout = p_plugin->player_has_vout();
-#if 0
- if( hasVout )
- {
- 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 text from p_plugin->psz_text */
- ForeColor(blackColor);
- PenMode( patCopy );
-
- /* seems that firefox forgets to set the following
- * on occasion (reload) */
- SetOrigin(((NP_Port *)npwindow.window)->portx,
- ((NP_Port *)npwindow.window)->porty);
-
- Rect rect;
- rect.left = 0;
- rect.top = 0;
- rect.right = npwindow.width;
- rect.bottom = npwindow.height;
- PaintRect( &rect );
-
- ForeColor(whiteColor);
- MoveTo( (npwindow.width-80)/ 2 , npwindow.height / 2 );
- if( p_plugin->psz_text )
- DrawText( p_plugin->psz_text, 0, strlen(p_plugin->psz_text) );
- }
- }
- return true;
- }
- case activateEvt:
- return false;
- case NPEventType_GetFocusEvent:
- case NPEventType_LoseFocusEvent:
- return true;
- case NPEventType_AdjustCursorEvent:
- return false;
- case NPEventType_MenuCommandEvent:
- return false;
- case NPEventType_ClippingChangedEvent:
- return false;
- case NPEventType_ScrollingBeginsEvent:
- return true;
- case NPEventType_ScrollingEndsEvent:
- return true;
- default:
- ;
- }
-#endif // __x86_64__
- return false;
-}
-#endif /* XP_MACOSX */
-
-/******************************************************************************
- * General Plug-in Calls
- *****************************************************************************/
-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,
-#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;
-
- if( instance == NULL )
- {
- return NPERR_INVALID_INSTANCE_ERROR;
- }
-
- VlcPlugin * p_plugin = new VlcPlugin( instance, mode );
- if( NULL == p_plugin )
- {
- return NPERR_OUT_OF_MEMORY_ERROR;
- }
-
- status = p_plugin->init(argc, argn, argv);
- if( NPERR_NO_ERROR == status )
- {
- instance->pdata = reinterpret_cast<void*>(p_plugin);
-#if 0
- NPN_SetValue(instance, NPPVpluginWindowBool, (void *)false);
- NPN_SetValue(instance, NPPVpluginTransparentBool, (void *)false);
-#endif
- }
- else
- {
- delete p_plugin;
- }
- return status;
-}
-
-NPError NPP_Destroy( NPP instance, NPSavedData** save )
-{
- if( NULL == instance )
- return NPERR_INVALID_INSTANCE_ERROR;
-
- VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
- if( NULL == p_plugin )
- return NPERR_NO_ERROR;
-
- instance->pdata = NULL;
-
-#if defined(XP_WIN)
- HWND win = (HWND)p_plugin->getWindow().window;
- WNDPROC winproc = p_plugin->getWindowProc();
- if( winproc )
- {
- /* reset WNDPROC */
- SetWindowLong( win, GWL_WNDPROC, (LONG)winproc );
- }
-#endif
-
- if( p_plugin->playlist_isplaying() )
- p_plugin->playlist_stop();
-
- delete p_plugin;
-
- return NPERR_NO_ERROR;
-}
-
-NPError NPP_SetWindow( NPP instance, NPWindow* window )
-{
-#if defined(XP_UNIX)
- Window control;
- unsigned int i_control_height = 0, i_control_width = 0;
-#endif
-
- if( ! instance )
- {
- return NPERR_INVALID_INSTANCE_ERROR;
- }
-
- /* NPP_SetWindow may be called before NPP_New (Opera) */
- VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
- if( NULL == p_plugin )
- {
- /* we should probably show a splash screen here */
- return NPERR_NO_ERROR;
- }
-
-#if defined(XP_UNIX)
- control = p_plugin->getControlWindow();
-#endif
-
- libvlc_instance_t *p_vlc = p_plugin->getVLC();
-
- /*
- * PLUGIN DEVELOPERS:
- * Before setting window to point to the
- * new window, you may wish to compare the new window
- * info to the previous window (if any) to note window
- * size changes, etc.
- */
-
- /* retrieve current window */
- NPWindow& curwin = p_plugin->getWindow();
-
-#ifdef XP_MACOSX
- if( window && window->window )
- {
- /* check if plugin has a new parent window */
- CGrafPtr drawable = (((NP_Port*) (window->window))->port);
-
- /* as MacOS X video output is windowless, set viewport */
- libvlc_rectangle_t view, clip;
-
- /*
- ** browser sets port origin to top-left location of plugin
- ** relative to GrafPort window origin is set relative to document,
- ** which of little use for drawing
- */
- view.top = ((NP_Port*) (window->window))->porty;
- view.left = ((NP_Port*) (window->window))->portx;
- view.bottom = window->height+view.top;
- view.right = window->width+view.left;
-
- /* clipRect coordinates are also relative to GrafPort */
- clip.top = window->clipRect.top;
- clip.left = window->clipRect.left;
- clip.bottom = window->clipRect.bottom;
- clip.right = window->clipRect.right;
-#ifdef NOT_WORKING
- libvlc_video_set_viewport(p_vlc, p_plugin->getMD(), &view, &clip);
-#else
-#warning disabled code
-#endif
- /* remember new window */
- p_plugin->setWindow(*window);
- }
- else if( curwin.window )
- {
- /* change/set parent */
- curwin.window = NULL;
- }
-#endif /* XP_MACOSX */
-
-#ifdef XP_WIN
- if( window && window->window )
- {
- /* check if plugin has a new parent window */
- HWND drawable = (HWND) (window->window);
- if( !curwin.window || drawable != curwin.window )
- {
- /* reset previous window settings */
- HWND oldwin = (HWND)p_plugin->getWindow().window;
- WNDPROC oldproc = p_plugin->getWindowProc();
- if( oldproc )
- {
- /* reset WNDPROC */
- SetWindowLong( oldwin, GWL_WNDPROC, (LONG)oldproc );
- }
- /* attach our plugin object */
- SetWindowLongPtr((HWND)drawable, GWLP_USERDATA,
- reinterpret_cast<LONG_PTR>(p_plugin));
-
- /* install our WNDPROC */
- p_plugin->setWindowProc( (WNDPROC)SetWindowLong( drawable,
- GWL_WNDPROC, (LONG)Manage ) );
-
- /* change window style to our liking */
- LONG style = GetWindowLong((HWND)drawable, GWL_STYLE);
- style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
- SetWindowLong((HWND)drawable, GWL_STYLE, style);
-
- /* remember new window */
- p_plugin->setWindow(*window);
-
- /* Redraw window */
- InvalidateRect( (HWND)drawable, NULL, TRUE );
- UpdateWindow( (HWND)drawable );
- }
- }
- else if( curwin.window )
- {
- /* reset WNDPROC */
- HWND oldwin = (HWND)curwin.window;
- SetWindowLong( oldwin, GWL_WNDPROC, (LONG)(p_plugin->getWindowProc()) );
- p_plugin->setWindowProc(NULL);
-
- curwin.window = NULL;
- }
-#endif /* XP_WIN */
-
-#if defined(XP_UNIX)
- /* default to hidden toolbar, shown at the end of this method if asked *
- * developers note : getToolbarSize need to wait the end of this method
- */
- i_control_height = 0;
- i_control_width = window->width;
-
- if( window && window->window )
- {
- Window parent = (Window) window->window;
- if( !curwin.window || (parent != (Window)curwin.window) )
- {
- Display *p_display = ( (NPSetWindowCallbackStruct *)
- window->ws_info )->display;
-
- XResizeWindow( p_display, parent, window->width, window->height );
-
- int i_blackColor = BlackPixel(p_display, DefaultScreen(p_display));
-
- /* create windows */
- Window video = XCreateSimpleWindow( p_display, parent, 0, 0,
- window->width, window->height - i_control_height,
- 0, i_blackColor, i_blackColor );
- Window controls = (Window) NULL;
- controls = XCreateSimpleWindow( p_display, parent,
- 0, window->height - i_control_height-1,
- window->width, i_control_height-1,
- 0, i_blackColor, i_blackColor );
-
- XMapWindow( p_display, parent );
- XMapWindow( p_display, video );
- if( controls ) { XMapWindow( p_display, controls ); }
-
- XFlush(p_display);
-
- /* bind events */
- Widget w = XtWindowToWidget( p_display, parent );
-
- XtAddEventHandler( w, ExposureMask, FALSE,
- (XtEventHandler)Redraw, p_plugin );
- XtAddEventHandler( w, StructureNotifyMask, FALSE,
- (XtEventHandler)Resize, p_plugin );
- XtAddEventHandler( w, ButtonReleaseMask, FALSE,
- (XtEventHandler)ControlHandler, p_plugin );
-
- /* remember window */
- p_plugin->setWindow( *window );
- p_plugin->setVideoWindow( video );
-
- if( controls )
- {
- p_plugin->setControlWindow( controls );
- }
-
- Redraw( w, (XtPointer)p_plugin, NULL );
-
- /* now display toolbar if asked through parameters */
- if( p_plugin->b_toolbar )
- {
- p_plugin->showToolbar();
- }
- }
- }
- else if( curwin.window )
- {
- curwin.window = NULL;
- }
-#endif /* XP_UNIX */
-
- if( !p_plugin->b_stream )
- {
- if( p_plugin->psz_target )
- {
- if( p_plugin->playlist_add( p_plugin->psz_target ) != -1 )
- {
- if( p_plugin->b_autoplay )
- {
- p_plugin->playlist_play();
- }
- }
- p_plugin->b_stream = true;
- }
- }
- return NPERR_NO_ERROR;
-}
-
-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 )
- {
- return NPERR_INVALID_INSTANCE_ERROR;
- }
-
- VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(instance->pdata);
- if( NULL == p_plugin )
- {
- return NPERR_INVALID_INSTANCE_ERROR;
- }
-
- /*
- ** Firefox/Mozilla may decide to open a stream from the URL specified
- ** in the SRC parameter of the EMBED tag and pass it to us
- **
- ** since VLC will open the SRC URL as well, we're not interested in
- ** that stream. Otherwise, we'll take it and queue it up in the playlist
- */
- if( !p_plugin->psz_target || strcmp(stream->url, p_plugin->psz_target) )
- {
- /* TODO: use pipes !!!! */
- *stype = NP_ASFILEONLY;
- return NPERR_NO_ERROR;
- }
- 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;
-}
-
-NPError NPP_DestroyStream( NPP instance, NPStream *stream, NPError reason )
-{
- if( instance == NULL )
- {
- return NPERR_INVALID_INSTANCE_ERROR;
- }
- return NPERR_NO_ERROR;
-}
-
-void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname )
-{
- if( instance == NULL )
- {
- return;
- }
-
- VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(instance->pdata);
- if( NULL == p_plugin )
- {
- return;
- }
-
- if( p_plugin->playlist_add( stream->url ) != -1 )
- {
- if( p_plugin->b_autoplay )
- {
- p_plugin->playlist_play();
- }
- }
-}
-
-void NPP_URLNotify( NPP instance, const char* url,
- NPReason reason, void* notifyData )
-{
- /***** Insert NPP_URLNotify code here *****\
- PluginInstance* p_plugin;
- if (instance != NULL)
- p_plugin = (PluginInstance*) instance->pdata;
- \*********************************************/
-}
-
-void NPP_Print( NPP instance, NPPrint* printInfo )
-{
- if( printInfo == NULL )
- {
- return;
- }
-
- if( instance != NULL )
- {
- /***** Insert NPP_Print code here *****\
- PluginInstance* p_plugin = (PluginInstance*) instance->pdata;
- \**************************************/
-
- if( printInfo->mode == NP_FULL )
- {
- /*
- * PLUGIN DEVELOPERS:
- * If your plugin would like to take over
- * printing completely when it is in full-screen mode,
- * set printInfo->pluginPrinted to TRUE and print your
- * plugin as you see fit. If your plugin wants Netscape
- * to handle printing in this case, set
- * printInfo->pluginPrinted to FALSE (the default) and
- * do nothing. If you do want to handle printing
- * yourself, printOne is true if the print button
- * (as opposed to the print menu) was clicked.
- * On the Macintosh, platformPrint is a THPrint; on
- * Windows, platformPrint is a structure
- * (defined in npapi.h) containing the printer name, port,
- * etc.
- */
-
- /***** Insert NPP_Print code here *****\
- void* platformPrint =
- printInfo->print.fullPrint.platformPrint;
- NPBool printOne =
- printInfo->print.fullPrint.printOne;
- \**************************************/
-
- /* Do the default*/
- printInfo->print.fullPrint.pluginPrinted = FALSE;
- }
- else
- {
- /* If not fullscreen, we must be embedded */
- /*
- * PLUGIN DEVELOPERS:
- * If your plugin is embedded, or is full-screen
- * but you returned false in pluginPrinted above, NPP_Print
- * will be called with mode == NP_EMBED. The NPWindow
- * in the printInfo gives the location and dimensions of
- * the embedded plugin on the printed page. On the
- * Macintosh, platformPrint is the printer port; on
- * Windows, platformPrint is the handle to the printing
- * device context.
- */
-
- /***** Insert NPP_Print code here *****\
- NPWindow* printWindow =
- &(printInfo->print.embedPrint.window);
- void* platformPrint =
- printInfo->print.embedPrint.platformPrint;
- \**************************************/
- }
- }
-}
-
-/******************************************************************************
- * Windows-only methods
- *****************************************************************************/
-#if defined(XP_WIN)
-static LRESULT CALLBACK Manage( HWND p_hwnd, UINT i_msg, WPARAM wpar, LPARAM lpar )
-{
- VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(GetWindowLongPtr(p_hwnd, GWLP_USERDATA));
-
- switch( i_msg )
- {
- case WM_ERASEBKGND:
- return 1L;
-
- case WM_PAINT:
- {
- PAINTSTRUCT paintstruct;
- HDC hdc;
- RECT rect;
-
- hdc = BeginPaint( p_hwnd, &paintstruct );
-
- GetClientRect( p_hwnd, &rect );
-
- FillRect( hdc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH) );
- SetTextColor(hdc, RGB(255, 255, 255));
- SetBkColor(hdc, RGB(0, 0, 0));
- if( p_plugin->psz_text )
- DrawText( hdc, p_plugin->psz_text, strlen(p_plugin->psz_text), &rect,
- DT_CENTER|DT_VCENTER|DT_SINGLELINE);
-
- EndPaint( p_hwnd, &paintstruct );
- return 0L;
- }
- default:
- /* delegate to default handler */
- return CallWindowProc( p_plugin->getWindowProc(), p_hwnd,
- i_msg, wpar, lpar );
- }
-}
-#endif /* XP_WIN */
-
-/******************************************************************************
- * UNIX-only methods
- *****************************************************************************/
-#if defined(XP_UNIX)
-static void Redraw( Widget w, XtPointer closure, XEvent *event )
-{
- VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(closure);
- Window control = p_plugin->getControlWindow();
- const NPWindow& window = p_plugin->getWindow();
- GC gc;
- XGCValues gcv;
- unsigned int i_control_height, i_control_width;
-
- if( p_plugin->b_toolbar )
- p_plugin->getToolbarSize( &i_control_width, &i_control_height );
- else
- i_control_height = i_control_width = 0;
-
- Window video = p_plugin->getVideoWindow();
- Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
-
- gcv.foreground = BlackPixel( p_display, 0 );
- gc = XCreateGC( p_display, video, GCForeground, &gcv );
-
- XFillRectangle( p_display, video, gc,
- 0, 0, window.width, window.height - i_control_height);
-
- gcv.foreground = WhitePixel( p_display, 0 );
- XChangeGC( p_display, gc, GCForeground, &gcv );
-
- if( p_plugin->psz_text )
- XDrawString( p_display, video, gc,
- window.width / 2 - 40, (window.height - i_control_height) / 2,
- p_plugin->psz_text, strlen(p_plugin->psz_text) );
- XFreeGC( p_display, gc );
-
- p_plugin->redrawToolbar();
-}
-
-static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
-{
- VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(closure);
- const NPWindow& window = p_plugin->getWindow();
-
- int i_height = window.height;
- int i_width = window.width;
- int i_xPos = event->xbutton.x;
- int i_yPos = event->xbutton.y;
-
- if( p_plugin && p_plugin->b_toolbar )
- {
- int i_playing;
-
- libvlc_media_player_t *p_md = p_plugin->getMD();
-
- i_playing = p_plugin->playlist_isplaying();
-
- vlc_toolbar_clicked_t clicked;
- clicked = p_plugin->getToolbarButtonClicked( i_xPos, i_yPos );
- switch( clicked )
- {
- case clicked_Play:
- case clicked_Pause:
- {
- if( i_playing == 1 )
- p_plugin->playlist_pause();
- else
- p_plugin->playlist_play();
- }
- break;
-
- case clicked_Stop:
- {
- p_plugin->playlist_stop();
- }
- break;
-
- case clicked_Fullscreen:
- {
- p_plugin->set_fullscreen( 1 );
- }
- break;
-
- case clicked_Mute:
- case clicked_Unmute:
- {
- if( p_md )
- libvlc_audio_toggle_mute( p_md );
- }
- break;
-
- case clicked_timeline:
- {
- /* if a movie is loaded */
- if( p_md )
- {
- int64_t f_length;
- f_length = libvlc_media_player_get_length( p_md ) / 100;
-
- f_length = (float)f_length *
- ( ((float)i_xPos-4.0 ) / ( ((float)i_width-8.0)/100) );
-
- libvlc_media_player_set_time( p_md, f_length );
- }
- }
- break;
-
- case clicked_Time:
- {
- /* Not implemented yet*/
- }
- break;
-
- default: /* button_Unknown */
- break;
- }
- }
- Redraw( w, closure, event );
-}
-
-static void Resize ( Widget w, XtPointer closure, XEvent *event )
-{
- VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(closure);
- Window control = p_plugin->getControlWindow();
- const NPWindow& window = p_plugin->getWindow();
- Window drawable = p_plugin->getVideoWindow();
- Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
-
- int i_ret;
- Window root_return, parent_return, * children_return;
- Window base_window;
- unsigned int i_nchildren;
- unsigned int i_control_height, i_control_width;
-
- if( p_plugin->b_toolbar )
- {
- p_plugin->getToolbarSize( &i_control_width, &i_control_height );
- }
- else
- {
- i_control_height = i_control_width = 0;
- }
-
-#ifdef X11_RESIZE_DEBUG
- XWindowAttributes attr;
-
- if( event && event->type == ConfigureNotify )
- {
- fprintf( stderr, "vlcshell::Resize() ConfigureNotify %d x %d, "
- "send_event ? %s\n", event->xconfigure.width,
- event->xconfigure.height,
- event->xconfigure.send_event ? "TRUE" : "FALSE" );
- }
-#endif /* X11_RESIZE_DEBUG */
-
- if( ! p_plugin->setSize(window.width, (window.height - i_control_height)) )
- {
- /* size already set */
- return;
- }
-
- i_ret = XResizeWindow( p_display, drawable,
- window.width, (window.height - i_control_height) );
-
-#ifdef X11_RESIZE_DEBUG
- fprintf( stderr,
- "vlcshell::Resize() XResizeWindow(owner) returned %d\n", i_ret );
-
- XGetWindowAttributes ( p_display, drawable, &attr );
-
- /* X is asynchronous, so the current size reported here is not
- necessarily the requested size as the Resize request may not
- yet have been handled by the plugin host */
- fprintf( stderr, "vlcshell::Resize() current (owner) size %d x %d\n",
- attr.width, attr.height );
-#endif /* X11_RESIZE_DEBUG */
-
- XQueryTree( p_display, drawable,
- &root_return, &parent_return, &children_return,
- &i_nchildren );
-
- if( i_nchildren > 0 )
- {
- /* XXX: Make assumptions related to the window parenting structure in
- vlc/modules/video_output/x11/xcommon.c */
- base_window = children_return[i_nchildren - 1];
-
-#ifdef X11_RESIZE_DEBUG
- fprintf( stderr, "vlcshell::Resize() got %d children\n", i_nchildren );
- fprintf( stderr, "vlcshell::Resize() got base_window %p\n",
- base_window );
-#endif /* X11_RESIZE_DEBUG */
-
- i_ret = XResizeWindow( p_display, base_window,
- window.width, ( window.height - i_control_height ) );
-
-#ifdef X11_RESIZE_DEBUG
- fprintf( stderr,
- "vlcshell::Resize() XResizeWindow(base) returned %d\n",
- i_ret );
-
- XGetWindowAttributes( p_display, base_window, &attr );
-
- fprintf( stderr, "vlcshell::Resize() new size %d x %d\n",
- attr.width, attr.height );
-#endif /* X11_RESIZE_DEBUG */
- }
-}
-
-#endif /* XP_UNIX */
+++ /dev/null
-/*****************************************************************************
- * vlcshell.h:
- *****************************************************************************
- * Copyright (C) 2009-2010 the VideoLAN team
- * $Id$
- *
- * Authors: Jean-Paul Saman <jpsaman@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef __VLCSHELL_H__
-#define __VLCSHELL_H__
-
-char * NPP_GetMIMEDescription( void );
-
-NPError NPP_Initialize( void );
-
-#ifdef OJI
-jref NPP_GetJavaClass( void );
-#endif
-void NPP_Shutdown( void );
-
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
-NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
- char* argn[], char* argv[], NPSavedData* saved );
-#else
-NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc,
- char* argn[], char* argv[], NPSavedData* saved );
-#endif
-
-NPError NPP_Destroy( NPP instance, NPSavedData** save );
-
-NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value );
-NPError NPP_SetValue( NPP instance, NPNVariable variable, void *value );
-
-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
-NPError NPP_DestroyStream( NPP instance, NPStream *stream, NPError reason );
-void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname );
-
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
-int32 NPP_WriteReady( NPP instance, NPStream *stream );
-int32 NPP_Write( NPP instance, NPStream *stream, int32 offset,
- int32 len, void *buffer );
-#else
-int32_t NPP_WriteReady( NPP instance, NPStream *stream );
-int32_t NPP_Write( NPP instance, NPStream *stream, int32_t offset,
- int32_t len, void *buffer );
-#endif
-
-void NPP_URLNotify( NPP instance, const char* url,
- NPReason reason, void* notifyData );
-void NPP_Print( NPP instance, NPPrint* printInfo );
-
-#ifdef XP_MACOSX
-#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
-int16 NPP_HandleEvent( NPP instance, void * event );
-#else
-int16_t NPP_HandleEvent( NPP instance, void * event );
-#endif
-#endif
-
-#endif
$(DIST_http_lua) \
$(DIST_lua) \
$(DIST_osdmenu_default) \
- $(DIST_mozilla) \
$(DIST_maemo) \
$(DIST_solid)
nobase_vlcdata_DATA += \
$(DIST_osdmenu_default)
endif
-if BUILD_MOZILLA
-# TODO: move to the mozilla directory
-nobase_vlcdata_DATA += $(DIST_mozilla)
-endif
if BUILD_HILDON
nobase_vlcdata_DATA += $(DIST_maemo) $(maemo_FILES)
endif
lua/http/vlm_export.html \
lua/http/flash.html
-DIST_mozilla = \
- mozilla/fullscreen.xpm \
- mozilla/pause.xpm \
- mozilla/play.xpm \
- mozilla/skip_next.xpm \
- mozilla/skip_previous.xpm \
- mozilla/stop.xpm \
- mozilla/time_icon.xpm \
- mozilla/time_line.xpm \
- mozilla/volume_knob.xpm \
- mozilla/volume_max.xpm \
- mozilla/volume_mute.xpm \
- mozilla/volume_slider_bar.xpm
-
DIST_maemo = \
maemo/vlc_intf.rc \
maemo/vlc_left_tab_active.png \
+++ /dev/null
-/* XPM */
-static char * fullscreen_xpm[] = {
-"15 12 4 1",
-" c None",
-". c #999999",
-"+ c #989898",
-"@ c #9A9A9A",
-". +",
-" .+ +. ",
-" +. +.+@.@ .. ",
-" ...+.+++. ",
-" +........ ",
-" +........ ",
-" +........ ",
-" +........ ",
-" ..+..+++. ",
-" +. @+... .. ",
-" +. .+ ",
-". ."};
+++ /dev/null
-/* XPM */
-static char * pause_xpm[] = {
-"15 12 3 1",
-" c None",
-". c #999999",
-"+ c #989898",
-".....+ ++....",
-".....+ ++....",
-".....+ ++....",
-".....+ ++....",
-".....+ ++....",
-".....+ ++....",
-".....+ ++....",
-".....+ ++....",
-".....+ ++....",
-".....+ ++....",
-".....+ ++....",
-".....+ ++...."};
+++ /dev/null
-/* XPM */
-static char * play_xpm[] = {
-"15 12 3 1",
-" c None",
-". c #999999",
-"+ c #989898",
-". ",
-"..+ ",
-".+++.. ",
-"....++.. ",
-"........+.. ",
-".........++++ ",
-".........+.... ",
-".......+...+ ",
-".......++ ",
-"...+.++ ",
-"..+.+ ",
-"++ "};
+++ /dev/null
-/* XPM */
-static char * skip_next_xpm[] = {
-"15 9 2 1",
-" c None",
-". c #999999",
-". . .",
-".. ... .",
-".... .... .",
-"...... ...... .",
-"...............",
-"...... ...... .",
-".... .... .",
-"... .. .",
-". . ."};
+++ /dev/null
-/* XPM */
-static char * skip_previous_xpm[] = {
-"15 9 2 1",
-" c None",
-". c #999999",
-". . .",
-". ... ...",
-". .... ....",
-". ...... ......",
-"...............",
-". ...... ......",
-". .... ....",
-". ... ...",
-". . ."};
+++ /dev/null
-/* XPM */
-static char * stop_xpm[] = {
-"15 15 2 1",
-" c None",
-". c #999999",
-"...............",
-"...............",
-"...............",
-"...............",
-"...............",
-"...............",
-"...............",
-"...............",
-"...............",
-"...............",
-"...............",
-"...............",
-"...............",
-"...............",
-"..............."};
+++ /dev/null
-/* XPM */
-static const char * time_slider_knob_xpm[] = {
-"8 6 3 1",
-" c None",
-". c #999999",
-"* c #999999",
-" *..* ",
-" *....* ",
-"*......*",
-"*......*",
-" *....* ",
-" *..* "};
+++ /dev/null
-/* XPM */
-static const char * time_line2_xpm[] = {
-"518 2 2 1",
-" c None",
-". c #999999",
-"......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................",
-"......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................"};
+++ /dev/null
-/* XPM */
-static const char * volume_knob_xpm[] = {
-"9 9 10 1",
-" c None",
-". c #989898",
-"+ c #999999",
-"@ c #8D8D8D",
-"# c #7A7A7A",
-"$ c #686868",
-"% c #272727",
-"& c #262626",
-"* c #2F2F2F",
-"= c #585858",
-" ... ",
-" .+@#@+. ",
-" +$%&%$+ ",
-".@%*=*%@.",
-".#&=+=&#.",
-".@%*=*%@.",
-" +$%&%$+ ",
-" .+@#@+. ",
-" ... "};
+++ /dev/null
-/* XPM */
-static const char * volume_max_xpm[] = {
-"15 13 3 1",
-" c None",
-". c #999999",
-"+ c #9A9A9A",
-" ",
-" . . ",
-" .. . ",
-" ... . . ",
-" ..... . .",
-"....... + . .",
-"....... + .",
-"....... + + .",
-" .... . .",
-" ... + . ",
-" .. . ",
-" . ",
-" "};
+++ /dev/null
-/* XPM */
-static const char * volume_mute_xpm[] = {
-"7 11 2 1",
-" c None",
-". c #999999",
-" .",
-" ..",
-" ...",
-" ....",
-".......",
-".......",
-".......",
-" .....",
-" ...",
-" ..",
-" ."};
+++ /dev/null
-/* XPM */
-static const char * volume_slider_bar_xpm[] = {
-"95 2 2 1",
-" c None",
-". c #999999",
-" ............................................................................................. ",
-" ............................................................................................. "};