예제 #1
0
bool VideoImpl::seekTo(guint64 positionNanoSeconds)
{
  if (!_appsink0 || !_seekEnabled)
  {
    return false;
  }
  else
  {
    lockMutex();

    // Free the current sample and reset.
    _freeCurrentSample();
    _bitsChanged = false;

    // Seek to position.
    bool result = gst_element_seek_simple(
                    _appsink0, GST_FORMAT_TIME,
                    GstSeekFlags( GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE ),
                    positionNanoSeconds);

    unlockMutex();

    return result;
  }
}
예제 #2
0
void VideoImpl::freeResources()
{
  // Free resources.
  if (_bus)
  {
    gst_object_unref (GST_OBJECT(_bus));
    _bus = NULL;
  }

  if (_pipeline)
  {
    gst_element_set_state (_pipeline, GST_STATE_NULL);
    gst_object_unref (GST_OBJECT(_pipeline));
    _pipeline = NULL;
  }

  // Free all components.
  _freeElement(&_queue0);
  _freeElement(&_capsfilter0);
  _freeElement(&_videoscale0);
  _freeElement(&_videoconvert0);
  _freeElement(&_appsink0);

  _freeElement(&_audioqueue0);
  _freeElement(&_audioconvert0);
  _freeElement(&_audioresample0);
  _freeElement(&_audiovolume0);
  _freeElement(&_audiosink0);

  qDebug() << "Freeing remaining samples/buffers" << endl;

  // Frees current sample and buffer.
  _freeCurrentSample();

  // Reset other informations.
  _bitsChanged = false;
  _width = _height = (-1);
  _duration = 0;
  _videoIsConnected = false;
  _audioIsConnected = false;
}
예제 #3
0
void MediaImpl::freeResources()
{
    // Free resources.
    if (_bus)
    {
        gst_object_unref (_bus);
        _bus = NULL;
    }

    if (_pipeline)
    {
        gst_element_set_state (_pipeline, GST_STATE_NULL);
        gst_object_unref (_pipeline);
        _pipeline = NULL;
    }

    // Reset pipeline elements.
    _uridecodebin0 = NULL;
    _queue0 = NULL;
    _videoconvert0 = NULL;
    _appsink0 = NULL;

    // Reset pad handler.
    _padHandlerData = GstPadHandlerData();

    // Unref the shmsrc poller.
    if (_pollSource)
    {
        g_source_unref(_pollSource);
        _pollSource = NULL;
    }

    qDebug() << "Freeing remaining samples/buffers" << endl;

    // Frees current sample and buffer.
    _freeCurrentSample();

    // Resets bits changed.
    _bitsChanged = false;
}