RDK Documentation (Open Sourced RDK Components)
AampcliSet.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 2022 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 AampcliSet.cpp
22  * @brief Aampcli Set command handler
23  */
24 
25 #include <iomanip>
26 #include"Aampcli.h"
27 #include"AampcliSet.h"
28 
29 std::map<string,setCommandInfo> Set::setCommands = std::map<string,setCommandInfo>();
30 std::vector<std::string> Set::commands(0);
31 
32 bool Set::execute(char *cmd, PlayerInstanceAAMP *playerInstanceAamp)
33 {
34  printf("%s:%d:cmd %s\n", __FUNCTION__, __LINE__,cmd);
35  char command[100];
36  int setCmd = 0;
37  int rate = 0;
38  unsigned int DownloadDelayInMs = 0;
39  Aampcli lAampcli;
40 
41  if (sscanf(cmd, "set %s", command) == 1)
42  {
43  if(isdigit(command[0]))
44  {
45  setCmd = atoi(command);
46  }
47  else
48  {
49  std::map<string,setCommandInfo>::iterator setCmdItr;
50  setCmdItr = setCommands.find(command);
51 
52  if(setCmdItr != setCommands.end())
53  {
54  setCmd = setCmdItr->second.value;
55  }
56  }
57 
58  if(0 == strncmp("help", command, 4))
59  {
60  printf("%s:%d:in help %s\n", __FUNCTION__, __LINE__,cmd);
61  ShowHelpSet();
62  }
63  else
64  {
65  switch(setCmd)
66  {
67  case 1:
68  {
69  int rate;
70  double relativeTuneTime;
71  printf("[AAMPCLI] Matched Command RateAndSeek - %s\n", cmd);
72  if (sscanf(cmd, "set %s %d %lf", command, &rate, &relativeTuneTime ) == 3){
73  playerInstanceAamp->SetRateAndSeek(rate, relativeTuneTime);
74  }
75  else
76  {
77  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
78  printf("[AAMPCLI] Expected: set %s <rate=0,1 etc> <seek time in sec>\n", command);
79  }
80  break;
81  }
82 
83  case 2:
84  {
85  int x,y,w,h;
86  printf("[AAMPCLI] Matched Command VideoRectangle - %s\n", cmd);
87  if (sscanf(cmd, "set %s %d %d %d %d", command, &x, &y, &w, &h) == 5){
88  playerInstanceAamp->SetVideoRectangle(x,y,w,h);
89  }
90  else
91  {
92  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
93  printf("[AAMPCLI] Expected: set %s <x> <y> <w> <h>\n", command);
94  }
95  break;
96  }
97 
98  case 3:
99  {
100  int videoZoom;
101  printf("[AAMPCLI] Matched Command VideoZoom - %s\n", cmd);
102  if (sscanf(cmd, "set %s %d", command, &videoZoom) == 2){
103  playerInstanceAamp->SetVideoZoom((videoZoom > 0 )? VIDEO_ZOOM_FULL : VIDEO_ZOOM_NONE );
104  }
105  else
106  {
107  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
108  printf("[AAMPCLI] Expected: set %s <value value>0? ZOOM_FULL : ZOOM_NONE>\n", command);
109  }
110  break;
111  }
112 
113  case 4:
114  {
115  int videoMute;
116  printf("[AAMPCLI] Matched Command VideoMute - %s\n", cmd);
117  if (sscanf(cmd, "set %s %d", command, &videoMute) == 2){
118  playerInstanceAamp->SetVideoMute((videoMute == 1 )? true : false );
119  }
120  else
121  {
122  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
123  printf("[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
124  }
125  break;
126  }
127 
128  case 5:
129  {
130  int vol;
131  printf("[AAMPCLI] Matched Command AudioVolume - %s\n", cmd);
132  if (sscanf(cmd, "set %s %d", command, &vol) == 2){
133  playerInstanceAamp->SetAudioVolume(vol);
134  }
135  else
136  {
137  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
138  printf("[AAMPCLI] Expected: set %s <value to set audio volume>\n", command);
139  }
140  break;
141  }
142 
143  case 6:
144  {
145  char lang[12];
146  printf("[AAMPCLI] Matched Command Language - %s\n", cmd);
147  if (sscanf(cmd, "set %s %s", command, lang) == 2){
148  playerInstanceAamp->SetLanguage(lang);
149  }
150  else
151  {
152  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
153  printf("[AAMPCLI] Expected: set %s <lang in string>\n", command);
154  }
155  break;
156  }
157 
158  case 7:
159  {
160  //Dummy implimentation
161  std::vector<std::string> subscribedTags;
162  printf("[AAMPCLI] Matched Command SubscribedTags - %s\n", cmd);
163  playerInstanceAamp->SetSubscribedTags(subscribedTags);
164  break;
165  }
166 
167  case 8:
168  {
169  char lisenceUrl[1024];
170  int drmType;
171  printf("[AAMPCLI] Matched Command LicenseServerUrl - %s\n", cmd);
172  if (sscanf(cmd, "set %s %s %d", command, lisenceUrl, &drmType) == 3){
173  playerInstanceAamp->SetLicenseServerURL(lisenceUrl,
175  }
176  else
177  {
178  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
179  printf("[AAMPCLI] Expected: set %s <license url in string> <value value==2? ?eDRM_PlayReady : eDRM_WideVine>\n", command);
180  }
181  break;
182  }
183 
184  case 9:
185  {
186  int isAnonym;
187  printf("[AAMPCLI] Matched Command AnonymousRequest - %s\n", cmd);
188  if (sscanf(cmd, "set %s %d", command, &isAnonym) == 2){
189  playerInstanceAamp->SetAnonymousRequest((isAnonym == 1)?true:false);
190  }
191  else
192  {
193  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
194  printf("[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
195  }
196  break;
197  }
198 
199  case 10:
200  {
201  int vodTFps;
202  printf("[AAMPCLI] Matched Command VodTrickplayFps - %s\n", cmd);
203  if (sscanf(cmd, "set %s %d", command, &vodTFps) == 2){
204  playerInstanceAamp->SetVODTrickplayFPS(vodTFps);
205  }
206  else
207  {
208  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
209  printf("[AAMPCLI] Expected: set %s <value>\n", command);
210  }
211  break;
212  }
213 
214  case 11:
215  {
216  int linearTFps;
217  printf("[AAMPCLI] Matched Command LinearTrickplayFps - %s\n", cmd);
218  if (sscanf(cmd, "set %s %d", command, &linearTFps) == 2){
219  playerInstanceAamp->SetLinearTrickplayFPS(linearTFps);
220  }
221  else
222  {
223  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
224  printf("[AAMPCLI] Expected: set %s <value>\n", command);
225  }
226  break;
227  }
228 
229  case 12:
230  {
231  double liveOffset;
232  printf("[AAMPCLI] Matched Command LiveOffset - %s\n", cmd);
233  if (sscanf(cmd, "set %s %lf", command, &liveOffset) == 2){
234  playerInstanceAamp->SetLiveOffset(liveOffset);
235  }
236  else
237  {
238  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
239  printf("[AAMPCLI] Expected: set %s <value>\n", command);
240  }
241  break;
242  }
243  case 56:
244  {
245  double liveOffset;
246  printf("[AAMPCLI] Matched Command LiveOffset4K - %s\n", cmd);
247  if (sscanf(cmd, "set %s %lf", command, &liveOffset) == 2){
248  playerInstanceAamp->SetLiveOffset4K(liveOffset);
249  }
250  else
251  {
252  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
253  printf("[AAMPCLI] Expected: set %s <value>\n", command);
254  }
255  break;
256  }
257 
258  case 13:
259  {
260  int stallErrorCode;
261  printf("[AAMPCLI] Matched Command StallErrorCode - %s\n", cmd);
262  if (sscanf(cmd, "set %s %d", command, &stallErrorCode) == 2){
263  playerInstanceAamp->SetStallErrorCode(stallErrorCode);
264  }
265  else
266  {
267  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
268  printf("[AAMPCLI] Expected: set %s <value>\n", command);
269  }
270  break;
271  }
272 
273  case 14:
274  {
275  int stallTimeout;
276  printf("[AAMPCLI] Matched Command StallTimeout - %s\n", cmd);
277  if (sscanf(cmd, "set %s %d", command, &stallTimeout) == 2){
278  playerInstanceAamp->SetStallTimeout(stallTimeout);
279  }
280  break;
281  }
282 
283  case 15:
284  {
285  int reportInterval;
286  printf("[AAMPCLI] Matched Command ReportInterval - %s\n", cmd);
287  if (sscanf(cmd, "set %s %d", command, &reportInterval) == 2){
288  playerInstanceAamp->SetReportInterval(reportInterval);
289  }
290  else
291  {
292  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
293  printf("[AAMPCLI] Expected: set %s <value>\n", command);
294  }
295  break;
296  }
297 
298  case 16:
299  {
300  long videoBitrate;
301  printf("[AAMPCLI] Matched Command VideoBitarate - %s\n", cmd);
302  if (sscanf(cmd, "set %s %ld", command, &videoBitrate) == 2){
303  playerInstanceAamp->SetVideoBitrate(videoBitrate);
304  }
305  else
306  {
307  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
308  printf("[AAMPCLI] Expected: set %s <value>\n", command);
309  }
310  break;
311  }
312 
313  case 17:
314  {
315  long initialBitrate;
316  printf("[AAMPCLI] Matched Command InitialBitrate - %s\n", cmd);
317  if (sscanf(cmd, "set %s %ld", command, &initialBitrate) == 2){
318  playerInstanceAamp->SetInitialBitrate(initialBitrate);
319  }
320  else
321  {
322  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
323  printf("[AAMPCLI] Expected: set %s <value>\n", command);
324  }
325  break;
326  }
327 
328  case 18:
329  {
330  long initialBitrate4k;
331  printf("[AAMPCLI] Matched Command InitialBitrate4k - %s\n", cmd);
332  if (sscanf(cmd, "set %s %ld", command, &initialBitrate4k) == 2){
333  playerInstanceAamp->SetInitialBitrate4K(initialBitrate4k);
334  }
335  else
336  {
337  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
338  printf("[AAMPCLI] Expected: set %s <value>\n", command);
339  }
340  break;
341  }
342 
343  case 19:
344  {
345  double networkTimeout;
346  printf("[AAMPCLI] Matched Command NetworkTimeout - %s\n", cmd);
347  if (sscanf(cmd, "set %s %lf", command, &networkTimeout) == 2){
348  playerInstanceAamp->SetNetworkTimeout(networkTimeout);
349  }
350  else
351  {
352  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
353  printf("[AAMPCLI] Expected: set %s <value>\n", command);
354  }
355  break;
356  }
357 
358  case 20:
359  {
360  double manifestTimeout;
361  printf("[AAMPCLI] Matched Command ManifestTimeout - %s\n", cmd);
362  if (sscanf(cmd, "set %s %lf", command, &manifestTimeout) == 2){
363  playerInstanceAamp->SetManifestTimeout(manifestTimeout);
364  }
365  else
366  {
367  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
368  printf("[AAMPCLI] Expected: set %s <value>\n", command);
369  }
370  break;
371  }
372 
373  case 21:
374  {
375  int downloadBufferSize;
376  printf("[AAMPCLI] Matched Command DownloadBufferSize - %s\n", cmd);
377  if (sscanf(cmd, "set %s %d", command, &downloadBufferSize) == 2){
378  playerInstanceAamp->SetDownloadBufferSize(downloadBufferSize);
379  }
380  else
381  {
382  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
383  printf("[AAMPCLI] Expected: set %s <value>\n", command);
384  }
385  break;
386  }
387 
388  case 22:
389  {
390  int preferredDrm;
391  printf("[AAMPCLI] Matched Command PreferredDrm - %s\n", cmd);
392  if (sscanf(cmd, "set %s %d", command, &preferredDrm) == 2){
393  playerInstanceAamp->SetPreferredDRM((DRMSystems)preferredDrm);
394  }
395  else
396  {
397  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
398  printf("[AAMPCLI] Expected: set %s <value>\n", command);
399  }
400  break;
401  }
402 
403  case 23:
404  {
405  int stereoOnlyPlayback;
406  printf("[AAMPCLI] Matched Command StereoOnlyPlayback - %s\n", cmd);
407  if (sscanf(cmd, "set %s %d", command, &stereoOnlyPlayback) == 2){
408  playerInstanceAamp->SetStereoOnlyPlayback(
409  (stereoOnlyPlayback == 1 )? true:false);
410  }
411  else
412  {
413  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
414  printf("[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
415  }
416  break;
417  }
418 
419  case 24:
420  {
421  //Dummy implementation
422  std::string adBrkId = "";
423  std::string adId = "";
424  std::string url = "";
425  printf("[AAMPCLI] Matched Command AlternateContent - %s\n", cmd);
426  playerInstanceAamp->SetAlternateContents(adBrkId, adId, url);
427  break;
428  }
429 
430  case 25:
431  {
432  char networkProxy[128];
433  printf("[AAMPCLI] Matched Command NetworkProxy - %s\n", cmd);
434  if (sscanf(cmd, "set %s %s", command, networkProxy) == 2){
435  playerInstanceAamp->SetNetworkProxy(networkProxy);
436  }
437  else
438  {
439  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
440  printf("[AAMPCLI] Expected: set %s <value in string>\n", command);
441  }
442  break;
443  }
444 
445  case 26:
446  {
447  char licenseReqProxy[128];
448  printf("[AAMPCLI] Matched Command LicenseReqProxy - %s\n", cmd);
449  if (sscanf(cmd, "set %s %s", command, licenseReqProxy) == 2){
450  playerInstanceAamp->SetLicenseReqProxy(licenseReqProxy);
451  }
452  else
453  {
454  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
455  printf("[AAMPCLI] Expected: set %s <value in string>\n", command);
456  }
457  break;
458  }
459 
460  case 27:
461  {
462  long downloadStallTimeout;
463  printf("[AAMPCLI] Matched Command DownloadStallTimeout - %s\n", cmd);
464  if (sscanf(cmd, "set %s %ld", command, &downloadStallTimeout) == 2){
465  playerInstanceAamp->SetDownloadStallTimeout(downloadStallTimeout);
466  }
467  else
468  {
469  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
470  printf("[AAMPCLI] Expected: set %s <value>\n", command);
471  }
472  break;
473  }
474 
475  case 28:
476  {
477  long downloadStartTimeout;
478  printf("[AAMPCLI] Matched Command DownloadStartTimeout - %s\n", cmd);
479  if (sscanf(cmd, "set %s %ld", command, &downloadStartTimeout) == 2){
480  playerInstanceAamp->SetDownloadStartTimeout(downloadStartTimeout);
481  }
482  else
483  {
484  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
485  printf("[AAMPCLI] Expected: set %s <value>\n", command);
486  }
487  break;
488  }
489 
490  case 29:
491  {
492  long downloadLowBWTimeout;
493  printf("[AAMPCLI] Matched Command DownloadLowBWTimeout - %s\n", cmd);
494  if (sscanf(cmd, "set %s %ld", command, &downloadLowBWTimeout) == 2){
495  playerInstanceAamp->SetDownloadLowBWTimeout(downloadLowBWTimeout);
496  }
497  else
498  {
499  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
500  printf("[AAMPCLI] Expected: set %s <value>\n", command);
501  }
502  break;
503  }
504 
505  case 30:
506  {
507  char preferredSubtitleLang[12];
508  printf("[AAMPCLI] Matched Command PreferredSubtitleLang - %s\n", cmd);
509  if (sscanf(cmd, "set %s %s", command, preferredSubtitleLang) == 2){
510  playerInstanceAamp->SetPreferredSubtitleLanguage(preferredSubtitleLang);
511  }
512  else
513  {
514  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
515  printf("[AAMPCLI] Expected: set %s <value in string>\n", command);
516  }
517  break;
518  }
519 
520  case 31:
521  {
522  int parallelPlaylistDL;
523  printf("[AAMPCLI] Matched Command ParallelPlaylistDL - %s\n", cmd);
524  if (sscanf(cmd, "set %s %d", command, &parallelPlaylistDL) == 2){
525  playerInstanceAamp->SetParallelPlaylistDL( (parallelPlaylistDL == 1)? true:false );
526  }
527  else
528  {
529  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
530  printf("[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
531  }
532  break;
533  }
534 
535  case 32:
536  {
537  char preferredLanguages[128];
538  char preferredLabel[128];
539  char rendition[32];
540  char type[16];
541  char preferredCodec[128];
542  memset(preferredLanguages, 0, sizeof(preferredLanguages));
543  memset(preferredLabel, 0, sizeof(preferredLabel));
544  memset(rendition, 0, sizeof(rendition));
545  memset(type, 0, sizeof(type));
546  memset(preferredCodec, 0, sizeof(preferredCodec));
547  bool prefLanPresent = false;
548  bool prefRendPresent = false;
549  bool prefTypePresent = false;
550  bool prefCodecPresent = false;
551  bool prefLabelPresent = false;
552  printf("[AAMPCLI] Matched Command PreferredLanguages - %s\n", cmd);
553 
554  if (sscanf(cmd, "set %s %s %s %s %s %s", command, preferredLanguages, rendition, type, preferredCodec, preferredLabel) == 6)
555  {
556  printf("[AAMPCLI] setting Preferred Languages (%s), rendition (%s), type (%s) , codec (%s) and label (%s)\n" ,
557  preferredLanguages, rendition, type, preferredCodec, preferredLabel);
558  if (0 != strcasecmp(preferredLanguages, "null"))
559  {
560  prefLanPresent = true;
561  }
562  if (0 != strcasecmp(preferredCodec, "null"))
563  {
564  prefCodecPresent = true;
565  }
566  if (0 != strcasecmp(rendition, "null"))
567  {
568  prefRendPresent = true;
569  }
570  if (0 != strcasecmp(type, "null"))
571  {
572  prefTypePresent = true;
573  }
574  if (0 != strcasecmp(preferredLabel, "null"))
575  {
576  prefLabelPresent = true;
577  }
578 
579  playerInstanceAamp->SetPreferredLanguages(prefLanPresent?preferredLanguages:NULL,
580  prefRendPresent?rendition:NULL,
581  prefTypePresent?type:NULL,
582  prefCodecPresent?preferredCodec:NULL,
583  prefLabelPresent?preferredLabel:NULL);
584  }
585  else if (sscanf(cmd, "set %s %s %s %s %s", command, preferredLanguages, rendition, type, preferredCodec) == 5)
586  {
587  printf("[AAMPCLI] setting Preferred Languages (%s), rendition (%s), type (%s) and codec (%s)\n" ,
588  preferredLanguages, rendition, type, preferredCodec);
589  if (0 != strcasecmp(preferredLanguages, "null"))
590  {
591  prefLanPresent = true;
592  }
593  if (0 != strcasecmp(preferredCodec, "null"))
594  {
595  prefCodecPresent = true;
596  }
597  if (0 != strcasecmp(rendition, "null"))
598  {
599  prefRendPresent = true;
600  }
601  if (0 != strcasecmp(type, "null"))
602  {
603  prefTypePresent = true;
604  }
605 
606  playerInstanceAamp->SetPreferredLanguages(prefLanPresent?preferredLanguages:NULL,
607  prefRendPresent?rendition:NULL,
608  prefTypePresent?type:NULL,
609  prefCodecPresent?preferredCodec:NULL);
610  }
611  else if (sscanf(cmd, "set %s %s %s %s", command, preferredLanguages, rendition, type) == 4)
612  {
613  printf("[AAMPCLI] setting PreferredLanguages (%s) with rendition (%s) and type (%s)\n" ,
614  preferredLanguages, rendition, type);
615  if (0 != strcasecmp(preferredLanguages, "null"))
616  {
617  prefLanPresent = true;
618  }
619  if (0 != strcasecmp(rendition, "null"))
620  {
621  prefRendPresent = true;
622  }
623  if (0 != strcasecmp(type, "null"))
624  {
625  prefTypePresent = true;
626  }
627  playerInstanceAamp->SetPreferredLanguages(prefLanPresent?preferredLanguages:NULL,
628  prefRendPresent?rendition:NULL,
629  prefTypePresent?type:NULL);
630  }
631  else if (sscanf(cmd, "set %s %s %s", command, preferredLanguages, rendition) == 3)
632  {
633  printf("[AAMPCLI] setting PreferredLanguages (%s) with rendition (%s)\n" ,
634  preferredLanguages, rendition);
635  if (0 != strcasecmp(preferredLanguages, "null"))
636  {
637  prefLanPresent = true;
638  }
639  if (0 != strcasecmp(rendition, "null"))
640  {
641  prefRendPresent = true;
642  }
643  playerInstanceAamp->SetPreferredLanguages(prefLanPresent?preferredLanguages:NULL,
644  prefRendPresent?rendition:NULL);
645  }
646  else if (sscanf(cmd, "set %s %s", command, preferredLanguages) == 2)
647  {
648  printf("[AAMPCLI] setting PreferredLanguages (%s)\n",preferredLanguages );
649  if (0 != strcasecmp(preferredLanguages, "null"))
650  {
651  std::ifstream infile(preferredLanguages);
652  std::string line = "";
653  std::string data = "";
654  if(infile.good())
655  {
656  /**< If it is file get the data **/
657  printf("[AAMPCLI] File Path for Json Data (%s)\n",preferredLanguages );
658  while ( getline (infile,line) )
659  {
660  if (!data.empty())
661  {
662  data += "\n";
663  }
664  data += line;
665  }
666  }
667  else
668  {
669  /**< If it is reqular data assign it**/
670  data = std::string(preferredLanguages);
671  }
672 
673  printf("[AAMPCLI] setting PreferredLanguages (%s)\n",data.c_str());
674  playerInstanceAamp->SetPreferredLanguages(data.c_str());
675  }
676  else
677  {
678  printf("[AAMPCLI] ERROR: Invalid arguments- %s\n", cmd);
679  printf("[AAMPCLI] set preferred languages must be set at least a language\n");
680  }
681 
682  }
683  else
684  {
685  printf("[AAMPCLI] ERROR: Mismatch in arguments- %s\n", cmd);
686  printf("[AAMPCLI] set preferred languages must be run with atleast 2 argument\n");
687  }
688  break;
689  }
690 
691  case 33:
692  {
693  char preferredLanguages[128];
694  if (sscanf(cmd, "set %s %s", command, preferredLanguages) == 2)
695  {
696  printf("[AAMPCLI] setting PreferredText (%s)\n",preferredLanguages );
697  if (0 != strcasecmp(preferredLanguages, "null"))
698  {
699  std::ifstream infile(preferredLanguages);
700  std::string line = "";
701  std::string data = "";
702  if(infile.good())
703  {
704  /**< If it is file get the data **/
705  while ( getline (infile,line) )
706  {
707  if (!data.empty())
708  {
709  data += "\n";
710  }
711  data += line;
712  }
713  }
714  else
715  {
716  /**Nomal case */
717  data = std::string(preferredLanguages);
718  }
719  printf("[AAMPCLI] JSON Argument Recieved- %s\n", data.c_str());
720  playerInstanceAamp->SetPreferredTextLanguages(data.c_str());
721  }
722  else
723  {
724  printf("[AAMPCLI] ERROR: Invalid arguments- %s\n", cmd);
725  printf("[AAMPCLI] set preferred text languages must be set at least a language or json data\n");
726  }
727  }
728  else
729  {
730  printf("[AAMPCLI] ERROR: Mismatch in arguments- %s\n", cmd);
731  printf("[AAMPCLI] set preferred languages must be run with 2 argument\n");
732  }
733  break;
734  }
735 
736  case 34:
737  {
738  int rampDownLimit;
739  printf("[AAMPCLI] Matched Command InitRampdownLimit - %s\n", cmd);
740  if (sscanf(cmd, "set %s %d", command, &rampDownLimit) == 2){
741  playerInstanceAamp->SetInitRampdownLimit(rampDownLimit);
742  }
743  else
744  {
745  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
746  printf("[AAMPCLI] Expected: set %s <value>\n", command);
747  }
748  break;
749  }
750 
751  case 35:
752  {
753  int rampDownLimit;
754  printf("[AAMPCLI] Matched Command RampDownLimit - %s\n", cmd);
755  if (sscanf(cmd, "set %s %d", command, &rampDownLimit) == 2){
756  playerInstanceAamp->SetRampDownLimit(rampDownLimit);
757  }
758  else
759  {
760  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
761  printf("[AAMPCLI] Expected: set %s <value>\n", command);
762  }
763  break;
764  }
765 
766  case 36:
767  {
768  long minBitrate;
769  printf("[AAMPCLI] Matched Command MinimumBitrate - %s\n", cmd);
770  if (sscanf(cmd, "set %s %ld", command, &minBitrate) == 2){
771  playerInstanceAamp->SetMinimumBitrate(minBitrate);
772  }
773  else
774  {
775  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
776  printf("[AAMPCLI] Expected: set %s <value>\n", command);
777  }
778  break;
779  }
780 
781  case 37:
782  {
783  long maxBitrate;
784  printf("[AAMPCLI] Matched Command MaximumBitrate - %s\n", cmd);
785  if (sscanf(cmd, "set %s %ld", command, &maxBitrate) == 2){
786  playerInstanceAamp->SetMaximumBitrate(maxBitrate);
787  }
788  else
789  {
790  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
791  printf("[AAMPCLI] Expected: set %s <value>\n", command);
792  }
793  break;
794  }
795  case 54:
796  {
797  long bitrate1, bitrate2, bitrate3;
798  std::vector<long>bitrateList;
799  printf("[AAMPCLI] Matched Command VideoTrack - %s\n", cmd);
800  if (sscanf(cmd, "set %s %ld %ld %ld", command, &bitrate1, &bitrate2, &bitrate3) == 4){
801  bitrateList.push_back(bitrate1);
802  bitrateList.push_back(bitrate2);
803  bitrateList.push_back(bitrate3);
804  playerInstanceAamp->SetVideoTracks(bitrateList);
805  }
806  else
807  {
808  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
809  printf("[AAMPCLI] Expected: set %s <value1> <value2> <value3>\n", command);
810  }
811  break;
812  }
813  case 38:
814  {
815  int failCount;
816  printf("[AAMPCLI] Matched Command MaximumSegmentInjFailCount - %s\n", cmd);
817  if (sscanf(cmd, "set %s %d", command, &failCount) == 2){
818  playerInstanceAamp->SetSegmentInjectFailCount(failCount);
819  }
820  else
821  {
822  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
823  printf("[AAMPCLI] Expected: set %s <value>\n", command);
824  }
825  break;
826  }
827 
828  case 49:
829  {
830  int value;
831  printf("[AAMPCLI] Matched Command SslVerifyPeer - %s\n", cmd);
832  if (sscanf(cmd, "set %s %d", command, &value) == 2){
833  playerInstanceAamp->SetSslVerifyPeerConfig(value == 1);
834  }
835  else
836  {
837  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
838  printf("[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
839  }
840  break;
841  }
842 
843  case 39:
844  {
845  int failCount;
846  printf("[AAMPCLI] Matched Command MaximumDrmDecryptFailCount - %s\n", cmd);
847  if (sscanf(cmd, "set %s %d", command, &failCount) == 2){
848  playerInstanceAamp->SetSegmentDecryptFailCount(failCount);
849  }
850  else
851  {
852  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
853  printf("[AAMPCLI] Expected: set %s <value>\n", command);
854  }
855  break;
856  }
857 
858  case 40:
859  {
860  int id3MetadataEventsEnabled;
861  printf("[AAMPCLI] Matched Command RegisterForID3MetadataEvents - %s\n", cmd);
862  if (sscanf(cmd, "set %s %d", command, &id3MetadataEventsEnabled) == 2){
863  if (id3MetadataEventsEnabled)
864  {
865  playerInstanceAamp->AddEventListener(AAMP_EVENT_ID3_METADATA, lAampcli.mEventListener);
866  }
867  else
868  {
869  playerInstanceAamp->RemoveEventListener(AAMP_EVENT_ID3_METADATA, lAampcli.mEventListener);
870  }
871 
872  }
873  else
874  {
875  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
876  printf("[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
877  }
878  break;
879  }
880 
881  case 53:
882  {
883  int mediaMetadataEventsEnabled;
884  printf("[AAMPCLI] Matched Command RegisterForMediaMetadata - %s\n", cmd);
885  if (sscanf(cmd, "set %s %d", command, &mediaMetadataEventsEnabled) == 2){
886  if (mediaMetadataEventsEnabled)
887  {
888  playerInstanceAamp->AddEventListener(AAMP_EVENT_MEDIA_METADATA, lAampcli.mEventListener);
889  }
890  else
891  {
892  playerInstanceAamp->RemoveEventListener(AAMP_EVENT_MEDIA_METADATA, lAampcli.mEventListener);
893  }
894  }
895  else
896  {
897  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
898  printf("[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
899  }
900  break;
901  }
902 
903  case 46:
904  {
905  LangCodePreference preference;
906  int preferenceInt = 0;
907  int bDescriptiveAudioTrack = 0;
908  if (sscanf(cmd, "set %s %d %d", command, &preferenceInt, &bDescriptiveAudioTrack ) >= 2)
909  {
910  preference = (LangCodePreference) preferenceInt;
911  playerInstanceAamp->SetLanguageFormat(preference, bDescriptiveAudioTrack!=0 );
912  }
913  else
914  {
915  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
916  printf("[AAMPCLI] Expected: set %s <value for preference> <value for track number>\n", command);
917  }
918  break;
919  }
920 
921  case 41:
922  {
923  int duration;
924  printf("[AAMPCLI] Matched Command InitialBufferDuration - %s\n", cmd);
925  if (sscanf(cmd, "set %s %d", command, &duration) == 2)
926  {
927  playerInstanceAamp->SetInitialBufferDuration(duration);
928  }
929  else
930  {
931  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
932  printf("[AAMPCLI] Expected: set %s <value>\n", command);
933  }
934  break;
935  }
936 
937  case 42:
938  {
939  int track;
940  char strTrackInfo[512];
941  memset(strTrackInfo, '\0', sizeof(strTrackInfo));
942  printf("[AAMPCLI] Matched Command AudioTrack - %s\n", cmd);
943  if (sscanf(cmd, "set %s %d", command, &track) == 2)
944  {
945  playerInstanceAamp->SetAudioTrack(track);
946  }
947  else if (sscanf(cmd, "set %s %s", command, strTrackInfo) == 2)
948  {
949  std::string substr = "";
950  std::string language = "";
951  std::string rendition = "";
952  std::string codec = "";
953  std::string type = "";
954  std::string label = "";
955  int channel = 0;
956  std::stringstream ss(strTrackInfo);
957  /** "language,rendition,codec,channel" **/
958  /*language */
959  if (std::getline(ss, substr, ',')){
960  if(!substr.empty()){
961  language = substr;
962  }
963  }
964 
965  /*rendition */
966  if (std::getline(ss, substr, ',')){
967  if(!substr.empty()){
968  rendition = substr;
969  }
970  }
971 
972  /*type */
973  if (std::getline(ss, substr, ',')){
974  if(!substr.empty()){
975  type = substr;
976  }
977  }
978 
979  /*codec */
980  if (std::getline(ss, substr, ',')){
981  if(!substr.empty()){
982  codec = substr;
983  }
984  }
985 
986  /*channel TODO:not supported now */
987  if (std::getline(ss, substr, ',')){
988  if(!substr.empty()){
989  channel = std::stoi(substr);
990  }
991  }
992  /*label*/
993  if (std::getline(ss, substr, ',')){
994  if(!substr.empty()){
995  label = substr;
996  }
997  }
998  printf("[AAMPCLI] Selecting audio track based on language - %s rendition - %s type = %s codec = %s channel = %d label = %s\n",
999  language.c_str(), rendition.c_str(), type.c_str(), codec.c_str(), channel, label.c_str());
1000  playerInstanceAamp->SetAudioTrack(language, rendition, type, codec, channel,label);
1001 
1002  }
1003  break;
1004  }
1005 
1006  case 43:
1007  {
1008  int track = 0;
1009  char sidecar[128];
1010 
1011  printf("[AAMPCLI] Matched Command TextTrack - %s\n", cmd);
1012  if (sscanf(cmd, "set %s %127s", command, sidecar) == 2)
1013  {
1014  std::ifstream inFile(sidecar);
1015  if (inFile.good())
1016  {
1017  /* Sidecar text file. */
1018  std::stringstream strStream;
1019  strStream << inFile.rdbuf();
1020  std::string str = strStream.str();
1021  char* data = new char[str.size() + 1];
1022  std::copy(str.begin(), str.end(), data);
1023  data[str.size()] = '\0';
1024 
1025  /* Ownership of data is passed to AAMP. */
1026  playerInstanceAamp->SetTextTrack(0, data);
1027  }
1028  else if (sscanf(cmd, "set %s %d", command, &track) == 2)
1029  {
1030  /* Text track number. */
1031  playerInstanceAamp->SetTextTrack(track);
1032  }
1033  else
1034  {
1035  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
1036  printf("[AAMPCLI] Expected: set %s <value> OR set %s <file>\n", command, command);
1037  }
1038  }
1039  else
1040  {
1041  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
1042  printf("[AAMPCLI] set %s must be run with 1 argument\n", command);
1043  }
1044  break;
1045  }
1046 
1047  case 44:
1048  {
1049  int status;
1050  printf("[AAMPCLI] Matched Command CCStatus - %s\n", cmd);
1051  if (sscanf(cmd, "set %s %d", command, &status) == 2)
1052  {
1053  playerInstanceAamp->SetCCStatus(status == 1);
1054  }
1055  else
1056  {
1057  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
1058  printf("[AAMPCLI] Expected: set %s <value>\n", command);
1059  }
1060  break;
1061  }
1062 
1063  case 45:
1064  {
1065  std::string options;
1066  int value;
1067  char jsonFile[128];
1068  char tempChar;
1069 
1070  printf("[AAMPCLI] Matched Command CCStyle - %s\n", cmd);
1071  if (sscanf(cmd, "set %s %d %c", command, &value, &tempChar) == 2)
1072  {
1073  switch (value)
1074  {
1075  case 1:
1076  options = std::string(CC_OPTION_1);
1077  break;
1078  case 2:
1079  options = std::string(CC_OPTION_2);
1080  break;
1081  case 3:
1082  options = std::string(CC_OPTION_3);
1083  break;
1084  default:
1085  printf("[AAMPCLI] Invalid option passed %d. skipping!\n", value);
1086  break;
1087  }
1088  }
1089  else if (sscanf(cmd, "set %s %127s", command, jsonFile) == 2)
1090  {
1091  std::ifstream infile(jsonFile);
1092  std::string line = "";
1093  if(infile.good())
1094  {
1095  /**< If it is file get the data **/
1096  while ( getline (infile,line) )
1097  {
1098  if (!options.empty())
1099  {
1100  options += "\n";
1101  }
1102  options += line;
1103  }
1104  }
1105  else
1106  {
1107  printf("[AAMPCLI] Invalid filename passed %s. skipping!\n", jsonFile);
1108  }
1109  }
1110 
1111  if (!options.empty())
1112  {
1113  playerInstanceAamp->SetTextStyle(options);
1114  }
1115  else
1116  {
1117  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
1118  printf("[AAMPCLI] Expected: set %s <value 1,2 or 3> or json file\n", command);
1119  }
1120  break;
1121  }
1122 
1123  case 47:
1124  {
1125  int propagateUriParam;
1126  printf("[AAMPCLI] Matched Command PropogateUriParam - %s\n", cmd);
1127  if (sscanf(cmd, "set %s %d", command, &propagateUriParam) == 2){
1128  playerInstanceAamp->SetPropagateUriParameters((bool) propagateUriParam);
1129  }
1130  else
1131  {
1132  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
1133  printf("[AAMPCLI] Expected: set %s <value>\n", command);
1134  }
1135  break;
1136  }
1137 
1138  case 48:
1139  {
1140  printf("[AAMPCLI] Matched Command ThumbnailTrack - %s\n",cmd);
1141  sscanf(cmd, "set %s %d", command, &rate);
1142  printf("[AAMPCLI] Setting ThumbnailTrack : %s\n",playerInstanceAamp->SetThumbnailTrack(rate)?"Success":"Failure");
1143  break;
1144  }
1145  case 50:
1146  {
1147  printf("[AAMPCLI] Matched Command DownloadDelayOnFetch - %s\n",cmd);
1148  sscanf(cmd, "set %s %d", command, &DownloadDelayInMs);
1149  playerInstanceAamp->ApplyArtificialDownloadDelay(DownloadDelayInMs);
1150  break;
1151  }
1152 
1153 
1154  case 51:
1155  {
1156  char behavior[24];
1157  printf("[AAMPCLI] Matched Command PausedBehavior - %s\n", cmd);
1158  if(sscanf(cmd, "set %s %d", command, &rate) == 2)
1159  {
1160  playerInstanceAamp->SetPausedBehavior(rate);
1161  }
1162  else
1163  {
1164  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
1165  printf("[AAMPCLI] Expected: set %s <value 0,1,2 or 3>\n", command);
1166  }
1167  break;
1168  }
1169 
1170  case 52:
1171  {
1172  char lang[12];
1173  printf("[AAMPCLI] Matched Command AuxiliaryAudio - %s\n", cmd);
1174  if (sscanf(cmd, "set %s %s", command, lang) == 2)
1175  {
1176  playerInstanceAamp->SetAuxiliaryLanguage(lang);
1177  }
1178  else
1179  {
1180  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
1181  printf("[AAMPCLI] Expected: set %s <value in string>\n", command);
1182  }
1183  break;
1184  }
1185 
1186  case 55:
1187  {
1188  int timeout;
1189  if (sscanf(cmd, "set %s %d", command, &timeout) == 2)
1190  {
1191  printf("[AAMPCLI] Enabling AAMP_EVENT_CONTENT_PROTECTION_DATA_UPDATE event registration");
1192  playerInstanceAamp->AddEventListener(AAMP_EVENT_CONTENT_PROTECTION_DATA_UPDATE, lAampcli.mEventListener);
1193  playerInstanceAamp->SetContentProtectionDataUpdateTimeout(timeout);
1194  }
1195  else
1196  {
1197  printf("[AAMPCLI] ERROR: Mismatch in arguments\n");
1198  printf("[AAMPCLI] Expected: set %s <value in Milliseconds>\n", command);
1199  }
1200  break;
1201  }
1202 
1203  default:
1204  printf("[AAMPCLI] Invalid set command %s\n", command);
1205  break;
1206  }
1207 
1208  }
1209  }
1210  else
1211  {
1212  printf("[AAMPCLI] Invalid set command = %s\n", cmd);
1213  }
1214 
1215  return true;
1216 }
1217 
1218 
1219 /**
1220  * @brief Show help menu with aamp command line interface
1221  */
1223 {
1224  addCommand(1,"rateAndSeek"," <x> <y>","Set Rate and Seek (int x=rate, double y=seconds)");
1225  addCommand(2,"videoRectangle"," <x> <y> <w> <h>","Set Video Rectangle (int x,y,w,h)");
1226  addCommand(3,"videoZoom"," <x>","Set Video zoom ( x = 1 for full, x = 0 for normal)");
1227  addCommand(4,"videoMute"," <x>","Set Video Mute ( x = 1 - Mute , x = 0 - Unmute)");
1228  addCommand(5,"audioVolume"," <x>","Set Audio Volume (int x=volume)");
1229  addCommand(6,"language"," <x>","Set Language (string x=lang)");
1230  addCommand(7,"subscribedTags","","Set Subscribed Tag - dummy");
1231  addCommand(8,"licenseServerUrl"," <x> <y>","Set License Server URL (String x=url) (int y=drmType)");
1232  addCommand(9,"anonymousRequest"," <x>","Set Anonymous Request (int x=0/1)");
1233  addCommand(10,"vodTrickplayFps"," <x>","Set VOD Trickplay FPS (int x=trickPlayFPS)");
1234  addCommand(11,"linearTrickplayFps"," <x>","Set Linear Trickplay FPS (int x=trickPlayFPS)");
1235  addCommand(12,"liveOffset"," <x>","Set Live offset (int x=offset)");
1236  addCommand(13,"stallErrorCode"," <x>","Set Stall error code (int x=errorCode)");
1237  addCommand(14,"stallTimeout"," <x>","Set Stall timeout (int x=timeout)");
1238  addCommand(15,"reportInterval"," <x>","Set Report Interval (int x=interval)");
1239  addCommand(16,"videoBitrate"," <x>","Set Video Bitrate (long x=bitrate)");
1240  addCommand(17,"initialBitrate"," <x>","Set Initial Bitrate (long x = bitrate)");
1241  addCommand(18,"initialBitrate4k"," <x>","Set Initial Bitrate 4K (long x = bitrate4k)");
1242  addCommand(19,"networkTimeout"," <x>","Set Network Timeout (long x = timeout in ms)");
1243  addCommand(20,"manifestTimeout"," <x>","Set Manifest Timeout (long x = timeout in ms)");
1244  addCommand(21,"downloadBufferSize"," <x>","Set Download Buffer Size (int x = bufferSize)");
1245  addCommand(22,"preferredDrm"," <x>","Set Preferred DRM (int x=1-WV, 2-PR, 4-Access, 5-AES 6-ClearKey)");
1246  addCommand(23,"stereoOnlyPlayback"," <x>","Set Stereo only playback (x=1/0)");
1247  addCommand(24,"alternateContent","","Set Alternate Contents - dummy ()");
1248  addCommand(25,"networkProxy"," <x>","Set Set Network Proxy (string x = url)");
1249  addCommand(26,"licenseReqProxy"," <x>","Set License Request Proxy (string x=url)");
1250  addCommand(27,"downloadStallTimeout"," <x>","Set Download Stall timeout (long x=timeout)");
1251  addCommand(28,"downloadStartTimeout"," <x>","Set Download Start timeout (long x=timeout)");
1252  addCommand(29,"downloadLowBWTimeout"," <x>","Set Download Low Bandwidth timeout (long x=timeout)");
1253  addCommand(30,"preferredSubtitleLang"," <x>","Set Preferred Subtitle language (string x = lang)");
1254  addCommand(31,"parallelPlaylistDL"," <x>","Set Parallel Playlist download (x=0/1)");
1255  addCommand(32,"preferredLanguages"," <x>","Set Preferred languages (string lang1,lang2,... rendition type codec1,codec2.. ) , use null keyword to discard any argument or path to json file");
1256  addCommand(33,"preferredTextLanguages"," <x>","Set Preferred languages (string lang1,lang2,... ) , or path json file");
1257  addCommand(34,"rampDownLimit"," <x>","Set number of Ramp Down limit during the playback (x = number)");
1258  addCommand(35,"initRampdownLimit"," <x>","Set number of Initial Ramp Down limit prior to the playback (x = number)");
1259  addCommand(36,"minimumBitrate"," <x>","Set Minimum bitrate (x = bitrate)");
1260  addCommand(37,"maximumBitrate"," <x>","Set Maximum bitrate (x = bitrate)");
1261  addCommand(38,"maximumSegmentInjFailCount"," <x>","Set Maximum segment injection fail count (int x = count)");
1262  addCommand(39,"maximumDrmDecryptFailCount"," <x>","Set Maximum DRM Decryption fail count(int x = count)");
1263  addCommand(40,"registerForID3MetadataEvents"," <x>","Set Listen for ID3_METADATA events (x = 1 - add listener, x = 0 - remove)");
1264  addCommand(41,"initialBufferDuration"," <x>","Set Initial Buffer Duration (int x = Duration in sec)");
1265  addCommand(42,"audioTrack"," <x>","Set Audio track ( x = track by index (number) OR track by language properties lan,rendition,type,codec )");
1266  addCommand(43,"textTrack"," <x>","Set Text track (int x = track index)");
1267  addCommand(44,"ccStatus"," <x>","Set CC status (x = 0/1)");
1268  addCommand(45,"ccStyle"," <x>","Set a predefined CC style commandion (x = 1/2/3)");
1269  addCommand(46,"languageFormat"," <x> <y> ","Set Language Format (x = preferredFormat(0-3), y = useRole(0/1))");
1270  //addCommand("auxiliaryAudio"," <x>","Set auxiliary audio language (x = string lang)");
1271  addCommand(47,"propagateUriParam"," <x>","Set propagate uri parameters: (int x = 0 to disable)");
1272  //addCommand("rateOnTune"," <x>","Set Pre-tune rate (x= PreTuneRate)");
1273  addCommand(48,"thumbnailTrack"," <x>","Set Thumbnail Track (int x = Thumbnail Index)");
1274  addCommand(49,"sslVerifyPeer"," <x>","Set Ssl Verify Peer flag (x = 1 for enabling)");
1275  addCommand(50,"downloadDelayOnFetch"," <x>","Set delay while downloading fragments (unsigned int x = download delay in ms)");
1276  addCommand(51,"pausedBehavior"," <x>","Set Paused behavior (int x (0-3) options -\"autoplay defer\",\"autoplay immediate\",\"live defer\",\"live immediate\"");
1277  addCommand(52,"auxiliaryAudio"," <x>","Set auxiliary audio language (x = string lang)");
1278  addCommand(53,"registerForMediaMetadata"," <x>","Set Listen for AAMP_EVENT_MEDIA_METADATA events (x = 1 - add listener, x = 0 - remove)");
1279  addCommand(54,"videoTrack"," <x> <y> <z> ","Set Video tracks range (x = bitrate1, y = bitrate2, z = bitrate3) OR single bitrate provide same value for x, y,z ");
1280  addCommand(55,"dynamicDrm"," <x> ","set Dynamic DRM config in Json format x=Timeout value for response message ");
1281  addCommand(56,"liveOffset4K"," <x> ","Set Live offset 4K stream(int x=offset)");
1282  commands.push_back("help");
1283 }
1284 
1285 void Set::addCommand(int value,string command,string param,string description)
1286 {
1287  setCommandInfo lCmdInfo;
1288  lCmdInfo.value = value;
1289  lCmdInfo.param = param;
1290  lCmdInfo.description = description;
1291 
1292  setCommands.insert(std::make_pair(command,lCmdInfo));
1293  commands.push_back(command);
1294 }
1295 
1296 /**
1297  * @brief Display Help menu for set
1298  * @param none
1299  */
1301 {
1302  std::map<string,setCommandInfo>::iterator setCmdItr;
1303 
1304  printf("******************************************************************************************\n");
1305  printf("* set <command> [<arguments>]\n");
1306  printf("* Usage of Commands with arguemnts expected in ()\n");
1307  printf("******************************************************************************************\n");
1308 
1309  if(!commands.empty())
1310  {
1311 
1312  if(!commands.empty())
1313  {
1314  for(auto itr:commands)
1315  {
1316  setCmdItr = setCommands.find(itr);
1317 
1318  if(setCmdItr != setCommands.end())
1319  {
1320  std::string strCmd = setCmdItr->first + (setCmdItr->second).param;
1321  std::cout << "set " << std::right << std::setw(2) << (setCmdItr->second).value << " / " << std::setw(35) << std::left << (strCmd).c_str() << "// " << (setCmdItr->second.description).c_str() << "\n";
1322  }
1323  }
1324  }
1325  }
1326 
1327  printf("******************************************************************************************\n");
1328 }
1329 
1330 char * Set::setCommandRecommender(const char *text, int state)
1331 {
1332  char *name;
1333  static int len;
1334  static std::vector<std::string>::iterator itr;
1335 
1336  if (!state)
1337  {
1338  itr = commands.begin();
1339  len = strlen(text);
1340  }
1341 
1342  while (itr != commands.end())
1343  {
1344  name = (char *) itr->c_str();
1345  itr++;
1346  if (strncmp(name, text, len) == 0)
1347  {
1348  return strdup(name);
1349  }
1350  }
1351 
1352  return NULL;
1353 }
PlayerInstanceAAMP::ApplyArtificialDownloadDelay
void ApplyArtificialDownloadDelay(unsigned int DownloadDelayInMs)
to optionally configure simulated per-download network latency for negative testing
Definition: main_aamp.cpp:2262
PlayerInstanceAAMP::SetManifestTimeout
void SetManifestTimeout(double timeout)
Optionally override default HLS main manifest download timeout with app-specific value.
Definition: main_aamp.cpp:2000
eDRM_WideVine
@ eDRM_WideVine
Definition: AampDrmSystems.h:36
PlayerInstanceAAMP::SetRampDownLimit
void SetRampDownLimit(int limit)
Set profile ramp down limit.
Definition: main_aamp.cpp:462
VIDEO_ZOOM_FULL
@ VIDEO_ZOOM_FULL
Definition: main_aamp.h:131
eDRM_PlayReady
@ eDRM_PlayReady
Definition: AampDrmSystems.h:37
PlayerInstanceAAMP::SetPropagateUriParameters
void SetPropagateUriParameters(bool bValue)
to configure URI parameters for fragment downloads
Definition: main_aamp.cpp:2254
PlayerInstanceAAMP::SetThumbnailTrack
bool SetThumbnailTrack(int thumbIndex)
To set a preferred bitrate for thumbnail profile.
Definition: main_aamp.cpp:2687
SetCommandInfo
Definition: AampcliSet.h:35
PlayerInstanceAAMP::SetVideoZoom
void SetVideoZoom(VideoZoomMode zoom)
Set video zoom.
Definition: main_aamp.cpp:1282
VIDEO_ZOOM_NONE
@ VIDEO_ZOOM_NONE
Definition: main_aamp.h:132
Set::ShowHelpSet
void ShowHelpSet()
Display Help menu for set.
Definition: AampcliSet.cpp:1300
PlayerInstanceAAMP::SetNetworkProxy
void SetNetworkProxy(const char *proxy)
To set the network proxy.
Definition: main_aamp.cpp:2115
Set::registerSetCommands
void registerSetCommands()
Show help menu with aamp command line interface.
Definition: AampcliSet.cpp:1222
PlayerInstanceAAMP::SetContentProtectionDataUpdateTimeout
void SetContentProtectionDataUpdateTimeout(int timeout)
To set default timeout for Dynamic ContentProtectionDataUpdate on Key Rotation.
Definition: main_aamp.cpp:3163
PlayerInstanceAAMP::SetStallTimeout
void SetStallTimeout(int timeoutMS)
To set the timeout value to be used for playback stall detection.
Definition: main_aamp.cpp:1693
PlayerInstanceAAMP::SetSegmentDecryptFailCount
void SetSegmentDecryptFailCount(int value)
Set retry limit on Segment drm decryption failure.
Definition: main_aamp.cpp:427
Aampcli
Definition: Aampcli.h:61
PlayerInstanceAAMP::SetDownloadStartTimeout
void SetDownloadStartTimeout(long startTimeout)
To set the curl download start timeout.
Definition: main_aamp.cpp:2145
PlayerInstanceAAMP::SetPreferredSubtitleLanguage
void SetPreferredSubtitleLanguage(const char *language)
Set preferred subtitle language.
Definition: main_aamp.cpp:2169
PlayerInstanceAAMP::RemoveEventListener
void RemoveEventListener(AAMPEventType eventType, EventListener *eventListener)
Remove event listener for eventType.
Definition: main_aamp.cpp:1493
PlayerInstanceAAMP::SetVideoRectangle
void SetVideoRectangle(int x, int y, int w, int h)
Set video rectangle.
Definition: main_aamp.cpp:1270
PlayerInstanceAAMP::SetInitialBufferDuration
void SetInitialBufferDuration(int durationSec)
Set initial buffer duration in seconds.
Definition: main_aamp.cpp:435
Aampcli.h
AAMPcli header file.
PlayerInstanceAAMP::SetAnonymousRequest
void SetAnonymousRequest(bool isAnonymous)
Indicates if session token has to be used with license request or not.
Definition: main_aamp.cpp:1620
PlayerInstanceAAMP::SetAlternateContents
void SetAlternateContents(const std::string &adBreakId, const std::string &adId, const std::string &url)
Setting the alternate contents' (Ads/blackouts) URL.
Definition: main_aamp.cpp:2106
PlayerInstanceAAMP::SetLicenseReqProxy
void SetLicenseReqProxy(const char *licenseProxy)
To set the proxy for license request.
Definition: main_aamp.cpp:2124
PlayerInstanceAAMP::SetVideoTracks
void SetVideoTracks(std::vector< long > bitrates)
Set video tracks.
Definition: main_aamp.cpp:2420
AampcliSet.h
AampcliSet header file.
PlayerInstanceAAMP::AddEventListener
void AddEventListener(AAMPEventType eventType, EventListener *eventListener)
Support multiple listeners for multiple event type.
Definition: main_aamp.cpp:1483
PlayerInstanceAAMP::SetLanguageFormat
void SetLanguageFormat(LangCodePreference preferredFormat, bool useRole=false)
Set Language preferred Format.
Definition: main_aamp.cpp:480
PlayerInstanceAAMP::SetLinearTrickplayFPS
void SetLinearTrickplayFPS(int linearTrickplayFPS)
Set Linear Trickplay FPS.
Definition: main_aamp.cpp:1655
PlayerInstanceAAMP::SetTextTrack
void SetTextTrack(int trackId, char *ccData=NULL)
Set text track.
Definition: main_aamp.cpp:2566
PlayerInstanceAAMP::SetInitRampdownLimit
void SetInitRampdownLimit(int limit)
Set Initial profile ramp down limit.
Definition: main_aamp.cpp:2658
PlayerInstanceAAMP::SetLanguage
void SetLanguage(const char *language)
Set Audio language.
Definition: main_aamp.cpp:1389
PlayerInstanceAAMP::SetLiveOffset4K
void SetLiveOffset4K(double liveoffset)
Set Live Offset.
Definition: main_aamp.cpp:1674
PlayerInstanceAAMP::SetLiveOffset
void SetLiveOffset(double liveoffset)
Set Live Offset.
Definition: main_aamp.cpp:1664
PlayerInstanceAAMP::SetMaximumBitrate
void SetMaximumBitrate(long bitrate)
Set maximum bitrate value.
Definition: main_aamp.cpp:521
PlayerInstanceAAMP::SetVODTrickplayFPS
void SetVODTrickplayFPS(int vodTrickplayFPS)
Set VOD Trickplay FPS.
Definition: main_aamp.cpp:1646
PlayerInstanceAAMP::SetPausedBehavior
void SetPausedBehavior(int behavior)
To set preferred paused state behavior.
Definition: main_aamp.cpp:2850
PlayerInstanceAAMP::SetCCStatus
void SetCCStatus(bool enabled)
Set CC visibility on/off.
Definition: main_aamp.cpp:2620
PlayerInstanceAAMP::SetParallelPlaylistDL
void SetParallelPlaylistDL(bool bValue)
Set parallel playlist download config value.
Definition: main_aamp.cpp:2192
PlayerInstanceAAMP::SetAuxiliaryLanguage
void SetAuxiliaryLanguage(const std::string &language)
Set auxiliary language.
Definition: main_aamp.cpp:2944
PlayerInstanceAAMP
Player interface class for the JS pluggin.
Definition: main_aamp.h:692
PlayerInstanceAAMP::SetStallErrorCode
void SetStallErrorCode(int errorCode)
To set the error code to be used for playback stalled error.
Definition: main_aamp.cpp:1684
PlayerInstanceAAMP::SetDownloadBufferSize
void SetDownloadBufferSize(int bufferSize)
To set the download buffer size value.
Definition: main_aamp.cpp:2018
AAMP_EVENT_CONTENT_PROTECTION_DATA_UPDATE
@ AAMP_EVENT_CONTENT_PROTECTION_DATA_UPDATE
Definition: AampEvent.h:88
PlayerInstanceAAMP::SetAudioVolume
void SetAudioVolume(int volume)
Set Audio Volume.
Definition: main_aamp.cpp:1361
AAMP_EVENT_ID3_METADATA
@ AAMP_EVENT_ID3_METADATA
Definition: AampEvent.h:82
PlayerInstanceAAMP::SetInitialBitrate
void SetInitialBitrate(long bitrate)
To set the initial bitrate value.
Definition: main_aamp.cpp:1953
PlayerInstanceAAMP::SetPreferredTextLanguages
void SetPreferredTextLanguages(const char *param)
Set optional preferred language list.
Definition: main_aamp.cpp:2371
PlayerInstanceAAMP::SetPreferredLanguages
void SetPreferredLanguages(const char *languageList, const char *preferredRendition=NULL, const char *preferredType=NULL, const char *codecList=NULL, const char *labelList=NULL)
Set optional preferred language list.
Definition: main_aamp.cpp:2363
PlayerInstanceAAMP::SetNetworkTimeout
void SetNetworkTimeout(double timeout)
To override default curl timeout for playlist/fragment downloads.
Definition: main_aamp.cpp:1991
PlayerInstanceAAMP::SetPreferredDRM
void SetPreferredDRM(DRMSystems drmType)
Set Preferred DRM.
Definition: main_aamp.cpp:2027
PlayerInstanceAAMP::SetRateAndSeek
void SetRateAndSeek(int rate, double secondsRelativeToTuneTime)
Seek to a time and playback with a new rate.
Definition: main_aamp.cpp:1202
AAMP_EVENT_MEDIA_METADATA
@ AAMP_EVENT_MEDIA_METADATA
Definition: AampEvent.h:55
PlayerInstanceAAMP::SetSegmentInjectFailCount
void SetSegmentInjectFailCount(int value)
Set retry limit on Segment injection failure.
Definition: main_aamp.cpp:419
PlayerInstanceAAMP::SetDownloadStallTimeout
void SetDownloadStallTimeout(long stallTimeout)
To set the curl stall timeout value.
Definition: main_aamp.cpp:2133
PlayerInstanceAAMP::SetAudioTrack
void SetAudioTrack(std::string language="", std::string rendition="", std::string type="", std::string codec="", unsigned int channel=0, std::string label="")
Set audio track.
Definition: main_aamp.cpp:2282
PlayerInstanceAAMP::SetStereoOnlyPlayback
void SetStereoOnlyPlayback(bool bValue)
Set Stereo Only Playback.
Definition: main_aamp.cpp:2044
PlayerInstanceAAMP::SetLicenseServerURL
void SetLicenseServerURL(const char *url, DRMSystems type=eDRM_MAX_DRMSystems)
Set License Server URL.
Definition: main_aamp.cpp:1590
PlayerInstanceAAMP::SetVideoBitrate
void SetVideoBitrate(long bitrate)
To set a preferred bitrate for video profile.
Definition: main_aamp.cpp:1805
PlayerInstanceAAMP::SetTextStyle
void SetTextStyle(const std::string &options)
Set style options for text track rendering.
Definition: main_aamp.cpp:2638
DRMSystems
DRMSystems
DRM system types.
Definition: AampDrmSystems.h:33
PlayerInstanceAAMP::SetDownloadLowBWTimeout
void SetDownloadLowBWTimeout(long lowBWTimeout)
To set the curl download low bandwidth timeout value.
Definition: main_aamp.cpp:2157
PlayerInstanceAAMP::SetSubscribedTags
void SetSubscribedTags(std::vector< std::string > subscribedTags)
Set array of subscribed tags.
Definition: main_aamp.cpp:1415
PlayerInstanceAAMP::SetMinimumBitrate
void SetMinimumBitrate(long bitrate)
Set minimum bitrate value.
Definition: main_aamp.cpp:494
PlayerInstanceAAMP::SetVideoMute
void SetVideoMute(bool muted)
Enable/ Disable Video.
Definition: main_aamp.cpp:1303
LangCodePreference
LangCodePreference
Language Code Preference types.
Definition: main_aamp.h:165
PlayerInstanceAAMP::SetReportInterval
void SetReportInterval(int reportInterval)
To set the Playback Position reporting interval.
Definition: main_aamp.cpp:1702
PlayerInstanceAAMP::SetInitialBitrate4K
void SetInitialBitrate4K(long bitrate4K)
To set the initial bitrate value for 4K assets.
Definition: main_aamp.cpp:1972
PlayerInstanceAAMP::SetSslVerifyPeerConfig
void SetSslVerifyPeerConfig(bool bValue)
Configure URI parameters.
Definition: main_aamp.cpp:2273