1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package kinesisvideoarchivedmedia 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/kinesisvideoarchivedmedia/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12 "io" 13) 14 15// Downloads an MP4 file (clip) containing the archived, on-demand media from the 16// specified video stream over the specified time range. Both the StreamName and 17// the StreamARN parameters are optional, but you must specify either the 18// StreamName or the StreamARN when invoking this API operation. As a prerequsite 19// to using GetCLip API, you must obtain an endpoint using GetDataEndpoint, 20// specifying GET_CLIP for the APIName parameter. An Amazon Kinesis video stream 21// has the following requirements for providing data through MP4: 22// 23// * The media must 24// contain h.264 or h.265 encoded video and, optionally, AAC or G.711 encoded 25// audio. Specifically, the codec ID of track 1 should be V_MPEG/ISO/AVC (for 26// h.264) or V_MPEGH/ISO/HEVC (for H.265). Optionally, the codec ID of track 2 27// should be A_AAC (for AAC) or A_MS/ACM (for G.711). 28// 29// * Data retention must be 30// greater than 0. 31// 32// * The video track of each fragment must contain codec private 33// data in the Advanced Video Coding (AVC) for H.264 format and HEVC for H.265 34// format. For more information, see MPEG-4 specification ISO/IEC 14496-15 35// (https://www.iso.org/standard/55980.html). For information about adapting stream 36// data to a given format, see NAL Adaptation Flags 37// (http://docs.aws.amazon.com/kinesisvideostreams/latest/dg/producer-reference-nal.html). 38// 39// * 40// The audio track (if present) of each fragment must contain codec private data in 41// the AAC format (AAC specification ISO/IEC 13818-7 42// (https://www.iso.org/standard/43345.html)) or the MS Wave format 43// (http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html). 44// 45// You can 46// monitor the amount of outgoing data by monitoring the GetClip.OutgoingBytes 47// Amazon CloudWatch metric. For information about using CloudWatch to monitor 48// Kinesis Video Streams, see Monitoring Kinesis Video Streams 49// (http://docs.aws.amazon.com/kinesisvideostreams/latest/dg/monitoring.html). For 50// pricing information, see Amazon Kinesis Video Streams Pricing 51// (https://aws.amazon.com/kinesis/video-streams/pricing/) and AWS Pricing 52// (https://aws.amazon.com/pricing/). Charges for outgoing AWS data apply. 53func (c *Client) GetClip(ctx context.Context, params *GetClipInput, optFns ...func(*Options)) (*GetClipOutput, error) { 54 if params == nil { 55 params = &GetClipInput{} 56 } 57 58 result, metadata, err := c.invokeOperation(ctx, "GetClip", params, optFns, addOperationGetClipMiddlewares) 59 if err != nil { 60 return nil, err 61 } 62 63 out := result.(*GetClipOutput) 64 out.ResultMetadata = metadata 65 return out, nil 66} 67 68type GetClipInput struct { 69 70 // The time range of the requested clip and the source of the timestamps. 71 // 72 // This member is required. 73 ClipFragmentSelector *types.ClipFragmentSelector 74 75 // The Amazon Resource Name (ARN) of the stream for which to retrieve the media 76 // clip. You must specify either the StreamName or the StreamARN. 77 StreamARN *string 78 79 // The name of the stream for which to retrieve the media clip. You must specify 80 // either the StreamName or the StreamARN. 81 StreamName *string 82} 83 84type GetClipOutput struct { 85 86 // The content type of the media in the requested clip. 87 ContentType *string 88 89 // Traditional MP4 file that contains the media clip from the specified video 90 // stream. The output will contain the first 100 MB or the first 200 fragments from 91 // the specified start timestamp. For more information, see Kinesis Video Streams 92 // Limits. 93 Payload io.ReadCloser 94 95 // Metadata pertaining to the operation's result. 96 ResultMetadata middleware.Metadata 97} 98 99func addOperationGetClipMiddlewares(stack *middleware.Stack, options Options) (err error) { 100 err = stack.Serialize.Add(&awsRestjson1_serializeOpGetClip{}, middleware.After) 101 if err != nil { 102 return err 103 } 104 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetClip{}, middleware.After) 105 if err != nil { 106 return err 107 } 108 if err = addSetLoggerMiddleware(stack, options); err != nil { 109 return err 110 } 111 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 112 return err 113 } 114 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 115 return err 116 } 117 if err = addResolveEndpointMiddleware(stack, options); err != nil { 118 return err 119 } 120 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 121 return err 122 } 123 if err = addRetryMiddlewares(stack, options); err != nil { 124 return err 125 } 126 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 127 return err 128 } 129 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 130 return err 131 } 132 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 133 return err 134 } 135 if err = addClientUserAgent(stack); err != nil { 136 return err 137 } 138 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 139 return err 140 } 141 if err = addOpGetClipValidationMiddleware(stack); err != nil { 142 return err 143 } 144 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetClip(options.Region), middleware.Before); err != nil { 145 return err 146 } 147 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 148 return err 149 } 150 if err = addResponseErrorMiddleware(stack); err != nil { 151 return err 152 } 153 if err = addRequestResponseLogging(stack, options); err != nil { 154 return err 155 } 156 return nil 157} 158 159func newServiceMetadataMiddleware_opGetClip(region string) *awsmiddleware.RegisterServiceMetadata { 160 return &awsmiddleware.RegisterServiceMetadata{ 161 Region: region, 162 ServiceID: ServiceID, 163 SigningName: "kinesisvideo", 164 OperationName: "GetClip", 165 } 166} 167