mirror of
https://github.com/panda3d/panda3d.git
synced 2026-02-11 17:49:01 -06:00
Remove helix
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
parametrics \
|
||||
pnmimagetypes pnmimage \
|
||||
pnmtext text tform lerp putil \
|
||||
audio pgui pandabase helix
|
||||
audio pgui pandabase
|
||||
|
||||
#define LOCAL_LIBS \
|
||||
downloader express pandabase
|
||||
|
||||
@@ -1,798 +0,0 @@
|
||||
// Filename: HelixClient.cxx
|
||||
// Created by: jjtaylor (10Feb04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Panda Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "helixclient.h"
|
||||
|
||||
// Initialize Static Data Members.
|
||||
TypeHandle HelixClient::_type_handle;
|
||||
|
||||
// Static Members used for the DoEvents Method. These might
|
||||
// be removed in the future since Panda calls the Win32 API
|
||||
// Message calls internally.
|
||||
const int HelixClient::_time_delta = 2000;
|
||||
const int HelixClient::_sleep_time = 10;
|
||||
const int HelixClient::_guid_length = 64;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::HelixClient()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This is the default constructor for creating the
|
||||
// the wrapper object that encapsulates the Helix Engine.
|
||||
// The constructor calls the init() which loads the main
|
||||
// Helix DLL, clntcore.dll.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HelixClient::HelixClient()
|
||||
: _engine(0),
|
||||
_dll_access(0) {
|
||||
const char * envName = "PLAYER";
|
||||
char* envPath = getenv( envName );
|
||||
_dll_home = string(string(envPath) + "\\ExtLib\\HelixLib\\.");
|
||||
init();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::~HelixClient()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This is the destructor for the HelixClient proxy class.
|
||||
// The destructor simply invokes the shutdown(), which
|
||||
// closes any open players on the engine, successfully
|
||||
// frees the DLLAccess and engine objects.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HelixClient::~HelixClient() {
|
||||
shutdown();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::do_event()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This method is was used primarily in the Win32
|
||||
// test application to give the Helix Engine the necessary
|
||||
// time slices to keep it running properly. In addition,
|
||||
// it has been modified to manually set each texture in
|
||||
// the _textures map to dirty. This means that the image
|
||||
// will be loaded once again into memory, essentially
|
||||
// updating the texture each frame with the new video
|
||||
// image applied to it.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::do_event() {
|
||||
// Legacy Win32 API code from the test application. This can
|
||||
// probably be removed since Panda already calls these methods
|
||||
// for retreiving and dispatching Win32 messages.
|
||||
MSG msg;
|
||||
GetMessage(&msg, NULL, 0, 0);
|
||||
DispatchMessage(&msg);
|
||||
|
||||
// Simply iterate through the _textures map and set the texture
|
||||
// dirty so that it will be updated in memory.
|
||||
TEXTURES::iterator iter;
|
||||
for(iter = _textures.begin(); iter != _textures.end(); iter++) {
|
||||
iter->second->mark_dirty(Texture::DF_image);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::do_events()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This method was used primarily in the Win32
|
||||
// test application to give the Helix Engine the necessary
|
||||
// time slices to keep it running properly. It is still
|
||||
// used in the HelixClient::begin() to get the engine
|
||||
// started for playback, but it most likely can be safely
|
||||
// removed in the future.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::do_events() {
|
||||
MSG msg;
|
||||
DWORD start_time, end_time, i;
|
||||
BOOL sleep = TRUE;
|
||||
static const int check_interval = 10;
|
||||
start_time = GetTickCount();
|
||||
end_time = start_time + _time_delta;
|
||||
i = 0;
|
||||
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
DispatchMessage(&msg);
|
||||
if((i % check_interval) == 0) {
|
||||
if(GetTickCount() > end_time) {
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
sleep = FALSE;
|
||||
}
|
||||
if(sleep) {
|
||||
Sleep(_sleep_time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::create_player(...)
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper method encapsulates the creation of a
|
||||
// player object for the Helix Engine.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const string &name - Desired name of the Player
|
||||
// Texture* tex - Panda Texture that is to be udpated with
|
||||
// the video that this player will run.
|
||||
// bool sink_on - Determines with the HxAdviseSink Object
|
||||
// should print out the presentation stats
|
||||
// in the command prompt.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::create_player(const string &name, Texture* tex, bool sink_on) {
|
||||
// Check to make certain that the engine interface has been
|
||||
// instantiated, otherwise, players cannot be created!
|
||||
if (_engine != 0) {
|
||||
|
||||
// For now, check if there is an actual Panda texture present. If not,
|
||||
// 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
|
||||
// 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
|
||||
// for that player must be created.
|
||||
context = new HxClientContext(_players.size());
|
||||
if(context != 0) {
|
||||
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.
|
||||
tmp_player->QueryInterface(IID_IHXPreferences, (void**)&pref);
|
||||
|
||||
// Send the Texture buffer down into the Context. It will then
|
||||
// ship the buffer to the site supplier, where the actual site
|
||||
// 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
|
||||
tmp_player->QueryInterface(IID_IHXErrorSinkControl, (void**)&controller);
|
||||
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 {
|
||||
STDOUT("ERROR: In HelixClient::CreatePlayer, pEngine = NULL");
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::close_player(...)
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper method encapsulates the closing of a
|
||||
// player object for the Helix Engine. This method
|
||||
// determines if a player with the designated name exists
|
||||
// by searching the _players map. If it does, it properly
|
||||
// closes the player, deletes it from memory, and removes
|
||||
// the pair instance from the map as well as its texture
|
||||
// counter part.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const string &name - Desired name of the Player to close.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::close_player(const string &name) {
|
||||
if (_engine != 0) {
|
||||
IUnknown* context = 0;
|
||||
// Determine if the player is in the map. If so, go about
|
||||
// removing that player from the engine.
|
||||
PLAYERS::iterator iter = _players.find(name);
|
||||
if (iter != _players.end()) {
|
||||
iter->second->Stop();
|
||||
iter->second->GetClientContext(context);
|
||||
context->Release();
|
||||
context = 0;
|
||||
_engine->ClosePlayer(iter->second);
|
||||
iter->second->Release();
|
||||
iter->second = 0;
|
||||
// Remove the player its associated texture from their
|
||||
// respective maps.
|
||||
_players.erase(name);
|
||||
_textures.erase(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::close_all_players()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper method encapsulates the closing of every
|
||||
// player object for the Helix Engine. This method simply
|
||||
// iterates through the _players map, and invokes the
|
||||
// the close_player routine to actually close the player.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: none
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::close_all_players() {
|
||||
if (_engine != 0) {
|
||||
if (!_players.empty()) {
|
||||
IUnknown* context = 0;
|
||||
PLAYERS::iterator iter;
|
||||
|
||||
// Iterate through the _players map to close each player
|
||||
// currently associated with the engine.
|
||||
unsigned int total_players = _players.size();
|
||||
for (unsigned int cntr = 0; cntr <= total_players; cntr++) {
|
||||
close_player(_players.begin()->first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::get_player_count()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper method simply returns the current number
|
||||
// of players that are associated with the Helix Engine.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: Int - the number of players currently associated with
|
||||
// the Helix Engine.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int HelixClient::get_player_count() {
|
||||
if (_engine != 0) {
|
||||
return _engine->GetPlayerCount();
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::init()
|
||||
// Access: Private
|
||||
// Purpose: This member function provides all of the dirty work
|
||||
// for instantiating a Helix Engine object. First it
|
||||
// searches for the main Helix DLL, clntcore.dll, and then
|
||||
// it instantiates the actual engine itself.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: bool - True if the engine is successfully initialized.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool HelixClient::init() {
|
||||
// Local Variable Defination and Initialization
|
||||
FPRMCREATEENGINE create_engine = 0;
|
||||
FPRMSETDLLACCESSPATH set_dll_access_path = 0;
|
||||
// Instantiate a DLLAccess object which will be used to properly
|
||||
// load the clntcore.dll at runtime.
|
||||
_dll_access = new DLLAccess();
|
||||
|
||||
// Attempt to load the clntcore.dll. If this fails, an error message will
|
||||
// be generated and printed to the console.
|
||||
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())) {
|
||||
const char * error_string = 0;
|
||||
error_string = _dll_access->getErrorString();
|
||||
STDERR("HelixClient: %s\n\n", error_string);
|
||||
|
||||
// Print out an explanation of what is wrong.
|
||||
STDERR("You must tell the player where to find the client core and\n");
|
||||
STDERR("all of its supporting DLLs and codecs.\n");
|
||||
|
||||
// Deallocate the memory from the heap to avoid a memory leak.
|
||||
delete _dll_access;
|
||||
_dll_access = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now that the client core has been loaded, retrieve the function pointer
|
||||
// to the engine and the DLL access path.
|
||||
create_engine = (FPRMCREATEENGINE) _dll_access->getSymbol("CreateEngine");
|
||||
set_dll_access_path = (FPRMSETDLLACCESSPATH) _dll_access->getSymbol("SetDLLAccessPath");
|
||||
|
||||
// If either function pointer was not retreived, print an error message to
|
||||
// the console, deallocate the DLLAccess object from memory, and abort the
|
||||
// initialization of the engine.
|
||||
if((create_engine == 0) || (set_dll_access_path == 0)) {
|
||||
STDOUT("---{ERROR: HelixClient::Init, set_dll_access_path}---");
|
||||
|
||||
delete _dll_access;
|
||||
_dll_access = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now that the clntcore.dll has been succesfully loaded. Specify where it
|
||||
// can find all of the accompanying DLLs that are necessary for Helix to
|
||||
// function.
|
||||
char paths[256];
|
||||
char* path_next_position = paths;
|
||||
memset(paths, 0, 256);
|
||||
UINT32 bytes_left = 256;
|
||||
|
||||
char next_path[256];
|
||||
memset(next_path, 0, 256);
|
||||
|
||||
// Apply the Common DLL Path to the paths string. For simplicity,
|
||||
// this is the same path as the clntcore.dll path.
|
||||
SafeSprintf(next_path, 256, "DT_Common=%s", _dll_home.c_str());
|
||||
STDERR("Common DLL path %s\n", next_path );
|
||||
UINT32 bytes_to_copy = strlen(next_path) + 1;
|
||||
if (bytes_to_copy <= bytes_left)
|
||||
{
|
||||
memcpy(path_next_position, next_path, bytes_to_copy);
|
||||
path_next_position += bytes_to_copy;
|
||||
bytes_left -= bytes_to_copy;
|
||||
}
|
||||
|
||||
// Apply the Plug-in DLL Path to the paths string. For simplicity,
|
||||
// this is the same path as the clntcore.dll path.
|
||||
SafeSprintf(next_path, 256, "DT_Plugins=%s", _dll_home.c_str());
|
||||
STDERR("Plugin path %s\n", next_path );
|
||||
bytes_to_copy = strlen(next_path) + 1;
|
||||
|
||||
if (bytes_to_copy <= bytes_left)
|
||||
{
|
||||
memcpy(path_next_position, next_path, bytes_to_copy);
|
||||
path_next_position += bytes_to_copy;
|
||||
bytes_left -= bytes_to_copy;
|
||||
}
|
||||
|
||||
// Apply the Codecs DLL Path to the paths string. For simplicity,
|
||||
// this is the same path as the clntcore.dll path.
|
||||
SafeSprintf(next_path, 256, "DT_Codecs=%s", _dll_home.c_str());
|
||||
bytes_to_copy = strlen(next_path) + 1;
|
||||
if (bytes_to_copy <= bytes_left)
|
||||
{
|
||||
memcpy(path_next_position, next_path, bytes_to_copy);
|
||||
path_next_position += bytes_to_copy;
|
||||
bytes_left -= bytes_to_copy;
|
||||
*path_next_position='\0';
|
||||
}
|
||||
STDOUT((char*)paths);
|
||||
set_dll_access_path((char*)paths);
|
||||
|
||||
// The dll_access_path has been set, so the engine can now be initialized. If
|
||||
// this fails, then deallocate the DLLAccess object from memory and abort the
|
||||
// initialization of the engine.
|
||||
if (HXR_OK != create_engine((IHXClientEngine**) &_engine)) {
|
||||
STDOUT("---{ERROR: HelixClient::Init, Creating Engine Problem}---");
|
||||
|
||||
delete _dll_access;
|
||||
_dll_access = 0;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::shutdown()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This member function closes all open players before it
|
||||
// proceeds to close the engine itself.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::shutdown() {
|
||||
if (_engine != 0) {
|
||||
// Close All Open Players that are associated with the
|
||||
// given Helix Engine.
|
||||
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
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::begin(...)
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function encapsulates the Helix Player
|
||||
// Begin method. It first searches for the name of the
|
||||
// specified player within the _players map. If that
|
||||
// is found, it calls the IHXPlayer::Begin method.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const string &name - Name of the Player to begin playback.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::begin(const string &name) {
|
||||
if (_engine != 0) {
|
||||
|
||||
// Search for the specified player in the map. If the player
|
||||
// is found, begin playback of the media file.
|
||||
PLAYERS::iterator iter = _players.find(name);
|
||||
if (iter != _players.end()) {
|
||||
iter->second->Begin();
|
||||
}
|
||||
|
||||
// This is legacy code from the test application, however, it
|
||||
// was necessary for helix to function since do_events was called
|
||||
// to give helix the necessary time-slice of the CPU. I think this
|
||||
// most likely can be removed since Panda calls the necessary
|
||||
// Win32 API Message calls.
|
||||
//UINT curr_time = 0;
|
||||
//UINT32 start_time = GetTickCount();
|
||||
//UINT32 end_time = start_time + _time_delta;
|
||||
//while(1) {
|
||||
// do_events();
|
||||
//curr_time = GetTickCount();
|
||||
//if(curr_time >= end_time)
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::begin_all()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function simply calls the IHXPlayer::Begin
|
||||
// routine for each player currently associated with the
|
||||
// the engine.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::begin_all() {
|
||||
if (_engine != 0) {
|
||||
|
||||
// Iterate through the _players map and call the Begin
|
||||
// routine to start playback of the media.
|
||||
PLAYERS::iterator iter;
|
||||
for(iter = _players.begin(); iter != _players.end(); iter++) {
|
||||
iter->second->Begin();
|
||||
}
|
||||
|
||||
// This is legacy code from the test application, however, it
|
||||
// was necessary for helix to function since do_events was called
|
||||
// to give helix the necessary time-slice of the CPU. I think this
|
||||
// most likely can be removed since Panda calls the necessary
|
||||
// Win32 API Message calls.
|
||||
// UINT curr_time = 0;
|
||||
// UINT32 start_time = GetTickCount();
|
||||
// UINT32 end_time = start_time + _time_delta;
|
||||
// while(1) {
|
||||
// do_events();
|
||||
// curr_time = GetTickCount();
|
||||
// if (curr_time >= end_time)
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::pause(...)
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function encapsulates the Helix Player
|
||||
// Pause method. It first searches for the name of the
|
||||
// specified player within the _players map. If that
|
||||
// is found, it calls the IHXPlayer::Pause method.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const string &name - Name of the Player to pause playback.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::pause(const string &name) {
|
||||
// Search for the specified player in the map. If the player
|
||||
// is found, pause the playback of the media file.
|
||||
if (_engine != 0) {
|
||||
PLAYERS::iterator iter = _players.find(name);
|
||||
if (iter != _players.end()) {
|
||||
iter->second->Pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::pause_all()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function simply calls the IHXPlayer::Pause
|
||||
// routine for each player currently associated with the
|
||||
// the engine.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::pause_all() {
|
||||
if (_engine != 0) {
|
||||
// Iterate through the _players map and call the Pause
|
||||
// routine to start playback of the media.
|
||||
PLAYERS::iterator iter;
|
||||
for(iter = _players.begin(); iter != _players.end(); iter++) {
|
||||
iter->second->Pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::seek(...)
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function encapsulates the Helix Player
|
||||
// Pause method. It first searches for the name of the
|
||||
// specified player within the _players map. If that
|
||||
// is found, it calls the IHXPlayer::Pause method.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const string &name - Name of the Player to seek to a
|
||||
// current time in the playback.
|
||||
// long &time - the time to seek to in the playback.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::seek_time(const string &name, long time) {
|
||||
if (_engine != 0) {
|
||||
// Search for the specified player in the map. If the player
|
||||
// is found, seek to the current time in the playback of the
|
||||
// media file.
|
||||
PLAYERS::iterator iter = _players.find(name);
|
||||
if (iter != _players.end()) {
|
||||
iter->second->Seek(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::stop(...)
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function encapsulates the Helix Player
|
||||
// Stop method. It first searches for the name of the
|
||||
// specified player within the _players map. If that
|
||||
// is found, it calls the IHXPlayer::Stop method which
|
||||
// stops the playback of the media.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const string &name - Name of the Player to stop playback.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::stop(const string &name) {
|
||||
if (_engine != 0) {
|
||||
// Search for the specified player in the map. If the player
|
||||
// is found, stop the playback of the media file.
|
||||
PLAYERS::iterator iter = _players.find(name);
|
||||
if (iter != _players.end()) {
|
||||
iter->second->Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::stop_all()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function simply calls the IHXPlayer::Stop
|
||||
// routine for each player currently associated with the
|
||||
// the engine.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::stop_all() {
|
||||
if (_engine != 0) {
|
||||
// Iterate through the _players map and call the Pause
|
||||
// routine to stop playback of the media.
|
||||
PLAYERS::iterator iter;
|
||||
for(iter = _players.begin(); iter != _players.end(); iter++) {
|
||||
iter->second->Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::open_url(...)
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function encapsulates the Helix Player
|
||||
// OpenURL method. It first searches for the name of the
|
||||
// specified player within the _players map. If that
|
||||
// is found, it calls the IHXPlayer::OpenURL method which
|
||||
// actually opens the specified media format. URLs can
|
||||
// come in two forms:
|
||||
//
|
||||
// Remote File: rtsp://www.realone.com/somevideo.ram
|
||||
// Local File: file://f:\\smildemohurl.ram
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const string &name - Name of the Player to open the URL.
|
||||
// string url - Name of the URL to be opened for playback.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HelixClient::open_url(const string &name, string url) {
|
||||
if (_engine != 0) {
|
||||
// Determine if a URL has been specified within the string.
|
||||
// If it hasn't, assume that the request has been made for
|
||||
// a local file, so insert, file://, at the beginning of the
|
||||
// string.
|
||||
if (url.find("://")==string::npos) {
|
||||
url.insert(0,"file://");
|
||||
}
|
||||
|
||||
// Check wheter the player specified exists
|
||||
// within the map. If it does, call the IHXPlayer::OpenURL(...)
|
||||
PLAYERS::iterator iter = _players.find(name);
|
||||
if (iter != _players.end()) {
|
||||
iter->second->OpenURL(url.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::is_live(...)
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function encapsulates the Helix Player
|
||||
// IsLive method. It first searches for the name of the
|
||||
// specified player within the _players map. If that
|
||||
// is found, it calls the IHXPlayer::IsLive method. This
|
||||
// indicates whether the player contains a live source
|
||||
// or not.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const string &name - Name of the Player to check.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool HelixClient::is_live(const string &name) {
|
||||
if (_engine != 0) {
|
||||
// Search for the specified player in the map. If the player
|
||||
// is found, check to see if it contains a live media source.
|
||||
PLAYERS::iterator iter = _players.find(name);
|
||||
if (iter != _players.end()) {
|
||||
return (iter->second->IsLive()) ? true : false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::is_done(...)
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function encapsulates the Helix Player
|
||||
// IsDone method. It first searches for the name of the
|
||||
// specified player within the _players map. If that
|
||||
// is found, it calls the IHXPlayer::IsDone method. This
|
||||
// indicates whether the player is finished playing the
|
||||
// the current presentation.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const string &name - Name of the Player to check.
|
||||
// Return: bool - true if the player has finished playback,
|
||||
// otherwise it is false.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool HelixClient::is_done(const string &name) {
|
||||
if (_engine != 0) {
|
||||
// Search for the specified player in the map. If the player
|
||||
// is found, check to see if it has finished playing the
|
||||
// the current presentation.
|
||||
PLAYERS::iterator iter = _players.find(name);
|
||||
if (iter != _players.end()) {
|
||||
return iter->second->IsDone();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::are_players_done()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function simply calls the IHXPlayer::IsDone
|
||||
// routine for each player currently associated with the
|
||||
// the engine. If all of the players have finished with
|
||||
// their respective presentations, it returns true.
|
||||
// Otherwise it would return false.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: bool - true if all players finished playback, otherwise
|
||||
// it is false.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool HelixClient::are_players_done() {
|
||||
if (_engine != 0) {
|
||||
bool done = true;
|
||||
PLAYERS::iterator iter;
|
||||
for(iter = _players.begin(); iter != _players.end(); iter++) {
|
||||
if(!iter->second->IsDone()) {
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
return done;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HelixClient::get_source_count()
|
||||
// Access: PUBLISHED
|
||||
// Purpose: This wrapper function simply calls the
|
||||
// IHXPlayer::GetSourceCount routine. This returns the
|
||||
// number of stream source instances currently used by
|
||||
// the player. In case of audio, it would be 1. In case
|
||||
// of a movie file, it would be 2.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const string &name - Name of the Player to check.
|
||||
// Return: Int - value of source count or -1 if there is no player
|
||||
// or engine.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int HelixClient::get_source_count(const string &name) {
|
||||
if (_engine != 0) {
|
||||
// Search for the specified player in the map. If the player
|
||||
// is found, check to see if it has finished playing the
|
||||
// the current presentation.
|
||||
PLAYERS::iterator iter = _players.find(name);
|
||||
if (iter != _players.end()) {
|
||||
return iter->second->GetSourceCount();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
// Filename: HelixClient.h
|
||||
// Created by: jjtaylor (10Feb04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#ifndef HELIXCLIENT_H
|
||||
#define HELIXCLIENT_H
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Panda Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "typedObject.h"
|
||||
#include "texture.h"
|
||||
#include "pmap.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Helix Main Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include <mainHelix.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Normal Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class: HelixClient
|
||||
// Purpose: This proxy class provides the top-level interface for
|
||||
// loading the Helix Client Engine, creating players on
|
||||
// the Helix engine, and initializing the media playback.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA_HELIX HelixClient {
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
register_type(_type_handle, "HelixClient");
|
||||
}
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
PUBLISHED:
|
||||
HelixClient();
|
||||
~HelixClient();
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// IHXClientEngine Interface Methods
|
||||
// Purpose: These are wrapper methods that invoke the actual Helix
|
||||
// Engine Interface method calls. For instance, the method
|
||||
// create_player invotes the Helix Engine method
|
||||
// engine->CreatePlayer().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void create_player(const string &name, Texture* tex = 0, bool sink_on = false);
|
||||
void close_player(const string &name);
|
||||
void close_all_players();
|
||||
int get_player_count();
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// IHXPlayer Interface Methods Prototypes
|
||||
// Purpose: These are wrapper methods that invoke the actual Helix
|
||||
// Player Interface method calls. For instance, the method
|
||||
// begin invotes the Helix Engine method player->Begin().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void begin(const string &name);
|
||||
void pause(const string &name);
|
||||
void seek_time(const string &name, long time);
|
||||
void stop(const string &name);
|
||||
|
||||
void begin_all();
|
||||
void pause_all();
|
||||
void stop_all();
|
||||
|
||||
void open_url(const string &name, string url);
|
||||
int get_source_count(const string &name);
|
||||
bool is_done(const string &name);
|
||||
bool is_live(const string &name);
|
||||
bool are_players_done();
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Utility Method Prototypes
|
||||
// Purpose: These methods provide basic utility functions which are
|
||||
// necessary for the Helix engine to play and close.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void do_event();
|
||||
void do_events();
|
||||
void shutdown();
|
||||
private:
|
||||
// Private Member Functions
|
||||
bool init();
|
||||
|
||||
// Private Member variables
|
||||
DLLAccess* _dll_access;
|
||||
|
||||
string _dll_home;
|
||||
static const int _time_delta;
|
||||
static const int _sleep_time;
|
||||
static const int _guid_length;
|
||||
|
||||
// Where the Engine will actually reside.
|
||||
IHXClientEngine* _engine;
|
||||
|
||||
typedef pmap<string, IHXPlayer*> PLAYERS;
|
||||
typedef pmap<string, PT(Texture)> TEXTURES;
|
||||
|
||||
PLAYERS _players;
|
||||
TEXTURES _textures;
|
||||
};
|
||||
#endif
|
||||
@@ -1,421 +0,0 @@
|
||||
#ifndef HELIX_CONFIG_MS_PSDK
|
||||
#define HELIX_CONFIG_MS_PSDK 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_3GPP
|
||||
#define HELIX_FEATURE_3GPP 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_ADVANCEDGROUPMGR
|
||||
#define HELIX_FEATURE_ADVANCEDGROUPMGR 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_ALT_URL
|
||||
#define HELIX_FEATURE_ALT_URL 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_ASM
|
||||
#define HELIX_FEATURE_ASM 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO
|
||||
#define HELIX_FEATURE_AUDIO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIOHOOK
|
||||
#define HELIX_FEATURE_AUDIOHOOK 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_CODEC_28_8
|
||||
#define HELIX_FEATURE_AUDIO_CODEC_28_8 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_CODEC_AMRNB
|
||||
#define HELIX_FEATURE_AUDIO_CODEC_AMRNB 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_CODEC_AMRWB
|
||||
#define HELIX_FEATURE_AUDIO_CODEC_AMRWB 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_CODEC_GECKO
|
||||
#define HELIX_FEATURE_AUDIO_CODEC_GECKO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_CODEC_INTERLEAVE_ALL
|
||||
#define HELIX_FEATURE_AUDIO_CODEC_INTERLEAVE_ALL 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_CODEC_O5_6
|
||||
#define HELIX_FEATURE_AUDIO_CODEC_O5_6 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_CODEC_RAAC
|
||||
#define HELIX_FEATURE_AUDIO_CODEC_RAAC 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_CODEC_SIPRO
|
||||
#define HELIX_FEATURE_AUDIO_CODEC_SIPRO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_CODEC_TOKYO
|
||||
#define HELIX_FEATURE_AUDIO_CODEC_TOKYO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_INACCURATESAMPLING
|
||||
#define HELIX_FEATURE_AUDIO_INACCURATESAMPLING 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_INCOMPLETESAMPLE
|
||||
#define HELIX_FEATURE_AUDIO_INCOMPLETESAMPLE 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_MPA_LAYER1
|
||||
#define HELIX_FEATURE_AUDIO_MPA_LAYER1 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_MPA_LAYER2
|
||||
#define HELIX_FEATURE_AUDIO_MPA_LAYER2 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_MPA_LAYER3
|
||||
#define HELIX_FEATURE_AUDIO_MPA_LAYER3 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_MPEG4
|
||||
#define HELIX_FEATURE_AUDIO_MPEG4 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_MULTIPLAYER_PAUSE
|
||||
#define HELIX_FEATURE_AUDIO_MULTIPLAYER_PAUSE 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_POSTMIXHOOK
|
||||
#define HELIX_FEATURE_AUDIO_POSTMIXHOOK 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_PREMIXHOOK
|
||||
#define HELIX_FEATURE_AUDIO_PREMIXHOOK 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_RALF
|
||||
#define HELIX_FEATURE_AUDIO_RALF 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUDIO_REAL
|
||||
#define HELIX_FEATURE_AUDIO_REAL 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUTHENTICATION
|
||||
#define HELIX_FEATURE_AUTHENTICATION 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_AUTOUPGRADE
|
||||
#define HELIX_FEATURE_AUTOUPGRADE 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_BASICGROUPMGR
|
||||
#define HELIX_FEATURE_BASICGROUPMGR 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_CHUNKRES
|
||||
#define HELIX_FEATURE_CHUNKRES 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_COOKIES
|
||||
#define HELIX_FEATURE_COOKIES 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_CORECOMM
|
||||
#define HELIX_FEATURE_CORECOMM 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_CROSSFADE
|
||||
#define HELIX_FEATURE_CROSSFADE 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_DBG_LOG
|
||||
#define HELIX_FEATURE_DBG_LOG 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_DIRECT_SOUND
|
||||
#define HELIX_FEATURE_DIRECT_SOUND 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_DRM
|
||||
#define HELIX_FEATURE_DRM 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_DTDR_AUDIO_DECODER
|
||||
#define HELIX_FEATURE_DTDR_AUDIO_DECODER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_DTDR_AVSYNC_ADJUSTER
|
||||
#define HELIX_FEATURE_DTDR_AVSYNC_ADJUSTER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_DTDR_DECRYPTER
|
||||
#define HELIX_FEATURE_DTDR_DECRYPTER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_DTDR_ENCODER
|
||||
#define HELIX_FEATURE_DTDR_ENCODER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_EVENTMANAGER
|
||||
#define HELIX_FEATURE_EVENTMANAGER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_FIFOCACHE
|
||||
#define HELIX_FEATURE_FIFOCACHE 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_FILESYSTEMMGR
|
||||
#define HELIX_FEATURE_FILESYSTEMMGR 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_FRAGMENTBUFFER
|
||||
#define HELIX_FEATURE_FRAGMENTBUFFER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_FULLGUID
|
||||
#define HELIX_FEATURE_FULLGUID 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_GAINTOOL
|
||||
#define HELIX_FEATURE_GAINTOOL 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_GIF_BROKENIMAGE
|
||||
#define HELIX_FEATURE_GIF_BROKENIMAGE 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_GROUPMGR
|
||||
#define HELIX_FEATURE_GROUPMGR 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_HTTPCLOAK
|
||||
#define HELIX_FEATURE_HTTPCLOAK 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_HTTP_GZIP
|
||||
#define HELIX_FEATURE_HTTP_GZIP 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_HYPER_NAVIGATE
|
||||
#define HELIX_FEATURE_HYPER_NAVIGATE 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_IGNORE_SIGPIPE
|
||||
#define HELIX_FEATURE_IGNORE_SIGPIPE 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_ISMA
|
||||
#define HELIX_FEATURE_ISMA 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_LIMITER
|
||||
#define HELIX_FEATURE_LIMITER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_MASTERTAC
|
||||
#define HELIX_FEATURE_MASTERTAC 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_MEDIAMARKER
|
||||
#define HELIX_FEATURE_MEDIAMARKER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_MEMMAP_IO
|
||||
#define HELIX_FEATURE_MEMMAP_IO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_META
|
||||
#define HELIX_FEATURE_META 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_MIXER
|
||||
#define HELIX_FEATURE_MIXER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_MP3FF_LENIENT
|
||||
#define HELIX_FEATURE_MP3FF_LENIENT 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_MP3FF_ONDEMANDMETAINFO
|
||||
#define HELIX_FEATURE_MP3FF_ONDEMANDMETAINFO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_MP3FF_SHOUTCAST
|
||||
#define HELIX_FEATURE_MP3FF_SHOUTCAST 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_NESTEDMETA
|
||||
#define HELIX_FEATURE_NESTEDMETA 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_NETCHECK
|
||||
#define HELIX_FEATURE_NETCHECK 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_NETINTERFACES
|
||||
#define HELIX_FEATURE_NETINTERFACES 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_NEXTGROUPMGR
|
||||
#define HELIX_FEATURE_NEXTGROUPMGR 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_OPTIMIZED_SCHEDULER
|
||||
#define HELIX_FEATURE_OPTIMIZED_SCHEDULER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_OVERLAYMGR
|
||||
#define HELIX_FEATURE_OVERLAYMGR 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_PAC
|
||||
#define HELIX_FEATURE_PAC 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_PACKETHOOKMGR
|
||||
#define HELIX_FEATURE_PACKETHOOKMGR 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_PLAYBACK_LOCAL
|
||||
#define HELIX_FEATURE_PLAYBACK_LOCAL 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_PLAYBACK_NET
|
||||
#define HELIX_FEATURE_PLAYBACK_NET 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_PLAYERNAVIGATOR
|
||||
#define HELIX_FEATURE_PLAYERNAVIGATOR 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_PLUGINHANDLER2
|
||||
#define HELIX_FEATURE_PLUGINHANDLER2 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_PNA
|
||||
#define HELIX_FEATURE_PNA 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_PREFERENCES
|
||||
#define HELIX_FEATURE_PREFERENCES 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_PREFETCH
|
||||
#define HELIX_FEATURE_PREFETCH 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_PROXYMGR
|
||||
#define HELIX_FEATURE_PROXYMGR 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RAREND_ADV_PACKET_FEEDER
|
||||
#define HELIX_FEATURE_RAREND_ADV_PACKET_FEEDER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RAREND_BANDWIDTH_LISTER
|
||||
#define HELIX_FEATURE_RAREND_BANDWIDTH_LISTER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RAREND_PREREDSTONE_SUPPORT
|
||||
#define HELIX_FEATURE_RAREND_PREREDSTONE_SUPPORT 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RAREND_SURESTREAM
|
||||
#define HELIX_FEATURE_RAREND_SURESTREAM 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RDT
|
||||
#define HELIX_FEATURE_RDT 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RECORDCONTROL
|
||||
#define HELIX_FEATURE_RECORDCONTROL 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_REGISTRY
|
||||
#define HELIX_FEATURE_REGISTRY 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RESAMPLER
|
||||
#define HELIX_FEATURE_RESAMPLER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RESOURCEMGR
|
||||
#define HELIX_FEATURE_RESOURCEMGR 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_REVERTER
|
||||
#define HELIX_FEATURE_REVERTER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RMFF_BANDWIDTH_NEGOTIATOR
|
||||
#define HELIX_FEATURE_RMFF_BANDWIDTH_NEGOTIATOR 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RMFF_DYNAMICASM
|
||||
#define HELIX_FEATURE_RMFF_DYNAMICASM 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RMFF_LEGACYAUDIO
|
||||
#define HELIX_FEATURE_RMFF_LEGACYAUDIO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RMFF_LICENSING
|
||||
#define HELIX_FEATURE_RMFF_LICENSING 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RMFF_LIVEINFO
|
||||
#define HELIX_FEATURE_RMFF_LIVEINFO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RMFF_MULTIRATE
|
||||
#define HELIX_FEATURE_RMFF_MULTIRATE 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RMFF_ONDEMANDMETAINFO
|
||||
#define HELIX_FEATURE_RMFF_ONDEMANDMETAINFO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RMFF_TIMEOFFSET_FIXUP
|
||||
#define HELIX_FEATURE_RMFF_TIMEOFFSET_FIXUP 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RMFF_TIMEOFFSET_HANDLER
|
||||
#define HELIX_FEATURE_RMFF_TIMEOFFSET_HANDLER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RMFF_VIEWSOURCE
|
||||
#define HELIX_FEATURE_RMFF_VIEWSOURCE 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_RTP
|
||||
#define HELIX_FEATURE_RTP 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SECURECONN
|
||||
#define HELIX_FEATURE_SECURECONN 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SETSRCPROPS
|
||||
#define HELIX_FEATURE_SETSRCPROPS 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SINKCONTROL
|
||||
#define HELIX_FEATURE_SINKCONTROL 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SMARTERNETWORK
|
||||
#define HELIX_FEATURE_SMARTERNETWORK 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SMIL1
|
||||
#define HELIX_FEATURE_SMIL1 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SMIL2
|
||||
#define HELIX_FEATURE_SMIL2 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SMIL2_ANIMATION
|
||||
#define HELIX_FEATURE_SMIL2_ANIMATION 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SMIL2_BRUSH
|
||||
#define HELIX_FEATURE_SMIL2_BRUSH 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SMIL2_MULTIWINDOWLAYOUT
|
||||
#define HELIX_FEATURE_SMIL2_MULTIWINDOWLAYOUT 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SMIL2_TRANSITIONS
|
||||
#define HELIX_FEATURE_SMIL2_TRANSITIONS 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SMIL2_VALIDATION
|
||||
#define HELIX_FEATURE_SMIL2_VALIDATION 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SMIL_REPEAT
|
||||
#define HELIX_FEATURE_SMIL_REPEAT 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SMIL_SOUNDLEVEL
|
||||
#define HELIX_FEATURE_SMIL_SOUNDLEVEL 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_STATS
|
||||
#define HELIX_FEATURE_STATS 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_SYSTEMREQUIRED
|
||||
#define HELIX_FEATURE_SYSTEMREQUIRED 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_THREADSAFE_MEMMAP_IO
|
||||
#define HELIX_FEATURE_THREADSAFE_MEMMAP_IO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_TIMEDTEXT
|
||||
#define HELIX_FEATURE_TIMEDTEXT 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_TRANSPORT_MULTICAST
|
||||
#define HELIX_FEATURE_TRANSPORT_MULTICAST 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_TURBOPLAY
|
||||
#define HELIX_FEATURE_TURBOPLAY 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VIDEO
|
||||
#define HELIX_FEATURE_VIDEO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VIDEO_CODEC_RV20
|
||||
#define HELIX_FEATURE_VIDEO_CODEC_RV20 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VIDEO_CODEC_RV30
|
||||
#define HELIX_FEATURE_VIDEO_CODEC_RV30 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VIDEO_CODEC_RV40
|
||||
#define HELIX_FEATURE_VIDEO_CODEC_RV40 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VIDEO_H263
|
||||
#define HELIX_FEATURE_VIDEO_H263 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VIDEO_MPEG4
|
||||
#define HELIX_FEATURE_VIDEO_MPEG4 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VIDEO_REAL
|
||||
#define HELIX_FEATURE_VIDEO_REAL 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VIDREND_OPTIMIZEDVIDEO
|
||||
#define HELIX_FEATURE_VIDREND_OPTIMIZEDVIDEO 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VIDREND_SYNCSMOOTHING
|
||||
#define HELIX_FEATURE_VIDREND_SYNCSMOOTHING 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VIEWPORT
|
||||
#define HELIX_FEATURE_VIEWPORT 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VIEWSOURCE
|
||||
#define HELIX_FEATURE_VIEWSOURCE 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_VOLUME
|
||||
#define HELIX_FEATURE_VOLUME 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_XMLPARSER
|
||||
#define HELIX_FEATURE_XMLPARSER 1
|
||||
#endif
|
||||
#ifndef HELIX_FEATURE_PANDA3D
|
||||
#define HELIX_FEATURE_PANDA3D 1
|
||||
#endif
|
||||
#ifndef STRICT
|
||||
#define STRICT 1
|
||||
#endif
|
||||
#ifndef THREADS_SUPPORTED
|
||||
#define THREADS_SUPPORTED 1
|
||||
#endif
|
||||
#ifndef WIN32
|
||||
#define WIN32 1
|
||||
#endif
|
||||
#ifndef _LITTLE_ENDIAN
|
||||
#define _LITTLE_ENDIAN 1
|
||||
#endif
|
||||
#ifndef _M_IX86
|
||||
#define _M_IX86 1
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
#define _WIN32 1
|
||||
#endif
|
||||
#ifndef _WINDOWS
|
||||
#define _WINDOWS 1
|
||||
#endif
|
||||
|
||||
@@ -1,650 +0,0 @@
|
||||
// Filename: HxAdviseSink.cpp
|
||||
// Created by: jjtaylor (27Jan04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Panda Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "HxAdviseSink.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Normal Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include <stdio.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxAdviseSink::Constructor
|
||||
// Access: Public
|
||||
// Purpose: Initializes member variables and sets up object
|
||||
// related interfaces.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Input: pUnknown - Pointer to an IUnknown Interface
|
||||
// client_index - Client Instance Identifier
|
||||
// Output: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HxAdviseSink::HxAdviseSink(IUnknown* unknown, LONG32 client_index, bool sink_on)
|
||||
: _ref_count (0),
|
||||
_client_index (client_index),
|
||||
_unknown (0),
|
||||
_registry (0),
|
||||
_scheduler (0),
|
||||
_current_bandwidth(0),
|
||||
_average_bandwidth(0),
|
||||
_on_stop(0),
|
||||
_sink_on(sink_on)
|
||||
{
|
||||
if (unknown != 0) {
|
||||
_unknown = unknown;
|
||||
_unknown->AddRef();
|
||||
|
||||
if (HXR_OK != _unknown->QueryInterface(IID_IHXRegistry, (void**)&_registry)) {
|
||||
_registry = 0;
|
||||
}
|
||||
|
||||
if (HXR_OK != _unknown->QueryInterface(IID_IHXScheduler, (void**)&_scheduler)) {
|
||||
_scheduler = 0;
|
||||
}
|
||||
|
||||
IHXPlayer* player;
|
||||
if(HXR_OK == _unknown->QueryInterface(IID_IHXPlayer, (void**)&player)) {
|
||||
player->AddAdviseSink(this);
|
||||
player->Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::~HxClientAdviseSink
|
||||
// Access: Private
|
||||
// Purpose: Class destructor which releases corresponding
|
||||
// interfaces which are related to this class.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HxAdviseSink::~HxAdviseSink() {
|
||||
// Release components and set the member variables to the
|
||||
// NULL-state.
|
||||
if (_scheduler != 0) {
|
||||
_scheduler->Release();
|
||||
_scheduler = 0;
|
||||
}
|
||||
|
||||
if (_registry != 0) {
|
||||
_registry->Release();
|
||||
_registry = 0;
|
||||
}
|
||||
|
||||
if (_unknown != 0) {
|
||||
_unknown->Release();
|
||||
_unknown = 0;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::QueryInterface
|
||||
// Access: Public
|
||||
// Purpose: Queries this class to determine whether it supports
|
||||
// supports a specific interface. If the call succeeds
|
||||
// then the methods of that interface are made
|
||||
// available for use.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: id - Indicates the reference identifier of the
|
||||
// the interface being queried.
|
||||
// interface_obj - Points to an interface pointer that is
|
||||
// filled in if the query succeeds.
|
||||
// Return: HX_RESULT - Varies based on wheter the interface is
|
||||
// supported or not.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::QueryInterface(REFIID id, void** interface_obj) {
|
||||
// Determine if the IUnknown and ClientAdviseSink interfaces
|
||||
// are supported.
|
||||
if (IsEqualIID(id, IID_IUnknown)) {
|
||||
// Increase the reference count, set the Interface Object,
|
||||
// and return that the interface is supported within this
|
||||
// object.
|
||||
AddRef();
|
||||
*interface_obj = (IUnknown*)(IHXClientAdviseSink*)this;
|
||||
}
|
||||
else if (IsEqualIID(id, IID_IHXClientAdviseSink)) {
|
||||
// Same as above.
|
||||
AddRef();
|
||||
*interface_obj = (IHXClientAdviseSink*)this;
|
||||
}
|
||||
else {
|
||||
// This Interface is not supported by this object. Set the
|
||||
// Interface Object to the NULL-state and return.
|
||||
*interface_obj = 0;
|
||||
return HXR_NOINTERFACE;
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::AddRef
|
||||
// Access: Public
|
||||
// Purpose: Increases the classes reference count by one.
|
||||
// Whenever an object is created, it's reference count
|
||||
// begins at 1. If an application calls IUnknown::AddRef,
|
||||
// queries an interface belonging to a specific object,
|
||||
// or uses a creation function like HXCreateInstance,
|
||||
// the reference count is incremented by 1.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: Returns the new reference count.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP_(ULONG32) HxAdviseSink::AddRef() {
|
||||
return InterlockedIncrement(&_ref_count);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::Release
|
||||
// Access: Public
|
||||
// Purpose: Decreases the object's reference count by one.
|
||||
// Every call to IUnknown::AddRef,
|
||||
// IUnknown::QueryInterface, or a creation function
|
||||
// such as HXCreateInstance must have a corresponding
|
||||
// call to IUnknown::Release. When the reference count
|
||||
// reaches 0 (zero), the object is destroyed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: Returns the new reference count.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP_(ULONG32) HxAdviseSink::Release() {
|
||||
// As long as the reference count is greater than 0, then this
|
||||
// object is still in "scope."
|
||||
if (InterlockedDecrement(&_ref_count) > 0 ) {
|
||||
return _ref_count;
|
||||
}
|
||||
|
||||
// Otherwise, this object is no longer necessary and should be
|
||||
// removed from memory.
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::OnPosLength
|
||||
// Access: Public
|
||||
// Purpose: Advises the client that the position or length of
|
||||
// the current playback context has changed
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: ulPosition - The new position of the playback.
|
||||
// ulLength - The new length of the playback.
|
||||
// Return: HXR_OK - Helix Specific result saying things are "Okay".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::OnPosLength(ULONG32 ulPosition, ULONG32 ulLength) {
|
||||
// Initialize Variables
|
||||
if(_sink_on) {
|
||||
STDOUT("OnPosLength(%ld, %ld)\n", ulPosition, ulLength);
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::OnPresentationOpened
|
||||
// Access: Public
|
||||
// Purpose: Advises the client that a presentation has been
|
||||
// opened.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: HXR_OK - Helix Specific result saying things are "Okay".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::OnPresentationOpened() {
|
||||
// For now, check if advise sinking is enabled. If so, print that
|
||||
// a presenatation has been opened.
|
||||
if(_sink_on) {
|
||||
STDOUT("OnPresentationOpened()\n");
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::OnPresentationClosed()
|
||||
// Access: Public
|
||||
// Purpose: Advises the cleint that a presentation has been
|
||||
// closed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: HXR_OK - Helix Specific result saying things are "Okay".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::OnPresentationClosed() {
|
||||
// For now, check if advise sinking is enabled. If so, print that
|
||||
// a presenatation has been closed.
|
||||
if(_sink_on) {
|
||||
STDOUT("OnPresentationClosed()\n");
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxAdviseSink::get_statistics
|
||||
// Access: Private
|
||||
// Purpose: Retrieves the statistic for the particular key that
|
||||
// is in the Helix Registry Interface.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: char* registry_key - the key whose value we wish to
|
||||
// retrieve from the registry.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HxAdviseSink::get_statistics(char* registry_key) {
|
||||
if(_sink_on) {
|
||||
char RegistryValue[MAX_DISPLAY_NAME] = {0};
|
||||
INT32 lValue = 0;
|
||||
INT32 i = 0;
|
||||
INT32 lStatistics = 8;
|
||||
UINT32 *plValue;
|
||||
|
||||
// Collect all of the necessary statistics from the registry
|
||||
// and print them to the screen.
|
||||
for (i = 0; i < lStatistics; i++) {
|
||||
plValue = NULL;
|
||||
switch (i) {
|
||||
case 0:
|
||||
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Normal", registry_key);
|
||||
break;
|
||||
case 1:
|
||||
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Recovered", registry_key);
|
||||
break;
|
||||
case 2:
|
||||
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Received", registry_key);
|
||||
break;
|
||||
case 3:
|
||||
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Lost", registry_key);
|
||||
break;
|
||||
case 4:
|
||||
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Late", registry_key);
|
||||
break;
|
||||
case 5:
|
||||
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.ClipBandwidth", registry_key);
|
||||
break;
|
||||
case 6:
|
||||
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s._average_bandwidth", registry_key);
|
||||
plValue = &_average_bandwidth;
|
||||
break;
|
||||
case 7:
|
||||
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s._current_bandwidth", registry_key);
|
||||
plValue = &_current_bandwidth;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_registry->GetIntByName(RegistryValue, lValue);
|
||||
if (plValue) {
|
||||
if (_on_stop || lValue == 0) {
|
||||
lValue = *plValue;
|
||||
}
|
||||
else {
|
||||
*plValue = lValue;
|
||||
}
|
||||
}
|
||||
STDOUT("%s = %ld\n", RegistryValue, lValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::get_all_statistics
|
||||
// Access: Private
|
||||
// Purpose: Displays the content of the entire registry. Not
|
||||
// truly necessary for Panda, however, it is useful
|
||||
// for debugging purposes of streaming files.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HxAdviseSink::get_all_statistics() {
|
||||
if(_sink_on) {
|
||||
UINT32 PlayerIndex = 0;
|
||||
UINT32 SourceIndex = 0;
|
||||
UINT32 StreamIndex = 0;
|
||||
|
||||
char* RegistryPrefix = "Statistics";
|
||||
char RegistryName[MAX_DISPLAY_NAME] = {0};
|
||||
|
||||
// Display the content of whole statistic registry
|
||||
if (_registry) {
|
||||
// Start from the first player.
|
||||
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld", RegistryPrefix, _client_index);
|
||||
if (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
|
||||
// Display player statistic
|
||||
get_statistics(RegistryName);
|
||||
|
||||
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Source%ld", RegistryName, SourceIndex);
|
||||
while (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
|
||||
// Display source statistic
|
||||
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.Player%ld.Source%ld.Stream%ld",
|
||||
RegistryPrefix, PlayerIndex, SourceIndex, StreamIndex);
|
||||
}
|
||||
SourceIndex++;
|
||||
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld.Source%ld",
|
||||
RegistryPrefix, PlayerIndex, SourceIndex);
|
||||
}
|
||||
PlayerIndex++;
|
||||
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld",
|
||||
RegistryPrefix, PlayerIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::OnStatisticsChanged
|
||||
// Access: Public
|
||||
// Purpose: Advises the client that the presentation statistics
|
||||
// have changed and prints those statistics out.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: HXR_OK - Helix Specific result saying things are "Okay".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::OnStatisticsChanged() {
|
||||
if(_sink_on) {
|
||||
char Buff[1024];
|
||||
HX_RESULT res = HXR_OK;
|
||||
UINT16 Player = 0;
|
||||
|
||||
STDOUT("OnStatisticsChanged():\n");
|
||||
|
||||
SafeSprintf(Buff, 1024, "Statistics.Player%u", Player);
|
||||
while( HXR_OK == res ) {
|
||||
res = dump_reg_tree( Buff );
|
||||
Player++;
|
||||
SafeSprintf(Buff, 1024, "Statistics.Player%u", Player );
|
||||
}
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::DumpRegTree
|
||||
// Access: Private
|
||||
// Purpose: Prints the contents of the Registry tree for this
|
||||
// particular object.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: pszTreeName - The name of the Registry tree that should
|
||||
// be printed.
|
||||
// Return: HX_RESULT - result varies.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HX_RESULT HxAdviseSink::dump_reg_tree(const char* tree_name) {
|
||||
//Initialize Local Variables related to the Registry Tree
|
||||
const char* pszName = NULL;
|
||||
ULONG32 ulRegID = 0;
|
||||
HX_RESULT res = HXR_OK;
|
||||
INT32 nVal = 0;
|
||||
IHXBuffer* pBuff = NULL;
|
||||
IHXValues* pValues = NULL;
|
||||
|
||||
|
||||
// Check if the name exists in the registry. If its not
|
||||
// return a failure.
|
||||
res = _registry->GetPropListByName(tree_name, pValues);
|
||||
if (HXR_OK!=res || !pValues) {
|
||||
return HXR_FAIL;
|
||||
}
|
||||
|
||||
// Make sure this is a PT_COMPOSITE type registry entry. If
|
||||
// its not, return a failure.
|
||||
if (PT_COMPOSITE != _registry->GetTypeByName(tree_name)) {
|
||||
return HXR_FAIL;
|
||||
}
|
||||
|
||||
// Print out the value of each member of this tree.
|
||||
res = pValues->GetFirstPropertyULONG32( pszName, ulRegID );
|
||||
while( HXR_OK == res ) {
|
||||
// There is at least one entry in the Registry. Now
|
||||
// check the type.
|
||||
HXPropType pt = _registry->GetTypeById(ulRegID);
|
||||
switch(pt) {
|
||||
case PT_COMPOSITE:
|
||||
dump_reg_tree(pszName);
|
||||
break;
|
||||
case PT_INTEGER:
|
||||
nVal = 0;
|
||||
_registry->GetIntById( ulRegID, nVal );
|
||||
STDOUT("%s : %d\n", pszName, nVal );
|
||||
break;
|
||||
case PT_INTREF :
|
||||
nVal = 0;
|
||||
_registry->GetIntById( ulRegID, nVal );
|
||||
STDOUT("%s : %d\n", pszName, nVal );
|
||||
break;
|
||||
case PT_STRING :
|
||||
pBuff = NULL;
|
||||
_registry->GetStrById( ulRegID, pBuff );
|
||||
STDOUT("%s : \"", pszName );
|
||||
|
||||
if( pBuff ) {
|
||||
STDOUT("%s", (const char *)(pBuff->GetBuffer()) );
|
||||
}
|
||||
STDOUT("\"\n" );
|
||||
HX_RELEASE(pBuff);
|
||||
break;
|
||||
case PT_BUFFER :
|
||||
STDOUT("%s : BUFFER TYPE NOT SHOWN\n", pszName, nVal );
|
||||
break;
|
||||
case PT_UNKNOWN:
|
||||
STDOUT("%s Unkown registry type entry\n", pszName );
|
||||
break;
|
||||
default:
|
||||
STDOUT("%s Unkown registry type entry\n", pszName );
|
||||
break;
|
||||
}
|
||||
res = pValues->GetNextPropertyULONG32(pszName, ulRegID);
|
||||
}
|
||||
|
||||
HX_RELEASE( pValues );
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::OnPreSeek
|
||||
// Access: Public
|
||||
// Purpose: Informs the client that a seek is about to occur.
|
||||
// The client is informed of the last time in the
|
||||
// stream's time line before the seek, as well as the
|
||||
// first new time in the stream's time line after the
|
||||
// seek is completed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: ulOldTime - The end of the stream's time line before the
|
||||
// current seek.
|
||||
// ulNewTime - The beginning of the stream's time line after
|
||||
// the current seek.
|
||||
// Return: HXR_OK - Helix Specific result saying things are "Okay".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::OnPreSeek(ULONG32 ulOldTime, ULONG32 ulNewTime) {
|
||||
// For now, check if advise sinking is enabled. If so, print that
|
||||
// a seek is about to happen.
|
||||
if(_sink_on) {
|
||||
STDOUT("OnPreSeek(%ld, %ld)\n", ulOldTime, ulNewTime);
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::OnPostSeek
|
||||
// Access: Public
|
||||
// Purpose: Informs the client that a seek has just occured.
|
||||
// The client is informed of the last time in the
|
||||
// stream's time line before the seek, as well as the
|
||||
// first new time in the stream's time line after the
|
||||
// seek is completed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: ulOldTime - The end of the stream's time line before the
|
||||
// current seek.
|
||||
// ulNewTime - The beginning of the stream's time line after
|
||||
// the current seek.
|
||||
// Return: HXR_OK - Helix Specific result saying things are "Okay".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::OnPostSeek(ULONG32 ulOldTime, ULONG32 ulNewTime) {
|
||||
// For now, check if advise sinking is enabled. If so, print that
|
||||
// a seek just happened.
|
||||
if(_sink_on) {
|
||||
STDOUT("OnPostSeek(%ld, %ld)\n", ulOldTime, ulNewTime);
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::OnStop
|
||||
// Access: Public
|
||||
// Purpose: Informs the client that a stop has just occured
|
||||
// in a presentation, and calculates the total time
|
||||
// that a file has been playing.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: HXR_OK - Helix Specific result saying things are "Okay".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::OnStop() {
|
||||
if(_sink_on) {
|
||||
HXTimeval curr_time;
|
||||
|
||||
STDOUT("OnStop()\n");
|
||||
|
||||
STDOUT("Player %ld stopped.\n", _client_index);
|
||||
_on_stop = TRUE;
|
||||
get_all_statistics();
|
||||
|
||||
// Retrieve the current time and subtract the beginning time to figure out
|
||||
// how long the file has played.
|
||||
curr_time = _scheduler->GetCurrentSchedulerTime();
|
||||
_stop_time = curr_time.tv_sec;
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::OnPause
|
||||
// Access: Public
|
||||
// Purpose: Informs the client that a pause has just occured.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: time - time in the stream's time line that the pause
|
||||
// occured.
|
||||
// Return: HXR_OK - Helix Specific result saying things are "Okay".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::OnPause(ULONG32 time) {
|
||||
// For now, check if advise sinking is enabled. If so, print that
|
||||
// the a pause in the presentation has occured for debugging
|
||||
// purposes.
|
||||
if(_sink_on) {
|
||||
STDOUT("OnPause(%ld)\n", time);
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::OnBegin
|
||||
// Access: Public
|
||||
// Purpose: Informs the client that a presenentation has begun.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: time - The time that the presentation has begun.
|
||||
// Return: HXR_OK - Helix Specific result saying things are "Okay".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::OnBegin(ULONG32 time) {
|
||||
if(_sink_on) {
|
||||
// Local Variable Declarations
|
||||
HXTimeval curr_time;
|
||||
|
||||
STDOUT("OnBegin(%ld)\n", time);
|
||||
STDOUT("Player %ld beginning playback...\n", _client_index);
|
||||
|
||||
// Record the current time that this begins so that the number
|
||||
// of seconds the media file has been playing can be calculated.
|
||||
curr_time = _scheduler->GetCurrentSchedulerTime();
|
||||
_start_time = curr_time.tv_sec;
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::OnBuffering
|
||||
// Access: Public
|
||||
// Purpose: Informs the client that buffering of data is occuring.
|
||||
// The render is informed of the reason for the buffering
|
||||
// (start-up of stream, seek has occured, network congestion,
|
||||
// etc.), as well as percentage complete of the buffering process.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: flags - The reason for buffering. Can be any of the following:
|
||||
// BUFFERING_START_UP, BUFFERING_SEEK,
|
||||
// BUFFERING_CONGESTION, BUFFERING_LIVE_PAUSE
|
||||
// percent_complete - The percentage fo the buffering that
|
||||
// has been completed.
|
||||
// Return: HXR_OK - Helix Specific result saying things are "Okay".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::OnBuffering(ULONG32 flags, UINT16 percent_complete) {
|
||||
// For now, check if advise sinking is enabled. If so, print that
|
||||
// the a presentation is now buffering.
|
||||
if(_sink_on) {
|
||||
STDOUT("OnBuffering(%ld, %d)\n", flags, percent_complete);
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientAdviseSink::OnContacting
|
||||
// Access: Public
|
||||
// Purpose: Informs the client that the engine is contacting
|
||||
// a host.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: host_name - Host name that the engine is contacting.
|
||||
// Return: HXR_OK - Helix Specific result saying things are "Okay".
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAdviseSink::OnContacting(const char* host_name) {
|
||||
// For now, check if advise sinking is enabled. If so, print that
|
||||
// the client is contacting a host for streaming.
|
||||
if(_sink_on) {
|
||||
STDOUT("OnContacting(\"%s\")\n", host_name);
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
// Filename: HxAdviseSink.h
|
||||
// Created by: jjtaylor (10Feb04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#ifndef HXADVISESINK_H
|
||||
#define HXADVISESINK_H
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Panda Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "pandabase.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Helix Main Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "mainHelix.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Prototype/Struct/Class Forward Delcarations
|
||||
////////////////////////////////////////////////////////////////////
|
||||
struct IHXClientAdviseSink;
|
||||
struct IUnknown;
|
||||
struct IHXRegistry;
|
||||
struct IHXScheduler;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class: HxAdviseSink
|
||||
// Purpose: This is a derived class from the IHXClientAdviseSink
|
||||
// base interface. This class is meant to receive
|
||||
// notifications from the client engine about changes in
|
||||
// or about a presentation's playback status.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class HxAdviseSink : public IHXClientAdviseSink {
|
||||
public:
|
||||
HxAdviseSink(IUnknown* unknown, LONG32 client_index, bool sink_on);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// IHUnkown Interface Methods Prototypes
|
||||
// Purpose: Implements the basic COM interface methods for reference
|
||||
// coutning and querying of related interfaces.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHOD(QueryInterface) (THIS_ REFIID id, void** interface_obj);
|
||||
STDMETHOD_(ULONG32,AddRef) (THIS);
|
||||
STDMETHOD_(ULONG32,Release) (THIS);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// IHXClientAdviseSink Interface Methods Prototypes
|
||||
// Purpose: Implements the necessary interface methods that may
|
||||
// be called during a presentations status.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHOD(OnPosLength) (THIS_ UINT32 position, UINT32 length);
|
||||
STDMETHOD(OnPresentationOpened) (THIS);
|
||||
STDMETHOD(OnPresentationClosed) (THIS);
|
||||
STDMETHOD(OnStatisticsChanged) (THIS);
|
||||
STDMETHOD(OnPreSeek) (THIS_ ULONG32 old_time, ULONG32 new_time);
|
||||
STDMETHOD(OnPostSeek) (THIS_ ULONG32 old_time, ULONG32 new_time);
|
||||
STDMETHOD(OnStop) (THIS);
|
||||
STDMETHOD(OnPause) (THIS_ ULONG32 Time);
|
||||
STDMETHOD(OnBegin) (THIS_ ULONG32 Time);
|
||||
STDMETHOD(OnBuffering) (THIS_ ULONG32 flags, UINT16 percent_complete);
|
||||
STDMETHOD(OnContacting) (THIS_ const char* host_name);
|
||||
private:
|
||||
// Private Member Functions
|
||||
~HxAdviseSink();
|
||||
HX_RESULT dump_reg_tree(const char* tree_name );
|
||||
void get_statistics (char* registry_key);
|
||||
void get_all_statistics ();
|
||||
|
||||
// Private Member variables
|
||||
LONG32 _ref_count;
|
||||
LONG32 _client_index;
|
||||
UINT32 _start_time;
|
||||
UINT32 _stop_time;
|
||||
UINT32 _current_bandwidth;
|
||||
UINT32 _average_bandwidth;
|
||||
BOOL _on_stop;
|
||||
|
||||
bool _sink_on;
|
||||
|
||||
IUnknown* _unknown;
|
||||
IHXRegistry* _registry;
|
||||
IHXScheduler* _scheduler;
|
||||
};
|
||||
#endif
|
||||
@@ -1,207 +0,0 @@
|
||||
// Filename: HxAuthenticationManager.cxx
|
||||
// Created by: jjtaylor (10Feb04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Panda Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "HxAuthenticationManager.h"
|
||||
#include "print.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Normal Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxAuthenticationManager::HxAuthenticationManager
|
||||
// Access: Public
|
||||
// Purpose: A default constructor which initializes the member
|
||||
// variables for the class.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HxAuthenticationManager::HxAuthenticationManager()
|
||||
: _ref_count(0),
|
||||
_sent_password(FALSE) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxAuthenticationManager::Destructor
|
||||
// Access: Public
|
||||
// Purpose: The default destructor which removes existing
|
||||
// COM interfaces that have not been freed from
|
||||
// memory.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HxAuthenticationManager::~HxAuthenticationManager() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxAuthenticationManager::QueryInterface
|
||||
// Access: Public
|
||||
// Purpose: Queries this class to determine whether it supports
|
||||
// supports a specific interface. If the call succeeds
|
||||
// then the methods of that interface are made
|
||||
// available for use.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: id - Indicates the reference identifier of the
|
||||
// the interface being queried.
|
||||
// ppInterfaceObj - Points to an interface pointer that is
|
||||
// filled in if the query succeeds.
|
||||
// Return: HX_RESULT - Varies based on wheter the interface is
|
||||
// supported or not.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HX_RESULT HxAuthenticationManager::QueryInterface(THIS_ REFIID id, void** ppInterfaceObj) {
|
||||
// Determine if the IUnknown and AuthenticationManager interfaces
|
||||
// are supported.
|
||||
if (IsEqualIID(id, IID_IUnknown)) {
|
||||
// Increase the reference count, set the Interface Object,
|
||||
// and return that the interface is supported within this
|
||||
// object.
|
||||
AddRef();
|
||||
*ppInterfaceObj = (IUnknown*)(IHXAuthenticationManager *)this;
|
||||
}
|
||||
else if (IsEqualIID(id, IID_IHXAuthenticationManager)) {
|
||||
// Same as above.
|
||||
AddRef();
|
||||
*ppInterfaceObj = (IHXAuthenticationManager *)this;
|
||||
}
|
||||
else {
|
||||
// This Interface is not supported by this object. Set the
|
||||
// Interface Object to the NULL-state and return.
|
||||
*ppInterfaceObj = 0;
|
||||
return HXR_NOINTERFACE;
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxAuthenticationManager::AddRef
|
||||
// Access: Public
|
||||
// Purpose: Increases the object's reference count by one.
|
||||
// Every call to IUnknown::AddRef,
|
||||
// IUnknown::QueryInterface, or a creation function
|
||||
// such as HXCreateInstance must have a corresponding
|
||||
// call to IUnknown::Release. When the reference count
|
||||
// reaches 0 (zero), the object is destroyed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: ULONG32 - The new reference count.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP_(ULONG32) HxAuthenticationManager::AddRef(THIS) {
|
||||
return InterlockedIncrement(&_ref_count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxAuthenticationManager::Release
|
||||
// Access: Public
|
||||
// Purpose: Decreases the object's reference count by one.
|
||||
// Every call to IUnknown::AddRef,
|
||||
// IUnknown::QueryInterface, or a creation function
|
||||
// such as HXCreateInstance must have a corresponding
|
||||
// call to IUnknown::Release. When the reference count
|
||||
// reaches 0 (zero), the object is destroyed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: ULONG32 - The new reference count.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP_(ULONG32) HxAuthenticationManager::Release(THIS) {
|
||||
// As long as the reference count is greater than 0, then this
|
||||
// object is still in "scope."
|
||||
if (InterlockedDecrement(&_ref_count) > 0 ) {
|
||||
return _ref_count;
|
||||
}
|
||||
|
||||
// Otherwise, this object is no longer necessary and should be
|
||||
// removed from memory.
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxAuthenticationManager:HandleAuthenticationRequest
|
||||
// Access: Public
|
||||
// Purpose: Retrieves the username and password which is
|
||||
// needed to access a specific file or URL.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: pResponse - Pointer to a response interface that
|
||||
// manages the response of the authentication
|
||||
// of the username and password.
|
||||
// Return: HX_RESULT - Based on the authentication process.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxAuthenticationManager::HandleAuthenticationRequest(IHXAuthenticationManagerResponse* pResponse)
|
||||
{
|
||||
char username[1024] = ""; /* Flawfinder: ignore */
|
||||
char password[1024] = ""; /* Flawfinder: ignore */
|
||||
HX_RESULT res = HXR_FAIL;
|
||||
|
||||
if( !_sent_password )
|
||||
{
|
||||
res = HXR_OK;
|
||||
|
||||
STDOUT("\nSending Username and Password...\n");
|
||||
|
||||
SafeStrCpy(username, "", 1024);
|
||||
SafeStrCpy(password, "", 1024);
|
||||
|
||||
//strip trailing whitespace
|
||||
char* c;
|
||||
for(c = username + strlen(username) - 1;
|
||||
c > username && isspace(*c);
|
||||
c--)
|
||||
;
|
||||
*(c+1) = 0;
|
||||
|
||||
for(c = password + strlen(password) - 1;
|
||||
c > password && isspace(*c);
|
||||
c--)
|
||||
;
|
||||
*(c+1) = 0;
|
||||
|
||||
_sent_password = TRUE;
|
||||
}
|
||||
if (FAILED(res))
|
||||
STDOUT("\nInvalid Username and/or Password.\n");
|
||||
|
||||
pResponse->AuthenticationRequestDone(res, username, password);
|
||||
return res;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// Filename: hxAuthenticationManager.cxx
|
||||
// Created by: jjtaylor (28Jan04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -1,324 +0,0 @@
|
||||
// Filename: HxClientContext.h
|
||||
// Created by: jjtaylor (01Feb04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Helix Main Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "mainHelix.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxClientContext::Constructor
|
||||
// Access: Public
|
||||
// Purpose: The constructor simply initializes all of the
|
||||
// member variables.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: LONG32 client_index - the player/client count
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HxClientContext::HxClientContext(LONG32 client_index)
|
||||
: _ref_count(0),
|
||||
_client_index(client_index),
|
||||
_client_sink(0),
|
||||
_error_sink(0),
|
||||
_auth_mgr(0),
|
||||
_site_supplier(0),
|
||||
_default_prefs(0) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxClientContext::Destructor
|
||||
// Access: Public
|
||||
// Purpose: The destructor simply calls the close member
|
||||
// function.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HxClientContext::~HxClientContext(){
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxClientContext::init
|
||||
// Access: Public
|
||||
// Purpose: This member performs all of the dirty work for
|
||||
// initializing the the client context for a player
|
||||
// as well as instantiating all of the necessary
|
||||
// Helix interface objects that must be declared so
|
||||
// the engine can properly communicate with the player
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: IUnknown* unknown - a Helix Interface Object
|
||||
// IHXPreferences* prefs -
|
||||
// char* guid - a GUID, if applicable.
|
||||
// bool sink_on - True if the AdviseSink should broadcast
|
||||
// presentation statistics.
|
||||
// Texture* tex - a Panda Texture Object which will be
|
||||
// updated with the video each frame.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HxClientContext::init(IUnknown* unknown, IHXPreferences* prefs, char* guid, bool sink_on, Texture* tex) {
|
||||
char * cipher = 0;
|
||||
|
||||
_client_sink = new HxAdviseSink(unknown, _client_index, sink_on);
|
||||
_error_sink = new HxErrorSink(unknown);
|
||||
_auth_mgr = new HxAuthenticationManager();
|
||||
#if defined(HELIX_FEATURE_VIDEO)
|
||||
// From this point, we need to create a site supplier object since we are dealing with video.
|
||||
// In addtion, we must send the Panda Texture buffer down to the site supplier, where it will
|
||||
// inevitably be sent to the video surface object so that it can be updated.
|
||||
//cout << "Buffer: " << buffer << endl;
|
||||
_site_supplier = new HxSiteSupplier(unknown, tex);
|
||||
#endif
|
||||
|
||||
if (_client_sink != 0) {
|
||||
_client_sink->AddRef();
|
||||
}
|
||||
|
||||
if (_error_sink != 0) {
|
||||
_error_sink->AddRef();
|
||||
}
|
||||
|
||||
if (_auth_mgr != 0) {
|
||||
_auth_mgr->AddRef();
|
||||
}
|
||||
|
||||
if (_site_supplier != 0) {
|
||||
_site_supplier->AddRef();
|
||||
}
|
||||
|
||||
if (prefs != 0) {
|
||||
_default_prefs = prefs;
|
||||
_default_prefs->AddRef();
|
||||
}
|
||||
|
||||
if (guid && *guid) {
|
||||
// Encode GUID
|
||||
cipher = Cipher(guid);
|
||||
SafeStrCpy(_guid, cipher, 256);
|
||||
}
|
||||
else {
|
||||
_guid[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxClientContext::close
|
||||
// Access: Public
|
||||
// Purpose: This method simply releases each of the helix
|
||||
// interface objects that are associated with the
|
||||
// player. For instance, the site supplier and the
|
||||
// error sink.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HxClientContext::close() {
|
||||
HX_RELEASE(_client_sink);
|
||||
HX_RELEASE(_error_sink);
|
||||
HX_RELEASE(_auth_mgr);
|
||||
HX_RELEASE(_site_supplier);
|
||||
HX_RELEASE(_default_prefs);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientContext::QueryInterface
|
||||
// Access: Public
|
||||
// Purpose: Queries this class to determine whether it supports
|
||||
// supports a specific interface. If the call succeeds
|
||||
// then the methods of that interface are made
|
||||
// available for use.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: id - Indicates the reference identifier of the
|
||||
// the interface being queried.
|
||||
// interface_obj - Points to an interface pointer that is
|
||||
// filled in if the query succeeds.
|
||||
// Return: HX_RESULT - Varies based on wheter the interface is
|
||||
// supported or not.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HX_RESULT HxClientContext::QueryInterface(THIS_ REFIID id, void** interface_obj) {
|
||||
HX_RESULT result = HXR_NOINTERFACE;
|
||||
// Determine if the IUnknown and ClientAdviseSink interfaces
|
||||
// are supported.
|
||||
if (IsEqualIID(id, IID_IUnknown)) {
|
||||
// Increase the reference count, set the Interface Object,
|
||||
// and return that the interface is supported within this
|
||||
// object.
|
||||
AddRef();
|
||||
*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;
|
||||
}
|
||||
else {
|
||||
// This Interface is not supported by this object. Set the
|
||||
// Interface Object to the NULL-state and return.
|
||||
*interface_obj = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientContex::AddRef
|
||||
// Access: Public
|
||||
// Purpose: Increases the classes reference count by one.
|
||||
// Whenever an object is created, it's reference count
|
||||
// begins at 1. If an application calls IUnknown::AddRef,
|
||||
// queries an interface belonging to a specific object,
|
||||
// or uses a creation function like HXCreateInstance,
|
||||
// the reference count is incremented by 1.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: Returns the new reference count.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP_(ULONG32) HxClientContext::AddRef(THIS) {
|
||||
return InterlockedIncrement(&_ref_count);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Method: HxClientContext::Release
|
||||
// Access: Public
|
||||
// Purpose: Decreases the object's reference count by one.
|
||||
// Every call to IUnknown::AddRef,
|
||||
// IUnknown::QueryInterface, or a creation function
|
||||
// such as HXCreateInstance must have a corresponding
|
||||
// call to IUnknown::Release. When the reference count
|
||||
// reaches 0 (zero), the object is destroyed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: Returns the new reference count.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP_(ULONG32) HxClientContext::Release(THIS) {
|
||||
// As long as the reference count is greater than 0, then this
|
||||
// object is still in "scope."
|
||||
if (InterlockedDecrement(&_ref_count) > 0 ) {
|
||||
return _ref_count;
|
||||
}
|
||||
|
||||
// Otherwise, this object is no longer necessary and should be
|
||||
// removed from memory.
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxClientContext::ReadPref
|
||||
// Access: Public
|
||||
// Purpose: This method reads a preference from the client
|
||||
// registry.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const char* pref_key - preference key to add to the
|
||||
// registry.
|
||||
// IHXBuffer* buffer - a buffer that manages the value of
|
||||
// the preference.
|
||||
// Return: IHXBuffer* buffer - returns a buffer that manages
|
||||
// the value of the preference.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxClientContext::ReadPref(const char* pref_key, IHXBuffer*& buffer) {
|
||||
HX_RESULT result = HXR_OK;
|
||||
char * cipher = 0;
|
||||
|
||||
if ((stricmp(pref_key, CLIENT_GUID_REGNAME) == 0) &&
|
||||
(*_guid != 0 )) {
|
||||
// Create a buffer
|
||||
buffer = new CHXBuffer();
|
||||
buffer->AddRef();
|
||||
|
||||
buffer->Set((UCHAR*)_guid, strlen(_guid) + 1);
|
||||
}
|
||||
else if (_default_prefs != 0) {
|
||||
result = _default_prefs->ReadPref(pref_key, buffer);
|
||||
}
|
||||
else {
|
||||
result = HXR_NOTIMPL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxClientContext::WritePref
|
||||
// Access: Public
|
||||
// Purpose: This method writes a preference to the helix
|
||||
// client registry.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: const char* pref_key - preference key to add to the
|
||||
// registry.
|
||||
// IHXBuffer* buffer - a buffer that manages the value of
|
||||
// the preference.
|
||||
// Return: IHXBuffer* buffer - returns a buffer that manages
|
||||
// the value of the preference.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxClientContext::WritePref(const char* pref_key, IHXBuffer *buffer) {
|
||||
if (_default_prefs != 0) {
|
||||
return _default_prefs->WritePref(pref_key, buffer);
|
||||
}
|
||||
else {
|
||||
return HXR_OK;
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
// Filename: HxClientContext.h
|
||||
// Created by: jjtaylor (01Feb04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#ifndef HXCLIENTCONTEXT_H
|
||||
#define HXCLIENTCONTEXT_H
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Panda Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "pandabase.h"
|
||||
#include "texture.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Helix Main Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "mainHelix.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Prototype/Struct/Class Forward Delcarations
|
||||
////////////////////////////////////////////////////////////////////
|
||||
struct IUnknown;
|
||||
struct IHXPreferences;
|
||||
class HxAdviseSink;
|
||||
class HxErrorSink;
|
||||
class HxAuthenticationManager;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class: HxClientContext
|
||||
// Purpose: This is a derived class from the IHXPreferences
|
||||
// base interface. This class is meant to set the
|
||||
// default preferences for a player. It contains the
|
||||
// necessary interface objects such as the Advise Sink,
|
||||
// Error Sink, and Site Supplier.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class HxClientContext : public IHXPreferences {
|
||||
public:
|
||||
HxClientContext(LONG32 client_index);
|
||||
~HxClientContext();
|
||||
void init(IUnknown* unknown, IHXPreferences* prefs, char* guid, bool sink_on, Texture* tex);
|
||||
void close();
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// IHUnkown Interface Methods Prototypes
|
||||
// Purpose: Implements the basic COM interface methods for reference
|
||||
// coutning and querying of related interfaces.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHOD (QueryInterface) (THIS_ REFIID id, void** interface_obj);
|
||||
STDMETHOD_ (ULONG32, AddRef) (THIS);
|
||||
STDMETHOD_ (ULONG32, Release) (THIS);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// IHXPreference Interface Methods Prototypes
|
||||
// Purpose: Implements the necessary interface methods that are
|
||||
// called to read or write from the Helix client registry.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHOD(ReadPref) (THIS_ const char* pref_key, IHXBuffer*& buffer);
|
||||
STDMETHOD(WritePref) (THIS_ const char* pref_key, IHXBuffer* buffer);
|
||||
private:
|
||||
// Private Class Variable Declarations
|
||||
LONG32 _ref_count;
|
||||
LONG32 _client_index;
|
||||
char _guid[256];
|
||||
|
||||
HxAdviseSink* _client_sink;
|
||||
HxErrorSink* _error_sink;
|
||||
HxAuthenticationManager* _auth_mgr;
|
||||
HxSiteSupplier * _site_supplier;
|
||||
IHXPreferences * _default_prefs;
|
||||
};
|
||||
#endif
|
||||
@@ -1,226 +0,0 @@
|
||||
// Filename: hxErrorSink.cpp
|
||||
// Created by: jjtaylor (27Jan04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Panda Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "HxErrorSink.h"
|
||||
#include "print.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Normal Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include <stdio.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxErrorSink::Constructor
|
||||
// Access: Public
|
||||
// Purpose: The default constructor of the class which
|
||||
// initializes the member variables.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: IUnknown * - Pointer to an IUnknown COM Interface
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HxErrorSink::HxErrorSink(IUnknown* unknown)
|
||||
: ref_count(0),
|
||||
_player(0)
|
||||
{
|
||||
IHXClientEngine* pEngine = 0;
|
||||
unknown->QueryInterface(IID_IHXClientEngine, (void**)&pEngine );
|
||||
if( pEngine != 0 )
|
||||
{
|
||||
IUnknown* pTemp = 0;
|
||||
pEngine->GetPlayer(0, pTemp);
|
||||
_player = (IHXPlayer*)pTemp;
|
||||
}
|
||||
|
||||
HX_RELEASE(pEngine);
|
||||
HX_ASSERT(_player);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Member: HxErrorSink::Destructor
|
||||
// Access: Private
|
||||
// Purpose: The default destructor of the class that releases
|
||||
// the interface member variables from memory.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HxErrorSink::~HxErrorSink() {
|
||||
HX_RELEASE(_player);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxErrorSink::QueryInterface
|
||||
// Access:
|
||||
// Purpose: Queries this class to determine whether it supports
|
||||
// supports a specific interface. If the call succeeds
|
||||
// then the methods of that interface are made
|
||||
// available for use.
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Params: _id - Indicates the reference identifier of the
|
||||
// the interface being queried.
|
||||
// _interface_obj - Points to an interface pointer that is
|
||||
// filled in if the query succeeds.
|
||||
// Return: HX_RESULT - Varies based on wheter the interface is
|
||||
// supported or not.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HX_RESULT HxErrorSink::QueryInterface(REFIID _id, void** _interface_obj) {
|
||||
// Determine if the IUnknown and ErrorSink interfaces
|
||||
// are supported.
|
||||
if (IsEqualIID(_id, IID_IUnknown)) {
|
||||
// Increase the reference count, set the Interface Object,
|
||||
// and return that the interface is supported within this
|
||||
// object.
|
||||
AddRef();
|
||||
*_interface_obj = (IUnknown*)(IHXErrorSink*)this;
|
||||
}
|
||||
else if (IsEqualIID(_id, IID_IHXErrorSink)) {
|
||||
// Same as above.
|
||||
AddRef();
|
||||
*_interface_obj = (IHXErrorSink*)this;
|
||||
}
|
||||
else {
|
||||
// This Interface is not supported by this object. Set the
|
||||
// Interface Object to the NULL-state and return.
|
||||
*_interface_obj = 0;
|
||||
return HXR_NOINTERFACE;
|
||||
}
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxErrorSink::AddRef
|
||||
// Access: Public
|
||||
// Purpose: Increases the object's reference count by one.
|
||||
// Whenever an object is created, it's reference count
|
||||
// begins at 1.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: ULONG32 - The new reference count.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP_(ULONG32) HxErrorSink::AddRef() {
|
||||
return InterlockedIncrement(&ref_count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxErrorSink::Release
|
||||
// Access: Public
|
||||
// Purpose: Decreases the object's reference count by one.
|
||||
// Every call to IUnknown::AddRef,
|
||||
// IUnknown::QueryInterface, or a creation function
|
||||
// such as HXCreateInstance must have a corresponding
|
||||
// call to IUnknown::Release. When the reference count
|
||||
// reaches 0 (zero), the object is destroyed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: ULONG32 - The new reference count.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP_(ULONG32) HxErrorSink::Release() {
|
||||
// As long as the reference count is greater than 0, then this
|
||||
// object is still in "scope."
|
||||
if (InterlockedDecrement(&ref_count) > 0 ) {
|
||||
return ref_count;
|
||||
}
|
||||
|
||||
// Otherwise, this object is no longer necessary and should be
|
||||
// removed from memory.
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxErrorSink::ErrorOccurred
|
||||
// Access: Public
|
||||
// Description: Reports an error, event, or status message
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: severity - Severity or level of the error message.
|
||||
// hx_code - Specific Error Code
|
||||
// user_code - User-Specific Error Code
|
||||
// user_string - Pointer to a user-specific string.
|
||||
// more_info_url - Pointer to a specific more information
|
||||
// URL string.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxErrorSink::ErrorOccurred(const UINT8 severity, const UINT32 hx_code,
|
||||
const UINT32 user_code, const char* user_string,
|
||||
const char* more_info_url) {
|
||||
// Initialize Local Variables to the Method.
|
||||
char HXDefine[256];
|
||||
|
||||
// Store the error code that was generated.
|
||||
convert_to_string(hx_code, HXDefine, 256);
|
||||
|
||||
STDOUT("Report(%d, %ld, \"%s\", %ld, \"%s\", \"%s\")\n", severity,
|
||||
hx_code, (user_string && *user_string) ? user_string : "(NULL)",
|
||||
user_code, (more_info_url && *more_info_url) ? more_info_url : "(NULL)",
|
||||
HXDefine);
|
||||
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxErrorSink::ConvertErrorToText
|
||||
// Access: Protected
|
||||
// Purpose: Converts the Helix error code to text for the
|
||||
// client to display.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: hx_code - the error code to be translated to text.
|
||||
// buffer - Text buffer that holds the code.
|
||||
// buffer_length - The length of the text buffer.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void HxErrorSink::convert_to_string(const ULONG32 hx_code, char* buffer, UINT32 buffer_length) {
|
||||
// Initialize Local Variables to this method.
|
||||
//IHXErrorMessages * pErrMsg = 0;
|
||||
|
||||
// If the buffer is not empty, then there is nothing to do.
|
||||
if( !buffer ) {
|
||||
return;
|
||||
}
|
||||
buffer[0] = '\0';
|
||||
|
||||
if (strlen(buffer) == 0) {
|
||||
SafeSprintf(buffer, buffer_length, "Can't convert the error code %p", hx_code);
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
// Filename: hxErrorSink.h
|
||||
// Created by: jjtaylor (29Jan04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#if !defined (_HXERRORSINK_H_)
|
||||
#define _HXERRORSINK_H_
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Panda Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "pandabase.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Helix Main Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "mainHelix.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Prototype/Struct/Class Forward Delcarations
|
||||
////////////////////////////////////////////////////////////////////
|
||||
struct IUnknown;
|
||||
struct IHXErrorMessages;
|
||||
struct IHXPlayer;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class: HxErrorSink
|
||||
// Purpose: This is a derived class from the IHXErrorSink
|
||||
// base interface. This class is meant to receive
|
||||
// error messages from the client engine.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class HxErrorSink : public IHXErrorSink {
|
||||
public:
|
||||
HxErrorSink(IUnknown* unknown);
|
||||
~HxErrorSink();
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// IHXErrorSink Interface Methods Prototypes
|
||||
// Purpose: Implements the necessary interface methods that may
|
||||
// be called when an error message is generated.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHOD (ErrorOccurred) (THIS_ const UINT8 severity, const UINT32 hx_code,
|
||||
const UINT32 user_code, const char* user_string,
|
||||
const char* more_info_url);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// IHUnkown Interface Methods Prototypes
|
||||
// Purpose: Implements the basic COM interface methods for reference
|
||||
// coutning and querying of related interfaces.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHOD (QueryInterface) (THIS_ REFIID _id, void** _interface_obj);
|
||||
STDMETHOD_ (ULONG32, AddRef) (THIS);
|
||||
STDMETHOD_ (ULONG32, Release) (THIS);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
// Protected Class Method Declarations
|
||||
void convert_to_string(const ULONG32 hx_code, char * buffer, UINT32 buffer_length);
|
||||
|
||||
// Protected Class Variable Declarations
|
||||
INT32 ref_count;
|
||||
IHXPlayer* _player;
|
||||
};
|
||||
#endif
|
||||
@@ -1,302 +0,0 @@
|
||||
// Filename: hxSiteSupplier.cxx
|
||||
// Created by: jjtaylor (29Jan04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Helix Main Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "mainHelix.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Normal Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include <iostream>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxSiteSupplier::Constructor
|
||||
// Access: Public
|
||||
// Purpose: The default constructor of the class which
|
||||
// initializes the member variables, and queries
|
||||
// the appropriate Helix Interfaces.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: IUnknown * - Pointer to an IUnknown COM Interface
|
||||
// Texture * tex- Pointer to the Panda texture object.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HxSiteSupplier::HxSiteSupplier(IUnknown* unknown, Texture* tex)
|
||||
: _ref_count(0),
|
||||
_site_manager(0),
|
||||
_ccf(0),
|
||||
_unknown(unknown),
|
||||
_dest_buffer(0),
|
||||
_texture(tex) {
|
||||
|
||||
if(_unknown) {
|
||||
_unknown->QueryInterface(IID_IHXSiteManager, (void**)&_site_manager);
|
||||
_unknown->QueryInterface(IID_IHXCommonClassFactory, (void**)&_ccf);
|
||||
_unknown->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Member: HxSiteSupplier:Destructor
|
||||
// Access: Private
|
||||
// Purpose: The default destructor of the class that releases
|
||||
// the interface member variables from memory.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
HxSiteSupplier::~HxSiteSupplier() {
|
||||
HX_RELEASE(_site_manager);
|
||||
HX_RELEASE(_ccf);
|
||||
HX_RELEASE(_unknown);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxSiteSupplier::QueryInterface
|
||||
// Access:
|
||||
// Purpose: Queries this class to determine whether it supports
|
||||
// supports a specific interface. If the call succeeds
|
||||
// then the methods of that interface are made
|
||||
// available for use.
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Params: _id - Indicates the reference identifier of the
|
||||
// the interface being queried.
|
||||
// _interface_obj - Points to an interface pointer that is
|
||||
// filled in if the query succeeds.
|
||||
// Return: HX_RESULT - Varies based on wheter the interface is
|
||||
// supported or not.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxSiteSupplier::QueryInterface(REFIID _id, void** _interface_obj) {
|
||||
if (IsEqualIID(_id, IID_IUnknown)) {
|
||||
AddRef();
|
||||
*_interface_obj = (IUnknown*)(IHXSiteSupplier*)this;
|
||||
return HXR_OK;
|
||||
}
|
||||
else if (IsEqualIID(_id, IID_IHXSiteSupplier)) {
|
||||
AddRef();
|
||||
*_interface_obj = (IHXSiteSupplier*)this;
|
||||
return HXR_OK;
|
||||
}
|
||||
*_interface_obj = NULL;
|
||||
return HXR_NOINTERFACE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxSiteSupplier::AddRef
|
||||
// Access: Public
|
||||
// Purpose: Increases the object's reference count by one.
|
||||
// Whenever an object is created, it's reference count
|
||||
// begins at 1.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: ULONG32 - The new reference count.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP_(ULONG32) HxSiteSupplier::AddRef() {
|
||||
return InterlockedIncrement(&_ref_count);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxSite::Release
|
||||
// Access: Public
|
||||
// Purpose: Decreases the object's reference count by one.
|
||||
// Every call to IUnknown::AddRef,
|
||||
// IUnknown::QueryInterface, or a creation function
|
||||
// such as HXCreateInstance must have a corresponding
|
||||
// call to IUnknown::Release. When the reference count
|
||||
// reaches 0 (zero), the object is destroyed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: ULONG32 - The new reference count.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP_(ULONG32)HxSiteSupplier::Release() {
|
||||
if (InterlockedDecrement(&_ref_count) > 0) {
|
||||
return _ref_count;
|
||||
}
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxSiteSupplier::SitesNeeded
|
||||
// Access: Public
|
||||
// Purpose: Informs the site supplier that a site with a
|
||||
// particular set of characteristics is needed. If the
|
||||
// supplier can fulfill the requestion, it should call
|
||||
// the site manager and add a new site to it.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: UINT32 request_id - ID used to map between corresponding
|
||||
// "sites needed" and "sites not needed"
|
||||
// calls.
|
||||
// IHXValues * pProps - The properties of the requested site
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxSiteSupplier::SitesNeeded(UINT32 request_id, IHXValues* pProps) {
|
||||
// Determine if there are valid properties. If not then a site
|
||||
// can not properly be created.
|
||||
if (!pProps) {
|
||||
return HXR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Local Variable Declaration and Intialization
|
||||
HRESULT hres = HXR_OK;
|
||||
IHXValues* site_props = NULL;
|
||||
IHXSiteWindowed* pSiteWindowed = NULL;
|
||||
IHXBuffer* pValue = NULL;
|
||||
UINT32 style = 0;
|
||||
IHXSite* pSite = NULL;
|
||||
|
||||
// Just let the Helix client core create a windowed site for us.
|
||||
hres = _ccf->CreateInstance(CLSID_IHXSiteWindowed,(void**)&pSiteWindowed);
|
||||
if (HXR_OK != hres) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
hres = pSiteWindowed->QueryInterface(IID_IHXSite,(void**)&pSite);
|
||||
if (HXR_OK != hres) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
hres = pSiteWindowed->QueryInterface(IID_IHXValues,(void**)&site_props);
|
||||
if (HXR_OK != hres) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Figures out what type of site must be created.
|
||||
hres = pProps->GetPropertyCString("playto",pValue);
|
||||
if (HXR_OK == hres) {
|
||||
site_props->SetPropertyCString("channel",pValue);
|
||||
HX_RELEASE(pValue);
|
||||
}
|
||||
else {
|
||||
hres = pProps->GetPropertyCString("name",pValue);
|
||||
if (HXR_OK == hres) {
|
||||
site_props->SetPropertyCString("LayoutGroup",pValue);
|
||||
HX_RELEASE(pValue);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
style = WS_OVERLAPPED | WS_VISIBLE | WS_CLIPCHILDREN;
|
||||
#endif
|
||||
|
||||
pSiteWindowed->SetDstBuffer(_texture->modify_ram_image(),
|
||||
_texture->get_x_size(),
|
||||
_texture->get_y_size());
|
||||
|
||||
// Create the window. Not necessary later on.
|
||||
hres = pSiteWindowed->Create(NULL, style);
|
||||
//hres = pSiteWindowed->AttachWindow(NULL);
|
||||
if (HXR_OK != hres) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// Add the site to the site manager.
|
||||
hres = _site_manager->AddSite(pSite);
|
||||
if (HXR_OK != hres) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
_created_sites.SetAt((void*)request_id,pSite);
|
||||
//pair<UINT32, IHXSite*> site(request_id, pSite);
|
||||
//_created_sites.insert(site);
|
||||
|
||||
pSite->AddRef();
|
||||
|
||||
exit:
|
||||
HX_RELEASE(site_props);
|
||||
HX_RELEASE(pSiteWindowed);
|
||||
HX_RELEASE(pSite);
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxSiteSupplier::SitesNotNeeded
|
||||
// Access: Public
|
||||
// Purpose: Informs the site supplier that all sites from a
|
||||
// previous site request are no longer needed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: UINT32 request_id - ID used to map between corresponding
|
||||
// "sites needed" and "sites not needed"
|
||||
// calls.
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxSiteSupplier::SitesNotNeeded(UINT32 request_id) {
|
||||
// Local Variable Declaration and Initialization
|
||||
IHXSite* pSite = NULL;
|
||||
IHXSiteWindowed* pSiteWindowed = NULL;
|
||||
void* pVoid = NULL;
|
||||
|
||||
// search for the site id in the map
|
||||
if (!_created_sites.Lookup((void*)request_id,pVoid)) {
|
||||
return HXR_INVALID_PARAMETER;
|
||||
}
|
||||
//SITES::iterator iter = _created_sites.find(request_id);
|
||||
//if(iter == _created_sites.end()) {
|
||||
// return HXR_INVALID_PARAMETER;
|
||||
//}
|
||||
pSite = (IHXSite*)pVoid;
|
||||
|
||||
// Remove the site from the site manager.
|
||||
_site_manager->RemoveSite(pSite);
|
||||
|
||||
// Need to actually do the work on destroying the window
|
||||
// and all that jazz.
|
||||
pSite->QueryInterface(IID_IHXSiteWindowed,(void**)&pSiteWindowed);
|
||||
|
||||
pSiteWindowed->Destroy();
|
||||
|
||||
// ref count = 2
|
||||
pSiteWindowed->Release();
|
||||
|
||||
// ref count = 1; deleted from this object's view!
|
||||
pSite->Release();
|
||||
|
||||
// Remove the site from the map.
|
||||
_created_sites.RemoveKey((void*)request_id);
|
||||
//_created_sites.erase(request_id);
|
||||
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxSiteSupplier::BeginChangeLayout
|
||||
// Access: Public
|
||||
// Purpose: Informs the site supplier that a layout change
|
||||
// has begun and that it can expect to receive calls
|
||||
// to the SitesNeeded and SitesNotNeeded method.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxSiteSupplier::BeginChangeLayout() {
|
||||
return HXR_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Member: HxSiteSupplier::DoneChangeLayout
|
||||
// Access: Public
|
||||
// Purpose: Informs the site supplier that the layout changes
|
||||
// are completed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Params: None
|
||||
// Return: None
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHODIMP HxSiteSupplier::DoneChangeLayout() {
|
||||
return HXR_OK;
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
// Filename: HxSiteSupplier.h
|
||||
// Created by: jjtaylor (29Jan04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||
//
|
||||
// All use of this software is subject to the terms of the revised BSD
|
||||
// license. You should have received a copy of this license along
|
||||
// with this source code in a file named "LICENSE."
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#ifndef HXSITESUPPLIER_H
|
||||
#define HXSITESUPPLIER_H
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Panda Header Files
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "pandabase.h"
|
||||
#include "pmap.h"
|
||||
#include "texture.h"
|
||||
#include "fivemmap.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class: HxSiteSupplier
|
||||
// Purpose: This is a derived class from the IHXSiteSupplier
|
||||
// base interface. This class is meant to create or
|
||||
// remove Helix Sites.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class HxSiteSupplier : public IHXSiteSupplier {
|
||||
public:
|
||||
HxSiteSupplier(IUnknown* unknown, Texture* tex);
|
||||
~HxSiteSupplier();
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// IHUnkown Interface Methods Prototypes
|
||||
// Purpose: Implements the basic COM interface methods for reference
|
||||
// coutning and querying of related interfaces.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHOD(QueryInterface) (THIS_ REFIID id, void** interface_obj);
|
||||
STDMETHOD_(ULONG32,AddRef) (THIS);
|
||||
STDMETHOD_(ULONG32,Release) (THIS);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// IHXClientAdviseSink Interface Methods Prototypes
|
||||
// Purpose: Implements the necessary interface methods that may
|
||||
// be called when a site must be created or closed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
STDMETHOD(SitesNeeded) (THIS_ UINT32 request_id, IHXValues* site_props);
|
||||
STDMETHOD(SitesNotNeeded) (THIS_ UINT32 request_id);
|
||||
STDMETHOD(BeginChangeLayout) (THIS);
|
||||
STDMETHOD(DoneChangeLayout) (THIS);
|
||||
private:
|
||||
LONG32 _ref_count;
|
||||
IHXSiteManager* _site_manager;
|
||||
IHXCommonClassFactory* _ccf;
|
||||
IUnknown* _unknown;
|
||||
FiveMinuteMap _created_sites;
|
||||
UCHAR* _dest_buffer;
|
||||
Texture* _texture;
|
||||
};
|
||||
#endif
|
||||
@@ -1,74 +0,0 @@
|
||||
#if !defined (_MAINHELIX_H_)
|
||||
#define _MAINHELIX_H_
|
||||
|
||||
// This file basically just contains all of the header
|
||||
// files that I will need to invoke the client core
|
||||
// and start an engine.
|
||||
#include "pandabase.h"
|
||||
#include "helixDefs.h"
|
||||
|
||||
#include <hxtypes.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <hlxclib/time.h>
|
||||
|
||||
#include <hxwintyp.h>
|
||||
#include <hxcom.h>
|
||||
#include <ihxpckts.h>
|
||||
#include <hxcomm.h>
|
||||
#include <hxmon.h>
|
||||
#include <hxfiles.h>
|
||||
#include <hxengin.h>
|
||||
#include <hxcore.h>
|
||||
#include <hxclsnk.h>
|
||||
#include <hxerror.h>
|
||||
#include <hxauth.h>
|
||||
#include <hxwin.h>
|
||||
#include <hxprefs.h>
|
||||
#include <hxtbuf.h>
|
||||
#include <hxbuffer.h>
|
||||
#include <hxmangle.h>
|
||||
//#include "fivemmap.h"
|
||||
#include <dllacces.h>
|
||||
#include <dllpath.h>
|
||||
#include <hxstrutl.h>
|
||||
|
||||
#include <HxAdviseSink.h>
|
||||
#include <HxErrorSink.h>
|
||||
#include <HxSiteSupplier.h>
|
||||
#include <HxAuthenticationManager.h>
|
||||
#include <HxClientContext.h>
|
||||
#include "print.h"
|
||||
|
||||
typedef HX_RESULT (HXEXPORT_PTR FPRMSETDLLACCESSPATH) (const char*);
|
||||
|
||||
#endif
|
||||
/*
|
||||
|
||||
#include "hxtypes.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <common/runtime/pub/hlxclib/time.h>
|
||||
|
||||
#include <common/include/hxwintyp.h>
|
||||
#include <common/include/hxcom.h>
|
||||
#include <common/include/ihxpckts.h>
|
||||
#include <common/include/hxcomm.h>
|
||||
#include <common/include/hxmon.h>
|
||||
#include <common/include/hxfiles.h>
|
||||
#include <common/include/hxengin.h>
|
||||
#include <common/include/hxcore.h>
|
||||
#include <client/include/hxclsnk.h>
|
||||
#include <common/include/hxerror.h>
|
||||
#include <common/include/hxauth.h>
|
||||
#include <common/include/hxwin.h>
|
||||
#include <common/include/hxprefs.h>
|
||||
#include <common/include/hxtbuf.h>
|
||||
#include <common/container/pub/hxbuffer.h>
|
||||
#include <common/util/pub/hxmangle.h>
|
||||
//#include "fivemmap.h"
|
||||
#include <common/system/pub/dllacces.h>
|
||||
#include <common/system/pub/dllpath.h>
|
||||
#include <common/util/pub/hxstrutl.h> */
|
||||
@@ -1,28 +0,0 @@
|
||||
#define BUILD_DIRECTORY $[HAVE_HELIX]
|
||||
|
||||
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
|
||||
dtoolutil:c dtoolbase:c dtool:m
|
||||
|
||||
#begin lib_target
|
||||
#define TARGET helix
|
||||
#define LOCAL_LIBS \
|
||||
dgraph
|
||||
#define WIN_SYS_LIBS $[WIN_SYS_LIBS] user32.lib advapi32.lib winmm.lib
|
||||
#define USE_PACKAGES helix
|
||||
|
||||
#define SOURCES \
|
||||
config_helix.cxx config_helix.h fivemmap.cxx fivemmap.h \
|
||||
HelixClient.cxx HelixClient.h HxAdviseSink.cxx HxAdviseSink.h \
|
||||
HxAuthenticationManager.cxx HxAuthenticationManager.h \
|
||||
HxClientContext.cxx HxClientContext.h HxErrorSink.cxx HxErrorSink.h \
|
||||
HxSiteSupplier.cxx HxSiteSupplier.h iids.cxx MainHelix.h print.cxx print.h
|
||||
|
||||
|
||||
#define INSTALL_HEADERS \
|
||||
config_helix.h \
|
||||
HelixClient.h
|
||||
|
||||
#define IGATESCAN \
|
||||
HelixClient.cxx
|
||||
|
||||
#end lib_target
|
||||
@@ -1,5 +0,0 @@
|
||||
// Filename: config_helix.h
|
||||
// Created by: jjtaylor (27Feb04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -1,5 +0,0 @@
|
||||
// Filename: config_helix.h
|
||||
// Created by: jjtaylor (27Feb04)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -1,175 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: RCSL 1.0/RPSL 1.0
|
||||
*
|
||||
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file, and the files included with this file, are
|
||||
* subject to the current version of the RealNetworks Public Source License
|
||||
* Version 1.0 (the "RPSL") available at
|
||||
* http://www.helixcommunity.org/content/rpsl unless you have licensed
|
||||
* the file under the RealNetworks Community Source License Version 1.0
|
||||
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
|
||||
* in which case the RCSL will apply. You may also obtain the license terms
|
||||
* directly from RealNetworks. You may not use this file except in
|
||||
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
|
||||
* applicable to this file, the RCSL. Please see the applicable RPSL or
|
||||
* RCSL for the rights, obligations and limitations governing use of the
|
||||
* contents of the file.
|
||||
*
|
||||
* This file is part of the Helix DNA Technology. RealNetworks is the
|
||||
* developer of the Original Code and owns the copyrights in the portions
|
||||
* it created.
|
||||
*
|
||||
* This file, and the files included with this file, is distributed and made
|
||||
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
*
|
||||
* Technology Compatibility Kit Test Suite(s) Location:
|
||||
* http://www.helixcommunity.org/content/tck
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <string.h>
|
||||
//#include "hxtypes.h"
|
||||
#include "fivemmap.h"
|
||||
|
||||
void* FiveMinuteMap::GetFirstValue()
|
||||
{
|
||||
m_nCursor = 0;
|
||||
|
||||
if (m_nMapSize)
|
||||
{
|
||||
return ValueArray[m_nCursor];
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void* FiveMinuteMap::GetNextValue()
|
||||
{
|
||||
m_nCursor++;
|
||||
|
||||
if (m_nCursor < m_nMapSize)
|
||||
{
|
||||
return ValueArray[m_nCursor];
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL FiveMinuteMap::Lookup(void* Key, void*& Value) const
|
||||
{
|
||||
BOOL bFound = FALSE;
|
||||
int nIndex = 0;
|
||||
|
||||
// If Key is alrady in the list, replace value
|
||||
for (; nIndex < m_nMapSize; nIndex++)
|
||||
{
|
||||
if (KeyArray[nIndex] == Key)
|
||||
{
|
||||
Value = ValueArray[nIndex];
|
||||
bFound = TRUE;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
return bFound;
|
||||
}
|
||||
|
||||
void FiveMinuteMap::RemoveKey(void* Key)
|
||||
{
|
||||
BOOL bFound = FALSE;
|
||||
int nIndex = 0;
|
||||
|
||||
// If Key is alrady in the list, replace value
|
||||
for (; nIndex < m_nMapSize; nIndex++)
|
||||
{
|
||||
if (KeyArray[nIndex] == Key)
|
||||
{
|
||||
if (nIndex < (m_nMapSize-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)));
|
||||
}
|
||||
m_nMapSize--;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
(NULL); // We're done!
|
||||
}
|
||||
|
||||
void FiveMinuteMap::RemoveValue(void* Value)
|
||||
{
|
||||
BOOL bFound = FALSE;
|
||||
int nIndex = 0;
|
||||
|
||||
// If Value is alrady in the list, replace value
|
||||
for (; nIndex < m_nMapSize; nIndex++)
|
||||
{
|
||||
if (ValueArray[nIndex] == Value)
|
||||
{
|
||||
if (nIndex < (m_nMapSize-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)));
|
||||
}
|
||||
m_nMapSize--;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
(NULL); // We're done!
|
||||
}
|
||||
|
||||
|
||||
void FiveMinuteMap::SetAt(void* Key, void* Value)
|
||||
{
|
||||
int nIndex = 0;
|
||||
|
||||
// If Key is alrady in the list, replace value
|
||||
for (; nIndex < m_nMapSize; nIndex++)
|
||||
{
|
||||
if (KeyArray[nIndex] == Key)
|
||||
{
|
||||
ValueArray[nIndex] = Value;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
// If we have room, add it to the end!
|
||||
if (m_nAllocSize == m_nMapSize)
|
||||
{
|
||||
m_nAllocSize += AllocationSize;
|
||||
void** pNewKeys = new void*[m_nAllocSize];
|
||||
void** pNewValues = new void*[m_nAllocSize];
|
||||
|
||||
memcpy(pNewKeys,KeyArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
|
||||
memcpy(pNewValues,ValueArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
|
||||
|
||||
delete [] KeyArray;
|
||||
delete [] ValueArray;
|
||||
|
||||
KeyArray = pNewKeys;
|
||||
ValueArray = pNewValues;
|
||||
}
|
||||
|
||||
KeyArray[m_nMapSize] = Key;
|
||||
ValueArray[m_nMapSize] = Value;
|
||||
m_nMapSize++;
|
||||
|
||||
exit:
|
||||
(NULL); // We're done!
|
||||
}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: RCSL 1.0/RPSL 1.0
|
||||
*
|
||||
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file, and the files included with this file, are
|
||||
* subject to the current version of the RealNetworks Public Source License
|
||||
* Version 1.0 (the "RPSL") available at
|
||||
* http://www.helixcommunity.org/content/rpsl unless you have licensed
|
||||
* the file under the RealNetworks Community Source License Version 1.0
|
||||
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
|
||||
* in which case the RCSL will apply. You may also obtain the license terms
|
||||
* directly from RealNetworks. You may not use this file except in
|
||||
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
|
||||
* applicable to this file, the RCSL. Please see the applicable RPSL or
|
||||
* RCSL for the rights, obligations and limitations governing use of the
|
||||
* contents of the file.
|
||||
*
|
||||
* This file is part of the Helix DNA Technology. RealNetworks is the
|
||||
* developer of the Original Code and owns the copyrights in the portions
|
||||
* it created.
|
||||
*
|
||||
* This file, and the files included with this file, is distributed and made
|
||||
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
*
|
||||
* Technology Compatibility Kit Test Suite(s) Location:
|
||||
* http://www.helixcommunity.org/content/tck
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _FIVEMMAP_H_
|
||||
#define _FIVEMMAP_H_
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "helixDefs.h"
|
||||
|
||||
#include <hxtypes.h>
|
||||
|
||||
#ifndef _HXTYPES_H_
|
||||
#error FiveMinuteMap assumes pntypes.h.
|
||||
#endif
|
||||
|
||||
class FiveMinuteMap {
|
||||
const int AllocationSize;
|
||||
|
||||
void** KeyArray;
|
||||
void** ValueArray;
|
||||
int m_nMapSize;
|
||||
int m_nAllocSize;
|
||||
int m_nCursor;
|
||||
public:
|
||||
FiveMinuteMap()
|
||||
: KeyArray(NULL)
|
||||
, ValueArray(NULL)
|
||||
, m_nMapSize(0)
|
||||
, m_nAllocSize(0)
|
||||
, m_nCursor(0)
|
||||
, AllocationSize(10)
|
||||
{};
|
||||
|
||||
~FiveMinuteMap()
|
||||
{
|
||||
delete [] KeyArray;
|
||||
delete [] ValueArray;
|
||||
};
|
||||
|
||||
int GetCount() {return m_nMapSize;}
|
||||
|
||||
void* GetFirstValue();
|
||||
void* GetNextValue();
|
||||
|
||||
BOOL Lookup(void* Key, void*& Value) const;
|
||||
void RemoveKey(void* Key);
|
||||
void RemoveValue(void* Value);
|
||||
void SetAt(void* Key, void* Value);
|
||||
};
|
||||
|
||||
#endif /* _FIVEMMAP_H_ */
|
||||
@@ -1,52 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: RCSL 1.0/RPSL 1.0
|
||||
*
|
||||
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file, and the files included with this file, are
|
||||
* subject to the current version of the RealNetworks Public Source License
|
||||
* Version 1.0 (the "RPSL") available at
|
||||
* http://www.helixcommunity.org/content/rpsl unless you have licensed
|
||||
* the file under the RealNetworks Community Source License Version 1.0
|
||||
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
|
||||
* in which case the RCSL will apply. You may also obtain the license terms
|
||||
* directly from RealNetworks. You may not use this file except in
|
||||
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
|
||||
* applicable to this file, the RCSL. Please see the applicable RPSL or
|
||||
* RCSL for the rights, obligations and limitations governing use of the
|
||||
* contents of the file.
|
||||
*
|
||||
* This file is part of the Helix DNA Technology. RealNetworks is the
|
||||
* developer of the Original Code and owns the copyrights in the portions
|
||||
* it created.
|
||||
*
|
||||
* This file, and the files included with this file, is distributed and made
|
||||
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
*
|
||||
* Technology Compatibility Kit Test Suite(s) Location:
|
||||
* http://www.helixcommunity.org/content/tck
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// define all guids here once...
|
||||
#define INITGUID
|
||||
#define NCIHACK
|
||||
#include "pandabase.h"
|
||||
#include "helixDefs.h"
|
||||
#include "hxtypes.h"
|
||||
#include "hxcom.h"
|
||||
#include "hxiids.h"
|
||||
#include "hxpiids.h"
|
||||
#if defined _WINDOWS
|
||||
#if defined (HELIX_FEATURE_DIRECT_SOUND)
|
||||
#include "dsound.h"
|
||||
#endif /* HELIX_FEATURE_DIRECT_SOUND */
|
||||
#if defined (HELIX_FEATURE_VIDEO) && !defined(_WINCE)
|
||||
#include "ddraw.h"
|
||||
#endif /* HELIX_FEATURE_VIDEO */
|
||||
#endif
|
||||
@@ -1,46 +0,0 @@
|
||||
#include "dllpath.h"
|
||||
|
||||
#include "HelixClient.h"
|
||||
|
||||
|
||||
// typedef for SetDLLAccessPath
|
||||
|
||||
#if defined _DEBUG || defined DEBUG
|
||||
#include "debug.h"
|
||||
#endif
|
||||
|
||||
#if defined(HELIX_CONFIG_NOSTATICS)
|
||||
# include "globals/hxglobals.h"
|
||||
#endif
|
||||
|
||||
DLLAccessPath statClnt;
|
||||
DLLAccessPath* GetDLLAccessPath()
|
||||
{
|
||||
return &statClnt;
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
HelixClient* myClient = new HelixClient();
|
||||
STDOUT("%s", argv[1]);
|
||||
myClient->create_player("myPlayer", true);
|
||||
|
||||
//myClient->open_url("myPlayer", argv[1]);
|
||||
myClient->open_url("myPlayer", "rage.mp3");
|
||||
|
||||
bool done = true;
|
||||
myClient->begin("myPlayer");
|
||||
while (done != myClient->is_done("myPlayer")) {
|
||||
//Do Nothing for now
|
||||
MSG msg;
|
||||
|
||||
GetMessage(&msg, NULL, 0, 0);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
delete myClient;
|
||||
myClient = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: RCSL 1.0/RPSL 1.0
|
||||
*
|
||||
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file, and the files included with this file, are
|
||||
* subject to the current version of the RealNetworks Public Source License
|
||||
* Version 1.0 (the "RPSL") available at
|
||||
* http://www.helixcommunity.org/content/rpsl unless you have licensed
|
||||
* the file under the RealNetworks Community Source License Version 1.0
|
||||
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
|
||||
* in which case the RCSL will apply. You may also obtain the license terms
|
||||
* directly from RealNetworks. You may not use this file except in
|
||||
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
|
||||
* applicable to this file, the RCSL. Please see the applicable RPSL or
|
||||
* RCSL for the rights, obligations and limitations governing use of the
|
||||
* contents of the file.
|
||||
*
|
||||
* This file is part of the Helix DNA Technology. RealNetworks is the
|
||||
* developer of the Original Code and owns the copyrights in the portions
|
||||
* it created.
|
||||
*
|
||||
* This file, and the files included with this file, is distributed and made
|
||||
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
*
|
||||
* Technology Compatibility Kit Test Suite(s) Location:
|
||||
* http://www.helixcommunity.org/content/tck
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include "print.h"
|
||||
#ifdef WIN32_PLATFORM_PSPC
|
||||
#include "hlxosstr.h"
|
||||
#include <winbase.h>
|
||||
#endif
|
||||
|
||||
int print2stdout(const char* pFmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, pFmt);
|
||||
|
||||
#ifdef WIN32_PLATFORM_PSPC
|
||||
char Message[512];
|
||||
int ret = vsprintf(Message, pFmt, args);
|
||||
OutputDebugString(OS_STRING(Message));
|
||||
#else
|
||||
int ret = vfprintf(stdout, pFmt, args);
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int print2stderr(const char* pFmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, pFmt);
|
||||
|
||||
#ifdef WIN32_PLATFORM_PSPC
|
||||
char Message[512];
|
||||
int ret = vsprintf(Message, pFmt, args);
|
||||
OutputDebugString(OS_STRING(Message));
|
||||
#else
|
||||
int ret = vfprintf(stderr, pFmt, args);
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: RCSL 1.0/RPSL 1.0
|
||||
*
|
||||
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file, and the files included with this file, are
|
||||
* subject to the current version of the RealNetworks Public Source License
|
||||
* Version 1.0 (the "RPSL") available at
|
||||
* http://www.helixcommunity.org/content/rpsl unless you have licensed
|
||||
* the file under the RealNetworks Community Source License Version 1.0
|
||||
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
|
||||
* in which case the RCSL will apply. You may also obtain the license terms
|
||||
* directly from RealNetworks. You may not use this file except in
|
||||
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
|
||||
* applicable to this file, the RCSL. Please see the applicable RPSL or
|
||||
* RCSL for the rights, obligations and limitations governing use of the
|
||||
* contents of the file.
|
||||
*
|
||||
* This file is part of the Helix DNA Technology. RealNetworks is the
|
||||
* developer of the Original Code and owns the copyrights in the portions
|
||||
* it created.
|
||||
*
|
||||
* This file, and the files included with this file, is distributed and made
|
||||
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
*
|
||||
* Technology Compatibility Kit Test Suite(s) Location:
|
||||
* http://www.helixcommunity.org/content/tck
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef PRINT_H
|
||||
#define PRINT_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _SYMBIAN
|
||||
#include "platform/symbian/symbian_print.h"
|
||||
|
||||
#define STDOUT symbianPrint
|
||||
#define STDERR symbianPrint
|
||||
#else
|
||||
int print2stdout(const char* pFmt, ...);
|
||||
int print2stderr(const char* pFmt, ...);
|
||||
#define STDOUT print2stdout
|
||||
#define STDERR print2stderr
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* PRINT_H */
|
||||
Reference in New Issue
Block a user