2 * This file is part of FFmpeg.
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.
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.
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
19 static int FUNC(sei_user_data_registered)
20 (CodedBitstreamContext *ctx, RWContext *rw,
21 SEIRawUserDataRegistered *current, uint32_t *payload_size)
25 HEADER("User Data Registered ITU-T T.35");
27 u(8, itu_t_t35_country_code, 0x00, 0xff);
28 if (current->itu_t_t35_country_code != 0xff)
31 u(8, itu_t_t35_country_code_extension_byte, 0x00, 0xff);
36 if (*payload_size < i) {
37 av_log(ctx->log_ctx, AV_LOG_ERROR,
38 "Invalid SEI user data registered payload.\n");
39 return AVERROR_INVALIDDATA;
41 current->data_length = *payload_size - i;
43 *payload_size = i + current->data_length;
46 allocate(current->data, current->data_length);
47 for (j = 0; j < current->data_length; j++)
48 xu(8, itu_t_t35_payload_byte[], current->data[j], 0x00, 0xff, 1, i + j);
53 static int FUNC(sei_user_data_unregistered)
54 (CodedBitstreamContext *ctx, RWContext *rw,
55 SEIRawUserDataUnregistered *current, uint32_t *payload_size)
59 HEADER("User Data Unregistered");
62 if (*payload_size < 16) {
63 av_log(ctx->log_ctx, AV_LOG_ERROR,
64 "Invalid SEI user data unregistered payload.\n");
65 return AVERROR_INVALIDDATA;
67 current->data_length = *payload_size - 16;
69 *payload_size = 16 + current->data_length;
72 for (i = 0; i < 16; i++)
73 us(8, uuid_iso_iec_11578[i], 0x00, 0xff, 1, i);
75 allocate(current->data, current->data_length);
77 for (i = 0; i < current->data_length; i++)
78 xu(8, user_data_payload_byte[i], current->data[i], 0x00, 0xff, 1, i);
83 static int FUNC(sei_mastering_display_colour_volume)
84 (CodedBitstreamContext *ctx, RWContext *rw,
85 SEIRawMasteringDisplayColourVolume *current)
89 HEADER("Mastering Display Colour Volume");
91 for (c = 0; c < 3; c++) {
92 us(16, display_primaries_x[c], 0, 50000, 1, c);
93 us(16, display_primaries_y[c], 0, 50000, 1, c);
96 u(16, white_point_x, 0, 50000);
97 u(16, white_point_y, 0, 50000);
99 u(32, max_display_mastering_luminance,
100 1, MAX_UINT_BITS(32));
101 u(32, min_display_mastering_luminance,
102 0, current->max_display_mastering_luminance - 1);
107 static int FUNC(sei_content_light_level)
108 (CodedBitstreamContext *ctx, RWContext *rw,
109 SEIRawContentLightLevelInfo *current)
113 HEADER("Content Light Level");
115 ub(16, max_content_light_level);
116 ub(16, max_pic_average_light_level);
121 static int FUNC(sei_alternative_transfer_characteristics)
122 (CodedBitstreamContext *ctx, RWContext *rw,
123 SEIRawAlternativeTransferCharacteristics *current)
127 HEADER("Alternative Transfer Characteristics");
129 ub(8, preferred_transfer_characteristics);