1 /* 2 * Copyright (c) 2016 Neil Birkbeck <neil.birkbeck@gmail.com> 3 * 4 * This file is part of FFmpeg. 5 * 6 * FFmpeg is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * FFmpeg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with FFmpeg; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 module ffmpeg.libavutil.mastering_display_metadata; 22 23 import ffmpeg.libavutil.frame; 24 import ffmpeg.libavutil.rational; 25 26 extern (C): 27 import ffmpeg; @nogc nothrow: 28 29 /** 30 * Mastering display metadata capable of representing the color volume of 31 * the display used to master the content (SMPTE 2086:2014). 32 * 33 * To be used as payload of a AVFrameSideData or AVPacketSideData with the 34 * appropriate type. 35 * 36 * @note The struct should be allocated with av_mastering_display_metadata_alloc() 37 * and its size is not a part of the public ABI. 38 */ 39 struct AVMasteringDisplayMetadata 40 { 41 /** 42 * CIE 1931 xy chromaticity coords of color primaries (r, g, b order). 43 */ 44 AVRational[2][3] display_primaries; 45 46 /** 47 * CIE 1931 xy chromaticity coords of white point. 48 */ 49 AVRational[2] white_point; 50 51 /** 52 * Min luminance of mastering display (cd/m^2). 53 */ 54 AVRational min_luminance; 55 56 /** 57 * Max luminance of mastering display (cd/m^2). 58 */ 59 AVRational max_luminance; 60 61 /** 62 * Flag indicating whether the display primaries (and white point) are set. 63 */ 64 int has_primaries; 65 66 /** 67 * Flag indicating whether the luminance (min_ and max_) have been set. 68 */ 69 int has_luminance; 70 } 71 72 /** 73 * Allocate an AVMasteringDisplayMetadata structure and set its fields to 74 * default values. The resulting struct can be freed using av_freep(). 75 * 76 * @return An AVMasteringDisplayMetadata filled with default values or NULL 77 * on failure. 78 */ 79 AVMasteringDisplayMetadata* av_mastering_display_metadata_alloc (); 80 81 /** 82 * Allocate a complete AVMasteringDisplayMetadata and add it to the frame. 83 * 84 * @param frame The frame which side data is added to. 85 * 86 * @return The AVMasteringDisplayMetadata structure to be filled by caller. 87 */ 88 AVMasteringDisplayMetadata* av_mastering_display_metadata_create_side_data (AVFrame* frame); 89 90 /** 91 * Content light level needed by to transmit HDR over HDMI (CTA-861.3). 92 * 93 * To be used as payload of a AVFrameSideData or AVPacketSideData with the 94 * appropriate type. 95 * 96 * @note The struct should be allocated with av_content_light_metadata_alloc() 97 * and its size is not a part of the public ABI. 98 */ 99 struct AVContentLightMetadata 100 { 101 /** 102 * Max content light level (cd/m^2). 103 */ 104 uint MaxCLL; 105 106 /** 107 * Max average light level per frame (cd/m^2). 108 */ 109 uint MaxFALL; 110 } 111 112 /** 113 * Allocate an AVContentLightMetadata structure and set its fields to 114 * default values. The resulting struct can be freed using av_freep(). 115 * 116 * @return An AVContentLightMetadata filled with default values or NULL 117 * on failure. 118 */ 119 AVContentLightMetadata* av_content_light_metadata_alloc (size_t* size); 120 121 /** 122 * Allocate a complete AVContentLightMetadata and add it to the frame. 123 * 124 * @param frame The frame which side data is added to. 125 * 126 * @return The AVContentLightMetadata structure to be filled by caller. 127 */ 128 AVContentLightMetadata* av_content_light_metadata_create_side_data (AVFrame* frame); 129 130 /* AVUTIL_MASTERING_DISPLAY_METADATA_H */