void VideoProducer::Disconnect(const media_source &source, const media_destination &destination) { PRINTF(1, ("Disconnect()\n")); if (!fConnected) { PRINTF(0, ("Disconnect: Not connected\n")); return; } if ((source != fOutput.source) || (destination != fOutput.destination)) { PRINTF(0, ("Disconnect: Bad source and/or destination\n")); return; } #if 1 /* Some dumb apps don't stop nodes before disconnecting... */ if (fRunning) HandleStop(); #endif fEnabled = false; fOutput.destination = media_destination::null; fLock.Lock(); delete fBufferGroup; fBufferGroup = NULL; fLock.Unlock(); fConnected = false; }
void LegacyAudioConsumer::HandleEvent( const media_timed_event *event, bigtime_t lateness, bool realTimeEvent ) { switch(event->type) { case BTimedEventQueue::B_START: HandleStart( event->event_time ); break; case BTimedEventQueue::B_STOP: HandleStop(); break; case BTimedEventQueue::B_WARP: HandleTimeWarp( event->bigdata ); break; case BTimedEventQueue::B_SEEK: HandleSeek( event->bigdata ); break; case BTimedEventQueue::B_HANDLE_BUFFER: HandleBuffer( static_cast<BBuffer *>( event->pointer ) ); break; case BTimedEventQueue::B_DATA_STATUS: case BTimedEventQueue::B_PARAMETER: default: break; //HandleEvent: Unhandled event } }
void VideoProducer::HandleEvent(const media_timed_event *event, bigtime_t lateness, bool realTimeEvent) { TOUCH(lateness); TOUCH(realTimeEvent); switch(event->type) { case BTimedEventQueue::B_START: HandleStart(event->event_time); break; case BTimedEventQueue::B_STOP: HandleStop(); break; case BTimedEventQueue::B_WARP: HandleTimeWarp(event->bigdata); break; case BTimedEventQueue::B_SEEK: HandleSeek(event->bigdata); break; case BTimedEventQueue::B_HANDLE_BUFFER: case BTimedEventQueue::B_DATA_STATUS: case BTimedEventQueue::B_PARAMETER: default: PRINTF(-1, ("HandleEvent: Unhandled event -- %lx\n", event->type)); break; } }
// -------------------------------------------------------- // // implementation for BMediaEventLooper // -------------------------------------------------------- // void AbstractFileInterfaceNode::HandleEvent( const media_timed_event *event, bigtime_t lateness, bool realTimeEvent) { CALLED(); switch (event->type) { case BTimedEventQueue::B_START: HandleStart(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_SEEK: HandleSeek(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_WARP: HandleWarp(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_STOP: HandleStop(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_HANDLE_BUFFER: if (RunState() == BMediaEventLooper::B_STARTED) { HandleBuffer(event,lateness,realTimeEvent); } break; case BTimedEventQueue::B_DATA_STATUS: HandleDataStatus(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_PARAMETER: HandleParameter(event,lateness,realTimeEvent); break; default: PRINT(" unknown event type: %ld\n",event->type); break; } }
void FireWireDVNode::HandleEvent(const media_timed_event* event, bigtime_t lateness, bool realTimeEvent) { switch(event->type) { case M_REFRESH_PARAMETER_WEB: RefreshParameterWeb(); break; case BTimedEventQueue::B_START: HandleStart(event->event_time); break; case BTimedEventQueue::B_STOP: HandleStop(); break; case BTimedEventQueue::B_WARP: HandleTimeWarp(event->bigdata); break; case BTimedEventQueue::B_SEEK: HandleSeek(event->bigdata); break; case BTimedEventQueue::B_HANDLE_BUFFER: case BTimedEventQueue::B_DATA_STATUS: case BTimedEventQueue::B_PARAMETER: default: TRACE("FireWireDVNode::HandleEvent: Unhandled event -- %lx\n", event->type); break; } }
void CSapConnection::HandleWrite(const boost::system::error_code& err) { SS_XLOG(XLOG_DEBUG,"CSapConnection::%s,id[%d]\n",__FUNCTION__,m_nId); SSapMsgHeader *pHeader=NULL; unsigned int dwServiceId=0; unsigned int dwMsgId=0; if(err) { SS_SLOG(XLOG_WARNING,"CSapConnection::"<<__FUNCTION__<<",id["<<m_nId<<"],error:" <<err.message()<<"\n"); while(!m_queue.empty()) { SSapMsgHeader *pHeader=(SSapMsgHeader *)(m_queue.front().pBuffer); unsigned int dwServiceId=ntohl(pHeader->dwServiceId); unsigned int dwMsgId=ntohl(pHeader->dwMsgId); if(!(dwServiceId==0&&dwMsgId==0)) { if(pHeader->byIdentifer==SAP_PACKET_REQUEST && m_pSession!=NULL) { SSapMsgHeader stSendFailResponse; stSendFailResponse.byIdentifer=SAP_PACKET_RESPONSE; stSendFailResponse.byHeadLen=sizeof(SSapMsgHeader); stSendFailResponse.dwPacketLen=htonl(sizeof(SSapMsgHeader)); stSendFailResponse.byVersion=0x1; stSendFailResponse.dwCode=htonl(ERROR_SOS_SEND_FAIL); stSendFailResponse.dwServiceId=pHeader->dwServiceId; stSendFailResponse.dwMsgId=pHeader->dwMsgId; stSendFailResponse.dwSequence=pHeader->dwSequence; m_pSession->OnReceiveSosAvenueResponse(m_nId,&stSendFailResponse,sizeof(stSendFailResponse),m_strRemoteIp,m_dwRemotePort); } free((void *)(m_queue.front().pBuffer)); } m_queue.pop_front(); m_nQueueLen--; } HandleStop(); return; } pHeader=(SSapMsgHeader *)(m_queue.front().pBuffer); dwServiceId=ntohl(pHeader->dwServiceId); dwMsgId=ntohl(pHeader->dwMsgId); if(!(dwServiceId==0&&dwMsgId==0)) { free((void *)(m_queue.front().pBuffer)); } m_queue.pop_front(); m_nQueueLen--; if (!m_queue.empty()) { boost::asio::async_write(m_socket, boost::asio::buffer(m_queue.front().pBuffer,m_queue.front().nLen), MakeSapAllocHandler(m_allocWrite,boost::bind(&CSapConnection::HandleWrite, shared_from_this(), boost::asio::placeholders::error))); } }
VideoProducer::~VideoProducer() { if (fInitStatus == B_OK) { /* Clean up after ourselves, in case the application didn't make us * do so. */ if (fConnected) Disconnect(fOutput.source, fOutput.destination); if (fRunning) HandleStop(); } atomic_add(&fInstances, -1); }
LegacyAudioConsumer::~LegacyAudioConsumer() { if ( mInitStatus != B_OK ) { return; } /* Clean up */ if ( mConnected ) { Disconnected( mInput.source, mInput.destination ); } if ( mRunning ) { HandleStop(); } if ( io_buf1 != NULL ) { free( static_cast<void *>(const_cast<audio_buffer_header *>(io_buf1)) ); } if ( fd != 0 ) { close( fd ); } }
void SoundPlayNode::HandleEvent(const media_timed_event* event, bigtime_t lateness, bool realTimeEvent) { CALLED(); switch (event->type) { case BTimedEventQueue::B_START: HandleStart(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_SEEK: HandleSeek(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_WARP: HandleWarp(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_STOP: HandleStop(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_HANDLE_BUFFER: // we don't get any buffers break; case SEND_NEW_BUFFER_EVENT: if (RunState() == BMediaEventLooper::B_STARTED) SendNewBuffer(event, lateness, realTimeEvent); break; case BTimedEventQueue::B_DATA_STATUS: HandleDataStatus(event,lateness,realTimeEvent); break; case BTimedEventQueue::B_PARAMETER: HandleParameter(event,lateness,realTimeEvent); break; default: fprintf(stderr," unknown event type: %li\n", event->type); break; } }
void CSapConnection::Close() { SS_XLOG(XLOG_DEBUG,"CSapConnection::%s,id[%d]\n",__FUNCTION__,m_nId); bRunning=false; HandleStop(); }
/******************************************************************************* * Function Name: Cy_SCB_EZI2C_Interrupt ****************************************************************************//** * * This is the interrupt function for the SCB configured in the EZI2C mode. * This function must be called inside the user-defined interrupt service * routine to make the EZI2C slave work. * * \param base * The pointer to the EZI2C SCB instance. * * \param context * The pointer to the context structure \ref cy_stc_scb_ezi2c_context_t allocated * by the user. The structure is used during the EZI2C operation for internal * configuration and data retention. The user must not modify anything * in this structure. * *******************************************************************************/ void Cy_SCB_EZI2C_Interrupt(CySCB_Type *base, cy_stc_scb_ezi2c_context_t *context) { uint32_t slaveIntrStatus; /* Handle an I2C wake-up event */ if (0UL != (CY_SCB_I2C_INTR_WAKEUP & Cy_SCB_GetI2CInterruptStatusMasked(base))) { /* Move from IDLE state, the slave was addressed. Following address match * interrupt continue transfer. */ context->state = CY_SCB_EZI2C_STATE_ADDR; Cy_SCB_ClearI2CInterrupt(base, CY_SCB_I2C_INTR_WAKEUP); } /* Get the slave interrupt sources */ slaveIntrStatus = Cy_SCB_GetSlaveInterruptStatusMasked(base); /* Handle the error conditions */ if (0UL != (CY_SCB_EZI2C_SLAVE_INTR_ERROR & slaveIntrStatus)) { HandleErrors(base, context); Cy_SCB_ClearSlaveInterrupt(base, CY_SCB_EZI2C_SLAVE_INTR_ERROR); /* Trigger the stop handling to complete the transaction */ slaveIntrStatus |= CY_SCB_SLAVE_INTR_I2C_STOP; } else { if ((CY_SCB_EZI2C_STATE_RX_DATA1 == context->state) && (0UL != (CY_SCB_SLAVE_INTR_I2C_STOP & slaveIntrStatus))) { /* Get data from the RX FIFO after Stop is generated */ Cy_SCB_SetRxInterrupt (base, CY_SCB_RX_INTR_LEVEL); Cy_SCB_SetRxInterruptMask(base, CY_SCB_RX_INTR_LEVEL); } } /* Handle the receive direction (master writes data) */ if (0UL != (CY_SCB_RX_INTR_LEVEL & Cy_SCB_GetRxInterruptStatusMasked(base))) { HandleDataReceive(base, context); Cy_SCB_ClearRxInterrupt(base, CY_SCB_RX_INTR_LEVEL); } /* Handle the transaction completion */ if (0UL != (CY_SCB_SLAVE_INTR_I2C_STOP & slaveIntrStatus)) { HandleStop(base, context); Cy_SCB_ClearSlaveInterrupt(base, CY_SCB_SLAVE_INTR_I2C_STOP); /* Update the slave interrupt status */ slaveIntrStatus = Cy_SCB_GetSlaveInterruptStatusMasked(base); } /* Handle the address byte */ if (0UL != (CY_SCB_SLAVE_INTR_I2C_ADDR_MATCH & slaveIntrStatus)) { HandleAddress(base, context); Cy_SCB_ClearI2CInterrupt (base, CY_SCB_I2C_INTR_WAKEUP); Cy_SCB_ClearSlaveInterrupt(base, CY_SCB_SLAVE_INTR_I2C_ADDR_MATCH); } /* Handle the transmit direction (master reads data) */ if (0UL != (CY_SCB_TX_INTR_LEVEL & Cy_SCB_GetTxInterruptStatusMasked(base))) { HandleDataTransmit(base, context); Cy_SCB_ClearTxInterrupt(base, CY_SCB_TX_INTR_LEVEL); } }