mastering_display_metadata.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. #ifndef AVUTIL_MASTERING_DISPLAY_METADATA_H
  21. #define AVUTIL_MASTERING_DISPLAY_METADATA_H
  22. #include "frame.h"
  23. #include "rational.h"
  24. /**
  25. * Mastering display metadata capable of representing the color volume of
  26. * the display used to master the content (SMPTE 2086:2014).
  27. *
  28. * To be used as payload of a AVFrameSideData or AVPacketSideData with the
  29. * appropriate type.
  30. *
  31. * @note The struct should be allocated with av_mastering_display_metadata_alloc()
  32. * and its size is not a part of the public ABI.
  33. */
  34. typedef struct AVMasteringDisplayMetadata {
  35. /**
  36. * CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
  37. */
  38. AVRational display_primaries[3][2];
  39. /**
  40. * CIE 1931 xy chromaticity coords of white point.
  41. */
  42. AVRational white_point[2];
  43. /**
  44. * Min luminance of mastering display (cd/m^2).
  45. */
  46. AVRational min_luminance;
  47. /**
  48. * Max luminance of mastering display (cd/m^2).
  49. */
  50. AVRational max_luminance;
  51. /**
  52. * Flag indicating whether the display primaries (and white point) are set.
  53. */
  54. int has_primaries;
  55. /**
  56. * Flag indicating whether the luminance (min_ and max_) have been set.
  57. */
  58. int has_luminance;
  59. } AVMasteringDisplayMetadata;
  60. /**
  61. * Allocate an AVMasteringDisplayMetadata structure and set its fields to
  62. * default values. The resulting struct can be freed using av_freep().
  63. *
  64. * @return An AVMasteringDisplayMetadata filled with default values or NULL
  65. * on failure.
  66. */
  67. AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void);
  68. /**
  69. * Allocate a complete AVMasteringDisplayMetadata and add it to the frame.
  70. *
  71. * @param frame The frame which side data is added to.
  72. *
  73. * @return The AVMasteringDisplayMetadata structure to be filled by caller.
  74. */
  75. AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame);
  76. /**
  77. * Content light level needed by to transmit HDR over HDMI (CTA-861.3).
  78. *
  79. * To be used as payload of a AVFrameSideData or AVPacketSideData with the
  80. * appropriate type.
  81. *
  82. * @note The struct should be allocated with av_content_light_metadata_alloc()
  83. * and its size is not a part of the public ABI.
  84. */
  85. typedef struct AVContentLightMetadata {
  86. /**
  87. * Max content light level (cd/m^2).
  88. */
  89. unsigned MaxCLL;
  90. /**
  91. * Max average light level per frame (cd/m^2).
  92. */
  93. unsigned MaxFALL;
  94. } AVContentLightMetadata;
  95. /**
  96. * Allocate an AVContentLightMetadata structure and set its fields to
  97. * default values. The resulting struct can be freed using av_freep().
  98. *
  99. * @return An AVContentLightMetadata filled with default values or NULL
  100. * on failure.
  101. */
  102. AVContentLightMetadata *av_content_light_metadata_alloc(size_t *size);
  103. /**
  104. * Allocate a complete AVContentLightMetadata and add it to the frame.
  105. *
  106. * @param frame The frame which side data is added to.
  107. *
  108. * @return The AVContentLightMetadata structure to be filled by caller.
  109. */
  110. AVContentLightMetadata *av_content_light_metadata_create_side_data(AVFrame *frame);
  111. #endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */