зеркало из https://github.com/mozilla/pjs.git
M plugins/build.xml
M plugins/mozilla/Makefile.in - Changes to build with objdir M plugins/examples/MediaPlayer/JMPlayer.java - Do not use * imports M plugins/examples/MediaPlayer/build.xml - distribute to objdir M plugins/src/PlugletEngine.cpp M plugins/src/PlugletFactory.cpp M plugins/src/PlugletsDir.cpp - Additional logging
This commit is contained in:
Родитель
e22d4e6b93
Коммит
6d71fd2e0b
|
@ -39,6 +39,8 @@
|
|||
<property file="../build.properties"/> <!-- java-supplement local -->
|
||||
<property environment="myenv" />
|
||||
|
||||
<property name="objdir.native.path" value="${objdir}/java/plugins" />
|
||||
|
||||
<!-- ************ Compiler Defaults *************************************** -->
|
||||
|
||||
<!-- Should Java compilations set the 'debug' compiler option? -->
|
||||
|
@ -95,51 +97,69 @@
|
|||
</target>
|
||||
|
||||
<target name="compile.src">
|
||||
<copy todir="${objdir.native.path}/src">
|
||||
<fileset dir="${basedir}/src">
|
||||
<include name="module.res" />
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<exec os="SunOS" dir="${basedir}/src" failonerror="yes"
|
||||
<exec os="SunOS" dir="${objdir.native.path}/src" failonerror="yes"
|
||||
executable="gmake"/>
|
||||
<exec os="Linux" dir="${basedir}/src" failonerror="yes"
|
||||
<exec os="Linux" dir="${objdir.native.path}/src" failonerror="yes"
|
||||
executable="make"/>
|
||||
<exec os="Windows 2000" dir="${basedir}/src" executable="make"
|
||||
<exec os="Windows 2000" dir="${objdir.native.path}/src" executable="make"
|
||||
failonerror="yes"/>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="compile.jni">
|
||||
|
||||
<exec os="SunOS" dir="${basedir}/jni" executable="gmake"
|
||||
<copy todir="${objdir.native.path}/jni">
|
||||
<fileset dir="${basedir}/jni">
|
||||
<include name="module.res" />
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
|
||||
<exec os="SunOS" dir="${objdir.native.path}/jni" executable="gmake"
|
||||
failonerror="yes">
|
||||
</exec>
|
||||
<exec os="Linux" dir="${basedir}/jni" executable="make"
|
||||
<exec os="Linux" dir="${objdir.native.path}/jni" executable="make"
|
||||
failonerror="yes">
|
||||
</exec>
|
||||
<exec os="Mac OS X" dir="${basedir}/jni" executable="make"
|
||||
<exec os="Mac OS X" dir="${objdir.native.path}/jni" executable="make"
|
||||
failonerror="yes">
|
||||
</exec>
|
||||
<exec os="Windows 2000" dir="${basedir}/jni" executable="make"
|
||||
<exec os="Windows 2000" dir="${objdir.native.path}/jni" executable="make"
|
||||
failonerror="yes"/>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="compile.mozilla">
|
||||
|
||||
<exec os="SunOS" dir="${basedir}/mozilla" failonerror="yes"
|
||||
<copy todir="${objdir.native.path}/mozilla">
|
||||
<fileset dir="${basedir}/mozilla">
|
||||
<include name="nppluglet.res" />
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<exec os="SunOS" dir="${objdir.native.path}/mozilla" failonerror="yes"
|
||||
executable="gmake"/>
|
||||
<exec os="Linux" dir="${basedir}/mozilla" failonerror="yes"
|
||||
<exec os="Linux" dir="${objdir.native.path}/mozilla" failonerror="yes"
|
||||
executable="make"/>
|
||||
<exec os="Windows 2000" dir="${basedir}/mozilla" executable="make"
|
||||
<exec os="Windows 2000" dir="${objdir.native.path}/mozilla" executable="make"
|
||||
failonerror="yes"/>
|
||||
|
||||
<exec os="SunOS" dir="${basedir}/mozilla" failonerror="yes"
|
||||
<exec os="SunOS" dir="${objdir.native.path}/mozilla" failonerror="yes"
|
||||
executable="gmake">
|
||||
<arg line="install" />
|
||||
</exec>
|
||||
<exec os="Linux" dir="${basedir}/mozilla" failonerror="yes"
|
||||
<exec os="Linux" dir="${objdir.native.path}/mozilla" failonerror="yes"
|
||||
executable="make">
|
||||
<arg line="install" />
|
||||
</exec>
|
||||
|
||||
<exec os="Windows 2000" dir="${basedir}/mozilla" executable="make"
|
||||
<exec os="Windows 2000" dir="${objdir.native.path}/mozilla" executable="make"
|
||||
failonerror="yes">
|
||||
<arg line="install" />
|
||||
</exec>
|
||||
|
@ -153,63 +173,65 @@
|
|||
<target name="clean" depends="clean.classes">
|
||||
|
||||
<delete >
|
||||
<fileset dir="${basedir}/src">
|
||||
<fileset dir="${objdir.native.path}/src">
|
||||
<include name="*.ilk"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<delete >
|
||||
<fileset dir="${basedir}/jni">
|
||||
<fileset dir="${objdir.native.path}/jni">
|
||||
<include name="*.ilk"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<delete >
|
||||
<fileset dir="${basedir}/mozilla">
|
||||
<fileset dir="${objdir.native.path}/mozilla">
|
||||
<include name="*.ilk"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<exec os="SunOS" dir="${basedir}/src" executable="gmake"
|
||||
<exec os="SunOS" dir="${objdir.native.path}/src" executable="gmake"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
<exec os="Linux" dir="${basedir}/src" executable="make"
|
||||
<exec os="Linux" dir="${objdir.native.path}/src" executable="make"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
<exec os="Windows 2000" dir="${basedir}/src" executable="make"
|
||||
<exec os="Windows 2000" dir="${objdir.native.path}/src" executable="make"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
|
||||
<exec os="Windows 2000" dir="${basedir}/jni" executable="make"
|
||||
<exec os="Windows 2000" dir="${objdir.native.path}/jni" executable="make"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
<exec os="SunOS" dir="${basedir}/jni" executable="gmake"
|
||||
<exec os="SunOS" dir="${objdir.native.path}/jni" executable="gmake"
|
||||
failonerror="yes">
|
||||
|
||||
<arg line="clobber_all"/>
|
||||
|
||||
</exec>
|
||||
<exec os="Linux" dir="${basedir}/jni" executable="make"
|
||||
<exec os="Linux" dir="${objdir.native.path}/jni" executable="make"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
|
||||
<exec os="SunOS" dir="${basedir}/mozilla" executable="gmake"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
<exec os="Linux" dir="${basedir}/mozilla" executable="make"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
<exec os="Windows 2000" dir="${basedir}/mozilla" executable="make"
|
||||
<exec os="Windows 2000" dir="${objdir.native.path}/mozilla" executable="make"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
<exec os="SunOS" dir="${objdir.native.path}/mozilla" executable="gmake"
|
||||
failonerror="yes">
|
||||
|
||||
<arg line="clobber_all"/>
|
||||
|
||||
</exec>
|
||||
<exec os="Linux" dir="${objdir.native.path}/mozilla" executable="make"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
|
||||
|
||||
</target>
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
import javax.media.*;
|
||||
import javax.media.util.*;
|
||||
import javax.media.format.*;
|
||||
import javax.media.bean.playerbean.*;
|
||||
import javax.media.control.*;
|
||||
|
||||
|
||||
import org.mozilla.pluglet.*;
|
||||
import org.mozilla.pluglet.mozilla.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.print.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class JMPlayer implements PlugletFactory {
|
||||
public JMPlayer() {
|
||||
}
|
||||
public Pluglet createPluglet(String mimeType) {
|
||||
Pluglet player = null;
|
||||
try {
|
||||
player = new Player();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return player;
|
||||
}
|
||||
public void initialize(String plugletPath, PlugletManager manager) {
|
||||
}
|
||||
public void shutdown() {
|
||||
}
|
||||
}
|
||||
|
||||
class Player implements Pluglet, ControllerListener {
|
||||
Dimension defaultSize;
|
||||
Frame frm;
|
||||
int w, h;
|
||||
MediaPlayer player = null;
|
||||
Panel panel;
|
||||
|
||||
public synchronized void controllerUpdate(ControllerEvent ce) {
|
||||
if(ce instanceof RealizeCompleteEvent) {
|
||||
player.prefetch();
|
||||
}
|
||||
if(ce instanceof PrefetchCompleteEvent) {
|
||||
Dimension dim = player.getPreferredSize();
|
||||
frm.pack();
|
||||
panel.setSize(dim);
|
||||
frm.setSize(defaultSize);
|
||||
player.start();
|
||||
frm.show();
|
||||
}
|
||||
}
|
||||
public Player() {
|
||||
}
|
||||
public void initialize(PlugletPeer peer) {
|
||||
PlugletTagInfo2 info = (PlugletTagInfo2)peer.getTagInfo();
|
||||
w = info.getWidth();
|
||||
h = info.getHeight();
|
||||
defaultSize = new Dimension(w, h);
|
||||
}
|
||||
public boolean playFile(String url) {
|
||||
player.setMediaLocator(new MediaLocator(url));
|
||||
if(player.getPlayer() == null) {
|
||||
return false;
|
||||
} else {
|
||||
player.addControllerListener(this);
|
||||
player.realize();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public void start() {
|
||||
player = new MediaPlayer();
|
||||
panel = new Panel();
|
||||
panel.add(player);
|
||||
}
|
||||
public void stop() {
|
||||
player.stop();
|
||||
player.close();
|
||||
}
|
||||
public void destroy() {
|
||||
}
|
||||
public PlugletStreamListener newStream() {
|
||||
JMPlayerStreamListener listener = new JMPlayerStreamListener();
|
||||
listener.setPlayer(this);
|
||||
return listener;
|
||||
}
|
||||
public void setWindow(Frame frame) {
|
||||
if(frame == null) {
|
||||
return;
|
||||
}
|
||||
frame.setSize(defaultSize);
|
||||
frame.setLayout(new BorderLayout());
|
||||
frame.add(panel);
|
||||
frm = frame;
|
||||
}
|
||||
public void print(PrinterJob printerJob) {
|
||||
}
|
||||
}
|
||||
|
||||
class JMPlayerStreamListener implements PlugletStreamListener {
|
||||
Player jmp;
|
||||
|
||||
public JMPlayerStreamListener() {
|
||||
}
|
||||
public void onStartBinding(PlugletStreamInfo streamInfo) {
|
||||
if(!jmp.playFile(streamInfo.getURL())) {
|
||||
System.out.println("Error starting player.");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
public void setPlayer(Player jmp) {
|
||||
this.jmp = jmp;
|
||||
}
|
||||
public void onDataAvailable(PlugletStreamInfo streamInfo, InputStream input,int length) {
|
||||
}
|
||||
public void onFileAvailable(PlugletStreamInfo plugletInfo, String fileName) {
|
||||
}
|
||||
public void onStopBinding(PlugletStreamInfo plugletInfo,int status) {
|
||||
}
|
||||
public int getStreamType() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
</fileset>
|
||||
</jar>
|
||||
|
||||
<copy todir="${myenv.MOZ_SRC}/mozilla/dist/bin/plugins"
|
||||
<copy todir="${objdir}/dist/bin/plugins"
|
||||
file="${basedir}/build/mediaplayer.jar" />
|
||||
|
||||
</target>
|
||||
|
|
|
@ -42,7 +42,9 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
PLUGIN_SDK=$(DEPTH)/modules/plugin/tools/sdk
|
||||
PLUGIN_SDK_PATH=modules/plugin/tools/sdk
|
||||
PLUGIN_SDK_SRC=$(DEPTH)/../modules/plugin/tools/sdk
|
||||
PLUGIN_SDK_OBJDIR=$(DEPTH)/modules/plugin/tools/sdk
|
||||
|
||||
XPIDL_MODULE = nppluglet
|
||||
LIBRARY_NAME = nppluglet
|
||||
|
@ -60,7 +62,7 @@ CPPSRCS = nsScriptablePeer.cpp \
|
|||
|
||||
XPIDLSRCS = nsISimplePlugin.idl
|
||||
|
||||
SHARED_LIBRARY_LIBS = $(PLUGIN_SDK)/samples/common/$(LIB_PREFIX)plugingate_s.$(LIB_SUFFIX) ../src/$(LIB_PREFIX)pluglet.$(LIB_SUFFIX) $(XPCOM_LIBS) $(NSPR_LIBS)
|
||||
SHARED_LIBRARY_LIBS = $(PLUGIN_SDK_OBJDIR)/samples/common/$(LIB_PREFIX)plugingate_s.$(LIB_SUFFIX) ../src/$(LIB_PREFIX)pluglet.$(LIB_SUFFIX) $(XPCOM_LIBS) $(NSPR_LIBS)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
DEFFILE = $(win_srcdir)/nppluglet.def
|
||||
|
@ -73,12 +75,11 @@ ifeq ($(OS_ARCH),WINNT)
|
|||
INCLUDES += \
|
||||
-I$(MSVCDIR)/Include \
|
||||
-I$(MSVCDIR)/ATL/SRC \
|
||||
-I../src \
|
||||
-I$(DEPTH)/../java/plugins/src \
|
||||
-I../src/_xpidlgen \
|
||||
-I$(MOZILLA_FIVE_HOME)/../include/string \
|
||||
-I$(MOZILLA_FIVE_HOME)/../include/xpcom_obsolete \
|
||||
$(NULL)
|
||||
CXXFLAGS += /Zi /Yd
|
||||
endif
|
||||
|
||||
CXXFLAGS += -DFORCE_PR_LOG
|
||||
|
@ -90,8 +91,8 @@ EXTRA_DSO_LDOPTS += $(XLDFLAGS) -rdynamic -lXi -lXext -lX11 -lm -lXt
|
|||
endif
|
||||
|
||||
LOCAL_INCLUDES = -I./$(XPIDL_GEN_DIR) \
|
||||
-I$(PLUGIN_SDK)/samples/include \
|
||||
-I$(PLUGIN_SDK)/../../base/src \
|
||||
-I$(PLUGIN_SDK_SRC)/samples/include \
|
||||
-I$(PLUGIN_SDK_SRC)/../../base/src \
|
||||
$(NULL)
|
||||
install::
|
||||
$(INSTALL) $(IFLAGS1) $(SHARED_LIBRARY) $(DIST)/bin/plugins
|
||||
|
|
|
@ -205,8 +205,11 @@ void PlugletEngine::StartJVM() {
|
|||
vm_args.nOptions = 1; // EDBURNS: Change to 3 for debugging
|
||||
vm_args.ignoreUnrecognized = JNI_FALSE;
|
||||
/* Create the Java VM */
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletEngine::StartJVM about to start JVM with options %s %s %s\n",
|
||||
options[0].optionString, options[1].optionString,
|
||||
options[2].optionString));
|
||||
res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
|
||||
printf("--bcJavaGlobal::StartJVM jvm started res %d\n",res);
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletEngine::StartJVM after CreateJavaVM res = %d\n",res));
|
||||
}
|
||||
|
|
|
@ -155,8 +155,6 @@ nsresult PlugletFactory::Shutdown(void) {
|
|||
}
|
||||
|
||||
nsresult PlugletFactory::GetMIMEDescription(const char* *result) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletFactory::GetMimeDescription\n"));
|
||||
if(!result) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -166,6 +164,10 @@ nsresult PlugletFactory::GetMIMEDescription(const char* *result) {
|
|||
|
||||
PlugletFactory::PlugletFactory(const char *inMimeDescription, const char *inPath) : jthis(nsnull), path(PL_strdup(inPath)), mimeDescription(PL_strdup(inMimeDescription))
|
||||
{
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletFactory::PlugletFactory: mimeDescription: %s, path: %s\n",
|
||||
mimeDescription, path));
|
||||
|
||||
}
|
||||
|
||||
PlugletFactory::~PlugletFactory(void) {
|
||||
|
@ -203,7 +205,12 @@ PlugletFactory * PlugletFactory::Load(const char * path) {
|
|||
char * mime = PlugletLoader::GetMIMEDescription(path);
|
||||
PlugletFactory * result = nsnull;
|
||||
if (mime) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletFactory::Load: About to create PlugletFactory instance\n"));
|
||||
result = new PlugletFactory(mime,path);
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletFactory::Load: successfully created PlugletFactory instance\n"));
|
||||
|
||||
//delete[] mime; //nb we have a strange exception here
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -94,7 +94,6 @@ nsresult PlugletsDir::LoadPluglets() {
|
|||
for (nsDirectoryIterator iter(dir,PR_TRUE); iter.Exists(); iter++) {
|
||||
const nsFileSpec& file = iter;
|
||||
const char* name = file.GetCString();
|
||||
printf("debug: edburns: PlugletsDir::LoadPluglets: name: %s\n", name);
|
||||
int length;
|
||||
if((length = strlen(name)) <= 4 // if it's shorter than ".jar"
|
||||
|| strcmp(name+length - 4,".jar") ) {
|
||||
|
@ -104,14 +103,17 @@ nsresult PlugletsDir::LoadPluglets() {
|
|||
mimeType = nsnull;
|
||||
rv = plugletFactory->GetMIMEDescription(&mimeType);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletsDir::LoadPluglets: got mime description: %s\n", mimeType));
|
||||
|
||||
const char *key = PL_strdup(mimeType);
|
||||
printf("debug: edburns: key: %s address: %p\n",
|
||||
key, key);
|
||||
PLHashEntry *entry =
|
||||
PL_HashTableAdd(mMimeTypeToPlugletFacoryHash,
|
||||
(const void *) key,
|
||||
plugletFactory);
|
||||
rv = (nsnull != entry) ? NS_OK : NS_ERROR_FAILURE;
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletsDir::LoadPluglets: adding to mimeTypeToPlugletFactoryHash. rv: %d\n", rv));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче