//YUV convert to RGB void YCbCrT_to_RGBA(int Y, int Cb, int Cr, int T, uint8_t *R, uint8_t *G, uint8_t *B, uint8_t *A) { int r, g, b; int Ey, Epb, Epr; Ey = (Y - 16); Epb = (Cb - 128); Epr = (Cr - 128); /* ITU-R 709 */ r = STD_MAX(STD_MIN(((298 * Ey + 460 * Epr) / 256), 255), 0); g = STD_MAX(STD_MIN(((298 * Ey - 55 * Epb - 137 * Epr) / 256), 255), 0); b = STD_MAX(STD_MIN(((298 * Ey + 543 * Epb ) / 256), 255), 0); *R = (uint8_t)r; *G = (uint8_t)g; *B = (uint8_t)b; *A = T; }
/** @brief Parses the input URL and fills in the default port if port already * not present. * * @param[in] pDefaultPort - Default HTTP port to use if port not present in URL * @param[out] pLaunchURL - Launch URL used to connect to server * @return * TRUE - Launch URL ready * FALSE - Otherwise */ bool PlaylistDownloadHelper::ParseURL ( const char* pDefaultPort, char*& pLaunchURL ) { bool bOk = false; URL url(GetURL()); size_t launchURLLen = url.GetUrlLength() + 1; uint32 port = 0; if (pLaunchURL) { QTV_Free(pLaunchURL); pLaunchURL = NULL; } if (url.GetPort(&port) == URL::URL_OK) { if (port) { pLaunchURL = (char*)QTV_Malloc(launchURLLen); if (pLaunchURL && url.GetUrlBuffer()) { bOk = true; (void)std_strlcpy(pLaunchURL, url.GetUrlBuffer(), launchURLLen); } } else if (pDefaultPort) { char hostName[HTTP_MAX_HOSTNAME_LEN] = {0}; //Extra space for ":9300" launchURLLen += std_strlen(pDefaultPort) + 1; pLaunchURL = (char*)QTV_Malloc(launchURLLen); if (pLaunchURL && url.GetHost(hostName, sizeof(hostName)) == URL::URL_OK) { //Write http:// size_t arg2 = std_strlen("http://") + 1; size_t dstBufLen = STD_MIN(launchURLLen, arg2); size_t numURLBytes = std_strlcpy(pLaunchURL, "http://", dstBufLen); //Write hostname arg2 = std_strlen(hostName) + 1; dstBufLen = STD_MIN(launchURLLen - numURLBytes, arg2); numURLBytes += std_strlcpy(pLaunchURL + numURLBytes, hostName, dstBufLen); //Write : arg2 = std_strlen(":") + 1; dstBufLen = STD_MIN(launchURLLen - numURLBytes, arg2); numURLBytes += std_strlcpy(pLaunchURL + numURLBytes, ":", dstBufLen); //Write default port arg2 = std_strlen(pDefaultPort) + 1; dstBufLen = STD_MIN(launchURLLen - numURLBytes, arg2); numURLBytes += std_strlcpy(pLaunchURL + numURLBytes, pDefaultPort, dstBufLen); //Write / arg2 = std_strlen("/") + 1; dstBufLen = STD_MIN(launchURLLen - numURLBytes, arg2); numURLBytes += std_strlcpy(pLaunchURL + numURLBytes, "/", dstBufLen); //Write clipname dstBufLen = launchURLLen - numURLBytes; char* pClipName = NULL; pClipName = (char*)QTV_Malloc(dstBufLen); if (pClipName) { if (url.GetClipName(pClipName, dstBufLen) == URL::URL_OK) { bOk = true; (void)std_strlcpy(pLaunchURL + numURLBytes, pClipName, dstBufLen); } QTV_Free(pClipName); } } } else { QTV_MSG_PRIO( QTVDIAG_HTTP_STREAMING, QTVDIAG_PRIO_ERROR, "Error: Invalid port" ); } } if(!bOk) { if(pLaunchURL) { QTV_Free(pLaunchURL); } } return bOk; }