29 std::map<string,setCommandInfo> Set::setCommands = std::map<string,setCommandInfo>();
30 std::vector<std::string> Set::commands(0);
34 printf(
"%s:%d:cmd %s\n", __FUNCTION__, __LINE__,cmd);
38 unsigned int DownloadDelayInMs = 0;
41 if (sscanf(cmd,
"set %s", command) == 1)
43 if(isdigit(command[0]))
45 setCmd = atoi(command);
49 std::map<string,setCommandInfo>::iterator setCmdItr;
50 setCmdItr = setCommands.find(command);
52 if(setCmdItr != setCommands.end())
54 setCmd = setCmdItr->second.value;
58 if(0 == strncmp(
"help", command, 4))
60 printf(
"%s:%d:in help %s\n", __FUNCTION__, __LINE__,cmd);
70 double relativeTuneTime;
71 printf(
"[AAMPCLI] Matched Command RateAndSeek - %s\n", cmd);
72 if (sscanf(cmd,
"set %s %d %lf", command, &rate, &relativeTuneTime ) == 3){
77 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
78 printf(
"[AAMPCLI] Expected: set %s <rate=0,1 etc> <seek time in sec>\n", command);
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){
92 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
93 printf(
"[AAMPCLI] Expected: set %s <x> <y> <w> <h>\n", command);
101 printf(
"[AAMPCLI] Matched Command VideoZoom - %s\n", cmd);
102 if (sscanf(cmd,
"set %s %d", command, &videoZoom) == 2){
107 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
108 printf(
"[AAMPCLI] Expected: set %s <value value>0? ZOOM_FULL : ZOOM_NONE>\n", command);
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 );
122 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
123 printf(
"[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
131 printf(
"[AAMPCLI] Matched Command AudioVolume - %s\n", cmd);
132 if (sscanf(cmd,
"set %s %d", command, &vol) == 2){
137 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
138 printf(
"[AAMPCLI] Expected: set %s <value to set audio volume>\n", command);
146 printf(
"[AAMPCLI] Matched Command Language - %s\n", cmd);
147 if (sscanf(cmd,
"set %s %s", command, lang) == 2){
152 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
153 printf(
"[AAMPCLI] Expected: set %s <lang in string>\n", command);
161 std::vector<std::string> subscribedTags;
162 printf(
"[AAMPCLI] Matched Command SubscribedTags - %s\n", cmd);
169 char lisenceUrl[1024];
171 printf(
"[AAMPCLI] Matched Command LicenseServerUrl - %s\n", cmd);
172 if (sscanf(cmd,
"set %s %s %d", command, lisenceUrl, &drmType) == 3){
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);
187 printf(
"[AAMPCLI] Matched Command AnonymousRequest - %s\n", cmd);
188 if (sscanf(cmd,
"set %s %d", command, &isAnonym) == 2){
193 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
194 printf(
"[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
202 printf(
"[AAMPCLI] Matched Command VodTrickplayFps - %s\n", cmd);
203 if (sscanf(cmd,
"set %s %d", command, &vodTFps) == 2){
208 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
209 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
217 printf(
"[AAMPCLI] Matched Command LinearTrickplayFps - %s\n", cmd);
218 if (sscanf(cmd,
"set %s %d", command, &linearTFps) == 2){
223 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
224 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
232 printf(
"[AAMPCLI] Matched Command LiveOffset - %s\n", cmd);
233 if (sscanf(cmd,
"set %s %lf", command, &liveOffset) == 2){
238 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
239 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
246 printf(
"[AAMPCLI] Matched Command LiveOffset4K - %s\n", cmd);
247 if (sscanf(cmd,
"set %s %lf", command, &liveOffset) == 2){
252 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
253 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
261 printf(
"[AAMPCLI] Matched Command StallErrorCode - %s\n", cmd);
262 if (sscanf(cmd,
"set %s %d", command, &stallErrorCode) == 2){
267 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
268 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
276 printf(
"[AAMPCLI] Matched Command StallTimeout - %s\n", cmd);
277 if (sscanf(cmd,
"set %s %d", command, &stallTimeout) == 2){
286 printf(
"[AAMPCLI] Matched Command ReportInterval - %s\n", cmd);
287 if (sscanf(cmd,
"set %s %d", command, &reportInterval) == 2){
292 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
293 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
301 printf(
"[AAMPCLI] Matched Command VideoBitarate - %s\n", cmd);
302 if (sscanf(cmd,
"set %s %ld", command, &videoBitrate) == 2){
307 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
308 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
316 printf(
"[AAMPCLI] Matched Command InitialBitrate - %s\n", cmd);
317 if (sscanf(cmd,
"set %s %ld", command, &initialBitrate) == 2){
322 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
323 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
330 long initialBitrate4k;
331 printf(
"[AAMPCLI] Matched Command InitialBitrate4k - %s\n", cmd);
332 if (sscanf(cmd,
"set %s %ld", command, &initialBitrate4k) == 2){
337 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
338 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
345 double networkTimeout;
346 printf(
"[AAMPCLI] Matched Command NetworkTimeout - %s\n", cmd);
347 if (sscanf(cmd,
"set %s %lf", command, &networkTimeout) == 2){
352 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
353 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
360 double manifestTimeout;
361 printf(
"[AAMPCLI] Matched Command ManifestTimeout - %s\n", cmd);
362 if (sscanf(cmd,
"set %s %lf", command, &manifestTimeout) == 2){
367 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
368 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
375 int downloadBufferSize;
376 printf(
"[AAMPCLI] Matched Command DownloadBufferSize - %s\n", cmd);
377 if (sscanf(cmd,
"set %s %d", command, &downloadBufferSize) == 2){
382 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
383 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
391 printf(
"[AAMPCLI] Matched Command PreferredDrm - %s\n", cmd);
392 if (sscanf(cmd,
"set %s %d", command, &preferredDrm) == 2){
397 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
398 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
405 int stereoOnlyPlayback;
406 printf(
"[AAMPCLI] Matched Command StereoOnlyPlayback - %s\n", cmd);
407 if (sscanf(cmd,
"set %s %d", command, &stereoOnlyPlayback) == 2){
409 (stereoOnlyPlayback == 1 )?
true:
false);
413 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
414 printf(
"[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
422 std::string adBrkId =
"";
423 std::string adId =
"";
424 std::string url =
"";
425 printf(
"[AAMPCLI] Matched Command AlternateContent - %s\n", cmd);
432 char networkProxy[128];
433 printf(
"[AAMPCLI] Matched Command NetworkProxy - %s\n", cmd);
434 if (sscanf(cmd,
"set %s %s", command, networkProxy) == 2){
439 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
440 printf(
"[AAMPCLI] Expected: set %s <value in string>\n", command);
447 char licenseReqProxy[128];
448 printf(
"[AAMPCLI] Matched Command LicenseReqProxy - %s\n", cmd);
449 if (sscanf(cmd,
"set %s %s", command, licenseReqProxy) == 2){
454 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
455 printf(
"[AAMPCLI] Expected: set %s <value in string>\n", command);
462 long downloadStallTimeout;
463 printf(
"[AAMPCLI] Matched Command DownloadStallTimeout - %s\n", cmd);
464 if (sscanf(cmd,
"set %s %ld", command, &downloadStallTimeout) == 2){
469 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
470 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
477 long downloadStartTimeout;
478 printf(
"[AAMPCLI] Matched Command DownloadStartTimeout - %s\n", cmd);
479 if (sscanf(cmd,
"set %s %ld", command, &downloadStartTimeout) == 2){
484 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
485 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
492 long downloadLowBWTimeout;
493 printf(
"[AAMPCLI] Matched Command DownloadLowBWTimeout - %s\n", cmd);
494 if (sscanf(cmd,
"set %s %ld", command, &downloadLowBWTimeout) == 2){
499 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
500 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
507 char preferredSubtitleLang[12];
508 printf(
"[AAMPCLI] Matched Command PreferredSubtitleLang - %s\n", cmd);
509 if (sscanf(cmd,
"set %s %s", command, preferredSubtitleLang) == 2){
514 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
515 printf(
"[AAMPCLI] Expected: set %s <value in string>\n", command);
522 int parallelPlaylistDL;
523 printf(
"[AAMPCLI] Matched Command ParallelPlaylistDL - %s\n", cmd);
524 if (sscanf(cmd,
"set %s %d", command, ¶llelPlaylistDL) == 2){
529 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
530 printf(
"[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
537 char preferredLanguages[128];
538 char preferredLabel[128];
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);
554 if (sscanf(cmd,
"set %s %s %s %s %s %s", command, preferredLanguages, rendition, type, preferredCodec, preferredLabel) == 6)
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"))
560 prefLanPresent =
true;
562 if (0 != strcasecmp(preferredCodec,
"null"))
564 prefCodecPresent =
true;
566 if (0 != strcasecmp(rendition,
"null"))
568 prefRendPresent =
true;
570 if (0 != strcasecmp(type,
"null"))
572 prefTypePresent =
true;
574 if (0 != strcasecmp(preferredLabel,
"null"))
576 prefLabelPresent =
true;
580 prefRendPresent?rendition:NULL,
581 prefTypePresent?type:NULL,
582 prefCodecPresent?preferredCodec:NULL,
583 prefLabelPresent?preferredLabel:NULL);
585 else if (sscanf(cmd,
"set %s %s %s %s %s", command, preferredLanguages, rendition, type, preferredCodec) == 5)
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"))
591 prefLanPresent =
true;
593 if (0 != strcasecmp(preferredCodec,
"null"))
595 prefCodecPresent =
true;
597 if (0 != strcasecmp(rendition,
"null"))
599 prefRendPresent =
true;
601 if (0 != strcasecmp(type,
"null"))
603 prefTypePresent =
true;
607 prefRendPresent?rendition:NULL,
608 prefTypePresent?type:NULL,
609 prefCodecPresent?preferredCodec:NULL);
611 else if (sscanf(cmd,
"set %s %s %s %s", command, preferredLanguages, rendition, type) == 4)
613 printf(
"[AAMPCLI] setting PreferredLanguages (%s) with rendition (%s) and type (%s)\n" ,
614 preferredLanguages, rendition, type);
615 if (0 != strcasecmp(preferredLanguages,
"null"))
617 prefLanPresent =
true;
619 if (0 != strcasecmp(rendition,
"null"))
621 prefRendPresent =
true;
623 if (0 != strcasecmp(type,
"null"))
625 prefTypePresent =
true;
628 prefRendPresent?rendition:NULL,
629 prefTypePresent?type:NULL);
631 else if (sscanf(cmd,
"set %s %s %s", command, preferredLanguages, rendition) == 3)
633 printf(
"[AAMPCLI] setting PreferredLanguages (%s) with rendition (%s)\n" ,
634 preferredLanguages, rendition);
635 if (0 != strcasecmp(preferredLanguages,
"null"))
637 prefLanPresent =
true;
639 if (0 != strcasecmp(rendition,
"null"))
641 prefRendPresent =
true;
644 prefRendPresent?rendition:NULL);
646 else if (sscanf(cmd,
"set %s %s", command, preferredLanguages) == 2)
648 printf(
"[AAMPCLI] setting PreferredLanguages (%s)\n",preferredLanguages );
649 if (0 != strcasecmp(preferredLanguages,
"null"))
651 std::ifstream infile(preferredLanguages);
652 std::string line =
"";
653 std::string data =
"";
657 printf(
"[AAMPCLI] File Path for Json Data (%s)\n",preferredLanguages );
658 while ( getline (infile,line) )
670 data = std::string(preferredLanguages);
673 printf(
"[AAMPCLI] setting PreferredLanguages (%s)\n",data.c_str());
678 printf(
"[AAMPCLI] ERROR: Invalid arguments- %s\n", cmd);
679 printf(
"[AAMPCLI] set preferred languages must be set at least a language\n");
685 printf(
"[AAMPCLI] ERROR: Mismatch in arguments- %s\n", cmd);
686 printf(
"[AAMPCLI] set preferred languages must be run with atleast 2 argument\n");
693 char preferredLanguages[128];
694 if (sscanf(cmd,
"set %s %s", command, preferredLanguages) == 2)
696 printf(
"[AAMPCLI] setting PreferredText (%s)\n",preferredLanguages );
697 if (0 != strcasecmp(preferredLanguages,
"null"))
699 std::ifstream infile(preferredLanguages);
700 std::string line =
"";
701 std::string data =
"";
705 while ( getline (infile,line) )
717 data = std::string(preferredLanguages);
719 printf(
"[AAMPCLI] JSON Argument Recieved- %s\n", data.c_str());
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");
730 printf(
"[AAMPCLI] ERROR: Mismatch in arguments- %s\n", cmd);
731 printf(
"[AAMPCLI] set preferred languages must be run with 2 argument\n");
739 printf(
"[AAMPCLI] Matched Command InitRampdownLimit - %s\n", cmd);
740 if (sscanf(cmd,
"set %s %d", command, &rampDownLimit) == 2){
745 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
746 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
754 printf(
"[AAMPCLI] Matched Command RampDownLimit - %s\n", cmd);
755 if (sscanf(cmd,
"set %s %d", command, &rampDownLimit) == 2){
760 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
761 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
769 printf(
"[AAMPCLI] Matched Command MinimumBitrate - %s\n", cmd);
770 if (sscanf(cmd,
"set %s %ld", command, &minBitrate) == 2){
775 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
776 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
784 printf(
"[AAMPCLI] Matched Command MaximumBitrate - %s\n", cmd);
785 if (sscanf(cmd,
"set %s %ld", command, &maxBitrate) == 2){
790 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
791 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
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);
808 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
809 printf(
"[AAMPCLI] Expected: set %s <value1> <value2> <value3>\n", command);
816 printf(
"[AAMPCLI] Matched Command MaximumSegmentInjFailCount - %s\n", cmd);
817 if (sscanf(cmd,
"set %s %d", command, &failCount) == 2){
822 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
823 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
831 printf(
"[AAMPCLI] Matched Command SslVerifyPeer - %s\n", cmd);
832 if (sscanf(cmd,
"set %s %d", command, &value) == 2){
837 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
838 printf(
"[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
846 printf(
"[AAMPCLI] Matched Command MaximumDrmDecryptFailCount - %s\n", cmd);
847 if (sscanf(cmd,
"set %s %d", command, &failCount) == 2){
852 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
853 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
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)
875 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
876 printf(
"[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
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)
897 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
898 printf(
"[AAMPCLI] Expected: set %s <value 0 or 1>\n", command);
906 int preferenceInt = 0;
907 int bDescriptiveAudioTrack = 0;
908 if (sscanf(cmd,
"set %s %d %d", command, &preferenceInt, &bDescriptiveAudioTrack ) >= 2)
915 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
916 printf(
"[AAMPCLI] Expected: set %s <value for preference> <value for track number>\n", command);
924 printf(
"[AAMPCLI] Matched Command InitialBufferDuration - %s\n", cmd);
925 if (sscanf(cmd,
"set %s %d", command, &duration) == 2)
931 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
932 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
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)
947 else if (sscanf(cmd,
"set %s %s", command, strTrackInfo) == 2)
949 std::string substr =
"";
950 std::string language =
"";
951 std::string rendition =
"";
952 std::string codec =
"";
953 std::string type =
"";
954 std::string label =
"";
956 std::stringstream ss(strTrackInfo);
959 if (std::getline(ss, substr,
',')){
966 if (std::getline(ss, substr,
',')){
973 if (std::getline(ss, substr,
',')){
980 if (std::getline(ss, substr,
',')){
987 if (std::getline(ss, substr,
',')){
989 channel = std::stoi(substr);
993 if (std::getline(ss, substr,
',')){
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);
1011 printf(
"[AAMPCLI] Matched Command TextTrack - %s\n", cmd);
1012 if (sscanf(cmd,
"set %s %127s", command, sidecar) == 2)
1014 std::ifstream inFile(sidecar);
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';
1028 else if (sscanf(cmd,
"set %s %d", command, &track) == 2)
1035 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
1036 printf(
"[AAMPCLI] Expected: set %s <value> OR set %s <file>\n", command, command);
1041 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
1042 printf(
"[AAMPCLI] set %s must be run with 1 argument\n", command);
1050 printf(
"[AAMPCLI] Matched Command CCStatus - %s\n", cmd);
1051 if (sscanf(cmd,
"set %s %d", command, &status) == 2)
1057 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
1058 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
1065 std::string options;
1070 printf(
"[AAMPCLI] Matched Command CCStyle - %s\n", cmd);
1071 if (sscanf(cmd,
"set %s %d %c", command, &value, &tempChar) == 2)
1076 options = std::string(CC_OPTION_1);
1079 options = std::string(CC_OPTION_2);
1082 options = std::string(CC_OPTION_3);
1085 printf(
"[AAMPCLI] Invalid option passed %d. skipping!\n", value);
1089 else if (sscanf(cmd,
"set %s %127s", command, jsonFile) == 2)
1091 std::ifstream infile(jsonFile);
1092 std::string line =
"";
1096 while ( getline (infile,line) )
1098 if (!options.empty())
1107 printf(
"[AAMPCLI] Invalid filename passed %s. skipping!\n", jsonFile);
1111 if (!options.empty())
1117 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
1118 printf(
"[AAMPCLI] Expected: set %s <value 1,2 or 3> or json file\n", command);
1125 int propagateUriParam;
1126 printf(
"[AAMPCLI] Matched Command PropogateUriParam - %s\n", cmd);
1127 if (sscanf(cmd,
"set %s %d", command, &propagateUriParam) == 2){
1132 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
1133 printf(
"[AAMPCLI] Expected: set %s <value>\n", command);
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");
1147 printf(
"[AAMPCLI] Matched Command DownloadDelayOnFetch - %s\n",cmd);
1148 sscanf(cmd,
"set %s %d", command, &DownloadDelayInMs);
1157 printf(
"[AAMPCLI] Matched Command PausedBehavior - %s\n", cmd);
1158 if(sscanf(cmd,
"set %s %d", command, &rate) == 2)
1164 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
1165 printf(
"[AAMPCLI] Expected: set %s <value 0,1,2 or 3>\n", command);
1173 printf(
"[AAMPCLI] Matched Command AuxiliaryAudio - %s\n", cmd);
1174 if (sscanf(cmd,
"set %s %s", command, lang) == 2)
1180 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
1181 printf(
"[AAMPCLI] Expected: set %s <value in string>\n", command);
1189 if (sscanf(cmd,
"set %s %d", command, &timeout) == 2)
1191 printf(
"[AAMPCLI] Enabling AAMP_EVENT_CONTENT_PROTECTION_DATA_UPDATE event registration");
1197 printf(
"[AAMPCLI] ERROR: Mismatch in arguments\n");
1198 printf(
"[AAMPCLI] Expected: set %s <value in Milliseconds>\n", command);
1204 printf(
"[AAMPCLI] Invalid set command %s\n", command);
1212 printf(
"[AAMPCLI] Invalid set command = %s\n", cmd);
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))");
1271 addCommand(47,
"propagateUriParam",
" <x>",
"Set propagate uri parameters: (int x = 0 to disable)");
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");
1285 void Set::addCommand(
int value,
string command,
string param,
string description)
1288 lCmdInfo.value = value;
1289 lCmdInfo.param = param;
1290 lCmdInfo.description = description;
1292 setCommands.insert(std::make_pair(command,lCmdInfo));
1293 commands.push_back(command);
1302 std::map<string,setCommandInfo>::iterator setCmdItr;
1304 printf(
"******************************************************************************************\n");
1305 printf(
"* set <command> [<arguments>]\n");
1306 printf(
"* Usage of Commands with arguemnts expected in ()\n");
1307 printf(
"******************************************************************************************\n");
1309 if(!commands.empty())
1312 if(!commands.empty())
1314 for(
auto itr:commands)
1316 setCmdItr = setCommands.find(itr);
1318 if(setCmdItr != setCommands.end())
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";
1327 printf(
"******************************************************************************************\n");
1330 char * Set::setCommandRecommender(
const char *text,
int state)
1334 static std::vector<std::string>::iterator itr;
1338 itr = commands.begin();
1342 while (itr != commands.end())
1344 name = (
char *) itr->c_str();
1346 if (strncmp(name, text, len) == 0)
1348 return strdup(name);