This commit is contained in:
David Rose 2004-08-06 22:52:10 +00:00
parent 2fb3521f56
commit 4f7f89164d
16 changed files with 535 additions and 535 deletions

View File

@ -93,7 +93,7 @@ void HelixClient::do_event() {
// dirty so that it will be updated in memory. // dirty so that it will be updated in memory.
TEXTURES::iterator iter; TEXTURES::iterator iter;
for(iter = _textures.begin(); iter != _textures.end(); iter++) { for(iter = _textures.begin(); iter != _textures.end(); iter++) {
iter->second->mark_dirty(Texture::DF_image); iter->second->mark_dirty(Texture::DF_image);
} }
} }
@ -119,14 +119,14 @@ void HelixClient::do_events() {
end_time = start_time + _time_delta; end_time = start_time + _time_delta;
i = 0; i = 0;
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
DispatchMessage(&msg); DispatchMessage(&msg);
if((i % check_interval) == 0) { if((i % check_interval) == 0) {
if(GetTickCount() > end_time) { if(GetTickCount() > end_time) {
break; break;
} }
++i; ++i;
} }
sleep = FALSE; sleep = FALSE;
} }
if(sleep) { if(sleep) {
Sleep(_sleep_time); Sleep(_sleep_time);
@ -153,88 +153,88 @@ void HelixClient::create_player(const string &name, Texture* tex, bool sink_on)
// instantiated, otherwise, players cannot be created! // instantiated, otherwise, players cannot be created!
if (_engine != 0) { if (_engine != 0) {
// For now, check if there is an actual Panda texture present. If not, // For now, check if there is an actual Panda texture present. If not,
// then this player should not be created. // then this player should not be created.
// NOTE: This portion of the interface must be redesigned as the current
// design forces the user to specify a valid texture. A more suitable
// approach would be to automatically generate a panda texture and allow
// the user to retreive that texture and set it for any piece of geometry
// within the world.
if( tex == 0 ) {
STDOUT("ERROR: HelixClient::CreatePlayer, INVALID Texture Object!\n");
STDOUT("ERROR: NO PLAYER CREATED!!\n");
return;
}
// Initialize necessary Helix pointers.
IHXPlayer* tmp_player = 0;
HxClientContext* context = 0;
IHXErrorSinkControl* controller = 0;
IHXErrorSink* error_sink = 0;
// Tell the texture object to keep the actual image buffer in memory. If // NOTE: This portion of the interface must be redesigned as the current
// the image buffer is deallocated, which is the default in panda, Helix // design forces the user to specify a valid texture. A more suitable
// and Panda because the engine will try to Blit to an invalid buffer. // approach would be to automatically generate a panda texture and allow
tex->set_keep_ram_image(true); // the user to retreive that texture and set it for any piece of geometry
// within the world.
if( tex == 0 ) {
STDOUT("ERROR: HelixClient::CreatePlayer, INVALID Texture Object!\n");
STDOUT("ERROR: NO PLAYER CREATED!!\n");
return;
}
// Try and create a valid helix player on the engine // Initialize necessary Helix pointers.
if (HXR_OK != _engine->CreatePlayer(tmp_player)) { IHXPlayer* tmp_player = 0;
STDOUT("ERROR: HelixClient::CreatePlayer, Failed Player Creation!\n"); HxClientContext* context = 0;
} IHXErrorSinkControl* controller = 0;
else { IHXErrorSink* error_sink = 0;
// Tell the texture object to keep the actual image buffer in memory. If
// the image buffer is deallocated, which is the default in panda, Helix
// and Panda because the engine will try to Blit to an invalid buffer.
tex->set_keep_ram_image(true);
// Try and create a valid helix player on the engine
if (HXR_OK != _engine->CreatePlayer(tmp_player)) {
STDOUT("ERROR: HelixClient::CreatePlayer, Failed Player Creation!\n");
}
else {
// Since a player has been successfully instantiated, a context // Since a player has been successfully instantiated, a context
// for that player must be created. // for that player must be created.
context = new HxClientContext(_players.size()); context = new HxClientContext(_players.size());
if(context != 0) { if(context != 0) {
context->AddRef(); context->AddRef();
// Specify a default GUID. Not really necessary, but here for
// convenience if needed later on.
char guid[_guid_length + 1];
IHXPreferences * pref = 0;
guid[0] = '\0';
// Query the Preferences Interface for the player. // Specify a default GUID. Not really necessary, but here for
tmp_player->QueryInterface(IID_IHXPreferences, (void**)&pref); // convenience if needed later on.
char guid[_guid_length + 1];
// Send the Texture buffer down into the Context. It will then IHXPreferences * pref = 0;
// ship the buffer to the site supplier, where the actual site guid[0] = '\0';
// and surface are generated.
context->init(tmp_player, pref, guid, sink_on, tex);
tmp_player->SetClientContext(context);
HX_RELEASE(pref);
// Query the Error Sink Controller // Query the Preferences Interface for the player.
tmp_player->QueryInterface(IID_IHXErrorSinkControl, (void**)&controller); tmp_player->QueryInterface(IID_IHXPreferences, (void**)&pref);
if(controller != 0) {
context->QueryInterface(IID_IHXErrorSink, (void**)&error_sink);
if(error_sink != 0) {
controller->AddErrorSink(error_sink, HXLOG_EMERG, HXLOG_INFO);
}
HX_RELEASE(error_sink);
error_sink = 0;
}
HX_RELEASE(controller);
controller = 0;
context = 0;
}
// Create a new map object for the player and its respective texture. // Send the Texture buffer down into the Context. It will then
pair<string, IHXPlayer*> player(name, tmp_player); // ship the buffer to the site supplier, where the actual site
pair<string, PT(Texture)> texture(name, tex); // and surface are generated.
context->init(tmp_player, pref, guid, sink_on, tex);
// Now that the pair has been created, set the tmp_player tmp_player->SetClientContext(context);
// address to 0 to protect against dangling references. HX_RELEASE(pref);
tmp_player = 0;
// Now, actually insert the pairs into their respective maps. // Query the Error Sink Controller
_players.insert(player); tmp_player->QueryInterface(IID_IHXErrorSinkControl, (void**)&controller);
_textures.insert(texture); if(controller != 0) {
} context->QueryInterface(IID_IHXErrorSink, (void**)&error_sink);
if(error_sink != 0) {
controller->AddErrorSink(error_sink, HXLOG_EMERG, HXLOG_INFO);
}
HX_RELEASE(error_sink);
error_sink = 0;
}
HX_RELEASE(controller);
controller = 0;
context = 0;
}
// Create a new map object for the player and its respective texture.
pair<string, IHXPlayer*> player(name, tmp_player);
pair<string, PT(Texture)> texture(name, tex);
// Now that the pair has been created, set the tmp_player
// address to 0 to protect against dangling references.
tmp_player = 0;
// Now, actually insert the pairs into their respective maps.
_players.insert(player);
_textures.insert(texture);
}
} }
else { else {
STDOUT("ERROR: In HelixClient::CreatePlayer, pEngine = NULL"); STDOUT("ERROR: In HelixClient::CreatePlayer, pEngine = NULL");
} }
} }
@ -256,21 +256,21 @@ void HelixClient::close_player(const string &name) {
if (_engine != 0) { if (_engine != 0) {
IUnknown* context = 0; IUnknown* context = 0;
// Determine if the player is in the map. If so, go about // Determine if the player is in the map. If so, go about
// removing that player from the engine. // removing that player from the engine.
PLAYERS::iterator iter = _players.find(name); PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) { if (iter != _players.end()) {
iter->second->Stop(); iter->second->Stop();
iter->second->GetClientContext(context); iter->second->GetClientContext(context);
context->Release(); context->Release();
context = 0; context = 0;
_engine->ClosePlayer(iter->second); _engine->ClosePlayer(iter->second);
iter->second->Release(); iter->second->Release();
iter->second = 0; iter->second = 0;
// Remove the player its associated texture from their // Remove the player its associated texture from their
// respective maps. // respective maps.
_players.erase(name); _players.erase(name);
_textures.erase(name); _textures.erase(name);
} }
} }
} }
@ -289,15 +289,15 @@ void HelixClient::close_all_players() {
if (_engine != 0) { if (_engine != 0) {
if (!_players.empty()) { if (!_players.empty()) {
IUnknown* context = 0; IUnknown* context = 0;
PLAYERS::iterator iter; PLAYERS::iterator iter;
// Iterate through the _players map to close each player // Iterate through the _players map to close each player
// currently associated with the engine. // currently associated with the engine.
unsigned int total_players = _players.size(); unsigned int total_players = _players.size();
for (unsigned int cntr = 0; cntr <= total_players; cntr++) { for (unsigned int cntr = 0; cntr <= total_players; cntr++) {
close_player(_players.begin()->first); close_player(_players.begin()->first);
} }
} }
} }
} }
@ -344,17 +344,17 @@ bool HelixClient::init() {
STDOUT("HelixClient is looking for the client core at %s\n", _dll_home.c_str()); STDOUT("HelixClient is looking for the client core at %s\n", _dll_home.c_str());
if(DLLAccess::DLL_OK != _dll_access->open(string(_dll_home+"\\clntcore.dll").c_str())) { if(DLLAccess::DLL_OK != _dll_access->open(string(_dll_home+"\\clntcore.dll").c_str())) {
const char * error_string = 0; const char * error_string = 0;
error_string = _dll_access->getErrorString(); error_string = _dll_access->getErrorString();
STDERR("HelixClient: %s\n\n", error_string); STDERR("HelixClient: %s\n\n", error_string);
// Print out an explanation of what is wrong. // Print out an explanation of what is wrong.
STDERR("You must tell the player where to find the client core and\n"); STDERR("You must tell the player where to find the client core and\n");
STDERR("all of its supporting DLLs and codecs.\n"); STDERR("all of its supporting DLLs and codecs.\n");
// Deallocate the memory from the heap to avoid a memory leak. // Deallocate the memory from the heap to avoid a memory leak.
delete _dll_access; delete _dll_access;
_dll_access = 0; _dll_access = 0;
return false; return false;
} }
// Now that the client core has been loaded, retrieve the function pointer // Now that the client core has been loaded, retrieve the function pointer
@ -367,10 +367,10 @@ bool HelixClient::init() {
// initialization of the engine. // initialization of the engine.
if((create_engine == 0) || (set_dll_access_path == 0)) { if((create_engine == 0) || (set_dll_access_path == 0)) {
STDOUT("---{ERROR: HelixClient::Init, set_dll_access_path}---"); STDOUT("---{ERROR: HelixClient::Init, set_dll_access_path}---");
delete _dll_access; delete _dll_access;
_dll_access = 0; _dll_access = 0;
return false; return false;
} }
// Now that the clntcore.dll has been succesfully loaded. Specify where it // Now that the clntcore.dll has been succesfully loaded. Specify where it
@ -429,9 +429,9 @@ bool HelixClient::init() {
if (HXR_OK != create_engine((IHXClientEngine**) &_engine)) { if (HXR_OK != create_engine((IHXClientEngine**) &_engine)) {
STDOUT("---{ERROR: HelixClient::Init, Creating Engine Problem}---"); STDOUT("---{ERROR: HelixClient::Init, Creating Engine Problem}---");
delete _dll_access; delete _dll_access;
_dll_access = 0; _dll_access = 0;
return false; return false;
} }
return false; return false;
} }
@ -451,24 +451,24 @@ void HelixClient::shutdown() {
// given Helix Engine. // given Helix Engine.
close_all_players(); close_all_players();
// Retrieve the Function Pointer for closing the Helix engine.
FPRMCLOSEENGINE close_engine = (FPRMCLOSEENGINE) _dll_access->getSymbol("CloseEngine");
// If the function pointer was successfully retrieved, close
// the helix engine.
if (close_engine != 0) {
STDOUT("Closing Helix Engine...\n");
close_engine(_engine);
_engine = 0;
}
// Close the link with the clntCore.dll and freeing the DLLAccess // Retrieve the Function Pointer for closing the Helix engine.
// object from memory to prevent a memory leak on the heap. FPRMCLOSEENGINE close_engine = (FPRMCLOSEENGINE) _dll_access->getSymbol("CloseEngine");
STDOUT("Closing the link to clntCore.dll...\n");
_dll_access->close(); // If the function pointer was successfully retrieved, close
delete _dll_access; // the helix engine.
_dll_access = 0; if (close_engine != 0) {
STDOUT("Closing Helix Engine...\n");
close_engine(_engine);
_engine = 0;
}
// Close the link with the clntCore.dll and freeing the DLLAccess
// object from memory to prevent a memory leak on the heap.
STDOUT("Closing the link to clntCore.dll...\n");
_dll_access->close();
delete _dll_access;
_dll_access = 0;
} }
} }
@ -487,19 +487,19 @@ void HelixClient::begin(const string &name) {
if (_engine != 0) { if (_engine != 0) {
// Search for the specified player in the map. If the player // Search for the specified player in the map. If the player
// is found, begin playback of the media file. // is found, begin playback of the media file.
PLAYERS::iterator iter = _players.find(name); PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) { if (iter != _players.end()) {
iter->second->Begin(); iter->second->Begin();
} }
// This is legacy code from the test application, however, it // This is legacy code from the test application, however, it
// was necessary for helix to function since do_events was called // was necessary for helix to function since do_events was called
// to give helix the necessary time-slice of the CPU. I think this // to give helix the necessary time-slice of the CPU. I think this
// most likely can be removed since Panda calls the necessary // most likely can be removed since Panda calls the necessary
// Win32 API Message calls. // Win32 API Message calls.
//UINT curr_time = 0; //UINT curr_time = 0;
//UINT32 start_time = GetTickCount(); //UINT32 start_time = GetTickCount();
//UINT32 end_time = start_time + _time_delta; //UINT32 end_time = start_time + _time_delta;
//while(1) { //while(1) {
// do_events(); // do_events();
@ -522,21 +522,21 @@ void HelixClient::begin(const string &name) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void HelixClient::begin_all() { void HelixClient::begin_all() {
if (_engine != 0) { if (_engine != 0) {
// Iterate through the _players map and call the Begin // Iterate through the _players map and call the Begin
// routine to start playback of the media. // routine to start playback of the media.
PLAYERS::iterator iter; PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) { for(iter = _players.begin(); iter != _players.end(); iter++) {
iter->second->Begin(); iter->second->Begin();
} }
// This is legacy code from the test application, however, it // This is legacy code from the test application, however, it
// was necessary for helix to function since do_events was called // was necessary for helix to function since do_events was called
// to give helix the necessary time-slice of the CPU. I think this // to give helix the necessary time-slice of the CPU. I think this
// most likely can be removed since Panda calls the necessary // most likely can be removed since Panda calls the necessary
// Win32 API Message calls. // Win32 API Message calls.
// UINT curr_time = 0; // UINT curr_time = 0;
// UINT32 start_time = GetTickCount(); // UINT32 start_time = GetTickCount();
// UINT32 end_time = start_time + _time_delta; // UINT32 end_time = start_time + _time_delta;
// while(1) { // while(1) {
// do_events(); // do_events();
@ -563,9 +563,9 @@ void HelixClient::pause(const string &name) {
// is found, pause the playback of the media file. // is found, pause the playback of the media file.
if (_engine != 0) { if (_engine != 0) {
PLAYERS::iterator iter = _players.find(name); PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) { if (iter != _players.end()) {
iter->second->Pause(); iter->second->Pause();
} }
} }
} }
@ -581,12 +581,12 @@ void HelixClient::pause(const string &name) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void HelixClient::pause_all() { void HelixClient::pause_all() {
if (_engine != 0) { if (_engine != 0) {
// Iterate through the _players map and call the Pause // Iterate through the _players map and call the Pause
// routine to start playback of the media. // routine to start playback of the media.
PLAYERS::iterator iter; PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) { for(iter = _players.begin(); iter != _players.end(); iter++) {
iter->second->Pause(); iter->second->Pause();
} }
} }
} }
@ -605,13 +605,13 @@ void HelixClient::pause_all() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void HelixClient::seek_time(const string &name, long time) { void HelixClient::seek_time(const string &name, long time) {
if (_engine != 0) { if (_engine != 0) {
// Search for the specified player in the map. If the player // Search for the specified player in the map. If the player
// is found, seek to the current time in the playback of the // is found, seek to the current time in the playback of the
// media file. // media file.
PLAYERS::iterator iter = _players.find(name); PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) { if (iter != _players.end()) {
iter->second->Seek(time); iter->second->Seek(time);
} }
} }
} }
@ -629,12 +629,12 @@ void HelixClient::seek_time(const string &name, long time) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void HelixClient::stop(const string &name) { void HelixClient::stop(const string &name) {
if (_engine != 0) { if (_engine != 0) {
// Search for the specified player in the map. If the player // Search for the specified player in the map. If the player
// is found, stop the playback of the media file. // is found, stop the playback of the media file.
PLAYERS::iterator iter = _players.find(name); PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) { if (iter != _players.end()) {
iter->second->Stop(); iter->second->Stop();
} }
} }
} }
@ -650,12 +650,12 @@ void HelixClient::stop(const string &name) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void HelixClient::stop_all() { void HelixClient::stop_all() {
if (_engine != 0) { if (_engine != 0) {
// Iterate through the _players map and call the Pause // Iterate through the _players map and call the Pause
// routine to stop playback of the media. // routine to stop playback of the media.
PLAYERS::iterator iter; PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) { for(iter = _players.begin(); iter != _players.end(); iter++) {
iter->second->Stop(); iter->second->Stop();
} }
} }
} }
@ -679,19 +679,19 @@ void HelixClient::stop_all() {
void HelixClient::open_url(const string &name, string url) { void HelixClient::open_url(const string &name, string url) {
if (_engine != 0) { if (_engine != 0) {
// Determine if a URL has been specified within the string. // Determine if a URL has been specified within the string.
// If it hasn't, assume that the request has been made for // If it hasn't, assume that the request has been made for
// a local file, so insert, file://, at the beginning of the // a local file, so insert, file://, at the beginning of the
// string. // string.
if (url.find("://")==string::npos) { if (url.find("://")==string::npos) {
url.insert(0,"file://"); url.insert(0,"file://");
} }
// Check wheter the player specified exists // Check wheter the player specified exists
// within the map. If it does, call the IHXPlayer::OpenURL(...) // within the map. If it does, call the IHXPlayer::OpenURL(...)
PLAYERS::iterator iter = _players.find(name); PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) { if (iter != _players.end()) {
iter->second->OpenURL(url.c_str()); iter->second->OpenURL(url.c_str());
} }
} }
} }
@ -710,12 +710,12 @@ void HelixClient::open_url(const string &name, string url) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
bool HelixClient::is_live(const string &name) { bool HelixClient::is_live(const string &name) {
if (_engine != 0) { if (_engine != 0) {
// Search for the specified player in the map. If the player // Search for the specified player in the map. If the player
// is found, check to see if it contains a live media source. // is found, check to see if it contains a live media source.
PLAYERS::iterator iter = _players.find(name); PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) { if (iter != _players.end()) {
return (iter->second->IsLive()) ? true : false; return (iter->second->IsLive()) ? true : false;
} }
} }
return false; return false;
} }
@ -736,13 +736,13 @@ bool HelixClient::is_live(const string &name) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
bool HelixClient::is_done(const string &name) { bool HelixClient::is_done(const string &name) {
if (_engine != 0) { if (_engine != 0) {
// Search for the specified player in the map. If the player // Search for the specified player in the map. If the player
// is found, check to see if it has finished playing the // is found, check to see if it has finished playing the
// the current presentation. // the current presentation.
PLAYERS::iterator iter = _players.find(name); PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) { if (iter != _players.end()) {
return iter->second->IsDone(); return iter->second->IsDone();
} }
} }
return true; return true;
} }
@ -763,13 +763,13 @@ bool HelixClient::is_done(const string &name) {
bool HelixClient::are_players_done() { bool HelixClient::are_players_done() {
if (_engine != 0) { if (_engine != 0) {
bool done = true; bool done = true;
PLAYERS::iterator iter; PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) { for(iter = _players.begin(); iter != _players.end(); iter++) {
if(!iter->second->IsDone()) { if(!iter->second->IsDone()) {
done = false; done = false;
} }
} }
return done; return done;
} }
return true; return true;
} }
@ -791,11 +791,11 @@ int HelixClient::get_source_count(const string &name) {
if (_engine != 0) { if (_engine != 0) {
// Search for the specified player in the map. If the player // Search for the specified player in the map. If the player
// is found, check to see if it has finished playing the // is found, check to see if it has finished playing the
// the current presentation. // the current presentation.
PLAYERS::iterator iter = _players.find(name); PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) { if (iter != _players.end()) {
return iter->second->GetSourceCount(); return iter->second->GetSourceCount();
} }
} }
return -1; return -1;
} }

