G-API: Wrap GStreamerSource * Wrap GStreamerSource into python * Fixed test skipping when can't make Gst-src * Wrapped GStreamerPipeline class, added dummy test for it * Fix no_gst testing * Changed wrap for GStreamerPipeline::getStreamingSource() : now python-specific in-class method GStreamerPipeline::get_streaming_source() * Added accuracy tests vs OCV:VideoCapture(Gstreamer) * Add skipping when can't use VideoCapture(GSTREAMER); Add better handling of GStreamer backend unavailable; Changed video to avoid terminations * Applying comments * back to a separate get_streaming_source function, with comment Co-authored-by: OrestChura <orest.chura@intel.com>
60 lines
1.9 KiB
C++
60 lines
1.9 KiB
C++
// This file is part of OpenCV project.
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
//
|
|
// Copyright (C) 2021 Intel Corporation
|
|
|
|
#ifndef OPENCV_GAPI_STREAMING_GSTREAMER_GSTREAMERPIPELINE_HPP
|
|
#define OPENCV_GAPI_STREAMING_GSTREAMER_GSTREAMERPIPELINE_HPP
|
|
|
|
#include <opencv2/gapi/streaming/gstreamer/gstreamersource.hpp>
|
|
#include <opencv2/gapi/own/exports.hpp>
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <memory>
|
|
|
|
namespace cv {
|
|
namespace gapi {
|
|
namespace wip {
|
|
namespace gst {
|
|
|
|
class GAPI_EXPORTS_W GStreamerPipeline
|
|
{
|
|
public:
|
|
class Priv;
|
|
|
|
GAPI_WRAP explicit GStreamerPipeline(const std::string& pipeline);
|
|
IStreamSource::Ptr getStreamingSource(const std::string& appsinkName,
|
|
const GStreamerSource::OutputType outputType =
|
|
GStreamerSource::OutputType::MAT);
|
|
virtual ~GStreamerPipeline();
|
|
|
|
protected:
|
|
explicit GStreamerPipeline(std::unique_ptr<Priv> priv);
|
|
|
|
std::unique_ptr<Priv> m_priv;
|
|
};
|
|
|
|
} // namespace gst
|
|
|
|
using GStreamerPipeline = gst::GStreamerPipeline;
|
|
|
|
// NB: Function for using from python
|
|
// FIXME: a separate function is created due to absence of wrappers for `shared_ptr<> `
|
|
// Ideally would be to wrap the `GStreamerPipeline::getStreamingSource()` method as is
|
|
GAPI_EXPORTS_W cv::Ptr<IStreamSource>
|
|
inline get_streaming_source(cv::Ptr<GStreamerPipeline>& pipeline,
|
|
const std::string& appsinkName,
|
|
const GStreamerSource::OutputType outputType
|
|
= GStreamerSource::OutputType::MAT)
|
|
{
|
|
return pipeline->getStreamingSource(appsinkName, outputType);
|
|
}
|
|
|
|
} // namespace wip
|
|
} // namespace gapi
|
|
} // namespace cv
|
|
|
|
#endif // OPENCV_GAPI_STREAMING_GSTREAMER_GSTREAMERPIPELINE_HPP
|