ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
player_intf.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <adtf_base.h>
10#include <adtf_ucom3.h>
11
12#include <map>
13
14#ifdef WIN32
15#undef GetObject
16#undef GetCurrentTime
17#endif
18
19namespace adtf
20{
21namespace services
22{
23namespace ant
24{
25
37ucom::object_ptr<IPlayer> pPlayer;
38// MIND: This call will only succeed if player is present and it will be called _AFTER_ the PlaybackService was initialized!
39if (IS_OK(get_player(pPlayer))
40{
41 if (IS_OK(pPlayer->Open("c:/temp/my_test_file.adtfdat", true)))
42 {
43 pPlayer->Play();
44 }
45}
46
48
49 * \endcode
50 *
51 * @remark Usually this Playback interface and the states of the Player does NOT depend on the Runlevel.
52 * Only the concrete implementation of the @ref section_playback_input maps it to the StreamingGraph State.
53 *
54 * @see @ref sec_streaming_graph "Streaming Graph", @ref section_playback_input
55 *
56 */
58{
59 public:
61 ADTF_IID(IPlayer, "player.ant.services.adtf.iid");
62
63 public:
64 enum tState : uint32_t
65 {
67 Closed = 0,
69 Paused = 1,
72 };
73
75 struct tEvent
76 {
77 enum tEventIds: uint32_t
78 {
83
86
90 };
91
93 uint32_t nEventId;
95 const void* pEventData;
98 };
99
102 {
103 public:
110 virtual tResult HandleStream(uint16_t ui16StreamId, const char* strStreamName) = 0;
111 };
112
123 virtual tResult Open(const char* strFileNames, bool bLoadReferencedFiles) = 0;
131 virtual tResult Close() = 0;
132
142 virtual tResult GetTimeRange(tTimeStamp& tmFirstItem, tTimeStamp& tmLastItem) const = 0;
143
150 virtual uint64_t GetChunkCount() const = 0;
151
160 virtual tResult GetCurrentFileNames(base::ant::IString&& strFileNames) const = 0;
161
169 virtual tTimeStamp GetCurrentTime() const = 0;
170
177 virtual IPlayer::tState GetCurrentState() const = 0;
178
183 virtual tResult Play() = 0;
184
189 virtual tResult Pause() = 0;
190
195 virtual tResult Reset() = 0;
196
201 virtual tResult SeekToTime(tTimeStamp tmTime) = 0;
202
207 virtual tResult SeekToChunkIndex(uint64_t ui64ChunkIndex) = 0;
208
213 virtual tResult SeekToStreamIndex(uint16_t ui16StreamId, uint64_t ui64StreamIndex) = 0;
214
219 virtual tResult ListStreams(IListStreamCallback& oCallback) = 0;
220};
221
229{
230 return _runtime->GetObject(pPlayer);
231}
232
237 public std::map<adtf::util::cString, uint16_t>
238{
239 public:
240 tResult HandleStream(uint16_t ui16StreamId, const char* strStreamName) override
241 {
242 insert({strStreamName, ui16StreamId});
244 }
245};
246
247}
248
249namespace bat
250{
251
256{
257public:
259 ADTF_IID(IPlayer, "player.bat.services.adtf.iid");
260
261public:
262
269 virtual tResult GetMarkers(adtf::base::ant::IString&& strMarkers) const = 0;
270
278 virtual tResult ExtractAttachedFiles(const char* strAdtfDatFileNames,
279 const char* strDestinationDirectory) = 0;
280};
281
286{
287 return _runtime->GetObject(pPlayer);
288}
289
290}
291
292namespace elasto
293{
294
299{
300public:
301 ADTF_IID(IPlayer, "player.elasto.remote.adtf");
302
303public:
304 enum class tLoopMode: uint32_t
305 {
312 };
313
314 enum class tStepDirection: uint32_t
315 {
320 };
321
322 enum class tStepItems: uint32_t
323 {
332 };
333
339 virtual tResult SetLoopMode(const tLoopMode& eLoopMode) = 0;
340
345 virtual tLoopMode GetLoopMode() const = 0;
346
352 virtual tResult SetPlaybackSpeed(float fPlaybackSpeed) = 0;
353
358 virtual float GetPlaybackSpeed() const = 0;
359
368 virtual tResult Step(uint64_t nSteps, tStepDirection eDirection, tStepItems eItems, bool bWait) = 0;
369
370};
371
376{
377 return _runtime->GetObject(pPlayer);
378}
379
380} // namespace elasto
381
382namespace quiet
383{
388{
389public:
391 ADTF_IID(IPlayer, "player.quiet.services.adtf.iid");
392
406 virtual tResult Open(const char* strFilenames,
407 bool bLoadReferencedFiles,
408 const char* strReaderId,
409 const adtf::base::ant::IProperties* pReaderProperties = nullptr) = 0;
410
418 virtual bool IsSeekable() const = 0;
419};
420
425{
426 return _runtime->GetObject(pPlayer);
427}
428
429}
430
431using quiet::IPlayer;
433using ant::cPlayerStreams;
434
435} // namespace services
436} // namespace adtf
#define ADTF_IID(_interface, _striid)
Common macro to enable correct treatment of interface classes by the adtf::ucom::ucom_cast<>
Definition adtf_iid.h:19
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.
Defintion of a property set container interface.
The IString interface provides methods for getting and setting strings through abstract interfaces.
Definition string_intf.h:28
virtual tResult HandleStream(uint16_t ui16StreamId, const char *strStreamName)=0
Called for every available stream.
ADTF Playback Service Control interface to control the ADTF Player.
Definition player_intf.h:58
ADTF_IID(IPlayer, "player.ant.services.adtf.iid")
Interface ID for the playback service interface.
virtual tResult Open(const char *strFileNames, bool bLoadReferencedFiles)=0
Opens one or more adtfdat files.
virtual tResult SeekToChunkIndex(uint64_t ui64ChunkIndex)=0
Control interface to seek to the given (Chunk) Index.
virtual tResult GetCurrentFileNames(base::ant::IString &&strFileNames) const =0
Information interface to get the time range of the current opened file.
virtual tResult ListStreams(IListStreamCallback &oCallback)=0
List all available streams.
virtual tResult Reset()=0
Control interface to Reset the streaming.
virtual tTimeStamp GetCurrentTime() const =0
Information interface to get the current time position of the current opened files.
@ Streaming
file is opened and streaming
Definition player_intf.h:71
@ Closed
no file is loaded
Definition player_intf.h:67
@ Paused
file is opened and playback has been paused
Definition player_intf.h:69
virtual tResult GetTimeRange(tTimeStamp &tmFirstItem, tTimeStamp &tmLastItem) const =0
Information interface to get the time range of the currently opened files.
virtual tResult SeekToTime(tTimeStamp tmTime)=0
Control interface to seek to the given (Chunk) Time.
virtual IPlayer::tState GetCurrentState() const =0
Information interface to get the current state of the Player.
virtual tResult Close()=0
Closes the current loaded files.
virtual tResult Pause()=0
Control interface to pause streaming.
virtual tResult SeekToStreamIndex(uint16_t ui16StreamId, uint64_t ui64StreamIndex)=0
Control interface to seek to the given (Stream) Index of the given stream.
virtual uint64_t GetChunkCount() const =0
Information interface to get the chunk count of the current opened files.
virtual tResult Play()=0
Control interface to start streaming.
Helper class that stores all streams from a player.
tResult HandleStream(uint16_t ui16StreamId, const char *strStreamName) override
Called for every available stream.
ADTF Playback Service Control interface to control the ADTF Player.
ADTF_IID(IPlayer, "player.bat.services.adtf.iid")
Interface ID for the playback service interface.
virtual tResult GetMarkers(adtf::base::ant::IString &&strMarkers) const =0
Get Markers.
virtual tResult ExtractAttachedFiles(const char *strAdtfDatFileNames, const char *strDestinationDirectory)=0
Extracts all attached files from the given ADTF DAT files.
ADTF Playback Service Control interface to control the ADTF Player.
virtual tLoopMode GetLoopMode() const =0
Retrieves the loop mode of the player.
virtual tResult SetPlaybackSpeed(float fPlaybackSpeed)=0
Sets the playback speed of the player.
virtual tResult Step(uint64_t nSteps, tStepDirection eDirection, tStepItems eItems, bool bWait)=0
Steps n items in given direction.
@ StreamTypes
only stream types samples are considered
@ Triggers
only triggers are considered
@ Samples
only samples are considered
@ Any
each stream item is considered
@ ChangeRunlevel
loop via a runlevel change sequence
virtual float GetPlaybackSpeed() const =0
Retrieves the current playback speed of the player.
virtual tResult SetLoopMode(const tLoopMode &eLoopMode)=0
Sets the loop mode of the player.
ADTF Playback Service Control interface to control the ADTF Player.
ADTF_IID(IPlayer, "player.quiet.services.adtf.iid")
Interface ID for the playback service interface.
virtual tResult Open(const char *strFilenames, bool bLoadReferencedFiles, const char *strReaderId, const adtf::base::ant::IProperties *pReaderProperties=nullptr)=0
Opens one or more given file with the given reader_id.
virtual bool IsSeekable() const =0
Indicates the players current capability of seeking.
Base class for every interface type within the uCOM.
Definition object_intf.h:33
Namespace for all service interfaces provided since v3.0.
tResult get_player(ucom::object_ptr< IPlayer > &pPlayer)
Gets the current registered player instance.
Namespace for all service interfaces provided since v3.1.
tResult get_player(ucom::object_ptr< IPlayer > &pPlayer)
Gets the current registered player instance.
Namespace for all service interfaces provided since v3.4.
tResult get_player(adtf::ucom::object_ptr< IPlayer > &pPlayer)
Gets the current registered player instance.
tResult get_player(adtf::ucom::object_ptr< IPlayer > &pPlayer)
Gets the current registered player instance.
Namespace for a summary of all service interfaces (System Service) provided by ADTF.
Namespace for entire ADTF SDK.
Layout of the events emitted by the playback service.
Definition player_intf.h:76
@ StartedPlaybackOfFile
The playback of a file has started The pEventData member points to a 0-terminated string that contain...
Definition player_intf.h:82
@ MarkerReached
A marker has been reached pEventData points to a string containing an XML representation of the marke...
Definition player_intf.h:89
@ EndOfStreams
The end of all streams has been reached.
Definition player_intf.h:85
size_t nEventDataSize
size of the event specific data.
Definition player_intf.h:97
const void * pEventData
pointer to the event specific data.
Definition player_intf.h:95