ADTF
Loading...
Searching...
No Matches
sample_codec_access_legacy.h
Go to the documentation of this file.
1
7#pragma once
8
12
13#include <utility>
14#include <string>
15
16namespace adtf
17{
18namespace mediadescription
19{
20namespace osborn
21{
23{
28{
29public:
34
35public:
36 #ifndef NO_ADTF_MEDIA_DESCRIPTION_LEGACY
44 ADTF3_DEPRECATED("Use adtf::mediadescription::cSampleDecoder::GetElement instead.")
45 tCodecIndex Resolve(tCodecLeafIndex nElementLeafIndex) const;
46
55 ADTF3_DEPRECATED("Use adtf::mediadescription::cSampleDecoder::GetElement instead.")
56 adtf_util::cVariant GetElementValue(tCodecLeafIndex nElementLeafIndex) const;
66 ADTF3_DEPRECATED("Use adtf::mediadescription::cSampleDecoder::GetElement instead.")
67 tResult GetElementValue(tCodecLeafIndex nElementLeafIndex, adtf_util::cVariant& oValue) const;
77 ADTF3_DEPRECATED("Use adtf::mediadescription::cSampleDecoder::GetElement instead.")
78 tResult GetElementValue(const char* strElementName, adtf_util::cVariant& oValue) const;
89 ADTF3_DEPRECATED("Use adtf::mediadescription::cSampleDecoder::GetElement instead.")
90 tResult GetElementValue(tCodecLeafIndex nElementLeafIndex, void* pValue) const;
100 ADTF3_DEPRECATED("Use adtf::mediadescription::cSampleDecoder::GetElement instead.")
101 tResult GetElementValue(const char* strElementName, void* pValue) const;
110 ADTF3_DEPRECATED("Use adtf::mediadescription::cSampleDecoder::GetElement instead.")
111 adtf_util::cString GetElementValueString(tCodecLeafIndex nElementLeafIndex) const;
121 ADTF3_DEPRECATED("Use adtf::mediadescription::cSampleDecoder::GetElement instead.")
122 tResult GetElement(tCodecLeafIndex nElementLeafIndex, const ddl::StructElement*& pElement) const;
123
132 ADTF3_DEPRECATED("Use adtf::mediadescription::cSampleDecoder::GetElement instead.")
133 const void* GetElementAddress(tCodecLeafIndex nElementLeafIndex) const;
134
141 ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleDecoder::GetElements!")
142 size_t GetElementCount() const;
143
150 static const char* GetStructElementName(const ddl::StructElement* pElement);
151
152 #endif //NO_ADTF_MEDIA_DESCRIPTION_LEGACY
153protected:
159 virtual const ddl::codec::StaticDecoder* getDecoder() const = 0;
160};
161
163namespace detail
164{
165 void set_adtf_util_variant(ddl::codec::StaticCodec* codec, const tCodecIndex& oCodecIndex, const adtf_util::cVariant& oVariant);
166 void set_adtf_util_variant(ddl::codec::Codec* codec, const tCodecIndex& oCodecIndex, const adtf_util::cVariant& oVariant);
167} // namespace detail
169
175template<typename CodecType>
177{
178public:
179 #ifndef NO_ADTF_MEDIA_DESCRIPTION_LEGACY
189 ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleCodec::GetElement!")
190 tResult SetElementValue(tCodecLeafIndex nElementLeafIndex, const adtf_util::cVariant& oValue)
191 {
192 try
193 {
194 auto oCodecIndex = getCodec()->resolve(nElementLeafIndex);
195 detail::set_adtf_util_variant(getCodec(), oCodecIndex, oValue);
197 }
198 catch(const std::exception&)
199 {
201 }
202 }
203
213 ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleCodec::GetElement!")
214 tResult SetElementValue(const char* strElementName, const adtf_util::cVariant& oValue)
215 {
216 try
217 {
218 auto oCodecIndex = getCodec()->getElement(strElementName).getIndex();
219 detail::set_adtf_util_variant(getCodec(), oCodecIndex, oValue);
221 }
222 catch (const std::exception&)
223 {
225 }
226 }
227
236 ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleCodec::GetElement!")
237 void* GetElementAddress(tCodecLeafIndex nElementLeafIndex)
238 {
239 try
240 {
241 auto oCodecIndex = getCodec()->resolve(nElementLeafIndex);
242 return getCodec()->getElementAddress(oCodecIndex);
243 }
244 catch (const std::exception&)
245 {
246 return nullptr;
247 }
248 }
249 #endif // NO_ADTF_MEDIA_DESCRIPTION_LEGACY
250
251protected:
257 virtual CodecType* getCodec() = 0;
258};
259
264{
265public:
270
271 #ifndef NO_ADTF_MEDIA_DESCRIPTION_LEGACY
279 tCodecIndex Resolve(tCodecLeafIndex nElementLeafIndex) const;
285 ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleCodecFactory::GetElements!")
286 size_t GetStaticElementCount() const;
294 ADTF3_DEPRECATED("Use @ref adtf::mediadescription::cSampleCodecFactory::GetElement!")
295 tResult GetStaticElement(tCodecLeafIndex nElementLeafIndex, const ddl::StructElement*& pElement) const;
296
302 static const char* GetStaticStructElementName(const ddl::StructElement* pElement);
309 tCodecLeafIndex FindIndex(const char* strElementName) const;
316 tCodecLeafIndex FindArrayIndex(const char* strArrayName) const;
323 tCodecLeafIndex FindStructIndex(const char* strStructName) const;
324
325 #endif // NO_ADTF_MEDIA_DESCRIPTION_LEGACY
326protected:
328 virtual const ddl::codec::CodecFactory* getFactory() const = 0;
329};
330
331} // namespace adtf_access
332} // namespace osborn
333} // namespace mediadescription
334} // namespace adtf
#define ADTF3_DEPRECATED(_depr_message_)
Definition adtf_base_deprecated.h:27
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_CURRENT_EXCEPTION()
returns the current exception as a tResult, use it in a catch block.
Definition result.h:111
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
Legacy CodecFactory API.
Definition sample_codec_access_legacy.h:264
size_t GetStaticElementCount() const
Legacy: Gets the leaf count.
tResult GetStaticElement(tCodecLeafIndex nElementLeafIndex, const ddl::StructElement *&pElement) const
virtual const ddl::codec::CodecFactory * getFactory() const =0
For internal use only.
tCodecLeafIndex FindArrayIndex(const char *strArrayName) const
Legacy: Retrieves the leaf index of the first element in the given element path.
tCodecIndex Resolve(tCodecLeafIndex nElementLeafIndex) const
tCodecLeafIndex FindStructIndex(const char *strStructName) const
Legacy: Retrieves the leaf index of the first element in the given element path.
ddl::StructElement DefinedStructElementType
type definition for the old access_element API.
Definition sample_codec_access_legacy.h:269
tCodecLeafIndex FindIndex(const char *strElementName) const
Legacy: Retrieves the leaf index of the first element in the given element path.
static const char * GetStaticStructElementName(const ddl::StructElement *pElement)
Legacy class for cSampleCodec and cStaticSampleCodec.
Definition sample_codec_access_legacy.h:177
tResult SetElementValue(tCodecLeafIndex nElementLeafIndex, const adtf_util::cVariant &oValue)
Legacy: Set the Element Value.
Definition sample_codec_access_legacy.h:190
void * GetElementAddress(tCodecLeafIndex nElementLeafIndex)
Legacy:Get the Element Address object.
Definition sample_codec_access_legacy.h:237
Definition sample_codec_access_legacy.h:28
adtf_util::cVariant GetElementValue(tCodecLeafIndex nElementLeafIndex) const
Legacy: Get the Element Value.
adtf_util::cString GetElementValueString(tCodecLeafIndex nElementLeafIndex) const
Legacy: Get the Element Value as string (resolved to the enum element name if is enum type)
const void * GetElementAddress(tCodecLeafIndex nElementLeafIndex) const
Legacy: Get the Element StructElement information.
tCodecIndex Resolve(tCodecLeafIndex nElementLeafIndex) const
ddl::StructElement DefinedStructElementType
type definition for the old access_element API.
Definition sample_codec_access_legacy.h:33
virtual const ddl::codec::StaticDecoder * getDecoder() const =0
Get the base ddl::Decoder.
static const char * GetStructElementName(const ddl::StructElement *pElement)
Legacy: Get the Struct Element Name for access_element legacy support.
tResult GetElement(tCodecLeafIndex nElementLeafIndex, const ddl::StructElement *&pElement) const
Get the Element StructElement information.
size_t GetElementCount() const
Legacy: Get the Element Leaf count.
Definition codec_factory.h:31
Definition codec.h:164
Definition static_codec.h:328
Definition static_codec.h:38
Namespace for codec usage.
Definition sample_codec_access_legacy.h:23
Namespace for all functionality of the ADTF Mediadescription SDK provided since v3....
Definition codec_sample_streamer.h:24
ddl::codec::CodecIndex tCodecIndex
Definition sample_codec_access_types.h:33
size_t tCodecLeafIndex
Definition sample_codec_access_types.h:25
Namespace for the ADTF Mediadescription SDK.
Definition codec_sample_streamer.h:22
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
definition of the ddl namespace
Definition codec.h:21
Definition struct_element.h:32