Extract spherical video and spatial audio metadata and send it to the bus
[platform/upstream/gst-plugins-good.git] / gst / isomp4 / qtdemux_types.h
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  * Copyright (C) <2009> STEricsson <benjamin.gaignard@stericsson.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef __GST_QTDEMUX_TYPES_H__
22 #define __GST_QTDEMUX_TYPES_H__
23
24 #include <gst/gst.h>
25 #include <gst/base/gstbytereader.h>
26
27 #include "qtdemux.h"
28
29 G_BEGIN_DECLS
30
31 typedef gboolean (*QtDumpFunc) (GstQTDemux * qtdemux, GstByteReader * data,
32     int depth);
33
34 typedef struct _QtNodeType QtNodeType;
35
36 #define QT_UINT32(a)  (GST_READ_UINT32_BE(a))
37 #define QT_UINT24(a)  (GST_READ_UINT32_BE(a) >> 8)
38 #define QT_UINT16(a)  (GST_READ_UINT16_BE(a))
39 #define QT_UINT8(a)   (GST_READ_UINT8(a))
40 #define QT_FP32(a)    ((GST_READ_UINT32_BE(a))/65536.0)
41 #define QT_SFP32(a)   (((gint)(GST_READ_UINT32_BE(a)))/65536.0)
42 #define QT_FP16(a)    ((GST_READ_UINT16_BE(a))/256.0)
43 #define QT_FOURCC(a)  (GST_READ_UINT32_LE(a))
44 #define QT_UINT64(a)  ((((guint64)QT_UINT32(a))<<32)|QT_UINT32(((guint8 *)a)+4))
45
46 #ifdef TIZEN_FEATURE_QTDEMUX_MODIFICATION
47 #define RFC_AMBISONIC_SA3DBOX_VERSION_SUPPORTED 0
48 #define RFC_AMBISONIC_TYPE_PERIPHONIC 0
49 #define RFC_AMBISONIC_ORDER_FOA 1
50 #define RFC_AMBISONIC_CHANNEL_ORDERING_ACN 0
51 #define RFC_AMBISONIC_CHANNEL_ORDERING_FUMA 1   /* FIXME: Currently value is not defined in Spatial Audio RFC */
52 #define RFC_AMBISONIC_NORMALIZATION_SN3D 0
53 #define RFC_AMBISONIC_NORMALIZATION_FUMA 1              /* FIXME: Currently value is not defined in Spatial Audio RFC */
54 #endif /* TIZEN_FEATURE_QTDEMUX_MODIFICATION */
55
56 typedef enum {
57   QT_FLAG_NONE      = (0),
58   QT_FLAG_CONTAINER = (1 << 0)
59 } QtFlags;
60
61 struct _QtNodeType {
62   guint32      fourcc;
63   const gchar *name;
64   QtFlags      flags;
65   QtDumpFunc   dump;
66 };
67
68 enum TfFlags
69 {
70   TF_BASE_DATA_OFFSET         = 0x000001,   /* base-data-offset-present */
71   TF_SAMPLE_DESCRIPTION_INDEX = 0x000002,   /* sample-description-index-present */
72   TF_DEFAULT_SAMPLE_DURATION  = 0x000008,   /* default-sample-duration-present */
73   TF_DEFAULT_SAMPLE_SIZE      = 0x000010,   /* default-sample-size-present */
74   TF_DEFAULT_SAMPLE_FLAGS     = 0x000020,   /* default-sample-flags-present */
75   TF_DURATION_IS_EMPTY        = 0x010000,   /* duration-is-empty */
76   TF_DEFAULT_BASE_IS_MOOF     = 0x020000    /* default-base-is-moof */
77 };
78
79 enum TrFlags
80 {
81   TR_DATA_OFFSET              = 0x000001,   /* data-offset-present */
82   TR_FIRST_SAMPLE_FLAGS       = 0x000004,   /* first-sample-flags-present */
83   TR_SAMPLE_DURATION          = 0x000100,   /* sample-duration-present */
84   TR_SAMPLE_SIZE              = 0x000200,   /* sample-size-present */
85   TR_SAMPLE_FLAGS             = 0x000400,   /* sample-flags-present */
86   TR_COMPOSITION_TIME_OFFSETS = 0x000800    /* sample-composition-time-offsets-presents */
87 };
88
89 #ifdef TIZEN_FEATURE_QTDEMUX_MODIFICATION
90 typedef enum
91 {
92   QTDEMUX_AMBISONIC_TYPE_UNKNOWN = 0,
93   QTDEMUX_AMBISONIC_TYPE_PERIPHONIC = 1,            /* To comply with Google's Spatial Audio RFC */
94   QTDEMUX_AMBISONIC_TYPE_NON_PERIPHONIC = 2,
95 } QTDEMUX_AMBISONIC_TYPE;
96
97 typedef enum
98 {
99   QTDEMUX_AMBISONIC_FORMAT_UNKNOWN = 0,
100   QTDEMUX_AMBISONIC_FORMAT_AMBIX = 1,               /* AMBIX (Channel sequence: ACN, Normalization: SN3D) */
101   QTDEMUX_AMBISONIC_FORMAT_AMB = 2,                 /* .AMB, Tetraproc (Channel sequence: FuMa, Normalization: FuMa) */
102   QTDEMUX_AMBISONIC_FORMAT_UA = 3,                  /* Universal Ambisonics (Channel sequence: SID, Normalization: N3D) */
103 } QTDEMUX_AMBISONIC_FORMAT;
104
105 typedef enum
106 {
107   QTDEMUX_AMBISONIC_ORDER_UNKNOWN = 0,
108   QTDEMUX_AMBISONIC_ORDER_FOA = 1,                  /* First order Ambisonics */
109   QTDEMUX_AMBISONIC_ORDER_TOA = 3,                  /* Third order Ambisonics */
110   QTDEMUX_AMBISONIC_ORDER_HOA,                      /* Higher order Ambisonics */
111 } QTDEMUX_AMBISONIC_ORDER;
112
113 typedef enum
114 {
115   QTDEMUX_AMBISONIC_CHANNEL_ORDERING_UNKNOWN = 0,
116   QTDEMUX_AMBISONIC_CHANNEL_ORDERING_ACN = 1,       /* Ambisonic Channel Number (ACN) system */
117   QTDEMUX_AMBISONIC_CHANNEL_ORDERING_FUMA = 2,      /* Furse-Malham ordering */
118   QTDEMUX_AMBISONIC_CHANNEL_ORDERING_SID = 3,       /* Single Index Designation ordering */
119 } QTDEMUX_AMBISONIC_CHANNEL_ORDERING;
120
121 typedef enum
122 {
123   QTDEMUX_AMBISONIC_NORMALIZATION_UNKNOWN = 0,
124   QTDEMUX_AMBISONIC_NORMALIZATION_SN3D = 1,         /* Schmidt semi-normalization */
125   QTDEMUX_AMBISONIC_NORMALIZATION_FUMA = 2,         /* Furse-Malham MaxN normalization */
126   QTDEMUX_AMBISONIC_NORMALIZATION_N3D = 3,          /* Full 3D normalization */
127 } QTDEMUX_AMBISONIC_NORMALIZATION;
128 #endif /* TIZEN_FEATURE_QTDEMUX_MODIFICATION */
129
130 const QtNodeType *qtdemux_type_get (guint32 fourcc);
131
132 G_END_DECLS
133
134 #endif /* __GST_QTDEMUX_TYPES_H__ */