[vlc-devel] Re: jvlc-win32-060612 not playing video
Pantelis Evgenidis
peyg at intracom.gr
Fri Jul 21 17:50:30 CEST 2006
Now I am replying to myself... How cool IS that?
Ok it seems I found a solution to play video using the VlcClient test
application. The problem was
exactly, that the full path to vlc.exe was not passed neither
discovered. Since I needed fast my
solution has alot of stuff hardcoded and further changes should be made,
but at least it plays.
I will paste the patch file I created in here so anyone who wants can
use it.
**You just copy - paste it to a new file <foo.patch> in <some_dir>, and
from a *nix environment go to
vlc-trunk/bindings/java
and type
patch -Np0 -i <some_dir>/<foo.patch>
(** special grant for all you newbie *nixers :-))) )
Just a few comments on my changes:
- In VlcClient.java I have changed the jvlc.playlist.add method to point
to my home dir.
unfortunately the text field of the playa is not doing much yet.
- In JVLC.java using the System.LoadLibrary method does not distinguish
between .so or .dll
libraries
- The "major" change I did was on vlc-libvlc-jni.cc and is due to the
fact (I think) that g++ is
kinda stricter where casting is required than gcc (maybe only in
windows?). That, and the fact
that allocating a 1 by 5 char array cannot hold a windoze path :-))).
Thats it more or less, it is not perfect, I'm not even sure its good,
but... it works. Thanks again Fillippo for
the path hint.
Cheers
Pantelis
diff -Nur java.ori/VlcClient.java java/VlcClient.java
--- java.ori/VlcClient.java 2006-07-21 18:21:18.015625000 +0300
+++ java/VlcClient.java 2006-07-21 18:21:10.890625000 +0300
@@ -22,7 +22,6 @@
jvcc = new JVLCPanel();
jvlc = jvcc.getJVLCObject();
-
setLayout(new java.awt.GridBagLayout());
gridBagConstraints = new java.awt.GridBagConstraints();
@@ -45,7 +44,7 @@
add( fullScreenButton, gridBagConstraints);
- jTextField1.setText("file:///home/little/a.avi");
+ jTextField1.setText("file://C:\\cygwin\\home\\peyg\\a.avi");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
@@ -116,7 +115,7 @@
}
private void setButtonActionPerformed(java.awt.event.ActionEvent evt) {
- jvlc.playlist.add("file:///home/little/a.avi", "a.avi");
+ jvlc.playlist.add("file://C:\\cygwin\\home\\peyg\\a.avi", "a.avi");
jvlc.playlist.play(-1, null);
}
diff -Nur java.ori/org/videolan/jvlc/JVLC.java
java/org/videolan/jvlc/JVLC.java
--- java.ori/org/videolan/jvlc/JVLC.java 2006-07-21
18:21:44.859375000 +0300
+++ java/org/videolan/jvlc/JVLC.java 2006-07-21 18:21:35.203125000 +0300
@@ -36,7 +36,7 @@
public class JVLC implements JLibVLC, Runnable {
static {
- System.load(System.getProperty( "user.dir" ) + "/libjvlc.so" );
+ System.loadLibrary("jvlc");
}
/**
diff -Nur java.ori/vlc-libvlc-jni.cc java/vlc-libvlc-jni.cc
--- java.ori/vlc-libvlc-jni.cc 2006-07-21 18:21:02.484375000 +0300
+++ java/vlc-libvlc-jni.cc 2006-07-21 18:20:41.453125000 +0300
@@ -43,11 +43,25 @@
// res is the pointer to libvlc_instance_t
long res;
libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc(
sizeof( libvlc_exception_t ));
- char temp_argv[1][5] = {""};
+
+ char** temp_argv;
+
+ /* Let's just say we have 5 args in total */
+ temp_argv = (char**) malloc( sizeof(int) * 5 );
+
+ /* Now we calloc each arg with a length of 512 */
+ for (int i = 0; i < 5; i++)
+ {
+ temp_argv[i] = (char*) calloc( sizeof(char), 512 );
+ }
libvlc_exception_init( exception );
- res = ( long ) libvlc_new( 0, (char **)temp_argv, exception );
+ sprintf( temp_argv[0], "%s", "C:\\Program
Files\\VideoLAN\\VLC\\vlc.exe" );
+ temp_argv[1] = '\0';
+ res = ( long ) libvlc_new( 1, temp_argv, exception );
+
+
if ( libvlc_exception_raised( exception ))
{
Pantelis Evgenidis wrote:
> Filippo Carone wrote:
>
>> Pantelis Evgenidis ha scritto:
>>
>>> Now to the matter at hand.
>>> There is problem in org/videolan/JVLC.java
>>> I have replaced the following line
>>> System.load(System.getProperty( "user.dir" ) + "/libjvlc.so" );
>>> with:
>>> System.loadLibrary("jvlc");
>>>
>>> Unfortunately when I try to run the test I get an
>>> EXCEPTION_ACCESS_VIOLATION
>>
>>
>>
>> Win32 is a really hostile environment :). It is really difficult for
>> me to follow what happens here, since I don't have a win32 pc atm.
>
>
> Couldn't agree more.
>
>>
>> Anyone giving me access to a win32 machine?
>
>
> Do what I do. I'm running SuSe 10.0 and I have installed winXP on
> VMWare. Really awkward though running linux and on top winXP and
> installing cygwin for development...
>
>>
>> Cheers,
>> Filippo
>>
>
--
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
More information about the vlc-devel
mailing list