ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
streammetatypeaudio.h
Go to the documentation of this file.
1
7#pragma once
9#include <adtfbase/property.h>
10#include "streamtype.h"
11
13
14namespace adtf
15{
16namespace streaming
17{
18namespace ant
19{
20
21
31{
33 static constexpr const tChar *const MetaTypeName = "adtf/audio";
34
39 static constexpr const tChar *const FormatName = "format_name";
44 static constexpr const tChar *const ChannelCount = "channel_count";
49 static constexpr const tChar *const SampleRateHz = "sample_rate_hz";
54 static constexpr const tChar *const BitsPerSample = "bits_per_sample";
59 static constexpr const tChar *const SampleCount = "sample_count";
60
66 {
67 pProperties->SetProperty(adtf::base::property<adtf_util::cString>(FormatName, ""));
68 pProperties->SetProperty(adtf::base::property<unsigned int>(ChannelCount, 0));
69 pProperties->SetProperty(adtf::base::property<unsigned int>(SampleRateHz, 0));
70 pProperties->SetProperty(adtf::base::property<unsigned int>(BitsPerSample, 0));
71 pProperties->SetProperty(adtf::base::property<unsigned int>(SampleCount, 0));
72 }
73};
74
75}
76
77namespace lucky
78{
84{
88 adtf_util::cString m_strFormatName;
92 unsigned int m_ui32ChannelCount = 0;
96 unsigned int m_ui32SampleRateHz = 0;
100 unsigned int m_ui32BitsPerSample = 0;
104 unsigned int m_ui32SampleCount = 0;
105};
106
114inline bool operator==(const tStreamAudioFormat& oLeft, const tStreamAudioFormat& oRight)
115{
116 return (oLeft.m_strFormatName == oRight.m_strFormatName)
117 && (oLeft.m_ui32BitsPerSample == oRight.m_ui32BitsPerSample)
118 && (oLeft.m_ui32ChannelCount == oRight.m_ui32ChannelCount)
119 && (oLeft.m_ui32SampleCount == oRight.m_ui32SampleCount)
120 && (oLeft.m_ui32SampleRateHz == oRight.m_ui32SampleRateHz);
121}
122
130inline bool operator!=(const tStreamAudioFormat& oLeft, const tStreamAudioFormat& oRight)
131{
132 return !(oLeft == oRight);
133}
134
135
162
189
194ADTF3_DEPRECATED("Use adtf::ucom::make_object_ptr<stream_type_audio<>>() instead!")
199
206ADTF3_DEPRECATED("Use adtf::ucom::make_object_ptr<stream_type_audio<>>(const tStreamAudioFormat&) instead!")
214
215} //namespace lucky
216
217namespace penguin
218{
226template<typename T = lucky::tStreamAudioFormat>
227class stream_type_audio : public ant::cStreamType
228{
229 static_assert(std::is_same_v<lucky::tStreamAudioFormat, T>,
230 "Currently only T=lucky::tStreamAudioFormat is possible."
231 "To support your own type you need to specialize this template stream_type_audio<T>");
232
233public:
234 stream_type_audio():
236 {
237 }
238 stream_type_audio(const T& sAudioFormat):
240 {
242 }
243};
244} // namespace penguin
245
252
253}
254}
255
256
Copyright © Audi Electronics Venture GmbH.
#define ADTF3_DEPRECATED(_depr_message_)
Mark a function or variable as deprecated.
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
Defines access methods for the interface of a Stream Type - see also Stream Type and Stream Meta Type...
virtual tResult GetMetaTypeName(base::ant::IString &&strTypeName) const =0
Get the meta type name of this instance.
Default StreamType implementation.
Definition streamtype.h:282
Generator template to create an instance of a IStreamType class for stream_meta_type_audio ("adtf/aud...
Namespace for all functionality of the ADTF Streaming SDK provided since v3.0.
tResult get_stream_type_audio_format(tStreamAudioFormat &sFormat, const IStreamType &oType)
retrievs the audio format from the properties of the stream type if meta type "adtf/audio" is set.
ucom::ant::object_ptr< ant::IStreamType > create_adtf_audio_stream_type()
Convinience functionality to create a stream type audio - see Stream Meta Type "adtf/audio".
bool operator==(const tStreamAudioFormat &oLeft, const tStreamAudioFormat &oRight)
is equal operator to compare tStreamAudioFormat
tResult set_stream_type_audio_format(IStreamType &oType, const tStreamAudioFormat &sFormat)
sets the audio format properties within the stream type if meta type "adtf/audio" is set
bool operator!=(const tStreamAudioFormat &oLeft, const tStreamAudioFormat &oRight)
is not equal operator to compare tStreamAudioFormat
Namespace for the ADTF Streaming SDK.
tResult set_property(IStreamType &oStreamType, const char *strNameOfValue, VALUETYPE oValue)
Sets the property of the given oStreamType to the value oValue.
VALUETYPE get_property(const IStreamType &oStreamType, const char *strNameOfValue, VALUETYPE oDefaultValue)
Gets the property of the given oStreamType.
object_ptr< Implementation > make_object_ptr(Args &&... args)
Create an instance of type object_ptr with Implementation as the shared resource.
Namespace for the ADTF uCOM3 SDK.
ant::iobject_ptr< T > iobject_ptr
Alias always bringing the latest version of ant::iobject_ptr into scope.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
#define adtf_string_intf(__string__)
The adtf_string_intf Macro helps to easily create a rvalue reference of a adtf::util::cString.
Use this Stream Meta Type for describing a audio stream with samples and sample rate.
static void SetProperties(const adtf::ucom::iobject_ptr< adtf::base::IProperties > &pProperties)
Sets the default properties to the given pProperties.
static constexpr const tChar *const FormatName
Name for the Property of the format name.
static constexpr const tChar *const MetaTypeName
StreamMetaTypeName for audiotype (audio stream).
static constexpr const tChar *const ChannelCount
Name for the Property for the amount of channels.
static constexpr const tChar *const BitsPerSample
Name for the Property for number of bits per sample.
static constexpr const tChar *const SampleCount
Name for the Property for number of samples.
static constexpr const tChar *const SampleRateHz
Name for the Property for the sample rate in hz.
unsigned int m_ui32BitsPerSample
bits per audio sample
unsigned int m_ui32SampleCount
audio sample count
unsigned int m_ui32SampleRateHz
audio sample rate in Hz
adtf_util::cString m_strFormatName
choose a format name.
#define THROW_IF_FAILED(s)
throws if the expression returns a failed tResult