コード例 #1
0
vod_status_t
mss_playready_build_manifest(
	request_context_t* request_context,
	mss_manifest_config_t* conf,
	media_set_t* media_set,
	vod_str_t* result)
{
	// Note: taking only the first sequence, in mss all renditions must have the same key
	drm_info_t* drm_info = (drm_info_t*)media_set->sequences[0].drm_info;
	drm_system_info_t* cur_info;
	size_t extra_tags_size;

	extra_tags_size = sizeof(VOD_MSS_PLAYREADY_PROTECTION_PREFIX) - 1 + sizeof(VOD_MSS_PLAYREADY_PROTECTION_SUFFIX) - 1;
	for (cur_info = drm_info->pssh_array.first; cur_info < drm_info->pssh_array.last; cur_info++)
	{
		extra_tags_size +=
			sizeof(VOD_MSS_PLAYREADY_PROTECTION_HEADER_PREFIX) - 1 +
			VOD_GUID_LENGTH + 
			sizeof(VOD_MSS_PLAYREADY_PROTECTION_HEADER_DELIMITER) - 1 +
			vod_base64_encoded_length(cur_info->data.len) + 
			sizeof(VOD_MSS_PLAYREADY_PROTECTION_HEADER_SUFFIX) - 1;
	}

	return mss_packager_build_manifest(
		request_context,
		conf,
		media_set,
		extra_tags_size,
		mss_playready_write_protection_tag,
		NULL,
		result);
}
コード例 #2
0
static ngx_int_t 
ngx_http_vod_mss_handle_manifest(
	ngx_http_vod_submodule_context_t* submodule_context,
	ngx_str_t* response,
	ngx_str_t* content_type)
{
	vod_status_t rc;

	if (submodule_context->conf->drm_enabled)
	{
		rc = mss_playready_build_manifest(
			&submodule_context->request_context,
			&submodule_context->conf->segmenter,
			&submodule_context->mpeg_metadata,
			response);
	}
	else
	{
		rc = mss_packager_build_manifest(
			&submodule_context->request_context,
			&submodule_context->conf->segmenter,
			&submodule_context->mpeg_metadata,
			0,
			NULL,
			NULL,
			response);
	}
	if (rc != VOD_OK)
	{
		ngx_log_debug1(NGX_LOG_DEBUG_HTTP, submodule_context->request_context.log, 0,
			"ngx_http_vod_mss_handle_manifest: mss_packager_build_manifest failed %i", rc);
		return ngx_http_vod_status_to_ngx_error(rc);
	}

	content_type->data = manifest_content_type;
	content_type->len = sizeof(manifest_content_type) - 1;

	return NGX_OK;
}