|
RDK Documentation (Open Sourced RDK Components)
|
26 #ifndef __AAMP_UTILS_H__
27 #define __AAMP_UTILS_H__
37 #define NOW_SYSTEM_TS_MS std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count()
38 #define NOW_STEADY_TS_MS std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count()
40 #define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0]))
43 #define SAFE_DELETE(ptr) { delete(ptr); ptr = NULL; }
45 #define SAFE_DELETE_ARRAY(ptr) { delete [] ptr; ptr = NULL; }
48 #define AAMP_FHD_HEIGHT (1080)
76 const FormatMap * GetAudioFormatForCodec(
const char *codecs );
85 const FormatMap * GetVideoFormatForCodec(
const char *codecs );
125 void aamp_ResolveURL(std::string& dst, std::string base,
const char *uri ,
bool bPropagateUriParams);
167 std::string
aamp_PostJsonRPC( std::string
id, std::string method, std::string params );
200 void UrlEncode(std::string inStr, std::string &outStr);
206 void trim(std::string& src);
230 bool aamp_WriteFile(std::string fileName,
const char* data,
size_t len,
MediaType &fileType,
unsigned int count,
const char *prefix);
262 void stream2hex(
const std::string str, std::string& hexstr,
bool capital =
false);
268 void mssleep(
int milliseconds);
270 #define MAX_RANGE_STRING_CHARS 128
272 #define WRITE_HASCII( DST, BYTE ) \
274 *DST++ = "0123456789abcdef"[BYTE>>4]; \
275 *DST++ = "0123456789abcdef"[BYTE&0xf]; \
StreamOutputFormat
Media output format.
ISO639 is a standard with representation of names for languages.
std::string aamp_PostJsonRPC(std::string id, std::string method, std::string params)
aamp_PostJsonRPC posts JSONRPC data
Types and APIs exposed by the AAMP player.
void UrlEncode(std::string inStr, std::string &outStr)
Encode URL.
std::string Getiso639map_NormalizeLanguageCode(std::string lang, LangCodePreference preferLangFormat)
To get the preferred iso639mapped language code.
int getHarvestConfigForMedia(MediaType fileType)
Get harvest config corresponds to Media type.
bool aamp_StartsWith(const char *inputStr, const char *prefix)
Check if string start with a prefix.
void aamp_DecodeUrlParameter(std::string &uriParam)
unescape uri-encoded uri parameter
const char * GetDrmSystemName(DRMSystems drmSystem)
Get name of DRM system.
bool aamp_WriteFile(std::string fileName, const char *data, size_t len, MediaType &fileType, unsigned int count, const char *prefix)
Write - file to storage.
bool aamp_IsLocalHost(std::string Hostname)
check is local or not from given hostname
void stream2hex(const std::string str, std::string &hexstr, bool capital)
Convert string of chars to its representative string of hex numbers.
struct timespec aamp_GetTimespec(int timeInMs)
To get the timespec.
void trim(std::string &src)
Trim a string.
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.
int aamp_GetDeferTimeMs(long maxTimeSeconds)
Get time to defer DRM acquisition.
std::string aamp_getHostFromURL(std::string url)
Extract host string from url.
unsigned char * aamp_Base64_URL_Decode(const char *src, size_t *len, size_t srcLen)
decode base64 URL encoded data to binary equivalent
void getDefaultHarvestPath(std::string &value)
Get harvest path to dump the files.
double ISO8601DateTimeToUTCSeconds(const char *ptr)
Parse date time from ISO8601 string and return value in seconds.
char * aamp_Base64_URL_Encode(const unsigned char *src, size_t len)
convert blob of binary data to ascii base64-URL-encoded equivalent
const char * GetDrmSystemID(DRMSystems drmSystem)
Get ID of DRM system.
long long aamp_GetCurrentTimeMS(void)
Get current time from epoch is milliseconds.
void aamp_ResolveURL(std::string &dst, std::string base, const char *uri, bool bPropagateUriParams)
Resolve file URL from the base and file path.
DRMSystems
DRM system types.
void mssleep(int milliseconds)
Sleep for given milliseconds.
LangCodePreference
Language Code Preference types.
bool aamp_IsAbsoluteURL(const std::string &url)
distinguish between absolute and relative urls
DRMSystems GetDrmSystem(std::string drmSystemID)
Get DRM system from ID.