![]() |
RDK Documentation (Open Sourced RDK Components)
|
Common utility functions. More...
#include "AampUtils.h"#include "_base64.h"#include "AampConfig.h"#include "AampConstants.h"#include <sys/time.h>#include <string.h>#include <assert.h>#include <ctime>#include <curl/curl.h>#include <sys/types.h>#include <sys/stat.h>#include <fstream>#include <dirent.h>#include <algorithm>
Go to the source code of this file.
Enumerations | |
| enum | HarvestConfigType |
| Harvest Configuration type. More... | |
Functions | |
| long long | aamp_GetCurrentTimeMS (void) |
| Get current time from epoch is milliseconds. More... | |
| void | getDefaultHarvestPath (std::string &value) |
| Get harvest path to dump the files. | |
| static const char * | ParseUriProtocol (const char *uri) |
| parse leading protcocol from uri if present More... | |
| void | aamp_ResolveURL (std::string &dst, std::string base, const char *uri, bool bPropagateUriParams) |
| Resolve file URL from the base and file path. | |
| bool | aamp_IsAbsoluteURL (const std::string &url) |
| distinguish between absolute and relative urls More... | |
| std::string | aamp_getHostFromURL (std::string url) |
| Extract host string from url. More... | |
| bool | aamp_IsLocalHost (std::string Hostname) |
| check is local or not from given hostname More... | |
| bool | aamp_StartsWith (const char *inputStr, const char *prefix) |
| Check if string start with a prefix. More... | |
| char * | aamp_Base64_URL_Encode (const unsigned char *src, size_t len) |
| convert blob of binary data to ascii base64-URL-encoded equivalent More... | |
| unsigned char * | aamp_Base64_URL_Decode (const char *src, size_t *len, size_t srcLen) |
| decode base64 URL encoded data to binary equivalent More... | |
| void | aamp_DecodeUrlParameter (std::string &uriParam) |
| unescape uri-encoded uri parameter More... | |
| double | ISO8601DateTimeToUTCSeconds (const char *ptr) |
| Parse date time from ISO8601 string and return value in seconds. More... | |
| static size_t | MyRpcWriteFunction (void *buffer, size_t size, size_t nmemb, void *context) |
| std::string | aamp_PostJsonRPC (std::string id, std::string method, std::string params) |
| aamp_PostJsonRPC posts JSONRPC data | |
| int | aamp_GetDeferTimeMs (long maxTimeSeconds) |
| Get time to defer DRM acquisition. More... | |
| DRMSystems | GetDrmSystem (std::string drmSystemID) |
| Get DRM system from ID. More... | |
| const char * | GetDrmSystemName (DRMSystems drmSystem) |
| Get name of DRM system. More... | |
| const char * | GetDrmSystemID (DRMSystems drmSystem) |
| Get ID of DRM system. More... | |
| void | UrlEncode (std::string inStr, std::string &outStr) |
| Encode URL. More... | |
| void | trim (std::string &src) |
| Trim a string. | |
| std::string | Getiso639map_NormalizeLanguageCode (std::string lang, LangCodePreference preferLangFormat) |
| To get the preferred iso639mapped language code. More... | |
| struct timespec | aamp_GetTimespec (int timeInMs) |
| To get the timespec. More... | |
| static void | createdir (const char *dirpath) |
| Inline function to create directory. More... | |
| int | getHarvestConfigForMedia (MediaType fileType) |
| Get harvest config corresponds to Media type. More... | |
| bool | aamp_WriteFile (std::string fileName, const char *data, size_t len, MediaType &fileType, unsigned int count, const char *prefix) |
| Write - file to storage. | |
| float | getWorkingTrickplayRate (float rate) |
| Get compatible trickplay for 6s cadense of iframe track from the given rates. | |
| float | getPseudoTrickplayRate (float rate) |
| Get reverse map the working rates to the rates given by platform player. | |
| void | stream2hex (const std::string str, std::string &hexstr, bool capital) |
| Convert string of chars to its representative string of hex numbers. | |
| void | mssleep (int milliseconds) |
| Sleep for given milliseconds. | |
| const char * | GetAudioFormatStringForCodec (StreamOutputFormat input) |
| const FormatMap * | GetAudioFormatForCodec (const char *codecs) |
| const FormatMap * | GetVideoFormatForCodec (const char *codecs) |
Variables | |
| const FormatMap | mAudioFormatMap [] |
| const FormatMap | mVideoFormatMap [] |
Common utility functions.
Definition in file AampUtils.cpp.
| enum HarvestConfigType |
Harvest Configuration type.
Definition at line 758 of file AampUtils.cpp.
| aamp_GetCurrentTimeMS | ( | void | ) |
Get current time from epoch is milliseconds.
| - | current time in milliseconds |
Definition at line 92 of file AampUtils.cpp.
|
static |
parse leading protcocol from uri if present
| [in] | uri | manifest/ fragment uri |
| return | pointer just past protocol (i.e. http://) if present (or) return NULL uri doesn't start with protcol |
Definition at line 127 of file AampUtils.cpp.
| bool aamp_IsAbsoluteURL | ( | const std::string & | url | ) |
distinguish between absolute and relative urls
Definition at line 221 of file AampUtils.cpp.
| std::string aamp_getHostFromURL | ( | std::string | url | ) |
Extract host string from url.
| host | of input url |
Definition at line 232 of file AampUtils.cpp.
| bool aamp_IsLocalHost | ( | std::string | Hostname | ) |
check is local or not from given hostname
| true | if localhost, false otherwise. |
Definition at line 267 of file AampUtils.cpp.
| bool aamp_StartsWith | ( | const char * | inputStr, |
| const char * | prefix | ||
| ) |
Check if string start with a prefix.
| TRUE | if substring is found in bigstring |
Definition at line 284 of file AampUtils.cpp.
| char* aamp_Base64_URL_Encode | ( | const unsigned char * | src, |
| size_t | len | ||
| ) |
convert blob of binary data to ascii base64-URL-encoded equivalent
| pointer | to malloc'd cstring containing base64 URL encoded version of string |
| NULL | if insufficient memory to allocate base64-URL-encoded copy |
Definition at line 304 of file AampUtils.cpp.
| unsigned char* aamp_Base64_URL_Decode | ( | const char * | src, |
| size_t * | len, | ||
| size_t | srcLen | ||
| ) |
decode base64 URL encoded data to binary equivalent
| pointer | to malloc'd memory containing decoded binary data |
| NULL | if insufficient memory to allocate decoded data |
Definition at line 340 of file AampUtils.cpp.
| void aamp_DecodeUrlParameter | ( | std::string & | uriParam | ) |
unescape uri-encoded uri parameter
| uriParam | string to un-escape |
Definition at line 366 of file AampUtils.cpp.
| double ISO8601DateTimeToUTCSeconds | ( | const char * | ptr | ) |
Parse date time from ISO8601 string and return value in seconds.
| durationMs | duration in milliseconds |
Definition at line 387 of file AampUtils.cpp.
| int aamp_GetDeferTimeMs | ( | long | maxTimeSeconds | ) |
Get time to defer DRM acquisition.
Definition at line 539 of file AampUtils.cpp.
| DRMSystems GetDrmSystem | ( | std::string | drmSystemID | ) |
Get DRM system from ID.
| drmSystem | drm system |
Definition at line 601 of file AampUtils.cpp.
| const char* GetDrmSystemName | ( | DRMSystems | drmSystem | ) |
Get name of DRM system.
| Name | of the DRM system, empty string if not supported |
Definition at line 625 of file AampUtils.cpp.
| const char* GetDrmSystemID | ( | DRMSystems | drmSystem | ) |
Get ID of DRM system.
| ID | of the DRM system, empty string if not supported |
Definition at line 649 of file AampUtils.cpp.
| void UrlEncode | ( | std::string | inStr, |
| std::string & | outStr | ||
| ) |
| std::string Getiso639map_NormalizeLanguageCode | ( | std::string | lang, |
| LangCodePreference | preferLangFormat | ||
| ) |
To get the preferred iso639mapped language code.
| [out] | preferred iso639 mapped language. |
Definition at line 725 of file AampUtils.cpp.
| struct timespec aamp_GetTimespec | ( | int | timeInMs | ) |
|
inlinestatic |
Inline function to create directory.
| dirpath | - path name |
Definition at line 786 of file AampUtils.cpp.
| int getHarvestConfigForMedia | ( | MediaType | fileType | ) |
Get harvest config corresponds to Media type.
Definition at line 807 of file AampUtils.cpp.
| const FormatMap mAudioFormatMap[] |
Definition at line 61 of file AampUtils.cpp.
| const FormatMap mVideoFormatMap[] |
Definition at line 78 of file AampUtils.cpp.