Repository navigation
Expand file tree
/
Copy pathota_shim.cpp
More file actions
704 lines (625 loc) · 21.3 KB
/
Copy pathota_shim.cpp
File metadata and controls
704 lines (625 loc) · 21.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
/*
* If not stated otherwise in this file or this component's license file the
* following copyright and licenses apply:
*
* Copyright 2018 RDK Management
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file ota_shim.cpp
* @brief shim for dispatching UVE OTA ATSC playback
*/
#include "AampUtils.h"
#include "ota_shim.h"
#include "priv_aamp.h"
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <signal.h>
#include <assert.h>
#ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
#include <core/core.h>
#include <websocket/websocket.h>
using namespace std;
using namespace WPEFramework;
#endif
#ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
#define MEDIAPLAYER_CALLSIGN "org.rdk.MediaPlayer.1"
#define MEDIASETTINGS_CALLSIGN "org.rdk.MediaSettings.1"
#define APP_ID "MainPlayer"
#define RDKSHELL_CALLSIGN "org.rdk.RDKShell.1"
void StreamAbstractionAAMP_OTA::onPlayerStatusHandler(const JsonObject& parameters) {
std::string message;
parameters.ToString(message);
JsonObject playerData = parameters[APP_ID].Object();
AAMPLOG_TRACE( "[OTA_SHIM]%s Received event : message : %s ", __FUNCTION__, message.c_str());
/* For detailed event data, we can print or use details like
playerData["locator"].String(), playerData["length"].String(), playerData["position"].String() */
std::string currState = playerData["playerStatus"].String();
if(0 != prevState.compare(currState))
{
PrivAAMPState state = eSTATE_IDLE;
AAMPLOG_WARN( "[OTA_SHIM]%s State changed from %s to %s ", __FUNCTION__, prevState.c_str(), currState.c_str());
prevState = currState;
if(0 == currState.compare("PENDING"))
{
state = eSTATE_PREPARING;
}else if(0 == currState.compare("BLOCKED"))
{
std::string reason = playerData["blockedReason"].String();
AAMPLOG_WARN( "[OTA_SHIM]%s Received BLOCKED event from player with REASON: %s", __FUNCTION__, reason.c_str());
aamp->SendAnomalyEvent(ANOMALY_WARNING,"BLOCKED REASON:%s", reason.c_str());
aamp->SendBlockedEvent(reason);
state = eSTATE_BLOCKED;
}else if(0 == currState.compare("PLAYING"))
{
if(!tuned){
aamp->SendTunedEvent();
/* For consistency, during first tune, first move to
PREPARED state to match normal IPTV flow sequence */
aamp->SetState(eSTATE_PREPARED);
aamp->SetContentType("OTA");
tuned = true;
aamp->LogFirstFrame();
aamp->LogTuneComplete();
}
state = eSTATE_PLAYING;
}else if(0 == currState.compare("DONE"))
{
if(tuned){
tuned = false;
}
state = eSTATE_COMPLETE;
}else
{
if(0 == currState.compare("IDLE"))
{
aamp->SendAnomalyEvent(ANOMALY_WARNING, "ATSC Tuner Idle");
}else{
/* Currently plugin lists only "IDLE","ERROR","PROCESSING","PLAYING"&"DONE" */
AAMPLOG_INFO( "[OTA_SHIM]%s Unsupported state change!", __FUNCTION__);
}
/* Need not set a new state hence returning */
return;
}
aamp->SetState(state);
}
}
#endif
/**
* @brief Initialize a newly created object.
* @note To be implemented by sub classes
* @param tuneType to set type of object.
* @retval true on success
* @retval false on failure
*/
AAMPStatusType StreamAbstractionAAMP_OTA::Init(TuneType tuneType)
{
#ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
logprintf( "[OTA_SHIM]Inside %s CURL ACCESS", __FUNCTION__ );
AAMPStatusType retval = eAAMPSTATUS_OK;
#else
AAMPLOG_INFO( "[OTA_SHIM]Inside %s ", __FUNCTION__ );
prevState = "IDLE";
tuned = false;
thunderAccessObj.ActivatePlugin();
mediaSettingsObj.ActivatePlugin();
std::function<void(const WPEFramework::Core::JSON::VariantContainer&)> actualMethod = std::bind(&StreamAbstractionAAMP_OTA::onPlayerStatusHandler, this, std::placeholders::_1);
thunderAccessObj.SubscribeEvent(_T("onPlayerStatus"), actualMethod);
AAMPStatusType retval = eAAMPSTATUS_OK;
//activate RDK Shell - not required as this plugin is already activated
// thunderRDKShellObj.ActivatePlugin();
#endif
return retval;
}
/**
* @brief StreamAbstractionAAMP_OTA Constructor
* @param aamp pointer to PrivateInstanceAAMP object associated with player
* @param seek_pos Seek position
* @param rate playback rate
*/
StreamAbstractionAAMP_OTA::StreamAbstractionAAMP_OTA(class PrivateInstanceAAMP *aamp,double seek_pos, float rate)
: StreamAbstractionAAMP(aamp)
#ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
, tuned(false),
thunderAccessObj(MEDIAPLAYER_CALLSIGN),
mediaSettingsObj(MEDIASETTINGS_CALLSIGN),
thunderRDKShellObj(RDKSHELL_CALLSIGN)
#endif
{ // STUB
}
/**
* @brief StreamAbstractionAAMP_OTA Destructor
*/
StreamAbstractionAAMP_OTA::~StreamAbstractionAAMP_OTA()
{
#ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
/*
Request : {"jsonrpc":"2.0", "id":3, "method": "org.rdk.MediaPlayer.1.release", "params":{ "id":"MainPlayer", "tag" : "MyApp"} }
Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
*/
std::string id = "3";
std:: string response = aamp_PostJsonRPC(id, "org.rdk.MediaPlayer.1.release", "{\"id\":\"MainPlayer\",\"tag\" : \"MyApp\"}");
logprintf( "StreamAbstractionAAMP_OTA:%s:%d response '%s'\n", __FUNCTION__, __LINE__, response.c_str());
#else
JsonObject param;
JsonObject result;
param["id"] = APP_ID;
param["tag"] = "MyApp";
thunderAccessObj.InvokeJSONRPC("release", param, result);
thunderAccessObj.UnSubscribeEvent(_T("onPlayerStatus"));
AAMPLOG_INFO("[OTA_SHIM]StreamAbstractionAAMP_OTA Destructor called !! ");
#endif
}
/**
* @brief Starts streaming.
*/
void StreamAbstractionAAMP_OTA::Start(void)
{
std::string id = "3";
std::string response;
const char *display = getenv("WAYLAND_DISPLAY");
std::string waylandDisplay;
if( display )
{
waylandDisplay = display;
logprintf( "WAYLAND_DISPLAY: '%s'\n", display );
}
else
{
logprintf( "WAYLAND_DISPLAY: NULL!\n" );
}
std::string url = aamp->GetManifestUrl();
#ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
logprintf( "[OTA_SHIM]Inside %s CURL ACCESS\n", __FUNCTION__ );
/*
Request : {"jsonrpc": "2.0","id": 4,"method": "Controller.1.activate", "params": { "callsign": "org.rdk.MediaPlayer" }}
Response : {"jsonrpc": "2.0","id": 4,"result": null}
*/
response = aamp_PostJsonRPC(id, "Controller.1.activate", "{\"callsign\":\"org.rdk.MediaPlayer\"}" );
logprintf( "StreamAbstractionAAMP_OTA:%s:%d response '%s'\n", __FUNCTION__, __LINE__, response.c_str());
response.clear();
/*
Request : {"jsonrpc":"2.0", "id":3, "method":"org.rdk.MediaPlayer.1.create", "params":{ "id" : "MainPlayer", "tag" : "MyApp"} }
Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
*/
response = aamp_PostJsonRPC(id, "org.rdk.MediaPlayer.1.create", "{\"id\":\"MainPlayer\",\"tag\":\"MyApp\"}");
logprintf( "StreamAbstractionAAMP_OTA:%s:%d response '%s'\n", __FUNCTION__, __LINE__, response.c_str());
response.clear();
// inform (MediaRite) player instance on which wayland display it should draw the video. This MUST be set before load/play is called.
/*
Request : {"jsonrpc":"2.0", "id":3, "method":"org.rdk.MediaPlayer.1.setWaylandDisplay", "params":{"id" : "MainPlayer","display" : "westeros-123"} }
Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true} }
*/
response = aamp_PostJsonRPC( id, "org.rdk.MediaPlayer.1.setWaylandDisplay", "{\"id\":\"MainPlayer\",\"display\":\"" + waylandDisplay + "\"}" );
logprintf( "StreamAbstractionAAMP_OTA:%s:%d response '%s'\n", __FUNCTION__, __LINE__, response.c_str());
response.clear();
/*
Request : {"jsonrpc":"2.0", "id":3, "method": "org.rdk.MediaPlayer.1.load", "params":{ "id":"MainPlayer", "url":"live://...", "autoplay": true} }
Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
*/
response = aamp_PostJsonRPC(id, "org.rdk.MediaPlayer.1.load","{\"id\":\"MainPlayer\",\"url\":\""+url+"\",\"autoplay\":true}" );
logprintf( "StreamAbstractionAAMP_OTA:%s:%d response '%s'\n", __FUNCTION__, __LINE__, response.c_str());
response.clear();
/*
Request : {"jsonrpc":"2.0", "id":3, "method": "org.rdk.MediaPlayer.1.play", "params":{ "id":"MainPlayer"} }
Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
*/
// below play request harmless, but not needed, given use of autoplay above
// response = aamp_PostJsonRPC(id, "org.rdk.MediaPlayer.1.play", "{\"id\":\"MainPlayer\"}");
// logprintf( "StreamAbstractionAAMP_OTA:%s:%d response '%s'\n", __FUNCTION__, __LINE__, response.c_str());
#else
AAMPLOG_INFO( "[OTA_SHIM]Inside %s : url : %s ", __FUNCTION__ , url.c_str());
JsonObject result;
SetPreferredAudioLanguage();
JsonObject createParam;
createParam["id"] = APP_ID;
createParam["tag"] = "MyApp";
thunderAccessObj.InvokeJSONRPC("create", createParam, result);
JsonObject displayParam;
displayParam["id"] = APP_ID;
displayParam["display"] = waylandDisplay;
thunderAccessObj.InvokeJSONRPC("setWaylandDisplay", displayParam, result);
JsonObject loadParam;
loadParam["id"] = APP_ID;
loadParam["url"] = url;
loadParam["autoplay"] = true;
thunderAccessObj.InvokeJSONRPC("load", loadParam, result);
// below play request harmless, but not needed, given use of autoplay above
//JsonObject playParam;
//playParam["id"] = APP_ID;
//thunderAccessObj.InvokeJSONRPC("play", playParam, result);
#endif
}
/**
* @brief Stops streaming.
*/
void StreamAbstractionAAMP_OTA::Stop(bool clearChannelData)
{
#ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
/*
Request : {"jsonrpc":"2.0", "id":3, "method": "org.rdk.MediaPlayer.1.stop", "params":{ "id":"MainPlayer"} }
Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
*/
std::string id = "3";
std::string response = aamp_PostJsonRPC(id, "org.rdk.MediaPlayer.1.stop", "{\"id\":\"MainPlayer\"}");
logprintf( "StreamAbstractionAAMP_OTA:%s:%d response '%s'\n", __FUNCTION__, __LINE__, response.c_str());
#else
JsonObject param;
JsonObject result;
param["id"] = APP_ID;
thunderAccessObj.InvokeJSONRPC("stop", param, result);
#endif
}
#ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
bool StreamAbstractionAAMP_OTA::GetScreenResolution(int & screenWidth, int & screenHeight)
{
JsonObject param;
JsonObject result;
bool bRetVal = false;
if( thunderRDKShellObj.InvokeJSONRPC("getScreenResolution", param, result) )
{
screenWidth = result["w"].Number();
screenHeight = result["h"].Number();
AAMPLOG_INFO( "StreamAbstractionAAMP_OTA:%s:%d screenWidth:%d screenHeight:%d ",__FUNCTION__, __LINE__,screenWidth, screenHeight);
bRetVal = true;
}
return bRetVal;
}
#endif
/**
* @brief SetVideoRectangle sets the position coordinates (x,y) & size (w,h)
*
* @param[in] x,y - position coordinates of video rectangle
* @param[in] wxh - width & height of video rectangle
*/
void StreamAbstractionAAMP_OTA::SetVideoRectangle(int x, int y, int w, int h)
{
#ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
/*
Request : {"jsonrpc":"2.0", "id":3, "method": "org.rdk.MediaPlayer.1.setVideoRectangle", "params":{ "id":"MainPlayer", "x":0, "y":0, "w":1280, "h":720} }
Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
*/
std::string id = "3";
std::string response = aamp_PostJsonRPC(id, "org.rdk.MediaPlayer.1.setVideoRectangle", "{\"id\":\"MainPlayer\", \"x\":" + to_string(x) + ", \"y\":" + to_string(y) + ", \"w\":" + to_string(w) + ", \"h\":" + std::to_string(h) + "}");
logprintf( "StreamAbstractionAAMP_OTA:%s:%d response '%s'\n", __FUNCTION__, __LINE__, response.c_str());
#else
JsonObject param;
JsonObject result;
param["id"] = APP_ID;
param["x"] = x;
param["y"] = y;
param["w"] = w;
param["h"] = h;
int screenWidth = 0;
int screenHeight = 0;
if(GetScreenResolution(screenWidth,screenHeight))
{
JsonObject meta;
meta["resWidth"] = screenWidth;
meta["resHeight"] = screenHeight;
param["meta"] = meta;
}
thunderAccessObj.InvokeJSONRPC("setVideoRectangle", param, result);
#endif
}
/**
* @brief NotifyAudioTrackChange To notify audio track change.Currently not used
* as mediaplayer does not have support yet.
*
* @param[in] tracks - updated audio track info
* @param[in]
*/
void StreamAbstractionAAMP_OTA::NotifyAudioTrackChange(const std::vector<AudioTrackInfo> &tracks)
{
if ((0 != mAudioTracks.size()) && (tracks.size() != mAudioTracks.size()))
{
aamp->NotifyAudioTracksChanged();
}
return;
}
/**
* @brief Get current audio track
*
* @return int - index of current audio track
*/
std::vector<AudioTrackInfo> & StreamAbstractionAAMP_OTA::GetAvailableAudioTracks()
{
if (mAudioTrackIndex.empty())
GetAudioTracks();
return mAudioTracks;
}
/**
* @brief Get current audio track
*
* @return int - index of current audio track
*/
int StreamAbstractionAAMP_OTA::GetAudioTrack()
{
int index = -1;
if (mAudioTrackIndex.empty())
GetAudioTracks();
if (!mAudioTrackIndex.empty())
{
for (auto it = mAudioTracks.begin(); it != mAudioTracks.end(); it++)
{
if (it->index == mAudioTrackIndex)
{
index = std::distance(mAudioTracks.begin(), it);
}
}
}
return index;
}
/**
* @brief SetPreferredAudioLanguage set the preferred audio language list
*
* @param[in]
* @param[in]
*/
void StreamAbstractionAAMP_OTA::SetPreferredAudioLanguage()
{
#ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
#else
JsonObject result;
JsonObject param;
JsonObject properties;
if(aamp->preferredLanguagesList.size() > 0) {
properties["preferredAudioLanguage"] = aamp->preferredLanguagesString.c_str();
param["properties"] = properties;
mediaSettingsObj.InvokeJSONRPC("setProperties", param, result);
}
#endif
}
/**
* @brief SetAudioTrackByLanguage set the audio language
*
* @param[in] lang : Audio Language to be set
* @param[in]
*/
void StreamAbstractionAAMP_OTA::SetAudioTrackByLanguage(const char* lang)
{
#ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
#else
JsonObject param;
JsonObject result;
JsonObject properties;
int index = -1;
if(NULL != lang)
{
if(mAudioTrackIndex.empty())
GetAudioTracks();
std::vector<AudioTrackInfo>::iterator itr;
for(itr = mAudioTracks.begin(); itr != mAudioTracks.end(); itr++)
{
if(0 == strcmp(lang, itr->language.c_str()))
{
index = std::distance(mAudioTracks.begin(), itr);
memcpy(aamp->language, itr->language.c_str(),itr->language.length());
break;
}
}
}
if(-1 != index)
{
SetAudioTrack(index);
}
return;
#endif
}
/**
* @brief GetAudioTracks get the available audio tracks for the selected service / media
*
* @param[in]
* @param[in]
*/
void StreamAbstractionAAMP_OTA::GetAudioTracks()
{
#ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
#else
JsonObject param;
JsonObject result;
JsonArray attributesArray;
std::vector<AudioTrackInfo> aTracks;
std::string aTrackIdx = "";
std::string index;
std::string output;
JsonArray outputArray;
JsonObject audioData;
int i = 0,arrayCount = 0;
long bandwidth = -1;
int currentTrackPk = 0;
currentTrackPk = GetAudioTrackInternal();
attributesArray.Add("pk"); // int - Unique primary key dynamically allocated. Used for track selection.
attributesArray.Add("name"); // Name to display in the UI when doing track selection
attributesArray.Add("type"); // e,g "MPEG4_AAC" "MPEG2" etc
attributesArray.Add("description"); //Track description supplied by the content provider
attributesArray.Add("language"); //ISO 639-2 three character text language (terminology variant per DVB standard, i.e. "deu" instead of "ger")
attributesArray.Add("contentType"); // e.g "DIALOGUE" , "EMERGENCY" , "MUSIC_AND_EFFECTS" etc
attributesArray.Add("mixType"); // Signaled audio mix type - orthogonal to AudioTrackType; For example, ac3 could be either surround or stereo.e.g "STEREO" , "SURROUND_SOUND"
attributesArray.Add("isSelected"); // Is Currently selected track
param["id"] = APP_ID;
param["attributes"] = attributesArray;
thunderAccessObj.InvokeJSONRPC("getAudioTracks", param, result);
result.ToString(output);
AAMPLOG_TRACE( "[OTA_SHIM]:%s:%d audio track output : %s ", __FUNCTION__, __LINE__, output.c_str());
outputArray = result["table"].Array();
arrayCount = outputArray.Length();
for(i = 0; i < arrayCount; i++)
{
index = to_string(i);
audioData = outputArray[i].Object();
if(currentTrackPk == audioData["pk"].Number()){
aTrackIdx = to_string(i);
}
std::string languageCode;
languageCode = Getiso639map_NormalizeLanguageCode(audioData["language"].String());
aTracks.push_back(AudioTrackInfo(index, /*idx*/ languageCode,/* lang */ audioData["name"].String(), /* name*/ audioData["type"].String(), /* codecStr */ (int)audioData["pk"].Number())); //pk
}
mAudioTracks = aTracks;
mAudioTrackIndex = aTrackIdx;
return;
#endif
}
/**
* @brief GetAudioTrackInternal get the primary key for the selected audio
*
* @param[in]
* @param[in]
*/
int StreamAbstractionAAMP_OTA::GetAudioTrackInternal()
{
#ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
#else
int pk = 0;
JsonObject param;
JsonObject result;
AAMPLOG_TRACE("[OTA_SHIM]Entered %s ", __FUNCTION__);
param["id"] = APP_ID;
thunderAccessObj.InvokeJSONRPC("getAudioTrack", param, result);
pk = result["pk"].Number();
return pk;
#endif
}
/**
* @brief SetAudioTrack sets a specific audio track
*
* @param[in] Index of the audio track.
* @param[in]
*/
void StreamAbstractionAAMP_OTA::SetAudioTrack(int trackId)
{
#ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
#else
JsonObject param;
JsonObject result;
param["id"] = APP_ID;
param["trackPk"] = mAudioTracks[trackId].primaryKey;
thunderAccessObj.InvokeJSONRPC("setAudioTrack", param, result);
if (result["success"].Boolean()) {
mAudioTrackIndex = to_string(trackId);
memset(aamp->language, 0, sizeof(aamp->language));
strncpy (aamp->language, mAudioTracks[trackId].language.c_str(),mAudioTracks[trackId].language.length());
}
return;
#endif
}
/**
* @brief Stub implementation
*/
void StreamAbstractionAAMP_OTA::DumpProfiles(void)
{ // STUB
}
/**
* @brief Get output format of stream.
*
* @param[out] primaryOutputFormat - format of primary track
* @param[out] audioOutputFormat - format of audio track
*/
void StreamAbstractionAAMP_OTA::GetStreamFormat(StreamOutputFormat &primaryOutputFormat, StreamOutputFormat &audioOutputFormat)
{
primaryOutputFormat = FORMAT_ISO_BMFF;
audioOutputFormat = FORMAT_INVALID;
}
/**
* @brief Return MediaTrack of requested type
*
* @param[in] type - track type
* @retval MediaTrack pointer.
*/
MediaTrack* StreamAbstractionAAMP_OTA::GetMediaTrack(TrackType type)
{ // STUB
return NULL;
}
/**
* @brief Get current stream position.
*
* @retval current position of stream.
*/
double StreamAbstractionAAMP_OTA::GetStreamPosition()
{ // STUB
return 0.0;
}
/**
* @brief Get stream information of a profile from subclass.
*
* @param[in] idx - profile index.
* @retval stream information corresponding to index.
*/
StreamInfo* StreamAbstractionAAMP_OTA::GetStreamInfo(int idx)
{ // STUB
return NULL;
}
/**
* @brief Get PTS of first sample.
*
* @retval PTS of first sample
*/
double StreamAbstractionAAMP_OTA::GetFirstPTS()
{ // STUB
return 0.0;
}
double StreamAbstractionAAMP_OTA::GetBufferedDuration()
{ // STUB
return -1.0;
}
bool StreamAbstractionAAMP_OTA::IsInitialCachingSupported()
{ // STUB
return false;
}
/**
* @brief Get index of profile corresponds to bandwidth
* @param[in] bitrate Bitrate to lookup profile
* @retval profile index
*/
int StreamAbstractionAAMP_OTA::GetBWIndex(long bitrate)
{ // STUB
return 0;
}
/**
* @brief To get the available video bitrates.
* @ret available video bitrates
*/
std::vector<long> StreamAbstractionAAMP_OTA::GetVideoBitrates(void)
{ // STUB
return std::vector<long>();
}
/*
* @brief Gets Max Bitrate avialable for current playback.
* @ret long MAX video bitrates
*/
long StreamAbstractionAAMP_OTA::GetMaxBitrate()
{ // STUB
return 0;
}
/**
* @brief To get the available audio bitrates.
* @ret available audio bitrates
*/
std::vector<long> StreamAbstractionAAMP_OTA::GetAudioBitrates(void)
{ // STUB
return std::vector<long>();
}
/**
* @brief Stops injecting fragments to StreamSink.
*/
void StreamAbstractionAAMP_OTA::StopInjection(void)
{ // STUB - discontinuity related
}
/**
* @brief Start injecting fragments to StreamSink.
*/
void StreamAbstractionAAMP_OTA::StartInjection(void)
{ // STUB - discontinuity related
}