StreamDecoderImageProvider.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package VisionX::ArmarXObjects::StreamDecoderImageProvider
17 * @author Mirko Waechter ( mirko dot waechter at kit dot edu )
18 * @date 2016
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25
27
29#include <VisionX/interface/components/StreamProvider.h>
30
31extern "C"
32{
33#include <libavcodec/avcodec.h>
34#include <libswscale/swscale.h>
35}
36
37#include <mutex>
38
39class CByteImage;
40
41namespace armarx
42{
43 /**
44 * @class StreamDecoderImageProviderPropertyDefinitions
45 * @brief
46 */
49 {
50 public:
53 {
54 defineOptionalProperty<std::string>("UsedStreamProvider",
55 "StreamProvider",
56 "Names of the StreamProvider that is to be used");
58 "imageStreamTopicName", "ImageStream", "Name of the image streaming topic");
59
60 //defineRequiredProperty<std::string>("PropertyName", "Description");
61 //defineOptionalProperty<std::string>("PropertyName", "DefaultValue", "Description");
62 }
63 };
64
65 /**
66 * @defgroup Component-StreamDecoderImageProvider StreamDecoderImageProvider
67 * @ingroup VisionX-Components
68 * A description of the component StreamDecoderImageProvider.
69 *
70 * @class StreamDecoderImageProvider
71 * @ingroup Component-StreamDecoderImageProvider
72 * @brief Brief description of class StreamDecoderImageProvider.
73 *
74 * Detailed description of class StreamDecoderImageProvider.
75 */
77 virtual public visionx::ImageProvider,
78 public Stream::StreamListenerInterface
79 {
80 public:
81 /**
82 * @see armarx::ManagedIceObject::getDefaultName()
83 */
84 std::string
85 getDefaultName() const override
86 {
87 return "StreamDecoderImageProvider";
88 }
89
90 protected:
91 void onInitImageProvider() override;
92 void onConnectComponent() override;
93 void onDisconnectImageProvider() override;
94 void onExitImageProvider() override;
95
96 /**
97 * @see PropertyUser::createPropertyDefinitions()
98 */
100 // StreamListenerInterface interface
101 Stream::StreamProviderPrx streamProvider;
102 void reportNewStreamData(const Stream::DataChunk& chunk,
103 Ice::Long imageTimestamp,
104 const Ice::Current&) override;
106 AVCodec* m_decoder;
107 AVCodecContext* m_decoderContext;
109 AVFrame* m_picture;
110 AVPacket m_packet;
113 SwsContext* m_swsCtx = NULL;
115 };
116} // namespace armarx
Default component property definition container.
Definition Component.h:70
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Brief description of class StreamDecoderImageProvider.
void reportNewStreamData(const Stream::DataChunk &chunk, Ice::Long imageTimestamp, const Ice::Current &) override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onConnectComponent() override
Pure virtual hook for the subclass.
void onInitImageProvider() override
This is called when the Component::onInitComponent() is called.
void onExitImageProvider() override
This is called when the Component::onExitComponent() setup is called.
std::string getDefaultName() const override
ImageProvider abstract class defines a component which provide images via ice or shared memory.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.