Version up(0.6.92 -> 0.6.93)
[platform/core/multimedia/libmm-fileinfo.git] / include / mm_file_formats.h
1 /*
2  * libmm-fileinfo
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Haejeong Kim <backto.kim@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef _MMFILE_FORMATS_H_
23 #define _MMFILE_FORMATS_H_
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 #include <glib.h>
29 #include "mm_file.h"
30
31 #define MAXSTREAMS              20
32 #define MMFILE_VIDEO_STREAM     0
33 #define MMFILE_AUDIO_STREAM     1
34
35 #define MMFILE_FORMAT_SUCCESS   1
36 #define MMFILE_FORMAT_FAIL      0
37
38
39 #define MM_FILE_SET_MEDIA_FILE_SRC(Media, Filename)             do { \
40                 (Media).type = MM_FILE_SRC_TYPE_FILE; \
41                 (Media).file.path = ((strstr(Filename, "file://") != NULL) ? Filename+7 : Filename); \
42         } while (0);
43
44 #define MM_FILE_SET_MEDIA_MEM_SRC(Media, Memory, Size, Format)          do { \
45                 (Media).type = MM_FILE_SRC_TYPE_MEMORY; \
46                 (Media).memory.ptr = (Memory); \
47                 (Media).memory.size = (Size); \
48                 (Media).memory.format = (Format); \
49         } while (0);
50
51
52
53 enum {
54         MM_FILE_SRC_TYPE_FILE,
55         MM_FILE_SRC_TYPE_MEMORY,
56 };
57
58 typedef struct _mm_file_source {
59         int             type;
60         union {
61                 struct {
62                         const char *path;
63                 } file;
64                 struct {
65                         const void *ptr;
66                         unsigned int size;
67                         int format;     /* _mmfileformats */
68                 } memory;
69         };
70 } MMFileSourceType;
71
72
73 typedef struct _mmfilesteam {
74         int     streamType;
75         int     codecId;
76         int     version;
77         int     bitRate;
78         int     framePerSec;
79         int     width;
80         int     height;
81         int     nbChannel;
82         int     samplePerSec;
83         int     bitPerSample;
84         bool is_uhqa;
85 } MMFileFormatStream;
86
87 typedef struct _mmfileformatframe {
88         unsigned int    frameSize;
89         unsigned int    frameWidth;
90         unsigned int    frameHeight;
91         unsigned int    configLenth;
92         unsigned char   *frameData;
93         void                    *configData;
94         unsigned int    timestamp;
95         unsigned int    frameNumber;
96 } MMFileFormatFrame;
97
98
99 typedef struct _MMFileFormatContext MMFileFormatContext;
100
101 struct _MMFileFormatContext {
102         int notsupport;
103         int formatType;
104         int commandType;        /* TAG or CONTENTS */
105
106         MMFileSourceType *filesrc;      /*ref only*/
107         char *uriFileName;
108
109         /* contents information */
110         int duration;   /* milliseconds */
111         int isseekable;
112         int videoTotalTrackNum;
113         int audioTotalTrackNum;
114         int nbStreams;
115         int audioStreamId;
116         int videoStreamId;
117         MMFileFormatStream *streams[MAXSTREAMS];
118
119         /* thumbnail info */
120         MMFileFormatFrame *thumbNail;
121
122         /* tag info */
123         char *title;
124         char *artist;
125         char *author;
126         char *composer;
127         char *album;
128         char *album_artist;
129         char *copyright;
130         char *description;
131         char *comment;
132         char *genre;
133         char *classification;
134         char *year;
135         char *recDate;
136         char *part_of_set;
137         char *tagTrackNum;
138         char *rating;
139         int artworkSize;
140         char *artworkMime;
141         unsigned char *artwork;
142         float  longitude;
143         float  latitude;
144         float  altitude;
145
146         char *conductor;
147         char *unsyncLyrics;
148         char *rotate;
149         GList *syncLyrics;
150         int syncLyricsNum;
151         int cdis;
152         int smta;
153         int isSpherical;
154         int isStitched;
155         char *stitchingSoftware;
156         char *projectionType;
157         char *stereoMode;
158         int sourceCount;
159         int initViewHeading;
160         int initViewPitch;
161         int initViewRoll;
162         int timestamp;
163         int fullPanoWidth;
164         int fullPanoHeight;
165         int croppedAreaImageWidth;
166         int croppedAreaImageHeight;
167         int croppedAreaLeft;
168         int croppedAreaTop;
169         MMFILE_AMBISONIC_TYPE ambisonicType;
170         MMFILE_AMBISONIC_FORMAT ambisonicFormat;
171         MMFILE_AMBISONIC_ORDER ambisonicOrder;
172         unsigned stereoModeV2;
173         char *metadataSourceV2;
174         unsigned projTypeV2;
175         unsigned poseYawV2;
176         unsigned posePitchV2;
177         unsigned poseRollV2;
178         unsigned cbmpLayoutV2;
179         unsigned cbmpPaddingV2;
180         unsigned equiBoundsTopV2;
181         unsigned equiBoundsBottomV2;
182         unsigned equiBoundsLeftV2;
183         unsigned equiBoundsRightV2;
184
185         /* private data */
186         void *privateFormatData;
187         void *privateCodecData;
188
189         /* function pointer */
190         int (*ReadStream)(MMFileFormatContext *);
191         int (*ReadFrame)(MMFileFormatContext *, unsigned int, MMFileFormatFrame *);
192         int (*ReadTag)(MMFileFormatContext *);
193         int (*Close)(MMFileFormatContext *);
194 };
195
196 #ifndef __MMFILE_DYN_LOADING__
197 int mmfile_format_open(MMFileFormatContext **formatContext, MMFileSourceType *fileSrc);
198 int mmfile_format_read_stream(MMFileFormatContext *formatContext);
199 int mmfile_format_read_frame(MMFileFormatContext *formatContext, unsigned int timestamp, MMFileFormatFrame *frame);
200 int mmfile_format_read_tag(MMFileFormatContext *formatContext);
201 int mmfile_format_close(MMFileFormatContext *formatContext);
202 #endif
203
204 #ifdef __cplusplus
205 }
206 #endif
207
208 #endif /* _MMFILE_FORMATS_H_ */
209