gstreamer-java + gstreamer winbuilds

29 views
Skip to first unread message

kandras

unread,
Aug 20, 2009, 4:20:05 PM8/20/09
to gstreamer-java
Hi,

I have problem with gstreamer-java and gstreamer Winbuilds on windows.
If i would like to play a video file i get this:

(java.exe:3304): GLib-GObject-CRITICAL **: file ..\..\gobject
\gobject.c: line 22
42: assertion `G_IS_OBJECT (object)' failed

(java.exe:3304): GLib-GObject-CRITICAL **: file ..\..\gobject
\gobject.c: line 49
0: assertion `G_IS_OBJECT_CLASS (class)' failed
Exception in thread "main" java.lang.IllegalArgumentException: Unknown
property:
uri
at org.gstreamer.GObject.set(GObject.java:86)
at org.gstreamer.elements.PlayBin.setURI(PlayBin.java:300)
at org.gstreamer.elements.PlayBin.setInputFile(PlayBin.java:
291)
at VideoPlayer.main(VideoPlayer.java:39)

Source code:
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.filechooser.FileFilter;
import org.gstreamer.Gst;
import org.gstreamer.State;
import org.gstreamer.elements.PlayBin;
import org.gstreamer.swing.VideoComponent;

public class VideoPlayer {
public static void main(String[] args) {
args = Gst.init("VideoPlayer", args);
final PlayBin playbin = new PlayBin("VideoPlayer");

File f = null;

JFileChooser fc = new JFileChooser();
fc.setFileFilter(new FileFilter() {

@Override
public boolean accept(File f) {
return f.isDirectory() || f.getName().toLowerCase
().endsWith(".avi");
}

@Override
public String getDescription() {
return "AVI fájlok";
}
});
if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
f = fc.getSelectedFile();
}

playbin.setInputFile(f);

SwingUtilities.invokeLater(new Runnable() {

public void run() {
VideoComponent videoComponent = new VideoComponent();
playbin.setVideoSink(videoComponent.getElement());

JFrame frame = new JFrame("VideoPlayer");
frame.getContentPane().add(videoComponent,
BorderLayout.CENTER);
frame.setPreferredSize(new Dimension(640, 480));
frame.setDefaultCloseOperation
(WindowConstants.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
playbin.setState(State.PLAYING);
}
});
Gst.main();
playbin.setState(State.NULL);
}
}

This code works on linux with native gstreamer and gstreamer-java.
If I try to play video file with gst-launch playbin uri="file:///c:/
somefile.avi", it works on windows, but gstreamer java is not.


If somebody can please help me,

Thanks in advance,
Andras

I'm using current version of JNA, current version (0.10.4) of
gstreamer Winbuilds and latest JVM.

Tal Shalif

unread,
Aug 20, 2009, 4:27:38 PM8/20/09
to gstream...@googlegroups.com
I used gstreamer win32 binaries with gstreamer-java successfully. I built the binaries myself using a mingw corss-compiler from a linux machine. I have not done so recently, but apparently cross-building gstreamer for win32 is now part of the official gstreamer code. Better check either your win32 binaries are from the latest gstreamer code or build your own.

2009/8/20 kandras <kand...@gmail.com>

Citizen

unread,
Aug 24, 2009, 2:36:22 PM8/24/09
to gstreamer-java
> I'm using current version of JNA, current version (0.10.4) of
> gstreamer Winbuilds and latest JVM.

Similar (but not identical) problem here:

I'm using JDK 1.6.0_11, JNA-3.2.2, GStreamer-WinBuild-0.10.4.exe (GPL-
version from http://www.gstreamer-winbuild.ylatuya.es/doku.php?id=download)
and gstreamer-java-bin-1.0.jar under Eclipse 3.5 (Galileo). I have

This works fine from cmd.exe (theora video + vorbis audio):

gst-launch-0.10-exe playbin uri=file:///c:/demo.ogg

I tried the BusMessages.java that come with gstreamer-java, and I
tried your snippet above as well. In both of them I get:

0:00:20.843750000 5936 03297CD0 ERROR basesrc
gstbasesrc.c:2790:gst_base_src_activate_pull:<source> Failed to start
in pull mode

(different numbers, but same error message otherwise).

It is not a problem with not finding gstreamer DLLs as far as I can
tell (renaming c:\gstreamer to something else gives errors about
finding DLLs).

I looked at the source code and it seems the error is generated if the
source isn't seekable - but a file on disk should be seekable, right?

Anyone with some insight?

/citizen

Tal Shalif

unread,
Aug 24, 2009, 3:26:14 PM8/24/09
to gstream...@googlegroups.com
Don't use 'winbuilds' - they are too old. You need a fairly recent build of gstreamer and the best way to do it is building it yourself. The current version is 0.10.24 - last I tried, gstreamer-java worked well with 0.10.17, but 0.10.4 may be too old. Try to run first the PipelineLauncher example, to which you can give the same pipeline description you use for 'gst-launch'.

2009/8/24 Citizen <cit...@fubbie.org>

Citizen

unread,
Aug 24, 2009, 4:37:53 PM8/24/09
to gstreamer-java
> Don't use 'winbuilds' - they are too old. You need a fairly recent build of
> gstreamer and the best way to do it is building it yourself. The current
> version is 0.10.24 - last I tried, gstreamer-java worked well with 0.10.17,
> but 0.10.4 may be too old. Try to run first the PipelineLauncher example, to
> which you can give the same pipeline description you use for 'gst-launch'.

This is indeed very confusing, but the WinBuilds installer executable
I linked to above has 0.10.4 in the filename, but it is actually just
4 days old (on the changelog it says Aug 20, 2009) and seems to
contain GStreamer 0.10.23 (latest available GStreamer right now is
0.10.24):

C:\gstreamer\bin>gst-launch-0.10.exe --version
gst-launch-0.10 version 0.10.23
GStreamer 0.10.23
Unknown package origin

Anyway, i just turned on --gst-debug-level=3 (sorry, should have done
that before posting) and figured out what the problem was:

0:00:00.656250000 5832 02E14038 WARN gio_src
gstgiosrc.c:313:gst_gio_src_start:<source> error: Could not open
location file:///c:/Src/Workspace/GStreamerTests/file:/c:/demo.ogg for
reading: Error opening file: Invalid argument

This is caused by

playbin.setInputFile( new File("c:/demo.ogg" ) );

So for some reason it prepends the current working directory to the
actual URI (and thus can't find it). I then tried

playbin.setURI( new URI("file:///c:/demo.ogg")); // NOTE: 3
slashes after file: (i.e no hostname)

which doesn't work either (using exact same uri in gst-launcher
works!).

The fix was to use

playbin.setURI( new URI("file://localhost/c:/demo.ogg")); // NOTE:
localhost as hostname

which works (i.e the file starts playing).

I believe this is a bug, but I haven't had the time to track down
where it is (my guess is in gstreamer-java). Hopefully this post will
help someone else with the same problem.

/citizen
Reply all
Reply to author
Forward
0 new messages