--[[----------------------------------------------------------------------------

WFVideoTranscodingOptions.lua

--------------------------------------------------------------------------------

ADOBE CONFIDENTIAL
------------------
Copyright 2013 Adobe Systems Incorporated
All Rights Reserved.

NOTICE: All information contained herein is, and remains the property of
Adobe Systems Incorporated and its suppliers, if any. The intellectual and
technical concepts contained herein are proprietary to Adobe Systems
Incorporated and its suppliers and are protected by all applicable
intellectual property laws, including trade secret and copyright laws.
Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

----------------------------------------------------------------------------]]--


--==============================================================================

local WFVideoTranscodingOptions = {}

--------------------------------------------------------------------------------

local EXPLICITLY_USE_VIDEOCORE_FOR_TRANSCODE = false
local EXPLICITLY_USE_AMAZON_FOR_TRANSCODE = false
local EXPLICITLY_USE_VIDEOCORE_FOR_HLS = false

--------------------------------------------------------------------------------

-- This function returns multiple results, each one a header table ready for
-- use in the WFHttpClient requestHeaders parameter.
function WFVideoTranscodingOptions.ozTranscodingHeaders( needHls )
	
	local renditions = "mpeg4,hls"
	
	if needHls then
		-- For videos we know to be less than 10 minutes long, we don't have to
		-- use HLS, so we won't request it.
		renditions = "mpeg4"
	end
	
	if EXPLICITLY_USE_VIDEOCORE_FOR_TRANSCODE and EXPLICITLY_USE_VIDEOCORE_FOR_HLS then
	
		return
			{ header = 'X-Generate-Renditions', value = renditions },
			{ header = 'X-Video-Transcoder', value = 'videocore' }
	
	elseif EXPLICITLY_USE_AMAZON_FOR_TRANSCODE and EXPLICITLY_USE_VIDEOCORE_FOR_HLS then
	
		return { header = 'X-Generate-Renditions', value = renditions .. ':videocore' },
			{ header = 'X-Video-Transcoder', value = 'elastic_transcoder' }
	
	elseif EXPLICITLY_USE_AMAZON_FOR_TRANSCODE or EXPLICITLY_USE_VIDEOCORE_FOR_HLS or EXPLICITLY_USE_VIDEOCORE_FOR_TRANSCODE then
		
		-- I'm sure there's a way I just haven't bothered to figure out how...
		error "Unsupported options"
	
	else
		
		return { header = 'X-Generate-Renditions', value = renditions }
		
	end

end

--==============================================================================

return WFVideoTranscodingOptions
