problem when trying to run example/SwingPlayer example

43 views
Skip to first unread message

acolubri

unread,
Nov 21, 2007, 5:01:49 AM11/21/07
to gstreamer-java
Hi,

I'm don't have much experience with java, so perhaps my question is a
little bit silly.

I'm trying to run the SwingPlayer example. I installed gstreamer
successfully on windows vista (the playbin test runs fine).

I have the latest JRE and JDK (1.6) installed on my machine. When I
try to execute:

java -cp jna-20070909-r283.jar:gstreamer-java-20071022-r125.jar
example.SwingPlayer C:/test.avi

I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: example/
SwingPlayer

Both jna-20070909-r283.jar and gstreamer-java-20071022-r125.jar are
located in the directory where I run the command.

The file C:/test.avi is the one I'm able to play with gst-launch-0.10
--gst-debug-level=2 playbin uri=file://C:/test.avi

Any suggestions?

Many thanks,
Andres

Wayne Meissner

unread,
Nov 21, 2007, 6:42:46 PM11/21/07
to gstream...@googlegroups.com
If you're on windows, I think you need to use a semi-colon ';' to separate the classpath elements, not a colon ':'

If that doesn't work, use 'jar tvf' on gstreamer-java-20071022-r125.jar to make sure example/SwingPlayer.class actually exists and/or the jar file didn't get corrupted during download or something.

acolubri

unread,
Nov 22, 2007, 2:38:50 PM11/22/07
to gstreamer-java
Thanks, it works now. Well, the SwingPlayer example shows the player
window, but when I press on the "pause" button, the windows freezes.
If the PlayBin example works flawlessly.

I have another question. I want to copy the buffer holding the frame
data into my own variables. Something like this:

ByteBuffer buffer;
player.getBuffer(buffer);

How can I do that?

Andres


On Nov 21, 3:42 pm, "Wayne Meissner" <wmeiss...@gmail.com> wrote:
> If you're on windows, I think you need to use a semi-colon ';' to separate
> the classpath elements, not a colon ':'
>
> If that doesn't work, use 'jar tvf' on gstreamer-java-20071022-r125.jar to
> make sure example/SwingPlayer.class actually exists and/or the jar file
> didn't get corrupted during download or something.
>

acolubri

unread,
Nov 22, 2007, 2:39:51 PM11/22/07
to gstreamer-java
Sorry, I meant "The PlayBin example works flawlessly."

Wayne Meissner

unread,
Nov 22, 2007, 10:51:43 PM11/22/07
to gstream...@googlegroups.com
On 23/11/2007, acolubri <andres....@gmail.com> wrote:

Thanks, it works now. Well, the SwingPlayer example shows the player
window, but when I press on the "pause" button, the windows freezes.
If the PlayBin example works flawlessly.

I haven't seen that on macosx or linux.  Could be a problem with the  gstreamer builds on windows, perhaps?
 
If you don't hit any of the buttons does it keep playing?


I have another question. I want to copy the buffer holding the frame
data into my own variables. Something like this:

ByteBuffer buffer;
player.getBuffer(buffer);

How can I do that?

Your best bet is to construct your own gstreamer pipeline and extract the video data from that.

Have a look at the code in GstVideoComponent on how it does this.  The key part is creating a CustomSink subclass, overriding sinkRender(), and then you can get a ByteBuffer from the passed in buffer.



acolubri

unread,
Nov 23, 2007, 5:10:45 AM11/23/07
to gstreamer-java
> > Thanks, it works now. Well, the SwingPlayer example shows the player
> > window, but when I press on the "pause" button, the windows freezes.
> > If the PlayBin example works flawlessly.
>
> I haven't seen that on macosx or linux. Could be a problem with the
> gstreamer builds on windows, perhaps?
>
> If you don't hit any of the buttons does it keep playing?

No, it doesn't play at all. As far as I don't press the pause button,
the player window responds to the mouse (I can change the volume,
resize the window, etc). As soon as I click pause, the player freezes.

One thing I noted when running example.Player is that gives me the
following error:

