1 /*****************************************************************************
2 * vlm_wrapper.cpp : Wrapper around VLM
3 *****************************************************************************
4 * Copyright (C) 2000-2005 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
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.
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.
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 *****************************************************************************/
24 /* FIXME: This is not wx-specific */
27 #include "dialogs/vlm/vlm_wrapper.hpp"
29 VLMWrapper::VLMWrapper( intf_thread_t *_p_intf )
35 VLMWrapper::~VLMWrapper()
37 /* FIXME :you have to destroy vlm here to close
38 * but we shouldn't destroy vlm here in case somebody else wants it */
43 bool VLMWrapper::AttachVLM()
45 p_vlm = vlm_New( p_intf );
46 return p_vlm ? true: false ;
49 void VLMWrapper::LockVLM()
51 vlc_mutex_lock( &p_vlm->object_lock );
54 void VLMWrapper::UnlockVLM()
56 vlc_mutex_unlock( &p_vlm->object_lock );
59 void VLMWrapper::AddBroadcast( const char* name, const char* input,
61 bool b_enabled, bool b_loop )
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 );
70 void VLMWrapper::EditBroadcast( const char* name, const char* input,
72 bool b_enabled, bool b_loop )
74 vlm_message_t *message;
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 )
84 command = "setup \"" + string(name) + "\" output \"" + string(output) + "\"";
85 vlm_ExecuteCommand( p_vlm, (char*)command.c_str(), &message );
86 vlm_MessageDelete( message );
90 command = "setup \"" + string(name) + "\" enabled";
91 vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
92 vlm_MessageDelete( message );
96 command = "setup \"" + string(name) + "\" loop";
97 vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
98 vlm_MessageDelete( message );
102 void VLMWrapper::AddVod( const char* name, const char* input,
104 bool b_enabled, bool b_loop )
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 );
113 void VLMWrapper::EditVod( const char* name, const char* input,
115 bool b_enabled, bool b_loop )
117 vlm_message_t *message;
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 )
124 command = "setup \"" + string(name) + "\" output \"" + string(output) + "\"";
125 vlm_ExecuteCommand( p_vlm, (char*)command.c_str(), &message );
126 vlm_MessageDelete( message );
130 command = "setup \"" + string(name) + "\" enabled";
131 vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
132 vlm_MessageDelete( message );