#include <iostream>
#include <qapplication.h>
#include <qthread.h>
#include <qdom.h>
#include <qdir.h>
#include <qsettings.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <pthread.h>
#include <wait.h>
#include <netdb.h>
#include <pwd.h>
#include <execinfo.h>
#include <errno.h>
#include "RioMMInterface.h"
#include "RioInterface.h"
#include "RioError.h"
#include "RioFile.h"
#include "RioMMObject.h"
#include "common.h"
#include "RioMMVideo.h"
#include "RioMMMp3.h"
#include "RioMMEmbed.h"
#include "RioMMBrowser.h"
#include "RioMMSlideShow.h"
#include "RioMMTgif.h"
#include "RioMMTopics.h"
#include "RioMMExplorer.h"
#include "RioMMKeywords.h"
Go to the source code of this file.
Functions | |
void | makeLogHeader (CRioMMVideo *, ConfigData *, char *) |
CRioMMObject * | CreateVideoObj (char *, int, RioBlock, CRioStream *, struct timeval RTT_average, RioMMInterface *, CRioStream *, ConfigData *config, int block=0) |
CRioMMObject * | CreateMusicObj (char *, int, RioBlock, CRioStream *, struct timeval RTT_average, RioMMInterface *) |
long long int | CreateTopicsObj (char *, int, RioBlock, CRioStream *, struct timeval RTT_average, CRioMMVideo *) |
long long int | CreateKeywordsObj (char *, int, RioBlock, CRioStream *, struct timeval RTT_average, CRioMMVideo *) |
CRioMMObject * | CreateEmbedObj (char *, int, RioBlock, CRioStream *, struct timeval RTT_average, int port) |
CRioMMObject * | CreateBrowserObj (char *, int, RioBlock, CRioStream *, struct timeval RTT_average, int port) |
CRioMMObject * | CreateTgifObj (char *, int, RioBlock, CRioStream *, struct timeval RTT_average, int tgifWindow) |
int | CheckForSlaves (CRioMMObject *, int, RioBlock, CRioStream *, struct timeval RTT_average, int tgifWindow, int browserPort) |
bool | readSettings (ConfigData *) |
void | printOptions (ConfigData *) |
void | Usage (char *progname) |
Prints the usage. | |
void | signalHandler (int sig) |
void | dispatchSignals (int sig) |
static void | InitCmdParams (ConfigData *config) |
void * | Connection (void *arg) |
void | show_stackframe () |
Handles the SEGFAULT. | |
void | segfaultHandler (int sig) |
int | main (int argc, char *argv[]) |
Variables | |
CRioMMEmbed * | browser |
CRioSession | videoSession |
CRioSession * | Session |
CRioStream | Stream |
CRioMMObject * | object |
RioMMInterface * | rio |
RioMMExplorer | rioMMExplorer |
int | screenWidth = 0 |
int | screenHeight = 0 |
int CheckForSlaves | ( | CRioMMObject * | obj, | |
int | blksize, | |||
RioBlock | buffsize, | |||
CRioStream * | stream, | |||
struct timeval | RTT_average, | |||
int | tgifWindow, | |||
int | browserPort | |||
) |
Definition at line 1521 of file RioMMClient.cpp.
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 // Finding browser slave midia. 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 // Finding TGIF slave midia. 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 // Finding Index slave midia. 01562 strcpy( ptr, ".index" ); 01563 01564 if( CreateTopicsObj( basename, blksize, buffsize, stream, RTT_average, 01565 (CRioMMVideo*)obj ) ) 01566 { 01567 // Somente devemos disponibilizar a op��o da busca de palavras-chave 01568 // por assunto se o �ndice foi corretamente lido e criado (pois a busca 01569 // descata as entradas do �ndice). 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 }
void* Connection | ( | void * | arg | ) |
Definition at line 296 of file RioMMClient.cpp.
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 // 187,500 bytes/sec = 1,500,000 bits/sec (Default: assumes 1.5 Mbit/sec). 00317 double Rate = 187.5e+03; 00318 00319 //Enviando evento pra interface exibir uma mensagem de espera 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 // User does not supply the username, use default. 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 // finalize application 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 // finalize application 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 // Foi colocado um novo parametro que define o nome do arquivo com o log da 00386 // RioNeti sera salvo. Este valor devere ser dado caso esta opcao de 00387 // compilacao seja usada, e devera ser dado pela opcao -d. 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 // finalize application 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 // Alteracao para tratar o erro gerado quando o cliente se conecta a 00426 // um servidor que nao possui suporte para a nova chamada remota de 00427 // procedimento que retorna os pares IP, porta do Servidor RIO e dos 00428 // Storage Servers, e que permite que o cliente funcione atras de NAT. 00429 // Neste caso, ainda poderemos nos conectar ao servidor, mas o acesso 00430 // nao funcionara se o cliente estiver atras de NAT. Entao, vamos 00431 // simplesmente mostrar uma mensagem ao cliente informando o erro e 00432 // permitir que a conexao seja feita. 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 // Este objeto explorer � utilizado para fazer o upload do log de 00441 // comportamento do usu�rio. Pode tamb�m ser usado para acessar qualquer 00442 // m�todo da RioExplorer. 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 // finalize application 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 // finalize application 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 // Reserve extra rate to absorb fluctuations on stream rate. 00505 // Guessing 50% extra should be enough. 00506 Rate = Rate * 1.5; 00507 00508 Traffic.Type = RIO_TRAFFIC_CBR; 00509 Traffic.Direction = RioStreamDirectionRead; 00510 Traffic.LogicalBlockSize = BlockSize; 00511 Traffic.MaxRequests = 1; // Ignored in new version of RIO. 00512 Traffic.TrafficVBR.Rate = Rate; 00513 00514 if( config->getRioMMConnectPI() ) 00515 { 00516 //Como um lider forcado requisita para si e para o grupo ao mesmo tempo 00517 //(2 fluxos), "dobramos" aqui a taxa requisitada para o servidor. 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 // finalize application 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 // finalize application 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 // Cria uma caixa de mensagem para informar ao usu�rio que o acesso 00567 // ao v�deo pode ser demorado (somente para o servidor executando 00568 // na GRID). 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 // Depois de o arquivo ser baixado, fecha a caixa de mensagem. 00582 // (somente para o servidor executando na GRID). 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 // Muda a mensagem padr�o que informa que o arquivo n�o foi 00599 // encontrado, ao conectar a um servidor executando na GRID. 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 // finalize application 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 // Muda a mensagem padr�o que informa que o arquivo n�o foi encontrado, 00630 // ao conectar a um servidor executando na GRID. 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 // finalize application 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 // finalize application 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 // Allow medias to reinitialize themselfes upon a SIGHUP. 00695 signal( SIGHUP, dispatchSignals ); 00696 00697 // Send completion event to the interface. This event enables the 00698 // play button on the interface and sets the object to be shown. 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 // Evento User + 4 dispara o play no cliente. 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 //Enviando evento pra interface ocultar a mensagem de espera 00722 QCustomEvent *msg_event2 = new QCustomEvent( QEvent::User + 11 ); 00723 QApplication::postEvent( rio, msg_event2 ); 00724 00725 free( ServerName ); 00726 00727 return( arg ); 00728 }
CRioMMObject * CreateBrowserObj | ( | char * | BrowserName, | |
int | BlockSize, | |||
RioBlock | BuffSize, | |||
CRioStream * | Stream, | |||
struct timeval | RTT_average, | |||
int | port | |||
) |
Definition at line 1407 of file RioMMClient.cpp.
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 }
CRioMMObject * CreateEmbedObj | ( | char * | NetscName, | |
int | BlockSize, | |||
RioBlock | BuffSize, | |||
CRioStream * | Stream, | |||
struct timeval | RTT_average, | |||
int | port | |||
) |
Definition at line 1444 of file RioMMClient.cpp.
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 }
long long int CreateKeywordsObj | ( | char * | KeywordsName, | |
int | BlockSize, | |||
RioBlock | BuffSize, | |||
CRioStream * | Stream, | |||
struct timeval | RTT_average, | |||
CRioMMVideo * | video | |||
) |
Definition at line 1372 of file RioMMClient.cpp.
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 }
CRioMMObject * CreateMusicObj | ( | char * | MusicName, | |
int | BlockSize, | |||
RioBlock | BuffSize, | |||
CRioStream * | Stream, | |||
struct timeval | RTT_average, | |||
RioMMInterface * | rio | |||
) |
Definition at line 1298 of file RioMMClient.cpp.
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 }
CRioMMObject * CreateTgifObj | ( | char * | TgifName, | |
int | BlockSize, | |||
RioBlock | BuffSize, | |||
CRioStream * | Stream, | |||
struct timeval | RTT_average, | |||
int | tgifWindow | |||
) |
Definition at line 1481 of file RioMMClient.cpp.
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 }
long long int CreateTopicsObj | ( | char * | TopicsName, | |
int | BlockSize, | |||
RioBlock | BuffSize, | |||
CRioStream * | Stream, | |||
struct timeval | RTT_average, | |||
CRioMMVideo * | video | |||
) |
Definition at line 1325 of file RioMMClient.cpp.
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 }
CRioMMObject * CreateVideoObj | ( | char * | VideoName, | |
int | BlockSize, | |||
RioBlock | BuffSize, | |||
CRioStream * | Stream, | |||
struct timeval | RTT_average, | |||
RioMMInterface * | rio, | |||
CRioStream * | ServerStream, | |||
ConfigData * | config, | |||
int | block = 0 | |||
) |
Definition at line 1089 of file RioMMClient.cpp.
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 // Permite, ao usarmos o modo de simula��o, obter o tempo necess�rio ao 01105 // abrirmos um arquivo do servidor. Usado para avaliar a diferen�a na 01106 // efici�ncia entre ler um arquivo do servidor executando na GRID e da 01107 // implementa��o normal do servidor. 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 // Permite, ao usarmos o modo de simula��o, obter o tempo necess�rio ao 01117 // abrirmos um arquivo do servidor. Usado para avaliar a diferen�a na 01118 // efici�ncia entre ler um arquivo do servidor executando na GRID e da 01119 // implementa��o normal do servidor. 01120 gettimeofday( &EndVideoOpen, NULL ); 01121 // Computa o tempo decorrido para ler o arquivo, e o coloca num arquivo de 01122 // log especial dentro do diret�rio de logs. 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 }
void dispatchSignals | ( | int | sig | ) |
Definition at line 206 of file RioMMClient.cpp.
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 // Get additional info according to the signal received. 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 // Do not bother if it is a fake SIGCHLD. 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 }
static void InitCmdParams | ( | ConfigData * | config | ) | [static] |
Definition at line 262 of file RioMMClient.cpp.
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 // Inicializa a variavel que define o diretorio com o log da RioNeti com 00283 // NULL, indicando que o log sera gerado no diretorio atual onde o cliente 00284 // esta sendo executado. 00285 config->setRioMMRioNetiLogPath( "NULL" ); 00286 #endif 00287 }
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 756 of file RioMMClient.cpp.
00757 { 00758 int optch; 00759 int ind = -1; 00760 int null; 00761 ConfigData config; 00762 // Variavel usada para indicar, se true, se devemos finalizar os objetos 00763 // object, Stream, rioMMExplorer e Session. 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 // Create the qapplication. This function also parse command line 00829 // to search for X parameters, aka -display, -geometry, -fn, etc. 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 // O emulador sera utilizado. 00887 config.setRioMMEmulator( QString( optarg ) ); 00888 break; 00889 00890 case 'l': 00891 // Setando o diretorio destino dos logs. 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 // Nova opcao para ler, da linha de comando, o diretorio onde sera 00926 // armazenado o log da RioNeti. 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 // Set screen resolution 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 // Enviando evento para a interface para que a mesma solicite a 00960 // password do usu�rio (se necess�rio) e dispare a thread Connection. 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 // Os par�metros "-e" e "-l" s�o obrigat�rios. 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 // Verifying logPath vality. 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 ); // Liberando mem�ria que n�o ser� mais usada. 00993 00994 // Connection conecta-se ao servidor e cria uma inst�ncia da RioMMVideo 00995 // que ser� apontada pela vari�vel "object". 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 //Tendo em conta que o arquivo de acoes est� em 01027 //segundos, multiplicamos aqui por 1000000 para 01028 //converter em microsegundos, que � a unidade de tempo 01029 //esperada pelo comando usleep. 01030 usleep( (int)(wait_time*1000000) ); 01031 } // fim do while( !fim ). 01032 delete emul; 01033 } 01034 finalize = true; 01035 } // fim do if( Connection( (void *)&configData ) != NULL ). 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 // Delete screen object. 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 }
void makeLogHeader | ( | CRioMMVideo * | Video, | |
ConfigData * | config, | |||
char * | VideoName | |||
) |
Definition at line 1165 of file RioMMClient.cpp.
01167 { 01168 // Informacoes para o log de comportamento do usuario. 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 // Inputing the client version. 01178 Video->inputLog( QString("RioMMClient version: %1\n").arg( VERSION ) ); 01179 01180 // Inputing the user login. 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 // Inputing the client IP. 01187 host.s_addr = Session->getipaddr(); 01188 Video->inputLog( QString( "Client IP Adrress: %1\n" ).arg( 01189 inet_ntoa( host ) ) ); 01190 01191 // Inputing the object path. 01192 Video->inputLog( QString("Object path: %1\n").arg( VideoName ) ); 01193 01194 // Inputing the object size and number os blocks. 01195 if( !FAILED( Session->GetObjectInfo( VideoName, &objectInfo ) ) ) 01196 { 01197 #ifdef USE_QT_GRID 01198 // Adapta��o para a QT3.1 (usada na GRID). 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 // Inputing the block size. 01220 Session->GetBlockSize( &block_size ); 01221 Video->inputLog( QString( "Block size: %1\n" ).arg( block_size ) ); 01222 01223 // Inputing config. 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 // Inputing the config file. 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 // Now, inputing the actions log (from riommvideo and riomminterface). 01288 Video->inputLog( "------------------Actions log--------------------\n" ); 01289 }
void printOptions | ( | ConfigData * | config | ) |
Definition at line 1596 of file RioMMClient.cpp.
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 }
bool readSettings | ( | ConfigData * | config | ) |
Definition at line 1591 of file RioMMClient.cpp.
01592 { 01593 return( config->readRioMMClientSettings() ); 01594 }
void segfaultHandler | ( | int | sig | ) |
Definition at line 748 of file RioMMClient.cpp.
00749 { 00750 RioErr << "[RioMMClient] SEGMENTATION FAULT(" << sig << ")!" << endl; 00751 show_stackframe(); 00752 00753 _exit( 1 ); 00754 }
void show_stackframe | ( | ) |
Handles the SEGFAULT.
Definition at line 733 of file RioMMClient.cpp.
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 }
void signalHandler | ( | int | sig | ) |
Definition at line 171 of file RioMMClient.cpp.
00172 { 00173 signal( SIGSEGV, SIG_IGN ); 00174 00175 if( object ) 00176 { 00177 // Make sure not attempt to operate in a SIGSEGV object. 00178 if( sig != SIGSEGV ) 00179 { 00180 // Ignorando o sinal de morte do filho (caso de ctrl+C). 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 }
void Usage | ( | char * | progname | ) |
Prints the usage.
Definition at line 117 of file RioMMClient.cpp.
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 }
Definition at line 63 of file RioMMClient.cpp.
Definition at line 67 of file RioMMClient.cpp.
Definition at line 68 of file RioMMClient.cpp.
Definition at line 69 of file RioMMClient.cpp.
int screenHeight = 0 |
Definition at line 73 of file RioMMClient.cpp.
int screenWidth = 0 |
Definition at line 72 of file RioMMClient.cpp.
Definition at line 65 of file RioMMClient.cpp.
Definition at line 66 of file RioMMClient.cpp.
Definition at line 64 of file RioMMClient.cpp.