Changeset f8b641ed9bf0cec1a945ec5bebdd136e2acfc7d0

Show
Ignore:
Timestamp:
03/09/08 12:38:57 (6 months ago)
Author:
Filippo Carone <littlejohn@videolan.org>
git-committer:
Filippo Carone <littlejohn@videolan.org> 1205062737 +0100
git-parent:

[9ac46b4ed4c5f904a4cd13674dc710e751febdba]

git-author:
Filippo Carone <littlejohn@videolan.org> 1205062737 +0100
Message:

vlcexample shows audio class uses

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bindings/java/VLCExample.java

    rdaa85a7 rf8b641e  
     1import org.videolan.jvlc.Audio; 
    12import org.videolan.jvlc.JVLC; 
    23import org.videolan.jvlc.MediaDescriptor; 
    34import org.videolan.jvlc.MediaInstance; 
    4 import org.videolan.jvlc.Playlist; 
    55import org.videolan.jvlc.VLCException; 
    66import org.videolan.jvlc.Video; 
     
    1414    { 
    1515        System.out.println("== Starting VLCExample =="); 
    16         boolean videoInput = false; 
    1716        if (args.length == 0) 
    1817        { 
     
    2827        } 
    2928        JVLC jvlc = new JVLC(args); 
    30         Playlist playlist = new Playlist(jvlc); 
    3129        System.out.println("... done."); 
    32          
    33         MediaDescriptor mediaDescriptor = new MediaDescriptor(jvlc, "/home/carone/a.avi"); 
     30 
     31        MediaDescriptor mediaDescriptor = new MediaDescriptor(jvlc, "/home/carone/apps/a.avi"); 
    3432        MediaInstance mediaInstance = mediaDescriptor.getMediaInstance(); 
    3533 
    3634        mediaInstance.addListener(new MediaInstanceListener() 
    3735        { 
     36 
    3837            @Override 
    3938            public void endReached(MediaInstance mediaInstance) 
     
    6766        }); 
    6867        mediaInstance.play(); 
    69          
    70         // MediaInstance mediaInstance = playlist.getMediaInstance(); 
    71         //         
    72         // while (! mediaInstance. playlist.isPlaying()) 
    73         // { 
    74         // Thread.sleep(100); 
    75         // } 
    76         // while (! jvlc.hasVout() ) 
    77         // { 
    78         // Thread.sleep(100); 
    79         // } 
    8068 
    81         // testing vout functionalities 
    82         // Thread.sleep(2500); 
    83         // if (jvlc.hasVout()) 
    84         // { 
    85         // videoInput = true; 
    86         // } 
    87         //         
    88         // if (videoInput) 
    89         // { 
     69        while (!mediaInstance.hasVideoOutput()) 
     70        { 
     71            Thread.sleep(100); 
     72        } 
     73 
    9074        try 
    9175        { 
     
    11195        } 
    11296 
    113         // System.out.print("Muting..."); 
    114         // jvlc.audio.setMute(true); 
    115         // Thread.sleep(3000); 
    116         // System.out.println("unmuting."); 
    117         // jvlc.audio.setMute(false); 
    118         // Thread.sleep(3000); 
    119         // System.out.println("Volume is: " + jvlc.audio.getVolume()); 
    120         // System.out.print("Setting volume to 150... "); 
    121         // jvlc.audio.setVolume(150); 
    122         // System.out.println("done"); 
    123         // System.out.println("== AUDIO INFO =="); 
    124         // int currentChannel = jvlc.audio.getChannel(); 
    125         // System.out.println("Audio track number: " + jvlc.audio.getTrack()); 
    126         // System.out.println("Audio channel info: " + jvlc.audio.getChannel()); 
    127         // System.out.print("Setting left channel... "); 
    128         // jvlc.audio.setChannel(AudioIntf.LEFT_CHANNEL); 
    129         // System.out.println("done."); 
    130         // Thread.sleep(3000); 
    131         // System.out.print("Setting right channel... "); 
    132         // jvlc.audio.setChannel(AudioIntf.RIGHT_CHANNEL); 
    133         // System.out.println("done."); 
    134         // Thread.sleep(3000); 
    135         // System.out.print("Reverting to original channel"); 
    136         // jvlc.audio.setChannel(currentChannel); 
    137         // System.out.println("done."); 
    138         // Thread.sleep(3000); 
    139         // System.out.println("INPUT INFORMATION"); 
    140         // System.out.println("-----------------"); 
    141         // System.out.println("Total length (ms) :\t" + jvlc.input.getLength()); 
    142         // System.out.println("Input time (ms) :\t" + jvlc.input.getTime()); 
    143         // System.out.println("Input position [0-1]:\t" + jvlc.input.getPosition()); 
    144         // if (videoInput) 
    145         // System.out.println("Input FPS :\t" + jvlc.input.getFPS()); 
    146         // 
    147         // } 
    148         // 
    149         // catch (Exception e) 
    150         // { 
    151         // System.out.println("Something was wrong. I die :(."); 
    152         // jvlc.destroy(); 
    153         // e.printStackTrace(); 
    154         // System.exit(0); 
    155         // } 
     97        System.out.print("Muting..."); 
     98        Audio audio = new Audio(jvlc); 
     99        audio.setMute(true); 
     100        Thread.sleep(3000); 
     101        System.out.println("unmuting."); 
     102        audio.setMute(false); 
     103        Thread.sleep(3000); 
     104        System.out.println("Volume is: " + audio.getVolume()); 
     105        System.out.print("Setting volume to 150... "); 
     106        audio.setVolume(150); 
     107        System.out.println("done"); 
     108        System.out.println("== AUDIO INFO =="); 
     109        System.out.println("Audio track number: " + audio.getTrack(mediaInstance)); 
     110        System.out.println("Audio channel info: " + audio.getChannel()); 
     111        Thread.sleep(3000); 
     112        System.out.println("MEDIA INSTANCE INFORMATION"); 
     113        System.out.println("--------------------------"); 
     114        System.out.println("Total length (ms) :\t" + mediaInstance.getLength()); 
     115        System.out.println("Input time (ms) :\t" + mediaInstance.getTime()); 
     116        System.out.println("Input position [0-1]:\t" + mediaInstance.getPosition()); 
     117        System.out.println("Input FPS :\t" + mediaInstance.getFPS()); 
    156118 
    157119        System.out.println("Everything fine ;)"); 
    158         System.out.println("Playing next item"); 
    159         // try 
    160         // { 
    161         // jvlc.playlist.next(); 
    162         // } 
    163         // catch (VLCException e) 
    164         // { 
    165         // e.printStackTrace(); 
    166         // } 
    167         // 
    168         // Thread.sleep(3000); 
    169  
    170         // jvlc.destroy(); 
    171120        return; 
    172121    }