Example #1
0
/*!
 * \brief CvCapture_GStreamer::close
 * Closes the pipeline and destroys all instances
 */
void CvCapture_GStreamer::close()
{
    if (isPipelinePlaying())
        this->stopPipeline();

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

    duration = -1;
}
/*!
 * \brief OpenIMAJCapGStreamer::close
 * Closes the pipeline and destroys all instances
 */
void OpenIMAJCapGStreamer::close()
{
    if (isPipelinePlaying())
        this->stopPipeline();
    
    if(pipeline) {
        gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_NULL);
        gst_object_unref(GST_OBJECT(pipeline));
        pipeline = NULL;
    }
    if(uridecodebin){
        gst_object_unref(GST_OBJECT(uridecodebin));
        uridecodebin = NULL;
    }
    if(color){
        gst_object_unref(GST_OBJECT(color));
        color = NULL;
    }
    if(sink){
        gst_object_unref(GST_OBJECT(sink));
        sink = NULL;
    }
    if(buffer) {
        gst_buffer_unref(buffer);
        buffer = NULL;
    }
    if(frame) {
        frame = NULL;
    }
    if(caps){
        gst_caps_unref(caps);
        caps = NULL;
    }
    if(buffer_caps){
        gst_caps_unref(buffer_caps);
        buffer_caps = NULL;
    }
    if(sample){
        gst_sample_unref(sample);
        sample = NULL;
    }
}
Example #3
0
/*!
 * \brief CvCapture_GStreamer::close
 * Closes the pipeline and destroys all instances
 */
void CvCapture_GStreamer::close()
{
    if (isPipelinePlaying())
        this->stopPipeline();

    if(pipeline) {
        gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_NULL);
        gst_object_unref(GST_OBJECT(pipeline));
    }
    if(uridecodebin){
        gst_object_unref(GST_OBJECT(uridecodebin));
    }
    if(color){
        gst_object_unref(GST_OBJECT(color));
    }
    if(sink){
        gst_object_unref(GST_OBJECT(sink));
    }
    if(buffer)
        gst_buffer_unref(buffer);
    if(frame) {
        frame->imageData = 0;
        cvReleaseImage(&frame);
    }
    if(caps){
        gst_caps_unref(caps);
    }
    if(buffer_caps){
        gst_caps_unref(buffer_caps);
    }
#if GST_VERSION_MAJOR > 0
    if(sample){
        gst_sample_unref(sample);
    }
#endif

}