Esempio n. 1
0
static void
ngx_http_vod_hls_init_encryption_params(
	hls_encryption_params_t* encryption_params,
	ngx_http_vod_submodule_context_t* submodule_context,
	u_char* iv)
{
	encryption_params->type = submodule_context->conf->hls.encryption_method;
	if (encryption_params->type == HLS_ENC_NONE)
	{
		return;
	}

	ngx_http_vod_hls_init_encryption_iv(iv, submodule_context->request_params.segment_index);
	encryption_params->key = submodule_context->media_set.sequences[0].encryption_key;
	encryption_params->iv = iv;
}
static void
ngx_http_vod_hls_init_encryption_params(
	hls_encryption_params_t* encryption_params,
	ngx_http_vod_submodule_context_t* submodule_context,
	u_char* iv)
{
	drm_info_t* drm_info;

	encryption_params->type = submodule_context->conf->hls.encryption_method;
	if (encryption_params->type == HLS_ENC_NONE)
	{
		return;
	}

	encryption_params->iv = iv;

	if (submodule_context->conf->drm_enabled)
	{
		drm_info = submodule_context->media_set.sequences[0].drm_info;
		encryption_params->key = drm_info->key;

		if (drm_info->iv_set)
		{
			encryption_params->iv = drm_info->iv;
		}
	}
	else
	{
		encryption_params->key = submodule_context->media_set.sequences[0].encryption_key;
	}

	if (encryption_params->iv == iv)
	{
		ngx_http_vod_hls_init_encryption_iv(iv, submodule_context->request_params.segment_index);
	}
}