ImageTypes.h (3378B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef GFX_IMAGETYPES_H 8 #define GFX_IMAGETYPES_H 9 10 #include <stdint.h> // for uint32_t 11 #include "mozilla/Maybe.h" 12 #include "mozilla/TimeStamp.h" 13 #include "mozilla/Variant.h" 14 15 namespace mozilla { 16 17 enum class ImageFormat { 18 /** 19 * The PLANAR_YCBCR format creates a PlanarYCbCrImage. All backends should 20 * support this format, because the Ogg video decoder depends on it. 21 * The maximum image width and height is 16384. 22 */ 23 PLANAR_YCBCR, 24 25 /** 26 * The NV_IMAGE format creates a NVImage. The PLANAR_YCBCR together with this 27 * complete the YUV format family. 28 */ 29 NV_IMAGE, 30 31 /** 32 * The SHARED_RGB format creates a SharedRGBImage, which stores RGB data in 33 * shared memory. Some Android hardware video decoders require this format. 34 * Currently only used on Android. 35 */ 36 SHARED_RGB, 37 38 /** 39 * The MOZ2D_SURFACE format creates a SourceSurfaceImage. All backends should 40 * support this format, because video rendering sometimes requires it. 41 * 42 * This format is useful even though a PaintedLayer could be used. 43 * It makes it easy to render a cairo surface when another Image format 44 * could be used. It can also avoid copying the surface data in some 45 * cases. 46 */ 47 MOZ2D_SURFACE, 48 49 /** 50 * A MacIOSurface object. 51 */ 52 MAC_IOSURFACE, 53 54 /** 55 * An Android SurfaceTexture ID that can be shared across threads and 56 * processes. 57 */ 58 SURFACE_TEXTURE, 59 60 /** 61 * The D3D9_RGB32_TEXTURE format creates a D3D9SurfaceImage, and wraps a 62 * IDirect3DTexture9 in RGB32 layout. 63 */ 64 D3D9_RGB32_TEXTURE, 65 66 /** 67 * An Image type carries an opaque handle once for each stream. 68 * The opaque handle would be a platform specific identifier. 69 */ 70 OVERLAY_IMAGE, 71 72 /** 73 * A share handle to a ID3D11Texture2D. 74 */ 75 D3D11_SHARE_HANDLE_TEXTURE, 76 77 /** 78 * A wrapper of ID3D11Texture2D for zero copy hw video decoding. 79 * Expected to be used in GPU process. 80 */ 81 D3D11_TEXTURE_ZERO_COPY, 82 83 /** 84 * A wrapper around a drawable TextureClient. 85 */ 86 TEXTURE_WRAPPER, 87 88 /** 89 * An opaque handle that refers to an Image stored in the GPU 90 * process. 91 */ 92 GPU_VIDEO, 93 94 /** 95 * The DMABUF format creates a SharedDMABUFImage, which stores YUV 96 * data in DMABUF memory. Used by VAAPI decoder on Linux. 97 */ 98 DMABUF, 99 100 /** 101 * A Wrapper of Dcomp surface handle, used by the windows media foundation 102 * media engine playback. 103 */ 104 DCOMP_SURFACE, 105 }; 106 107 enum class StereoMode { 108 MONO, 109 LEFT_RIGHT, 110 RIGHT_LEFT, 111 BOTTOM_TOP, 112 TOP_BOTTOM, 113 MAX, 114 }; 115 116 namespace layers { 117 118 using ContainerFrameID = uint32_t; 119 constexpr ContainerFrameID kContainerFrameID_Invalid = 0; 120 121 using ContainerProducerID = uint32_t; 122 constexpr ContainerProducerID kContainerProducerID_Invalid = 0; 123 124 // int64_t represents a WebRTC NTP timestamp. 125 using ContainerCaptureTime = Variant<Nothing, TimeStamp, int64_t>; 126 127 // int64_t represents a WebRTC Realtime timestamp. 128 using ContainerReceiveTime = Maybe<int64_t>; 129 130 using ContainerRtpTimestamp = Maybe<uint32_t>; 131 132 } // namespace layers 133 134 } // namespace mozilla 135 136 #endif