// 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) 2020 Intel Corporation #ifndef OPENCV_GAPI_GSTREAMING_META_HPP #define OPENCV_GAPI_GSTREAMING_META_HPP #include #include #include #include namespace cv { namespace gapi { namespace streaming { // FIXME: the name is debatable namespace meta_tag { static constexpr const char * timestamp = "org.opencv.gapi.meta.timestamp"; static constexpr const char * seq_id = "org.opencv.gapi.meta.seq_id"; } // namespace meta_tag namespace detail { struct GMeta { static const char *id() { return "org.opencv.streaming.meta"; } // A universal yield for meta(), same as in GDesync template static std::tuple yield(cv::GCall &call, cv::detail::Seq) { return std::make_tuple(cv::detail::Yield::yield(call, IIs)...); } // Also a universal outMeta stub here static GMetaArgs getOutMeta(const GMetaArgs &args, const GArgs &) { return args; } }; } // namespace detail template cv::GOpaque meta(G g, const std::string &tag) { using O = cv::GOpaque; cv::GKernel k{ detail::GMeta::id() // kernel id , tag // kernel tag. Use meta tag here , &detail::GMeta::getOutMeta // outMeta callback , {cv::detail::GTypeTraits::shape} // output Shape , {cv::detail::GTypeTraits::op_kind} // input data kinds , {cv::detail::GObtainCtor::get()} // output template ctors }; cv::GCall call(std::move(k)); call.pass(g); return std::get<0>(detail::GMeta::yield(call, cv::detail::MkSeq<1>::type())); } template cv::GOpaque timestamp(G g) { return meta(g, meta_tag::timestamp); } template cv::GOpaque seq_id(G g) { return meta(g, meta_tag::seq_id); } template cv::GOpaque seqNo(G g) { // Old name, compatibility only return seq_id(g); } } // namespace streaming } // namespace gapi } // namespace cv #endif // OPENCV_GAPI_GSTREAMING_META_HPP