bool MediaImpl::_preRun() { // Check for end-of-stream or terminate. if (_eos() || _terminate) { _setFinished(true); resetMovie(); // _FINISH_OUT->type()->setValue(1.0f); // _VIDEO_OUT->sleeping(true); // _AUDIO_OUT->sleeping(true); // // if (_audioBufferAdapter != NULL) // gst_adapter_clear(_audioBufferAdapter); } else _setFinished(false); // _FINISH_OUT->type()->setValue(0.0f); // if (_RESET_IN->type()->boolValue()) // resetMovie(); if (!_movieReady || !_padHandlerData.isConnected()) return false; return true; }
void MediaImpl::update() { // Check for end-of-stream or terminate. if (_eos() || _terminate) { _setFinished(true); resetMovie(); } else { _setFinished(false); } // // Check if movie is ready and connected. // if (!isReady()) // { // _bitsChanged = false; // } // // Check gstreamer messages on bus. _checkMessages(); }
bool MediaImpl::runVideo() { // if (!_VIDEO_OUT->connected()) // return; if (!_preRun()) return false; bool bitsChanged = false; if (queue_input_buf.size() > 0) { // Pull video. if (!_videoPull()) { _setFinished(true); // _FINISH_OUT->type()->setValue(1.0f); // _VIDEO_OUT->sleeping(true); } else { bitsChanged = true; // _VIDEO_OUT->sleeping(false); } //std::cout << "VideoImpl::runVideo: read frame #" << _videoNewBufferCounter << std::endl; } /* TODO: This causes the texture to be loaded always in Mapper.cpp . The * problem if this is not set is: When we have more than one shape, a * shape that has a new buffer coming in will overdraw the old buffer of the * shape on top. This implementation seems to be fast enough that * _videoNewBufferCounter is often 1 or 0. If bitsChanged is often switching * between true and false (as in the case described above), than the shape * textures will appear to be flickering/alternating. Maybe a better solution is * needed (in the GL layer or here?)*/ else bitsChanged = true; _postRun(); return bitsChanged; }