ADTF
Loading...
Searching...
No Matches
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
38ucom::object_ptr<IPlayer> pPlayer;
39// MIND: This call will only succeed if player is present and it will be called _AFTER_ the PlaybackService was
40initialized! if (IS_OK(get_player(pPlayer))
41{
42 if (IS_OK(pPlayer->Open("c:/temp/my_test_file.adtfdat", true)))
43 {
44 pPlayer->Play();
45 }
46}
47
49
50 * \endcode
51 *
52 * @remark Usually this Playback interface and the states of the Player does NOT depend on the Runlevel.
53 * Only the concrete implementation of the @ref page_player maps it to the StreamingGraph State.
54 */
56{
57public:
59 ADTF_IID(IPlayer, "player.ant.services.adtf.iid");
60
61public:
62 enum tState : uint32_t
63 {
65 Closed = 0,
67 Paused = 1,
70 };
71
73 struct tEvent
74 {
75 enum tEventIds : uint32_t
76 {
81
84
88
93 };
94
96 uint32_t nEventId;
98 const void* pEventData;
101 };
102
105 {
106 public:
113 virtual tResult HandleStream(uint16_t ui16StreamId, const char* strStreamName) = 0;
114 };
115
126 virtual tResult Open(const char* strFileNames, bool bLoadReferencedFiles) = 0;
135 virtual tResult Close() = 0;
136
146 virtual tResult GetTimeRange(tTimeStamp& tmFirstItem, tTimeStamp& tmLastItem) const = 0;
147
154 virtual uint64_t GetChunkCount() const = 0;
155
164 virtual tResult GetCurrentFileNames(base::ant::IString&& strFileNames) const = 0;
165
173 virtual tTimeStamp GetCurrentTime() const = 0;
174
181 virtual IPlayer::tState GetCurrentState() const = 0;
182
187 virtual tResult Play() = 0;
188
193 virtual tResult Pause() = 0;
194
199 virtual tResult Reset() = 0;
200
205 virtual tResult SeekToTime(tTimeStamp tmTime) = 0;
206
211 virtual tResult SeekToChunkIndex(uint64_t ui64ChunkIndex) = 0;
212
217 virtual tResult SeekToStreamIndex(uint16_t ui16StreamId, uint64_t ui64StreamIndex) = 0;
218
223 virtual tResult ListStreams(IListStreamCallback& oCallback) = 0;
224};
225
233{
234 return _runtime->GetObject(pPlayer);
235}
236
240class cPlayerStreams : public IPlayer::IListStreamCallback, public std::map<adtf::util::cString, uint16_t>
241{
242public:
243 tResult HandleStream(uint16_t ui16StreamId, const char* strStreamName) override
244 {
245 insert({strStreamName, ui16StreamId});
247 }
248};
249
250} // namespace ant
251
252namespace bat
253{
254
259{
260public:
262 ADTF_IID(IPlayer, "player.bat.services.adtf.iid");
263
264public:
271 virtual tResult GetMarkers(adtf::base::ant::IString&& strMarkers) const = 0;
272
280 virtual tResult ExtractAttachedFiles(const char* strAdtfDatFileNames, const char* strDestinationDirectory) = 0;
281};
282
287{
288 return _runtime->GetObject(pPlayer);
289}
290
291} // namespace bat
292
293namespace elasto
294{
295
300{
301public:
302 ADTF_IID(IPlayer, "player.elasto.remote.adtf");
303
304public:
305 enum class tLoopMode : uint32_t
306 {
313 };
314
315 enum class tStepDirection : uint32_t
316 {
321 };
322
323 enum class tStepItems : uint32_t
324 {
333 };
334
340 virtual tResult SetLoopMode(const tLoopMode& eLoopMode) = 0;
341
346 virtual tLoopMode GetLoopMode() const = 0;
347
353 virtual tResult SetPlaybackSpeed(float fPlaybackSpeed) = 0;
354
359 virtual float GetPlaybackSpeed() const = 0;
360
369 virtual tResult Step(uint64_t nSteps, tStepDirection eDirection, tStepItems eItems, bool bWait) = 0;
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
419 virtual bool IsSeekable() const = 0;
420};
421
426{
427 return _runtime->GetObject(pPlayer);
428}
429
430} // namespace quiet
431
432using quiet::IPlayer;
434using ant::cPlayerStreams;
435
436} // namespace services
437} // namespace adtf
#define ADTF_IID(_interface, _striid)
Definition adtf_iid.h:19
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
Definition property_intf.h:213
Definition string_intf.h:29
callback for stream information
Definition player_intf.h:105
virtual tResult HandleStream(uint16_t ui16StreamId, const char *strStreamName)=0
ADTF Playback Service Control interface to control the ADTF Player.
Definition player_intf.h:56
virtual tResult GetTimeRange(tTimeStamp &tmFirstItem, tTimeStamp &tmLastItem) const =0
virtual tResult Play()=0
virtual tResult SeekToTime(tTimeStamp tmTime)=0
virtual tTimeStamp GetCurrentTime() const =0
virtual tResult Open(const char *strFileNames, bool bLoadReferencedFiles)=0
Opens one or more adtfdat files.
virtual tResult SeekToChunkIndex(uint64_t ui64ChunkIndex)=0
virtual tResult GetCurrentFileNames(base::ant::IString &&strFileNames) const =0
virtual tResult Close()=0
Closes the current loaded files.
ADTF_IID(IPlayer, "player.ant.services.adtf.iid")
Interface ID for the playback service interface.
virtual tResult SeekToStreamIndex(uint16_t ui16StreamId, uint64_t ui64StreamIndex)=0
virtual uint64_t GetChunkCount() const =0
virtual tResult Reset()=0
virtual tResult ListStreams(IListStreamCallback &oCallback)=0
virtual IPlayer::tState GetCurrentState() const =0
tState
Definition player_intf.h:63
@ Closed
no file is loaded
Definition player_intf.h:65
@ Paused
file is opened and playback has been paused
Definition player_intf.h:67
@ Streaming
file is opened and streaming
Definition player_intf.h:69
virtual tResult Pause()=0
Definition player_intf.h:241
tResult HandleStream(uint16_t ui16StreamId, const char *strStreamName) override
Definition player_intf.h:243
ADTF Playback Service Control interface to control the ADTF Player.
Definition player_intf.h:259
virtual tResult GetMarkers(adtf::base::ant::IString &&strMarkers) const =0
ADTF_IID(IPlayer, "player.bat.services.adtf.iid")
Interface ID for the playback service interface.
virtual tResult ExtractAttachedFiles(const char *strAdtfDatFileNames, const char *strDestinationDirectory)=0
ADTF Playback Service Control interface to control the ADTF Player.
Definition player_intf.h:300
virtual tResult Step(uint64_t nSteps, tStepDirection eDirection, tStepItems eItems, bool bWait)=0
tStepItems
Definition player_intf.h:324
@ StreamTypes
only stream types samples are considered
Definition player_intf.h:330
@ Triggers
only triggers are considered
Definition player_intf.h:332
@ Samples
only samples are considered
Definition player_intf.h:328
@ Any
each stream item is considered
Definition player_intf.h:326
virtual float GetPlaybackSpeed() const =0
tLoopMode
Definition player_intf.h:306
@ DontLoop
do not loop at all
Definition player_intf.h:308
@ ChangeRunlevel
loop via a runlevel change sequence
Definition player_intf.h:312
@ SeekToStart
loop via seek
Definition player_intf.h:310
tStepDirection
Definition player_intf.h:316
@ Forward
step forward
Definition player_intf.h:318
@ Backward
step backward
Definition player_intf.h:320
virtual tLoopMode GetLoopMode() const =0
virtual tResult SetPlaybackSpeed(float fPlaybackSpeed)=0
virtual tResult SetLoopMode(const tLoopMode &eLoopMode)=0
ADTF Playback Service Control interface to control the ADTF Player.
Definition player_intf.h:388
virtual bool IsSeekable() const =0
Indicates the players current capability of seeking.
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.
Definition object_intf.h:33
Definition object_ptr.h:384
Namespace for all service interfaces provided since v3.0.
Definition rpc_object_server_registry_intf.h:82
tResult get_player(ucom::object_ptr< IPlayer > &pPlayer)
Definition player_intf.h:232
tResult get_player(ucom::object_ptr< IPlayer > &pPlayer)
Definition player_intf.h:286
Namespace for all service interfaces provided since v3.4.
Definition player_intf.h:294
tResult get_player(adtf::ucom::object_ptr< IPlayer > &pPlayer)
Definition player_intf.h:375
tResult get_player(adtf::ucom::object_ptr< IPlayer > &pPlayer)
Definition player_intf.h:425
Namespace for a summary of all service interfaces provided by ADTF.
Definition rpc_object_server_registry_intf.h:80
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
Layout of the events emitted by the playback service.
Definition player_intf.h:74
const void * pEventData
pointer to the event specific data.
Definition player_intf.h:98
size_t nEventDataSize
size of the event specific data.
Definition player_intf.h:100
uint32_t nEventId
the event id.
Definition player_intf.h:96
tEventIds
Definition player_intf.h:76
@ MarkerReached
Definition player_intf.h:87
@ StartedPlaybackOfFile
Definition player_intf.h:80
@ EndOfStreams
The end of all streams has been reached.
Definition player_intf.h:83
@ StateChangeEnd
Definition player_intf.h:92