bool PAPlayer::CloseFile(bool reopen) { if (reopen) CAEFactory::KeepConfiguration(3000); if (!m_isPaused) SoftStop(true, true); CloseAllStreams(false); /* wait for the thread to terminate */ StopThread(true);//true - wait for end of thread // wait for any pending jobs to complete { CSharedLock lock(m_streamsLock); while (m_jobCounter > 0) { lock.Leave(); m_jobEvent.WaitMSec(100); lock.Enter(); } } return true; }
/** Flanco en secuencia_On*/ void In2GestorMaquina::_sltOPCSecuenciaOn(){ //Comienza la impresion if (m_memoryMap->m_mapa.m_maquina.secuencia_on){ emit SendDebugInfo(LOGGER_WARNING,"_sltOPCSecuenciaOn 1"); m_gestorMaquina->sltHabilitarFreno(true); m_memoryMap->m_mapa.m_maquina.InicioSecuenciaAutomatico=0x01; m_memoryMap->m_mapa.m_maquina.EstadoSecuenciaAutomatico=0x01; m_memoryMap->m_mapa.m_maquina.ParadaDiametro=false; bool condiciones=ComprobacionesPreviasImpresion(); if (condiciones){ //Tiene que haber imagen enviada if (m_memoryMap->m_ImagenEnviada==false) { int respuesta=QMessageBox::question(0,"ATENCION","No hay imagen enviada\n¿Está seguro que desea continuar?","Si","No",QString::null, 0, 1 ); if (respuesta==0){ //En eset caso obviamos el filtro de maculas //m_memoryMap->m_mapa.m_impresion.m_fltrMacula.bMonitorMacula=false; sltLaunchPrint(); } else{ //Tiramos de nuevo las condiciones de movimiento m_gestorMaquina->sltEnableCondicionesMovimiento(); } } else{ sltLaunchPrint(); } } else{ //No se dan las condiciones de impresion //Tiramos de nuevo las condiciones de movimiento m_gestorMaquina->sltEnableCondicionesMovimiento(); } } else{ //Paramos //emit sgnInitImpresion(false); emit SendDebugInfo(LOGGER_WARNING,"_sltOPCSecuenciaOn 0"); m_memoryMap->m_ImagenEnviada=false; m_startDelayed=false; //Es un softstop if (m_memoryMap->m_mapa.m_maquina.codigo_parada==0){ //Aqui softstopear SoftStop(); } else{ //Es una parada de emergencia //QString valor_codigo_parada=QString("%1").arg(m_memoryMap->m_mapa.m_maquina.codigo_parada); //emit SendDebugInfo(LOGGER_WARNING,QString("Realizando parada %1").arg(valor_codigo_parada)); //Insertar_Evento(ERROR_MAQUINA,valor_codigo_parada); EmergencyStop(FIN_EMERGENCIA); //Se quitan los jogs por si acasol GestorMaquina *gM= GestorMaquina::request(this); if (gM){ gM->sltJogMenosOff(); gM->sltJogMenosOff(); } } } }
PAPlayer::~PAPlayer() { if (!m_isPaused) SoftStop(true, true); CloseAllStreams(false); /* wait for the thread to terminate */ StopThread(true);//true - wait for end of thread delete m_FileItem; }
bool PAPlayer::CloseFile() { if (!m_isPaused) SoftStop(true, true); CloseAllStreams(false); /* wait for the thread to terminate */ StopThread(true);//true - wait for end of thread return true; }
void PAPlayer::Pause() { if (m_isPaused) { m_isPaused = false; SoftStart(); } else { m_isPaused = true; SoftStop(true, false); } }
void PAPlayer::Pause() { if (m_isPaused) { m_isPaused = false; SoftStart(); m_callback.OnPlayBackResumed(); } else { m_isPaused = true; SoftStop(true, false); m_callback.OnPlayBackPaused(); } }
void PAPlayer::SetSpeed(float speed) { m_playbackSpeed = static_cast<int>(speed); if (m_playbackSpeed != 0 && m_isPaused) { m_isPaused = false; SoftStart(); m_callback.OnPlayBackResumed(); } else if (m_playbackSpeed == 0 && !m_isPaused) { m_isPaused = true; SoftStop(true, false); m_callback.OnPlayBackPaused(); } m_signalSpeedChange = true; }
void PAPlayer::CloseAllStreams(bool fade/* = true */) { if (!fade) { CSingleLock lock(m_streamsLock); while (!m_streams.empty()) { StreamInfo* si = m_streams.front(); m_streams.pop_front(); if (si->m_stream) { CloseFileCB(*si); CServiceBroker::GetActiveAE().FreeStream(si->m_stream); si->m_stream = NULL; } si->m_decoder.Destroy(); delete si; } while (!m_finishing.empty()) { StreamInfo* si = m_finishing.front(); m_finishing.pop_front(); if (si->m_stream) { CloseFileCB(*si); CServiceBroker::GetActiveAE().FreeStream(si->m_stream); si->m_stream = nullptr; } si->m_decoder.Destroy(); delete si; } m_currentStream = nullptr; } else { SoftStop(false, true); CSingleLock lock(m_streamsLock); m_currentStream = NULL; } }
void PAPlayer::CloseAllStreams(bool fade/* = true */) { if (!fade) { CExclusiveLock lock(m_streamsLock); while(!m_streams.empty()) { StreamInfo* si = m_streams.front(); m_streams.pop_front(); if (si->m_stream) { CAEFactory::FreeStream(si->m_stream); si->m_stream = NULL; } si->m_decoder.Destroy(); delete si; } while(!m_finishing.empty()) { StreamInfo* si = m_finishing.front(); m_finishing.pop_front(); if (si->m_stream) { CAEFactory::FreeStream(si->m_stream); si->m_stream = NULL; } si->m_decoder.Destroy(); delete si; } m_currentStream = NULL; } else { SoftStop(false, true); CExclusiveLock lock(m_streamsLock); m_currentStream = NULL; } }