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 */
26 #include "dialogs/vlm/vlm_wrapper.hpp"
28 VLMWrapper::VLMWrapper( intf_thread_t *_p_intf )
34 VLMWrapper::~VLMWrapper()
36 /* FIXME :you have to destroy vlm here to close
37 * but we shouldn't destroy vlm here in case somebody else wants it */
42 vlc_bool_t VLMWrapper::AttachVLM()
44 p_vlm = vlm_New( p_intf );
45 return p_vlm ? VLC_TRUE: VLC_FALSE ;
48 void VLMWrapper::LockVLM()
50 vlc_mutex_lock( &p_vlm->object_lock );
53 void VLMWrapper::UnlockVLM()
55 vlc_mutex_unlock( &p_vlm->object_lock );
58 void VLMWrapper::AddBroadcast( const char* name, const char* input,
60 vlc_bool_t b_enabled, vlc_bool_t b_loop )
62 vlm_message_t *message;
63 string command = "new " + string(name) + " broadcast";
64 vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
65 vlm_MessageDelete( message );
66 EditBroadcast( name, input, output, b_enabled, b_loop );
69 void VLMWrapper::EditBroadcast( const char* name, const char* input,
71 vlc_bool_t b_enabled, vlc_bool_t b_loop )
73 vlm_message_t *message;
75 command = "setup " + string(name) + " inputdel all";
76 vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
77 vlm_MessageDelete( message );
78 command = "setup " + string(name) + " input " + string(input);
79 vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
80 vlm_MessageDelete( message );
81 if( strlen(output) > 0 )
83 command = "setup " + string(name) + " output " + string(output);
84 vlm_ExecuteCommand( p_vlm, (char*)command.c_str(), &message );
85 vlm_MessageDelete( message );
89 command = "setup " + string(name) + " enabled";
90 vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
91 vlm_MessageDelete( message );
95 command = "setup " + string(name) + " loop";
96 vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
97 vlm_MessageDelete( message );
101 void VLMWrapper::AddVod( const char* name, const char* input,
103 vlc_bool_t b_enabled, vlc_bool_t b_loop )
105 vlm_message_t *message;
106 string command = "new " + string(name) + " vod";
107 vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
108 vlm_MessageDelete( message );
109 EditVod( name, input, output, b_enabled, b_loop );
112 void VLMWrapper::EditVod( const char* name, const char* input,
114 vlc_bool_t b_enabled, vlc_bool_t b_loop )
116 vlm_message_t *message;
118 command = "setup " + string(name) + " input " + string(input);
119 vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
120 vlm_MessageDelete( message );
121 if( strlen(output) > 0 )
123 command = "setup " + string(name) + " output " + string(output);
124 vlm_ExecuteCommand( p_vlm, (char*)command.c_str(), &message );
125 vlm_MessageDelete( message );
129 command = "setup " + string(name) + " enabled";
130 vlm_ExecuteCommand( p_vlm, command.c_str(), &message );
131 vlm_MessageDelete( message );