ambient_viewing_environment.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) 2023 Jan Ekström <jeebjp@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_AMBIENT_VIEWING_ENVIRONMENT_H
  21. #define AVUTIL_AMBIENT_VIEWING_ENVIRONMENT_H
  22. #include <stddef.h>
  23. #include "frame.h"
  24. #include "rational.h"
  25. /**
  26. * Ambient viewing environment metadata as defined by H.274. The values are
  27. * saved in AVRationals so that they keep their exactness, while allowing for
  28. * easy access to a double value with f.ex. av_q2d.
  29. *
  30. * @note sizeof(AVAmbientViewingEnvironment) is not part of the public ABI, and
  31. * it must be allocated using av_ambient_viewing_environment_alloc.
  32. */
  33. typedef struct AVAmbientViewingEnvironment {
  34. /**
  35. * Environmental illuminance of the ambient viewing environment in lux.
  36. */
  37. AVRational ambient_illuminance;
  38. /**
  39. * Normalized x chromaticity coordinate of the environmental ambient light
  40. * in the nominal viewing environment according to the CIE 1931 definition
  41. * of x and y as specified in ISO/CIE 11664-1.
  42. */
  43. AVRational ambient_light_x;
  44. /**
  45. * Normalized y chromaticity coordinate of the environmental ambient light
  46. * in the nominal viewing environment according to the CIE 1931 definition
  47. * of x and y as specified in ISO/CIE 11664-1.
  48. */
  49. AVRational ambient_light_y;
  50. } AVAmbientViewingEnvironment;
  51. /**
  52. * Allocate an AVAmbientViewingEnvironment structure.
  53. *
  54. * @return the newly allocated struct or NULL on failure
  55. */
  56. AVAmbientViewingEnvironment *av_ambient_viewing_environment_alloc(size_t *size);
  57. /**
  58. * Allocate and add an AVAmbientViewingEnvironment structure to an existing
  59. * AVFrame as side data.
  60. *
  61. * @return the newly allocated struct, or NULL on failure
  62. */
  63. AVAmbientViewingEnvironment *av_ambient_viewing_environment_create_side_data(AVFrame *frame);
  64. #endif /* AVUTIL_AMBIENT_VIEWING_ENVIRONMENT_H */