Commit bfdcf837 authored by Emmanuel Puig's avatar Emmanuel Puig

* Added use of channel server for skins: still experimental

parent 0c212dbc
......@@ -2,7 +2,7 @@
* banks.cpp: Bitmap bank, Event, bank, Font bank and OffSet bank
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: banks.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: banks.cpp,v 1.2 2003/04/14 10:00:38 karibu Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -186,6 +186,7 @@ EventBank::~EventBank()
for( map<string,Event *>::iterator iter = Bank.begin();
iter != Bank.end(); iter++ )
{
iter->second->DestructParameters( true );
delete (OSEvent *)iter->second;
}
}
......
......@@ -2,7 +2,7 @@
* event.cpp: Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: event.cpp,v 1.6 2003/04/13 17:46:23 asmax Exp $
* $Id: event.cpp,v 1.7 2003/04/14 10:00:38 karibu Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -66,17 +66,22 @@ Event::~Event()
{
}
//---------------------------------------------------------------------------
void Event::DestructParameters()
void Event::DestructParameters( bool force )
{
switch( Message )
{
case CTRL_SYNCHRO:
if( Param2 == (int)true )
if( Param2 == (int)true || force )
delete (Event *)Param1;
break;
case CTRL_SET_TEXT:
delete (char *)Param2;
delete[] (char *)Param2;
break;
case VLC_NET_ADDCS:
if( Param2 == (int)true || force )
delete[] (char *)Param1;
break;
}
......@@ -171,6 +176,8 @@ unsigned int Event::GetMessageType( string Desc )
// Network events
else if( Desc == "VLC_NET_ADDUDP" )
return VLC_NET_ADDUDP;
else if( Desc == "VLC_NET_ADDCS" )
return VLC_NET_ADDCS;
// Window event
else if( Desc == "WINDOW_MOVE" )
......@@ -236,6 +243,9 @@ void Event::CreateEvent()
char *para2 = new char[MAX_PARAM_SIZE];
char *para3 = new char[MAX_PARAM_SIZE];
// Buffer to create strings
char *buf;
// Scan the event
int scan = sscanf( EventDesc.c_str(),
"%[^(](%[^,)],%[^,)],%[^,)])", msg, para1, para2, para3 );
......@@ -282,6 +292,13 @@ void Event::CreateEvent()
Param2 = atoi( para1 );
break;
case VLC_NET_ADDCS:
buf = new char[MAX_PARAM_SIZE + 7];
sprintf( buf, "%s:%s", para1, para2 );
Param1 = (unsigned int)buf;
Param2 = (int)false;
break;
case CTRL_ID_VISIBLE:
Param1 = (unsigned int)FindControl( para1 );
Param2 = GetBool( para2 );
......
......@@ -2,7 +2,7 @@
* event.h: Event class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: event.h,v 1.5 2003/04/12 21:43:27 asmax Exp $
* $Id: event.h,v 1.6 2003/04/14 10:00:38 karibu Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -40,6 +40,7 @@ using namespace std;
#define MAX_EVENT_SIZE 30
#define MAX_PARAM_SIZE 20
#define EVENT_MAX_BUFFER_SIZE 20
#if !defined _WIN32
#define WM_APP 0x8000
......@@ -93,6 +94,7 @@ using namespace std;
// Network events
#define VLC_NET_ADDUDP (VLC_MESSAGE + 701)
#define VLC_NET_ADDCS (VLC_MESSAGE + 703)
// Window event
#define WINDOW_MOVE (VLC_WINDOW + 1)
......@@ -163,7 +165,7 @@ class Event
// Destructor
virtual ~Event();
void DestructParameters();
void DestructParameters( bool force = false );
// General operations on events
GenericControl * FindControl( string id );
......
......@@ -2,7 +2,7 @@
* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlcproc.cpp,v 1.5 2003/04/12 21:43:27 asmax Exp $
* $Id: vlcproc.cpp,v 1.6 2003/04/14 10:00:38 karibu Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -29,7 +29,7 @@
#include <vlc/intf.h>
#include <vlc/aout.h>
#include <vlc/vout.h>
#include <netutils.h>
//--- SKIN ------------------------------------------------------------------
#include "os_api.h"
......@@ -158,6 +158,10 @@ bool VlcProc::EventProc( Event *evt )
AddNetworkUDP( (int)evt->GetParam2() );
return true;
case VLC_NET_ADDCS:
AddNetworkChannelServer( (char *)evt->GetParam1() );
return true;
default:
return true;
}
......@@ -616,5 +620,32 @@ void VlcProc::AddNetworkUDP( int port )
InterfaceRefresh();
}
//---------------------------------------------------------------------------
void VlcProc::AddNetworkChannelServer( char *server )
{
char *name = new char[MAX_PARAM_SIZE];
int port = 0;
// Scan the server address
int scan = sscanf( server, "%[^:]:%i", name, port );
if( scan != 2)
{
msg_Err( p_intf, "Invalid channel server: %s", server );
delete[] name;
return;
}
config_PutInt( p_intf, "network-channel", VLC_TRUE );
config_PutPsz( p_intf, "channel-server", name );
config_PutInt( p_intf, "channel-port", port );
if( p_intf->p_vlc->p_channel == NULL )
{
network_ChannelCreate( p_intf );
}
delete[] name;
}
//---------------------------------------------------------------------------
......@@ -2,7 +2,7 @@
* vlcproc.h: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlcproc.h,v 1.2 2003/04/11 22:08:07 videolan Exp $
* $Id: vlcproc.h,v 1.3 2003/04/14 10:00:39 karibu Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -53,6 +53,7 @@ class VlcProc
void FullScreen();
void ChangeVolume( unsigned int msg, long param );
void AddNetworkUDP( int port );
void AddNetworkChannelServer( char *server );
void InterfaceRefresh( bool All = false );
void EnabledEvent( string type, bool state );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment