]> git.sesse.net Git - vlc/blob - mozilla/vlcpeer.cpp
* modules/mux/ogg.c: each ogg stream has to be cleared in OggCreateHeader().
[vlc] / mozilla / vlcpeer.cpp
1 /*****************************************************************************
2  * vlcpeer.cpp: scriptable peer descriptor
3  *****************************************************************************
4  * Copyright (C) 2002 VideoLAN
5  * $Id: vlcpeer.cpp,v 1.8 2003/09/21 10:23:59 gbazin Exp $
6  *
7  * Authors: Samuel Hocevar <sam@zoy.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <vlc/vlc.h>
28
29 #ifdef DEBUG
30 /* We do not want to use nsDebug.h */
31 #   undef DEBUG
32 #endif
33
34 #include <nsISupports.h>
35 #include <nsMemory.h>
36 #include <npapi.h>
37
38 #include "vlcpeer.h"
39 #include "vlcplugin.h"
40
41 NS_IMPL_ISUPPORTS2( VlcPeer, VlcIntf, nsIClassInfo )
42
43 /*****************************************************************************
44  * Scriptable peer constructor and destructor
45  *****************************************************************************/
46 VlcPeer::VlcPeer()
47 {
48     NS_INIT_ISUPPORTS();
49 }
50
51 VlcPeer::VlcPeer( VlcPlugin * plugin )
52 {
53     NS_INIT_ISUPPORTS();
54     p_plugin = plugin;
55 }
56
57 VlcPeer::~VlcPeer()
58 {
59     ;
60 }
61
62 /*****************************************************************************
63  * Scriptable peer methods
64  *****************************************************************************/
65 void VlcPeer::Disable()
66 {
67     p_plugin = NULL;
68 }
69
70 /*****************************************************************************
71  * Scriptable peer plugin methods
72  *****************************************************************************/
73 NS_IMETHODIMP VlcPeer::Play()
74 {
75     if( p_plugin )
76     {
77         if( !p_plugin->b_stream && p_plugin->psz_target )
78         {
79             VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target, 0, 0,
80                            PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
81             p_plugin->b_stream = 1;
82         }
83
84         VLC_Play( p_plugin->i_vlc );
85     }
86     return NS_OK;
87 }
88
89 NS_IMETHODIMP VlcPeer::Pause()
90 {
91     if( p_plugin )
92     {
93         VLC_Pause( p_plugin->i_vlc );
94     }
95     return NS_OK;
96 }
97
98 NS_IMETHODIMP VlcPeer::Stop()
99 {
100     if( p_plugin )
101     {
102         VLC_Stop( p_plugin->i_vlc );
103         p_plugin->b_stream = 0;
104     }
105     return NS_OK;
106 }
107
108 NS_IMETHODIMP VlcPeer::Fullscreen()
109 {
110     if( p_plugin )
111     {
112 #ifdef XP_MACOSX
113 #else
114         VLC_FullScreen( p_plugin->i_vlc );
115 #endif
116     }
117     return NS_OK;
118 }
119