Tizen 2.1 base
[platform/core/api/media-content.git] / src / media_util_private.c
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 #include <string.h>
19 #include <sys/stat.h>
20 #include <media_util_private.h>
21 #include <media_info_private.h>
22 #include <media_content_type.h>
23
24
25 int _media_util_get_store_type_by_path(const char *path, int *storage_type)
26 {
27         if(STRING_VALID(path))
28         {
29                 if(strncmp(path, MEDIA_CONTENT_PATH_PHONE, strlen(MEDIA_CONTENT_PATH_PHONE)) == 0)
30                 {
31                         *storage_type = MEDIA_CONTENT_STORAGE_INTERNAL;
32                 }
33                 else if(strncmp (path, MEDIA_CONTENT_PATH_MMC, strlen(MEDIA_CONTENT_PATH_MMC)) == 0)
34                 {
35                         *storage_type = MEDIA_CONTENT_STORAGE_EXTERNAL;
36                 }
37         }
38         else
39         {
40                 media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
41                 return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
42         }
43
44         return MEDIA_CONTENT_ERROR_NONE;
45 }