RDK Documentation (Open Sourced RDK Components)
ota_shim.cpp
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2018 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 /**
21  * @file ota_shim.cpp
22  * @brief shim for dispatching UVE OTA ATSC playback
23  */
24 
25 #include "AampUtils.h"
26 #include "ota_shim.h"
27 #include "priv_aamp.h"
28 #include <stdlib.h>
29 #include <string.h>
30 #include <pthread.h>
31 #include <signal.h>
32 #include <assert.h>
33 
34 #ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
35 
36 #include <core/core.h>
37 #include <websocket/websocket.h>
38 
39 using namespace std;
40 using namespace WPEFramework;
41 #endif
42 
43 #ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
44 
45 #define MEDIAPLAYER_CALLSIGN "org.rdk.MediaPlayer.1"
46 #define MEDIASETTINGS_CALLSIGN "org.rdk.MediaSettings.1"
47 #define APP_ID "MainPlayer"
48 
49 #define RDKSHELL_CALLSIGN "org.rdk.RDKShell.1"
50 
51 ATSCGlobalSettings gATSCSettings;
52 
53 void StreamAbstractionAAMP_OTA::onPlayerStatusHandler(const JsonObject& parameters) {
54  std::string message;
55  parameters.ToString(message);
56 
57  JsonObject playerData = parameters[APP_ID].Object();
58  AAMPLOG_TRACE( "[OTA_SHIM]Received event : message : %s ", message.c_str());
59  /* For detailed event data, we can print or use details like
60  playerData["locator"].String(), playerData["length"].String(), playerData["position"].String() */
61 
62  std::string currState = playerData["playerStatus"].String();
63  bool blockedReasonChanged = false;
64  std::string reason("");
65  if(0 == currState.compare("BLOCKED"))
66  {
67  reason = playerData["blockedReason"].String();
68  if(0 != reason.compare(prevBlockedReason))
69  {
70  blockedReasonChanged = true;
71  }
72  }
73 
74  if(0 != prevState.compare(currState) || blockedReasonChanged)
75  {
76  PrivAAMPState state = eSTATE_IDLE;
77  prevBlockedReason.clear();
78  AAMPLOG_WARN( "[OTA_SHIM] State changed from %s to %s ", prevState.c_str(), currState.c_str());
79  prevState = currState;
80  if(0 == currState.compare("PENDING"))
81  {
82  state = eSTATE_PREPARING;
83  }else if((0 == currState.compare("BLOCKED")) && (0 != reason.compare("NOT_BLOCKED")))
84  {
85  std::string ratingString;
86  JsonObject ratingObj = playerData["rating"].Object();
87  ratingObj.ToString(ratingString);
88  AAMPLOG_WARN( "[OTA_SHIM] Received BLOCKED event from player with REASON: %s Current Ratings: %s", reason.c_str(), ratingString.c_str());
89 
90  aamp->SendAnomalyEvent(ANOMALY_WARNING,"BLOCKED REASON:%s", reason.c_str());
91  aamp->SendBlockedEvent(reason);
92  state = eSTATE_BLOCKED;
93  prevBlockedReason = reason;
94  }else if(0 == currState.compare("PLAYING"))
95  {
96  if(!tuned){
97  aamp->SendTunedEvent(false);
98  /* For consistency, during first tune, first move to
99  PREPARED state to match normal IPTV flow sequence */
100  aamp->SetState(eSTATE_PREPARED);
101  tuned = true;
102  aamp->LogFirstFrame();
103  aamp->LogTuneComplete();
104  }
105  std::string ratingString;
106  JsonObject ratingObj = playerData["rating"].Object();
107  ratingObj.ToString(ratingString);
108  AAMPLOG_WARN( "[OTA_SHIM] PLAYING STATE Current Ratings : %s", ratingString.c_str());
109  state = eSTATE_PLAYING;
110  }else if(0 == currState.compare("DONE"))
111  {
112  if(tuned){
113  tuned = false;
114  }
115  state = eSTATE_COMPLETE;
116  }else
117  {
118  if(0 == currState.compare("IDLE"))
119  {
120  aamp->SendAnomalyEvent(ANOMALY_WARNING, "ATSC Tuner Idle");
121  }else{
122  /* Currently plugin lists only "IDLE","ERROR","PROCESSING","PLAYING"&"DONE" */
123  AAMPLOG_INFO( "[OTA_SHIM] Unsupported state change!");
124  }
125  /* Need not set a new state hence returning */
126  return;
127  }
128  aamp->SetState(state);
129  }
130 
131  if((0 == currState.compare("PLAYING")) || (0 == currState.compare("BLOCKED")) && 0 == reason.compare("SERVICE_PIN_LOCKED"))
132  {
133  if(PopulateMetaData(playerData))
134  {
135  SendMediaMetadataEvent();
136 
137  // genereate Notify bitrate event if video w/h is changed
138  // this is lagacy event used by factory test app to get video info
139  if( (miPrevmiVideoWidth != miVideoWidth) || (miPrevmiVideoHeight != miVideoHeight) )
140  {
141  miPrevmiVideoWidth = miVideoWidth;
142  miPrevmiVideoHeight = miVideoHeight;
143  aamp->NotifyBitRateChangeEvent(mVideoBitrate, eAAMP_BITRATE_CHANGE_BY_OTA, miVideoWidth, miVideoHeight, mFrameRate, 0, false, mVideoScanType, mAspectRatioWidth, mAspectRatioHeight);
144  }
145  }
146  }
147 
148 }
149 
150 /**
151  * @brief reads metadata properties from player status object and return true if any of data is changed
152  */
153 bool StreamAbstractionAAMP_OTA::PopulateMetaData(const JsonObject& playerData)
154 {
155  bool isDataChanged = false;
156  std::string ratingString;
157  JsonObject ratingObj = playerData["rating"].Object();
158  ratingObj.ToString(ratingString);
159 
160  if( mPCRating != ratingString )
161  {
162  AAMPLOG_INFO( "[OTA_SHIM]ratings changed : old:%s new:%s ", mPCRating.c_str(), ratingString.c_str());
163  mPCRating = ratingString;
164  isDataChanged = true;
165  }
166 
167  int tempSSI = playerData["ssi"].Number();
168 
169  if(tempSSI != mSsi)
170  {
171  AAMPLOG_INFO( "[OTA_SHIM]SSI changed : old:%d new:%d ", mSsi, tempSSI);
172  mSsi = tempSSI;
173  isDataChanged = true;
174  }
175 
176  /* Video info */
177  JsonObject videoInfoObj = playerData["videoInfo"].Object();
178 
179  VideoScanType tempScanType = (videoInfoObj["progressive"].Boolean() ? eVIDEOSCAN_PROGRESSIVE : eVIDEOSCAN_INTERLACED);
180  if(mVideoScanType != tempScanType)
181  {
182  AAMPLOG_INFO( "[OTA_SHIM]Scan type changed : old:%d new:%d ", mVideoScanType, tempScanType);
183  isDataChanged = true;
184  mVideoScanType = tempScanType;
185  }
186 
187  float tempframeRate = 0.0;
188  float frameRateN = static_cast<float> (videoInfoObj["frameRateN"].Number());
189  float frameRateD = static_cast<float> (videoInfoObj["frameRateD"].Number());
190  if((0 != frameRateN) && (0 != frameRateD))
191  {
192  tempframeRate = frameRateN / frameRateD;
193 
194  if( mFrameRate != tempframeRate)
195  {
196  AAMPLOG_INFO( "[OTA_SHIM] mFrameRate changed : old:%f new:%f ", mFrameRate, tempframeRate);
197  isDataChanged = true;
198  mFrameRate = tempframeRate;
199  }
200  }
201 
202  int tempAspectRatioWidth = videoInfoObj["aspectRatioWidth"].Number();
203  if( tempAspectRatioWidth != mAspectRatioWidth)
204  {
205  isDataChanged = true;
206  AAMPLOG_INFO( "[OTA_SHIM] mAspectRatioWidth changed : old:%d new:%d ", mAspectRatioWidth, tempAspectRatioWidth);
207  mAspectRatioWidth = tempAspectRatioWidth;
208  }
209 
210  int tempAspectRatioHeight = videoInfoObj["aspectRatioHeight"].Number();
211  if( mAspectRatioHeight != tempAspectRatioHeight)
212  {
213  AAMPLOG_INFO( "[OTA_SHIM] tempAspectRatioHeight : old:%d new:%d ", mAspectRatioHeight, tempAspectRatioHeight);
214  isDataChanged = true;
215  mAspectRatioHeight = tempAspectRatioHeight;
216  }
217 
218  int tempVideoWidth = videoInfoObj["width"].Number();
219  if( miVideoWidth != tempVideoWidth)
220  {
221  AAMPLOG_INFO( "[OTA_SHIM] miVideoWidth : old:%d new:%d ", miVideoWidth, tempVideoWidth);
222  miVideoWidth = tempVideoWidth;
223  isDataChanged = true;
224  }
225 
226  int tempVideoHeight = videoInfoObj["height"].Number();
227  if( miVideoHeight != tempVideoHeight)
228  {
229  AAMPLOG_INFO( "[OTA_SHIM] miVideoHeight : old:%d new:%d ", miVideoHeight, tempVideoHeight);
230  miVideoHeight = tempVideoHeight;
231  isDataChanged = true;
232  }
233 
234  std::string tempVideoCodec = videoInfoObj["codec"].String();
235  if(0 != mVideoCodec.compare(tempVideoCodec))
236  {
237  AAMPLOG_INFO( "[OTA_SHIM] mVideoCodec : old:%s new:%s ", mVideoCodec.c_str(), tempVideoCodec.c_str());
238  mVideoCodec = tempVideoCodec;
239  isDataChanged = true;
240  }
241 
242  mHdrType = videoInfoObj["hdrType"].String();
243 
244  /* Audio Info */
245  JsonObject audioInfoObj = playerData["audioInfo"].Object();
246 
247  std::string tempAudioCodec = audioInfoObj["codec"].String();
248  if(0 != mAudioCodec.compare(tempAudioCodec))
249  {
250  AAMPLOG_INFO( "[OTA_SHIM] tempAudioCodec : old:%s new:%s ", mAudioCodec.c_str(), mAudioCodec.c_str());
251  mAudioCodec = tempAudioCodec;
252  isDataChanged = true;
253  }
254 
255  std::string tempAudioMixType = audioInfoObj["mixType"].String();
256  if(0 != mAudioMixType.compare(tempAudioMixType))
257  {
258  AAMPLOG_INFO( "[OTA_SHIM] tempAudioMixType : old:%s new:%s ", mAudioMixType.c_str(), tempAudioMixType.c_str());
259  mAudioMixType = tempAudioMixType;
260  isDataChanged = true;
261  }
262 
263  bool tempIsAtmos = audioInfoObj["isAtmos"].Boolean();
264 
265  if( mIsAtmos != tempIsAtmos)
266  {
267  AAMPLOG_INFO( "[OTA_SHIM] -- mIsAtmos : old:%d new:%d ", mIsAtmos, tempIsAtmos);
268  mIsAtmos = tempIsAtmos;
269  isDataChanged = true;
270  }
271 
272  if( isDataChanged )
273  {
274  mVideoBitrate = videoInfoObj["bitrate"].Number();
275  mAudioBitrate = audioInfoObj["bitrate"].Number();
276  }
277 
278  return isDataChanged;
279 }
280 
281 
282 void StreamAbstractionAAMP_OTA::SendMediaMetadataEvent()
283 {
284  if(aamp->IsEventListenerAvailable(AAMP_EVENT_MEDIA_METADATA))
285  {
286  MediaMetadataEventPtr event = std::make_shared<MediaMetadataEvent>(-1/*duration*/, miVideoWidth, miVideoHeight, false/*hasDrm*/,true/*isLive*/, ""/*drmtype*/, -1/*programStartTime*/);
287 
288  // This is video bitrate
289  event->addBitrate(mVideoBitrate);
290  event->addSupportedSpeed(1);
291  event->SetVideoMetaData(mFrameRate,mVideoScanType,mAspectRatioWidth,mAspectRatioHeight, mVideoCodec, mHdrType, mPCRating,mSsi);
292  event->SetAudioMetaData(mAudioCodec,mAudioMixType,mIsAtmos);
293  event->addAudioBitrate(mAudioBitrate);
294  aamp->SendEvent(event,AAMP_EVENT_ASYNC_MODE);
295  }
296 }
297 
298 #endif
299 
300 /**
301  * @brief Initialize a newly created object.
302  */
304 {
305 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
306  AAMPLOG_WARN( "[OTA_SHIM]Inside CURL ACCESS" );
308 #else
309  AAMPLOG_INFO("[OTA_SHIM]Inside" );
310  prevState = "IDLE";
311 
312  //initialize few veriables, it will invalidate mediametadata/Notifybitrate events
313  miVideoWidth = 0;
314  miVideoHeight = 0;
315  miPrevmiVideoWidth = 0;
316  miPrevmiVideoHeight = 0;
317 
318  prevBlockedReason = "";
319  tuned = false;
320 
321  aamp->SetContentType("OTA");
322 
323  thunderAccessObj.ActivatePlugin();
324  mediaSettingsObj.ActivatePlugin();
325  std::function<void(const WPEFramework::Core::JSON::VariantContainer&)> actualMethod = std::bind(&StreamAbstractionAAMP_OTA::onPlayerStatusHandler, this, std::placeholders::_1);
326 
327  //mEventSubscribed flag updated for tracking event subscribtion
328  mEventSubscribed = thunderAccessObj.SubscribeEvent(_T("onPlayerStatus"), actualMethod);
329 
331 
332  //activate RDK Shell - not required as this plugin is already activated
333  // thunderRDKShellObj.ActivatePlugin();
334 
335 #endif
336  return retval;
337 }
338 
339 /**
340  * @brief StreamAbstractionAAMP_OTA Constructor
341  */
343  : StreamAbstractionAAMP(logObj, aamp)
344 #ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
345  , tuned(false),mEventSubscribed(false),
346  thunderAccessObj(MEDIAPLAYER_CALLSIGN, logObj),
347  mediaSettingsObj(MEDIASETTINGS_CALLSIGN, logObj),
348  thunderRDKShellObj(RDKSHELL_CALLSIGN,logObj),
349  mPCRating(),mSsi(-1),mFrameRate(0),mVideoScanType(eVIDEOSCAN_UNKNOWN),mAspectRatioWidth(0),mAspectRatioHeight(0),
350  mVideoCodec(),mHdrType(),mAudioBitrate(0),mAudioCodec(),mAudioMixType(),mIsAtmos(false),
351  miVideoWidth(0),miVideoHeight(0),miPrevmiVideoWidth(0),miPrevmiVideoHeight(0)
352 #endif
353 { // STUB
354 }
355 
356 /**
357  * @brief StreamAbstractionAAMP_OTA Distructor
358  */
360 {
361 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
362  /*
363  Request : {"jsonrpc":"2.0", "id":3, "method": "org.rdk.MediaPlayer.1.release", "params":{ "id":"MainPlayer", "tag" : "MyApp"} }
364  Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
365  */
366  std::string id = "3";
367  std:: string response = aamp_PostJsonRPC(id, "org.rdk.MediaPlayer.1.release", "{\"id\":\"MainPlayer\",\"tag\" : \"MyApp\"}");
368  AAMPLOG_WARN( "StreamAbstractionAAMP_OTA: response '%s'", response.c_str());
369 #else
370  JsonObject param;
371  JsonObject result;
372  param["id"] = APP_ID;
373  param["tag"] = "MyApp";
374  thunderAccessObj.InvokeJSONRPC("release", param, result);
375 
376  // unsubscribing only if subscribed
377  if (mEventSubscribed)
378  {
379  thunderAccessObj.UnSubscribeEvent(_T("onPlayerStatus"));
380  mEventSubscribed = false;
381  }
382  else
383  {
384  AAMPLOG_WARN("[OTA_SHIM]OTA Destructor finds Player Status Event not Subscribed !! ");
385  }
386 
387  AAMPLOG_INFO("[OTA_SHIM]StreamAbstractionAAMP_OTA Destructor called !! ");
388 #endif
389 }
390 
391 /**
392  * @brief Starts streaming.
393  */
395 {
396  std::string id = "3";
397  std::string response;
398  const char *display = getenv("WAYLAND_DISPLAY");
399  std::string waylandDisplay;
400  if( display )
401  {
402  waylandDisplay = display;
403  AAMPLOG_WARN( "WAYLAND_DISPLAY: '%s'", display );
404  }
405  else
406  {
407  AAMPLOG_WARN( "WAYLAND_DISPLAY: NULL!" );
408  }
409  std::string url = aamp->GetManifestUrl();
410 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
411  AAMPLOG_WARN( "[OTA_SHIM]Inside CURL ACCESS");
412  /*
413  Request : {"jsonrpc": "2.0","id": 4,"method": "Controller.1.activate", "params": { "callsign": "org.rdk.MediaPlayer" }}
414  Response : {"jsonrpc": "2.0","id": 4,"result": null}
415  */
416  response = aamp_PostJsonRPC(id, "Controller.1.activate", "{\"callsign\":\"org.rdk.MediaPlayer\"}" );
417  AAMPLOG_WARN( "StreamAbstractionAAMP_OTA: response '%s'", response.c_str());
418  response.clear();
419  /*
420  Request : {"jsonrpc":"2.0", "id":3, "method":"org.rdk.MediaPlayer.1.create", "params":{ "id" : "MainPlayer", "tag" : "MyApp"} }
421  Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
422  */
423  response = aamp_PostJsonRPC(id, "org.rdk.MediaPlayer.1.create", "{\"id\":\"MainPlayer\",\"tag\":\"MyApp\"}");
424  AAMPLOG_WARN( "StreamAbstractionAAMP_OTA: response '%s'", response.c_str());
425  response.clear();
426  // inform (MediaRite) player instance on which wayland display it should draw the video. This MUST be set before load/play is called.
427  /*
428  Request : {"jsonrpc":"2.0", "id":3, "method":"org.rdk.MediaPlayer.1.setWaylandDisplay", "params":{"id" : "MainPlayer","display" : "westeros-123"} }
429  Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true} }
430  */
431  response = aamp_PostJsonRPC( id, "org.rdk.MediaPlayer.1.setWaylandDisplay", "{\"id\":\"MainPlayer\",\"display\":\"" + waylandDisplay + "\"}" );
432  AAMPLOG_WARN( "StreamAbstractionAAMP_OTA: response '%s'", response.c_str());
433  response.clear();
434  /*
435  Request : {"jsonrpc":"2.0", "id":3, "method": "org.rdk.MediaPlayer.1.load", "params":{ "id":"MainPlayer", "url":"live://...", "autoplay": true} }
436  Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
437  */
438  response = aamp_PostJsonRPC(id, "org.rdk.MediaPlayer.1.load","{\"id\":\"MainPlayer\",\"url\":\""+url+"\",\"autoplay\":true}" );
439  AAMPLOG_WARN( "StreamAbstractionAAMP_OTA: response '%s'", response.c_str());
440  response.clear();
441  /*
442  Request : {"jsonrpc":"2.0", "id":3, "method": "org.rdk.MediaPlayer.1.play", "params":{ "id":"MainPlayer"} }
443  Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
444  */
445 
446  // below play request harmless, but not needed, given use of autoplay above
447  // response = aamp_PostJsonRPC(id, "org.rdk.MediaPlayer.1.play", "{\"id\":\"MainPlayer\"}");
448  // AAMPLOG_WARN( "StreamAbstractionAAMP_OTA: response '%s'", response.c_str());
449 
450 #else
451  AAMPLOG_INFO( "[OTA_SHIM] url : %s ", url.c_str());
452  JsonObject result;
453 
455 
456  JsonObject createParam;
457  createParam["id"] = APP_ID;
458  createParam["tag"] = "MyApp";
459  thunderAccessObj.InvokeJSONRPC("create", createParam, result);
460 
461  JsonObject displayParam;
462  displayParam["id"] = APP_ID;
463  displayParam["display"] = waylandDisplay;
464  thunderAccessObj.InvokeJSONRPC("setWaylandDisplay", displayParam, result);
465 
466  JsonObject loadParam;
467  loadParam["id"] = APP_ID;
468  loadParam["url"] = url;
469  loadParam["autoplay"] = true;
470  thunderAccessObj.InvokeJSONRPC("load", loadParam, result);
471 
472  // below play request harmless, but not needed, given use of autoplay above
473  //JsonObject playParam;
474  //playParam["id"] = APP_ID;
475  //thunderAccessObj.InvokeJSONRPC("play", playParam, result);
476 #endif
477 }
478 
479 /**
480  * @brief Stops streaming.
481  */
482 void StreamAbstractionAAMP_OTA::Stop(bool clearChannelData)
483 {
484  /*StreamAbstractionAAMP::Stop is being called twice
485  PrivateInstanceAAMP::Stop calls Stop with clearChannelData set to true
486  PrivateInstanceAAMP::TeardownStream calls Stop with clearChannelData set to false
487  Hence avoiding the Stop with clearChannelData set to false*/
488  if(!clearChannelData)
489  return;
490 
491 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
492  /*
493  Request : {"jsonrpc":"2.0", "id":3, "method": "org.rdk.MediaPlayer.1.stop", "params":{ "id":"MainPlayer"} }
494  Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
495  */
496  std::string id = "3";
497  std::string response = aamp_PostJsonRPC(id, "org.rdk.MediaPlayer.1.stop", "{\"id\":\"MainPlayer\"}");
498  AAMPLOG_WARN( "StreamAbstractionAAMP_OTA: response '%s'", response.c_str());
499 #else
500  JsonObject param;
501  JsonObject result;
502  param["id"] = APP_ID;
503  thunderAccessObj.InvokeJSONRPC("stop", param, result);
504 #endif
505 }
506 
507 #ifdef USE_CPP_THUNDER_PLUGIN_ACCESS
508 
509 bool StreamAbstractionAAMP_OTA::GetScreenResolution(int & screenWidth, int & screenHeight)
510 {
511  JsonObject param;
512  JsonObject result;
513  bool bRetVal = false;
514 
515  if( thunderRDKShellObj.InvokeJSONRPC("getScreenResolution", param, result) )
516  {
517  screenWidth = result["w"].Number();
518  screenHeight = result["h"].Number();
519  AAMPLOG_INFO( "StreamAbstractionAAMP_OTA: screenWidth:%d screenHeight:%d ",screenWidth, screenHeight);
520  bRetVal = true;
521  }
522  return bRetVal;
523 }
524 #endif
525 
526 /**
527  * @brief SetVideoRectangle sets the position coordinates (x,y) & size (w,h)
528  */
529 void StreamAbstractionAAMP_OTA::SetVideoRectangle(int x, int y, int w, int h)
530 {
531 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
532  /*
533  Request : {"jsonrpc":"2.0", "id":3, "method": "org.rdk.MediaPlayer.1.setVideoRectangle", "params":{ "id":"MainPlayer", "x":0, "y":0, "w":1280, "h":720} }
534  Response: { "jsonrpc":"2.0", "id":3, "result": { "success": true } }
535  */
536  std::string id = "3";
537  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) + "}");
538  AAMPLOG_WARN( "StreamAbstractionAAMP_OTA: response '%s'", response.c_str());
539 #else
540  JsonObject param;
541  JsonObject result;
542  param["id"] = APP_ID;
543  param["x"] = x;
544  param["y"] = y;
545  param["w"] = w;
546  param["h"] = h;
547  int screenWidth = 0;
548  int screenHeight = 0;
549  if(GetScreenResolution(screenWidth,screenHeight))
550  {
551  JsonObject meta;
552  meta["resWidth"] = screenWidth;
553  meta["resHeight"] = screenHeight;
554  param["meta"] = meta;
555  }
556 
557  thunderAccessObj.InvokeJSONRPC("setVideoRectangle", param, result);
558 #endif
559 }
560 
561 /**
562  * @brief NotifyAudioTrackChange To notify audio track change.Currently not used
563  * as mediaplayer does not have support yet.
564  */
565 void StreamAbstractionAAMP_OTA::NotifyAudioTrackChange(const std::vector<AudioTrackInfo> &tracks)
566 {
567  if ((0 != mAudioTracks.size()) && (tracks.size() != mAudioTracks.size()))
568  {
570  }
571  return;
572 }
573 
574 /**
575  * @brief Get the list of available audio tracks
576  */
577 std::vector<AudioTrackInfo> & StreamAbstractionAAMP_OTA::GetAvailableAudioTracks(bool allTrack)
578 {
579  if (mAudioTrackIndex.empty())
580  GetAudioTracks();
581 
582  return mAudioTracks;
583 }
584 
585 /**
586  * @brief Get current audio track
587  */
589 {
590  int index = -1;
591  if (mAudioTrackIndex.empty())
592  GetAudioTracks();
593 
594  if (!mAudioTrackIndex.empty())
595  {
596  for (auto it = mAudioTracks.begin(); it != mAudioTracks.end(); it++)
597  {
598  if (it->index == mAudioTrackIndex)
599  {
600  index = std::distance(mAudioTracks.begin(), it);
601  }
602  }
603  }
604  return index;
605 }
606 
607 /**
608  * @brief Get current audio track
609  */
611 {
612  int index = -1;
613  bool bFound = false;
614  if (mAudioTrackIndex.empty())
615  GetAudioTracks();
616 
617  if (!mAudioTrackIndex.empty())
618  {
619  for (auto it = mAudioTracks.begin(); it != mAudioTracks.end(); it++)
620  {
621  if (it->index == mAudioTrackIndex)
622  {
623  audioTrack = *it;
624  bFound = true;
625  }
626  }
627  }
628  return bFound;
629 }
630 
631 /**
632  * @brief SetPreferredAudioLanguages set the preferred audio language list
633  */
635 {
636 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
637 #else
638  JsonObject properties;
639  bool modifiedLang = false;
640  bool modifiedRend = false;
641  //AAMPLOG_WARN( "[OTA_SHIM]aamp->preferredLanguagesString : %s, gATSCSettings.preferredLanguages : %s aamp->preferredRenditionString : %s gATSCSettings.preferredRendition : %s", aamp->preferredLanguagesString.c_str(),gATSCSettings.preferredLanguages.c_str(), aamp->preferredRenditionString.c_str(), gATSCSettings.preferredRendition.c_str());fflush(stdout);
642 
643  if((0 != aamp->preferredLanguagesString.length()) && (aamp->preferredLanguagesString != gATSCSettings.preferredLanguages)){
644  properties["preferredAudioLanguage"] = aamp->preferredLanguagesString.c_str();
645  modifiedLang = true;
646  }
647  if((0 != aamp->preferredRenditionString.length()) && (aamp->preferredRenditionString != gATSCSettings.preferredRendition)){
648 
649  if(0 == aamp->preferredRenditionString.compare("VISUALLY_IMPAIRED")){
650  properties["visuallyImpaired"] = true;
651  modifiedRend = true;
652  }else if(0 == aamp->preferredRenditionString.compare("NORMAL")){
653  properties["visuallyImpaired"] = false;
654  modifiedRend = true;
655  }else{
656  /*No rendition settings to MediaSettings*/
657  }
658  }
659  if(modifiedLang || modifiedRend)
660  {
661  bool rpcResult = false;
662  JsonObject result;
663  JsonObject param;
664 
665  param["properties"] = properties;
666  rpcResult = mediaSettingsObj.InvokeJSONRPC("setProperties", param, result);
667  if (rpcResult){
668  if (!result["success"].Boolean()){
669  std::string responseStr;
670  result.ToString(responseStr);
671  AAMPLOG_WARN( "[OTA_SHIM] setProperties API failed result:%s", responseStr.c_str());
672  }else{
673  std::string paramStr;
674  param.ToString(paramStr);
675  AAMPLOG_WARN( "[OTA_SHIM] setProperties success with param:%s", paramStr.c_str());
676  /*Thunder call success save global settings*/
677  if(modifiedLang){
678  gATSCSettings.preferredLanguages = aamp->preferredLanguagesString;
679  }
680  if(modifiedRend){
681  gATSCSettings.preferredRendition = aamp->preferredRenditionString;
682  }
683  }
684  }
685  }
686 #endif
687 }
688 
689 /**
690  * @brief SetAudioTrackByLanguage set the audio language
691  */
693 {
694 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
695 #else
696  JsonObject param;
697  JsonObject result;
698  JsonObject properties;
699  int index = -1;
700 
701  if(NULL != lang)
702  {
703  if(mAudioTrackIndex.empty())
704  GetAudioTracks();
705 
706  std::vector<AudioTrackInfo>::iterator itr;
707  for(itr = mAudioTracks.begin(); itr != mAudioTracks.end(); itr++)
708  {
709  if(0 == strcmp(lang, itr->language.c_str()))
710  {
711  index = std::distance(mAudioTracks.begin(), itr);
712  break;
713  }
714  }
715  }
716  if(-1 != index)
717  {
718  SetAudioTrack(index);
719  }
720  return;
721 #endif
722 }
723 
724 /**
725  * @brief GetAudioTracks get the available audio tracks for the selected service / media
726  */
728 {
729 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
730 #else
731  JsonObject param;
732  JsonObject result;
733  JsonArray attributesArray;
734  std::vector<AudioTrackInfo> aTracks;
735  std::string aTrackIdx = "";
736  std::string index;
737  std::string output;
738  JsonArray outputArray;
739  JsonObject audioData;
740  int i = 0,arrayCount = 0;
741  long bandwidth = -1;
742  int currentTrackPk = 0;
743 
744  currentTrackPk = GetAudioTrackInternal();
745 
746  attributesArray.Add("pk"); // int - Unique primary key dynamically allocated. Used for track selection.
747  attributesArray.Add("name"); // Name to display in the UI when doing track selection
748  attributesArray.Add("type"); // e,g "MPEG4_AAC" "MPEG2" etc
749  attributesArray.Add("description"); //Track description supplied by the content provider
750  attributesArray.Add("language"); //ISO 639-2 three character text language (terminology variant per DVB standard, i.e. "deu" instead of "ger")
751  attributesArray.Add("contentType"); // e.g "DIALOGUE" , "EMERGENCY" , "MUSIC_AND_EFFECTS" etc
752  attributesArray.Add("mixType"); // Signaled audio mix type - orthogonal to AudioTrackType; For example, ac3 could be either surround or stereo.e.g "STEREO" , "SURROUND_SOUND"
753  attributesArray.Add("isSelected"); // Is Currently selected track
754 
755  param["id"] = APP_ID;
756  param["attributes"] = attributesArray;
757 
758  thunderAccessObj.InvokeJSONRPC("getAudioTracks", param, result);
759 
760  result.ToString(output);
761  AAMPLOG_TRACE( "[OTA_SHIM]:audio track output : %s ", output.c_str());
762  outputArray = result["table"].Array();
763  arrayCount = outputArray.Length();
764 
765  for(i = 0; i < arrayCount; i++)
766  {
767  index = to_string(i);
768  audioData = outputArray[i].Object();
769 
770  if(currentTrackPk == audioData["pk"].Number()){
771  aTrackIdx = to_string(i);
772  }
773 
774  std::string languageCode;
775  languageCode = Getiso639map_NormalizeLanguageCode(audioData["language"].String(),aamp->GetLangCodePreference());
776  aTracks.push_back(AudioTrackInfo(index, /*idx*/ languageCode, /*lang*/ audioData["contentType"].String(), /*rend*/ audioData["name"].String(), /*name*/ audioData["type"].String(), /*codecStr*/ (int)audioData["pk"].Number(), /*primaryKey*/ audioData["contentType"].String(), /*contentType*/ audioData["mixType"].String() /*mixType*/));
777  }
778 
779  mAudioTracks = aTracks;
780  mAudioTrackIndex = aTrackIdx;
781  return;
782 #endif
783 }
784 
785 
786 /**
787  * @brief GetAudioTrackInternal get the primary key for the selected audio
788  */
790 {
791 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
792  return 0;
793 #else
794  int pk = 0;
795  JsonObject param;
796  JsonObject result;
797 
798  AAMPLOG_TRACE("[OTA_SHIM]Entered ");
799  param["id"] = APP_ID;
800  thunderAccessObj.InvokeJSONRPC("getAudioTrack", param, result);
801  pk = result["pk"].Number();
802  return pk;
803 #endif
804 }
805 
806 /**
807  * @brief SetAudioTrack sets a specific audio track
808  */
810 {
811 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
812 #else
813  JsonObject param;
814  JsonObject result;
815 
816  param["id"] = APP_ID;
817 
818  param["trackPk"] = mAudioTracks[trackId].primaryKey;
819 
820  thunderAccessObj.InvokeJSONRPC("setAudioTrack", param, result);
821  if (result["success"].Boolean()) {
822  mAudioTrackIndex = to_string(trackId);
823  }
824  return;
825 #endif
826 }
827 
828 /**
829  * @brief Get the list of available text tracks
830  */
831 std::vector<TextTrackInfo> & StreamAbstractionAAMP_OTA::GetAvailableTextTracks(bool all)
832 {
833  AAMPLOG_TRACE("[OTA_SHIM]");
834  if (mTextTracks.empty())
835  GetTextTracks();
836 
837  return mTextTracks;
838 }
839 
840 /**
841  * @brief GetTextTracks get the available text tracks for the selected service / media
842  */
844 {
845  AAMPLOG_TRACE("[OTA_SHIM]");
846 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
847 #else
848  JsonObject param;
849  JsonObject result;
850  JsonArray attributesArray;
851  std::vector<TextTrackInfo> txtTracks;
852  std::string output;
853  JsonArray outputArray;
854  JsonObject textData;
855  int arrayCount = 0;
856 
857  attributesArray.Add("pk"); // int - Unique primary key dynamically allocated. Used for track selection.
858  attributesArray.Add("name"); // Name to display in the UI when doing track selection
859  attributesArray.Add("type"); // Specific track type for the track - "CC" for ATSC Closed caption
860  attributesArray.Add("description"); //Track description supplied by the content provider
861  attributesArray.Add("language"); //ISO 639-2 three character text language
862  attributesArray.Add("contentType"); // Track content type e.g "HEARING_IMPAIRED", "EASY_READER"
863  attributesArray.Add("ccServiceNumber"); // Set to 1-63 for 708 CC Subtitles and 0 for 608
864  attributesArray.Add("isSelected"); // Is Currently selected track
865  attributesArray.Add("ccTypeIs708"); // Is 708 cc track
866  attributesArray.Add("ccType"); // Actual cc track type
867 
868  param["id"] = APP_ID;
869  param["attributes"] = attributesArray;
870 
871  thunderAccessObj.InvokeJSONRPC("getSubtitleTracks", param, result);
872 
873  result.ToString(output);
874  AAMPLOG_TRACE( "[OTA_SHIM]:text track output : %s ", output.c_str());
875  outputArray = result["table"].Array();
876  arrayCount = outputArray.Length();
877 
878  std::string txtTrackIdx = "";
879  std::string instreamId;
880  int ccIndex = 0;
881 
882  for(int i = 0; i < arrayCount; i++)
883  {
884  std::string trackType;
885  textData = outputArray[i].Object();
886  trackType = textData["type"].String();
887  if(0 == trackType.compare("CC"))
888  {
889 
890  std::string empty;
891  std::string index = std::to_string(ccIndex++);
892  std::string serviceNo;
893  int ccServiceNumber = -1;
894  std::string languageCode = Getiso639map_NormalizeLanguageCode(textData["language"].String(),aamp->GetLangCodePreference());
895 
896  ccServiceNumber = textData["ccServiceNumber"].Number();
897  /*Plugin info : ccServiceNumber int Set to 1-63 for 708 CC Subtitles and 1-4 for 608/TEXT*/
898  if(textData["ccType"].String() == std::string{"CC708"})
899  {
900  if((ccServiceNumber >= 1) && (ccServiceNumber <= 63))
901  {
902  /*708 CC*/
903  serviceNo = "SERVICE";
904  serviceNo.append(std::to_string(ccServiceNumber));
905  }
906  else
907  {
908  AAMPLOG_WARN( "[OTA_SHIM]:unexpected text track for 708 CC");
909  }
910  }
911  else if(textData["ccType"].String() == std::string{"CC608"})
912  {
913  if((ccServiceNumber >= 1) && (ccServiceNumber <= 4))
914  {
915  /*608 CC*/
916  serviceNo = "CC";
917  serviceNo.append(std::to_string(ccServiceNumber));
918  }
919  else
920  {
921  AAMPLOG_WARN( "[OTA_SHIM]:unexpected text track for 608 CC");
922  }
923  }
924  else if(textData["ccType"].String() == std::string{"TEXT"})
925  {
926  if((ccServiceNumber >= 1) && (ccServiceNumber <= 4))
927  {
928  /*TEXT CC*/
929  serviceNo = "TXT";
930  serviceNo.append(std::to_string(ccServiceNumber));
931  }
932  else
933  {
934  AAMPLOG_WARN( "[OTA_SHIM]:unexpected text track for TEXT CC");
935  }
936  }
937  else
938  {
939  AAMPLOG_WARN( "[OTA_SHIM]:unexpected ccType: '%s'", textData["ccType"].String().c_str());
940  }
941 
942  txtTracks.push_back(TextTrackInfo(index, languageCode, true, empty, textData["name"].String(), serviceNo, empty, (int)textData["pk"].Number()));
943  //values shared: index, language, isCC, rendition-empty, name, instreamId, characteristics-empty, primarykey
944  AAMPLOG_WARN("[OTA_SHIM]:: Text Track - index:%s lang:%s, isCC:true, rendition:empty, name:%s, instreamID:%s, characteristics:empty, primarykey:%d", index.c_str(), languageCode.c_str(), textData["name"].String().c_str(), serviceNo.c_str(), (int)textData["pk"].Number());
945  }
946  }
947 
948  if (txtTracks.empty())
949  {
950  std::string empty;
951  // Push dummy track , when not published,
952  // it is obseved that even if track is not published
953  // CC1 is present
954  txtTracks.push_back(TextTrackInfo("0", "und", true, empty, "Undetermined", "CC1", empty, 0 ));
955  }
956 
957  mTextTracks = txtTracks;
958  return;
959 #endif
960 }
961 
962 /**
963  * @brief Disable Restrictions (unlock) till seconds mentioned
964  */
965 void StreamAbstractionAAMP_OTA::DisableContentRestrictions(long grace, long time, bool eventChange)
966 {
967 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
968 #else
969  JsonObject param;
970  JsonObject result;
971  param["id"] = APP_ID;
972  if(-1 == grace){
973 
974  param["grace"] = -1;
975  param["time"] = -1;
976  param["eventChange"] = false;
977  AAMPLOG_WARN( "[OTA_SHIM] unlocked till next reboot or explicit enable" );
978  }else{
979  param["grace"] = 0;
980  param["time"] = time;
981  param["eventChange"] = eventChange;
982 
983  if(-1 != time)
984  AAMPLOG_WARN( "[OTA_SHIM] unlocked for %ld sec ", time);
985 
986  if(eventChange)
987  AAMPLOG_WARN( "[OTA_SHIM] unlocked till next program ");
988  }
989  thunderAccessObj.InvokeJSONRPC("disableContentRestrictionsUntil", param, result);
990 
991 #endif
992 }
993 
994 /**
995  * @brief Enable Content Restriction (lock)
996  */
998 {
999 #ifndef USE_CPP_THUNDER_PLUGIN_ACCESS
1000 #else
1001  AAMPLOG_WARN( "[OTA_SHIM] locked ");
1002  JsonObject param;
1003  JsonObject result;
1004  param["id"] = APP_ID;
1005  thunderAccessObj.InvokeJSONRPC("enableContentRestrictions", param, result);
1006 
1007 #endif
1008 }
1009 
1010 /**
1011  * @brief Stub implementation
1012  */
1014 { // STUB
1015 }
1016 
1017 /**
1018  * @brief Get output format of stream.
1019  */
1020 void StreamAbstractionAAMP_OTA::GetStreamFormat(StreamOutputFormat &primaryOutputFormat, StreamOutputFormat &audioOutputFormat, StreamOutputFormat &auxAudioOutputFormat, StreamOutputFormat &subtitleOutputFormat)
1021 {
1022  primaryOutputFormat = FORMAT_INVALID;
1023  audioOutputFormat = FORMAT_INVALID;
1024  auxAudioOutputFormat = FORMAT_INVALID;
1025  subtitleOutputFormat = FORMAT_INVALID;
1026 }
1027 
1028 /**
1029  * @brief Return MediaTrack of requested type
1030  */
1032 { // STUB
1033  return NULL;
1034 }
1035 
1036 /**
1037  * @brief Get current stream position.
1038  */
1040 { // STUB
1041  return 0.0;
1042 }
1043 
1044 /**
1045  * @brief Get stream information of a profile from subclass.
1046  */
1048 { // STUB
1049  return NULL;
1050 }
1051 
1052 /**
1053  * @brief Get PTS of first sample.
1054  */
1056 { // STUB
1057  return 0.0;
1058 }
1059 
1060 /**
1061  * @brief Get Start time PTS of first sample.
1062  */
1064 { // STUB
1065  return 0.0;
1066 }
1067 
1068 /**
1069  * @brief Get the Buffered time
1070  */
1072 { // STUB
1073  return -1.0;
1074 }
1075 
1076 /**
1077  * @brief Check if initial Caching is supports
1078  */
1080 { // STUB
1081  return false;
1082 }
1083 
1084 /**
1085  * @brief Get index of profile corresponds to bandwidth
1086  */
1088 { // STUB
1089  return 0;
1090 }
1091 
1092 /**
1093  * @brief To get the available video bitrates.
1094  */
1096 { // STUB
1097  return std::vector<long>();
1098 }
1099 
1100 /**
1101  * @brief Gets Max Bitrate avialable for current playback.
1102  */
1104 { // STUB
1105  return 0;
1106 }
1107 
1108 /**
1109  * @brief To get the available audio bitrates.
1110  */
1112 { // STUB
1113  return std::vector<long>();
1114 }
1115 
1116 /**
1117  * @brief To get the available video tracks.
1118  */
1120 { // STUB
1121  return std::vector<StreamInfo*>();
1122 }
1123 
1124 /**
1125  * @brief To get the available thumbnail tracks.
1126  */
1128 { // STUB
1129  return std::vector<StreamInfo*>();
1130 }
1131 
1132 /**
1133  * @brief Function to set thumbnail track for processing
1134  */
1136 {
1137  (void) thumbnailIndex; /* unused */
1138  return false;
1139 }
1140 
1141 /**
1142  * @brief To get the available thumbnail tracks.
1143  */
1144 std::vector<ThumbnailData> StreamAbstractionAAMP_OTA::GetThumbnailRangeData(double start, double end, std::string *baseurl, int *raw_w, int *raw_h, int *width, int *height)
1145 {
1146  return std::vector<ThumbnailData>();
1147 }
1148 
1149 /**
1150  * @brief Stops injecting fragments to StreamSink.
1151  */
1153 { // STUB - discontinuity related
1154 }
1155 
1156 /**
1157  * @brief Start injecting fragments to StreamSink.
1158  */
1160 { // STUB - discontinuity related
1161 }
AAMP_EVENT_ASYNC_MODE
@ AAMP_EVENT_ASYNC_MODE
Definition: AampEvent.h:101
ota_shim.h
shim for dispatching UVE OTA ATSC playback
StreamAbstractionAAMP_OTA::GetAudioTracks
void GetAudioTracks()
GetAudioTracks get the available audio tracks for the selected service / media.
Definition: ota_shim.cpp:727
StreamOutputFormat
StreamOutputFormat
Media output format.
Definition: main_aamp.h:106
eVIDEOSCAN_UNKNOWN
@ eVIDEOSCAN_UNKNOWN
Definition: AampEvent.h:194
StreamInfo
Structure holding the information of a stream.
Definition: StreamAbstractionAAMP.h:69
StreamAbstractionAAMP_OTA::GetTextTracks
void GetTextTracks()
GetTextTracks get the available text tracks for the selected service / media.
Definition: ota_shim.cpp:843
PrivateInstanceAAMP::preferredLanguagesString
std::string preferredLanguagesString
Definition: priv_aamp.h:964
eVIDEOSCAN_PROGRESSIVE
@ eVIDEOSCAN_PROGRESSIVE
Definition: AampEvent.h:192
StreamAbstractionAAMP_OTA::SetAudioTrack
void SetAudioTrack(int index) override
SetAudioTrack sets a specific audio track.
Definition: ota_shim.cpp:809
StreamAbstractionAAMP_OTA::StartInjection
void StartInjection(void) override
Start injecting fragments to StreamSink.
Definition: ota_shim.cpp:1159
StreamAbstractionAAMP_OTA::GetStreamInfo
StreamInfo * GetStreamInfo(int idx) override
Get stream information of a profile from subclass.
Definition: ota_shim.cpp:1047
AudioTrackInfo
Structure for audio track information Holds information about an audio track in playlist.
Definition: main_aamp.h:178
StreamAbstractionAAMP_OTA::GetAudioTrackInternal
int GetAudioTrackInternal()
GetAudioTrackInternal get the primary key for the selected audio.
Definition: ota_shim.cpp:789
StreamAbstractionAAMP_OTA::Start
void Start() override
Starts streaming.
Definition: ota_shim.cpp:394
TuneType
TuneType
Tune Typea.
Definition: priv_aamp.h:190
StreamAbstractionAAMP_OTA::GetBufferedDuration
double GetBufferedDuration() override
Get the Buffered time.
Definition: ota_shim.cpp:1071
StreamAbstractionAAMP::aamp
PrivateInstanceAAMP * aamp
Definition: StreamAbstractionAAMP.h:727
StreamAbstractionAAMP_OTA::GetAvailableVideoTracks
std::vector< StreamInfo * > GetAvailableVideoTracks(void) override
To get the available video tracks.
Definition: ota_shim.cpp:1119
aamp_PostJsonRPC
std::string aamp_PostJsonRPC(std::string id, std::string method, std::string params)
aamp_PostJsonRPC posts JSONRPC data
Definition: AampUtils.cpp:422
FORMAT_INVALID
@ FORMAT_INVALID
Definition: main_aamp.h:108
StreamAbstractionAAMP::mTextTracks
std::vector< TextTrackInfo > mTextTracks
Definition: StreamAbstractionAAMP.h:1455
StreamAbstractionAAMP_OTA::GetMediaTrack
MediaTrack * GetMediaTrack(TrackType type) override
Return MediaTrack of requested type.
Definition: ota_shim.cpp:1031
StreamAbstractionAAMP_OTA::GetAudioBitrates
std::vector< long > GetAudioBitrates(void) override
To get the available audio bitrates.
Definition: ota_shim.cpp:1111
StreamAbstractionAAMP_OTA::GetStartTimeOfFirstPTS
double GetStartTimeOfFirstPTS() override
Get Start time PTS of first sample.
Definition: ota_shim.cpp:1063
StreamAbstractionAAMP_OTA::GetFirstPTS
double GetFirstPTS() override
Get PTS of first sample.
Definition: ota_shim.cpp:1055
StreamAbstractionAAMP_OTA::GetStreamFormat
void GetStreamFormat(StreamOutputFormat &primaryOutputFormat, StreamOutputFormat &audioOutputFormat, StreamOutputFormat &auxOutputFormat, StreamOutputFormat &subtitleOutputFormat) override
Get output format of stream.
Definition: ota_shim.cpp:1020
StreamAbstractionAAMP_OTA::GetBWIndex
int GetBWIndex(long bitrate) override
Get index of profile corresponds to bandwidth.
Definition: ota_shim.cpp:1087
Getiso639map_NormalizeLanguageCode
std::string Getiso639map_NormalizeLanguageCode(std::string lang, LangCodePreference preferLangFormat)
To get the preferred iso639mapped language code.
Definition: AampUtils.cpp:725
AampLogManager
AampLogManager Class.
Definition: AampLogManager.h:150
StreamAbstractionAAMP_OTA::GetThumbnailRangeData
std::vector< ThumbnailData > GetThumbnailRangeData(double, double, std::string *, int *, int *, int *, int *) override
To get the available thumbnail tracks.
Definition: ota_shim.cpp:1144
PrivateInstanceAAMP::GetManifestUrl
std::string & GetManifestUrl(void)
Get manifest URL.
Definition: priv_aamp.h:1890
eSTATE_BLOCKED
@ eSTATE_BLOCKED
Definition: AampEvent.h:172
ATSCSettings
Structure to save the ATSC settings.
Definition: ota_shim.h:42
VideoScanType
VideoScanType
VideoScanType - Progressive/Interlaced.
Definition: AampEvent.h:190
StreamAbstractionAAMP_OTA::GetMaxBitrate
long GetMaxBitrate(void) override
Gets Max Bitrate avialable for current playback.
Definition: ota_shim.cpp:1103
eSTATE_PREPARED
@ eSTATE_PREPARED
Definition: AampEvent.h:162
eSTATE_PREPARING
@ eSTATE_PREPARING
Definition: AampEvent.h:161
MediaTrack
Base Class for Media Track.
Definition: StreamAbstractionAAMP.h:159
StreamAbstractionAAMP
StreamAbstraction class of AAMP.
Definition: StreamAbstractionAAMP.h:577
StreamAbstractionAAMP_OTA::DumpProfiles
void DumpProfiles(void) override
Stub implementation.
Definition: ota_shim.cpp:1013
StreamAbstractionAAMP_OTA::Stop
void Stop(bool clearChannelData) override
Stops streaming.
Definition: ota_shim.cpp:482
StreamAbstractionAAMP_OTA::GetStreamPosition
double GetStreamPosition() override
Get current stream position.
Definition: ota_shim.cpp:1039
PrivateInstanceAAMP::NotifyAudioTracksChanged
void NotifyAudioTracksChanged()
Function to notify available audio tracks changed.
Definition: priv_aamp.cpp:10424
StreamAbstractionAAMP_OTA::EnableContentRestrictions
void EnableContentRestrictions() override
Enable Content Restriction (lock)
Definition: ota_shim.cpp:997
TrackType
TrackType
Media Track Types.
Definition: StreamAbstractionAAMP.h:48
StreamAbstractionAAMP_OTA::NotifyAudioTrackChange
void NotifyAudioTrackChange(const std::vector< AudioTrackInfo > &tracks)
NotifyAudioTrackChange To notify audio track change.Currently not used as mediaplayer does not have s...
Definition: ota_shim.cpp:565
eAAMPSTATUS_OK
@ eAAMPSTATUS_OK
Definition: priv_aamp.h:207
StreamAbstractionAAMP::mAudioTrackIndex
std::string mAudioTrackIndex
Definition: StreamAbstractionAAMP.h:1457
StreamAbstractionAAMP_OTA::StreamAbstractionAAMP_OTA
StreamAbstractionAAMP_OTA(AampLogManager *logObj, class PrivateInstanceAAMP *aamp, double seekpos, float rate)
StreamAbstractionAAMP_OTA Constructor.
Definition: ota_shim.cpp:342
StreamAbstractionAAMP_OTA::Init
AAMPStatusType Init(TuneType tuneType) override
Initialize a newly created object.
Definition: ota_shim.cpp:303
StreamAbstractionAAMP_OTA::SetVideoRectangle
void SetVideoRectangle(int x, int y, int w, int h) override
SetVideoRectangle sets the position coordinates (x,y) & size (w,h)
Definition: ota_shim.cpp:529
StreamAbstractionAAMP_OTA::SetPreferredAudioLanguages
void SetPreferredAudioLanguages() override
SetPreferredAudioLanguages set the preferred audio language list.
Definition: ota_shim.cpp:634
priv_aamp.h
Private functions and types used internally by AAMP.
StreamAbstractionAAMP_OTA::GetAvailableThumbnailTracks
std::vector< StreamInfo * > GetAvailableThumbnailTracks(void) override
To get the available thumbnail tracks.
Definition: ota_shim.cpp:1127
PrivateInstanceAAMP::GetLangCodePreference
LangCodePreference GetLangCodePreference()
Get Language preference from aamp.cfg.
Definition: priv_aamp.cpp:5796
StreamAbstractionAAMP_OTA::~StreamAbstractionAAMP_OTA
~StreamAbstractionAAMP_OTA()
StreamAbstractionAAMP_OTA Distructor.
Definition: ota_shim.cpp:359
AAMPLOG_TRACE
#define AAMPLOG_TRACE(FORMAT,...)
AAMP logging defines, this can be enabled through setLogLevel() as per the need.
Definition: AampLogManager.h:83
PrivateInstanceAAMP
Class representing the AAMP player's private instance, which is not exposed to outside world.
Definition: priv_aamp.h:640
PrivAAMPState
PrivAAMPState
Mapping all required status codes based on JS player requirement. These requirements may be forced by...
Definition: AampEvent.h:156
StreamAbstractionAAMP_OTA::IsInitialCachingSupported
bool IsInitialCachingSupported() override
Check if initial Caching is supports.
Definition: ota_shim.cpp:1079
StreamAbstractionAAMP_OTA::GetVideoBitrates
std::vector< long > GetVideoBitrates(void) override
To get the available video bitrates.
Definition: ota_shim.cpp:1095
StreamAbstractionAAMP_OTA::SetAudioTrackByLanguage
void SetAudioTrackByLanguage(const char *lang) override
SetAudioTrackByLanguage set the audio language.
Definition: ota_shim.cpp:692
AAMP_EVENT_MEDIA_METADATA
@ AAMP_EVENT_MEDIA_METADATA
Definition: AampEvent.h:55
AAMPStatusType
AAMPStatusType
AAMP Function return values.
Definition: priv_aamp.h:205
StreamAbstractionAAMP::mAudioTracks
std::vector< AudioTrackInfo > mAudioTracks
Definition: StreamAbstractionAAMP.h:1452
TextTrackInfo
Structure for text track information Holds information about a text track in playlist.
Definition: main_aamp.h:282
PrivateInstanceAAMP::preferredRenditionString
std::string preferredRenditionString
Definition: priv_aamp.h:966
StreamAbstractionAAMP_OTA::DisableContentRestrictions
void DisableContentRestrictions(long grace, long time, bool eventChange) override
Disable Restrictions (unlock) till seconds mentioned.
Definition: ota_shim.cpp:965
eSTATE_IDLE
@ eSTATE_IDLE
Definition: AampEvent.h:158
StreamAbstractionAAMP_OTA::StopInjection
void StopInjection(void) override
Stops injecting fragments to StreamSink.
Definition: ota_shim.cpp:1152
StreamAbstractionAAMP_OTA::SetThumbnailTrack
bool SetThumbnailTrack(int) override
Function to set thumbnail track for processing.
Definition: ota_shim.cpp:1135
StreamAbstractionAAMP_OTA::GetAvailableTextTracks
std::vector< TextTrackInfo > & GetAvailableTextTracks(bool all=false) override
Get the list of available text tracks.
Definition: ota_shim.cpp:831
StreamAbstractionAAMP_OTA::GetCurrentAudioTrack
bool GetCurrentAudioTrack(AudioTrackInfo &audioTrack) override
Get current audio track.
Definition: ota_shim.cpp:610
eSTATE_PLAYING
@ eSTATE_PLAYING
Definition: AampEvent.h:166
eSTATE_COMPLETE
@ eSTATE_COMPLETE
Definition: AampEvent.h:169
ANOMALY_WARNING
@ ANOMALY_WARNING
Definition: main_aamp.h:72
StreamAbstractionAAMP_OTA::GetAudioTrack
int GetAudioTrack() override
Get current audio track.
Definition: ota_shim.cpp:588
StreamAbstractionAAMP_OTA::GetAvailableAudioTracks
std::vector< AudioTrackInfo > & GetAvailableAudioTracks(bool allTrack=false) override
Get the list of available audio tracks.
Definition: ota_shim.cpp:577
eVIDEOSCAN_INTERLACED
@ eVIDEOSCAN_INTERLACED
Definition: AampEvent.h:193