From 2ff147f0e5f6521502eaa6d5032acb68c33c4e0c Mon Sep 17 00:00:00 2001 From: George Wu Date: Mon, 26 Jun 2023 20:15:58 -0700 Subject: [PATCH 1/4] medialive/channel: implement additional encoder settings --- .../channel_encoder_settings_schema.go | 1233 +++++++++++++++-- .../docs/r/medialive_channel.html.markdown | 119 ++ 2 files changed, 1260 insertions(+), 92 deletions(-) diff --git a/internal/service/medialive/channel_encoder_settings_schema.go b/internal/service/medialive/channel_encoder_settings_schema.go index e9699b50350..1d857173b1f 100644 --- a/internal/service/medialive/channel_encoder_settings_schema.go +++ b/internal/service/medialive/channel_encoder_settings_schema.go @@ -1921,11 +1921,455 @@ func channelEncoderSettingsSchema() *schema.Schema { }, // TODO avail_configuration // TODO blackout_slate - // TODO caption_descriptions + "caption_descriptions": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "caption_selector_name": { + Type: schema.TypeString, + Required: true, + }, + "name": { + Type: schema.TypeString, + Required: true, + }, + "accessibility": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.AccessibilityType](), + }, + + "destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "arib_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, // no exported elements in this list + }, + }, + "burn_in_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "alignment": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.BurnInAlignment](), + }, + "background_color": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.BurnInBackgroundColor](), + }, + "background_opacity": { + Type: schema.TypeInt, + Optional: true, + }, + "font": func() *schema.Schema { + return inputLocationSchema() + }(), + "font_color": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.BurnInFontColor](), + }, + "font_opacity": { + Type: schema.TypeInt, + Default: 0, + Optional: true, + ValidateFunc: validation.IntAtLeast(0), + }, + "font_resolution": { + Type: schema.TypeInt, + Default: 96, + Optional: true, + ValidateFunc: validation.IntAtLeast(1), + }, + "font_size": { + Type: schema.TypeString, + Optional: true, + }, + "outline_color": { + Type: schema.TypeString, + Required: true, + ValidateDiagFunc: enum.Validate[types.BurnInOutlineColor](), + }, + "outline_size": { + Type: schema.TypeInt, + Optional: true, + }, + "shadow_color": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.BurnInShadowColor](), + }, + "shadow_opacity": { + Type: schema.TypeInt, + Default: 0, + Optional: true, + ValidateFunc: validation.IntAtLeast(0), + }, + "shadow_x_offset": { + Type: schema.TypeInt, + Optional: true, + }, + "shadow_y_offset": { + Type: schema.TypeInt, + Optional: true, + }, + "teletext_grid_control": { + Type: schema.TypeString, + Required: true, + ValidateDiagFunc: enum.Validate[types.BurnInTeletextGridControl](), + }, + "x_position": { + Type: schema.TypeInt, + Optional: true, + }, + "y_position": { + Type: schema.TypeInt, + Optional: true, + }, + }, + }, + }, + "dvb_sub_destination_settings": { + Type: schema.TypeList, + Required: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "alignment": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.DvbSubDestinationAlignment](), + }, + "background_color": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.DvbSubDestinationBackgroundColor](), + }, + "background_opacity": { + Type: schema.TypeInt, + Default: 0, + Optional: true, + ValidateFunc: validation.IntAtLeast(0), + }, + "font": func() *schema.Schema { + return inputLocationSchema() + }(), + "font_color": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.DvbSubDestinationFontColor](), + }, + "font_opacity": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntAtLeast(0), + }, + "font_resolution": { + Type: schema.TypeInt, + Default: 96, + Optional: true, + ValidateFunc: validation.IntAtLeast(1), + }, + "font_size": { + Type: schema.TypeString, + Optional: true, + }, + "outline_color": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.DvbSubDestinationOutlineColor](), + }, + "outline_size": { + Type: schema.TypeInt, + Optional: true, + }, + "shadow_color": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.DvbSubDestinationShadowColor](), + }, + "shadow_opacity": { + Type: schema.TypeInt, + Default: 0, + Optional: true, + ValidateFunc: validation.IntAtLeast(0), + }, + "shadow_x_offset": { + Type: schema.TypeInt, + Optional: true, + }, + "shadow_y_offset": { + Type: schema.TypeInt, + Optional: true, + }, + "teletext_grid_control": { + Type: schema.TypeString, + Required: true, + ValidateDiagFunc: enum.Validate[types.DvbSubDestinationTeletextGridControl](), + }, + "x_position": { + Type: schema.TypeInt, + Optional: true, + }, + "y_position": { + Type: schema.TypeInt, + Optional: true, + }, + }, + }, + }, + "ebu_tt_d_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "copyright_holder": { + Type: schema.TypeString, + Optional: true, + }, + "fill_line_gap": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.EbuTtDFillLineGapControl](), + }, + "font_family": { + Type: schema.TypeString, + Optional: true, + }, + "style_control": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateDiagFunc: enum.Validate[types.EbuTtDDestinationStyleControl](), + }, + }, + }, + }, + "embedded_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, // no exported elements in this list + }, + }, + "embedded_plus_scte20_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, // no exported elements in this list + }, + }, + "rtmp_caption_info_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, // no exported elements in this list + }, + }, + "scte20_plus_embedded_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, // no exported elements in this list + }, + }, + "scte27_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, // no exported elements in this list + }, + }, + "smpte_tt_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, // no exported elements in this list + }, + }, + "teletext_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, // no exported elements in this list + }, + }, + "ttml_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "style_control": { + Type: schema.TypeString, + Required: true, + ValidateDiagFunc: enum.Validate[types.TtmlDestinationStyleControl](), + }, + }, + }, + }, + "webvtt_destination_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "style_control": { + Type: schema.TypeString, + Required: true, + ValidateDiagFunc: enum.Validate[types.WebvttDestinationStyleControl](), + }, + }, + }, + }, + }, + }, + }, + "language_code": { + Type: schema.TypeString, + Optional: true, + }, + "language_description": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, // TODO feature_activations - // TODO global_configuration - // TODO motion_graphics_configuration - // TODO nielsen_configuration + "global_configuration": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "initial_audio_gain": { + Type: schema.TypeInt, + Optional: true, + }, + "input_end_action": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.GlobalConfigurationInputEndAction](), + }, + "input_loss_behavior": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "black_frame_msec": { + Type: schema.TypeInt, + Optional: true, + }, + "input_loss_image_color": { + Type: schema.TypeString, + Optional: true, + }, + "input_loss_image_slate": func() *schema.Schema { + return inputLocationSchema() + }(), + + "input_loss_image_type": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.InputLossImageType](), + }, + "repeat_frame_msec": { + Type: schema.TypeInt, + Optional: true, + }, + }, + }, + }, + "output_locking_mode": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.GlobalConfigurationOutputLockingMode](), + }, + "output_timing_source": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.GlobalConfigurationOutputTimingSource](), + }, + "support_low_framerate_inputs": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.GlobalConfigurationLowFramerateInputs](), + }, + }, + }, + }, + "motion_graphics_configuration": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "motion_graphics_settings": { + Type: schema.TypeList, + Required: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "html_motion_graphics_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, // no exported elements in this list + }, + }, + }, + }, + }, + "motion_graphics_insertion": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.MotionGraphicsInsertion](), + }, + }, + }, + }, + "nielsen_configuration": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "distributor_id": { + Type: schema.TypeString, + Optional: true, + }, + "nielsen_pcm_to_id3_tagging": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.NielsenPcmToId3TaggingState](), + }, + }, + }, + }, }, }, } @@ -2636,19 +3080,19 @@ func expandChannelEncoderSettings(tfList []interface{}) *types.EncoderSettings { settings.BlackoutSlate = nil // TODO expandChannelEncoderSettingsBlackoutSlate(v) } if v, ok := m["caption_descriptions"].([]interface{}); ok && len(v) > 0 { - settings.CaptionDescriptions = nil // TODO expandChannelEncoderSettingsCaptionDescriptions(v) + settings.CaptionDescriptions = expandChannelEncoderSettingsCaptionDescriptions(v) } if v, ok := m["feature_activations"].([]interface{}); ok && len(v) > 0 { settings.FeatureActivations = nil // TODO expandChannelEncoderSettingsFeatureActivations(v) } if v, ok := m["global_configuration"].([]interface{}); ok && len(v) > 0 { - settings.GlobalConfiguration = nil // TODO expandChannelEncoderSettingsGlobalConfiguration(v) + settings.GlobalConfiguration = expandChannelEncoderSettingsGlobalConfiguration(v) } if v, ok := m["motion_graphics_configuration"].([]interface{}); ok && len(v) > 0 { - settings.MotionGraphicsConfiguration = nil // TODO expandChannelEncoderSettingsMotionGraphicsConfiguration(v) + settings.MotionGraphicsConfiguration = expandChannelEncoderSettingsMotionGraphicsConfiguration(v) } if v, ok := m["nielsen_configuration"].([]interface{}); ok && len(v) > 0 { - settings.NielsenConfiguration = nil // TODO expandChannelEncoderSettingsNielsenConfiguration(v) + settings.NielsenConfiguration = expandChannelEncoderSettingsNielsenConfiguration(v) } return &settings @@ -4347,146 +4791,539 @@ func expandM2tsSettings(tfList []interface{}) *types.M2tsSettings { if v, ok := m["scte35_pid"].(string); ok && v != "" { s.Scte35Pid = aws.String(v) } - if v, ok := m["segmentation_markers"].(string); ok && v != "" { - s.SegmentationMarkers = types.M2tsSegmentationMarkers(v) + if v, ok := m["segmentation_markers"].(string); ok && v != "" { + s.SegmentationMarkers = types.M2tsSegmentationMarkers(v) + } + if v, ok := m["segmentation_style"].(string); ok && v != "" { + s.SegmentationStyle = types.M2tsSegmentationStyle(v) + } + if v, ok := m["segmentation_time"].(float64); ok { + s.SegmentationTime = v + } + if v, ok := m["timed_metadata_behavior"].(string); ok && v != "" { + s.TimedMetadataBehavior = types.M2tsTimedMetadataBehavior(v) + } + if v, ok := m["timed_metadata_pid"].(string); ok && v != "" { + s.TimedMetadataPid = aws.String(v) + } + if v, ok := m["transport_stream_id"].(int); ok { + s.TransportStreamId = int32(v) + } + if v, ok := m["video_pid"].(string); ok && v != "" { + s.VideoPid = aws.String(v) + } + + return &s +} + +func expandM2tsDvbNitSettings(tfList []interface{}) *types.DvbNitSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var s types.DvbNitSettings + if v, ok := m["network_ids"].(int); ok { + s.NetworkId = int32(v) + } + if v, ok := m["network_name"].(string); ok && v != "" { + s.NetworkName = aws.String(v) + } + if v, ok := m["network_ids"].(int); ok { + s.RepInterval = int32(v) + } + return &s +} + +func expandM2tsDvbSdtSettings(tfList []interface{}) *types.DvbSdtSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var s types.DvbSdtSettings + if v, ok := m["output_sdt"].(string); ok && v != "" { + s.OutputSdt = types.DvbSdtOutputSdt(v) + } + if v, ok := m["rep_interval"].(int); ok { + s.RepInterval = int32(v) + } + if v, ok := m["service_name"].(string); ok && v != "" { + s.ServiceName = aws.String(v) + } + if v, ok := m["service_provider_name"].(string); ok && v != "" { + s.ServiceProviderName = aws.String(v) + } + + return &s +} + +func expandChannelEncoderSettingsTimecodeConfig(tfList []interface{}) *types.TimecodeConfig { + if tfList == nil { + return nil + } + m := tfList[0].(map[string]interface{}) + + var config types.TimecodeConfig + if v, ok := m["source"].(string); ok && v != "" { + config.Source = types.TimecodeConfigSource(v) + } + if v, ok := m["sync_threshold"].(int32); ok { + config.SyncThreshold = v + } + + return &config +} + +func expandChannelEncoderSettingsVideoDescriptions(tfList []interface{}) []types.VideoDescription { + if tfList == nil { + return nil + } + + var videoDesc []types.VideoDescription + for _, tfItem := range tfList { + m, ok := tfItem.(map[string]interface{}) + if !ok { + continue + } + + var d types.VideoDescription + if v, ok := m["name"].(string); ok && v != "" { + d.Name = aws.String(v) + } + if v, ok := m["codec_settings"].([]interface{}); ok && len(v) > 0 { + d.CodecSettings = expandChannelEncoderSettingsVideoDescriptionsCodecSettings(v) + } + if v, ok := m["height"].(int); ok { + d.Height = int32(v) + } + if v, ok := m["respond_to_afd"].(string); ok && v != "" { + d.RespondToAfd = types.VideoDescriptionRespondToAfd(v) + } + if v, ok := m["scaling_behavior"].(string); ok && v != "" { + d.ScalingBehavior = types.VideoDescriptionScalingBehavior(v) + } + if v, ok := m["sharpness"].(int); ok { + d.Sharpness = int32(v) + } + if v, ok := m["width"].(int); ok { + d.Width = int32(v) + } + + videoDesc = append(videoDesc, d) + } + + return videoDesc +} + +func expandChannelEncoderSettingsAvailBlanking(tfList []interface{}) *types.AvailBlanking { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.AvailBlanking + if v, ok := m["avail_blanking_image"].([]interface{}); ok && len(v) > 0 { + out.AvailBlankingImage = expandInputLocation(v) + } + if v, ok := m["state"].(string); ok && v != "" { + out.State = types.AvailBlankingState(v) + } + + return &out +} + +func expandChannelEncoderSettingsCaptionDescriptions(tfList []interface{}) []types.CaptionDescription { + if tfList == nil { + return nil + } + + var captionDesc []types.CaptionDescription + for _, tfItem := range tfList { + m, ok := tfItem.(map[string]interface{}) + if !ok { + continue + } + + var d types.CaptionDescription + if v, ok := m["caption_selector_name"].(string); ok && v != "" { + d.CaptionSelectorName = aws.String(v) + } + if v, ok := m["name"].(string); ok && v != "" { + d.Name = aws.String(v) + } + if v, ok := m["accessibility"].(string); ok && v != "" { + d.Accessibility = types.AccessibilityType(v) + } + if v, ok := m["destination_settings"].([]interface{}); ok && len(v) > 0 { + d.DestinationSettings = expandChannelEncoderSettingsCaptionDescriptionsDestinationSettings(v) + } + if v, ok := m["language_code"].(string); ok && v != "" { + d.LanguageCode = aws.String(v) + } + if v, ok := m["language_description"].(string); ok && v != "" { + d.LanguageDescription = aws.String(v) + } + + captionDesc = append(captionDesc, d) + } + + return captionDesc +} + +func expandChannelEncoderSettingsCaptionDescriptionsDestinationSettings(tfList []interface{}) *types.CaptionDestinationSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.CaptionDestinationSettings + if v, ok := m["arib_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.AribDestinationSettings = &types.AribDestinationSettings{} // only unexported fields + } + if v, ok := m["burn_in_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.BurnInDestinationSettings = expandsCaptionDescriptionsDestinationSettingsBurnInDestinationSettings(v) + } + if v, ok := m["dvb_sub_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.DvbSubDestinationSettings = expandsCaptionDescriptionsDestinationSettingsDvbSubDestinationSettings(v) + } + if v, ok := m["ebu_tt_d_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.EbuTtDDestinationSettings = expandsCaptionDescriptionsDestinationSettingsEbuTtDDestinationSettings(v) + } + if v, ok := m["embedded_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.EmbeddedDestinationSettings = &types.EmbeddedDestinationSettings{} // only unexported fields + } + if v, ok := m["embedded_plus_scte20_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.EmbeddedPlusScte20DestinationSettings = &types.EmbeddedPlusScte20DestinationSettings{} // only unexported fields + } + if v, ok := m["rtmp_caption_info_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.RtmpCaptionInfoDestinationSettings = &types.RtmpCaptionInfoDestinationSettings{} // only unexported fields + } + if v, ok := m["scte20_plus_embedded_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.Scte20PlusEmbeddedDestinationSettings = &types.Scte20PlusEmbeddedDestinationSettings{} // only unexported fields + } + if v, ok := m["scte27_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.Scte27DestinationSettings = &types.Scte27DestinationSettings{} // only unexported fields + } + if v, ok := m["smpte_tt_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.SmpteTtDestinationSettings = &types.SmpteTtDestinationSettings{} // only unexported fields + } + if v, ok := m["teletext_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.TeletextDestinationSettings = &types.TeletextDestinationSettings{} // only unexported fields + } + if v, ok := m["ttml_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.TtmlDestinationSettings = expandsCaptionDescriptionsDestinationSettingsTtmlDestinationSettings(v) + } + if v, ok := m["webvtt_destination_settings"].([]interface{}); ok && len(v) > 0 { + out.WebvttDestinationSettings = expandsCaptionDescriptionsDestinationSettingsWebvttDestinationSettings(v) + } + + return &out +} + +func expandsCaptionDescriptionsDestinationSettingsBurnInDestinationSettings(tfList []interface{}) *types.BurnInDestinationSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.BurnInDestinationSettings + if v, ok := m["alignment"].(string); ok && len(v) > 0 { + out.Alignment = types.BurnInAlignment(v) + } + if v, ok := m["background_color"].(string); ok && len(v) > 0 { + out.BackgroundColor = types.BurnInBackgroundColor(v) + } + if v, ok := m["background_opacity"].(int); ok { + out.BackgroundOpacity = int32(v) + } + if v, ok := m["font"].([]interface{}); ok && len(v) > 0 { + out.Font = expandInputLocation(v) + } + if v, ok := m["font_color"].(string); ok && len(v) > 0 { + out.FontColor = types.BurnInFontColor(v) + } + if v, ok := m["font_opacity"].(int); ok { + out.FontOpacity = int32(v) + } + if v, ok := m["font_resolution"].(int); ok { + out.FontResolution = int32(v) + } + if v, ok := m["font_size"].(string); ok && v != "" { + out.FontSize = aws.String(v) + } + if v, ok := m["outline_color"].(string); ok && len(v) > 0 { + out.OutlineColor = types.BurnInOutlineColor(v) + } + if v, ok := m["outline_size"].(int); ok { + out.OutlineSize = int32(v) + } + if v, ok := m["shadow_color"].(string); ok && len(v) > 0 { + out.ShadowColor = types.BurnInShadowColor(v) + } + if v, ok := m["shadow_opacity"].(int); ok { + out.ShadowOpacity = int32(v) + } + if v, ok := m["shadow_x_offset"].(int); ok { + out.ShadowXOffset = int32(v) + } + if v, ok := m["shadow_y_offset"].(int); ok { + out.ShadowYOffset = int32(v) + } + if v, ok := m["teletext_grid_control"].(string); ok && len(v) > 0 { + out.TeletextGridControl = types.BurnInTeletextGridControl(v) + } + if v, ok := m["x_position"].(int); ok { + out.XPosition = int32(v) + } + if v, ok := m["y_position"].(int); ok { + out.YPosition = int32(v) + } + + return &out +} + +func expandsCaptionDescriptionsDestinationSettingsDvbSubDestinationSettings(tfList []interface{}) *types.DvbSubDestinationSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.DvbSubDestinationSettings + if v, ok := m["alignment"].(string); ok && len(v) > 0 { + out.Alignment = types.DvbSubDestinationAlignment(v) + } + if v, ok := m["background_color"].(string); ok && len(v) > 0 { + out.BackgroundColor = types.DvbSubDestinationBackgroundColor(v) + } + if v, ok := m["background_opacity"].(int); ok { + out.BackgroundOpacity = int32(v) + } + if v, ok := m["font"].([]interface{}); ok && len(v) > 0 { + out.Font = expandInputLocation(v) + } + if v, ok := m["font_color"].(string); ok && len(v) > 0 { + out.FontColor = types.DvbSubDestinationFontColor(v) + } + if v, ok := m["font_opacity"].(int); ok { + out.FontOpacity = int32(v) + } + if v, ok := m["font_resolution"].(int); ok { + out.FontResolution = int32(v) + } + if v, ok := m["font_size"].(string); ok && v != "" { + out.FontSize = aws.String(v) + } + if v, ok := m["outline_color"].(string); ok && len(v) > 0 { + out.OutlineColor = types.DvbSubDestinationOutlineColor(v) + } + if v, ok := m["outline_size"].(int); ok { + out.OutlineSize = int32(v) + } + if v, ok := m["shadow_color"].(string); ok && len(v) > 0 { + out.ShadowColor = types.DvbSubDestinationShadowColor(v) + } + if v, ok := m["shadow_opacity"].(int); ok { + out.ShadowOpacity = int32(v) + } + if v, ok := m["shadow_x_offset"].(int); ok { + out.ShadowXOffset = int32(v) + } + if v, ok := m["shadow_y_offset"].(int); ok { + out.ShadowYOffset = int32(v) + } + if v, ok := m["teletext_grid_control"].(string); ok && len(v) > 0 { + out.TeletextGridControl = types.DvbSubDestinationTeletextGridControl(v) + } + if v, ok := m["x_position"].(int); ok { + out.XPosition = int32(v) + } + if v, ok := m["y_position"].(int); ok { + out.YPosition = int32(v) + } + + return &out +} + +func expandsCaptionDescriptionsDestinationSettingsEbuTtDDestinationSettings(tfList []interface{}) *types.EbuTtDDestinationSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.EbuTtDDestinationSettings + if v, ok := m["copyright_holder"].(string); ok && v != "" { + out.CopyrightHolder = aws.String(v) } - if v, ok := m["segmentation_style"].(string); ok && v != "" { - s.SegmentationStyle = types.M2tsSegmentationStyle(v) + + if v, ok := m["fill_line_gap"].(string); ok && len(v) > 0 { + out.FillLineGap = types.EbuTtDFillLineGapControl(v) } - if v, ok := m["segmentation_time"].(float64); ok { - s.SegmentationTime = v + + if v, ok := m["font_family"].(string); ok && v != "" { + out.FontFamily = aws.String(v) } - if v, ok := m["timed_metadata_behavior"].(string); ok && v != "" { - s.TimedMetadataBehavior = types.M2tsTimedMetadataBehavior(v) + + if v, ok := m["style_control"].(string); ok && len(v) > 0 { + out.StyleControl = types.EbuTtDDestinationStyleControl(v) } - if v, ok := m["timed_metadata_pid"].(string); ok && v != "" { - s.TimedMetadataPid = aws.String(v) + + return &out +} + +func expandsCaptionDescriptionsDestinationSettingsTtmlDestinationSettings(tfList []interface{}) *types.TtmlDestinationSettings { + if tfList == nil { + return nil } - if v, ok := m["transport_stream_id"].(int); ok { - s.TransportStreamId = int32(v) + + m := tfList[0].(map[string]interface{}) + + var out types.TtmlDestinationSettings + if v, ok := m["style_control"].(string); ok && len(v) > 0 { + out.StyleControl = types.TtmlDestinationStyleControl(v) } - if v, ok := m["video_pid"].(string); ok && v != "" { - s.VideoPid = aws.String(v) + + return &out +} + +func expandsCaptionDescriptionsDestinationSettingsWebvttDestinationSettings(tfList []interface{}) *types.WebvttDestinationSettings { + if tfList == nil { + return nil } - return &s + m := tfList[0].(map[string]interface{}) + + var out types.WebvttDestinationSettings + if v, ok := m["style_control"].(string); ok && len(v) > 0 { + out.StyleControl = types.WebvttDestinationStyleControl(v) + } + return &out } -func expandM2tsDvbNitSettings(tfList []interface{}) *types.DvbNitSettings { +func expandChannelEncoderSettingsGlobalConfiguration(tfList []interface{}) *types.GlobalConfiguration { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var s types.DvbNitSettings - if v, ok := m["network_ids"].(int); ok { - s.NetworkId = int32(v) + var out types.GlobalConfiguration + + if v, ok := m["initial_audio_gain"].(int); ok { + out.InitialAudioGain = int32(v) } - if v, ok := m["network_name"].(string); ok && v != "" { - s.NetworkName = aws.String(v) + + if v, ok := m["input_end_action"].(string); ok && len(v) > 0 { + out.InputEndAction = types.GlobalConfigurationInputEndAction(v) } - if v, ok := m["network_ids"].(int); ok { - s.RepInterval = int32(v) + + if v, ok := m["input_loss_behavior"].([]interface{}); ok && len(v) > 0 { + out.InputLossBehavior = expandChannelEncoderSettingsGlobalConfigurationInputLossBehavior(v) } - return &s + + if v, ok := m["output_locking_mode"].(string); ok && len(v) > 0 { + out.OutputLockingMode = types.GlobalConfigurationOutputLockingMode(v) + } + + if v, ok := m["output_timing_source"].(string); ok && len(v) > 0 { + out.OutputTimingSource = types.GlobalConfigurationOutputTimingSource(v) + } + + if v, ok := m["support_low_framerate_inputs"].(string); ok && len(v) > 0 { + out.SupportLowFramerateInputs = types.GlobalConfigurationLowFramerateInputs(v) + } + + return &out } -func expandM2tsDvbSdtSettings(tfList []interface{}) *types.DvbSdtSettings { +func expandChannelEncoderSettingsGlobalConfigurationInputLossBehavior(tfList []interface{}) *types.InputLossBehavior { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var s types.DvbSdtSettings - if v, ok := m["output_sdt"].(string); ok && v != "" { - s.OutputSdt = types.DvbSdtOutputSdt(v) + var out types.InputLossBehavior + + if v, ok := m["black_frame_msec"].(int); ok { + out.BlackFrameMsec = int32(v) } - if v, ok := m["rep_interval"].(int); ok { - s.RepInterval = int32(v) + + if v, ok := m["input_loss_image_color"].(string); ok && v != "" { + out.InputLossImageColor = aws.String(v) } - if v, ok := m["service_name"].(string); ok && v != "" { - s.ServiceName = aws.String(v) + + if v, ok := m["input_loss_image_slate"].([]interface{}); ok && len(v) > 0 { + out.InputLossImageSlate = expandInputLocation(v) } - if v, ok := m["service_provider_name"].(string); ok && v != "" { - s.ServiceProviderName = aws.String(v) + + if v, ok := m["input_loss_image_type"].(string); ok && len(v) > 0 { + out.InputLossImageType = types.InputLossImageType(v) } - return &s + if v, ok := m["repeat_frame_msec"].(int); ok { + out.RepeatFrameMsec = int32(v) + } + + return &out } -func expandChannelEncoderSettingsTimecodeConfig(tfList []interface{}) *types.TimecodeConfig { +func expandChannelEncoderSettingsMotionGraphicsConfiguration(tfList []interface{}) *types.MotionGraphicsConfiguration { if tfList == nil { return nil } + m := tfList[0].(map[string]interface{}) - var config types.TimecodeConfig - if v, ok := m["source"].(string); ok && v != "" { - config.Source = types.TimecodeConfigSource(v) + var out types.MotionGraphicsConfiguration + + if v, ok := m["motion_graphics_settings"].([]interface{}); ok && len(v) > 0 { + out.MotionGraphicsSettings = expandChannelEncoderSettingsMotionGraphicsConfigurationMotionGraphicsSettings(v) } - if v, ok := m["sync_threshold"].(int32); ok { - config.SyncThreshold = v + + if v, ok := m["motion_graphics_insertion"].(string); ok && len(v) > 0 { + out.MotionGraphicsInsertion = types.MotionGraphicsInsertion(v) } - return &config + return &out } -func expandChannelEncoderSettingsVideoDescriptions(tfList []interface{}) []types.VideoDescription { +func expandChannelEncoderSettingsMotionGraphicsConfigurationMotionGraphicsSettings(tfList []interface{}) *types.MotionGraphicsSettings { if tfList == nil { return nil } - var videoDesc []types.VideoDescription - for _, tfItem := range tfList { - m, ok := tfItem.(map[string]interface{}) - if !ok { - continue - } - - var d types.VideoDescription - if v, ok := m["name"].(string); ok && v != "" { - d.Name = aws.String(v) - } - if v, ok := m["codec_settings"].([]interface{}); ok && len(v) > 0 { - d.CodecSettings = expandChannelEncoderSettingsVideoDescriptionsCodecSettings(v) - } - if v, ok := m["height"].(int); ok { - d.Height = int32(v) - } - if v, ok := m["respond_to_afd"].(string); ok && v != "" { - d.RespondToAfd = types.VideoDescriptionRespondToAfd(v) - } - if v, ok := m["scaling_behavior"].(string); ok && v != "" { - d.ScalingBehavior = types.VideoDescriptionScalingBehavior(v) - } - if v, ok := m["sharpness"].(int); ok { - d.Sharpness = int32(v) - } - if v, ok := m["width"].(int); ok { - d.Width = int32(v) - } + m := tfList[0].(map[string]interface{}) - videoDesc = append(videoDesc, d) + var out types.MotionGraphicsSettings + if v, ok := m["html_motion_graphics_settings"].([]interface{}); ok && len(v) > 0 { + out.HtmlMotionGraphicsSettings = &types.HtmlMotionGraphicsSettings{} // no exported elements in this list } - return videoDesc + return &out } -func expandChannelEncoderSettingsAvailBlanking(tfList []interface{}) *types.AvailBlanking { +func expandChannelEncoderSettingsNielsenConfiguration(tfList []interface{}) *types.NielsenConfiguration { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var out types.AvailBlanking - if v, ok := m["avail_blanking_image"].([]interface{}); ok && len(v) > 0 { - out.AvailBlankingImage = expandInputLocation(v) + var out types.NielsenConfiguration + if v, ok := m["distributor_id"].(string); ok && v != "" { + out.DistributorId = aws.String(v) } - if v, ok := m["state"].(string); ok && v != "" { - out.State = types.AvailBlankingState(v) + + if v, ok := m["nielsen_pcm_to_id3_tagging"].(string); ok && len(v) > 0 { + out.NielsenPcmToId3Tagging = types.NielsenPcmToId3TaggingState(v) } return &out @@ -4949,11 +5786,11 @@ func flattenChannelEncoderSettings(apiObject *types.EncoderSettings) []interface "avail_blanking": flattenAvailBlanking(apiObject.AvailBlanking), // TODO avail_configuration // TODO blackout_slate - // TODO caption_descriptions + "caption_descriptions": flattenCaptionDescriptions(apiObject.CaptionDescriptions), // TODO feature_activations - // TODO global_configuration - // TODO motion_graphics_configuration - // TODO nielsen_configuration + "global_configuration": flattenGlobalConfiguration(apiObject.GlobalConfiguration), + "motion_graphics_configuration": flattenMotionGraphicsConfiguration(apiObject.MotionGraphicsConfiguration), + "nielsen_configuration": flattenNielsenConfiguration(apiObject.NielsenConfiguration), } return []interface{}{m} @@ -5836,6 +6673,218 @@ func flattenAvailBlanking(in *types.AvailBlanking) []interface{} { return []interface{}{m} } +func flattenCaptionDescriptions(tfList []types.CaptionDescription) []interface{} { + if len(tfList) == 0 { + return nil + } + + var out []interface{} + + for _, item := range tfList { + m := map[string]interface{}{ + "caption_selector_name": aws.ToString(item.CaptionSelectorName), + "name": aws.ToString(item.Name), + "accessibility": string(item.Accessibility), + "destination_settings": flattenCaptionDescriptionsCaptionDestinationSettings(item.DestinationSettings), + "language_code": aws.ToString(item.LanguageCode), + "language_description": aws.ToString(item.LanguageDescription), + } + + out = append(out, m) + } + return out +} + +func flattenCaptionDescriptionsCaptionDestinationSettings(in *types.CaptionDestinationSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "arib_destination_settings": []interface{}{}, // attribute has no exported fields + "burn_in_destination_settings": flattenCaptionDescriptionsCaptionDestinationSettingsBurnInDestinationSettings(in.BurnInDestinationSettings), + "dvb_sub_destination_settings": flattenCaptionDescriptionsCaptionDestinationSettingsDvbSubDestinationSettings(in.DvbSubDestinationSettings), + "ebu_tt_d_destination_settings": flattenCaptionDescriptionsCaptionDestinationSettingsEbuTtDDestinationSettings(in.EbuTtDDestinationSettings), + "embedded_destination_settings": []interface{}{}, // attribute has no exported fields + "embedded_plus_scte20_destination_settings": []interface{}{}, // attribute has no exported fields + "rtmp_caption_info_destination_settings": []interface{}{}, // attribute has no exported fields + "scte20_plus_embedded_destination_settings": []interface{}{}, // attribute has no exported fields + "scte27_destination_settings": []interface{}{}, // attribute has no exported fields + "smpte_tt_destination_settings": []interface{}{}, // attribute has no exported fields + "teletext_destination_settings": []interface{}{}, // attribute has no exported fields + "ttml_destination_settings": flattenCaptionDescriptionsCaptionDestinationSettingsTtmlDestinationSettings(in.TtmlDestinationSettings), + "webvtt_destination_settings": flattenCaptionDescriptionsCaptionDestinationSettingsWebvttDestinationSettings(in.WebvttDestinationSettings), + } + + return []interface{}{m} +} + +func flattenCaptionDescriptionsCaptionDestinationSettingsBurnInDestinationSettings(in *types.BurnInDestinationSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "alignment": string(in.Alignment), + "background_color": string(in.BackgroundColor), + "background_opacity": int(in.BackgroundOpacity), + "font": flattenInputLocation(in.Font), + "font_color": string(in.FontColor), + "font_opacity": int(in.FontOpacity), + "font_resolution": int(in.FontResolution), + "font_size": aws.ToString(in.FontSize), + "outline_color": string(in.OutlineColor), + "outline_size": int(in.OutlineSize), + "shadow_color": string(in.ShadowColor), + "shadow_opacity": int(in.ShadowOpacity), + "shadow_x_offset": int(in.ShadowXOffset), + "shadow_y_offset": int(in.ShadowYOffset), + "teletext_grid_control": string(in.TeletextGridControl), + "x_position": int(in.XPosition), + "y_position": int(in.YPosition), + } + + return []interface{}{m} +} + +func flattenCaptionDescriptionsCaptionDestinationSettingsDvbSubDestinationSettings(in *types.DvbSubDestinationSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "alignment": string(in.Alignment), + "background_color": string(in.BackgroundColor), + "background_opacity": int(in.BackgroundOpacity), + "font": flattenInputLocation(in.Font), + "font_color": string(in.FontColor), + "font_opacity": int(in.FontOpacity), + "font_resolution": int(in.FontResolution), + "font_size": aws.ToString(in.FontSize), + "outline_color": string(in.OutlineColor), + "outline_size": int(in.OutlineSize), + "shadow_color": string(in.ShadowColor), + "shadow_opacity": int(in.ShadowOpacity), + "shadow_x_offset": int(in.ShadowXOffset), + "shadow_y_offset": int(in.ShadowYOffset), + "teletext_grid_control": string(in.TeletextGridControl), + "x_position": int(in.XPosition), + "y_position": int(in.YPosition), + } + + return []interface{}{m} +} + +func flattenCaptionDescriptionsCaptionDestinationSettingsEbuTtDDestinationSettings(in *types.EbuTtDDestinationSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "copyright_holder": aws.ToString(in.CopyrightHolder), + "fill_line_gap": string(in.FillLineGap), + "font_family": aws.ToString(in.FontFamily), + "style_control": string(in.StyleControl), + } + + return []interface{}{m} +} + +func flattenCaptionDescriptionsCaptionDestinationSettingsTtmlDestinationSettings(in *types.TtmlDestinationSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "style_control": string(in.StyleControl), + } + + return []interface{}{m} +} + +func flattenCaptionDescriptionsCaptionDestinationSettingsWebvttDestinationSettings(in *types.WebvttDestinationSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "style_control": string(in.StyleControl), + } + + return []interface{}{m} +} + +func flattenGlobalConfiguration(apiObject *types.GlobalConfiguration) []interface{} { + if apiObject == nil { + return nil + } + + m := map[string]interface{}{ + "initial_audio_gain": int(apiObject.InitialAudioGain), + "input_end_action": string(apiObject.InputEndAction), + "input_loss_behavior": flattenGlobalConfigurationInputLossBehavior(apiObject.InputLossBehavior), + "output_locking_mode": string(apiObject.OutputLockingMode), + "output_timing_source": string(apiObject.OutputTimingSource), + "support_low_framerate_inputs": string(apiObject.SupportLowFramerateInputs), + } + + return []interface{}{m} +} + +func flattenGlobalConfigurationInputLossBehavior(in *types.InputLossBehavior) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "black_frame_msec": int(in.BlackFrameMsec), + "input_loss_image_color": aws.ToString(in.InputLossImageColor), + "input_loss_image_slate": flattenInputLocation(in.InputLossImageSlate), + "input_loss_image_type": string(in.InputLossImageType), + "repeat_frame_msec": int(in.RepeatFrameMsec), + } + + return []interface{}{m} +} + +func flattenMotionGraphicsConfiguration(apiObject *types.MotionGraphicsConfiguration) []interface{} { + if apiObject == nil { + return nil + } + + m := map[string]interface{}{ + "motion_graphics_settings": flattenMotionGraphicsConfigurationMotionGraphicsSettings(apiObject.MotionGraphicsSettings), + "motion_graphics_insertion": string(apiObject.MotionGraphicsInsertion), + } + + return []interface{}{m} +} + +func flattenMotionGraphicsConfigurationMotionGraphicsSettings(in *types.MotionGraphicsSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "html_motion_graphics_settings": []interface{}{}, // attribute has no exported fields + } + + return []interface{}{m} +} + +func flattenNielsenConfiguration(apiObject *types.NielsenConfiguration) []interface{} { + if apiObject == nil { + return nil + } + + m := map[string]interface{}{ + "distributor_id": aws.ToString(apiObject.DistributorId), + "nielsen_pcm_to_id3_tagging": string(apiObject.NielsenPcmToId3Tagging), + } + + return []interface{}{m} +} + func flattenVideoDescriptionsCodecSettings(in *types.VideoCodecSettings) []interface{} { if in == nil { return nil diff --git a/website/docs/r/medialive_channel.html.markdown b/website/docs/r/medialive_channel.html.markdown index 1264f82e1cc..b0f21f8eb62 100644 --- a/website/docs/r/medialive_channel.html.markdown +++ b/website/docs/r/medialive_channel.html.markdown @@ -128,6 +128,10 @@ The following arguments are optional: * `output_groups` - (Required) Output groups for the channel. See [Output Groups](#output-groups) for more details. * `timecode_config` - (Required) Contains settings used to acquire and adjust timecode information from inputs. See [Timecode Config](#timecode-config) for more details. * `video_descriptions` - (Required) Video Descriptions. See [Video Descriptions](#video-descriptions) for more details. +* `caption_descriptions` - (Optional) Caption Descriptions. See [Caption Descriptions](#caption-descriptions) for more details. +* `global_configuration` - (Optional) Configuration settings that apply to the event as a whole. See [Global Configuration](#global-configuration) for more details. +* `motion_graphics_configuration` - (Optional) Settings for motion graphics. See [Motion Graphics Configuration](#motion-graphics-configuration) for more details. +* `nielsen_configuration` - (Optional) Nielsen configuration settings. See [Nielsen Configuration](#nielsen-configuration) for more details. * `avail_blanking` - (Optional) Settings for ad avail blanking. See [Avail Blanking](#avail-blanking) for more details. ### Input Attachments @@ -430,6 +434,121 @@ The following arguments are optional: * `post_filter_sharpening` - (Optional) Post filter sharpening. * `strength` - (Optional) Filter strength. +### Caption Descriptions + +* `accessibility` - (Optional) Indicates whether the caption track implements accessibility features such as written descriptions of spoken dialog, music, and sounds. +* `caption_selector_name` - (Required) Specifies which input caption selector to use as a caption source when generating output captions. This field should match a captionSelector name. +* `destination_settings` - (Optional) Additional settings for captions destination that depend on the destination type. See [Destination Settings](#destination-settings) for more details. +* `language_code` - (Optional) ISO 639-2 three-digit code. +* `language_description` - (Optional) Human readable information to indicate captions available for players (eg. English, or Spanish). +* `name` - (Required) Name of the caption description. Used to associate a caption description with an output. Names must be unique within an event. + +### Destination Settings + +* `arib_destination_settings` - (Optional) Arib Destination Settings. +* `burn_in_destination_settings` - (Optional) Burn In Destination Settings. See [Burn In Destination Settings](#burn-in-destination-settings) for more details. +* `dvb_sub_destination_settings` - (Optional) Dvb Sub Destination Settings. See [Dvb Sub Destination Settings](#dvb-sub-destination-settings) for more details. +* `ebu_tt_d_destination_settings` - (Optional) Ebu Tt D Destination Settings. See [Ebu Tt D Destination Settings](#ebu-tt-d-destination-settings) for more details. +* `embedded_destination_settings` - (Optional) Embedded Destination Settings. +* `embedded_plus_scte20_destination_settings` - (Optional) Embedded Plus Scte20 Destination Settings. +* `rtmp_caption_info_destination_settings` - (Optional) Rtmp Caption Info Destination Settings. +* `scte20_plus_embedded_destination_settings` - (Optional) Scte20 Plus Embedded Destination Settings. +* `scte27_destination_settings` – (Optional) Scte27 Destination Settings. +* `smpteTt_destination_settings` – (Optional) Smpte Tt Destination Settings. +* `teletext_destination_settings` – (Optional) Teletext Destination Settings. +* `ttml_destination_settings` – (Optional) Ttml Destination Settings. See [Ttml Destination Settings](#ttml-destination-settings) for more details. +* `webvtt_destination_settings` - (Optional) Webvtt Destination Settings. See [Webvtt Destination Settings](#webvtt-destination-settings) for more details. + +### Burn In Destination Settings + +* `alignment` – (Optional) If no explicit xPosition or yPosition is provided, setting alignment to centered will place the captions at the bottom center of the output. Similarly, setting a left alignment will align captions to the bottom left of the output. If x and y positions are given in conjunction with the alignment parameter, the font will be justified (either left or centered) relative to those coordinates. Selecting “smart” justification will left-justify live subtitles and center-justify pre-recorded subtitles. All burn-in and DVB-Sub font settings must match. +* `background_color` – (Optional) Specifies the color of the rectangle behind the captions. All burn-in and DVB-Sub font settings must match. +* `background_opacity` – (Optional) Specifies the opacity of the background rectangle. 255 is opaque; 0 is transparent. Leaving this parameter out is equivalent to setting it to 0 (transparent). All burn-in and DVB-Sub font settings must match. +* `font` – (Optional) External font file used for caption burn-in. File extension must be ‘ttf’ or ‘tte’. Although the user can select output fonts for many different types of input captions, embedded, STL and teletext sources use a strict grid system. Using external fonts with these caption sources could cause unexpected display of proportional fonts. All burn-in and DVB-Sub font settings must match. See [Font](#font) for more details. +* `font_color` – (Optional) Specifies the color of the burned-in captions. This option is not valid for source captions that are STL, 608/embedded or teletext. These source settings are already pre-defined by the caption stream. All burn-in and DVB-Sub font settings must match. +* `font_opacity` – (Optional) Specifies the opacity of the burned-in captions. 255 is opaque; 0 is transparent. All burn-in and DVB-Sub font settings must match. +* `font_resolution` – (Optional) Font resolution in DPI (dots per inch); default is 96 dpi. All burn-in and DVB-Sub font settings must match. +* `font_size` – (Optional) When set to ‘auto’ fontSize will scale depending on the size of the output. Giving a positive integer will specify the exact font size in points. All burn-in and DVB-Sub font settings must match. +* `outline_color` – (Optional) Specifies font outline color. This option is not valid for source captions that are either 608/embedded or teletext. These source settings are already pre-defined by the caption stream. All burn-in and DVB-Sub font settings must match. +* `outline_size` – (Optional) Specifies font outline size in pixels. This option is not valid for source captions that are either 608/embedded or teletext. These source settings are already pre-defined by the caption stream. All burn-in and DVB-Sub font settings must match. +* `shadow_color` – (Optional) Specifies the color of the shadow cast by the captions. All burn-in and DVB-Sub font settings must match. +* `shadow_opacity` – (Optional) Specifies the opacity of the shadow. 255 is opaque; 0 is transparent. Leaving this parameter out is equivalent to setting it to 0 (transparent). All burn-in and DVB-Sub font settings must match. +* `shadow_x_offset` – (Optional) Specifies the horizontal offset of the shadow relative to the captions in pixels. A value of -2 would result in a shadow offset 2 pixels to the left. All burn-in and DVB-Sub font settings must match. +* `shadow_y_offset` – (Optional) Specifies the vertical offset of the shadow relative to the captions in pixels. A value of -2 would result in a shadow offset 2 pixels above the text. All burn-in and DVB-Sub font settings must match. +* `teletext_grid_control` – (Optional) Controls whether a fixed grid size will be used to generate the output subtitles bitmap. Only applicable for Teletext inputs and DVB-Sub/Burn-in outputs. +* `x_position` – (Optional) Specifies the horizontal position of the caption relative to the left side of the output in pixels. A value of 10 would result in the captions starting 10 pixels from the left of the output. If no explicit xPosition is provided, the horizontal caption position will be determined by the alignment parameter. All burn-in and DVB-Sub font settings must match. +* `y_position` – (Optional) Specifies the vertical position of the caption relative to the top of the output in pixels. A value of 10 would result in the captions starting 10 pixels from the top of the output. If no explicit yPosition is provided, the caption will be positioned towards the bottom of the output. All burn-in and DVB-Sub font settings must match. + +### Dvb Sub Destination Settings + +* `alignment` – (Optional) If no explicit xPosition or yPosition is provided, setting alignment to centered will place the captions at the bottom center of the output. Similarly, setting a left alignment will align captions to the bottom left of the output. If x and y positions are given in conjunction with the alignment parameter, the font will be justified (either left or centered) relative to those coordinates. Selecting “smart” justification will left-justify live subtitles and center-justify pre-recorded subtitles. This option is not valid for source captions that are STL or 608/embedded. These source settings are already pre-defined by the caption stream. All burn-in and DVB-Sub font settings must match. +* `background_color` – (Optional) Specifies the color of the rectangle behind the captions. All burn-in and DVB-Sub font settings must match. +* `background_opacity` – (Optional) Specifies the opacity of the background rectangle. 255 is opaque; 0 is transparent. Leaving this parameter blank is equivalent to setting it to 0 (transparent). All burn-in and DVB-Sub font settings must match. +* `font` – (Optional) External font file used for caption burn-in. File extension must be ‘ttf’ or ‘tte’. Although the user can select output fonts for many different types of input captions, embedded, STL and teletext sources use a strict grid system. Using external fonts with these caption sources could cause unexpected display of proportional fonts. All burn-in and DVB-Sub font settings must match. See [Font](#font) for more details. +* `font_color` – (Optional) Specifies the color of the burned-in captions. This option is not valid for source captions that are STL, 608/embedded or teletext. These source settings are already pre-defined by the caption stream. All burn-in and DVB-Sub font settings must match. +* `font_opacity` – (Optional) Specifies the opacity of the burned-in captions. 255 is opaque; 0 is transparent. All burn-in and DVB-Sub font settings must match. +* `font_resolution` – (Optional) Font resolution in DPI (dots per inch); default is 96 dpi. All burn-in and DVB-Sub font settings must match. +* `font_size` – (Optional) When set to auto fontSize will scale depending on the size of the output. Giving a positive integer will specify the exact font size in points. All burn-in and DVB-Sub font settings must match. +* `outline_color` – (Optional) Specifies font outline color. This option is not valid for source captions that are either 608/embedded or teletext. These source settings are already pre-defined by the caption stream. All burn-in and DVB-Sub font settings must match. +* `outline_size` – (Optional) Specifies font outline size in pixels. This option is not valid for source captions that are either 608/embedded or teletext. These source settings are already pre-defined by the caption stream. All burn-in and DVB-Sub font settings must match. +* `shadow_color` – (Optional) Specifies the color of the shadow cast by the captions. All burn-in and DVB-Sub font settings must match. +* `shadow_opacity` – (Optional) Specifies the opacity of the shadow. 255 is opaque; 0 is transparent. Leaving this parameter blank is equivalent to setting it to 0 (transparent). All burn-in and DVB-Sub font settings must match. +* `shadow_x_offset` – (Optional) Specifies the horizontal offset of the shadow relative to the captions in pixels. A value of -2 would result in a shadow offset 2 pixels to the left. All burn-in and DVB-Sub font settings must match. +* `shadow_y_offset` – (Optional) Specifies the vertical offset of the shadow relative to the captions in pixels. A value of -2 would result in a shadow offset 2 pixels above the text. All burn-in and DVB-Sub font settings must match. +* `teletext_grid_control` – (Optional) Controls whether a fixed grid size will be used to generate the output subtitles bitmap. Only applicable for Teletext inputs and DVB-Sub/Burn-in outputs. +* `x_position` – (Optional) Specifies the horizontal position of the caption relative to the left side of the output in pixels. A value of 10 would result in the captions starting 10 pixels from the left of the output. If no explicit xPosition is provided, the horizontal caption position will be determined by the alignment parameter. This option is not valid for source captions that are STL, 608/embedded or teletext. These source settings are already pre-defined by the caption stream. All burn-in and DVB-Sub font settings must match. +* `y_position` – (Optional) Specifies the vertical position of the caption relative to the top of the output in pixels. A value of 10 would result in the captions starting 10 pixels from the top of the output. If no explicit yPosition is provided, the caption will be positioned towards the bottom of the output. This option is not valid for source captions that are STL, 608/embedded or teletext. These source settings are already pre-defined by the caption stream. All burn-in and DVB-Sub font settings must match. + +### Ebu Tt D Destination Settings + +* `copyright_holder` – (Optional) Complete this field if you want to include the name of the copyright holder in the copyright tag in the captions metadata. +* `fill_line_gap` – (Optional) Specifies how to handle the gap between the lines (in multi-line captions). - enabled: Fill with the captions background color (as specified in the input captions). - disabled: Leave the gap unfilled. +* `font_family` – (Optional) Specifies the font family to include in the font data attached to the EBU-TT captions. Valid only if styleControl is set to include. If you leave this field empty, the font family is set to “monospaced”. (If styleControl is set to exclude, the font family is always set to “monospaced”.) You specify only the font family. All other style information (color, bold, position and so on) is copied from the input captions. The size is always set to 100% to allow the downstream player to choose the size. - Enter a list of font families, as a comma-separated list of font names, in order of preference. The name can be a font family (such as “Arial”), or a generic font family (such as “serif”), or “default” (to let the downstream player choose the font). - Leave blank to set the family to “monospace”. +* `style_control` – (Optional) Specifies the style information (font color, font position, and so on) to include in the font data that is attached to the EBU-TT captions. - include: Take the style information (font color, font position, and so on) from the source captions and include that information in the font data attached to the EBU-TT captions. This option is valid only if the source captions are Embedded or Teletext. - exclude: In the font data attached to the EBU-TT captions, set the font family to “monospaced”. Do not include any other style information. + +### Ttml Destination Settings + +* `style_control` – (Optional) This field is not currently supported and will not affect the output styling. Leave the default value. + +### Webvtt Destination Settings + +* `style_control` - (Optional) Controls whether the color and position of the source captions is passed through to the WebVTT output captions. PASSTHROUGH - Valid only if the source captions are EMBEDDED or TELETEXT. NO\_STYLE\_DATA - Don’t pass through the style. The output captions will not contain any font styling information. + +### Font + +* `password_param` – (Optional) Key used to extract the password from EC2 Parameter store. +* `uri` – (Required) Path to a file accessible to the live stream. +* `username` – (Optional) Username to be used. + +### Global Configuration + +* `initial_audio_gain` – (Optional) Value to set the initial audio gain for the Live Event. +* `input_end_action` – (Optional) Indicates the action to take when the current input completes (e.g. end-of-file). When switchAndLoopInputs is configured the encoder will restart at the beginning of the first input. When “none” is configured the encoder will transcode either black, a solid color, or a user specified slate images per the “Input Loss Behavior” configuration until the next input switch occurs (which is controlled through the Channel Schedule API). +* `input_loss_behavior` - (Optional) Settings for system actions when input is lost. See [Input Loss Behavior](#input-loss-behavior) for more details. +* `output_locking_mode` – (Optional) Indicates how MediaLive pipelines are synchronized. PIPELINE\_LOCKING - MediaLive will attempt to synchronize the output of each pipeline to the other. EPOCH\_LOCKING - MediaLive will attempt to synchronize the output of each pipeline to the Unix epoch. +* `output_timing_source` – (Optional) Indicates whether the rate of frames emitted by the Live encoder should be paced by its system clock (which optionally may be locked to another source via NTP) or should be locked to the clock of the source that is providing the input stream. +* `support_low_framerate_inputs` – (Optional) Adjusts video input buffer for streams with very low video framerates. This is commonly set to enabled for music channels with less than one video frame per second. + +### Input Loss Behavior + +* `password_param` – (Optional) Key used to extract the password from EC2 Parameter store. +* `uri` – (Required) Path to a file accessible to the live stream. +* `username` – (Optional) Username to be used. + +### Motion Graphics Configuration + +* `motion_graphics_insertion` – (Optional) Motion Graphics Insertion. +* `motion_graphics_settings`– (Required) Motion Graphics Settings. See [Motion Graphics Settings](#motion-graphics-settings) for more details. + +### Motion Graphics Settings + +* `html_motion_graphics_settings` – (Optional) Html Motion Graphics Settings. + +### Nielsen Configuration + +* `distributor_id` – (Optional) Enter the Distributor ID assigned to your organization by Nielsen. +* `nielsen_pcm_to_id3_tagging` – (Optional) Enables Nielsen PCM to ID3 tagging. + ### Avail Blanking * `avail_blanking_image` - (Optional) Blanking image to be used. See [Avail Blanking Image](#avail-blanking-image) for more details. From e3cadac664c0865aeaf1bec18cd1739cb291ec28 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 25 Jul 2023 13:37:32 -0500 Subject: [PATCH 2/4] aws_medialive_channel: add test --- internal/service/medialive/channel.go | 2 +- .../channel_encoder_settings_schema.go | 8 +- internal/service/medialive/channel_test.go | 163 +++++++++++++++++- 3 files changed, 168 insertions(+), 5 deletions(-) diff --git a/internal/service/medialive/channel.go b/internal/service/medialive/channel.go index 4cacb35412b..989d9dfe6f4 100644 --- a/internal/service/medialive/channel.go +++ b/internal/service/medialive/channel.go @@ -1160,7 +1160,7 @@ func expandInputAttachmentInputSettings(tfList []interface{}) *types.InputSettin if v, ok := m["audio_selector"].([]interface{}); ok && len(v) > 0 { out.AudioSelectors = expandInputAttachmentInputSettingsAudioSelectors(v) } - if v, ok := m["audio_selector"].([]interface{}); ok && len(v) > 0 { + if v, ok := m["caption_selector"].([]interface{}); ok && len(v) > 0 { out.CaptionSelectors = expandInputAttachmentInputSettingsCaptionSelectors(v) } if v, ok := m["deblock_filter"].(string); ok && v != "" { diff --git a/internal/service/medialive/channel_encoder_settings_schema.go b/internal/service/medialive/channel_encoder_settings_schema.go index 0eb19b7c976..95a262b7240 100644 --- a/internal/service/medialive/channel_encoder_settings_schema.go +++ b/internal/service/medialive/channel_encoder_settings_schema.go @@ -1925,8 +1925,9 @@ func channelEncoderSettingsSchema() *schema.Schema { // TODO avail_configuration // TODO blackout_slate "caption_descriptions": { - Type: schema.TypeSet, + Type: schema.TypeList, Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "caption_selector_name": { @@ -2047,7 +2048,7 @@ func channelEncoderSettingsSchema() *schema.Schema { }, "dvb_sub_destination_settings": { Type: schema.TypeList, - Required: true, + Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -2089,6 +2090,7 @@ func channelEncoderSettingsSchema() *schema.Schema { "font_size": { Type: schema.TypeString, Optional: true, + Computed: true, }, "outline_color": { Type: schema.TypeString, @@ -2120,7 +2122,7 @@ func channelEncoderSettingsSchema() *schema.Schema { }, "teletext_grid_control": { Type: schema.TypeString, - Required: true, + Optional: true, ValidateDiagFunc: enum.Validate[types.DvbSubDestinationTeletextGridControl](), }, "x_position": { diff --git a/internal/service/medialive/channel_test.go b/internal/service/medialive/channel_test.go index 0de5260b0be..543242d728c 100644 --- a/internal/service/medialive/channel_test.go +++ b/internal/service/medialive/channel_test.go @@ -79,6 +79,64 @@ func TestAccMediaLiveChannel_basic(t *testing.T) { }) } +func TestAccMediaLiveChannel_captionDescriptions(t *testing.T) { + ctx := acctest.Context(t) + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + var channel medialive.DescribeChannelOutput + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_medialive_channel.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionHasService(t, names.MediaLiveEndpointID) + testAccChannelsPreCheck(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.MediaLiveEndpointID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckChannelDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccChannelConfig_caption_descriptions(rName, 100), + Check: resource.ComposeTestCheckFunc( + testAccCheckChannelExists(ctx, resourceName, &channel), + resource.TestCheckResourceAttrSet(resourceName, "channel_id"), + resource.TestCheckResourceAttr(resourceName, "channel_class", "STANDARD"), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttrSet(resourceName, "role_arn"), + resource.TestCheckResourceAttr(resourceName, "input_specification.0.codec", "AVC"), + resource.TestCheckResourceAttr(resourceName, "input_specification.0.input_resolution", "HD"), + resource.TestCheckResourceAttr(resourceName, "input_specification.0.maximum_bitrate", "MAX_20_MBPS"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "input_attachments.*", map[string]string{ + "input_attachment_name": "example-input1", + }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "destinations.*", map[string]string{ + "id": rName, + }), + resource.TestCheckResourceAttr(resourceName, "encoder_settings.0.timecode_config.0.source", "EMBEDDED"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "encoder_settings.0.caption_descriptions.*", map[string]string{ + "caption_selector_name": rName, + "name": "test-caption-name", + "destination_settings.0.dvb_sub_destination_settings.0.font_resolution": "100", + }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "encoder_settings.0.video_descriptions.*", map[string]string{ + "name": "test-video-name", + }), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"start_channel"}, + }, + }, + }) +} + func TestAccMediaLiveChannel_M2TS_settings(t *testing.T) { ctx := acctest.Context(t) if testing.Short() { @@ -954,7 +1012,6 @@ resource "aws_medialive_input" "test" { } } - `, rName) } @@ -1744,6 +1801,110 @@ resource "aws_medialive_channel" "test" { `, rName)) } +func testAccChannelConfig_caption_descriptions(rName string, fontResolution int) string { + return acctest.ConfigCompose( + testAccChannelConfig_base(rName), + testAccChannelConfig_baseS3(rName), + testAccChannelConfig_baseMultiplex(rName), + fmt.Sprintf(` +resource "aws_medialive_channel" "test" { + name = %[1]q + channel_class = "STANDARD" + role_arn = aws_iam_role.test.arn + + input_specification { + codec = "AVC" + input_resolution = "HD" + maximum_bitrate = "MAX_20_MBPS" + } + + input_attachments { + input_attachment_name = "example-input1" + input_id = aws_medialive_input.test.id + + input_settings { + caption_selector { + name = %[1]q + } + + audio_selector { + name = "test-audio-selector" + } + } + } + + destinations { + id = %[1]q + + settings { + url = "s3://${aws_s3_bucket.test1.id}/test1" + } + + settings { + url = "s3://${aws_s3_bucket.test2.id}/test2" + } + } + + encoder_settings { + timecode_config { + source = "EMBEDDED" + } + + audio_descriptions { + name = "test-audio-name" + audio_selector_name = "test-audio-selector" + } + + + video_descriptions { + name = "test-video-name" + } + + caption_descriptions { + name = "test-caption-name" + caption_selector_name = aws_medialive_input.test.name + + destination_settings { + dvb_sub_destination_settings{ + font_resolution = %[2]d + } + } + } + + output_groups { + output_group_settings { + archive_group_settings { + destination { + destination_ref_id = %[1]q + } + } + } + + outputs { + output_name = "test-output-name" + video_description_name = "test-video-name" + audio_description_names = ["test-audio-name"] + caption_description_names = ["test-caption-name"] + output_settings { + archive_output_settings { + name_modifier = "_1" + extension = "m2ts" + container_settings { + m2ts_settings { + audio_buffer_model = "ATSC" + buffer_model = "MULTIPLEX" + rate_mode = "CBR" + } + } + } + } + } + } + } +} +`, rName, fontResolution)) +} + func testAccChannelConfig_start(rName string, start bool) string { return acctest.ConfigCompose( testAccChannelConfig_base(rName), From d57fbd4eb232b35a8560eb4b29fe6aa26fe9a389 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 25 Jul 2023 13:43:41 -0500 Subject: [PATCH 3/4] fmt --- internal/service/medialive/channel_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/medialive/channel_test.go b/internal/service/medialive/channel_test.go index 543242d728c..a69dea2e8b5 100644 --- a/internal/service/medialive/channel_test.go +++ b/internal/service/medialive/channel_test.go @@ -1851,7 +1851,7 @@ resource "aws_medialive_channel" "test" { } audio_descriptions { - name = "test-audio-name" + name = "test-audio-name" audio_selector_name = "test-audio-selector" } @@ -1861,11 +1861,11 @@ resource "aws_medialive_channel" "test" { } caption_descriptions { - name = "test-caption-name" + name = "test-caption-name" caption_selector_name = aws_medialive_input.test.name destination_settings { - dvb_sub_destination_settings{ + dvb_sub_destination_settings { font_resolution = %[2]d } } @@ -1881,9 +1881,9 @@ resource "aws_medialive_channel" "test" { } outputs { - output_name = "test-output-name" - video_description_name = "test-video-name" - audio_description_names = ["test-audio-name"] + output_name = "test-output-name" + video_description_name = "test-video-name" + audio_description_names = ["test-audio-name"] caption_description_names = ["test-caption-name"] output_settings { archive_output_settings { From 230d3a8eef35473f0783c74e87f529d5bbd115d0 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 25 Jul 2023 13:45:36 -0500 Subject: [PATCH 4/4] add CHANGELOG entry --- .changelog/32233.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/32233.txt diff --git a/.changelog/32233.txt b/.changelog/32233.txt new file mode 100644 index 00000000000..e46b496d537 --- /dev/null +++ b/.changelog/32233.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_medialive_channel: Adds schemas for `caption_descriptions`, `global_configuration`, `motion_graphics_configuration`, and `nielsen_configuration` support to `encoder settings` +``` \ No newline at end of file