[vlc-devel] commit: vlcexample shows audio class uses (Filippo Carone )

git version control git at videolan.org
Sun Mar 9 12:38:43 CET 2008


vlc | branch: master | Filippo Carone <littlejohn at videolan.org> | Sun Mar  9 12:38:57 2008 +0100| [f8b641ed9bf0cec1a945ec5bebdd136e2acfc7d0]

vlcexample shows audio class uses

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f8b641ed9bf0cec1a945ec5bebdd136e2acfc7d0
---

 bindings/java/VLCExample.java |  111 +++++++++++------------------------------
 1 files changed, 30 insertions(+), 81 deletions(-)

diff --git a/bindings/java/VLCExample.java b/bindings/java/VLCExample.java
index 29759fa..e679698 100644
--- a/bindings/java/VLCExample.java
+++ b/bindings/java/VLCExample.java
@@ -1,7 +1,7 @@
+import org.videolan.jvlc.Audio;
 import org.videolan.jvlc.JVLC;
 import org.videolan.jvlc.MediaDescriptor;
 import org.videolan.jvlc.MediaInstance;
-import org.videolan.jvlc.Playlist;
 import org.videolan.jvlc.VLCException;
 import org.videolan.jvlc.Video;
 import org.videolan.jvlc.event.MediaInstanceListener;
@@ -13,7 +13,6 @@ public class VLCExample
     public static void main(String[] args) throws InterruptedException
     {
         System.out.println("== Starting VLCExample ==");
-        boolean videoInput = false;
         if (args.length == 0)
         {
             System.out.print("Creating a JVLC instance without args");
@@ -27,14 +26,14 @@ public class VLCExample
             }
         }
         JVLC jvlc = new JVLC(args);
-        Playlist playlist = new Playlist(jvlc);
         System.out.println("... done.");
-        
-        MediaDescriptor mediaDescriptor = new MediaDescriptor(jvlc, "/home/carone/a.avi");
+
+        MediaDescriptor mediaDescriptor = new MediaDescriptor(jvlc, "/home/carone/apps/a.avi");
         MediaInstance mediaInstance = mediaDescriptor.getMediaInstance();
 
         mediaInstance.addListener(new MediaInstanceListener()
         {
+
             @Override
             public void endReached(MediaInstance mediaInstance)
             {
@@ -66,27 +65,12 @@ public class VLCExample
             }
         });
         mediaInstance.play();
-        
-        // MediaInstance mediaInstance = playlist.getMediaInstance();
-        //        
-        // while (! mediaInstance. playlist.isPlaying())
-        // {
-        // Thread.sleep(100);
-        // }
-        // while (! jvlc.hasVout() )
-        // {
-        // Thread.sleep(100);
-        // }
 
-        // testing vout functionalities
-        // Thread.sleep(2500);
-        // if (jvlc.hasVout())
-        // {
-        // videoInput = true;
-        // }
-        //        
-        // if (videoInput)
-        // {
+        while (!mediaInstance.hasVideoOutput())
+        {
+            Thread.sleep(100);
+        }
+
         try
         {
             Video video = new Video(jvlc);
@@ -110,64 +94,29 @@ public class VLCExample
             e.printStackTrace();
         }
 
-        // System.out.print("Muting...");
-        // jvlc.audio.setMute(true);
-        // Thread.sleep(3000);
-        // System.out.println("unmuting.");
-        // jvlc.audio.setMute(false);
-        // Thread.sleep(3000);
-        // System.out.println("Volume is: " + jvlc.audio.getVolume());
-        // System.out.print("Setting volume to 150... ");
-        // jvlc.audio.setVolume(150);
-        // System.out.println("done");
-        // System.out.println("== AUDIO INFO ==");
-        // int currentChannel = jvlc.audio.getChannel();
-        // System.out.println("Audio track number: " + jvlc.audio.getTrack());
-        // System.out.println("Audio channel info: " + jvlc.audio.getChannel());
-        // System.out.print("Setting left channel... ");
-        // jvlc.audio.setChannel(AudioIntf.LEFT_CHANNEL);
-        // System.out.println("done.");
-        // Thread.sleep(3000);
-        // System.out.print("Setting right channel... ");
-        // jvlc.audio.setChannel(AudioIntf.RIGHT_CHANNEL);
-        // System.out.println("done.");
-        // Thread.sleep(3000);
-        // System.out.print("Reverting to original channel");
-        // jvlc.audio.setChannel(currentChannel);
-        // System.out.println("done.");
-        // Thread.sleep(3000);
-        // System.out.println("INPUT INFORMATION");
-        // System.out.println("-----------------");
-        // System.out.println("Total length (ms) :\t" + jvlc.input.getLength());
-        // System.out.println("Input time (ms) :\t" + jvlc.input.getTime());
-        // System.out.println("Input position [0-1]:\t" + jvlc.input.getPosition());
-        // if (videoInput)
-        // System.out.println("Input FPS :\t" + jvlc.input.getFPS());
-        //
-        // }
-        //
-        // catch (Exception e)
-        // {
-        // System.out.println("Something was wrong. I die :(.");
-        // jvlc.destroy();
-        // e.printStackTrace();
-        // System.exit(0);
-        // }
+        System.out.print("Muting...");
+        Audio audio = new Audio(jvlc);
+        audio.setMute(true);
+        Thread.sleep(3000);
+        System.out.println("unmuting.");
+        audio.setMute(false);
+        Thread.sleep(3000);
+        System.out.println("Volume is: " + audio.getVolume());
+        System.out.print("Setting volume to 150... ");
+        audio.setVolume(150);
+        System.out.println("done");
+        System.out.println("== AUDIO INFO ==");
+        System.out.println("Audio track number: " + audio.getTrack(mediaInstance));
+        System.out.println("Audio channel info: " + audio.getChannel());
+        Thread.sleep(3000);
+        System.out.println("MEDIA INSTANCE INFORMATION");
+        System.out.println("--------------------------");
+        System.out.println("Total length (ms) :\t" + mediaInstance.getLength());
+        System.out.println("Input time (ms) :\t" + mediaInstance.getTime());
+        System.out.println("Input position [0-1]:\t" + mediaInstance.getPosition());
+        System.out.println("Input FPS :\t" + mediaInstance.getFPS());
 
         System.out.println("Everything fine ;)");
-        System.out.println("Playing next item");
-        // try
-        // {
-        // jvlc.playlist.next();
-        // }
-        // catch (VLCException e)
-        // {
-        // e.printStackTrace();
-        // }
-        //
-        // Thread.sleep(3000);
-
-        // jvlc.destroy();
         return;
     }
 }




More information about the vlc-devel mailing list