test/aampcli.cpp
/**
 * @brief Parse config entries for aamp-cli, and update gpGlobalConfig params
 *        based on the config.
 * @param cfg config to process
 */
@brief Parse config entries for aamp-cli, and update gpGlobalConfig params
based on the config.
@param cfg config to process
@brief Parse config entries for aamp - cli and update gpGlobalConfig params based on the config . @param cfg config to process
static void ProcessCLIConfEntry(char *cfg)
{
	trim(&cfg);
	if (cfg[0] == '*')
	{
			char *delim = strchr(cfg, ' ');
			if (delim)
			{
				VirtualChannelInfo channelInfo;
				channelInfo.channelNumber = INT_MIN;
				char *channelStr = &cfg[1];
				char *token = strtok(channelStr, " ");
				while (token != NULL)
				{
					if (isNumber(token))
						channelInfo.channelNumber = atoi(token);
					else if (memcmp(token, "http", 4) == 0)
							channelInfo.uri = token;
					else
						channelInfo.name = token;
					token = strtok(NULL, " ");
				}
				if (!channelInfo.uri.empty())
				{
					if (INT_MIN == channelInfo.channelNumber)
					{
						channelInfo.channelNumber = mVirtualChannelMap.size() + 1;
					}
					if (channelInfo.name.empty())
					{
						channelInfo.name = "CH" + std::to_string(channelInfo.channelNumber);
					}
					mVirtualChannelMap.push_back(channelInfo);
				}
				else
				{
					logprintf("%s(): Could not parse uri of %s\n", __FUNCTION__, cfg);
				}
			}
	}
}
static void ProcessCLIConfEntry ( char * cfg ) { trim ( & cfg ) ; if ( cfg [ 0 ] == ' ' ) { char * delim = strchr ( cfg , ' ' ) ; if ( delim ) { VirtualChannelInfo channelInfo ; channelInfo . channelNumber = INT_MIN ; char * channelStr = & cfg [ 1 ] ; char * token = strtok ( channelStr , " " ) ; while ( token != NULL ) { if ( isNumber ( token ) ) channelInfo . channelNumber = atoi ( token ) ; else if ( memcmp ( token , " " , 4 ) == 0 ) channelInfo . uri = token ; else channelInfo . name = token ; token = strtok ( NULL , " " ) ; } if ( ! channelInfo . uri . empty ( ) ) { if ( INT_MIN == channelInfo . channelNumber ) { channelInfo . channelNumber = mVirtualChannelMap . size ( ) + 1 ; } if ( channelInfo . name . empty ( ) ) { channelInfo . name = " " + std :: to_string ( channelInfo . channelNumber ) ; } mVirtualChannelMap . push_back ( channelInfo ) ; } else { logprintf ( " \n " , __FUNCTION__ , cfg ) ; } } } }
@brief Parse config entries for aamp-cli, and update gpGlobalConfig params
        based on the config.
@brief Parse config entries for aamp - cli and update gpGlobalConfig params based on the config .
//Populate channel map from aampcli.cfg