00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <iostream>
00019 using namespace std;
00020
00021 #include <qapplication.h>
00022 #include <qthread.h>
00023 #include <qdom.h>
00024 #include <qdir.h>
00025 #include <qsettings.h>
00026
00027 #include <stdio.h>
00028 #include <string.h>
00029 #include <unistd.h>
00030 #include <getopt.h>
00031 #include <stdlib.h>
00032 #include <sys/types.h>
00033 #include <sys/stat.h>
00034 #include <fcntl.h>
00035 #include <signal.h>
00036 #include <pthread.h>
00037 #include <wait.h>
00038 #include <netdb.h>
00039 #include <pwd.h>
00040 #include <execinfo.h>
00041 #include <errno.h>
00042
00043 #include "RioMMInterface.h"
00044 #include "RioInterface.h"
00045 #include "RioError.h"
00046 #include "RioFile.h"
00047 #include "RioMMObject.h"
00048 #include "common.h"
00049 #include "RioMMVideo.h"
00050 #include "RioMMMp3.h"
00051 #include "RioMMEmbed.h"
00052 #include "RioMMBrowser.h"
00053 #include "RioMMSlideShow.h"
00054 #include "RioMMTgif.h"
00055 #include "RioMMTopics.h"
00056 #include "RioMMExplorer.h"
00057 #include "RioMMKeywords.h"
00058
00059 #ifdef RIO_EMUL
00060 #include "RioMMEmul.h"
00061 #endif
00062
00063 CRioMMEmbed *browser;
00064 CRioSession videoSession;
00065 CRioSession *Session;
00066 CRioStream Stream;
00067 CRioMMObject *object;
00068 RioMMInterface *rio;
00069 RioMMExplorer rioMMExplorer;
00070
00071
00072 int screenWidth = 0;
00073 int screenHeight = 0;
00074
00075 void makeLogHeader( CRioMMVideo*, ConfigData*, char* );
00076
00077 CRioMMObject *CreateVideoObj( char *, int, RioBlock,
00078 CRioStream *, struct timeval RTT_average,
00079 RioMMInterface *, CRioStream *,
00080 ConfigData *config,
00081 int block = 0 );
00082
00083 CRioMMObject *CreateMusicObj( char *, int, RioBlock, CRioStream *,
00084 struct timeval RTT_average, RioMMInterface * );
00085
00086 long long int CreateTopicsObj( char *, int, RioBlock, CRioStream *,
00087 struct timeval RTT_average, CRioMMVideo * );
00088
00089
00090
00091
00092
00093 long long int CreateKeywordsObj( char *, int, RioBlock, CRioStream *,
00094 struct timeval RTT_average, CRioMMVideo * );
00095
00096 CRioMMObject *CreateEmbedObj( char *, int, RioBlock, CRioStream *,
00097 struct timeval RTT_average, int port );
00098
00099 CRioMMObject *CreateBrowserObj( char *, int, RioBlock, CRioStream *,
00100 struct timeval RTT_average, int port );
00101
00102 CRioMMObject *CreateTgifObj( char *, int, RioBlock, CRioStream *,
00103 struct timeval RTT_average, int tgifWindow );
00104
00105 int CheckForSlaves( CRioMMObject *, int, RioBlock, CRioStream *,
00106 struct timeval RTT_average, int tgifWindow,
00107 int browserPort );
00108
00109 bool readSettings( ConfigData * );
00110 void printOptions( ConfigData * );
00111
00112
00113
00114
00115
00116
00117 void Usage( char *progname )
00118 {
00119 #ifdef RIO_EMUL
00120 cout << "\nUsage: " << progname << " -e <emulator_file> -l "
00121 << "<logEmulator_path> [options] server:multimedia-file" << endl;
00122 cout << " -e|--emulator <emulator_file>\n\tExecute client without "
00123 << "interactions using file 'emulator_file'." << endl;
00124 cout << " -l|--logFilename <logEmulator_filename>\n\tFilename where the "
00125 << "emulator's logs will be stored." << endl;
00126 #else
00127 cout << "\nUsage: " << progname << " [options] server:multimedia-file"
00128 << endl;
00129 #endif
00130 cout << "\nOptions:" << endl;
00131 cout << " -a|--autoplay\n\tActivate automatic start at the beginning of "
00132 << "the video and automatic closing of RioMMClient at the completion "
00133 << "of the video." << endl;
00134 cout << " -b|--buffers num-buffers\n\tWait num-buffers packets before "
00135 << "start movie." << endl;
00136 cout << " -c|--usecache <0|1>\n\t0 - Don't use cache. 1 - Use cache"
00137 << endl;
00138 #ifdef RIO_DEBUG_FILE
00139 cout << " -d|--rnlogpath\n\tPath where the RioNeti log will "
00140 << "be saved." << endl;
00141 #endif
00142 cout << " -h|--help\n\tShow this message" << endl;
00143 cout << " -i|--pluginport port\n\tCommunication port with browser "
00144 << "plugin" << endl;
00145 cout << " -m|--mainwindow ID\n\tRoot window for the main interface"
00146 << endl;;
00147 cout << " -n|--useplugins <0|1>\n\t0 - Disable all plugins. 1 - Enable "
00148 << "all plugins" << endl;
00149 cout << " -p|--pi <hostname>\n\tConnect to a Patching Interativo Layer at"
00150 << " host 'hostname'." << endl;
00151 cout << " -s|--sync <0|1>\n\t0 - Disable synchronization button. 1 -"
00152 << " Enable synchronization button." << endl;
00153 cout << " -t|--tgifWindow ID\n\tRoot window for tgif" << endl;
00154
00155 #ifndef RIO_EMUL
00156 cout << " -u|--username user\n\tLog in using this user name." << endl;
00157 #endif
00158
00159 cout << " -v|--vid ID\n\tRoot window for video." << endl;
00160 cout << " -V|--version\n\tshow riommclient version and exit"
00161 << endl << endl;
00162 exit( -1 );
00163 }
00164
00165
00166
00167
00168
00169
00170
00171 void signalHandler( int sig )
00172 {
00173 signal( SIGSEGV, SIG_IGN );
00174
00175 if( object )
00176 {
00177
00178 if( sig != SIGSEGV )
00179 {
00180
00181 if( sig == SIGINT )
00182 signal( SIGCHLD, SIG_IGN );
00183
00184 object->Stop();
00185 delete object;
00186 object = NULL;
00187 }
00188 else
00189 {
00190 RioErr << "[RioMMClient]: Caught SIGSEGV signal, exiting ... "
00191 << endl;
00192 }
00193 Stream.Close();
00194 Session->Disconnect();
00195 exit( -1 );
00196 }
00197 }
00198
00199
00200
00201
00202
00203
00204
00205
00206 void dispatchSignals( int sig )
00207 {
00208 int data;
00209
00210 #ifdef RIO_DEBUG2
00211 RioErr << "[RioMMClient]: Entrei na dispatchSignals" << endl;
00212 #endif
00213
00214 data = 0;
00215 if( object )
00216 {
00217
00218 switch( sig )
00219 {
00220 case SIGHUP:
00221 break;
00222
00223 case SIGCHLD:
00224 #ifdef RIO_DEBUG2
00225 RioErr << "dispatchSignals entrei aqui!!" << endl;
00226 #endif
00227 data = waitpid( -1, NULL, WNOHANG );
00228
00229 if( data <= 0 )
00230 return;
00231 break;
00232 }
00233
00234 #ifdef RIO_DEBUG2
00235 RioErr << "\t[RioMMClient]: Dispatching Signal " << sig << endl;
00236 #endif
00237
00238 if( object->ProcessSignal( sig, (void *)data ) == 2 )
00239 {
00240 #ifdef RIO_DEBUG2
00241 RioErr << "\t[RioMMClient]: Chamando o stop() da RioMMInterface."
00242 << endl;
00243 #endif
00244
00245 QEvent *event = new QCustomEvent( (QEvent::Type)(QEvent::User + 2),
00246 NULL );
00247 QApplication::postEvent( rio, event );
00248 }
00249 }
00250
00251 #ifdef RIO_DEBUG2
00252 RioErr << "[RioMMClient]: Saindo da dispatchSignals" << endl;
00253 #endif
00254 }
00255
00256
00257
00258
00259
00260
00261
00262 static void InitCmdParams( ConfigData *config )
00263 {
00264 config->setRioMMUsePlugins( true );
00265 config->setRioMMSync( false );
00266 config->setRioMMUseCache( false );
00267 config->setRioMMTgifWindow( 0 );
00268 config->setRioMMMainWindow( 0 );
00269 config->setRioMMVideoWindow( 0 );
00270 config->setRioMMPluginPort( 0 );
00271 config->setRioMMConnectPI( false );
00272 config->setRioMMBuffers( 4 );
00273 config->setRioMMUser( "NULL" );
00274 config->setRioMMPassword( "NULL" );
00275 config->setRioMMServer( "NULL" );
00276 config->setRioMMPIHost( "NULL" );
00277 #ifdef RIO_EMUL
00278 config->setRioMMEmulator( "NULL" );
00279 config->setRioMMLogPath( "NULL" );
00280 #endif
00281 #ifdef RIO_DEBUG_FILE
00282
00283
00284
00285 config->setRioMMRioNetiLogPath( "NULL" );
00286 #endif
00287 }
00288
00289
00290
00291
00292
00293
00294
00295
00296 void *Connection( void *arg )
00297 {
00298 ConfigData *config;
00299 int rc;
00300 char *ObjName = 0, *ServerName = 0;
00301 char *ext;
00302 unsigned int BlockSize;
00303 RioBlock BufferSize;
00304 CRioStream *videoStream;
00305 int initial_block = 0;
00306 RioStreamTraffic Traffic;
00307 struct timeval RTT_average;
00308
00309 #ifndef RIO_EMUL
00310 CRioStream *slaveMediaStream;
00311 PLAYDATA *playData;
00312 QCustomEvent *event;
00313 RioStreamTraffic TrafficNRT;
00314 #endif
00315
00316
00317 double Rate = 187.5e+03;
00318
00319
00320 QCustomEvent *msg_event = new QCustomEvent( QEvent::User + 10 );
00321 QApplication::postEvent( rio, msg_event );
00322
00323 config = (ConfigData *)arg;
00324
00325 BufferSize = DEFAULTBUFFERSIZE;
00326
00327 if( ( config->getRioMMUser() == "NULL" ) ||
00328 ( config->getRioMMUser() == DEFAULTUSER )
00329 )
00330 {
00331 config->setRioMMUser( DEFAULTUSER );
00332 config->setRioMMPassword( encryptPassword( DEFAULTUSER ) );
00333 }
00334
00335 if( config->getRioMMBuffers() > 0 )
00336 BufferSize = config->getRioMMBuffers();
00337
00338 #ifdef RIO_DEBUG2
00339 RioErr << "[RioMMClient]: BufferSize = " << BufferSize << endl;
00340 #endif
00341
00342 ServerName = strdup( config->getRioMMServer() );
00343 ObjName = strchr( ServerName, ':' );
00344
00345 if( (ObjName == 0) || (strlen( ObjName + 1 ) == 0) )
00346 {
00347 sendMsg( QString( "RioMMClient" ),
00348 QString( "No object name specified" ), rio );
00349
00350
00351 QCustomEvent *finalize_event = new QCustomEvent(
00352 ( QEvent::Type )( QEvent::User + 9 ), NULL );
00353 QApplication::postEvent( rio, finalize_event );
00354
00355 free( ServerName );
00356
00357 return NULL;
00358 }
00359 *ObjName = 0;
00360 ObjName++;
00361
00362 #ifdef RIO_DEBUG2
00363 RioErr << "[RioMMClient]: Trying to connect to "
00364 << ServerName << " " << ObjName << endl;
00365 #endif
00366
00367 Session = new CRioSession;
00368 if( Session == NULL )
00369 {
00370 sendMsg( QString( "RioMMClient" ),
00371 QString( "Could not create session object" )
00372 + QString( ServerName ), rio );
00373
00374
00375 QCustomEvent *finalize_event = new QCustomEvent(
00376 ( QEvent::Type )( QEvent::User + 9 ), NULL );
00377 QApplication::postEvent( rio, finalize_event );
00378
00379 free( ServerName );
00380
00381 return NULL;
00382 }
00383
00384 #ifdef RIO_DEBUG_FILE
00385
00386
00387
00388 if( config->getRioMMRioNetiLogPath() == "NULL" )
00389 rc = Session->Connect( ServerName, config->getRioMMUser(),
00390 config->getRioMMPassword(), 1, NULL );
00391 else
00392 rc = Session->Connect( ServerName, config->getRioMMUser(),
00393 config->getRioMMPassword(), 1,
00394 config->getRioMMRioNetiLogPath() );
00395 #else
00396 rc = Session->Connect( ServerName, config->getRioMMUser(),
00397 config->getRioMMPassword(), 1 );
00398 #endif
00399 if( FAILED( rc ) && ( rc != (signed) ( ERROR_RIOSESSION + ERROR_NO_MAPPING ) ) )
00400 {
00401 if( (rc & 0xff) == (signed)ERROR_MAX_SESSIONS )
00402 sendMsg( QString( "RioMMClient" ),
00403 QString( "Max number of connections reached." ), rio );
00404 else if( (rc & 0xff) == (signed)ERROR_SOCKET_CONNECT )
00405 sendMsg( QString( "RioMMClient" ),
00406 QString( "Server not responding." ), rio );
00407 else if( (rc & 0xff) == (signed)ERROR_INVALID_USER )
00408 sendMsg( QString( "RioMMClient" ),
00409 QString( "Invalid user/password." ), rio );
00410 else
00411 sendMsg( QString( "RioMMClient" ),
00412 QString( "Could not connect to Rio Server at host " )
00413 + QString( ServerName ), rio );
00414
00415
00416 QCustomEvent *finalize_event = new QCustomEvent(
00417 ( QEvent::Type )( QEvent::User + 9 ), NULL );
00418 QApplication::postEvent( rio, finalize_event );
00419
00420 free( ServerName );
00421
00422 return NULL;
00423 } else if( (unsigned int) rc == ERROR_RIOSESSION + ERROR_NO_MAPPING )
00424 {
00425
00426
00427
00428
00429
00430
00431
00432
00433 sendMsg( QString( "RioMMClient" ),
00434 QString( "Could not use Rio Server (" ) +
00435 QString( ServerName ) +
00436 QString( ") to obtain address of the servers.\n" ) +
00437 QString( "The client will not work behind a NAT."), rio );
00438 }
00439
00440
00441
00442
00443 rioMMExplorer.setSession( Session );
00444
00445 if( config->getRioMMConnectPI() )
00446 {
00447 #ifdef RIO_DEBUG2
00448 RioErr << "[RioMMClient]: Trying to connect to pl "
00449 << config->getRioMMPIHost().ascii() << endl;
00450 #endif
00451
00452 rc = videoSession.Connect( config->getRioMMPIHost(),
00453 config->getRioMMUser(),
00454 config->getRioMMPassword(), 0 );
00455 if( FAILED(rc) )
00456 {
00457 sendMsg( QString( "RioMMClient" ),
00458 QString( "Could not connect to PI at host " )
00459 + QString( config->getRioMMPIHost() ), rio );
00460 if( (rc & 0xFF) == (signed)ERROR_MAX_SESSIONS )
00461 RioErr << "\tmax number of connections reached" << endl;
00462 else if( (rc & 0xFF) == (signed)ERROR_SOCKET_CONNECT )
00463 RioErr << "\tserver not responding" << endl;
00464 else
00465 RioErr << "\tCausa desconhecida." << endl;
00466
00467
00468 QCustomEvent *finalize_event = new QCustomEvent(
00469 ( QEvent::Type )( QEvent::User + 9 ), NULL );
00470 QApplication::postEvent( rio, finalize_event );
00471
00472 free( ServerName );
00473
00474 return NULL;
00475 }
00476 }
00477
00478 #ifdef RIO_DEBUG2
00479 RioErr << "Getting block size for data transfer..." << endl;
00480 #endif
00481
00482 rc = Session->GetBlockSize( &BlockSize );
00483 if( rc < 0 )
00484 {
00485 sendMsg( QString( "RioMMClient" ),
00486 QString( "Failed to get block size" ), rio );
00487
00488
00489 QCustomEvent *finalize_event = new QCustomEvent(
00490 ( QEvent::Type )( QEvent::User + 9 ), NULL );
00491 QApplication::postEvent( rio, finalize_event );
00492
00493 free( ServerName );
00494
00495 return NULL;
00496 }
00497
00498 #ifdef RIO_DEBUG2
00499 RioErr << "Ok (" << BlockSize << ")" << endl;
00500 #endif
00501
00502 Session->GetAverageRTT( &RTT_average );
00503
00504
00505
00506 Rate = Rate * 1.5;
00507
00508 Traffic.Type = RIO_TRAFFIC_CBR;
00509 Traffic.Direction = RioStreamDirectionRead;
00510 Traffic.LogicalBlockSize = BlockSize;
00511 Traffic.MaxRequests = 1;
00512 Traffic.TrafficVBR.Rate = Rate;
00513
00514 if( config->getRioMMConnectPI() )
00515 {
00516
00517
00518 Rate = Rate * 1.5;
00519 Traffic.TrafficVBR.Rate = Rate;
00520
00521 videoStream = new CRioStream();
00522 rc = videoStream->Open( &Traffic, &videoSession );
00523 if( rc < 0 )
00524 {
00525 sendMsg( QString( "RioMMClient" ),
00526 QString( "(1) Could not open stream" ), rio );
00527
00528
00529 QCustomEvent *finalize_event = new QCustomEvent(
00530 ( QEvent::Type )( QEvent::User + 9 ), NULL );
00531 QApplication::postEvent( rio, finalize_event );
00532
00533 free( ServerName );
00534
00535 return NULL;
00536 }
00537 }
00538 else
00539 {
00540 rc = Stream.Open( &Traffic, Session );
00541 if( rc < 0 )
00542 {
00543 sendMsg( QString( "RioMMClient" ),
00544 QString( "(2) Could not open stream" ), rio );
00545
00546
00547 QCustomEvent *finalize_event = new QCustomEvent(
00548 ( QEvent::Type )( QEvent::User + 9 ), NULL );
00549 QApplication::postEvent( rio, finalize_event );
00550
00551 free( ServerName );
00552
00553 return NULL;
00554 }
00555 videoStream = &Stream;
00556 }
00557
00558 ext = strrchr( ObjName, '.' );
00559
00560 if( ext != NULL )
00561 {
00562 if( strcmp( ext, ".mpg" ) == 0 )
00563 {
00564
00565 #ifdef USE_GRID
00566
00567
00568
00569 showMessageBox( QString( "RioMMClient" ),
00570 QString( "Copying object (" ) +
00571 QString( ObjName ) +
00572 QString( "). Please wait!" ), rio );
00573 #endif
00574
00575 object = CreateVideoObj( ObjName, BlockSize, BufferSize,
00576 videoStream, RTT_average,
00577 rio, &Stream, config,
00578 initial_block );
00579
00580 #ifdef USE_GRID
00581
00582
00583 hideMessageBox( rio );
00584 #endif
00585
00586 }
00587 #ifndef RIO_EMUL
00588 else
00589 {
00590 if( strcmp( ext, ".mp3" ) == 0 )
00591 {
00592 object = CreateMusicObj( ObjName, BlockSize, BufferSize,
00593 &Stream, RTT_average, rio );
00594 }
00595 else
00596 {
00597 #ifdef USE_GRID
00598
00599
00600 sendMsg( QString( "RioMMClient" ),
00601 QString( "Cannot PLAY/FIND multimedia object (" ) +
00602 QString( ObjName ) +
00603 QString( ") in storage or " ) +
00604 QString( "insufficient space avaliable in RIOServer." ),
00605 rio );
00606 #else
00607 sendMsg( QString( "RioMMClient" ),
00608 QString( "Cannot PLAY/FIND multimedia object (" ) +
00609 QString( ObjName ) +
00610 QString( ") in storage." ), rio );
00611 #endif
00612
00613
00614 QCustomEvent *finalize_event = new QCustomEvent(
00615 ( QEvent::Type )( QEvent::User + 9 ), NULL );
00616 QApplication::postEvent( rio, finalize_event );
00617
00618 free( ServerName );
00619
00620 return NULL;
00621 }
00622 }
00623 #endif
00624 }
00625
00626 if( object == NULL )
00627 {
00628 #ifdef USE_GRID
00629
00630
00631 sendMsg( QString( "RioMMClient" ),
00632 QString( "Cannot FIND multimedia object (" ) +
00633 QString( ObjName ) +
00634 QString( ") in storage or " ) +
00635 QString( "insufficient space avaliable in RIOServer." ),
00636 rio );
00637 #else
00638 sendMsg( QString( "RioMMClient" ),
00639 QString( "Cannot FIND multimedia object (" ) +
00640 QString( ObjName ) +
00641 QString( ") in storage." ), rio );
00642 #endif
00643
00644
00645 QCustomEvent *finalize_event = new QCustomEvent(
00646 ( QEvent::Type )( QEvent::User + 9 ), NULL );
00647 QApplication::postEvent( rio, finalize_event );
00648
00649 free( ServerName );
00650
00651 return NULL;
00652 }
00653
00654 #ifndef RIO_EMUL
00655 browser = NULL;
00656 if( config->getRioMMUsePlugins() )
00657 {
00658 slaveMediaStream = new CRioStream;
00659
00660 TrafficNRT.Type = RIO_TRAFFIC_NRT;
00661 TrafficNRT.Direction = RioStreamDirectionRead;
00662 TrafficNRT.LogicalBlockSize = BlockSize;
00663 TrafficNRT.MaxRequests = 20;
00664 TrafficNRT.TrafficNRT.Reserved = 0;
00665
00666 rc = slaveMediaStream->Open( &TrafficNRT, Session );
00667 if( rc < 0 )
00668 {
00669 sendMsg( QString( "RioMMClient" ),
00670 QString( "Could not open slave media stream" ), rio );
00671
00672
00673 QCustomEvent *finalize_event = new QCustomEvent(
00674 ( QEvent::Type )( QEvent::User + 9 ), NULL );
00675 QApplication::postEvent( rio, finalize_event );
00676
00677 free( ServerName );
00678
00679 return NULL;
00680 }
00681 CheckForSlaves( object, BlockSize, BufferSize, slaveMediaStream,
00682 RTT_average, config->getRioMMTgifWindow(),
00683 config->getRioMMPluginPort() );
00684 slaveMediaStream->Close();
00685
00686 }
00687
00688 unsigned nMedias = object->GetNMedias();
00689 for( unsigned int i = 0; i < nMedias; i++ )
00690 {
00691 object->GetMedia( i )->init();
00692 }
00693
00694
00695 signal( SIGHUP, dispatchSignals );
00696
00697
00698
00699 playData = new PLAYDATA;
00700 playData->id = 0;
00701 playData->object = object;
00702 playData->size = object->GetTotalPositions();
00703 playData->msg = NULL;
00704
00705 event = new QCustomEvent( (QEvent::Type)(QEvent::User + 1), playData );
00706 QApplication::postEvent( rio, event );
00707
00708
00709 if( config->getRioMMConnectPI() )
00710 {
00711 QCustomEvent *event2 = new QCustomEvent( QEvent::User + 4 );
00712 QApplication::postEvent( rio, event2 );
00713 }
00714 #endif
00715
00716 if( config->getRioMMAutoPlay() )
00717 {
00718 QCustomEvent *event2 = new QCustomEvent( QEvent::User + 4 );
00719 QApplication::postEvent( rio, event2 );
00720 }
00721
00722 QCustomEvent *msg_event2 = new QCustomEvent( QEvent::User + 11 );
00723 QApplication::postEvent( rio, msg_event2 );
00724
00725 free( ServerName );
00726
00727 return( arg );
00728 }
00729
00730
00731
00732
00733 void show_stackframe()
00734 {
00735 void *trace[16];
00736 char **messages = (char **)NULL;
00737 int i;
00738 int trace_size = 0;
00739
00740 trace_size = backtrace( trace, 16 );
00741 messages = backtrace_symbols( trace, trace_size );
00742 RioErr << "[bt] Execution path:" << endl;
00743 for( i = 0; i < trace_size; ++i )
00744 RioErr << "[bt(" << i << "/" << trace_size << ")] " << messages[i]
00745 << endl;
00746 }
00747
00748 void segfaultHandler( int sig )
00749 {
00750 RioErr << "[RioMMClient] SEGMENTATION FAULT(" << sig << ")!" << endl;
00751 show_stackframe();
00752
00753 _exit( 1 );
00754 }
00755
00756 int main( int argc, char *argv[] )
00757 {
00758 int optch;
00759 int ind = -1;
00760 int null;
00761 ConfigData config;
00762
00763
00764 bool finalize;
00765
00766 signal( SIGTERM, signalHandler );
00767 signal( SIGINT, signalHandler );
00768 signal( SIGSEGV, segfaultHandler );
00769 signal( SIGABRT, segfaultHandler );
00770 signal( SIGCHLD, dispatchSignals );
00771
00772 #ifndef RIO_EMUL
00773 QCustomEvent *event;
00774 #else
00775 double wait_time = 0;
00776 int fim = 0;
00777 RioMMEmul *emul;
00778 #endif
00779
00780 #ifdef RIO_DEBUG2
00781 RioErr << "RioMMClient disparado com PID " << getpid() << endl;
00782 #endif
00783
00784 QDesktopWidget *screen = NULL;
00785
00786 #ifdef RIO_EMUL
00787 static char opts_short[] ="ab:c:d:e:l:hi:m:n:p:st:u:Vv:";
00788 #else
00789 #ifdef RIO_DEBUG_FILE
00790 static char opts_short[] ="ab:c:d:hi:m:n:p:st:u:Vv:";
00791 #else
00792 static char opts_short[] ="ab:c:hi:m:n:p:st:u:Vv:";
00793 #endif
00794 #endif
00795 static struct option opts_int[] =
00796 {
00797 {"autoplay" ,0,0,'a'},
00798 {"buffers" ,1,0,'b'},
00799
00800 #ifdef RIO_DEBUG_FILE
00801 {"rnlogpath" ,1,0,'d'},
00802 #endif
00803 #ifdef RIO_EMUL
00804 {"emulator" ,1,0,'e'},
00805 {"logPath" ,1,0,'l'},
00806 #endif
00807 {"help" ,0,0,'h'},
00808 {"pluginport" ,1,0,'i'},
00809 {"mainwindow" ,1,0,'m'},
00810 {"usecache" ,1,0,'c'},
00811 {"useplugins" ,1,0,'n'},
00812 {"patch" ,1,0,'p'},
00813 {"sync" ,1,0,'s'},
00814 {"tgifWindow" ,1,0,'t'},
00815 {"username" ,1,0,'u'},
00816 {"vid" ,1,0,'v'},
00817 {"version" ,0,0,'V'},
00818 {0 ,0,0,0 }
00819 };
00820
00821 object = NULL;
00822
00823 InitCmdParams( &config );
00824
00825 readSettings( &config );
00826
00827 #ifndef RIO_EMUL
00828
00829
00830 QApplication app( argc, argv );
00831 #endif
00832
00833 ind = 0;
00834 while( (optch = getopt_long( argc, argv, opts_short, opts_int, &ind ) )
00835 != -1 )
00836 {
00837 switch( optch )
00838 {
00839 case 0:
00840 break;
00841
00842 #ifndef RIO_EMUL
00843 case 'u':
00844 config.setRioMMUser( QString( optarg ) );
00845 break;
00846 #endif
00847
00848 case 'a':
00849 config.setRioMMAutoPlay( true );
00850 break;
00851
00852 case 'b':
00853 if( atoi( optarg ) > 0 )
00854 config.setRioMMBuffers( atoi( optarg ) );
00855
00856 break;
00857
00858 case 'n':
00859 if( atoi( optarg ) == 1 )
00860 config.setRioMMUsePlugins( true );
00861 else
00862 config.setRioMMUsePlugins( false );
00863 break;
00864
00865 case 's':
00866 if( atoi( optarg ) == 1 )
00867 config.setRioMMSync( true );
00868 else
00869 config.setRioMMSync( false );
00870 break;
00871
00872 case 'p':
00873 config.setRioMMConnectPI( true );
00874 config.setRioMMPIHost( QString( optarg ) );
00875 break;
00876
00877 case 'c':
00878 if( atoi( optarg ) == 1 )
00879 config.setRioMMUseCache( true );
00880 else
00881 config.setRioMMUseCache( false );
00882 break;
00883
00884 #ifdef RIO_EMUL
00885 case 'e':
00886
00887 config.setRioMMEmulator( QString( optarg ) );
00888 break;
00889
00890 case 'l':
00891
00892 config.setRioMMLogPath( QString( optarg ) );
00893 break;
00894 #endif
00895
00896 case 'v':
00897 config.setRioMMVideoWindow( atoi( optarg ) );
00898 break;
00899
00900 case 'm':
00901 config.setRioMMMainWindow( atoi( optarg ) );
00902 break;
00903
00904 case 't':
00905 config.setRioMMTgifWindow( atoi( optarg ) );
00906 break;
00907
00908 case 'i':
00909 config.setRioMMPluginPort( atoi( optarg ) );
00910 null = open( "/dev/null", O_WRONLY );
00911 dup2( null, 1 );
00912 dup2( null, 2 );
00913 break;
00914
00915 case 'h':
00916 Usage( argv[0] );
00917 break;
00918
00919 case 'V':
00920 cout << "riommclient version: " << VERSION << endl;
00921 exit( 0 );
00922 break;
00923
00924 #ifdef RIO_DEBUG_FILE
00925
00926
00927 case 'd':
00928 config.setRioMMRioNetiLogPath( QString( optarg ) );
00929 break;
00930 #endif
00931
00932 default:
00933 cout << "Op��o \'-" << optch << "\' desconhecida!" << endl;
00934 Usage( argv[0] );
00935 }
00936 ind = -1;
00937 }
00938
00939 if( ( config.getRioMMServer() == "NULL" ) && ( argc - optind == 1 ) )
00940 config.setRioMMServer( argv[ optind ] );
00941 else
00942 Usage( argv[0] );
00943
00944 #ifndef RIO_EMUL
00945
00946 screen = new QDesktopWidget();
00947 screenWidth = screen->screenGeometry().width();
00948 screenHeight = screen->screenGeometry().height();
00949
00950 rio = new RioMMInterface( &config );
00951 app.setMainWidget( rio );
00952
00953 if( config.getRioMMMainWindow() != 0 )
00954 XReparentWindow( qt_xdisplay(), rio->winId(),
00955 (Window)config.getRioMMMainWindow(), 0, 0 );
00956
00957 rio->show();
00958
00959
00960
00961 event = new QCustomEvent( (QEvent::Type)(QEvent::User + 5),
00962 (void*)Connection );
00963 QApplication::postEvent( rio, event );
00964
00965 finalize = ( app.exec() == 0 );
00966
00967 #ifdef RIO_DEBUG2
00968 RioErr << "main depois do app.exec, finalize = " << finalize << endl;
00969 #endif
00970
00971 #else
00972
00973 if( ( config.getRioMMEmulator() == "NULL" ) ||
00974 ( config.getRioMMLogPath() == "NULL" ) )
00975 {
00976 cout << "Para o emulador as op��es -e -l s�o obrigat�rias." << endl;
00977 Usage( argv[0] );
00978 }
00979
00980 char *pathCheck = strdup( config.getRioMMLogPath() );
00981 char *barPos = strrchr( pathCheck, '/' );
00982 if( barPos != NULL )
00983 *barPos = '\0';
00984
00985 if( !QDir( pathCheck ).exists() )
00986 {
00987 RioErr << "\nError: Path " << pathCheck << "does not exist.\n"
00988 << "Exiting riommclient." << endl;
00989 exit( -1 );
00990 }
00991
00992 free( pathCheck );
00993
00994
00995
00996 if( Connection( (void *)&config ) != NULL )
00997 {
00998 if( config.getRioMMEmulator() != "NULL" )
00999 {
01000 emul = new RioMMEmul( config.getRioMMEmulator(), object );
01001 while( !fim )
01002 {
01003 if( wait_time == -1 || object->GetFinalizeEmul() )
01004 {
01005 RioErr << "RioMMClient - Finalizando emulador. "
01006 << "wait_time = " << wait_time
01007 << ", finalize_emul = "
01008 << object->GetFinalizeEmul() << endl;
01009
01010 fim = 1;
01011 config.setRioMMEmulator( "NULL" );
01012 wait_time = -1;
01013 break;
01014 }
01015
01016 do
01017 {
01018 wait_time = emul->run();
01019 }
01020 while( wait_time == 0 );
01021
01022 RioErr << "RioMMClient - testando wait_time: " << wait_time
01023 << endl;
01024
01025 if( wait_time > 0 )
01026
01027
01028
01029
01030 usleep( (int)(wait_time*1000000) );
01031 }
01032 delete emul;
01033 }
01034 finalize = true;
01035 }
01036 else
01037 {
01038 RioErr << "IMPOSSIVEL CONECTAR AO SERVIDOR. ABORTANDO CLIENTE!"
01039 << endl;
01040 finalize = false;
01041 }
01042
01043 #ifdef RIO_DEBUG2
01044 RioErr << "main depois de executar a emulacao, finalize = " << finalize
01045 << endl;
01046 #endif
01047
01048 #endif
01049
01050 #ifdef RIO_DEBUG_EMUL
01051 RioErr << "RioMMClient - TERMINO DA EMULACAO!" << endl;
01052 RioErr << "RioMMClient - Deletando objeto " << endl;
01053 #endif
01054
01055
01056 if( screen )
01057 delete screen;
01058
01059 if( finalize )
01060 {
01061 if( object )
01062 {
01063 delete object;
01064 object = NULL;
01065 }
01066
01067 Stream.Close();
01068
01069 #ifdef RIO_DEBUG2
01070 RioErr << "Stream fechada" << endl;
01071 #endif
01072
01073 Session->Disconnect();
01074
01075 #ifdef RIO_DEBUG2
01076 RioErr << "Desconectado" << endl;
01077 #endif
01078 }
01079
01080 return( 0 );
01081 }
01082
01083
01084
01085
01086
01087
01088
01089 CRioMMObject *CreateVideoObj( char *VideoName, int BlockSize,
01090 RioBlock BuffSize, CRioStream *Stream,
01091 struct timeval RTT_average, RioMMInterface *rio,
01092 CRioStream *ServerStream, ConfigData *config,
01093 int block )
01094 {
01095 CRioMMVideo *Video;
01096 RioAccess Access;
01097 int rc;
01098
01099 Video = new CRioMMVideo( VideoName, BlockSize, BuffSize, RTT_average,
01100 rio, block, config, &rioMMExplorer );
01101 Access = RIO_READ_ACCESS | RIO_SHARE_READ;
01102
01103 #if defined(USE_GRID) && defined(RIO_EMUL)
01104
01105
01106
01107
01108 struct timeval StartVideoOpen;
01109 struct timeval EndVideoOpen;
01110 gettimeofday( &StartVideoOpen, NULL );
01111 #endif
01112
01113 rc = Video->Open( Access, Stream );
01114
01115 #if defined(USE_GRID) && defined(RIO_EMUL)
01116
01117
01118
01119
01120 gettimeofday( &EndVideoOpen, NULL );
01121
01122
01123 QString logEmulatorPath;
01124 ofstream logOpenTime;
01125 logEmulatorPath = config->getRioMMLogPath();
01126 logEmulatorPath += QString( "/log_opentime.log" );
01127 logOpenTime.open( logEmulatorPath.latin1() );
01128 double InicioOpen;
01129 double FimOpen;
01130 InicioOpen = (double)StartVideoOpen.tv_sec +
01131 ((double)StartVideoOpen.tv_usec) / 1000000.0;
01132 FimOpen = (double)EndVideoOpen.tv_sec +
01133 ((double)EndVideoOpen.tv_usec) / 1000000.0;
01134 logOpenTime << "Time to open file " << VideoName << " "
01135 << FimOpen - InicioOpen << " seconds." << endl;
01136 #endif
01137
01138 if( rc < 0 )
01139 {
01140
01141 #ifdef RIO_DEBUG2
01142 RioErr << "Could not open object " << VideoName << endl;
01143 #endif
01144
01145 delete Video;
01146 Video = NULL;
01147 }
01148 else
01149 {
01150
01151 #ifndef RIO_EMUL
01152 Video->GetSubTitles( Access, ServerStream );
01153 #endif
01154
01155 Video->SetWID( config->getRioMMVideoWindow() );
01156 Video->init();
01157
01158 if( Video->getmakeLog() )
01159 makeLogHeader( Video, config, VideoName );
01160 }
01161
01162 return( (CRioMMObject *)Video );
01163 }
01164
01165 void makeLogHeader( CRioMMVideo *Video, ConfigData *config,
01166 char *VideoName )
01167 {
01168
01169 QString tmpFileName;
01170 struct passwd *user;
01171 unsigned int block_size;
01172 in_addr host;
01173 char data[256];
01174 FILE *conf_file;
01175 ObjectInfo objectInfo;
01176
01177
01178 Video->inputLog( QString("RioMMClient version: %1\n").arg( VERSION ) );
01179
01180
01181 if( ( user = getpwuid( geteuid() ) ) == NULL )
01182 Video->inputLog( QString("User login: unknown\n" ) );
01183 else
01184 Video->inputLog( QString("User login: %1\n").arg( user->pw_name ) );
01185
01186
01187 host.s_addr = Session->getipaddr();
01188 Video->inputLog( QString( "Client IP Adrress: %1\n" ).arg(
01189 inet_ntoa( host ) ) );
01190
01191
01192 Video->inputLog( QString("Object path: %1\n").arg( VideoName ) );
01193
01194
01195 if( !FAILED( Session->GetObjectInfo( VideoName, &objectInfo ) ) )
01196 {
01197 #ifdef USE_QT_GRID
01198
01199 Video->inputLog( QString().sprintf( "Object size: %lli\n",
01200 objectInfo.getSize() ) );
01201 #else
01202 Video->inputLog( QString( "Object size: %1\n" ).arg(
01203 objectInfo.getSize() ) );
01204 #endif
01205 Video->inputLog( QString( "Object time: %1/%2/%3 %4:%5\n" )
01206 .arg( objectInfo.getTime().Day )
01207 .arg( objectInfo.getTime().Month )
01208 .arg( objectInfo.getTime().Year )
01209 .arg( objectInfo.getTime().Hour )
01210 .arg( objectInfo.getTime().Minute )
01211 );
01212 }
01213 else
01214 {
01215 Video->inputLog( "Impossible to get object size.\n" );
01216 Video->inputLog( "Impossible to get object time.\n" );
01217 }
01218
01219
01220 Session->GetBlockSize( &block_size );
01221 Video->inputLog( QString( "Block size: %1\n" ).arg( block_size ) );
01222
01223
01224 Video->inputLog( "\n------------------Command Options-----------------\n" );
01225 Video->inputLog( "Command options: \n" );
01226 Video->inputLog( QString( "User : %1\n" ).arg( config->getRioMMUser() ) );
01227
01228 Video->inputLog( QString( "nbuffers : %1\n" ).arg(
01229 config->getRioMMBuffers() ) );
01230
01231 if( config->getRioMMUsePlugins() )
01232 Video->inputLog( "usePlugins: true\n" );
01233 else
01234 Video->inputLog( "usePlugins: false\n" );
01235
01236 if( config->getRioMMSync() )
01237 Video->inputLog( "sync : true\n" );
01238 else
01239 Video->inputLog( "sync : false\n" );
01240
01241 if( config->getRioMMConnectPI() )
01242 Video->inputLog( "connectPI : true\n" );
01243 else
01244 Video->inputLog( "connectPI : false\n" );
01245
01246 if( config->getRioMMUseCache() )
01247 Video->inputLog( "useCache : true\n" );
01248 else
01249 Video->inputLog( "useCache : false\n" );
01250
01251 #ifdef RIO_EMUL
01252 Video->inputLog( QString( "emulator : %1\n" ).arg(
01253 config->getRioMMEmulator() ) );
01254 Video->inputLog( QString( "logPath : %1\n" ).arg( config->getRioMMLogPath() ) );
01255 #endif
01256
01257 Video->inputLog( QString( "vId : %1\n" ).arg( config->getRioMMVideoWindow() ) );
01258 Video->inputLog( QString( "mId : %1\n" ).arg( config->getRioMMMainWindow() ) );
01259 Video->inputLog( QString( "tId : %1\n" ).arg( config->getRioMMTgifWindow() ) );
01260 Video->inputLog( QString( "pluginPort: %1\n\n" ).arg(
01261 config->getRioMMPluginPort() ) );
01262
01263
01264 Video->inputLog( "\n--------------------Config file-------------------\n" );
01265 tmpFileName = QString( "%1/.qt/riorc" ).arg( getenv( "HOME" ) );
01266
01267 if( ( conf_file = fopen( tmpFileName.ascii(), "r" ) ) != NULL )
01268 {
01269 while( feof( conf_file ) == 0 )
01270 {
01271 if( ( fgets( data, 256, conf_file ) == NULL ) && ( errno != 0 ) )
01272 {
01273 RioErr << "makeLogHeader erro " << errno << " ("
01274 << strerror( errno ) << ") ao obter dados do arquivo "
01275 << tmpFileName.ascii() << endl;
01276 }
01277 Video->inputLog( data );
01278 }
01279 fclose( conf_file );
01280 }
01281 else
01282 {
01283 Video->inputLog( QString( "Impossible to read the riorc file at %1\n" )
01284 .arg( tmpFileName ) );
01285 }
01286
01287
01288 Video->inputLog( "------------------Actions log--------------------\n" );
01289 }
01290
01291 #ifndef RIO_EMUL
01292
01293
01294
01295
01296
01297
01298 CRioMMObject *CreateMusicObj( char *MusicName, int BlockSize,
01299 RioBlock BuffSize, CRioStream *Stream,
01300 struct timeval RTT_average, RioMMInterface *rio )
01301 {
01302 CRioMMMp3 *Music;
01303 RioAccess Access;
01304 int rc;
01305
01306 Music = new CRioMMMp3( MusicName, BlockSize, BuffSize, RTT_average, rio );
01307
01308 Access = RIO_READ_ACCESS | RIO_SHARE_READ;
01309 rc = Music->Open( Access, Stream );
01310 if( rc < 0 )
01311 {
01312 delete Music;
01313 Music = NULL;
01314 }
01315
01316 return( (CRioMMObject *)Music );
01317 }
01318
01319
01320
01321
01322
01323
01324
01325 long long int CreateTopicsObj( char *TopicsName, int BlockSize, RioBlock BuffSize,
01326 CRioStream *Stream, struct timeval RTT_average,
01327 CRioMMVideo *video )
01328 {
01329 CRioMMTopics *Topics;
01330 RioAccess Access;
01331
01332 Topics = new CRioMMTopics( TopicsName, BlockSize, BuffSize, RTT_average,
01333 rio );
01334
01335 Access = RIO_READ_ACCESS | RIO_SHARE_READ;
01336 if( Topics->GetTopics( Access, Stream ) <= 0 )
01337 {
01338 #ifdef RIO_DEBUG2
01339 RioErr << "[RioMMClient]: Could not get topics " << endl;
01340 #endif
01341
01342 video->appendLog( "Index status: failed\n" );
01343 delete Topics;
01344 Topics = NULL;
01345 }
01346 else
01347 {
01348 video->appendLog( "Index status: success\n" );
01349 }
01350
01351 return( (long long int) Topics );
01352 }
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372 long long int CreateKeywordsObj( char *KeywordsName, int BlockSize, RioBlock BuffSize,
01373 CRioStream *Stream, struct timeval RTT_average,
01374 CRioMMVideo *video )
01375 {
01376 CRioMMKeywords *Keywords;
01377 RioAccess Access;
01378
01379 Keywords = new CRioMMKeywords( KeywordsName, BlockSize, BuffSize,
01380 RTT_average, rio );
01381
01382 Access = RIO_READ_ACCESS | RIO_SHARE_READ;
01383 if( Keywords->GetKeywords( Access, Stream ) <= 0 )
01384 {
01385 #ifdef RIO_DEBUG2
01386 RioErr << "[RioMMClient]: Could not get keywords " << endl;
01387 #endif
01388
01389 video->appendLog( "Keywords status: failed\n" );
01390 delete Keywords;
01391 Keywords = NULL;
01392 }
01393 else
01394 {
01395 video->appendLog( "Keywords status: success\n" );
01396 }
01397
01398 return( (long long int) Keywords );
01399 }
01400
01401
01402
01403
01404
01405
01406
01407 CRioMMObject *CreateBrowserObj( char *BrowserName, int BlockSize,
01408 RioBlock BuffSize, CRioStream *Stream,
01409 struct timeval RTT_average, int port )
01410 {
01411 CRioMMBrowser *Browser;
01412 RioAccess Access;
01413
01414 Browser = new CRioMMBrowser( BrowserName, BlockSize, BuffSize, RTT_average);
01415
01416 Access = RIO_READ_ACCESS | RIO_SHARE_READ;
01417 if( Browser->GetCommands( Access, Stream ) < 0 )
01418 {
01419 delete Browser;
01420 return( NULL );
01421 }
01422
01423 if( Browser->GetSlides( Access, Stream ) < 0 )
01424 {
01425 #ifdef RIO_DEBUG2
01426 RioErr << "[RioMMClient]: Could not get slides" << endl;
01427 #endif
01428
01429 delete Browser;
01430 return( NULL );
01431 }
01432
01433 return( (CRioMMObject *)Browser );
01434 }
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444 CRioMMObject *CreateEmbedObj( char *NetscName, int BlockSize,
01445 RioBlock BuffSize, CRioStream *Stream,
01446 struct timeval RTT_average, int port )
01447 {
01448 CRioMMEmbed *Embed;
01449 RioAccess Access;
01450
01451 Embed = new CRioMMEmbed( NetscName, BlockSize, BuffSize, RTT_average );
01452
01453 Access = RIO_READ_ACCESS | RIO_SHARE_READ;
01454 if( Embed->GetCommands( Access, Stream ) < 0 )
01455 {
01456 delete Embed;
01457 return( NULL );
01458 }
01459
01460 if( Embed->GetSlides( Access, Stream ) < 0 )
01461 {
01462 #ifdef RIO_DEBUG2
01463 RioErr << "Could not get slides" << endl;
01464 #endif
01465
01466 delete Embed;
01467 return( NULL );
01468 }
01469 Embed->setPort( port );
01470
01471 browser = Embed;
01472 return( (CRioMMObject *)Embed );
01473 }
01474
01475
01476
01477
01478
01479
01480
01481 CRioMMObject *CreateTgifObj( char *TgifName, int BlockSize, RioBlock BuffSize,
01482 CRioStream *Stream, struct timeval RTT_average,
01483 int tgifWindow )
01484 {
01485 CRioMMTgif *Tgif;
01486 RioAccess Access;
01487
01488 Tgif = new CRioMMTgif( TgifName, BlockSize, BuffSize, RTT_average,
01489 screenWidth, screenHeight );
01490
01491 Access = RIO_READ_ACCESS | RIO_SHARE_READ;
01492
01493 if( Tgif->GetCommands( Access, Stream ) < 0 )
01494 {
01495 delete Tgif;
01496 return( NULL );
01497 }
01498
01499 if( Tgif->GetSlides( Access, Stream ) < 0 )
01500 {
01501 #ifdef RIO_DEBUG2
01502 RioErr << "[RioMMClient]: Could not get slides" << endl;
01503 #endif
01504
01505 delete Tgif;
01506 return( NULL );
01507 }
01508
01509 Tgif->setParent( tgifWindow );
01510
01511 return( (CRioMMObject *)Tgif );
01512 }
01513
01514
01515
01516
01517
01518
01519
01520
01521 int CheckForSlaves( CRioMMObject *obj, int blksize, RioBlock buffsize,
01522 CRioStream *stream, struct timeval RTT_average,
01523 int tgifWindow, int browserPort )
01524 {
01525 char *ptr;
01526 int qtdSlaves;
01527 char basename[ 128 ],
01528 objecttype[ 128 ];
01529 CRioMMObject *slave[ 10 ];
01530
01531
01532 qtdSlaves = 0;
01533
01534 strcpy( basename, obj->GetName() );
01535
01536 ptr = strrchr( basename, '.' );
01537 if( ptr == NULL )
01538 return 0;
01539
01540 strcpy( objecttype, ptr );
01541
01542
01543 strcpy( ptr, ".browser" );
01544 if( browserPort != 0 )
01545 slave[ qtdSlaves ] = CreateEmbedObj( basename, blksize, buffsize,
01546 stream, RTT_average, browserPort );
01547 else
01548 slave[ qtdSlaves ] = CreateBrowserObj( basename, blksize, buffsize,
01549 stream, RTT_average, browserPort );
01550 if( slave[ qtdSlaves ] )
01551 qtdSlaves++;
01552
01553
01554 strcpy( ptr, ".tgif" );
01555 slave[ qtdSlaves ] = CreateTgifObj( basename, blksize, buffsize, stream,
01556 RTT_average, tgifWindow );
01557
01558 if( slave[ qtdSlaves ] )
01559 qtdSlaves++;
01560
01561
01562 strcpy( ptr, ".index" );
01563
01564 if( CreateTopicsObj( basename, blksize, buffsize, stream, RTT_average,
01565 (CRioMMVideo*)obj ) )
01566 {
01567
01568
01569
01570 strcpy( ptr, ".keyword" );
01571 CreateKeywordsObj( basename, blksize, buffsize, stream, RTT_average,
01572 (CRioMMVideo*)obj );
01573 }
01574
01575 if( qtdSlaves )
01576 {
01577 obj->AllocMedia( qtdSlaves );
01578 for( int i = 0; i < qtdSlaves; i++ )
01579 obj->AddMedia( slave[ i ] );
01580 }
01581
01582 return( qtdSlaves );
01583 }
01584 #endif
01585
01586
01587
01588
01589
01590
01591 bool readSettings( ConfigData *config )
01592 {
01593 return( config->readRioMMClientSettings() );
01594 }
01595
01596 void printOptions( ConfigData *config )
01597 {
01598 cout << "Printing riommclient options values" << endl;
01599 cout << " usePlugins " << config->getRioMMUsePlugins() << endl;
01600 cout << " sync " << config->getRioMMSync() << endl;
01601 cout << " useCache " << config->getRioMMUseCache() << endl;
01602 cout << " tId " << config->getRioMMTgifWindow() << endl;
01603 cout << " mId " << config->getRioMMMainWindow() << endl;
01604 cout << " vId " << config->getRioMMVideoWindow() << endl;
01605 cout << " pluginPort " << config->getRioMMPluginPort() << endl;
01606 cout << " connectPI " << config->getRioMMConnectPI() << endl;
01607 cout << " User " << config->getRioMMUser().latin1() << endl;
01608 cout << " Server " << config->getRioMMServer().latin1() << endl;
01609 cout << " Password " << config->getRioMMPassword().latin1() << endl;
01610 cout << " piHost " << config->getRioMMPIHost().latin1() << endl;
01611 cout << " nbuffers " << config->getRioMMBuffers() << endl;
01612
01613 #ifdef RIO_EMUL
01614 cout << " emulator " << config->getRioMMEmulator().latin1() << endl;
01615 cout << " logPath " << config->getRioMMLogPath().latin1() << endl;
01616 #endif
01617 }