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_
31 #define MMFILE_VIDEO_STREAM 0
32 #define MMFILE_AUDIO_STREAM 1
34 #define MMFILE_FORMAT_SUCCESS 1
35 #define MMFILE_FORMAT_FAIL 0
38 #define MM_FILE_SET_MEDIA_FILE_SRC(Media, Filename) do { \
39 (Media).type = MM_FILE_SRC_TYPE_FILE; \
40 (Media).file.path = ((strstr(Filename, "file://")!=NULL) ? Filename+7:Filename); \
43 #define MM_FILE_SET_MEDIA_MEM_SRC(Media, Memory, Size, Format) do { \
44 (Media).type = MM_FILE_SRC_TYPE_MEMORY; \
45 (Media).memory.ptr = (Memory); \
46 (Media).memory.size = (Size); \
47 (Media).memory.format = (Format); \
53 MM_FILE_SRC_TYPE_FILE,
54 MM_FILE_SRC_TYPE_MEMORY,
58 MM_FILE_DRM_NONE = 0, /*not drm file*/
59 MM_FILE_DRM_OMA, /*oma drm*/
60 MM_FILE_DRM_DIVX, /*divx drm*/
61 MM_FILE_DRM_PROTECTED, /*This is drm file but not oma or divx*/
65 typedef struct _mm_file_source {
74 int format; /* _mmfileformats */
80 typedef struct _mmfilesteam {
94 typedef struct _mmfileformatframe {
95 unsigned char bCompressed;
96 unsigned int frameSize;
97 unsigned int frameWidth;
98 unsigned int frameHeight;
99 unsigned int configLenth;
100 unsigned char *frameData;
102 unsigned int timestamp;
103 unsigned int frameNumber;
107 typedef struct _MMFileFormatContext MMFileFormatContext;
109 struct _MMFileFormatContext {
112 int commandType; /* TAG or CONTENTS */
113 int pre_checked; /*filefomat already detected.*/
115 MMFileSourceType *filesrc; /*ref only*/
118 /* contents information */
119 int duration; /* milliseconds */
121 int isdrm; /*drm type. see MM_FILE_DRM_XXX*/
122 int videoTotalTrackNum;
123 int audioTotalTrackNum;
127 MMFileFormatStream *streams[MAXSTREAMS];
130 MMFileFormatFrame *thumbNail;
143 char *classification;
150 unsigned char *artwork;
164 void *privateFormatData;
165 void *privateCodecData;
167 /* function pointer */
168 int (*ReadStream)(MMFileFormatContext *);
169 int (*ReadFrame)(MMFileFormatContext *, unsigned int, MMFileFormatFrame *);
170 int (*ReadTag)(MMFileFormatContext *);
171 int (*Close)(MMFileFormatContext *);
174 #ifndef __MMFILE_DYN_LOADING__
175 int mmfile_format_open(MMFileFormatContext **formatContext, MMFileSourceType *fileSrc);
176 int mmfile_format_read_stream(MMFileFormatContext *formatContext);
177 int mmfile_format_read_frame(MMFileFormatContext *formatContext, unsigned int timestamp, MMFileFormatFrame *frame);
178 int mmfile_format_read_tag(MMFileFormatContext *formatContext);
179 int mmfile_format_close(MMFileFormatContext *formatContext);
186 #endif /* _MMFILE_FORMATS_H_ */