You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
3.6KB

  1. /*
  2. * This file is part of FFmpeg.
  3. *
  4. * FFmpeg is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * FFmpeg is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with FFmpeg; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. static int FUNC(sei_user_data_registered)
  19. (CodedBitstreamContext *ctx, RWContext *rw,
  20. SEIRawUserDataRegistered *current, uint32_t *payload_size)
  21. {
  22. int err, i, j;
  23. HEADER("User Data Registered ITU-T T.35");
  24. u(8, itu_t_t35_country_code, 0x00, 0xff);
  25. if (current->itu_t_t35_country_code != 0xff)
  26. i = 1;
  27. else {
  28. u(8, itu_t_t35_country_code_extension_byte, 0x00, 0xff);
  29. i = 2;
  30. }
  31. #ifdef READ
  32. if (*payload_size < i) {
  33. av_log(ctx->log_ctx, AV_LOG_ERROR,
  34. "Invalid SEI user data registered payload.\n");
  35. return AVERROR_INVALIDDATA;
  36. }
  37. current->data_length = *payload_size - i;
  38. #else
  39. *payload_size = i + current->data_length;
  40. #endif
  41. allocate(current->data, current->data_length);
  42. for (j = 0; j < current->data_length; j++)
  43. xu(8, itu_t_t35_payload_byte[], current->data[j], 0x00, 0xff, 1, i + j);
  44. return 0;
  45. }
  46. static int FUNC(sei_user_data_unregistered)
  47. (CodedBitstreamContext *ctx, RWContext *rw,
  48. SEIRawUserDataUnregistered *current, uint32_t *payload_size)
  49. {
  50. int err, i;
  51. HEADER("User Data Unregistered");
  52. #ifdef READ
  53. if (*payload_size < 16) {
  54. av_log(ctx->log_ctx, AV_LOG_ERROR,
  55. "Invalid SEI user data unregistered payload.\n");
  56. return AVERROR_INVALIDDATA;
  57. }
  58. current->data_length = *payload_size - 16;
  59. #else
  60. *payload_size = 16 + current->data_length;
  61. #endif
  62. for (i = 0; i < 16; i++)
  63. us(8, uuid_iso_iec_11578[i], 0x00, 0xff, 1, i);
  64. allocate(current->data, current->data_length);
  65. for (i = 0; i < current->data_length; i++)
  66. xu(8, user_data_payload_byte[i], current->data[i], 0x00, 0xff, 1, i);
  67. return 0;
  68. }
  69. static int FUNC(sei_mastering_display_colour_volume)
  70. (CodedBitstreamContext *ctx, RWContext *rw,
  71. SEIRawMasteringDisplayColourVolume *current)
  72. {
  73. int err, c;
  74. HEADER("Mastering Display Colour Volume");
  75. for (c = 0; c < 3; c++) {
  76. us(16, display_primaries_x[c], 0, 50000, 1, c);
  77. us(16, display_primaries_y[c], 0, 50000, 1, c);
  78. }
  79. u(16, white_point_x, 0, 50000);
  80. u(16, white_point_y, 0, 50000);
  81. u(32, max_display_mastering_luminance,
  82. 1, MAX_UINT_BITS(32));
  83. u(32, min_display_mastering_luminance,
  84. 0, current->max_display_mastering_luminance - 1);
  85. return 0;
  86. }
  87. static int FUNC(sei_content_light_level)
  88. (CodedBitstreamContext *ctx, RWContext *rw,
  89. SEIRawContentLightLevelInfo *current)
  90. {
  91. int err;
  92. HEADER("Content Light Level");
  93. ub(16, max_content_light_level);
  94. ub(16, max_pic_average_light_level);
  95. return 0;
  96. }
  97. static int FUNC(sei_alternative_transfer_characteristics)
  98. (CodedBitstreamContext *ctx, RWContext *rw,
  99. SEIRawAlternativeTransferCharacteristics *current)
  100. {
  101. int err;
  102. HEADER("Alternative Transfer Characteristics");
  103. ub(8, preferred_transfer_characteristics);
  104. return 0;
  105. }