Rebase code with tizen 2.3 with following additional changes
[platform/core/multimedia/libmm-sound.git] / include / mm_source.h
1 /*
2  * libmm-sound
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungbae Shin <seungbae.shin@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 __MM_SOURCE_H__
23 #define __MM_SOURCE_H__
24
25 enum {
26     MM_SOURCE_NONE = 0,
27     MM_SOURCE_FILE,
28     MM_SOURCE_MEMORY,
29     MM_SOURCE_MEMORY_NOTALLOC,
30     MM_SOURCE_NUM,
31 };
32
33 enum {
34         MM_SOURCE_NOT_DRM_CONTENTS = 0,
35         MM_SOURCE_CHECK_DRM_CONTENTS
36 };
37
38 typedef struct {
39     int             type;           /**< source type (file or memory) */
40     void            *ptr;           /**< pointer to buffer */
41     unsigned int    cur_size;       /**< size of current memory */
42     unsigned int    tot_size;       /**< size of current memory */
43     int             fd;             /**< file descriptor for file */
44         unsigned int    medOffset;              /**Media Offset */
45 } MMSourceType;
46
47 #define MMSourceIsUnUsed(psource) \
48     ((psource)->type == MM_SOUND_SOURCE_NONE)
49
50 #define MMSourceIsFile(psource) \
51     ((psource)->type == MM_SOUND_SOURCE_FILE)
52
53 #define MMSourceIsMemory(psource) \
54     ((psource)->type == MM_SOUND_SOURCE_MEMORY)
55
56 #define MMSourceGetPtr(psource) \
57     ((psource)->ptr)
58
59 #define MMSourceGetCurSize(psource) \
60     ((psource)->cur_size)
61
62 #define MMSourceGetTotSize(psource) \
63     ((psource)->tot_size)
64
65 int mm_source_open_file(const char *filename, MMSourceType* source, int drmsupport);
66 int mm_source_open_full_memory(const void *ptr, int totsize, int alloc, MMSourceType *source);
67 int mm_source_open_memory(const void *ptr, int totsize, int size, MMSourceType *source);
68 int mm_source_append_memory(const void *ptr, int size, MMSourceType *source);
69 int mm_source_close(MMSourceType *source);
70
71 #endif  /* __MM_SOURCE_H__ */
72