JVLC on Linux with JInternalFrame: X11 errors

*nix specific usage questions
glebfrank
Blank Cone
Blank Cone
Posts: 10
Joined: 09 Dec 2008 08:39

JVLC on Linux with JInternalFrame: X11 errors

Postby glebfrank » 14 Mar 2009 01:24

Hello,

I'm trying to use JVLC as part of a larger Java application. Things seem to work OK on Windows. On Linux, however, I'm getting an error from X11 video output:

Code: Select all

[????????] x11 video output error: X11 request 147.4 failed with error code 8: BadMatch (invalid parameter attributes) X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 147 (MIT-SHM) Minor opcode of failed request: 4 (X_ShmGetImage) Serial number of failed request: 1813 Current serial number in output stream: 1813
What's interesting is that this happens even after I disabled the shared memory for VLC.... Switching between --vout=xvideo and x11 doesn't change anything. I'm currently using vlc that I built from Git a couple of days ago. This issue, however, is nothing new: I've been having it with all stable vlc versions (latest was 0.9.8a).

Anyway, I'm attaching a slightly modified version of VlcClient from samples directory; the chief difference is that it puts VLC's canvas in a JInternalFrame. Steps to reproduce the problem:

1) Start VlcClient. You'll need JVLC and JNA on the classpath.
2) Type or paste a valid file path for a movie into the edit box
3) Click Set Item. The movie should start playing.
4) Start resizing the main window, making it smaller. As soon as the window boundary touches the JInternalFrame boundary, boom.

(In fact, even if you don't do the resizing, it crashes after a while; this just makes it quick.)

I attach my code:

Code: Select all

/***************************************************************************** * VlcClient.java: Sample Swing player ***************************************************************************** * Copyright (C) 1998-2006 the VideoLAN team * * Created on 28-feb-2006 * * $Id: AudioIntf.java 8 2006-02-28 12:03:47Z little $ * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * */ import java.awt.Canvas; import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.*; import java.awt.BorderLayout; //import javax.swing.JFrame; import org.videolan.jvlc.JVLC; import org.videolan.jvlc.Playlist; import org.videolan.jvlc.VLCException; class VLCPlayerFrame extends JInternalFrame { private Playlist playlist; public Canvas jvcanvas; public VLCPlayerFrame() { initComponents(); } private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; fullScreenButton = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); setButton = new javax.swing.JButton(); pauseButton = new javax.swing.JButton(); stopButton = new javax.swing.JButton(); jvcc = new JPanel(); jvcanvas = new java.awt.Canvas(); jvcanvas.setSize(200, 200); jvcc.add(jvcanvas); jvlc = new JVLC(new String[] {"-vvv", "--no-x11-shm", "--no-xvideo-shm"}); playlist = new Playlist(jvlc); setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.CENTER; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; getContentPane().add(jvcc, gridBagConstraints); fullScreenButton.setText("FullScreen"); fullScreenButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fullScreenButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; getContentPane().add(fullScreenButton, gridBagConstraints); jTextField1.setText("file:///home/frank/test.mp4"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; getContentPane().add(jTextField1, gridBagConstraints); setButton.setText("Set item"); setButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { setButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; getContentPane().add(setButton, gridBagConstraints); pauseButton.setText("Play/Pause"); pauseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pauseButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; getContentPane().add(pauseButton, gridBagConstraints); stopButton.setText("Stop"); stopButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { stopButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; getContentPane().add(stopButton, gridBagConstraints); pack(); } private void stopButtonActionPerformed(java.awt.event.ActionEvent evt) { try { playlist.stop(); } catch (Exception e) { e.printStackTrace(); } } private void pauseButtonActionPerformed(java.awt.event.ActionEvent evt) { try { playlist.togglePause(); } catch (Exception e) { e.printStackTrace(); } } private void setButtonActionPerformed(java.awt.event.ActionEvent evt) { try { jvlc.setVideoOutput(jvcanvas); playlist.add(jTextField1.getText(), "a.avi"); playlist.play(); } catch (VLCException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private void fullScreenButtonActionPerformed(java.awt.event.ActionEvent evt) { // jvlc.fullScreen(); } private javax.swing.JButton setButton; private javax.swing.JButton pauseButton; private javax.swing.JButton stopButton; private javax.swing.JButton fullScreenButton; private javax.swing.JTextField jTextField1; private JPanel jvcc; public JVLC jvlc; // MediaControlInstance mci; } public class VlcClient { public static void main(String[] args) { JFrame pfr = new JFrame("Parent"); JDesktopPane dtp = new JDesktopPane(); dtp.setPreferredSize(new java.awt.Dimension(1000, 1000)); pfr.add(dtp); pfr.pack(); pfr.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent ev) { System.exit(0); } }); pfr.setVisible(true); JInternalFrame f = new VLCPlayerFrame(); dtp.add(f); f.setVisible(true); } }

Rémi Denis-Courmont
Developer
Developer
Posts: 15215
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: JVLC on Linux with JInternalFrame: X11 errors

Postby Rémi Denis-Courmont » 14 Mar 2009 15:46

VLC does not use XShmGetImage. Anywhere. This error is coming from another part of your program using X11. Because Xlib has a single error handler, the error is sent to VLC, but the bug is somewhere else.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

glebfrank
Blank Cone
Blank Cone
Posts: 10
Joined: 09 Dec 2008 08:39

Re: JVLC on Linux with JInternalFrame: X11 errors

Postby glebfrank » 15 Mar 2009 00:40

Well, the full program is posted above; it's in Java and it certainly doesn't use XShmGetImage (whatever that is) directly - as I said, it's a very slight variation on the VlcClient.java file in JVLC's samples directory.

While it's possible that Java uses XShmGetImage under the hood somehow, whatever Java does with X does not result in errors like these - never seen that in many many years of Java application development. So I have a strong suspicion that JVLC is the culprit - something in the way it glues the VLC window into Java, perhaps?

Is there any additional information that I could provide to get this solved?

Thanks,
Gleb

glebfrank
Blank Cone
Blank Cone
Posts: 10
Joined: 09 Dec 2008 08:39

Re: JVLC on Linux with JInternalFrame: X11 errors

Postby glebfrank » 17 Mar 2009 22:22

So, no additional thoughts on this? Is this the right forum for this question - are the JVLC guys reading this, or is there a better way to get in touch with them? This is really an important issue for us...

bentium
New Cone
New Cone
Posts: 6
Joined: 22 Dec 2008 11:35

Re: JVLC on Linux with JInternalFrame: X11 errors

Postby bentium » 26 Mar 2009 13:34

i get exactly the same error in an application that uses jvlc with a vlc 0.9.3 on an opensuse 10 and ubuntu 8.04.

the application doesn't use jinternalframe, but regulare tabbedpanes.


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 4 guests