|  | // Copyright 2021 The Fuchsia Authors. All rights reserved. | 
|  | // Use of this source code is governed by a BSD-style license that can be | 
|  | // found in the LICENSE file. | 
|  | library fuchsia.mediastreams; | 
|  |  | 
|  | using fuchsia.math; | 
|  |  | 
|  | /// Describes a format used for video elementary streams without | 
|  | /// reference to compression. Where compression is supported, this | 
|  | /// type should be combined with a `Compression` struct. | 
|  | type VideoFormat = struct { | 
|  | /// Describes the manner in which pixels are encoded. | 
|  | pixel_format PixelFormat; | 
|  |  | 
|  | /// Indicates the color space used to interpret pixel values. | 
|  | color_space ColorSpace; | 
|  |  | 
|  | /// The size of a frame in terms of the number of pixels that | 
|  | /// are represented in a frame payload. | 
|  | coded_size fuchsia.math.Size; | 
|  |  | 
|  | /// The size of a frame in terms of the number of pixels that | 
|  | /// should be displayed. These values will always be less than | 
|  | /// or equal to the corresponding `coded_size` values. | 
|  | display_size fuchsia.math.Size; | 
|  |  | 
|  | /// Aspect ratio of a single pixel as the video is intended to | 
|  | /// be displayed. | 
|  | aspect_ratio box<fuchsia.math.Size>; | 
|  |  | 
|  | // TODO: fuchsia.sysmem2.ImageFormat has bytes_per_row, but | 
|  | // that’s a function of pixel_format and coded_size. Do we | 
|  | // need that? | 
|  | }; | 
|  |  | 
|  | /// Expresses the manner in which video pixels are encoded. | 
|  | // TODO: Do we need a pixel format modifier? | 
|  | type PixelFormat = strict enum { | 
|  | INVALID = 0; | 
|  | R8G8B8A8 = 1; | 
|  | BGRA32 = 101; | 
|  | I420 = 102; | 
|  | M420 = 103; | 
|  | NV12 = 104; | 
|  | YUY2 = 105; | 
|  | MJPEG = 106; | 
|  | YV12 = 107; | 
|  | BGR24 = 108; | 
|  | RGB565 = 109; | 
|  | RGB332 = 110; | 
|  | RGB2220 = 111; | 
|  | L8 = 112; | 
|  | R8 = 113; | 
|  | R8G8 = 114; | 
|  | }; | 
|  |  | 
|  | /// Expresses the color space used to interpret video pixel values. | 
|  | type ColorSpace = strict enum { | 
|  | INVALID = 0; | 
|  | SRGB = 1; | 
|  | REC601_NTSC = 2; | 
|  | REC601_NTSC_FULL_RANGE = 3; | 
|  | REC601_PAL = 4; | 
|  | REC601_PAL_FULL_RANGE = 5; | 
|  | REC709 = 6; | 
|  | REC2020 = 7; | 
|  | REC2100 = 8; | 
|  | }; |