Skip to content

Commit

Permalink
Merge pull request #11 from Telmate/PS-2221
Browse files Browse the repository at this point in the history
fix cleanup methods, and use instance based stuff for a lot of things
  • Loading branch information
avis authored Jul 23, 2018
2 parents c4c1658 + 0efa16f commit 9ab2b47
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 119 deletions.
116 changes: 49 additions & 67 deletions module/src/server/implementation/objects/TelmateFrameGrabberImpl.cpp
Original file line number Diff line number Diff line change
@@ -1,119 +1,101 @@
/* Autogenerated with kurento-module-creator */

#include <gst/gst.h>
#include <string>
#include "MediaPipeline.hpp"
#include <TelmateFrameGrabberImplFactory.hpp>
#include "TelmateFrameGrabberImpl.hpp"
#include <jsonrpc/JsonSerializer.hpp>
#include <KurentoException.hpp>
#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> mediaPipeline) :
OpenCVFilterImpl(config,
std::dynamic_pointer_cast<MediaPipelineImpl> (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> mediaPipeline) :
OpenCVFilterImpl (config, std::dynamic_pointer_cast<MediaPipelineImpl> (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<kurento::TelmateFrameGrabberOpenCVImpl *> (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<MediaObject> 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> mediaPipeline) const {

return new TelmateFrameGrabberImpl(config, mediaPipeline);
TelmateFrameGrabberImplFactory::createObject (const boost::property_tree::ptree &config, std::shared_ptr<MediaPipeline> 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 */
107 changes: 55 additions & 52 deletions module/src/server/implementation/objects/TelmateFrameGrabberImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,74 +8,77 @@
#include <EventHandler.hpp>
#include <boost/property_tree/ptree.hpp>
#include "TelmateFrameGrabberOpenCVImpl.hpp"
#include <string>

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
<kurento::module::telmate::
TelmateFrameGrabberImpl> &object, JsonSerializer &serializer);
} /* telmateframegrabber */
} /* module */
} /* kurento */

namespace kurento {
namespace kurento
{
void Serialize (std::shared_ptr<kurento::module::telmateframegrabber::TelmateFrameGrabberImpl> &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> mediaPipeline);
~TelmateFrameGrabberImpl();

/* Next methods are automatically implemented by code generator */
virtual bool connect(const std::string &eventType,
std::shared_ptr<EventHandler> handler);
virtual void invoke(std::shared_ptr<MediaObjectImpl> obj,
const std::string &methodName, const Json::Value &params,
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> 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<EventHandler> handler);
virtual void invoke (std::shared_ptr<MediaObjectImpl> obj,
const std::string &methodName, const Json::Value &params,
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__ */
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9ab2b47

Please sign in to comment.