]> git.sesse.net Git - vlc/blob - modules/gui/wxwidgets/dialogs/vlm/vlm_wrapper.cpp
Merge branch 'master' of git@git.videolan.org:vlc
[vlc] / modules / gui / wxwidgets / dialogs / vlm / vlm_wrapper.cpp
1 /*****************************************************************************
2  * vlm_wrapper.cpp : Wrapper around VLM
3  *****************************************************************************
4  * Copyright (C) 2000-2005 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /* FIXME: This is not wx-specific */
25
26 #if 0
27 #include "dialogs/vlm/vlm_wrapper.hpp"
28
29 VLMWrapper::VLMWrapper( intf_thread_t *_p_intf )
30 {
31     p_intf = _p_intf;
32     p_vlm = NULL;
33 }
34
35 VLMWrapper::~VLMWrapper()
36 {
37    /* FIXME :you have to destroy vlm here to close
38     * but we shouldn't destroy vlm here in case somebody else wants it */
39    if( p_vlm )
40         vlm_Delete( p_vlm );
41 }
42
43 bool VLMWrapper::AttachVLM()
44 {
45     p_vlm = vlm_New( p_intf );
46     return p_vlm ? true: false ;
47 }
48
49 void VLMWrapper::LockVLM()
50 {
51     vlc_mutex_lock( &p_vlm->object_lock );
52 }
53
54 void VLMWrapper::UnlockVLM()
55 {
56     vlc_mutex_unlock( &p_vlm->object_lock );
57 }
58
59 void VLMWrapper::AddBroadcast( const char* name, const char* input,
60                                const char* output,
61                                bool b_enabled, bool b_loop  )
62 {
63     vlm_message_t *message;
64     string command = "new \"" + string(name) + "\" broadcast";
65     vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
66     vlm_MessageDelete( message );
67     EditBroadcast( name, input, output, b_enabled, b_loop );
68 }
69
70 void VLMWrapper::EditBroadcast( const char* name, const char* input,
71                                const char* output,
72                                bool b_enabled, bool b_loop  )
73 {
74     vlm_message_t *message;
75     string command;
76     command = "setup \"" + string(name) + "\" inputdel all";
77     vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
78     vlm_MessageDelete( message );
79     command = "setup \"" + string(name) + "\" input \"" + string(input) + "\"";
80     vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
81     vlm_MessageDelete( message );
82     if( strlen(output) > 0 )
83     {
84         command = "setup \"" + string(name) + "\" output \"" + string(output) + "\"";
85         vlm_ExecuteCommand( p_vlm, (char*)command.c_str(), &message );
86         vlm_MessageDelete( message );
87     }
88     if( b_enabled )
89     {
90         command = "setup \"" + string(name) + "\" enabled";
91         vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
92         vlm_MessageDelete( message );
93     }
94     if( b_loop )
95     {
96         command = "setup \"" + string(name) + "\" loop";
97         vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
98         vlm_MessageDelete( message );
99     }
100 }
101
102 void VLMWrapper::AddVod( const char* name, const char* input,
103                          const char* output,
104                          bool b_enabled, bool b_loop  )
105 {
106     vlm_message_t *message;
107     string command = "new \"" + string(name) + "\" vod";
108     vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
109     vlm_MessageDelete( message );
110     EditVod( name, input, output, b_enabled, b_loop );
111 }
112
113 void VLMWrapper::EditVod( const char* name, const char* input,
114                           const char* output,
115                           bool b_enabled, bool b_loop  )
116 {
117     vlm_message_t *message;
118     string command;
119     command = "setup \"" + string(name) + "\" input \"" + string(input) + "\"";
120     vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
121     vlm_MessageDelete( message );
122     if( strlen(output) > 0 )
123     {
124         command = "setup \"" + string(name) + "\" output \"" + string(output) + "\"";
125         vlm_ExecuteCommand( p_vlm, (char*)command.c_str(), &message );
126         vlm_MessageDelete( message );
127     }
128     if( b_enabled )
129     {
130         command = "setup \"" + string(name) + "\" enabled";
131         vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
132         vlm_MessageDelete( message );
133     }
134 }
135 #endif
136