** (java.exe:5404): CRITICAL **: file E:\devel-release\src_releases
\gstreamer\gs
t\gstinfo.c: line 413: assertion `category != NULL' failed

However, it plays the file ok, so I don't know if this is very
important.


> I have another question. I want to copy the buffer holding the frame
>
> > data into my own variables. Something like this:
>
> > ByteBuffer buffer;
> > player.getBuffer(buffer);
>
> > How can I do that?
>
> Your best bet is to construct your own gstreamer pipeline and extract the
> video data from that.
>
> Have a look at the code in GstVideoComponent on how it does this. The key
> part is creating a CustomSink subclass, overriding sinkRender(), and then
> you can get a ByteBuffer from the passed in buffer.

Great, sounds good. I looked at the classes you mentioned, and the
required changes
seem to be not too difficult.

But since I don't have much experience with java development, I have
to start asking a
few very basic questions. What IDE should I use to compile my modified
version of
gstreamer-java? Netbeans? And what JDK? 1.5 or 1.6?

Andres

Wayne Meissner

unread,
Nov 25, 2007, 7:39:21 PM11/25/07
to gstream...@googlegroups.com
On 23/11/2007, acolubri <andres....@gmail.com> wrote:

No, it doesn't play at all. As far as I don't press the pause button,
the player window responds to the mouse (I can change the volume,
resize the window, etc). As soon as I click pause, the player freezes.

Hmm.  I'll have to find my windows VM and boot it up to take a look at it.

The biggest difference between Player and SwingPlayer is that Player just renders via a native gstreamer output sink (using direct draw, I think) whereas SwingPlayer uses java2d to render.

Try SwingVideoTest and see whether that works (should display a test pattern with some updating areas), to see if it is the rendering part, or the decoding part of the pipeline.





> I have another question. I want to copy the buffer holding the frame
>
> > data into my own variables. Something like this:
>
> > ByteBuffer buffer;
> > player.getBuffer (buffer);
>
> > How can I do that?
>
> Your best bet is to construct your own gstreamer pipeline and extract the
> video data from that.
>
> Have a look at the code in GstVideoComponent on how it does this.  The key
> part is creating a CustomSink subclass, overriding sinkRender(), and then
> you can get a ByteBuffer from the passed in buffer.

Great, sounds good. I looked at the classes you mentioned, and the
required changes
seem to be not too difficult.

But since I don't have much experience with java development, I have
to start asking a
few very basic questions. What IDE should I use to compile my modified
version of
gstreamer-java? Netbeans? And what JDK? 1.5 or 1.6?

I use Netbeans 6.0 (RC1) with jdk 1.5  to develop, so thats probably easiest, but others have used eclipse with some success.  There have been problems in the past with some gstreamer-java code that does stuff with generics that is valid and compiles fine on sun's jdk, but fails with eclipse's compiler.

First steps would be to open up the project in Netbeans and run the unit tests - that will confirm your setup is all working.



acolubri

unread,
Nov 30, 2007, 5:17:51 AM11/30/07
to gstreamer-java

> Try SwingVideoTest and see whether that works (should display a test pattern
> with some updating areas), to see if it is the rendering part, or the
> decoding part of the pipeline.

SwingVideoTest works ok on my system.

> I use Netbeans 6.0 (RC1) with jdk 1.5 to develop, so thats probably
> easiest, but others have used eclipse with some success. There have been
> problems in the past with some gstreamer-java code that does stuff with
> generics that is valid and compiles fine on sun's jdk, but fails with
> eclipse's compiler.
>
> First steps would be to open up the project in Netbeans and run the unit
> tests - that will confirm your setup is all working.

Thanks for the info.

I have been using Netbeans 5.5, and compiled gstreamer-java with both
jdk 1.5 and 1.6
However, in the two cases I run into the following problem. The
example.Player test
runs fine using my own compiled versions of gstreamer-java, but
everything that seems
to be related to swing (example.SwingVideoTest, example.SwingPlayer,
etc) crashes
at startup with the following error:

(java.exe:4236): GLib-GObject-WARNING **: specified instance size for
type `Vide
oSink' is smaller than the parent type's `GstBaseSink' instance size

(java.exe:4236): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OB
JECT (object_type)' failed
Exception in thread "main" java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.put(Unknown Source)
at org.gstreamer.NativeObject.<init>(NativeObject.java:41)
at org.gstreamer.GObject.<init>(GObject.java:38)
at org.gstreamer.GstObject.<init>(GstObject.java:48)
at org.gstreamer.GstObject.<init>(GstObject.java:30)
at org.gstreamer.Element.<init>(Element.java:39)
at org.gstreamer.BaseSink.<init>(BaseSink.java:34)
at org.gstreamer.CustomSink.<init>(CustomSink.java:59)
at org.gstreamer.swing.GstVideoComponent
$VideoSink.<init>(GstVideoCompon
ent.java:284)
at
org.gstreamer.swing.GstVideoComponent.<init>(GstVideoComponent.java:6
6)
at example.SwingVideoTest.main(SwingVideoTest.java:67)


Perhaps I should recompile the JNI as well?

Wayne Meissner

unread,
Nov 30, 2007, 7:09:03 PM11/30/07
to gstream...@googlegroups.com
On 30/11/2007, acolubri <andres....@gmail.com> wrote:



I have been using Netbeans 5.5, and compiled gstreamer-java with both
jdk 1.5 and 1.6
However, in the two cases I run into the following problem. The
example.Player test
runs fine using my own compiled versions of gstreamer-java, but
everything that seems
to be related to swing (example.SwingVideoTest, example.SwingPlayer,
etc) crashes
at startup with the following error:

(java.exe:4236): GLib-GObject-WARNING **: specified instance size for
type `Vide
oSink' is smaller than the parent type's `GstBaseSink' instance size

(java.exe:4236): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OB
JECT (object_type)' failed
Exception in thread "main" java.lang.NullPointerException
        at java.util.concurrent.ConcurrentHashMap.put(Unknown Source)
        at org.gstreamer.NativeObject.<init>(NativeObject.java:41)
        at org.gstreamer.GObject.<init>(GObject.java:38)
        at org.gstreamer.GstObject.<init>(GstObject.java:48)
        at org.gstreamer.GstObject.<init>(GstObject.java:30)
        at org.gstreamer.Element .<init>(Element.java:39)

        at org.gstreamer.BaseSink.<init>(BaseSink.java:34)
        at org.gstreamer.CustomSink.<init>(CustomSink.java:59)
        at org.gstreamer.swing.GstVideoComponent
$VideoSink.<init>(GstVideoCompon
ent.java:284)
        at
org.gstreamer.swing.GstVideoComponent.<init>(GstVideoComponent.java:6
6)
        at example.SwingVideoTest.main(SwingVideoTest.java:67)


Perhaps I should recompile the JNI as well?

No, its a problem with the definitions of on of the gstreamer structures in GstAPI.java - some field in one of the structs does not match the one in the native header definition.

I've rolled GstVideoComponent back to an earlier version which shouldn't have that problem.

 


Reply all
Reply to author
Forward
0 new messages