Example #1
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;
  }

  _source = NULL;
//  _audioQueue = NULL;
//  _audioConvert = NULL;
//  _audioResample = NULL;
  _videoQueue = NULL;
  _videoConvert = NULL;
  _videoColorSpace = NULL;
  _audioSink = NULL;
  _videoSink = NULL;
  _frame = NULL;
  _padHandlerData = GstPadHandlerData();

  // Flush buffers in adapter.
//  gst_adapter_clear(_audioBufferAdapter);

}
Example #2
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;
}