4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Haejeong Kim <backto.kim@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #ifndef _MMFILE_FORMATS_H_
23 #define _MMFILE_FORMATS_H_
32 #define MMFILE_VIDEO_STREAM 0
33 #define MMFILE_AUDIO_STREAM 1
35 #define MMFILE_FORMAT_SUCCESS 1
36 #define MMFILE_FORMAT_FAIL 0
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); \
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); \
54 MM_FILE_SRC_TYPE_FILE,
55 MM_FILE_SRC_TYPE_MEMORY,
58 typedef struct _mm_file_source {
67 int format; /* _mmfileformats */
73 typedef struct _mmfilesteam {
87 typedef struct _mmfileformatframe {
88 unsigned char bCompressed;
89 unsigned int frameSize;
90 unsigned int frameWidth;
91 unsigned int frameHeight;
92 unsigned int configLenth;
93 unsigned char *frameData;
95 unsigned int timestamp;
96 unsigned int frameNumber;
100 typedef struct _MMFileFormatContext MMFileFormatContext;
102 struct _MMFileFormatContext {
105 int commandType; /* TAG or CONTENTS */
106 int pre_checked; /*filefomat already detected.*/
108 MMFileSourceType *filesrc; /*ref only*/
111 /* contents information */
112 int duration; /* milliseconds */
114 int videoTotalTrackNum;
115 int audioTotalTrackNum;
119 MMFileFormatStream *streams[MAXSTREAMS];
122 MMFileFormatFrame *thumbNail;
135 char *classification;
143 unsigned char *artwork;
157 char *stitchingSoftware;
158 char *projectionType;
167 int croppedAreaImageWidth;
168 int croppedAreaImageHeight;
171 MMFILE_AMBISONIC_TYPE ambisonicType;
172 MMFILE_AMBISONIC_FORMAT ambisonicFormat;
173 MMFILE_AMBISONIC_ORDER ambisonicOrder;
174 unsigned stereoModeV2;
175 char *metadataSourceV2;
178 unsigned posePitchV2;
180 unsigned cbmpLayoutV2;
181 unsigned cbmpPaddingV2;
182 unsigned equiBoundsTopV2;
183 unsigned equiBoundsBottomV2;
184 unsigned equiBoundsLeftV2;
185 unsigned equiBoundsRightV2;
188 void *privateFormatData;
189 void *privateCodecData;
191 /* function pointer */
192 int (*ReadStream)(MMFileFormatContext *);
193 int (*ReadFrame)(MMFileFormatContext *, unsigned int, MMFileFormatFrame *);
194 int (*ReadTag)(MMFileFormatContext *);
195 int (*Close)(MMFileFormatContext *);
198 #ifndef __MMFILE_DYN_LOADING__
199 int mmfile_format_open(MMFileFormatContext **formatContext, MMFileSourceType *fileSrc);
200 int mmfile_format_read_stream(MMFileFormatContext *formatContext);
201 int mmfile_format_read_frame(MMFileFormatContext *formatContext, unsigned int timestamp, MMFileFormatFrame *frame);
202 int mmfile_format_read_tag(MMFileFormatContext *formatContext);
203 int mmfile_format_close(MMFileFormatContext *formatContext);
210 #endif /* _MMFILE_FORMATS_H_ */