xref: /aosp_15_r20/external/libopenapv/src/oapv_metadata.h (revision abb65b4b03b69e1d508d4d9a44dcf199df16e7c3)
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  * All Rights Reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * - Redistributions of source code must retain the above copyright notice,
9  *   this list of conditions and the following disclaimer.
10  *
11  * - Redistributions in binary form must reproduce the above copyright notice,
12  *   this list of conditions and the following disclaimer in the documentation
13  *   and/or other materials provided with the distribution.
14  *
15  * - Neither the name of the copyright owner, nor the names of its contributors
16  *   may be used to endorse or promote products derived from this software
17  *   without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _OAPV_METADATA_H_
33 #define _OAPV_METADATA_H_
34 
35 #include "oapv_def.h"
36 
37 /* oapv metadata container magic code */
38 #define OAPVM_MAGIC_CODE 0x4150314D /* AP1M */
39 
40 /* Metadata payload */
41 typedef struct oapv_mdp oapv_mdp_t;
42 struct oapv_mdp {
43     u32         pld_type; /* u(8) */
44     u32         pld_size; /* u(8) */
45     void       *pld_data;
46     oapv_mdp_t *next;
47 };
48 
49 typedef struct oapv_md oapv_md_t;
50 struct oapv_md {
51     int         md_num;
52     u32         md_size; /* u(32) */
53     oapv_mdp_t *md_payload;
54 };
55 
56 typedef struct oapvm_ctx oapvm_ctx_t;
57 struct oapvm_ctx {
58     u32       magic; // magic code
59     oapv_md_t md_arr[OAPV_MAX_NUM_METAS];
60     int       group_ids[OAPV_MAX_NUM_METAS];
61     int       num;
62 };
63 
64 /* Filler metadata */
65 typedef struct oapv_md_fm oapv_md_fm_t;
66 struct oapv_md_fm {
67     u8 *ff_byte; /* f(8) */
68 };
69 
70 /* Recommendation ITU-T T.35 metadata*/
71 typedef struct oapv_md_t35 oapv_md_t35_t;
72 struct oapv_md_t35 {
73     u32 itu_t_t35_country_code;           /* b(8) */
74     u32 itu_t_t35_country_code_extension; /* b(8) */
75     u8 *itu_t_t35_payload;
76 };
77 
78 /* Mastering display colour volum metadata*/
79 typedef struct oapv_md_mdcv oapv_md_mdcv_t;
80 struct oapv_md_mdcv {
81     u16 primary_chromaticity_x[3];  /* u(16) */
82     u16 primary_chromaticity_y[3];  /* u(16) */
83     u16 white_point_chromaticity_x; /* u(16) */
84     u16 white_point_chromaticity_y; /* u(16) */
85     u32 max_mastering_luminance;    /* u(32) */
86     u32 min_mastering_luminance;    /* u(32) */
87 };
88 
89 /* Content light level information*/
90 typedef struct oapv_md_cll oapv_md_cll_t;
91 struct oapv_md_cll {
92     u16 max_cll;  /* u(16) */
93     u16 max_fall; /* u(16) */
94 };
95 
96 /* User defined metadata */
97 typedef struct oapv_md_usd oapv_md_usd_t;
98 struct oapv_md_usd {
99     u8  uuid[16]; /* u(128) */
100     u8 *user_defined_data_payload;
101 };
102 
103 /* Undefined metadata */
104 typedef struct oapv_md_ud oapv_md_ud_t;
105 struct oapv_md_ud {
106     u8 *undefined_data_payload;
107 };
108 
109 #endif /* _OAPV_METADATA_H_ */