]> git.sesse.net Git - vlc/blob - bindings/java/org/videolan/jvlc/Video.java
fcb234410e5f9199cad91256a2bb6bc353b8fecb
[vlc] / bindings / java / org / videolan / jvlc / Video.java
1 /**
2  * 
3  */
4 package org.videolan.jvlc;
5
6 import java.awt.Dimension;
7 import java.awt.Graphics;
8
9 public final class Video implements VideoIntf {
10         
11         private long libvlcInstance;
12         
13     private JVLCCanvas actualCanvas;
14     
15         public Video( long libvlcInstance) {
16                 this.libvlcInstance = libvlcInstance;
17         }
18
19         /*
20      * Video native methods
21      */
22     private native void                 _toggleFullscreen();
23     private native void                 _setFullscreen( boolean value);
24     private native boolean              _getFullscreen();
25     private native int                  _getHeight();
26     private native int                  _getWidth();
27     private native void                 _getSnapshot(String filename,int width,int height);
28     private native void                 _destroyVideo();
29     private native void                 _reparent(JVLCCanvas component);
30     private native void                 _setSize(int width, int height);
31     private native void                 _paint(JVLCCanvas canvas, Graphics g);
32
33         /* (non-Javadoc)
34          * @see org.videolan.jvlc.VideoIntf#destroyVideo()
35          */
36         public void destroyVideo() throws VLCException {
37                 _destroyVideo();
38         }
39
40         /* (non-Javadoc)
41          * @see org.videolan.jvlc.VideoIntf#getFullscreen()
42          */
43         public boolean getFullscreen() throws VLCException {
44                 return _getFullscreen();
45         }
46
47         /* (non-Javadoc)
48          * @see org.videolan.jvlc.VideoIntf#getSnapshot(java.lang.String)
49          */
50         public void getSnapshot(String filepath,int width,int height) throws VLCException {
51                 _getSnapshot( filepath , width, height);
52         }
53
54         /* (non-Javadoc)
55          * @see org.videolan.jvlc.VideoIntf#getVideoHeight()
56          */
57         public int getHeight() throws VLCException {
58                 return _getHeight();
59         }
60
61         /* (non-Javadoc)
62          * @see org.videolan.jvlc.VideoIntf#getVideoWidth()
63          */
64         public int getWidth() throws VLCException {
65                 return _getWidth();
66         }
67
68         /* (non-Javadoc)
69          * @see org.videolan.jvlc.VideoIntf#reparentVideo(java.awt.Component)
70          */
71         public void reparent(JVLCCanvas c) throws VLCException {
72                 _reparent(c);
73                 setActualCanvas(c);
74         }
75
76         /* (non-Javadoc)
77          * @see org.videolan.jvlc.VideoIntf#resizeVideo(int, int)
78          */
79         public void setSize(int width, int height) throws VLCException {
80                 _setSize( width, height );
81         }
82
83         /* (non-Javadoc)
84          * @see org.videolan.jvlc.VideoIntf#setFullscreen(boolean)
85          */
86         public void setFullscreen(boolean fullscreen) throws VLCException {
87                 _setFullscreen( fullscreen );
88         }
89
90         /* (non-Javadoc)
91          * @see org.videolan.jvlc.VideoIntf#toggleFullscreen()
92          */
93         public void toggleFullscreen() throws VLCException {
94                 _toggleFullscreen();
95         }
96         
97         /* (non-Javadoc)
98          * @see org.videolan.jvlc.VideoIntf#getSize()
99          */
100         public Dimension getSize() throws VLCException {
101                 return new Dimension (getWidth(), getHeight());
102         }
103
104         /* (non-Javadoc)
105          * @see org.videolan.jvlc.VideoIntf#setSize(java.awt.Dimension)
106          */
107         public void setSize(Dimension d) throws VLCException {
108                 setSize(d.width, d.height);
109         }
110         
111         public void paint(Graphics g) {
112                 _paint(actualCanvas, g);
113         }
114
115         public void setActualCanvas(JVLCCanvas canvas) {
116                 actualCanvas = canvas;
117         }
118         
119         public long getInstance() {
120                 return libvlcInstance;
121         }
122         
123 }