gstreamerpipeline.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. //
  5. // Copyright (C) 2021 Intel Corporation
  6. #ifndef OPENCV_GAPI_STREAMING_GSTREAMER_GSTREAMERPIPELINE_HPP
  7. #define OPENCV_GAPI_STREAMING_GSTREAMER_GSTREAMERPIPELINE_HPP
  8. #include <opencv2/gapi/streaming/gstreamer/gstreamersource.hpp>
  9. #include <opencv2/gapi/own/exports.hpp>
  10. #include <string>
  11. #include <unordered_map>
  12. #include <memory>
  13. namespace cv {
  14. namespace gapi {
  15. namespace wip {
  16. namespace gst {
  17. class GAPI_EXPORTS_W GStreamerPipeline
  18. {
  19. public:
  20. class Priv;
  21. GAPI_WRAP explicit GStreamerPipeline(const std::string& pipeline);
  22. IStreamSource::Ptr getStreamingSource(const std::string& appsinkName,
  23. const GStreamerSource::OutputType outputType =
  24. GStreamerSource::OutputType::MAT);
  25. virtual ~GStreamerPipeline();
  26. protected:
  27. explicit GStreamerPipeline(std::unique_ptr<Priv> priv);
  28. std::unique_ptr<Priv> m_priv;
  29. };
  30. } // namespace gst
  31. using GStreamerPipeline = gst::GStreamerPipeline;
  32. // NB: Function for using from python
  33. // FIXME: a separate function is created due to absence of wrappers for `shared_ptr<> `
  34. // Ideally would be to wrap the `GStreamerPipeline::getStreamingSource()` method as is
  35. GAPI_EXPORTS_W cv::Ptr<IStreamSource>
  36. inline get_streaming_source(cv::Ptr<GStreamerPipeline>& pipeline,
  37. const std::string& appsinkName,
  38. const GStreamerSource::OutputType outputType
  39. = GStreamerSource::OutputType::MAT)
  40. {
  41. return pipeline->getStreamingSource(appsinkName, outputType);
  42. }
  43. } // namespace wip
  44. } // namespace gapi
  45. } // namespace cv
  46. #endif // OPENCV_GAPI_STREAMING_GSTREAMER_GSTREAMERPIPELINE_HPP