View File

@ -120,4 +120,4 @@ private:
PLAYERS _players; PLAYERS _players;
TEXTURES _textures; TEXTURES _textures;
}; };
#endif #endif

View File

@ -38,32 +38,32 @@
HxAdviseSink::HxAdviseSink(IUnknown* unknown, LONG32 client_index, bool sink_on) HxAdviseSink::HxAdviseSink(IUnknown* unknown, LONG32 client_index, bool sink_on)
: _ref_count (0), : _ref_count (0),
_client_index (client_index), _client_index (client_index),
_unknown (0), _unknown (0),
_registry (0), _registry (0),
_scheduler (0), _scheduler (0),
_current_bandwidth(0), _current_bandwidth(0),
_average_bandwidth(0), _average_bandwidth(0),
_on_stop(0), _on_stop(0),
_sink_on(sink_on) _sink_on(sink_on)
{ {
if (unknown != 0) { if (unknown != 0) {
_unknown = unknown; _unknown = unknown;
_unknown->AddRef(); _unknown->AddRef();
if (HXR_OK != _unknown->QueryInterface(IID_IHXRegistry, (void**)&_registry)) { if (HXR_OK != _unknown->QueryInterface(IID_IHXRegistry, (void**)&_registry)) {
_registry = 0; _registry = 0;
} }
if (HXR_OK != _unknown->QueryInterface(IID_IHXScheduler, (void**)&_scheduler)) { if (HXR_OK != _unknown->QueryInterface(IID_IHXScheduler, (void**)&_scheduler)) {
_scheduler = 0; _scheduler = 0;
} }
IHXPlayer* player; IHXPlayer* player;
if(HXR_OK == _unknown->QueryInterface(IID_IHXPlayer, (void**)&player)) { if(HXR_OK == _unknown->QueryInterface(IID_IHXPlayer, (void**)&player)) {
player->AddAdviseSink(this); player->AddAdviseSink(this);
player->Release(); player->Release();
} }
} }
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -79,18 +79,18 @@ HxAdviseSink::~HxAdviseSink() {
// Release components and set the member variables to the // Release components and set the member variables to the
// NULL-state. // NULL-state.
if (_scheduler != 0) { if (_scheduler != 0) {
_scheduler->Release(); _scheduler->Release();
_scheduler = 0; _scheduler = 0;
} }
if (_registry != 0) { if (_registry != 0) {
_registry->Release(); _registry->Release();
_registry = 0; _registry = 0;
} }
if (_unknown != 0) { if (_unknown != 0) {
_unknown->Release(); _unknown->Release();
_unknown = 0; _unknown = 0;
} }
} }
@ -112,24 +112,24 @@ HxAdviseSink::~HxAdviseSink() {
STDMETHODIMP HxAdviseSink::QueryInterface(REFIID id, void** interface_obj) { STDMETHODIMP HxAdviseSink::QueryInterface(REFIID id, void** interface_obj) {
// Determine if the IUnknown and ClientAdviseSink interfaces // Determine if the IUnknown and ClientAdviseSink interfaces
// are supported. // are supported.
if (IsEqualIID(id, IID_IUnknown)) { if (IsEqualIID(id, IID_IUnknown)) {
// Increase the reference count, set the Interface Object, // Increase the reference count, set the Interface Object,
// and return that the interface is supported within this // and return that the interface is supported within this
// object. // object.
AddRef(); AddRef();
*interface_obj = (IUnknown*)(IHXClientAdviseSink*)this; *interface_obj = (IUnknown*)(IHXClientAdviseSink*)this;
} }
else if (IsEqualIID(id, IID_IHXClientAdviseSink)) { else if (IsEqualIID(id, IID_IHXClientAdviseSink)) {
// Same as above. // Same as above.
AddRef(); AddRef();
*interface_obj = (IHXClientAdviseSink*)this; *interface_obj = (IHXClientAdviseSink*)this;
} }
else { else {
// This Interface is not supported by this object. Set the // This Interface is not supported by this object. Set the
// Interface Object to the NULL-state and return. // Interface Object to the NULL-state and return.
*interface_obj = 0; *interface_obj = 0;
return HXR_NOINTERFACE; return HXR_NOINTERFACE;
} }
return HXR_OK; return HXR_OK;
} }
@ -190,7 +190,7 @@ STDMETHODIMP_(ULONG32) HxAdviseSink::Release() {
STDMETHODIMP HxAdviseSink::OnPosLength(ULONG32 ulPosition, ULONG32 ulLength) { STDMETHODIMP HxAdviseSink::OnPosLength(ULONG32 ulPosition, ULONG32 ulLength) {
// Initialize Variables // Initialize Variables
if(_sink_on) { if(_sink_on) {
STDOUT("OnPosLength(%ld, %ld)\n", ulPosition, ulLength); STDOUT("OnPosLength(%ld, %ld)\n", ulPosition, ulLength);
} }
return HXR_OK; return HXR_OK;
} }
@ -250,58 +250,58 @@ STDMETHODIMP HxAdviseSink::OnPresentationClosed() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void HxAdviseSink::get_statistics(char* registry_key) { void HxAdviseSink::get_statistics(char* registry_key) {
if(_sink_on) { if(_sink_on) {
char RegistryValue[MAX_DISPLAY_NAME] = {0}; char RegistryValue[MAX_DISPLAY_NAME] = {0};
INT32 lValue = 0; INT32 lValue = 0;
INT32 i = 0; INT32 i = 0;
INT32 lStatistics = 8; INT32 lStatistics = 8;
UINT32 *plValue; UINT32 *plValue;
// Collect all of the necessary statistics from the registry // Collect all of the necessary statistics from the registry
// and print them to the screen. // and print them to the screen.
for (i = 0; i < lStatistics; i++) { for (i = 0; i < lStatistics; i++) {
plValue = NULL; plValue = NULL;
switch (i) { switch (i) {
case 0: case 0:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Normal", registry_key); SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Normal", registry_key);
break; break;
case 1: case 1:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Recovered", registry_key); SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Recovered", registry_key);
break; break;
case 2: case 2:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Received", registry_key); SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Received", registry_key);
break; break;
case 3: case 3:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Lost", registry_key); SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Lost", registry_key);
break; break;
case 4: case 4:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Late", registry_key); SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Late", registry_key);
break; break;
case 5: case 5:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.ClipBandwidth", registry_key); SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.ClipBandwidth", registry_key);
break; break;
case 6: case 6:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s._average_bandwidth", registry_key); SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s._average_bandwidth", registry_key);
plValue = &_average_bandwidth; plValue = &_average_bandwidth;
break; break;
case 7: case 7:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s._current_bandwidth", registry_key); SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s._current_bandwidth", registry_key);
plValue = &_current_bandwidth; plValue = &_current_bandwidth;
break; break;
default: default:
break; break;
} }
_registry->GetIntByName(RegistryValue, lValue); _registry->GetIntByName(RegistryValue, lValue);
if (plValue) { if (plValue) {
if (_on_stop || lValue == 0) { if (_on_stop || lValue == 0) {
lValue = *plValue; lValue = *plValue;
} }
else { else {
*plValue = lValue; *plValue = lValue;
} }
} }
STDOUT("%s = %ld\n", RegistryValue, lValue); STDOUT("%s = %ld\n", RegistryValue, lValue);
} }
} }
} }
@ -327,35 +327,35 @@ void HxAdviseSink::get_all_statistics() {
// Display the content of whole statistic registry // Display the content of whole statistic registry
if (_registry) { if (_registry) {
// Start from the first player. // Start from the first player.
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld", RegistryPrefix, _client_index); SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld", RegistryPrefix, _client_index);
if (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) { if (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
// Display player statistic // Display player statistic
get_statistics(RegistryName); get_statistics(RegistryName);
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Source%ld", RegistryName, SourceIndex); SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Source%ld", RegistryName, SourceIndex);
while (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) { while (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
// Display source statistic // Display source statistic
get_statistics(RegistryName); get_statistics(RegistryName);
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Stream%ld", RegistryName, StreamIndex);
while (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
// Display stream statistic
get_statistics(RegistryName);
StreamIndex++; SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Stream%ld", RegistryName, StreamIndex);
while (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
// Display stream statistic
get_statistics(RegistryName);
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld.Source%ld.Stream%ld", StreamIndex++;
RegistryPrefix, PlayerIndex, SourceIndex, StreamIndex);
} SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld.Source%ld.Stream%ld",
RegistryPrefix, PlayerIndex, SourceIndex, StreamIndex);
}
SourceIndex++; SourceIndex++;
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld.Source%ld", SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld.Source%ld",
RegistryPrefix, PlayerIndex, SourceIndex); RegistryPrefix, PlayerIndex, SourceIndex);
} }
PlayerIndex++; PlayerIndex++;
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld", SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld",
RegistryPrefix, PlayerIndex); RegistryPrefix, PlayerIndex);
} }
} }
} }
} }
@ -370,7 +370,7 @@ void HxAdviseSink::get_all_statistics() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
STDMETHODIMP HxAdviseSink::OnStatisticsChanged() { STDMETHODIMP HxAdviseSink::OnStatisticsChanged() {
if(_sink_on) { if(_sink_on) {
char Buff[1024]; char Buff[1024];
HX_RESULT res = HXR_OK; HX_RESULT res = HXR_OK;
UINT16 Player = 0; UINT16 Player = 0;
@ -397,7 +397,7 @@ STDMETHODIMP HxAdviseSink::OnStatisticsChanged() {
// Return: HX_RESULT - result varies. // Return: HX_RESULT - result varies.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
HX_RESULT HxAdviseSink::dump_reg_tree(const char* tree_name) { HX_RESULT HxAdviseSink::dump_reg_tree(const char* tree_name) {
//Initialize Local Variables related to the Registry Tree //Initialize Local Variables related to the Registry Tree
const char* pszName = NULL; const char* pszName = NULL;
ULONG32 ulRegID = 0; ULONG32 ulRegID = 0;
HX_RESULT res = HXR_OK; HX_RESULT res = HXR_OK;
@ -444,9 +444,9 @@ HX_RESULT HxAdviseSink::dump_reg_tree(const char* tree_name) {
_registry->GetStrById( ulRegID, pBuff ); _registry->GetStrById( ulRegID, pBuff );
STDOUT("%s : \"", pszName ); STDOUT("%s : \"", pszName );
if( pBuff ) { if( pBuff ) {
STDOUT("%s", (const char *)(pBuff->GetBuffer()) ); STDOUT("%s", (const char *)(pBuff->GetBuffer()) );
} }
STDOUT("\"\n" ); STDOUT("\"\n" );
HX_RELEASE(pBuff); HX_RELEASE(pBuff);
break; break;
@ -459,7 +459,7 @@ HX_RESULT HxAdviseSink::dump_reg_tree(const char* tree_name) {
default: default:
STDOUT("%s Unkown registry type entry\n", pszName ); STDOUT("%s Unkown registry type entry\n", pszName );
break; break;
} }
res = pValues->GetNextPropertyULONG32(pszName, ulRegID); res = pValues->GetNextPropertyULONG32(pszName, ulRegID);
} }
@ -650,4 +650,4 @@ STDMETHODIMP HxAdviseSink::OnContacting(const char* host_name) {
STDOUT("OnContacting(\"%s\")\n", host_name); STDOUT("OnContacting(\"%s\")\n", host_name);
} }
return HXR_OK; return HXR_OK;
} }

View File

@ -73,25 +73,25 @@ class HxAdviseSink : public IHXClientAdviseSink {
STDMETHOD(OnBuffering) (THIS_ ULONG32 flags, UINT16 percent_complete); STDMETHOD(OnBuffering) (THIS_ ULONG32 flags, UINT16 percent_complete);
STDMETHOD(OnContacting) (THIS_ const char* host_name); STDMETHOD(OnContacting) (THIS_ const char* host_name);
private: private:
// Private Member Functions // Private Member Functions
~HxAdviseSink(); ~HxAdviseSink();
HX_RESULT dump_reg_tree(const char* tree_name ); HX_RESULT dump_reg_tree(const char* tree_name );
void get_statistics (char* registry_key); void get_statistics (char* registry_key);
void get_all_statistics (void); void get_all_statistics (void);
// Private Member variables // Private Member variables
LONG32 _ref_count; LONG32 _ref_count;
LONG32 _client_index; LONG32 _client_index;
UINT32 _start_time; UINT32 _start_time;
UINT32 _stop_time; UINT32 _stop_time;
UINT32 _current_bandwidth; UINT32 _current_bandwidth;
UINT32 _average_bandwidth; UINT32 _average_bandwidth;
BOOL _on_stop; BOOL _on_stop;
bool _sink_on; bool _sink_on;
IUnknown* _unknown; IUnknown* _unknown;
IHXRegistry* _registry; IHXRegistry* _registry;
IHXScheduler* _scheduler; IHXScheduler* _scheduler;
}; };
#endif #endif

View File

@ -86,21 +86,21 @@ HX_RESULT HxAuthenticationManager::QueryInterface(THIS_ REFIID id, void** ppInte
// are supported. // are supported.
if (IsEqualIID(id, IID_IUnknown)) { if (IsEqualIID(id, IID_IUnknown)) {
// Increase the reference count, set the Interface Object, // Increase the reference count, set the Interface Object,
// and return that the interface is supported within this // and return that the interface is supported within this
// object. // object.
AddRef(); AddRef();
*ppInterfaceObj = (IUnknown*)(IHXAuthenticationManager *)this; *ppInterfaceObj = (IUnknown*)(IHXAuthenticationManager *)this;
} }
else if (IsEqualIID(id, IID_IHXAuthenticationManager)) { else if (IsEqualIID(id, IID_IHXAuthenticationManager)) {
// Same as above. // Same as above.
AddRef(); AddRef();
*ppInterfaceObj = (IHXAuthenticationManager *)this; *ppInterfaceObj = (IHXAuthenticationManager *)this;
} }
else { else {
// This Interface is not supported by this object. Set the // This Interface is not supported by this object. Set the
// Interface Object to the NULL-state and return. // Interface Object to the NULL-state and return.
*ppInterfaceObj = 0; *ppInterfaceObj = 0;
return HXR_NOINTERFACE; return HXR_NOINTERFACE;
} }
return HXR_OK; return HXR_OK;
} }
@ -119,7 +119,7 @@ HX_RESULT HxAuthenticationManager::QueryInterface(THIS_ REFIID id, void** ppInte
// Return: ULONG32 - The new reference count. // Return: ULONG32 - The new reference count.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
STDMETHODIMP_(ULONG32) HxAuthenticationManager::AddRef(THIS) { STDMETHODIMP_(ULONG32) HxAuthenticationManager::AddRef(THIS) {
return InterlockedIncrement(&_ref_count); return InterlockedIncrement(&_ref_count);
} }
@ -173,12 +173,12 @@ STDMETHODIMP_(ULONG32) HxAuthenticationManager::Release(THIS) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
STDMETHODIMP HxAuthenticationManager::HandleAuthenticationRequest(IHXAuthenticationManagerResponse* pResponse) STDMETHODIMP HxAuthenticationManager::HandleAuthenticationRequest(IHXAuthenticationManagerResponse* pResponse)
{ {
char username[1024] = ""; /* Flawfinder: ignore */ char username[1024] = ""; /* Flawfinder: ignore */
char password[1024] = ""; /* Flawfinder: ignore */ char password[1024] = ""; /* Flawfinder: ignore */
HX_RESULT res = HXR_FAIL; HX_RESULT res = HXR_FAIL;
if( !_sent_password ) if( !_sent_password )
{ {
res = HXR_OK; res = HXR_OK;
STDOUT("\nSending Username and Password...\n"); STDOUT("\nSending Username and Password...\n");
@ -202,9 +202,9 @@ STDMETHODIMP HxAuthenticationManager::HandleAuthenticationRequest(IHXAuthenticat
_sent_password = TRUE; _sent_password = TRUE;
} }
if (FAILED(res)) if (FAILED(res))
STDOUT("\nInvalid Username and/or Password.\n"); STDOUT("\nInvalid Username and/or Password.\n");
pResponse->AuthenticationRequestDone(res, username, password); pResponse->AuthenticationRequestDone(res, username, password);
return res; return res;
} }

View File

@ -64,4 +64,4 @@ class HxAuthenticationManager : public IHXAuthenticationManager {
INT32 _ref_count; INT32 _ref_count;
BOOL _sent_password; BOOL _sent_password;
}; };
#endif #endif

View File

@ -33,11 +33,11 @@
HxClientContext::HxClientContext(LONG32 client_index) HxClientContext::HxClientContext(LONG32 client_index)
: _ref_count(0), : _ref_count(0),
_client_index(client_index), _client_index(client_index),
_client_sink(0), _client_sink(0),
_error_sink(0), _error_sink(0),
_auth_mgr(0), _auth_mgr(0),
_site_supplier(0), _site_supplier(0),
_default_prefs(0) { _default_prefs(0) {
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -99,11 +99,11 @@ void HxClientContext::init(IUnknown* unknown, IHXPreferences* prefs, char* guid,
#endif #endif
if (_client_sink != 0) { if (_client_sink != 0) {
_client_sink->AddRef(); _client_sink->AddRef();
} }
if (_error_sink != 0) { if (_error_sink != 0) {
_error_sink->AddRef(); _error_sink->AddRef();
} }
if (_auth_mgr != 0) { if (_auth_mgr != 0) {
@ -116,13 +116,13 @@ void HxClientContext::init(IUnknown* unknown, IHXPreferences* prefs, char* guid,
if (prefs != 0) { if (prefs != 0) {
_default_prefs = prefs; _default_prefs = prefs;
_default_prefs->AddRef(); _default_prefs->AddRef();
} }
if (guid && *guid) { if (guid && *guid) {
// Encode GUID // Encode GUID
cipher = Cipher(guid); cipher = Cipher(guid);
SafeStrCpy(_guid, cipher, 256); SafeStrCpy(_guid, cipher, 256);
} }
else { else {
_guid[0] = '\0'; _guid[0] = '\0';
@ -172,41 +172,41 @@ HX_RESULT HxClientContext::QueryInterface(THIS_ REFIID id, void** interface_obj)
HX_RESULT result = HXR_NOINTERFACE; HX_RESULT result = HXR_NOINTERFACE;
// Determine if the IUnknown and ClientAdviseSink interfaces // Determine if the IUnknown and ClientAdviseSink interfaces
// are supported. // are supported.
if (IsEqualIID(id, IID_IUnknown)) { if (IsEqualIID(id, IID_IUnknown)) {
// Increase the reference count, set the Interface Object, // Increase the reference count, set the Interface Object,
// and return that the interface is supported within this // and return that the interface is supported within this
// object. // object.
AddRef(); AddRef();
*interface_obj = (IUnknown*)(IHXClientAdviseSink*)this; *interface_obj = (IUnknown*)(IHXClientAdviseSink*)this;
result = HXR_OK;
}
else if (IsEqualIID(id, IID_IHXPreferences)) {
// Same as above.
AddRef();
*interface_obj = (IHXPreferences*)this;
result = HXR_OK;
}
else if ((_client_sink != 0) &&
(_client_sink->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_error_sink != 0) &&
(_error_sink->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_auth_mgr != 0) &&
(_auth_mgr->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_site_supplier != 0) &&
(_site_supplier->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK; result = HXR_OK;
} }
else { else if (IsEqualIID(id, IID_IHXPreferences)) {
// This Interface is not supported by this object. Set the // Same as above.
// Interface Object to the NULL-state and return. AddRef();
*interface_obj = 0; *interface_obj = (IHXPreferences*)this;
} result = HXR_OK;
}
else if ((_client_sink != 0) &&
(_client_sink->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_error_sink != 0) &&
(_error_sink->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_auth_mgr != 0) &&
(_auth_mgr->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_site_supplier != 0) &&
(_site_supplier->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else {
// This Interface is not supported by this object. Set the
// Interface Object to the NULL-state and return.
*interface_obj = 0;
}
return result; return result;
} }
@ -288,18 +288,18 @@ STDMETHODIMP HxClientContext::ReadPref(const char* pref_key, IHXBuffer*& buffer)
char * cipher = 0; char * cipher = 0;
if ((stricmp(pref_key, CLIENT_GUID_REGNAME) == 0) && if ((stricmp(pref_key, CLIENT_GUID_REGNAME) == 0) &&
(*_guid != 0 )) { (*_guid != 0 )) {
// Create a buffer // Create a buffer
buffer = new CHXBuffer(); buffer = new CHXBuffer();
buffer->AddRef(); buffer->AddRef();
buffer->Set((UCHAR*)_guid, strlen(_guid) + 1); buffer->Set((UCHAR*)_guid, strlen(_guid) + 1);
} }
else if (_default_prefs != 0) { else if (_default_prefs != 0) {
result = _default_prefs->ReadPref(pref_key, buffer); result = _default_prefs->ReadPref(pref_key, buffer);
} }
else { else {
result = HXR_NOTIMPL; result = HXR_NOTIMPL;
} }
return result; return result;
} }
@ -322,6 +322,6 @@ STDMETHODIMP HxClientContext::WritePref(const char* pref_key, IHXBuffer *buffer)
return _default_prefs->WritePref(pref_key, buffer); return _default_prefs->WritePref(pref_key, buffer);
} }
else { else {
return HXR_OK; return HXR_OK;
} }
} }

View File

@ -85,4 +85,4 @@ private:
HxSiteSupplier * _site_supplier; HxSiteSupplier * _site_supplier;
IHXPreferences * _default_prefs; IHXPreferences * _default_prefs;
}; };
#endif #endif

View File

@ -39,7 +39,7 @@ HxErrorSink::HxErrorSink(IUnknown* unknown)
: ref_count(0), : ref_count(0),
_player(0) _player(0)
{ {
IHXClientEngine* pEngine = 0; IHXClientEngine* pEngine = 0;
unknown->QueryInterface(IID_IHXClientEngine, (void**)&pEngine ); unknown->QueryInterface(IID_IHXClientEngine, (void**)&pEngine );
if( pEngine != 0 ) if( pEngine != 0 )
{ {
@ -174,8 +174,8 @@ STDMETHODIMP_(ULONG32) HxErrorSink::Release() {
// Return: None // Return: None
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
STDMETHODIMP HxErrorSink::ErrorOccurred(const UINT8 severity, const UINT32 hx_code, STDMETHODIMP HxErrorSink::ErrorOccurred(const UINT8 severity, const UINT32 hx_code,
const UINT32 user_code, const char* user_string, const UINT32 user_code, const char* user_string,
const char* more_info_url) { const char* more_info_url) {
// Initialize Local Variables to the Method. // Initialize Local Variables to the Method.
char HXDefine[256]; char HXDefine[256];
@ -191,23 +191,23 @@ STDMETHODIMP HxErrorSink::ErrorOccurred(const UINT8 severity, const UINT32 hx_co
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Member: HxErrorSink::ConvertErrorToText // Member: HxErrorSink::ConvertErrorToText
// Access: Protected // Access: Protected
// Purpose: Converts the Helix error code to text for the // Purpose: Converts the Helix error code to text for the
// client to display. // client to display.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Params: hx_code - the error code to be translated to text. // Params: hx_code - the error code to be translated to text.
// buffer - Text buffer that holds the code. // buffer - Text buffer that holds the code.
// buffer_length - The length of the text buffer. // buffer_length - The length of the text buffer.
@ -226,4 +226,4 @@ void HxErrorSink::convert_to_string(const ULONG32 hx_code, char* buffer, UINT32
if (strlen(buffer) == 0) { if (strlen(buffer) == 0) {
SafeSprintf(buffer, buffer_length, "Can't convert the error code %p", hx_code); SafeSprintf(buffer, buffer_length, "Can't convert the error code %p", hx_code);
} }
} }

View File

@ -52,8 +52,8 @@ public:
// be called when an error message is generated. // be called when an error message is generated.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
STDMETHOD (ErrorOccurred) (THIS_ const UINT8 severity, const UINT32 hx_code, STDMETHOD (ErrorOccurred) (THIS_ const UINT8 severity, const UINT32 hx_code,
const UINT32 user_code, const char* user_string, const UINT32 user_code, const char* user_string,
const char* more_info_url); const char* more_info_url);
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// IHUnkown Interface Methods Prototypes // IHUnkown Interface Methods Prototypes
@ -74,4 +74,4 @@ protected:
INT32 ref_count; INT32 ref_count;
IHXPlayer* _player; IHXPlayer* _player;
}; };
#endif #endif

View File

@ -40,15 +40,15 @@
HxSiteSupplier::HxSiteSupplier(IUnknown* unknown, Texture* tex) HxSiteSupplier::HxSiteSupplier(IUnknown* unknown, Texture* tex)
: _ref_count(0), : _ref_count(0),
_site_manager(0), _site_manager(0),
_ccf(0), _ccf(0),
_unknown(unknown), _unknown(unknown),
_dest_buffer(0), _dest_buffer(0),
_texture(tex) { _texture(tex) {
if(_unknown) { if(_unknown) {
_unknown->QueryInterface(IID_IHXSiteManager, (void**)&_site_manager); _unknown->QueryInterface(IID_IHXSiteManager, (void**)&_site_manager);
_unknown->QueryInterface(IID_IHXCommonClassFactory, (void**)&_ccf); _unknown->QueryInterface(IID_IHXCommonClassFactory, (void**)&_ccf);
_unknown->AddRef(); _unknown->AddRef();
} }
} }
@ -83,14 +83,14 @@ HxSiteSupplier::~HxSiteSupplier() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
STDMETHODIMP HxSiteSupplier::QueryInterface(REFIID _id, void** _interface_obj) { STDMETHODIMP HxSiteSupplier::QueryInterface(REFIID _id, void** _interface_obj) {
if (IsEqualIID(_id, IID_IUnknown)) { if (IsEqualIID(_id, IID_IUnknown)) {
AddRef(); AddRef();
*_interface_obj = (IUnknown*)(IHXSiteSupplier*)this; *_interface_obj = (IUnknown*)(IHXSiteSupplier*)this;
return HXR_OK; return HXR_OK;
} }
else if (IsEqualIID(_id, IID_IHXSiteSupplier)) { else if (IsEqualIID(_id, IID_IHXSiteSupplier)) {
AddRef(); AddRef();
*_interface_obj = (IHXSiteSupplier*)this; *_interface_obj = (IHXSiteSupplier*)this;
return HXR_OK; return HXR_OK;
} }
*_interface_obj = NULL; *_interface_obj = NULL;
return HXR_NOINTERFACE; return HXR_NOINTERFACE;
@ -148,49 +148,49 @@ STDMETHODIMP_(ULONG32)HxSiteSupplier::Release() {
// IHXValues * pProps - The properties of the requested site // IHXValues * pProps - The properties of the requested site
// Return: None // Return: None
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
STDMETHODIMP HxSiteSupplier::SitesNeeded(UINT32 request_id, IHXValues* pProps) { STDMETHODIMP HxSiteSupplier::SitesNeeded(UINT32 request_id, IHXValues* pProps) {
// Determine if there are valid properties. If not then a site // Determine if there are valid properties. If not then a site
// can not properly be created. // can not properly be created.
if (!pProps) { if (!pProps) {
return HXR_INVALID_PARAMETER; return HXR_INVALID_PARAMETER;
} }
// Local Variable Declaration and Intialization // Local Variable Declaration and Intialization
HRESULT hres = HXR_OK; HRESULT hres = HXR_OK;
IHXValues* site_props = NULL; IHXValues* site_props = NULL;
IHXSiteWindowed* pSiteWindowed = NULL; IHXSiteWindowed* pSiteWindowed = NULL;
IHXBuffer* pValue = NULL; IHXBuffer* pValue = NULL;
UINT32 style = 0; UINT32 style = 0;
IHXSite* pSite = NULL; IHXSite* pSite = NULL;
// Just let the Helix client core create a windowed site for us. // Just let the Helix client core create a windowed site for us.
hres = _ccf->CreateInstance(CLSID_IHXSiteWindowed,(void**)&pSiteWindowed); hres = _ccf->CreateInstance(CLSID_IHXSiteWindowed,(void**)&pSiteWindowed);
if (HXR_OK != hres) { if (HXR_OK != hres) {
goto exit; goto exit;
} }
hres = pSiteWindowed->QueryInterface(IID_IHXSite,(void**)&pSite); hres = pSiteWindowed->QueryInterface(IID_IHXSite,(void**)&pSite);
if (HXR_OK != hres) { if (HXR_OK != hres) {
goto exit; goto exit;
} }
hres = pSiteWindowed->QueryInterface(IID_IHXValues,(void**)&site_props); hres = pSiteWindowed->QueryInterface(IID_IHXValues,(void**)&site_props);
if (HXR_OK != hres) { if (HXR_OK != hres) {
goto exit; goto exit;
} }
// Figures out what type of site must be created. // Figures out what type of site must be created.
hres = pProps->GetPropertyCString("playto",pValue); hres = pProps->GetPropertyCString("playto",pValue);
if (HXR_OK == hres) { if (HXR_OK == hres) {
site_props->SetPropertyCString("channel",pValue); site_props->SetPropertyCString("channel",pValue);
HX_RELEASE(pValue); HX_RELEASE(pValue);
} }
else { else {
hres = pProps->GetPropertyCString("name",pValue); hres = pProps->GetPropertyCString("name",pValue);
if (HXR_OK == hres) { if (HXR_OK == hres) {
site_props->SetPropertyCString("LayoutGroup",pValue); site_props->SetPropertyCString("LayoutGroup",pValue);
HX_RELEASE(pValue); HX_RELEASE(pValue);
} }
} }
#ifdef _WINDOWS #ifdef _WINDOWS
@ -201,34 +201,34 @@ STDMETHODIMP HxSiteSupplier::SitesNeeded(UINT32 request_id, IHXValues* pProps) {
// so that it may be sent down into the sites video // so that it may be sent down into the sites video
// surface object. // surface object.
if( _texture->has_ram_image() ) { if( _texture->has_ram_image() ) {
pSiteWindowed->SetDstBuffer(_texture->_pbuffer->_image, pSiteWindowed->SetDstBuffer(_texture->_pbuffer->_image,
_texture->_pbuffer->get_xsize(), _texture->_pbuffer->get_xsize(),
_texture->_pbuffer->get_ysize()); _texture->_pbuffer->get_ysize());
} }
else { else {
cout << "--- {{ HxSiteSupplier.cxx, RELOADED RAM IMAGE!!! }}---" << endl; cout << "--- {{ HxSiteSupplier.cxx, RELOADED RAM IMAGE!!! }}---" << endl;
PixelBuffer* fake = _texture->get_ram_image(); PixelBuffer* fake = _texture->get_ram_image();
if( fake ) { if( fake ) {
pSiteWindowed->SetDstBuffer(fake->_image, pSiteWindowed->SetDstBuffer(fake->_image,
_texture->_pbuffer->get_xsize(), _texture->_pbuffer->get_xsize(),
_texture->_pbuffer->get_ysize()); _texture->_pbuffer->get_ysize());
} }
else { else {
cout << "--- {{ HxSiteSupplier.cxx, NO RAM IMAGE PRESENT!!! }} ---" << endl; cout << "--- {{ HxSiteSupplier.cxx, NO RAM IMAGE PRESENT!!! }} ---" << endl;
} }
} }
// Create the window. Not necessary later on. // Create the window. Not necessary later on.
hres = pSiteWindowed->Create(NULL, style); hres = pSiteWindowed->Create(NULL, style);
//hres = pSiteWindowed->AttachWindow(NULL); //hres = pSiteWindowed->AttachWindow(NULL);
if (HXR_OK != hres) { if (HXR_OK != hres) {
goto exit; goto exit;
} }
// Add the site to the site manager. // Add the site to the site manager.
hres = _site_manager->AddSite(pSite); hres = _site_manager->AddSite(pSite);
if (HXR_OK != hres) { if (HXR_OK != hres) {
goto exit; goto exit;
} }
_created_sites.SetAt((void*)request_id,pSite); _created_sites.SetAt((void*)request_id,pSite);
@ -258,13 +258,13 @@ STDMETHODIMP HxSiteSupplier::SitesNeeded(UINT32 request_id, IHXValues* pProps) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
STDMETHODIMP HxSiteSupplier::SitesNotNeeded(UINT32 request_id) { STDMETHODIMP HxSiteSupplier::SitesNotNeeded(UINT32 request_id) {
// Local Variable Declaration and Initialization // Local Variable Declaration and Initialization
IHXSite* pSite = NULL; IHXSite* pSite = NULL;
IHXSiteWindowed* pSiteWindowed = NULL; IHXSiteWindowed* pSiteWindowed = NULL;
void* pVoid = NULL; void* pVoid = NULL;
// search for the site id in the map // search for the site id in the map
if (!_created_sites.Lookup((void*)request_id,pVoid)) { if (!_created_sites.Lookup((void*)request_id,pVoid)) {
return HXR_INVALID_PARAMETER; return HXR_INVALID_PARAMETER;
} }
//SITES::iterator iter = _created_sites.find(request_id); //SITES::iterator iter = _created_sites.find(request_id);
//if(iter == _created_sites.end()) { //if(iter == _created_sites.end()) {
@ -319,4 +319,4 @@ STDMETHODIMP HxSiteSupplier::BeginChangeLayout() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
STDMETHODIMP HxSiteSupplier::DoneChangeLayout() { STDMETHODIMP HxSiteSupplier::DoneChangeLayout() {
return HXR_OK; return HXR_OK;
} }

View File

@ -64,4 +64,4 @@ private:
UCHAR* _dest_buffer; UCHAR* _dest_buffer;
Texture* _texture; Texture* _texture;
}; };
#endif #endif

View File

@ -71,4 +71,4 @@ typedef HX_RESULT (HXEXPORT_PTR FPRMSETDLLACCESSPATH) (const char*);
//#include "fivemmap.h" //#include "fivemmap.h"
#include <common/system/pub/dllacces.h> #include <common/system/pub/dllacces.h>
#include <common/system/pub/dllpath.h> #include <common/system/pub/dllpath.h>
#include <common/util/pub/hxstrutl.h> */ #include <common/util/pub/hxstrutl.h> */

View File

@ -73,12 +73,12 @@ BOOL FiveMinuteMap::Lookup(void* Key, void*& Value) const
// If Key is alrady in the list, replace value // If Key is alrady in the list, replace value
for (; nIndex < m_nMapSize; nIndex++) for (; nIndex < m_nMapSize; nIndex++)
{ {
if (KeyArray[nIndex] == Key) if (KeyArray[nIndex] == Key)
{ {
Value = ValueArray[nIndex]; Value = ValueArray[nIndex];
bFound = TRUE; bFound = TRUE;
goto exit; goto exit;
} }
} }
exit: exit:
@ -93,16 +93,16 @@ void FiveMinuteMap::RemoveKey(void* Key)
// If Key is alrady in the list, replace value // If Key is alrady in the list, replace value
for (; nIndex < m_nMapSize; nIndex++) for (; nIndex < m_nMapSize; nIndex++)
{ {
if (KeyArray[nIndex] == Key) if (KeyArray[nIndex] == Key)
{ {
if (nIndex < (m_nMapSize-1)) if (nIndex < (m_nMapSize-1))
{ {
memmove(&(KeyArray[nIndex]),&(KeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1))); memmove(&(KeyArray[nIndex]),&(KeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
memmove(&(ValueArray[nIndex]),&(ValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1))); memmove(&(ValueArray[nIndex]),&(ValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
} }
m_nMapSize--; m_nMapSize--;
goto exit; goto exit;
} }
} }
exit: exit:
@ -117,16 +117,16 @@ void FiveMinuteMap::RemoveValue(void* Value)
// If Value is alrady in the list, replace value // If Value is alrady in the list, replace value
for (; nIndex < m_nMapSize; nIndex++) for (; nIndex < m_nMapSize; nIndex++)
{ {
if (ValueArray[nIndex] == Value) if (ValueArray[nIndex] == Value)
{ {
if (nIndex < (m_nMapSize-1)) if (nIndex < (m_nMapSize-1))
{ {
memmove(&(KeyArray[nIndex]),&(KeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1))); memmove(&(KeyArray[nIndex]),&(KeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
memmove(&(ValueArray[nIndex]),&(ValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1))); memmove(&(ValueArray[nIndex]),&(ValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
} }
m_nMapSize--; m_nMapSize--;
goto exit; goto exit;
} }
} }
exit: exit:
@ -141,28 +141,28 @@ void FiveMinuteMap::SetAt(void* Key, void* Value)
// If Key is alrady in the list, replace value // If Key is alrady in the list, replace value
for (; nIndex < m_nMapSize; nIndex++) for (; nIndex < m_nMapSize; nIndex++)
{ {
if (KeyArray[nIndex] == Key) if (KeyArray[nIndex] == Key)
{ {
ValueArray[nIndex] = Value; ValueArray[nIndex] = Value;
goto exit; goto exit;
} }
} }
// If we have room, add it to the end! // If we have room, add it to the end!
if (m_nAllocSize == m_nMapSize) if (m_nAllocSize == m_nMapSize)
{ {
m_nAllocSize += AllocationSize; m_nAllocSize += AllocationSize;
void** pNewKeys = new void*[m_nAllocSize]; void** pNewKeys = new void*[m_nAllocSize];
void** pNewValues = new void*[m_nAllocSize]; void** pNewValues = new void*[m_nAllocSize];
memcpy(pNewKeys,KeyArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */ memcpy(pNewKeys,KeyArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
memcpy(pNewValues,ValueArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */ memcpy(pNewValues,ValueArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
delete [] KeyArray; delete [] KeyArray;
delete [] ValueArray; delete [] ValueArray;
KeyArray = pNewKeys; KeyArray = pNewKeys;
ValueArray = pNewValues; ValueArray = pNewValues;
} }
KeyArray[m_nMapSize] = Key; KeyArray[m_nMapSize] = Key;

View File

@ -50,24 +50,24 @@ class FiveMinuteMap {
void** KeyArray; void** KeyArray;
void** ValueArray; void** ValueArray;
int m_nMapSize; int m_nMapSize;
int m_nAllocSize; int m_nAllocSize;
int m_nCursor; int m_nCursor;
public: public:
FiveMinuteMap() FiveMinuteMap()
: KeyArray(NULL) : KeyArray(NULL)
, ValueArray(NULL) , ValueArray(NULL)
, m_nMapSize(0) , m_nMapSize(0)
, m_nAllocSize(0) , m_nAllocSize(0)
, m_nCursor(0) , m_nCursor(0)
, AllocationSize(10) , AllocationSize(10)
{}; {};
~FiveMinuteMap() ~FiveMinuteMap()
{ {
delete [] KeyArray; delete [] KeyArray;
delete [] ValueArray; delete [] ValueArray;
}; };
int GetCount() {return m_nMapSize;} int GetCount() {return m_nMapSize;}

View File

@ -35,8 +35,8 @@ int main( int argc, char *argv[] )
//Do Nothing for now //Do Nothing for now
MSG msg; MSG msg;
GetMessage(&msg, NULL, 0, 0); GetMessage(&msg, NULL, 0, 0);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
delete myClient; delete myClient;
@ -59,4 +59,4 @@ int main( int argc, char *argv[] )