]> git.sesse.net Git - vlc/blob - bindings/java/core/src/main/java/org/videolan/jvlc/Video.java
Add some locking.
[vlc] / bindings / java / core / src / main / java / org / videolan / jvlc / Video.java
1 /*****************************************************************************
2  * Video.java: JVLC Video Output
3  *****************************************************************************
4  *
5  * Copyright (C) 1998-2008 the VideoLAN team
6  * 
7  * Author: Filippo Carone <filippo@carone.org>
8  *         Philippe Morin <phmorin@free.fr>
9  *
10  * Created on 28-feb-2006
11  *
12  * $Id: JVLC.java 20141 2007-05-16 19:31:35Z littlejohn $
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2 of the
17  * License, or (at your option) any later version.
18  * 
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * General Public License for more details.
23  * 
24  * You should have received a copy of the GNU General Public
25  * License along with this program; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
27  * 
28  */
29 package org.videolan.jvlc;
30
31 import java.awt.Dimension;
32
33 import org.videolan.jvlc.internal.LibVlc;
34 import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
35
36 public class Video
37 {
38
39     private final LibVlc libvlc;
40
41     public Video( JVLC jvlc) {
42         this.libvlc = jvlc.getLibvlc();
43     }
44
45     /** (non-Javadoc)
46      * @deprecated
47      * @since 
48      */
49     public void destroyVideo(MediaPlayer media)
50     {
51         return;
52     }
53
54     /* (non-Javadoc)
55      * @see org.videolan.jvlc.VideoIntf#getFullscreen()
56      */
57     public boolean getFullscreen(MediaPlayer media)  {
58         libvlc_exception_t exception = new libvlc_exception_t();
59         return libvlc.libvlc_get_fullscreen(media.getInstance(), exception) == 1 ? true : false;
60     }
61
62     /* (non-Javadoc)
63      * @see org.videolan.jvlc.VideoIntf#getSnapshot(java.lang.String)
64      */
65     public void getSnapshot(MediaPlayer media, String filepath, int width, int height)  {
66         libvlc_exception_t exception = new libvlc_exception_t();
67         libvlc.libvlc_video_take_snapshot(media.getInstance(), filepath, width, height, exception);
68     }
69
70     /* (non-Javadoc)
71      * @see org.videolan.jvlc.VideoIntf#getVideoHeight()
72      */
73     public int getHeight(MediaPlayer media)  {
74         libvlc_exception_t exception = new libvlc_exception_t();
75         return libvlc.libvlc_video_get_height(media.getInstance(), exception);
76     }
77
78     /* (non-Javadoc)
79      * @see org.videolan.jvlc.VideoIntf#getVideoWidth()
80      */
81     public int getWidth(MediaPlayer media)  {
82         libvlc_exception_t exception = new libvlc_exception_t();
83         return libvlc.libvlc_video_get_width(media.getInstance(), exception);
84     }
85
86     /**
87      * @deprecated
88      */
89     public void reparent(MediaPlayer media, java.awt.Canvas canvas)  {
90     }
91
92     /**
93      * @deprecated
94      */
95     public void setSize(int width, int height)  {
96     }
97
98     public void setFullscreen(MediaPlayer media, boolean fullscreen)  {
99         libvlc_exception_t exception = new libvlc_exception_t();
100         libvlc.libvlc_set_fullscreen(media.getInstance(), fullscreen? 1 : 0, exception);
101     }
102
103     public void toggleFullscreen(MediaPlayer media)  {
104         libvlc_exception_t exception = new libvlc_exception_t();
105         libvlc.libvlc_toggle_fullscreen(media.getInstance(), exception);
106     }
107
108     public Dimension getSize(MediaPlayer media)  {
109         return new Dimension (getWidth(media), getHeight(media));
110     }
111
112     
113     /**
114      * @param d
115      * @deprecated
116      */
117     public void setSize(Dimension d)  {
118         setSize(d.width, d.height);
119     }
120 }