Beispiel #1
0
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;
}
Beispiel #2
0
int8_t	
_bslurp_s8(struct hdfs_heap_buf *b)
{
	uint8_t res;
	if (_eos(b, sizeof(res)))
		return 0;
	res = ((uint8_t *)b->buf)[b->used++];
	return (int8_t)res;
}
Beispiel #3
0
void
_bslurp_mem1(struct hdfs_heap_buf *b, size_t len, char **obuf)
{
	char *res;

	if (_eos(b, len))
		return;

	res = malloc(len + 1);
	ASSERT(res);
	memcpy(res, b->buf + b->used, len);
	b->used += len;
	*obuf = res;
}
Beispiel #4
0
void MediaImpl::resetMovie()
{
  // TODO: Check if we can still seek when we reach EOS. It seems like it's then impossible and we
  // have to reload but it seems weird so we should check.
  if (!_eos() && _seekEnabled)
  {
    qDebug() << "Seeking at position 0.";
    gst_element_seek_simple (_pipeline, GST_FORMAT_TIME,
                             (GstSeekFlags) (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), 0);
    this->_frame = NULL;
    _setReady(true);
  }
  else
  {
    // Just reload movie.
    qDebug() << "Reloading the movie" << _seekEnabled;
    _currentMovie = "";
    loadMovie(_uri);
  }
}
Beispiel #5
0
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();
}