Tha*_*Guy 5 java gstreamer 32bit-64bit
我正在尝试运行Gstreamer Java教程(https://code.google.com/p/gstreamer-java/wiki/Tutorials).但我现在遇到了"没有这样的Gstreamer工厂"的错误.
从在互联网上寻找它似乎与计算机架构(32或64位)有关,但我看不出如何解决问题.
我正在运行OSX 10.8.5(64位),Java 1.7.
有任何想法吗?
谢谢!埃德
编辑:
java -version
java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
并且运行的代码是:
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.*;
import org.gstreamer.*;
import org.gstreamer.swing.VideoComponent;
public class VideoTest {
public VideoTest() {
}
private static Pipeline pipe;
private static String libDir;
private static final Object[][] DEPENDENCIES = {
// glib libraries
{"gio-2.0", new String[]{}, true},
{"glib-2.0", new String[]{}, true},
{"gmodule-2.0", new String[]{}, true},
{"gobject-2.0", new String[]{}, true},
{"gthread-2.0", new String[]{}, true},
// Core gstreamer libraries
{"gstapp-0.10", new String[]{}, true},
{"gstaudio-0.10", new String[]{}, true},
{"gstbase-0.10", new String[]{}, true},
{"gstbasevideo-0.10", new String[]{}, true},
//{"gstcdda-0.10", new String[]{}, true},
{"gstcontroller-0.10", new String[]{}, true},
{"gstdataprotocol-0.10", new String[]{}, true},
{"gstfft-0.10", new String[]{}, true},
{"gstinterfaces-0.10", new String[]{}, true},
//{"gstnet-0.10", new String[]{}, true},
{"gstnetbuffer-0.10", new String[]{}, true},
{"gstpbutils-0.10", new String[]{}, true},
{"gstphotography-0.10", new String[]{}, true},
{"gstreamer-0.10", new String[]{}, true},
{"gstriff-0.10", new String[]{}, true},
{"gstrtp-0.10", new String[]{}, true},
{"gstrtsp-0.10", new String[]{}, true},
{"gstsdp-0.10", new String[]{}, true},
//{"gstsignalprocessor-0.10", new String[]{}, true},
{"gsttag-0.10", new String[]{}, true},
{"gstvideo-0.10", new String[]{}, true},};
public static void main(String[] args) {
libDir = System.getProperty("user.dir");
//MAC64
if (System.getProperty("os.name").contains("OS")) {
if (System.getProperty("sun.arch.data.model").contains("64")) {
libDir = libDir + "/MAC64";
}
}
//PC64
if (System.getProperty("os.name").contains("Win")) {
if (System.getProperty("sun.arch.data.model").contains("64")) {
libDir = libDir + "\\PC64";
}
}
//PC32
if (System.getProperty("os.name").contains("Win")) {
if (System.getProperty("sun.arch.data.model").contains("32")) {
libDir = libDir + "\\PC32";
}
}
for (Object[] a : DEPENDENCIES) {
try {
NativeLibrary.addSearchPath(a[0].toString(), libDir);
Native.loadLibrary(a[0].toString(), DummyLibrary.class);
} catch (UnsatisfiedLinkError ex) {
System.out.println("Error loading: " + a[0].toString());
}
}
Gst.setUseDefaultContext(false);
args = Gst.init("VideoTest", args);
pipe = new Pipeline("VideoTest");
final Element videosrc = ElementFactory.make("videotestsrc", "source");
final Element videofilter = ElementFactory.make("capsfilter", "filter");
videofilter.setCaps(Caps.fromString("video/x-raw-yuv, width=720, height=576"
+ ", bpp=32, depth=32, framerate=25/1"));
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
VideoComponent videoComponent = new VideoComponent();
Element videosink = videoComponent.getElement();
pipe.addMany(videosrc, videofilter, videosink);
Element.linkMany(videosrc, videofilter, videosink);
// Now create a JFrame to display the video output
JFrame frame = new JFrame("Swing Video Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(videoComponent, BorderLayout.CENTER);
videoComponent.setPreferredSize(new Dimension(720, 576));
frame.pack();
frame.setVisible(true);
// Start the pipeline processing
pipe.setState(State.PLAYING);
}
});
}
public interface DummyLibrary extends Library {
}
}
Run Code Online (Sandbox Code Playgroud)
目录中包含lib/dylib文件.这是基于Praxis LIVE(https://code.google.com/p/praxis/)的代码.
| 归档时间: |
|
| 查看次数: |
1570 次 |
| 最近记录: |