1+ /*
2+ * BSD 3-Clause License
3+ *
4+ * Copyright (c) 2017-2019, Dolby Laboratories
5+ * All rights reserved.
6+ *
7+ * Redistribution and use in source and binary forms, with or without
8+ * modification, are permitted provided that the following conditions are met:
9+ *
10+ * * Redistributions of source code must retain the above copyright notice, this
11+ * list of conditions and the following disclaimer.
12+ *
13+ * * Redistributions in binary form must reproduce the above copyright notice,
14+ * this list of conditions and the following disclaimer in the documentation
15+ * and/or other materials provided with the distribution.
16+ *
17+ * * Neither the name of the copyright holder nor the names of its
18+ * contributors may be used to endorse or promote products derived from
19+ * this software without specific prior written permission.
20+ *
21+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+ */
32+
33+ #ifndef __DEE_PLUGINS_IMG_TRANSFORMER_API_H__
34+ #define __DEE_PLUGINS_IMG_TRANSFORMER_API_H__
35+
36+ #include " plugins_common.h"
37+ #include < cstdint>
38+ #define IMG_TRANSFORMER_API_VERSION 1
39+
40+ #ifdef __cplusplus
41+ extern " C" {
42+ #endif
43+
44+ typedef enum {
45+ PLANAR = 0 ,
46+ INTERLEAVED
47+ }ImgTransformerArrangement;
48+
49+ typedef enum {
50+ FORMAT_UNKNOWN = 0 ,
51+ FORMAT_RAW ,
52+ FORMAT_JPEG2000 ,
53+ FORMAT_PRORES ,
54+ FORMAT_TIFF ,
55+ }ImgTransformerFormat;
56+
57+ typedef enum {
58+ CODEC_UNSPECIFIED = 0 ,
59+ CODEC_JPEG2000 ,
60+ CODEC_PRORES_APCH ,
61+ CODEC_PRORES_APCN ,
62+ CODEC_PRORES_APCS ,
63+ CODEC_PRORES_APCO ,
64+ CODEC_PRORES_AP4H ,
65+ CODEC_PRORES_AP4X ,
66+ CODEC_TIFF ,
67+ CODEC_NONE ,
68+ }ImgTransformerCodec;
69+
70+ typedef enum {
71+ CHROMA_UNKNOWN = 0 ,
72+ CHROMA_ACES , /* *< Academy Color Encoding Space primaries */
73+ CHROMA_DCI , /* *< DCI P3 primaries with 0.314, 0.351 white */
74+ CHROMA_P3D65 , /* *< Standard Pulsar display space */
75+ CHROMA_REC709 , /* *< RGB, primaries / white per Rec. 709 */
76+ CHROMA_REC2020 /* *< RGB, primaries / white per Rec. 2020 */
77+ }ImgTransformerChroma;
78+
79+ typedef enum {
80+ COLOR_SPACE_UNKNOWN = 0 ,
81+ COLOR_SPACE_RGB , /* *< RGB */
82+ COLOR_SPACE_REC709_YUV , /* *< Y'U'V' per Rec. 709 */
83+ COLOR_SPACE_REC2020_YUV , /* *< Y'U'V' per Rec. 2020 */
84+ COLOR_SPACE_IPTc2 /* *< Proposed mobile representation */
85+ }ImgTransformerColorspace;
86+
87+ typedef enum {
88+ EOTF_UNKNOWN = 0 ,
89+ EOTF_PQ , /* *< PQ encoding */
90+ EOTF_BT1886 , /* *< Rec. BT1886 gamma */
91+ EOTF_REC709 , /* *< Rec. 709 gamma with linear section at bottom */
92+ EOTF_HLG ,
93+ }ImgTransformerEotf;
94+
95+ typedef enum {
96+ RANGE_UNKNOWN = 0 ,
97+ RANGE_COMPUTER , /* *< Computer or full range, 0 thru (2^bits - 1)) */
98+ RANGE_SDI , /* *< SMPTE SDI valid range (16 thru (2^bits - 17)) */
99+ RANGE_LEGAL /* *< SMPTE SDI valid range, scale = 2^(bits - 8), 16*scale thru 235*scale for luma / 240*scale for chroma */
100+ }ImgTransformerRange;
101+
102+ typedef enum {
103+ BIT_DEPTH_UNKNOWN = 0 ,
104+ BIT_DEPTH_UINT8 , /* *< 8 bits per color */
105+ BIT_DEPTH_UINT10_LSB , /* *< 10 lower bits of 16 (0 - 1023) */
106+ BIT_DEPTH_UINT12_LSB , /* *< 12 lower bits of 16 (0 - 4095) */
107+ BIT_DEPTH_UINT14_LSB , /* *< 14 lower bits of 16 (0 - 16383) */
108+ BIT_DEPTH_UINT16 /* *< 16 bits per color */
109+ }ImgTransformerBitdepth;
110+
111+ typedef enum {
112+ SUBSAMPLING_S444 = 0 ,
113+ SUBSAMPLING_S422 ,
114+ SUBSAMPLING_S420 ,
115+ }ImgTransformerSubsampling;
116+
117+ typedef struct {
118+ int64_t numerator;
119+ int64_t denominator;
120+ }ImgTransformerPts;
121+
122+ typedef struct {
123+ int64_t top;
124+ int64_t bottom;
125+ int64_t left;
126+ int64_t right;
127+ } ImgTransformerLetterbox;
128+
129+ typedef struct {
130+ double cfr;
131+ int64_t start;
132+ int64_t duration;
133+ int64_t preroll;
134+ int64_t postroll;
135+ }ImgTransformerProgram;
136+
137+ typedef struct {
138+ uint8_t * buffer;
139+ // int64_t bufferSize;
140+ int64_t size;
141+ } ImgTransformerData;
142+
143+ typedef struct {
144+ char * metadataFilename;
145+ int64_t metadataPosition;
146+ ImgTransformerFormat format;
147+ ImgTransformerCodec codec;
148+ ImgTransformerProgram program;
149+ int64_t width;
150+ int64_t height;
151+ ImgTransformerSubsampling subsampling;
152+ ImgTransformerBitdepth bitdepth;
153+ ImgTransformerChroma chroma;
154+ ImgTransformerColorspace colorspace;
155+ ImgTransformerEotf eotf;
156+ ImgTransformerRange range;
157+ ImgTransformerLetterbox letterbox;
158+ ImgTransformerPts pts;
159+ ImgTransformerArrangement arrangement;
160+ } ImgTransformerMetadata;
161+
162+ typedef struct {
163+ ImgTransformerMetadata metadata;
164+ ImgTransformerData data;
165+ } ImgTransformerFrame;
166+
167+ typedef struct {
168+ const Property* properties;
169+ size_t count;
170+ } ImgTransformerInitParams;
171+
172+ typedef void * ImgTransformerHandle;
173+
174+ typedef size_t (*ImgTransformerGetInfo)(const PropertyInfo** info);
175+
176+ typedef size_t (*ImgTransformerGetSize)();
177+
178+ typedef Status (*ImgTransformerInit)(ImgTransformerHandle handle, const ImgTransformerInitParams* initParams);
179+
180+ typedef Status (*ImgTransformerClose)(ImgTransformerHandle handle);
181+
182+ typedef Status (*ImgTransformerProcess) (ImgTransformerHandle handle, ImgTransformerFrame* inFrame);
183+
184+ typedef const char * (*ImgTransformerGetMessage)(ImgTransformerHandle handle);
185+
186+ typedef struct {
187+ const char * pluginName;
188+ ImgTransformerGetInfo getInfo;
189+ ImgTransformerGetSize getSize;
190+ ImgTransformerInit init;
191+ ImgTransformerClose close;
192+ ImgTransformerProcess process;
193+ ImgTransformerGetMessage getMessage;
194+ } ImgTransformerApi;
195+
196+ DLB_EXPORT
197+ ImgTransformerApi* imgTransformerGetApi ();
198+
199+ typedef ImgTransformerApi* (*ImgTransformerGetApi)();
200+
201+ DLB_EXPORT
202+ int imgTransformerGetApiVersion (void );
203+
204+ typedef int (*ImgTransformerGetApiVersion)(void );
205+
206+ #ifdef __cplusplus
207+ }
208+ #endif
209+
210+ #endif // __DLB_PLUGINS_MP4_MUX_API_H__
0 commit comments