4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, 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.
24 #ifndef _MEDIA_INFO_H_
25 #define _MEDIA_INFO_H_
27 #include "media-info-types.h"
28 #include "media-info-error.h"
38 @defgroup MEDIA_INFO Media Information Service
41 * @brief This file defines API's for media information service.
46 @defgroup MP_DB_API Database Manager API
50 manage the service database.
56 * Open media information service library. This is the function that an user who wants to use media information service calls first.
57 * This function connects to the media database.
59 * @return This function returns zero(MEDIA_INFO_ERROR_NONE) on success, or negative value with error code.
60 * Please refer 'media-info-error.h' to know the exact meaning of the error.
61 * @see mediainfo_close
63 * @post call mediainfo_close() to close the media database
64 * @remark The database name is "/opt/dbspace/.media.db".
68 #include <media-info.h>
72 int ret = MEDIA_INFO_ERROR_NONE;
73 // open media database
74 ret = mediainfo_open();
78 printf( "Cannot open media db. error code->%d", ret);
87 int mediainfo_open(void);
91 * Open media information service library. This is the function that an user who wants to finalize media information service calls before closing the application.
92 * This function disconnects to the media database.
94 * @return This function returns zero(MEDIA_INFO_ERROR_NONE) on success, or negative value with error code.
95 * Please refer 'media-info-error.h' to know the exact meaning of the error.
98 * @post call mediainfo_open() to open the media database
99 * @remark The database name is "/opt/dbspace/.media.db".
103 #include <media-info.h>
105 void close_media_db()
107 int ret = MEDIA_INFO_ERROR_NONE;
108 // close media database
109 ret = mediainfo_close();
113 printf( "Cannot close media db. error code->%d", ret);
122 int mediainfo_close(void);
125 * mediainfo_connect_db_with_handle:
126 * Connect to the media database. This is the function that an user who wants to get a handle to access the media database.
127 * This function connects to the media database.
129 * @param db_handle [out] Handle to access database using sqlite3 libs
130 * @return This function returns zero(MEDIA_INFO_ERROR_NONE) on success, or negative value with error code.
131 * Please refer 'media-info-error.h' to know the exact meaning of the error.
132 * @see mediainfo_disconnect_db_with_handle
134 * @post call mediainfo_connect_db_with_handle to connect to the media database
135 * @remark The database name is "/opt/dbspace/.media.db".
139 #include <media-info.h>
141 void connect_media_db()
143 int ret = MEDIA_INFO_ERROR_NONE;
144 sqlite3* my_handle = NULL;
146 // connect to the media database
147 ret = mediainfo_connect_db_with_handle(&my_handle);
151 printf("Fatal error to connect DB\n");
160 int mediainfo_connect_db_with_handle(sqlite3** db_handle);
164 * mediainfo_disconnect_db_with_handle:
165 * Disconnect to the media database. This is the function that an user who wants to disconnect the media database.
166 * This function disconnects to the media database.
168 * @param db_handle [out] Handle to access database using sqlite3 libs
169 * @return This function returns zero(MEDIA_INFO_ERROR_NONE) on success, or negative value with error code.
170 * Please refer 'media-info-error.h' to know the exact meaning of the error.
171 * @see mediainfo_connect_db_with_handle
173 * @post call mediainfo_disconnect_db_with_handle to disconnect to the media database
174 * @remark The database name is "/opt/dbspace/.media.db".
178 #include <media-info.h>
180 void disconnect_media_db()
182 int ret = MEDIA_INFO_ERROR_NONE;
183 sqlite3* my_handle = NULL;
185 // connect to the media database
186 ret = mediainfo_connect_db_with_handle(&my_handle);
190 printf("Fatal error to connect DB\n");
195 // Do something using my_handle
199 ret = mediainfo_disconnect_db_with_handle(my_handle);
202 printf("Fatal error to disconnect DB\n");
210 int mediainfo_disconnect_db_with_handle(sqlite3* db_handle);
213 * mediainfo_register_file:
214 * This function registers multimedia file to media DB
215 * When you did some file operations such as Create, Copy, Move, Rename, and Delete in phone or mmc storage, media-server registers the result to database automatically by inotify mechanism.
216 * However, automatic registration will have a little delay because the method is asynchronous.
217 * If you want to register some files to database immediately, you should use this API.
219 * @param file_full_path [in] full path of file for register
220 * @return This function returns zero(MEDIA_INFO_ERROR_NONE) on success, or negative value with error code.
221 * Please refer 'media-info-error.h' to know the exact meaning of the error.
225 * @remark The database name is "/opt/dbspace/.media.db".
226 * You have to use this API only for registering multimedia files. If you try to register no multimedia file, this API returns error.
230 #include <media-info.h>
236 result = mediainfo_register_file("/opt/media/test.txt");
239 printf("FAIL to mediainfo_register_file\n");
244 printf("SUCCESS to register file\n");
252 DEPRECATED_API int mediainfo_register_file(const char *file_full_path);
254 typedef GArray* minfo_list;
256 DEPRECATED_API int mediainfo_list_new(minfo_list *list);
258 DEPRECATED_API int mediainfo_list_add(minfo_list list, const char* file_full_path);
260 DEPRECATED_API int mediainfo_list_free(minfo_list list);
262 DEPRECATED_API int mediainfo_register_files(const minfo_list list);
275 #endif /*_MEDIA_INFO_H_*/