drm/ave/drm.cpp
/**
 * @brief Get AveDrm instance configured with a specific metadata
 *
 * @param[in] sha1Hash SHA1 hash of meta-data
 *
 * @return AveDrm  Instance corresponds to sha1Hash
 * @return NULL    If AveDrm instance configured with the meta-data is not available
 */
@brief Get AveDrm instance configured with a specific metadata
@param[in] sha1Hash SHA1 hash of meta-data

@return AveDrm  Instance corresponds to sha1Hash
@return NULL    If AveDrm instance configured with the meta-data is not available
@brief Get AveDrm instance configured with a specific metadata @param [ in ] sha1Hash SHA1 hash of meta - data @return AveDrm Instance corresponds to sha1Hash @return NULL If AveDrm instance configured with the meta - data is not available
std::shared_ptr<AveDrm> AveDrmManager::GetAveDrm(char* sha1Hash)
{
	std::shared_ptr<AveDrm>  aveDrm = nullptr;
#ifdef ENABLE_AVE_DRM_MANGER_DEBUG
	printf("%s:%d Enter sAveDrmManager.size = %d sha1Hash -  ", __FUNCTION__, __LINE__, (int)sAveDrmManager.size());
	PrintSha1Hash(sha1Hash);
#endif
	pthread_mutex_lock(&aveDrmManagerMutex);
	for (int i = 0; i < sAveDrmManager.size(); i++)
	{
		if (sAveDrmManager[i]->mDrmContexSet)
		{
			if (0 == memcmp(sha1Hash, sAveDrmManager[i]->mSha1Hash, DRM_SHA1_HASH_LEN))
			{
				aveDrm = sAveDrmManager[i]->mDrm;
				sAveDrmManager[i]->mHasBeenUsed = true;
				AVE_DRM_MANGER_DEBUG ("%s:%d: Found matching sha1Hash[%s]. Index[%d] aveDrm[%p]\n", __FUNCTION__, __LINE__,sha1Hash, i, aveDrm.get());
				break;
			}
			else
			{
#ifdef ENABLE_AVE_DRM_MANGER_DEBUG
				printf("%s:%d sHlsDrmContext[%d].mSha1Hash -  ", __FUNCTION__, __LINE__, i);
				PrintSha1Hash(sAveDrmManager[i]->mSha1Hash);
#endif
			}
		}
		else
		{
			logprintf("%s:%d: sHlsDrmContext[%d].mDrmContexSet is false\n", __FUNCTION__, __LINE__, i);
		}
	}
	pthread_mutex_unlock(&aveDrmManagerMutex);
	return aveDrm;
}
std :: shared_ptr < AveDrm > AveDrmManager :: GetAveDrm ( char * sha1Hash ) { std :: shared_ptr < AveDrm > aveDrm = nullptr ; #ifdef ENABLE_AVE_DRM_MANGER_DEBUG printf ( " " , __FUNCTION__ , __LINE__ , ( int ) sAveDrmManager . size ( ) ) ; PrintSha1Hash ( sha1Hash ) ; #endif pthread_mutex_lock ( & aveDrmManagerMutex ) ; for ( int i = 0 ; i < sAveDrmManager . size ( ) ; i ++ ) { if ( sAveDrmManager [ i ] -> mDrmContexSet ) { if ( 0 == memcmp ( sha1Hash , sAveDrmManager [ i ] -> mSha1Hash , DRM_SHA1_HASH_LEN ) ) { aveDrm = sAveDrmManager [ i ] -> mDrm ; sAveDrmManager [ i ] -> mHasBeenUsed = true ; AVE_DRM_MANGER_DEBUG ( " \n " , __FUNCTION__ , __LINE__ , sha1Hash , i , aveDrm . get ( ) ) ; break ; } else { #ifdef ENABLE_AVE_DRM_MANGER_DEBUG printf ( " " , __FUNCTION__ , __LINE__ , i ) ; PrintSha1Hash ( sAveDrmManager [ i ] -> mSha1Hash ) ; #endif } } else { logprintf ( " \n " , __FUNCTION__ , __LINE__ , i ) ; } } pthread_mutex_unlock ( & aveDrmManagerMutex ) ; return aveDrm ; }
@brief Get AveDrm instance configured with a specific metadata
 @param[in] sha1Hash SHA1 hash of meta-data
@brief Get AveDrm instance configured with a specific metadata @param [ in ] sha1Hash SHA1 hash of meta - data
// Found a user for the Meta data , update the flag so that it can be removed when no users for it 