diff --git a/module/src/server/implementation/objects/TelmateFrameGrabberImpl.cpp b/module/src/server/implementation/objects/TelmateFrameGrabberImpl.cpp index 984d01e..bb0c580 100644 --- a/module/src/server/implementation/objects/TelmateFrameGrabberImpl.cpp +++ b/module/src/server/implementation/objects/TelmateFrameGrabberImpl.cpp @@ -1,7 +1,6 @@ /* Autogenerated with kurento-module-creator */ #include -#include #include "MediaPipeline.hpp" #include #include "TelmateFrameGrabberImpl.hpp" @@ -9,111 +8,94 @@ #include #include "MediaPipelineImpl.hpp" - #define GST_CAT_DEFAULT kurento_telmate_frame_grabber_impl -GST_DEBUG_CATEGORY_STATIC(GST_CAT_DEFAULT); +GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); #define GST_DEFAULT_NAME "KurentoTelmateFrameGrabberImpl" -namespace kurento { -namespace module { -namespace telmate { - -TelmateFrameGrabberImpl::TelmateFrameGrabberImpl( - const boost::property_tree::ptree &config, - std::shared_ptr mediaPipeline) : - OpenCVFilterImpl(config, - std::dynamic_pointer_cast (mediaPipeline)) { +namespace kurento +{ +namespace module +{ +namespace telmateframegrabber +{ - GST_DEBUG("TelmateFrameGrabberImpl::" - "TelmateFrameGrabberImpl() " - "called, %s ", this->epName.c_str()); +TelmateFrameGrabberImpl::TelmateFrameGrabberImpl (const boost::property_tree::ptree &config, + std::shared_ptr mediaPipeline) : + OpenCVFilterImpl (config, std::dynamic_pointer_cast (mediaPipeline) ) +{ - g_object_set (element, "filter-factory", "opencvfilter", NULL); + g_object_set (element, "filter-factory", "telmateframegrabberopencvimpl", NULL); + g_object_get (G_OBJECT (element), "filter", &telmateframegrabberopencvimpl, NULL); - g_object_get (G_OBJECT (element), "filter", &opencvfilter, NULL); - - if (opencvfilter == nullptr) { + if (telmateframegrabberopencvimpl == nullptr) { throw KurentoException (MEDIA_OBJECT_NOT_AVAILABLE, "Media Object not available"); } - g_object_set (opencvfilter, "target-object", + g_object_set (telmateframegrabberopencvimpl, "target-object", static_cast (this), NULL); - g_object_unref (opencvfilter); + g_object_unref (telmateframegrabberopencvimpl); + pTelmateFrameGrabberOpenCVImpl = (TelmateFrameGrabberOpenCVImpl*) telmateframegrabberopencvimpl; } -TelmateFrameGrabberImpl::~TelmateFrameGrabberImpl() { - - +int TelmateFrameGrabberImpl::cleanup() +{ + pTelmateFrameGrabberOpenCVImpl->cleanup(); + return 1; } -void TelmateFrameGrabberImpl::release() { - - std::shared_ptr p = TelmateFrameGrabberOpenCVImpl::getSharedPtr(); - p.reset(); - GST_DEBUG("TelmateFrameGrabberImpl::" - "release() " - "called, %s ", this->epName.c_str()); - return; +int TelmateFrameGrabberImpl::getSnapInterval () +{ + return pTelmateFrameGrabberOpenCVImpl->snapInterval; } - -void TelmateFrameGrabberImpl::cleanup() { - - TelmateFrameGrabberOpenCVImpl *p = (TelmateFrameGrabberOpenCVImpl*) opencvfilter; - p->cleanup(); +void TelmateFrameGrabberImpl::setSnapInterval (int snapInterval) +{ + pTelmateFrameGrabberOpenCVImpl->snapInterval = snapInterval; return; } -int TelmateFrameGrabberImpl::getSnapInterval() { - return TelmateFrameGrabberOpenCVImpl::snapInterval; -} - - -void TelmateFrameGrabberImpl::setSnapInterval(int snapInterval) { - TelmateFrameGrabberOpenCVImpl::snapInterval = snapInterval; - return; +std::string TelmateFrameGrabberImpl::getStoragePath () +{ + return pTelmateFrameGrabberOpenCVImpl->storagePath; } -void TelmateFrameGrabberImpl::setOutputFormat(int outputFormat) { - TelmateFrameGrabberOpenCVImpl::outputFormat = outputFormat; - return; -} -std::string TelmateFrameGrabberImpl::getStoragePath() { - return TelmateFrameGrabberOpenCVImpl::storagePath; +void TelmateFrameGrabberImpl::setStoragePath (const std::string &path) +{ + pTelmateFrameGrabberOpenCVImpl->storagePath = path; } -void TelmateFrameGrabberImpl::setStoragePath(const std::string &path) { - TelmateFrameGrabberOpenCVImpl::storagePath = path; +void TelmateFrameGrabberImpl::setWebRtcEpName (const std::string &epName) +{ + pTelmateFrameGrabberOpenCVImpl->epName = epName; return; } -void TelmateFrameGrabberImpl::setWebRtcEpName(const std::string &epName) { - TelmateFrameGrabberOpenCVImpl::epName = epName; +void TelmateFrameGrabberImpl::setOutputFormat (int outputFormat) +{ + pTelmateFrameGrabberOpenCVImpl->outputFormat = outputFormat; return; } MediaObjectImpl * - TelmateFrameGrabberImplFactory::createObject( - const boost::property_tree::ptree &config, - std::shared_ptr mediaPipeline) const { - - return new TelmateFrameGrabberImpl(config, mediaPipeline); +TelmateFrameGrabberImplFactory::createObject (const boost::property_tree::ptree &config, std::shared_ptr mediaPipeline) const +{ + return new TelmateFrameGrabberImpl (config, mediaPipeline); } -TelmateFrameGrabberImpl::StaticConstructor - TelmateFrameGrabberImpl::staticConstructor; +TelmateFrameGrabberImpl::StaticConstructor TelmateFrameGrabberImpl::staticConstructor; -TelmateFrameGrabberImpl::StaticConstructor::StaticConstructor() { - GST_DEBUG_CATEGORY_INIT(GST_CAT_DEFAULT, GST_DEFAULT_NAME, 0, +TelmateFrameGrabberImpl::StaticConstructor::StaticConstructor() +{ + GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, GST_DEFAULT_NAME, 0, GST_DEFAULT_NAME); } -} // namespace telmat -} // namespace module -} // namespace kurento +} /* telmateframegrabber */ +} /* module */ +} /* kurento */ diff --git a/module/src/server/implementation/objects/TelmateFrameGrabberImpl.hpp b/module/src/server/implementation/objects/TelmateFrameGrabberImpl.hpp index e56c3ec..8289d51 100644 --- a/module/src/server/implementation/objects/TelmateFrameGrabberImpl.hpp +++ b/module/src/server/implementation/objects/TelmateFrameGrabberImpl.hpp @@ -8,74 +8,77 @@ #include #include #include "TelmateFrameGrabberOpenCVImpl.hpp" -#include -namespace kurento { -namespace module { -namespace telmate { +namespace kurento +{ +namespace module +{ +namespace telmateframegrabber +{ class TelmateFrameGrabberImpl; -} // namespace telmateframegrabber -} // namespace module -} // namespace kurento - -namespace kurento { -void Serialize(std::shared_ptr - &object, JsonSerializer &serializer); +} /* telmateframegrabber */ +} /* module */ } /* kurento */ -namespace kurento { +namespace kurento +{ +void Serialize (std::shared_ptr &object, JsonSerializer &serializer); +} /* kurento */ + +namespace kurento +{ class MediaPipelineImpl; } /* kurento */ -namespace kurento { -namespace module { -namespace telmate { - -class TelmateFrameGrabberImpl : - public OpenCVFilterImpl, - public virtual TelmateFrameGrabber, - public virtual TelmateFrameGrabberOpenCVImpl { - public: - TelmateFrameGrabberImpl(const - boost::property_tree::ptree &config, - std::shared_ptr mediaPipeline); - ~TelmateFrameGrabberImpl(); - - /* Next methods are automatically implemented by code generator */ - virtual bool connect(const std::string &eventType, - std::shared_ptr handler); - virtual void invoke(std::shared_ptr obj, - const std::string &methodName, const Json::Value ¶ms, - Json::Value &response); +namespace kurento +{ +namespace module +{ +namespace telmateframegrabber +{ - virtual void Serialize(JsonSerializer &serializer); +class TelmateFrameGrabberImpl : public OpenCVFilterImpl, public virtual TelmateFrameGrabber, public virtual TelmateFrameGrabberOpenCVImpl +{ +public: - void release(); - void cleanup(); + TelmateFrameGrabberImpl (const boost::property_tree::ptree &config, std::shared_ptr mediaPipeline); - int getSnapInterval(); - void setSnapInterval(int snapInterval); - void setOutputFormat(int outputFormat); - std::string getStoragePath(); - void setStoragePath(const std::string &path); - void setWebRtcEpName(const std::string &epName); + virtual ~TelmateFrameGrabberImpl () {}; - private: - GstElement *opencvfilter{}; + int getSnapInterval (); + void setSnapInterval (int snapInterval); + std::string getStoragePath (); + void setStoragePath (const std::string &path); + void setWebRtcEpName (const std::string &epName); + void setOutputFormat (int outputFormat); + int cleanup(); - class StaticConstructor { - public: - StaticConstructor(); - }; + /* Next methods are automatically implemented by code generator */ + virtual bool connect (const std::string &eventType, std::shared_ptr handler); + virtual void invoke (std::shared_ptr obj, + const std::string &methodName, const Json::Value ¶ms, + Json::Value &response); - static StaticConstructor staticConstructor; + virtual void Serialize (JsonSerializer &serializer); + +private: + + GstElement *telmateframegrabberopencvimpl{}; + TelmateFrameGrabberOpenCVImpl *pTelmateFrameGrabberOpenCVImpl; + + class StaticConstructor + { + public: + StaticConstructor(); + }; + + static StaticConstructor staticConstructor; }; -} // namespace telmate -} // namespace module -} // namespace kurento +} /* telmateframegrabber */ +} /* module */ +} /* kurento */ #endif /* __TELMATE_FRAME_GRABBER_IMPL_HPP__ */ diff --git a/module/src/server/interface/telmateframegrabber.TelmateFrameGrabber.kmd.json b/module/src/server/interface/telmateframegrabber.TelmateFrameGrabber.kmd.json index f35b3a0..ca1f593 100644 --- a/module/src/server/interface/telmateframegrabber.TelmateFrameGrabber.kmd.json +++ b/module/src/server/interface/telmateframegrabber.TelmateFrameGrabber.kmd.json @@ -16,6 +16,15 @@ ] }, "methods": [ + { + "name": "cleanup", + "doc": "clear plugin data", + "params": [ ], + "return": { + "doc": "1 for true 0 for false", + "type": "int" + } + }, { "name": "getSnapInterval", "doc": "get Snapshot interval",