2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
20 #ifndef _PLATFORM_MEDIA_CONTENT_MANAGER_H_
21 #define _PLATFORM_MEDIA_CONTENT_MANAGER_H_
25 #include <dpl/mutex.h>
26 #include "IContentManager.h"
29 #include "IEventGetDirectories.h"
30 #include "IEventUpdate.h"
31 #include "IEventUpdateBatch.h"
32 #include "ContentSearchVisitor.h"
34 #include "ContentImage.h"
35 #include "ContentVideo.h"
36 #include "ContentAudio.h"
37 #include "AudioLyrics.h"
39 #include <media_content.h>
40 #include <metadata_extractor.h>
43 #define TAG_DELIMETER '/' //After reviewing the ID3v2.3 spec the delimiter is a "/" for multiple entries.
48 class MediacontentManager : public IMediacontentManager
51 MediacontentManager();
52 virtual ~MediacontentManager();
54 static void readCommonDataFromMediaInfo(media_info_h info, MediacontentMedia* newMedia);
55 static void readImageFromMediaInfo( media_info_h info, MediacontentImage* newImage);
56 static void readVideoFromMediaInfo( media_info_h info, MediacontentVideo* newVideo);
57 static void readMusicFromMediaInfo( media_info_h info, MediacontentAudio* newAudio);
60 virtual void OnRequestReceived(const IEventFindFolderPtr &ptr);
61 virtual void OnRequestReceived(const IEventUpdateMediaPtr &ptr);
62 virtual void OnRequestReceived(const IEventBrowseFolderPtr &ptr);
63 virtual void OnRequestReceived(const IEventUpdateMediaItemsPtr &ptr);
66 static bool mediaFolderCallback(media_folder_h folder, void *user_data);
67 static bool mediaItemCallback(media_info_h info, void* user_data);
68 static void convertToPlatformFolder(media_folder_h media_folder, MediacontentFolderPtr& newFolder);
69 bool updateMediaToDB(MediacontentMediaPtr mediaPtr);
70 string makeQuerySortMode(SortModeArrayPtr attr, MediaSearchVisitor::QueryType value=MediaSearchVisitor::QUERY_FOLDER);
71 static tm* toDateTm(time_t date);
72 media_content_orientation_e convertToOrientation(string orientation);
75 static int m_instanceCount;
76 DPL::Mutex m_constructorMutex;
83 #endif /* _PLATFORM_MEDIA_CONTENT_MANAGER_H_ */