What about making vlcj the default Java bindings of VLC?To any vlcj users who may be interested, I made a final 1.1.0 release of vlcj now that vlc 1.1.0 final has been released. Not much has changed if you've been using the recent pre-release 1.1.0x versions.
Please feed back any issues.
http://code.google.com/p/vlcj/
(You also need log4j, jna and the jna platform jars.)
To be honest, I can't see myself having the spare capacity to move my project and development environment from googlecode+svn to something new.What about making vlcj the default Java bindings of VLC?
I had this same problem with JVLC. In fact I do not know how to resolve but I managed to identify that this occurs when you give a second dispose () in dialogs (with video playing).vlcj contains a simple video player implementation built using Swing/AWT, and I use this for testing.
I have discovered a new issue that I am really struggling to solve. I did not see this issue with vlc 1.0.5, nor with vlc 1.1.0pre2, but it is present when running the same Java code against vlc 1.0.6 and vlc 1.1.0pre3. I'm not saying this is a vlc fault I'm just describing my circumstances.
The problem goes like this...
1. Start the test player
2. Use file or stream dialog to open a media source
3. Video starts playing
4. Use file or stream dialog, this time hit cancel (or choose something, it doesn't matter)
5. => Fatal JVM failure, with the text below dumped to the error console
(If you never start a video playing, you can open and cancel as many dialogs as you want and it doesn't crash.)
The fatal JVM failure is most likely as a result of an unhandled exception condition in the native code.Code: Select all
[????????] x11 video output error: X11 request 20.0 failed with error code 3: BadWindow (invalid Window parameter) X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 20 (X_GetProperty) Resource id in failed request: 0x4400042 Serial number of failed request: 2673 Current serial number in output stream: 2673
This happens as soon as the dialog box closes, and is 100% repeatable and I have no idea what to do about it.
I can play movie after movie without any issues if I don't use a dialog box and do it programmatically instead.
Anyone have any ideas?
Code: Select all
package br.ufpb.lavid.GTMDA.Commons.GUI.swing;
import java.awt.Component;
import java.awt.Dialog.ModalityType;
import java.awt.HeadlessException;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author alexander
*/
public class JFileChooserGTMDA extends JFileChooser{
private JDialog meuDialog = null;
public JFileChooserGTMDA(String path){
super(path);
}
public void setFileFilter(String description, String... formats){
setFileFilter(new MyFileFilter(description, formats));
}
@Override
protected JDialog createDialog(Component parent) throws HeadlessException {
this.meuDialog = super.createDialog(parent);
meuDialog.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
meuDialog.setModalityType(ModalityType.APPLICATION_MODAL);
meuDialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
cancelSelection();
}
});
return this.meuDialog;
}
public JDialog getDialog(){
return meuDialog;
}
@Override
public int showDialog(Component parent, String approveButtonText)
throws HeadlessException {
return showDialog(parent, approveButtonText, approveButtonText);
}
/**
* Exibe um jFileChooser.
*
* @param parent a tela pai
* @param approveButtonText o nome a ser exibido do botao de aceitacao
* @param title o titulo do jFileChooser
*
* @return esse eu nao entendi (nao fui eu que fiz esse codigo)
*/
public int showDialog(Component parent, String approveButtonText, String title)
throws HeadlessException {
if(approveButtonText != null) {
setApproveButtonText(approveButtonText);
setDialogType(CUSTOM_DIALOG);
}
meuDialog = createDialog(parent);
meuDialog.setTitle(title);
rescanCurrentDirectory();
meuDialog.show();
firePropertyChange("JFileChooserDialogIsClosingProperty", meuDialog, null);
return CANCEL_OPTION;
}
@Override
public void approveSelection() {
meuDialog.setVisible(false);
}
@Override
public void cancelSelection() {
setSelectedFile(null);
meuDialog.setVisible(false);
}
private class MyFileFilter extends FileFilter {
String description;
String[] formats;
public MyFileFilter(String description, String... formats) {
this.description = description;
this.formats = formats;
}
@Override
public boolean accept(File f) {
for(String ext : formats)
if(f.getName().endsWith('.'+ext))
return true;
return f.isDirectory();
}
@Override
public String getDescription() {
return description;
}
}
}
Very nice workaround, thank you.I had this same problem with JVLC. In fact I do not know how to resolve but I managed to identify that this occurs when you give a second dispose () in dialogs (with video playing).
Try this JFileChooser above that overloads where to dispose() of setVisible (false) and you can "solve" the problem.
Hi sherington, nice work with the VLCJ
The marquee and logo is only possible that way because there are new API functions exposed in libvlc 1.1.0. There's nothing that I know about exposed in the libvlc API for those other effects.I saw that you can add in VLCJ Marquee and Logo in this way. Its possible do this with the video effects ? (Invert, noise ...) Or Change the transcoding line is this way ?
This is a hard problem to pin down since the workaround is not needed with my 1.1 bindings and vlc 1.1.0 - it all works just fine with 1.1.0, and since that's where everyone should be now I guess we can forget about this particular problem.Very nice workaround, thank you.I had this same problem with JVLC. In fact I do not know how to resolve but I managed to identify that this occurs when you give a second dispose () in dialogs (with video playing).
Try this JFileChooser above that overloads where to dispose() of setVisible (false) and you can "solve" the problem.
Code: Select all
Properties p = System.getProperties();
p.setProperty("jna.library.path", p.getProperty("jna.library.path") + File.pathSeparator + "lib");
Code: Select all
String plugin = "--plugin-path=plugins";
this.mediaPlayerFactory = new MediaPlayerFactory(new String[]{plugin});
Code: Select all
No accelerated IMDCT transform found
get_buffer() failed (stride changed)
Invalid memory access of location 0x12e75053000 rip=0x7fff87522120
Java Result: 139
If I knew what to do I would already have done it.I do not know what I gotta do to develop a MacCanvas (similar to what you did with WindowsCanvas). Do you have any tips?
Presumably you mean in the same Java application? Not easily. You'd probably have to muck about with Java class loaders and JNA library settings. Just use 1.1!1.) Is it possible to have more than one version of VLCJ? For example, if someone has VLC 1.0.6 installed and another VLC 1.1 that the software still works.
You need to realise the Java bindings are simply calling the underlying libvlc API. When you call getTime() on the Java bindings, you are simply calling the libvlc get_time() function. What you're seeing returned is whatever libvlc is returning at the time you called it.2.) I found an issue regarding the time returned by VLCJ: my program needs to be updated every 100ms which is done by a thread. This thread retrieves the current playtime and displays it. JMF returned nearly always 100ms steps but VLCJ sometimes returns twice 0.167 and then the next higher time is 0.384 or something like that. Does somebody know how to tell VLCJ to return always 100ms steps without skipping some times or is it not possible? I cannot go to seconds level because I need to be more granular in case of time.
This was never a great implementation because it simply uses the AWT Robot class to do a partial screen capture - that explains why it doesn't work if something else is overlaying it. You could make sure you do window.toFront() before you invoke the method.But now I have found another issue regarding the function getVideoSurfaceContents(): it does not return the video surface like in 1.0.3 instead I get a black surface (because I have initialized it black) and if a window is overlaying this part will now be taken as surface but the video itself not.
Use the other snapshot function, e.g. mediaPlayer.getShapshot(). This calls the native libvlc snapshot function with a temporary file name, and then it loads that file as a BufferedImage and deletes the temporary file.How could I else get the currently displayed frame.
That's not a Java bindings issue, these are options you pass to libvlc, I can't remember what they are however.And another question: how could I remove the filename displayed within the video when I start to play it?
Code: Select all
--no-osd
--no-video-title-show
--no-overlay
Setting the plugin path should not be needed. That is to say, LibVLC is supposed to scan for plugins inside the directory from where it was loaded. For instance /usr/lib/libvlc.so will load plugins from /usr/lib/vlc/plugins/. This is supposed to work on Linux and Windows. On BSD and Solaris, the path will be hard-coded at compilation time (which should be OK on those platforms anyway). On MacOS X, there is some autodetection, though I don't know if it depends on the VLCKit.yeah. as it turns out i had a relative path to the plugins directory in my code, replaced it with the full path and it all works now.Aren't those type of errors usually because of the plugin-path setting being missing?edit: okay recompiling the drivers was gonna be more effort than it was worth, i have however installed a 32-bit JDK and run the application in that and it seems to work although i get 'no access module matched "any"' errors. back to the drawing board...
Thanks to a vlcj user contribution we now have this working in the vlcj Java bindings. It's pretty experimental right now and the API will surely change, but if any vlcj users want to try it out (I've had a few people asking me about whether this was possible in Java) then check out the latest code from the vlcj googlecode project and have a look. Any feedback on how this functionality should be presented and used in the vlcj API would be welcome.libvlc_video_set_callbacks() and libvlc_video_set_format() allow grabbing video frames from a chosen memory location in real-time
I always reply to my email, so I must not have received anything from you.Ok I recasted the mediaPlayer object to WindowsEmbeddedMediaPlayer for the setVideoSurface() and can compile. Bad news is when creating the instance of vlc the code now hangs as if the creation is taking forever. This is new since I upgraded to vlcj 1.1.1. I will let you know what I find. Please update your test code because you might run into the same issues I am.
Thanks,
-Tony
Return to “Development around libVLC”
Users browsing this forum: No registered users and 4 guests