~ubuntu-branches/ubuntu/maverick/vlc/maverick

« back to all changes in this revision

Viewing changes to bindings/java/VLCExample.java

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-09-17 21:56:14 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20080917215614-tj0vx8xzd57e52t8
Tags: 0.9.2-1ubuntu1
* New Upstream Release, exception granted by
    - dktrkranz, norsetto, Hobbsee (via irc). LP: #270404

Changes done in ubuntu:

* add libxul-dev to build-depends
* make sure that vlc is build against libxul in configure. This doesn't
  change anything in the package, but makes it more robust if building
  in an 'unclean' chroot or when modifying the package.
* debian/control: make Vcs-* fields point to the motumedia branch
* add libx264-dev and libass-dev to build-depends
  LP: #210354, #199870
* actually enable libass support by passing --enable-libass to configure
* enable libdca: add libdca-dev to build depends and --enable-libdca
* install the x264 plugin.

Changes already in the pkg-multimedia branch in debian:

* don't install usr/share/vlc/mozilla in debian/mozilla-plugin-vlc.install  
* new upstream .desktop file now registers flash video mimetype LP: #261567
* add Xb-Npp-Applications to mozilla-plugin-vlc
* remove duplicate entries in debian/vlc-nox.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import org.videolan.jvlc.JVLC;
2
 
import org.videolan.jvlc.VLCException;
3
 
 
4
 
 
5
 
public class VLCExample 
6
 
{
7
 
 
8
 
    public static void main( String[] args )
9
 
    {
10
 
        boolean videoInput = false;
11
 
        JVLC jvlc = new JVLC(args);
12
 
        try {
13
 
        jvlc.playlist.add("file://" + System.getProperty( "user.dir" ) + "/a.avi", "a.avi");
14
 
        jvlc.playlist.add("file://" + System.getProperty( "user.dir" ) + "/a.mp3", "a.mp3");
15
 
        jvlc.playlist.play( -1 , null );
16
 
        } catch (VLCException e) {
17
 
                e.printStackTrace();
18
 
        }
19
 
        while (! jvlc.isInputPlaying()) ;
20
 
        while (! jvlc.hasVout() );        
21
 
        
22
 
        
23
 
        
24
 
        // testing vout functionalities
25
 
 
26
 
        try {
27
 
                Thread.sleep(2500);
28
 
                if (jvlc.hasVout()) videoInput = true;
29
 
                } catch (InterruptedException e) {
30
 
                                e.printStackTrace();
31
 
                }
32
 
 
33
 
        if (videoInput) {
34
 
                try {
35
 
                        System.out.print(jvlc.video.getWidth());
36
 
                        System.out.print("x");
37
 
                        System.out.println(jvlc.video.getHeight());
38
 
                } catch (VLCException e) {
39
 
                        e.printStackTrace();
40
 
                }
41
 
        }
42
 
        try 
43
 
        {
44
 
                if (videoInput) {
45
 
                        System.out.print("Fullscreen... ");             
46
 
                        jvlc.video.setFullscreen(true);
47
 
                        Thread.sleep(3000);
48
 
                        System.out.println("real size.");
49
 
                jvlc.video.setFullscreen(false);
50
 
                System.out.print("Taking snapshot... ");
51
 
                jvlc.video.getSnapshot( System.getProperty( "user.dir" ) + "/snap.png");
52
 
                System.out.println("taken. (see " + System.getProperty( "user.dir" ) + "/snap.png )");
53
 
                        Thread.sleep(2000);
54
 
                System.out.println("Resizing to 300x300");
55
 
                jvlc.video.setSize(300, 300);
56
 
                                
57
 
                }
58
 
            System.out.print("Muting...");
59
 
            jvlc.audio.setMute(true);
60
 
            Thread.sleep(3000);
61
 
            System.out.println("unmuting.");
62
 
            jvlc.audio.setMute(false);
63
 
            Thread.sleep(3000);
64
 
            System.out.println("Volume is: " + jvlc.audio.getVolume());
65
 
            System.out.print("Setting volume to 150... ");
66
 
            jvlc.audio.setVolume(150);
67
 
            System.out.println("done");
68
 
            Thread.sleep(3000);
69
 
            System.out.println("INPUT INFORMATION");
70
 
            System.out.println("-----------------");
71
 
            System.out.println("Total length   (ms) :\t" + jvlc.input.getLength());
72
 
            System.out.println("Input time     (ms) :\t" + jvlc.input.getTime());
73
 
            System.out.println("Input position [0-1]:\t" + jvlc.input.getPosition());
74
 
            if (videoInput)
75
 
                System.out.println("Input FPS          :\t" + jvlc.input.getFPS());
76
 
           
77
 
            
78
 
        }
79
 
        
80
 
        catch (Exception e) 
81
 
        {
82
 
                System.out.println("Something was wrong. I die :(.");
83
 
            jvlc.destroy();
84
 
        }
85
 
        
86
 
        System.out.println("Everything fine ;)");
87
 
        System.out.println("Playing next item");
88
 
        try {
89
 
                jvlc.playlist.next();
90
 
        } catch (VLCException e) {
91
 
                e.printStackTrace();
92
 
        }
93
 
        
94
 
        try {
95
 
                Thread.sleep(3000);
96
 
        } catch (InterruptedException e) {
97
 
                e.printStackTrace();
98
 
        }
99
 
        jvlc.destroy();
100
 
        return;
101
 
    }
102
 
}
103