1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
/*
* Main.java
*
* Created on 26 June 2007, 11:45
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package javaapplication4;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import org.videolan.jvlc.JVLC;
import org.videolan.jvlc.VLCException;
public class Main
{
public Main()
{
}
public static void main( String[] Args )
{
String[] args = new String[1];
args[0] = "-vvv";
boolean videoInput = false;
JVLC jvlc = new JVLC(Args);
try
{
jvlc.playlist.add("file://c:\\a.avi", "a.avi");
jvlc.playlist.add("file://c:\\c.avi", "c.avi");
jvlc.playlist.play( -1 , null );
}
catch (VLCException e)
{
e.printStackTrace();
}
while (! jvlc.isInputPlaying()) ;
while (! jvlc.hasVout() );
try
{
Thread.sleep(2500);
if (jvlc.hasVout()) videoInput = true;
}
catch (InterruptedException e)
{
e.printStackTrace();
}
if (videoInput)
{
try
{
System.out.print(jvlc.video.getWidth());
System.out.print("x");
System.out.println(jvlc.video.getHeight());
}
catch (VLCException e)
{
e.printStackTrace();
}
}
try
{
if (videoInput)
{
System.out.print("Fullscreen... ");
jvlc.video.setFullscreen(true);
Thread.sleep(3000);
System.out.println("real size.");
jvlc.video.setFullscreen(false);
System.out.print("Taking snapshot... ");
jvlc.video.getSnapshot( System.getProperty( "user.dir" ) + "/snap.png");
System.out.println("taken. (see " + System.getProperty( "user.dir" ) + "/snap.png )");
Thread.sleep(2000);
System.out.println("Resizing to 300x300");
jvlc.video.setSize(300, 300);
}
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");
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();
}
System.out.println("Everything fine ;)");
System.out.println("Playing next item");
try
{
jvlc.playlist.next();
}
catch (VLCException e)
{
e.printStackTrace();
}
try
{
Thread.sleep(3000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
jvlc.destroy();
return;
}
} |
Partager