D
dev null
Dear JMF wizards:
I'm having a serious portability problem
between Solaris and Windows. A simple program
together with platform and Java version info
is below. I have two questions which I would
be much obliged if you can help answer. First,
what is going on under Windows that causes
the JMF to think it took more than 96 hours
to realize the player as opposed to about a
second on Solaris running the same class file?
Is there any work-around available? This is
really amazing (and really annoying)!
Second, when I ran the JMF's exe installer
on the Windows machine under my user account
and in my user-controlled space, I could not
run this program in spite of setting all my
shell vars as the Readme file instructs. But,
when I asked a System Administrator to do the
install, the program ran fine (except for the
above mentioned Time problem). This will be
a serious drawback to my user community if an
Administrator has to be found to run the
install on every Windows machine they want
to run my app on. Is there any work-around for
a regular Windows user to run this install
and not get Access Denied and ClassNotFound
(on classes in the JMF's lib) errors?
TIA. Example program and results follow.
// file: Test.java
import java.io.*;
import java.net.*;
import javax.media.*;
public class Test implements ControllerListener
{
Player player = null;
public Test (String file)
{
try
{
URL url = new URL (file);
MediaLocator ml = new MediaLocator (url);
if ((player = Manager.createPlayer (ml)) == null)
throw new NoPlayerException ("player");
player.addControllerListener (this);
player.realize ();
}
catch (Exception e)
{
e.printStackTrace ();
}
}
public void controllerUpdate (ControllerEvent event)
{
if (event.getSource ().equals (null))
return;
System.out.println ("\nnew event: " + event.toString ());
if (event.getSource ().equals (player))
{
synchronized (player)
{
try
{
if (event instanceof RealizeCompleteEvent)
{
System.out.println ("\ncurrent Time offset: " +
player.getTimeBase ().getTime ().getSeconds ());
player.setTimeBase (null);
System.out.println ("after setting to null: " +
player.getTimeBase ().getTime ().getSeconds ());
player.start ();
}
else if (event instanceof StartEvent)
{
System.out.println ("\nexiting");
System.exit (0);
}
}
catch (Exception e)
{
e.printStackTrace ();
}
}
}
}
public static void main (String args[])
{
new Test (args[0]);
}
}
/*
on Solaris:
% uname -ir
5.8 SUNW,Sun-Blade-100
% java -version
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
% wc -c jmf*sh
4778152 jmf-2_1_1a-solsparc.sh
% java Test file:///home/data/movie.mpg
new event: javax.media.TransitionEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,previous=Unrealized,current=Realizing,target=Realized]
new event: javax.media.DurationUpdateEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,duration=javax.media.Time@10a2d64
new event: javax.media.RealizeCompleteEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,previous=Realizing,current=Realized,target=Realized]
current Time offset: 1.8250000000000002
after setting to null: 1.8290000000000002
new event: javax.media.TransitionEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,previous=Realized,current=Prefetching,target=Started]
new event: javax.media.PrefetchCompleteEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,previous=Prefetching,current=Prefetched,target=Started]
new event: javax.media.StartEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,previous=Prefetched,current=Started,target=Started,mediaTime=javax.media.Time@a31e1b,timeBaseTime=javax.media.Time@10da5eb]
exiting
=================
on PC:
from Control Panel -> General:
System: Microsoft Windows 2000, 5.00.2195, Service Pack 3
Computer: Intel(R) Pentium, (R) 4 CPU 1.70 GHz, AT/AT COMPATIBLE,
523,696 KB RAM
C:\> java -version
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
C:\> dir /b jmf*.exe
jmf-2_1_1a-win.exe
1 File(s) 5,251,218 bytes
C:\> java Test file:\\data\movie.mpg
new event: javax.media.DurationUpdateEvent[source=com.sun.media.content.video.mpeg.Handler@46f579,duration=javax.media.Time@aaa1e
new event: javax.media.RealizeCompleteEvent[source=com.sun.media.content.video.mpeg.Handler@46f579,previous=Realizing,current=Realized,target=Realized]
current Time offset: 346248.34
after setting to null: 346248.341
new event: javax.media.TransitionEvent[source=com.sun.media.content.video.mpeg.Handler@46f579,previous=Realized,current=Prefetching,target=Started]
new event: javax.media.PrefetchCompleteEvent[source=com.sun.media.content.video.mpeg.Handler@46f579,previous=Prefetching,current=Prefetched,target=Started]
new event: javax.media.StartEvent[source=com.sun.media.content.video.mpeg.Handler@46f579,previous=Prefetched,current=Started,target=Started,mediaTime=javax.media.Time@31b4c3,timeBaseTime=javax.media.Time@52906a]
exiting
*/
I'm having a serious portability problem
between Solaris and Windows. A simple program
together with platform and Java version info
is below. I have two questions which I would
be much obliged if you can help answer. First,
what is going on under Windows that causes
the JMF to think it took more than 96 hours
to realize the player as opposed to about a
second on Solaris running the same class file?
Is there any work-around available? This is
really amazing (and really annoying)!
Second, when I ran the JMF's exe installer
on the Windows machine under my user account
and in my user-controlled space, I could not
run this program in spite of setting all my
shell vars as the Readme file instructs. But,
when I asked a System Administrator to do the
install, the program ran fine (except for the
above mentioned Time problem). This will be
a serious drawback to my user community if an
Administrator has to be found to run the
install on every Windows machine they want
to run my app on. Is there any work-around for
a regular Windows user to run this install
and not get Access Denied and ClassNotFound
(on classes in the JMF's lib) errors?
TIA. Example program and results follow.
// file: Test.java
import java.io.*;
import java.net.*;
import javax.media.*;
public class Test implements ControllerListener
{
Player player = null;
public Test (String file)
{
try
{
URL url = new URL (file);
MediaLocator ml = new MediaLocator (url);
if ((player = Manager.createPlayer (ml)) == null)
throw new NoPlayerException ("player");
player.addControllerListener (this);
player.realize ();
}
catch (Exception e)
{
e.printStackTrace ();
}
}
public void controllerUpdate (ControllerEvent event)
{
if (event.getSource ().equals (null))
return;
System.out.println ("\nnew event: " + event.toString ());
if (event.getSource ().equals (player))
{
synchronized (player)
{
try
{
if (event instanceof RealizeCompleteEvent)
{
System.out.println ("\ncurrent Time offset: " +
player.getTimeBase ().getTime ().getSeconds ());
player.setTimeBase (null);
System.out.println ("after setting to null: " +
player.getTimeBase ().getTime ().getSeconds ());
player.start ();
}
else if (event instanceof StartEvent)
{
System.out.println ("\nexiting");
System.exit (0);
}
}
catch (Exception e)
{
e.printStackTrace ();
}
}
}
}
public static void main (String args[])
{
new Test (args[0]);
}
}
/*
on Solaris:
% uname -ir
5.8 SUNW,Sun-Blade-100
% java -version
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
% wc -c jmf*sh
4778152 jmf-2_1_1a-solsparc.sh
% java Test file:///home/data/movie.mpg
new event: javax.media.TransitionEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,previous=Unrealized,current=Realizing,target=Realized]
new event: javax.media.DurationUpdateEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,duration=javax.media.Time@10a2d64
new event: javax.media.RealizeCompleteEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,previous=Realizing,current=Realized,target=Realized]
current Time offset: 1.8250000000000002
after setting to null: 1.8290000000000002
new event: javax.media.TransitionEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,previous=Realized,current=Prefetching,target=Started]
new event: javax.media.PrefetchCompleteEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,previous=Prefetching,current=Prefetched,target=Started]
new event: javax.media.StartEvent[source=com.sun.media.content.video.mpeg.Handler@f99ff5,previous=Prefetched,current=Started,target=Started,mediaTime=javax.media.Time@a31e1b,timeBaseTime=javax.media.Time@10da5eb]
exiting
=================
on PC:
from Control Panel -> General:
System: Microsoft Windows 2000, 5.00.2195, Service Pack 3
Computer: Intel(R) Pentium, (R) 4 CPU 1.70 GHz, AT/AT COMPATIBLE,
523,696 KB RAM
C:\> java -version
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
C:\> dir /b jmf*.exe
jmf-2_1_1a-win.exe
1 File(s) 5,251,218 bytes
C:\> java Test file:\\data\movie.mpg
new event: javax.media.DurationUpdateEvent[source=com.sun.media.content.video.mpeg.Handler@46f579,duration=javax.media.Time@aaa1e
new event: javax.media.RealizeCompleteEvent[source=com.sun.media.content.video.mpeg.Handler@46f579,previous=Realizing,current=Realized,target=Realized]
current Time offset: 346248.34
after setting to null: 346248.341
new event: javax.media.TransitionEvent[source=com.sun.media.content.video.mpeg.Handler@46f579,previous=Realized,current=Prefetching,target=Started]
new event: javax.media.PrefetchCompleteEvent[source=com.sun.media.content.video.mpeg.Handler@46f579,previous=Prefetching,current=Prefetched,target=Started]
new event: javax.media.StartEvent[source=com.sun.media.content.video.mpeg.Handler@46f579,previous=Prefetched,current=Started,target=Started,mediaTime=javax.media.Time@31b4c3,timeBaseTime=javax.media.Time@52906a]
exiting
*/