TARGET_LINK_LIBRARIES(${this_target} "-losp-locations")
TARGET_LINK_LIBRARIES(${this_target} "-lglib-2.0" )
TARGET_LINK_LIBRARIES(${this_target} "-lexif" )
-TARGET_LINK_LIBRARIES(${this_target} "-lmmffile" )
TARGET_LINK_LIBRARIES(${this_target} "-lcapi-content-media-content")
TARGET_LINK_LIBRARIES(${this_target} "-lcapi-media-metadata-extractor")
TARGET_LINK_LIBRARIES(${this_target} "-lcapi-content-mime-type")
Tizen::Base::String GetComment(void) const;
/**
+ * Gets the description of the audio file.
+ *
+ * @since 2.1
+ *
+ * @return The description of the audio file
+ */
+ Tizen::Base::String GetDescription(void) const;
+
+ /**
* Gets the track number of the audio file.
*
* @since 2.0
* @page CompContentInfoGetThumbnailNPage Compatibility for GetThumbnailN().
* @section CompContentInfoGetThumbnailNPageIssueSection Issue
* The thumbnail size of this method in OSP compatible applications has the following issues: @n
- * <DIV> The size is changed from 80x60 pixels to the size of image which is returned from the platform since %Tizen</DIV>
+ * <DIV> The size is changed from 80x60 pixels to the size of image which is returned from the platform since %Tizen API 2.1.</DIV>
*
* @endif
*/
class ContentInfo;
class _ContentManagerImpl;
-class _IContentScanListener;
+class IContentScanListener;
+class IContentUpdateEventListener;
/**
* @class ContentManager
* Creates the content information.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/content.write
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/content.write
*
* @return The content ID
* @param[in] contentInfo An instance of ContentInfo
* @compatibility This method has compatibility issues with OSP compatible applications. @n
* For more information, see @ref CompContentManagerCreateContentPage "here".
* @endif
- * @privilege %http://tizen.org/privilege/content.write
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/content.write
*
* @return The content ID
* @param[in] byteBuffer The @c byteBuffer of the content to create
* @compatibility This method has compatibility issues with OSP compatible applications. @n
* For more information, see @ref CompContentManagerCreateContentPage "here".
* @endif
- * @privilege %http://tizen.org/privilege/content.write
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/content.write
*
* @return The content ID
* @param[in] sourcePath The source file path
* @exception E_SYSTEM A system error has occurred.
* @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
* @exception E_SERVICE_BUSY The database is busy.
- * @remarks The source path should start with the directory path returned by either Tizen::System::Environment::GetAppRootPath() or Tizen::System::Environment::GetExternalStoragePath(). @n
+ * @remarks The source path should start with the directory path returned by either Tizen::App::App::GetAppRootPath() or Tizen::System::Environment::GetExternalStoragePath(). @n
* The destination path should start with the directory path returned by either Tizen::System::Environment::GetMediaPath() or Tizen::System::Environment::GetExternalStoragePath(). @n
* The specific error code can be accessed using the GetLastResult() method. @n
* For using CreateContent(), check @ref CreateContentUsage "here".
* Gets the content information.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/content.read
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/content.read
*
* @return A pointer to ContentInfo
* @param[in] contentId The content ID
* Updates the content information with the specified instance of ContentInfo.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/content.write
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/content.write
*
* @return An error code
* @param[in] contentInfo An instance of ContentInfo
* Deletes the content information with the specified content ID.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/content.write
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/content.write
*
* @return An error code
* @param[in] contentId The content ID
*/
result DeleteContent(const ContentId& contentId);
- /*
- * Requests to scan a file(for internal use)
+ /**
+ * Adds a listener to receive the database change notification
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] listener The event listener
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The listener has already been added.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ result AddContentUpdateEventListener(IContentUpdateEventListener& listener);
+
+ /**
+ * Removes a listener
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] listener The event listener
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The listener is not found.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ result RemoveContentUpdateEventListener(IContentUpdateEventListener& listener);
+
+
+ /**
+ * Requests to scan a file
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/content.write
+ *
+ * @return An error code
+ * @param[in] contentPath The content path
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
+ * @exception E_SERVICE_BUSY The database is busy.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
*/
- result ScanFile(const Tizen::Base::String& contentPath);
+ static result ScanFile(const Tizen::Base::String& contentPath);
- /*
- * Requests to scan directories(for internal use)
+ /**
+ * Requests to scan a directory
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/content.write
+ *
+ * @return An error code
+ * @param[in] directoryPath The directory path
+ * @param[in] recursive Set to @c true in order to scan recursively sub directories, @n
+ * else @c false
+ * @param[in] pListener The scan event listener
+ * @param[out] reqId The request ID
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
+ * @exception E_SERVICE_BUSY The database is busy.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remark Platform does not have the ownership of the listener.
*/
- result ScanDirectory(const Tizen::Base::String& directoryPath, bool recursive, _IContentScanListener& listener);
+ static result ScanDirectory(const Tizen::Base::String& directoryPath, bool recursive, IContentScanListener* pListener, RequestId& reqId);
private:
/**
{
public:
/**
- * Gets the metadata for an image.
+ * Gets the metadata of an image from the file.
*
* @if OSPCOMPAT
* @brief <i> [Compatibility] </i>
* @param[in] filePath The file path
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The specified input parameter is invalid.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
- * @remarks The supported formats are 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'wbmp', or 'tiff'. @n
- * The specific error code can be accessed using the GetLastResult() method.
+ * @remarks If the image data is valid but meta information does not exist, the width and height are set from actual image data.
+ * The specific error code can be accessed using the GetLastResult() method.
*/
static Tizen::Content::ImageMetadata* GetImageMetaN(const Tizen::Base::String& filePath);
/**
- * Gets the metadata for an audio.
+ * Gets the metadata of an image from the buffer.
+ *
+ * @since 2.1
+ *
+ * @return A pointer to ImageMetadata, @n
+ * else @c null if an exception occurs
+ * @param[in] byteBuffer The buffer that contains image data
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
+ * @remarks If the image data in the buffer is valid but meta information does not exist, the width and height are set from actual image data.
+ * The specific error code can be accessed using the GetLastResult() method.
+ */
+ static Tizen::Content::ImageMetadata* GetImageMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
+
+ /**
+ * Gets the metadata of an audio from the file.
*
* @if OSPCOMPAT
* @brief <i> [Compatibility] </i>
* @param[in] filePath The file path
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The specified input parameter is invalid.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
- * @remarks The supported formats are 'mp3', 'wav', 'aac', 'wma', 'm4a', 'xmf', '3ga', or 'mmf'. @n
- * The specific error code can be accessed using the GetLastResult() method.
+ * @remarks If the audio data is valid but meta information does not exist, the duration is set from actual audio data.
+ * The specific error code can be accessed using the GetLastResult() method.
*/
static Tizen::Content::AudioMetadata* GetAudioMetaN(const Tizen::Base::String& filePath);
/**
- * Gets the metadata for a video.
+ * Gets the metadata of an audio from the buffer.
+ *
+ * @since 2.1
+ *
+ * @return A pointer to AudioMetadata, @n
+ * else @c null if an exception occurs
+ * @param[in] byteBuffer The buffer that contains audio data
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
+ * @remarks If the audio data in the buffer is valid but meta information does not exist, the duration is set from actual audio data.
+ * The specific error code can be accessed using the GetLastResult() method.
+ */
+ static Tizen::Content::AudioMetadata* GetAudioMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
+
+ /**
+ * Gets the metadata of a video from the file.
*
* @if OSPCOMPAT
* @brief <i> [Compatibility] </i>
* @param[in] filePath The file path
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The specified input parameter is invalid.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
- * @remarks The supported formats are 'wmv', 'asf', 'mp4', '3gp', or 'avi'. @n
- * The specific error code can be accessed using the GetLastResult() method.
+ * @remarks If the video data is valid but meta information does not exist, the duration is set from actual video data.
+ * The specific error code can be accessed using the GetLastResult() method.
*/
static Tizen::Content::VideoMetadata* GetVideoMetaN(const Tizen::Base::String& filePath);
/**
+ * Gets the metadata of a video from the buffer.
+ *
+ * @since 2.1
+ *
+ * @return A pointer to VideoMetadata, @n
+ * else @c null if an exception occurs
+ * @param[in] byteBuffer The buffer that contains video data
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
+ * @remarks If the video data in the buffer is valid but meta information does not exist, the duration is set from actual video data.
+ * The specific error code can be accessed using the GetLastResult() method.
+ */
+ static Tizen::Content::VideoMetadata* GetVideoMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
+
+ /**
* Checks the content type from the file path.
*
* @if OSPCOMPAT
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The specified input parameter is invalid, or
* the length of the specified path is @c 0 or exceeds system limitations.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
* @exception E_FILE_NOT_FOUND The specified file cannot be found.
* @exception E_UNSUPPORTED_FORMAT The specified format is invalid or not supported.
* @remarks The content type can be different for each device. @n
* Searches the content and returns the search result list according to the query.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/content.read
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/content.read
*
* @return A pointer to a list containing the ContentSearchResult instances @n
* An empty list is returned if there is no result and there is no error, @n
* Gets the value list of the specified column within a specified range.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/content.read
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/content.read
*
* @return A pointer to a list containing the values of a column @n
* The type of value can be Tizen::Base::Float, Tizen::Base::Double, Tizen::Base::LongLong, Tizen::Base::DateTime, or Tizen::Base::String. @n
* @deprecated This method is deprecated. Instead of using this method, it is recommended to use the GetValueListN(int, int, int&, int&, const Tizen::Base::String&, @n
* Tizen::Base::SortOrder) method, that gets the value list of the specified column.
* @since 2.0
- * @privilege %http://tizen.org/privilege/content.read
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/content.read
*
* @return A pointer to a list containing the values of a column @n
* The type of value can be Tizen::Base::Integer, Tizen::Base::Double, Tizen::Base::LongLong, Tizen::Base::DateTime, or Tizen::Base::String. @n
* @deprecated This method is deprecated due to the operation policy of the Tizen Server.
* When downloading the contents from a third party server, it is recommended to use the Download(const Tizen::Base::Utility::Uri&, const Tizen::Base::String&, RequestId&, bool, int, int) method.
* @since 2.0
- * @privilege %http://tizen.org/privilege/download
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/download
*
* @return An error code
* @param[in] uri The content URL
* @compatibility This method has compatibility issues with OSP compatible applications. @n
* For more information, see @ref CompContentTransferDownloadPage3 "here".
* @endif
- * @privilege %http://tizen.org/privilege/download
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/download
*
* @return An error code
* @param[in] uri The content URL
* @deprecated This method is deprecated due to the operation policy of the Tizen Server.
* When downloading the contents to a buffer from a third party server, it is recommended to use the DownloadToBuffer(const Tizen::Base::Utility::Uri&, RequestId&, int, int) method.
* @since 2.0
- * @privilege %http://tizen.org/privilege/download
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/download
*
* @return An error code
* @param[in] uri The content URL
* @brief <i> [Deprecated] </i>
* @deprecated This class is deprecated. Instead of using this class, use DownloadManager class.
* @since 2.0
- * @privilege %http://tizen.org/privilege/download
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/download
*
* @return An error code
* @param[in] uri The content URL
* @return A pointer to the %DownloadManager instance, @n
* else @c null if it fails
* @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
* @exception E_SYSTEM The method cannot proceed due to a severe system error.
* @remarks The specific error code can be accessed using the GetLastResult() method.
*/
* If this operation succeeds, the IDownloadListener::OnDownloadInProgress() method is called. @n
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/download
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/download
*
* @return An error code
* @param[in] request The download request
* @exception E_INVALID_ARG The URL of the download request is invalid.
* @exception E_ILLEGAL_ACCESS Access to the path of the download request is denied due to insufficient permission.
* @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
* @exception E_SYSTEM The method cannot proceed due to a severe system error.
*/
result Start(const DownloadRequest& request, RequestId& reqId);
* @exception E_INVALID_ARG There is no download request for the specified @c reqId.
* @exception E_INVALID_OPERATION The current download state prohibits the execution of this operation. @n
* The download state of the request ID is not downloading.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
* @exception E_SYSTEM The method cannot proceed due to a severe system error.
*/
result Pause(RequestId reqId);
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG There is no download request for the specified @c reqId.
* @exception E_INVALID_OPERATION The current download state prohibits the execution of this operation. @n
- * The download operation of the request ID is not paused.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * The download state of the request ID is not paused or failed.
* @exception E_SYSTEM The method cannot proceed due to a severe system error.
*/
result Resume(RequestId reqId);
* @param[in] reqId The request ID returned by Start()
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG There is no download request for the specified @c reqId.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
* @exception E_SYSTEM The method cannot proceed due to a severe system error.
*/
result Cancel(RequestId reqId);
* @param[in] reqId The request ID returned by Start()
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG There is no download request for the specified @c reqId.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
* @remarks The specific error code can be accessed using the GetLastResult() method.
*/
DownloadRequest* GetDownloadRequestN(RequestId reqId) const;
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG There is no download request for the specified @c reqId.
* @exception E_INVALID_OPERATION The current download state prohibits the execution of this operation. @n
- * The download state of the request ID is not downloading or paused.
+ * The download operation is not started.
* @exception E_SYSTEM The method cannot proceed due to a severe system error.
*/
result GetMimeType(RequestId reqId, Tizen::Base::String& mimeType) const;
#include <FBaseResult.h>
#include <FBaseString.h>
+#include <FBaseColIMap.h>
+#include <FCntTypes.h>
namespace Tizen { namespace Content
{
*/
Tizen::Base::String GetFileName(void) const;
+ /**
+ * Sets to show the download notification by the system or not. @n
+ * If true, the system posts notifications about this download request through the Tizen::Shell::NotificationManager. @n
+ * By default, this value sets to true.
+ * @since 2.1
+ * @param[in] enable whether the system should show a notification for this download request
+ * @see Tizen::Shell::NotificationManager
+ */
+ void SetNotification(bool enable);
+
+ /**
+ * Sets the extra data which is delivered to the application when the notification message is selected. @n
+ * The extra data will be passed to the application through the
+ * Tizen::App::IAppControlProviderEventListener::OnAppControlRequestReceived().
+ * @since 2.1
+ * @return An error code
+ * @param[in] pExtraData A pointer to an argument map of the Tizen::Base::String key and Tizen::Base::String value pair
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG Either of the following conditions has occurred: @n
+ * - The argument is null. @n
+ * - The argument is not a map of Tizen::Base::String key and Tizen::Base::String value pair.
+ * @see Tizen::Shell::NotificationManager
+ * @see Tizen::App::IAppControlProviderEventListener::OnAppControlRequestReceived()
+ */
+ result SetNotificationExtraData(const Tizen::Base::Collection::IMap *pExtraData);
+
+ /**
+ * Sets the allowed network type. By default, all network types are allowed.
+ * @since 2.1
+ * @param[in] type The download network type
+ */
+ void SetNetworkType(DownloadNetworkType type);
+
+ /**
+ * Checks whether the system should show a notification for this download request.
+ * @since 2.1
+ * @return @c true if the system should show a notification for this download request, @n
+ * else @c false
+ */
+ bool IsNotificationEnabled(void) const;
+
+ /**
+ * Gets the extra data which is delivered to the application when the notification message is seleted.
+ * @since 2.1
+ * @return The extra data map which consists of the Tizen::Base::String key and Tizen::Base::String value pair
+ */
+ const Tizen::Base::Collection::IMap* GetNotificationExtraData(void) const;
+
+ /**
+ * Gets the allowed network type.
+ * @since 2.1
+ * @return network type
+ */
+ DownloadNetworkType GetNetworkType(void) const;
+
+ /**
+ * Adds an HTTP header field.
+ * @since 2.1
+ * @return An error code
+ * @param[in] field The HTTP header field
+ * @param[in] value The value of the header field
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The field is empty or already exist.
+ */
+ result AddRequestHeader(const Tizen::Base::String& field, const Tizen::Base::String& value);
+
+ /**
+ * Sets an HTTP header field.
+ * @since 2.1
+ * @return An error code
+ * @param[in] field The HTTP header field
+ * @param[in] value The value of the header field
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The field is empty or does not exist.
+ */
+ result SetRequestHeader(const Tizen::Base::String& field, const Tizen::Base::String& value);
+
+ /**
+ * Removes an HTTP header field.
+ * @since 2.1
+ * @return An error code
+ * @param[in] field The HTTP header field
+ * @param[in] value The value of the header field
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The field is empty or does not exist.
+ */
+ result RemoveRequestHeader(const Tizen::Base::String& field);
+
+ /**
+ * Gets the value of the HTTP header field.
+ * @since 2.1
+ * @return The value of HTTP header field if successful, @n
+ * else null if there is no HTTP header field
+ * @param[in] field The HTTP header field
+ */
+ Tizen::Base::String* GetRequestHeaderN(const Tizen::Base::String& field);
+
private:
/**
* This default constructor is intentionally declared as private so that only the platform can create an instance.
// See the License for the specific language governing permissions and
// limitations under the License.
//
+
/**
* @file FCntIContentScanListener.h
- * @brief This is the header file for the %_IContentScanListener interface.
+ * @brief This is the header file for the %IContentScanListener interface.
*
- * This header file contains the declarations of the %_IContentScanListener interface.
+ * This header file contains the declarations of the %IContentScanListener interface.
*/
#ifndef _FCNT_ICONTENT_SCAN_LISTENER_H_
#define _FCNT_ICONTENT_SCAN_LISTENER_H_
-#include <FBaseString.h>
#include <FBaseRtIEventListener.h>
namespace Tizen { namespace Content
{
-
-class _OSP_EXPORT_ _IContentScanListener
+/**
+ * @interface IContentScanListener
+ * @brief This interface is used for receiving the scan operation event.
+ *
+ * @since 2.1
+ *
+ * The %IContentScanListener interface is used for receiving the scan operation event.
+ */
+class _OSP_EXPORT_ IContentScanListener
: virtual public Tizen::Base::Runtime::IEventListener
{
public:
- virtual ~_IContentScanListener(void) {}
- virtual void OnContentScanCompleted(const Tizen::Base::String& scanPath, result r) = 0;
+ /**
+ * This polymorphic destructor should be overridden if required. @n
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.1
+ */
+ virtual ~IContentScanListener(void) {}
+
+ /**
+ * Called when a scan operation is completed.
+ *
+ * @since 2.1
+ *
+ * @param[in] reqId The request ID returned by ContentManager::ScanDirectory()
+ * @param[in] scanPath The scan path.
+ * @param[in] r The error of scan operation.
+ * The following exception is given through this parameter.
+ * @exception E_SUCCESS The method is successful
+ * @exception E_SERVICE_BUSY The database is busy.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ virtual void OnContentScanCompleted(RequestId reqId, const Tizen::Base::String& scanPath, result r) = 0;
protected:
- virtual void _IContentScanListener_Reserved1(void) {}
- virtual void _IContentScanListener_Reserved2(void) {}
-}; // class _IContentScanListener
+ //
+ // This method is for internal use only.
+ // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // This method is reserved and may change its name at any time without prior notice.
+ //
+ // @since 2.1
+ //
+ virtual void IContentScanListener_Reserved1(void) {}
+
+ //
+ // This method is for internal use only.
+ // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // This method is reserved and may change its name at any time without prior notice.
+ //
+ // @since 2.1
+ //
+ virtual void IContentScanListener_Reserved2(void) {}
+
+
+}; // class IContentScanListener
-}}
+}} // Tizen::Content
#endif // _FCNT_ICONTENT_SCAN_LISTENER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FCntIContentUpdateEventListener.h
+ * @brief This is the header file for the %IContentUpdateEventListener interface.
+ *
+ * This header file contains the declarations of the %IContentUpdateEventListener interface.
+ */
+
+#ifndef _FCNT_ICONTENT_UPDATE_EVENT_LISTENER_H_
+#define _FCNT_ICONTENT_UPDATE_EVENT_LISTENER_H_
+
+#include <FBaseRtIEventListener.h>
+
+namespace Tizen { namespace Content
+{
+/**
+ * @interface IContentUpdateEventListener
+ * @brief This interface is used for receiving the database change notification.
+ *
+ * @since 2.1
+ *
+ * The %IContentUpdateEventListener interface is used for receiving the database change notification.
+ */
+class _OSP_EXPORT_ IContentUpdateEventListener
+ : virtual public Tizen::Base::Runtime::IEventListener
+{
+public:
+ /**
+ * This polymorphic destructor should be overridden if required. @n
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.1
+ */
+ virtual ~IContentUpdateEventListener(void) {}
+
+ /**
+ * Called when the content is created.
+ *
+ * @since 2.1
+ *
+ * @param[in] contentId The content ID
+ * @param[in] contentType The content type
+ * @param[in] r An error code
+ * The following exception is given through this parameter.
+ * @exception E_SUCCESS The method is successful
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ virtual void OnContentFileCreated(ContentId contentId, ContentType contentType, result r) = 0;
+
+ /**
+ * Called when the content is updated.
+ *
+ * @since 2.1
+ *
+ * @param[in] contentId The content ID
+ * @param[in] contentType The content type
+ * @param[in] r An error code
+ * The following exception is given through this parameter.
+ * @exception E_SUCCESS The method is successful
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ virtual void OnContentFileUpdated(ContentId contentId, ContentType contentType, result r) = 0;
+
+ /**
+ * Called when the content is deleted..
+ *
+ * @since 2.1
+ *
+ * @param[in] contentId The content ID
+ * @param[in] contentType The content type
+ * @param[in] r An error code
+ * The following exception is given through this parameter.
+ * @exception E_SUCCESS The method is successful
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ virtual void OnContentFileDeleted(ContentId contentId, ContentType contentType, result r) = 0;
+
+ /**
+ * Called when the scan for a directory is completed.
+ *
+ * @since 2.1
+ *
+ * @param[in] directoryPath The directory path
+ * @param[in] r An error code
+ * The following exception is given through this parameter.
+ * @exception E_SUCCESS The method is successful
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ */
+ virtual void OnContentDirectoryScanCompleted(const Tizen::Base::String& directoryPath, result r) = 0;
+
+protected:
+ //
+ // This method is for internal use only.
+ // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // This method is reserved and may change its name at any time without prior notice.
+ //
+ // @since 2.1
+ //
+ virtual void IContentUpdateEventListener_Reserved1(void) {}
+
+ //
+ // This method is for internal use only.
+ // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // This method is reserved and may change its name at any time without prior notice.
+ //
+ // @since 2.1
+ //
+ virtual void IContentUpdateEventListener_Reserved2(void) {}
+
+ //
+ // This method is for internal use only.
+ // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // This method is reserved and may change its name at any time without prior notice.
+ //
+ // @since 2.1
+ //
+ virtual void IContentUpdateEventListener_Reserved3(void) {}
+
+ //
+ // This method is for internal use only.
+ // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // This method is reserved and may change its name at any time without prior notice.
+ //
+ // @since 2.1
+ //
+ virtual void IContentUpdateEventListener_Reserved4(void) {}
+
+ //
+ // This method is for internal use only.
+ // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // This method is reserved and may change its name at any time without prior notice.
+ //
+ // @since 2.1
+ //
+ virtual void IContentUpdateEventListener_Reserved5(void) {}
+
+}; // class IContentUpdateEventListener
+
+}} // Tizen::Content
+
+#endif // _FCNT_ICONTENT_UPDATE_EVENT_LISTENER_H_
};
/**
+ * @enum DownloadNetworkType
+ * Defines the download network type.
+ * @since 2.1
+ */
+enum DownloadNetworkType
+{
+ DOWNLOAD_NETWORK_DATA_NETWORK = 1, /**< The data network is allowed */
+ DOWNLOAD_NETWORK_WIFI, /*< The wifi network is allowed */
+ DOWNLOAD_NETWORK_ALL = 100 /*< The all network types are allowed */
+};
+
+/**
* @enum DownloadState
*
* Defines the download state.
DOWNLOAD_STATE_PAUSED, /**< The download request is in a paused state by user request */
DOWNLOAD_STATE_CANCELLED, /**< The download request is cancelled by user request */
DOWNLOAD_STATE_COMPLETED, /**< The download request is in a completed state */
- DOWNLOAD_STATE_FAILED, /**< The download request failed */
+ DOWNLOAD_STATE_FAILED /**< The download request failed */
};
-extern const Tizen::Base::String OSP_HOME;
-extern const Tizen::Base::String OSP_HOME_EXT;
-extern const Tizen::Base::String OSP_MEDIA_PHONE;
-extern const Tizen::Base::String OSP_MEDIA_MMC;
+_OSP_EXPORT_ extern const wchar_t OSP_HOME[];
+_OSP_EXPORT_ extern const wchar_t OSP_HOME_EXT[];
+_OSP_EXPORT_ extern const wchar_t OSP_MEDIA_PHONE[];
+_OSP_EXPORT_ extern const wchar_t OSP_MEDIA_MMC[];
} } // Tizen::Content
Tizen::Base::String GetGenre(void) const;
/**
+ * Gets the comment of the video file.
+ *
+ * @since 2.1
+ *
+ * @return The comment of the video file
+ */
+ Tizen::Base::String GetComment(void) const;
+
+ /**
+ * Gets the description of the video file.
+ *
+ * @since 2.1
+ *
+ * @return The description of the video file
+ */
+ Tizen::Base::String GetDescription(void) const;
+
+ /**
* Gets the album art of the video.
*
* @since 2.0
#include <FCntContentTransferInfo.h>
#include <FCntIContentTransferListener.h>
#include <FCntIContentScanListener.h>
+#include <FCntIContentUpdateEventListener.h>
#include <FCntDownloadRequest.h>
#include <FCntDownloadManager.h>
#include <FCntIDownloadListener.h>
Name: osp-content
Summary: osp content library
-Version: 1.2.0.0
+Version: 1.2.1.0
Release: 2
Group: System/Libraries
License: Apache License, Version 2.0
BuildRequires: openssl-devel
# runtime requires
-Requires: osp-appfw
+Requires: osp-appfw
Requires: osp-net
Requires: osp-image
Requires: osp-media
Summary: osp content library (Development)
Group: TO_BE/FILLED_IN
Requires: %{name} = %{version}-%{release}
+Requires: osp-appfw-devel
+Requires: osp-uifw-devel
+Requires: osp-image-core-devel
+Requires: osp-image-devel
+Requires: osp-locations-devel
+Requires: osp-net-devel
%description devel
osp content library (DEV)
#include <FIoFile.h>
#include <FIoDirectory.h>
#include <FSysEnvironment.h>
-//#include <FLocLocationProvider.h>
-//#include <FLocQualifiedCoordinates.h>
#include <FIo_FileImpl.h>
#include <FApp_AppInfo.h>
* This file contains implementation of the %AudioMetadata class.
*/
-// includes
#include <FBaseSysLog.h>
#include <FCntAudioMetadata.h>
#include <FCnt_AudioMetadataImpl.h>
-// using namespaces
using namespace Tizen::Base;
using namespace Tizen::Graphics;
return __pImpl->GetComment();
}
+String
+AudioMetadata::GetDescription(void) const
+{
+ if (__pImpl == null)
+ {
+ return String();
+ }
+ return __pImpl->GetDescription();
+}
+
int
AudioMetadata::GetTrack(void) const
{
* This is the implementation file for %ContentDirectory class.
*/
-// includes
#include <FBaseSysLog.h>
#include <FCntContentDirectory.h>
#include <FBaseColIList.h>
* This file contains implementation of the %ContentManager class.
*/
-// includes
#include <FBaseSysLog.h>
#include <FBaseByteBuffer.h>
#include <FCntContentManager.h>
#include <FCnt_ContentManagerImpl.h>
#include <FSec_AccessController.h>
-// using namespaces
using namespace Tizen::Base;
using namespace Tizen::Security;
}
result
-ContentManager::ScanFile(const String& contentPath)
+ContentManager::AddContentUpdateEventListener(IContentUpdateEventListener& listener)
+{
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ r = __pImpl->AddContentUpdateEventListener(listener);
+ SysTryReturnResult(NID_CNT, !IsFailed(r), r, "[%s] AddContentUpdateEventListener failed.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+ContentManager::RemoveContentUpdateEventListener(IContentUpdateEventListener& listener)
+{
+ ClearLastResult();
+ result r = E_SUCCESS;
+
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ r = __pImpl->RemoveContentUpdateEventListener(listener);
+ SysTryReturnResult(NID_CNT, !IsFailed(r), r, "[%s] RemoveContentUpdateEventListener failed.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+ContentManager::ScanFile(const Tizen::Base::String& contentPath)
{
ClearLastResult();
result r = E_SUCCESS;
SysTryReturn(NID_CNT, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
"[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
- SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
-
- r = __pImpl->ScanFile(contentPath);
+ r = _ContentManagerImpl::ScanFile(contentPath);
SysTryReturn(NID_CNT, !IsFailed(r), r, r, "[%s] ScanFile failed.", GetErrorMessage(r));
return r;
}
result
-ContentManager::ScanDirectory(const String& directoryPath, bool recursive, _IContentScanListener& listener)
+ContentManager::ScanDirectory(const Tizen::Base::String& directoryPath, bool recursive, IContentScanListener* pListener, RequestId& reqId)
{
ClearLastResult();
result r = E_SUCCESS;
SysTryReturn(NID_CNT, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
"[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
- SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
-
- r = __pImpl->ScanDirectory(directoryPath, recursive, listener);
+ r = _ContentManagerImpl::ScanDirectory(directoryPath, recursive, pListener, reqId);
SysTryReturn(NID_CNT, !IsFailed(r), r, r, "[%s] ScanDirectory failed.", GetErrorMessage(r));
return r;
}
+
}}
* This file contains implementation of the %ContentManagerUtil class.
*/
-// includes
#include <FBaseSysLog.h>
#include <FCntContentManagerUtil.h>
#include <FCntImageMetadata.h>
#include <FCntVideoMetadata.h>
#include <FCnt_ContentManagerUtilImpl.h>
-// using namespace
using namespace Tizen::Base;
namespace Tizen { namespace Content
return pVideoMetadata;
}
+ImageMetadata*
+ContentManagerUtil::GetImageMetaN(const ByteBuffer& byteBuffer)
+{
+ ClearLastResult();
+
+ result r = E_SUCCESS;
+ ImageMetadata* pImageMetadata = null;
+
+ pImageMetadata = _ContentManagerUtilImpl::GetImageMetaN(byteBuffer);
+ r = GetLastResult();
+ SysTryReturn(NID_CNT, pImageMetadata != null, null, r, "[%s] GetImageMetaN failed.", GetErrorMessage(r));
+
+ return pImageMetadata;
+}
+
+AudioMetadata*
+ContentManagerUtil::GetAudioMetaN(const ByteBuffer& byteBuffer)
+{
+ ClearLastResult();
+
+ result r = E_SUCCESS;
+ AudioMetadata* pAudioMetadata = null;
+
+ pAudioMetadata = _ContentManagerUtilImpl::GetAudioMetaN(byteBuffer);
+ r = GetLastResult();
+ SysTryReturn(NID_CNT, pAudioMetadata != null, null, r, "[%s] GetAudioMetaN failed.", GetErrorMessage(r));
+
+ return pAudioMetadata;
+}
+
+VideoMetadata*
+ContentManagerUtil::GetVideoMetaN(const ByteBuffer& byteBuffer)
+{
+ ClearLastResult();
+
+ result r = E_SUCCESS;
+ VideoMetadata* pVideoMetadata = null;
+
+ pVideoMetadata = _ContentManagerUtilImpl::GetVideoMetaN(byteBuffer);
+ r = GetLastResult();
+ SysTryReturn(NID_CNT, pVideoMetadata != null, null, r, "[%s] GetVideoMetaN failed.", GetErrorMessage(r));
+
+ return pVideoMetadata;
+}
+
ContentType
ContentManagerUtil::CheckContentType(const String& filePath)
{
* This is the implementation file for %ContentSearch class.
*/
-// includes
#include <FBaseSysLog.h>
#include <FCntContentSearch.h>
#include <FBaseColIList.h>
* This file contains implementation of the %ContentSearchResult class.
*/
-// includes
#include <FCntContentSearchResult.h>
#include <FCntContentInfo.h>
-// using namespace
using namespace Tizen::Base;
namespace Tizen { namespace Content
* This file contains implementation of the %ContentTransfer class.
*/
-// includes
#include <FBaseSysLog.h>
#include <FCntContentTransfer.h>
#include <FBaseColIList.h>
#include <FCnt_ContentTransferImpl.h>
#include <FSec_AccessController.h>
-// using namespace
using namespace Tizen::Base;
using namespace Tizen::Security;
#include "FCnt_DownloadRequestImpl.h"
using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
namespace Tizen { namespace Content
{
return __pDownloadRequestImpl->GetFileName();
}
+void
+DownloadRequest::SetNotification(bool enable)
+{
+ __pDownloadRequestImpl->SetNotification(enable);
+}
+
+result
+DownloadRequest::SetNotificationExtraData(const IMap *pExtraData)
+{
+ SysTryReturnResult(NID_CNT, pExtraData != null, E_INVALID_ARG, "pExtraData is null.");
+ return __pDownloadRequestImpl->SetNotificationExtraData(pExtraData);
+}
+
+void
+DownloadRequest::SetNetworkType(DownloadNetworkType type)
+{
+ __pDownloadRequestImpl->SetNetworkType(type);
+}
+
+bool
+DownloadRequest::IsNotificationEnabled(void) const
+{
+ return __pDownloadRequestImpl->IsNotificationEnabled();
+}
+
+const IMap*
+DownloadRequest::GetNotificationExtraData(void) const
+{
+ return __pDownloadRequestImpl->GetNotificationExtraData();
+}
+
+DownloadNetworkType
+DownloadRequest::GetNetworkType(void) const
+{
+ return __pDownloadRequestImpl->GetNetworkType();
+}
+
+result
+DownloadRequest::AddRequestHeader(const String& field, const String& value)
+{
+ return __pDownloadRequestImpl->AddRequestHeader(field, value);
+}
+
+result
+DownloadRequest::SetRequestHeader(const String& field, const String& value)
+{
+ return __pDownloadRequestImpl->SetRequestHeader(field, value);
+}
+
+result
+DownloadRequest::RemoveRequestHeader(const String& field)
+{
+ return __pDownloadRequestImpl->RemoveRequestHeader(field);
+}
+
+String*
+DownloadRequest::GetRequestHeaderN(const String& field)
+{
+ return __pDownloadRequestImpl->GetRequestHeaderN(field);
+}
+
} } // Tizen::Content
#include <FIoFile.h>
#include <FIoDirectory.h>
#include <FSysEnvironment.h>
-//#include <FLocLocationProvider.h>
-//#include <FLocQualifiedCoordinates.h>
#include <FIo_FileImpl.h>
#include <FApp_AppInfo.h>
* This file contains implementation of the %ImageMetadata class.
*/
-// includes
#include <FBaseSysLog.h>
#include <FCntImageMetadata.h>
#include <FCnt_ImageMetadataImpl.h>
-// using namespaces
using namespace Tizen::Base;
using namespace Tizen::Graphics;
#include <FIoFile.h>
#include <FIoDirectory.h>
#include <FSysEnvironment.h>
-//#include <FLocLocationProvider.h>
-//#include <FLocQualifiedCoordinates.h>
#include <FIo_FileImpl.h>
#include <FApp_AppInfo.h>
SysTryReturn(NID_CNT, !playListName.IsEmpty(), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The playListName is empty.");
- r = __pImpl->SetPlalyListName(__playListName, playListName); // impl need old and new name
- SysTryReturn(NID_CNT, !IsFailed(r), r, r, "[%s] SetPlalyListName failed. ", GetErrorMessage(r));
+ r = __pImpl->SetPlayListName(__playListName, playListName); // impl need old and new name
+ SysTryReturn(NID_CNT, !IsFailed(r), r, r, "[%s] SetPlayListName failed. ", GetErrorMessage(r));
__playListName = playListName;
#include <FIoFile.h>
#include <FIoDirectory.h>
#include <FSysEnvironment.h>
-//#include <FLocLocationProvider.h>
-//#include <FLocQualifiedCoordinates.h>
#include <FIo_FileImpl.h>
#include <FApp_AppInfo.h>
* This file contains implementation of the %VideoMetadata class.
*/
-// includes
#include <FBaseSysLog.h>
#include <FCntVideoMetadata.h>
#include <FCnt_VideoMetadataImpl.h>
-// using namespaces
using namespace Tizen::Base;
using namespace Tizen::Graphics;
return __pImpl->GetGenre();
}
+String
+VideoMetadata::GetComment(void) const
+{
+ if (__pImpl == null)
+ {
+ return String();
+ }
+ return __pImpl->GetComment();
+}
+
+String
+VideoMetadata::GetDescription(void) const
+{
+ if (__pImpl == null)
+ {
+ return String();
+ }
+ return __pImpl->GetDescription();
+}
+
Bitmap*
VideoMetadata::GetAlbumArtN(void) const
{
* This file contains implementation of the %_AudioMetadataImpl class.
*/
-// includes
#include <FBaseSysLog.h>
#include <FCntAudioMetadata.h>
#include <FCnt_AudioMetadataImpl.h>
#include <FGrp_BitmapImpl.h>
-// using namespaces
using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Graphics;
__pAudioMeta->pComment = new (nothrow) String(*(pAudioMeta->pComment));
SysTryReturnResult(NID_CNT, __pAudioMeta->pComment != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
}
+ if (pAudioMeta->pDescription != null)
+ {
+ __pAudioMeta->pDescription = new (nothrow) String(*(pAudioMeta->pDescription));
+ SysTryReturnResult(NID_CNT, __pAudioMeta->pDescription != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+ }
if (pAudioMeta->pComposer != null)
{
__pAudioMeta->pComposer = new (nothrow) String(*(pAudioMeta->pComposer));
return;
}
}
+ // pDescription
+ if ((rhs.__pAudioMeta)->pDescription != null)
+ {
+ pNewAudioMeta->pDescription = new (nothrow) String(*((rhs.__pAudioMeta)->pDescription));
+ if (pNewAudioMeta->pDescription == null)
+ {
+ SysLog(NID_CNT, "The memory is insufficient.");
+ return;
+ }
+ }
// pComposer
if ((rhs.__pAudioMeta)->pComposer != null)
{
__pAudioMeta->pComment = new (nothrow) String(*((rhs.__pAudioMeta)->pComment));
}
+ // pDescription
+ if (__pAudioMeta->pDescription != null && (rhs.__pAudioMeta)->pDescription != null)
+ {
+ // delete previous data
+ delete __pAudioMeta->pDescription;
+ __pAudioMeta->pDescription = null;
+
+ __pAudioMeta->pDescription = new (nothrow) String(*((rhs.__pAudioMeta)->pDescription));
+ }
+ else if (__pAudioMeta->pDescription != null)
+ {
+ delete __pAudioMeta->pDescription;
+ __pAudioMeta->pDescription = null;
+ }
+ else if ((rhs.__pAudioMeta)->pDescription != null)
+ {
+ __pAudioMeta->pDescription = new (nothrow) String(*((rhs.__pAudioMeta)->pDescription));
+ }
+
// pComposer
if (__pAudioMeta->pComposer != null && (rhs.__pAudioMeta)->pComposer != null)
{
{
return false;
}
+ if (!((this->GetDescription()).Equals(pRhs->GetDescription())))
+ {
+ return false;
+ }
if (!((this->GetComposer()).Equals(pRhs->GetComposer())))
{
return false;
int
_AudioMetadataImpl::GetHashCode(void) const
{
- int hash = 0;
-
- hash += (this->GetAlbumName()).GetHashCode();
- hash += (this->GetArtist()).GetHashCode();
- hash += Integer::GetHashCode(this->GetBitrate());
- hash += Integer::GetHashCode(this->GetChannelCount());
- hash += (this->GetComment()).GetHashCode();
- hash += (this->GetComposer()).GetHashCode();
- hash += (this->GetCopyright()).GetHashCode();
- hash += Long::GetHashCode(this->GetDuration());
- hash += Integer::GetHashCode(this->GetFrequency());
- hash += (this->GetGenre()).GetHashCode();
- hash += (this->GetRecordingDate()).GetHashCode();
- hash += (this->GetTitle()).GetHashCode();
- hash += Integer::GetHashCode(this->GetTrack());
- hash += (this->GetTrackInfo()).GetHashCode();
- hash += Integer::GetHashCode(this->GetYear());
-
- return hash;
+ return (this->GetAlbumName()).GetHashCode()
+ ^ (this->GetArtist()).GetHashCode()
+ ^ Integer::GetHashCode(this->GetBitrate())
+ ^ Integer::GetHashCode(this->GetChannelCount())
+ ^ (this->GetComment()).GetHashCode()
+ ^ (this->GetDescription()).GetHashCode()
+ ^ (this->GetComposer()).GetHashCode()
+ ^ (this->GetCopyright()).GetHashCode()
+ ^ Long::GetHashCode(this->GetDuration())
+ ^ Integer::GetHashCode(this->GetFrequency())
+ ^ (this->GetGenre()).GetHashCode()
+ ^ (this->GetRecordingDate()).GetHashCode()
+ ^ (this->GetTitle()).GetHashCode()
+ ^ Integer::GetHashCode(this->GetTrack())
+ ^ (this->GetTrackInfo()).GetHashCode()
+ ^ Integer::GetHashCode(this->GetYear());
}
String
return *(__pAudioMeta->pComment);
}
+String
+_AudioMetadataImpl::GetDescription(void) const
+{
+ if (__pAudioMeta == null || __pAudioMeta->pDescription == null)
+ {
+ SysLog(NID_CNT, "__pAudioMeta or __pAudioMeta->pDescription is null.");
+ return String();
+ }
+ return *(__pAudioMeta->pDescription);
+}
+
int
_AudioMetadataImpl::GetTrack(void) const
{
SysTryReturn(NID_CNT, CheckMediaPath(contentDirectoryPath), directoryItemCount, E_INVALID_ARG,
"[E_INVALID_ARG] Failed to perform CheckMediaPath operation.");
- r = CreateFolderFilter(__isMultiContentType, contentDirectoryPath);
+ String detachedPath = contentDirectoryPath;
+
+ if (contentDirectoryPath.EndsWith(L"/"))
+ {
+ r = detachedPath.Remove(detachedPath.GetLength() - 1, 1);
+ SysTryReturn(NID_CNT, !IsFailed(r), directoryItemCount, E_INVALID_ARG, "[E_INVALID_ARG] Failed to remove the path string.");
+ }
+
+ r = CreateFolderFilter(__isMultiContentType, detachedPath);
SysTryReturn(NID_CNT, !IsFailed(r), directoryItemCount, E_SYSTEM, "[E_SYSTEM] Failed to perform CreateFolderFilter operation.");
ret = media_folder_foreach_folder_from_db(*(__pFilterHandle.get()), MediaFoldersCb, &pItemList);
SysTryReturn(NID_CNT, CheckMediaPath(contentDirectoryPath), null, E_INVALID_ARG,
"[E_INVALID_ARG] Failed to perform CheckMediaPath operation.");
+ String detachedPath = contentDirectoryPath;
+
+ if (contentDirectoryPath.EndsWith(L"/"))
+ {
+ r = detachedPath.Remove(detachedPath.GetLength() - 1, 1);
+ SysTryReturn(NID_CNT, !IsFailed(r), null, E_INVALID_ARG, "[E_INVALID_ARG] Failed to remove the path string.");
+ }
+
__pFinalOutList = std::unique_ptr<ArrayList, AllElementsDeleter>(new (std::nothrow) ArrayList());
SysTryReturn(NID_CNT, __pFinalOutList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] FinalOutList is null.");
r = __pFinalOutList->Construct();
SysTryReturn(NID_CNT, r == E_SUCCESS, null, r, "[%s] Failed to construct __pFinalOutList ArrayList.", GetErrorMessage(r));
- r = CreateFolderFilter(__isMultiContentType, contentDirectoryPath);
+ r = CreateFolderFilter(__isMultiContentType, detachedPath);
SysTryReturn(NID_CNT, !IsFailed(r), null, E_SYSTEM, "[E_SYSTEM] Failed to perform CreateFolderFilter operation.");
if ((!column.IsEmpty()) && (sortOrder != SORT_ORDER_NONE))
SysLog(NID_CNT, "totalCount is [%d].", totalCount);
}
-
+
if (totalCount > 0)
{
if ((totalCount % countPerPage) == 0)
#include <FBaseSysLog.h>
#include <FIoDirectory.h>
#include <FSysEnvironment.h>
-#include <FCntContentManager.h>
#include <FCntImageContentInfo.h>
#include <FCntVideoContentInfo.h>
#include <FCntAudioContentInfo.h>
#include <FCntOtherContentInfo.h>
#include <FApp_AppInfo.h>
+#include <FCnt_ContentManagerImpl.h>
#include <FCnt_ContentManagerUtilImpl.h>
#include <FIo_FileImpl.h>
#include "FCnt_ContentDownloadListener.h"
return;
CATCH:
- ContentManager contentManager;
+ _ContentManagerImpl contentManager;
r = contentManager.Construct();
SysTryLog(NID_CNT, !IsFailed(r), "[%s] Failed to construct ContentManager.", GetErrorMessage(r));
ClearLastResult();
result r = E_SUCCESS;
ContentId contentId;
- ContentManager contentManager;
+ _ContentManagerImpl contentManager;
ContentType contentType = CONTENT_TYPE_UNKNOWN;
ImageContentInfo imageContentInfo;
AudioContentInfo audioContentInfo;
#include <FCntAudioMetadata.h>
#include <FCntVideoMetadata.h>
#include <FCntIContentScanListener.h>
+#include <FCntIContentUpdateEventListener.h>
#include <FIoDirectory.h>
#include <FSysEnvironment.h>
#include <FCnt_ContentManagerImpl.h>
namespace Tizen { namespace Content
{
+static RequestId requestId = 0;
+
static const int SYSTEM_TYPE_IMAGE = 0;
static const int SYSTEM_TYPE_VIDEO = 1;
static const int SYSTEM_TYPE_SOUND = 2;
static const int SOURCE_PATH_LENGTH = 200;
// For extern declaration in FCntTypes.h
-const String OSP_HOME = L"/Home/";
-const String OSP_HOME_EXT = L"/HomeExt/";
-const String OSP_MEDIA_PHONE = L"/Media/";
-const String OSP_MEDIA_MMC = L"/Storagecard/Media/";
+const wchar_t OSP_HOME[] = L"/Home/";
+const wchar_t OSP_HOME_EXT[] = L"/HomeExt/";
+const wchar_t OSP_MEDIA_PHONE[] = L"/Media/";
+const wchar_t OSP_MEDIA_MMC[] = L"/Storagecard/Media/";
+
+static result
+ConvertError(int error)
+{
+ result r = E_SUCCESS;
+
+ switch (error)
+ {
+ case MEDIA_CONTENT_ERROR_NONE:
+ r = E_SUCCESS;
+ break;
+
+ case MEDIA_CONTENT_ERROR_INVALID_PARAMETER:
+ r = E_INVALID_ARG;
+ break;
+
+ case MEDIA_CONTENT_ERROR_OUT_OF_MEMORY:
+ r = E_OUT_OF_MEMORY;
+ break;
+
+ case MEDIA_CONTENT_ERROR_DB_BUSY:
+ r = E_SERVICE_BUSY;
+ break;
+
+ case MEDIA_CONTENT_ERROR_DB_FAILED:
+ r = E_SYSTEM;
+ break;
+
+ default:
+ r = E_SYSTEM;
+ break;
+ }
+
+ return r;
+}
static void
-OnScanCompleted(media_content_error_e error, void *user_data)
+OnScanCompleted(media_content_error_e error, void* user_data)
{
ClearLastResult();
- SysLog(NID_CNT, "OnScanCompleted start.");
+ SysLog(NID_CNT, "OnScanCompleted callback method is called.");
if (user_data == null)
{
return;
}
- ScanResult* pScanResult = (ScanResult*)user_data;
+ ScanResult* pScanResult = static_cast< ScanResult* >(user_data);
- if (pScanResult == null || pScanResult->pData == null || pScanResult->pContentPath == null)
+ if (pScanResult == null || pScanResult->pScanPath == null || pScanResult->pScanListener == null)
{
SysLog(NID_CNT, "OnScanCompleted failed.");
return;
}
- _ContentManagerImpl* __pManagerImpl = (_ContentManagerImpl*)pScanResult->pData;
- String contentPath(pScanResult->pContentPath);
+ String scanPath(pScanResult->pScanPath);
+ IContentScanListener* pListener = pScanResult->pScanListener;
+ RequestId reqId = pScanResult->requestId;
delete pScanResult;
+ result r = ConvertError(error);
+
+ pListener->OnContentScanCompleted(reqId, scanPath, r);
+
+ int val = media_content_disconnect();
+ SysTryLog(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, "The disconnection failed[%d].", val);
+
+ SysLog(NID_CNT, "Fire the OnContentScanCompleted method.");
+}
+
+static void
+OnContentUpdateCompleted(media_content_error_e error, int pid, media_content_db_update_item_type_e update_item,
+ media_content_db_update_type_e update_type, media_content_type_e media_type, char* uuid, char* path, char* mime_type, void* user_data)
+{
+ SysLog(NID_CNT, "OnContentUpdateCompleted callback method is called.");
+
result r = E_SUCCESS;
- switch (error)
+
+ SysTryLogReturn(NID_CNT, user_data != null, , "OnContentUpdateCompleted failed.");
+
+ _ContentManagerImpl* pTempManagerImpl = static_cast< _ContentManagerImpl* >(user_data);
+
+ IContentUpdateEventListener* pListener = pTempManagerImpl->GetListener();
+ SysTryLogReturn(NID_CNT, pListener != null, , "IContentUpdateEventListener is null.");
+
+ if (error != MEDIA_CONTENT_ERROR_NONE)
{
- case MEDIA_CONTENT_ERROR_NONE:
- r = E_SUCCESS;
- break;
+ r = E_SYSTEM;
+ }
- case MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT:
- // fall through
- case MEDIA_CONTENT_ERROR_INVALID_PARAMETER:
- r = E_INVALID_ARG;
- break;
+ switch (update_item)
+ {
+ case MEDIA_ITEM_FILE:
+ {
+ ContentType contentType = CONTENT_TYPE_UNKNOWN;
- case MEDIA_CONTENT_ERROR_DB_BUSY:
- r = E_SERVICE_BUSY;
+ switch (media_type)
+ {
+ case MEDIA_CONTENT_TYPE_IMAGE:
+ contentType = CONTENT_TYPE_IMAGE;
+ break;
+
+ case MEDIA_CONTENT_TYPE_VIDEO:
+ contentType = CONTENT_TYPE_VIDEO;
+ break;
+
+ case MEDIA_CONTENT_TYPE_SOUND:
+ // fall through
+ case MEDIA_CONTENT_TYPE_MUSIC:
+ contentType = CONTENT_TYPE_AUDIO;
+ break;
+
+ case MEDIA_CONTENT_TYPE_OTHERS:
+ contentType = CONTENT_TYPE_OTHER;
+ break;
+
+ default:
+ r = E_SYSTEM;
+ SysLog(NID_CNT, "media_type is invalid.");
+ break;
+ }
+
+ String str(uuid);
+ ContentId contentId;
+
+ result res = UuId::Parse(str, contentId);
+ SysTryLogReturn(NID_CNT, !IsFailed(res), , "Failed to parse to the content ID.");
+
+ switch (update_type)
+ {
+ case MEDIA_CONTENT_INSERT:
+ pListener->OnContentFileCreated(contentId, contentType, r);
+ break;
+
+ case MEDIA_CONTENT_DELETE:
+ pListener->OnContentFileDeleted(contentId, contentType, r);
+ break;
+
+ case MEDIA_CONTENT_UPDATE:
+ pListener->OnContentFileUpdated(contentId, contentType, r);
+ break;
+
+ default:
+ SysLog(NID_CNT, "update_type is invalid.");
+ break;
+ }
+ }
+
+ case MEDIA_ITEM_DIRECTORY:
+ {
+ String directoryPath(path);
+
+ pListener->OnContentDirectoryScanCompleted(directoryPath, r);
break;
+ }
default:
- r = E_SYSTEM;
+ SysLog(NID_CNT, "update_item is invalid.");
break;
}
- (__pManagerImpl->GetListener())->OnContentScanCompleted(contentPath, r);
-
- SysLog(NID_CNT, "OnScanCompleted end.");
+ SysLog(NID_CNT, "Fire the OnContentUpdateCompleted method.");
}
_ContentManagerImpl::_ContentManagerImpl(void)
: Object()
, __isConnected(false)
+ , __pListener(null)
{
}
return r;
}
+//
+// E_SUCCESS
+// E_OBJ_ALREADY_EXIST
+// E_SYSTEM
+//
result
-_ContentManagerImpl::ScanFile(const String& contentPath)
+_ContentManagerImpl::AddContentUpdateEventListener(IContentUpdateEventListener& listener)
{
- SysAssertf(__isConnected, "Not yet constructed. Construct() should be called before use.");
-
ClearLastResult();
- unique_ptr<char[]> pContentPath(_StringConverter::CopyToCharArrayN(contentPath));
+ SysTryReturnResult(NID_CNT, GetListener() == null, E_OBJ_ALREADY_EXIST, "IContentUpdateEventListener is already set.");
- int val = media_content_scan_file(pContentPath.get());
- SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
- "media_content_scan_file failed[%d].", val);
+ SetListener(&listener);
+
+ int val = media_content_set_db_updated_cb(OnContentUpdateCompleted, this);
+ SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "media_content_set_db_updated_cb failed[%d].", val);
return E_SUCCESS;
}
+//
+// E_SUCCESS
+// E_OBJ_NOT_FOUND
+// E_SYSTEM
+//
result
-_ContentManagerImpl::ScanDirectory(const String& directoryPath, bool recursive, _IContentScanListener& listener)
+_ContentManagerImpl::RemoveContentUpdateEventListener(IContentUpdateEventListener& listener)
{
- SysAssertf(__isConnected, "Not yet constructed. Construct() should be called before use.");
+ ClearLastResult();
+
+ SysTryReturnResult(NID_CNT, GetListener() == &listener, E_OBJ_NOT_FOUND, "The input listener is not equal to the registered listener.");
+
+ int val = media_content_unset_db_updated_cb();
+ SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "media_content_unset_db_updated_cb failed[%d].", val);
+
+ SetListener(null);
+
+ return E_SUCCESS;
+}
+//
+// E_SUCCESS
+// E_INVALID_ARG
+// E_SYSTEM
+// E_SERVICE_BUSY
+// E_PRIVILEGE_DENIED(in public)
+//
+result
+_ContentManagerImpl::ScanFile(const Tizen::Base::String& contentPath)
+{
ClearLastResult();
- unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(directoryPath));
+ SysLog(NID_CNT, "The scan path is [%ls].", contentPath.GetPointer());
- SetListener(&listener);
+ unique_ptr<char[]> pContentPath(_StringConverter::CopyToCharArrayN(contentPath));
+ SysTryReturnResult(NID_CNT, (pContentPath.get())[0] != null, E_SYSTEM, "pContentPath is NULL.");
- ScanResult* pScanResult = new (nothrow) ScanResult;
- SysTryReturnResult(NID_CNT, pScanResult != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+ int val = media_content_connect();
+ SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "The connection failed[%d].", val);
- pScanResult->pData = this;
- pScanResult->pContentPath = pDirPath.get();
+ val = media_content_scan_file(pContentPath.get());
+ SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val), "media_content_scan_file failed[%d].", val);
- int val = media_content_scan_folder(pDirPath.release(), OnScanCompleted, pScanResult);
- SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
- "media_content_scan_folder failed[%d].", val);
+ val = media_content_disconnect();
+ SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "The disconnection failed[%d].", val);
return E_SUCCESS;
}
-void
-_ContentManagerImpl::SetListener(_IContentScanListener* pListener)
+//
+// E_SUCCESS
+// E_INVALID_ARG
+// E_SYSTEM
+// E_SERVICE_BUSY
+// E_PRIVILEGE_DENIED(in public)
+//
+result
+_ContentManagerImpl::ScanDirectory(const Tizen::Base::String& directoryPath, bool recursive, IContentScanListener* pListener, RequestId& reqId)
{
- this->__pListener = pListener;
-}
+ ClearLastResult();
-_IContentScanListener*
-_ContentManagerImpl::GetListener(void) const
-{
- return this->__pListener;
+ SysLog(NID_CNT, "The scan path is [%ls].", directoryPath.GetPointer());
+
+ SysTryReturnResult(NID_CNT, pListener != null, E_INVALID_ARG, "Failed to ScanDirectory method.");
+
+ unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(directoryPath));
+ SysTryReturnResult(NID_CNT, (pDirPath.get())[0] != null, E_SYSTEM, "pDirPath is NULL.");
+
+ int val = media_content_connect();
+ SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, E_SYSTEM, "The connection failed[%d].", val);
+
+ ScanResult* pScanResult = new (nothrow) ScanResult;
+ SysTryReturnResult(NID_CNT, pScanResult != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+ reqId = requestId++;
+
+ pScanResult->pScanPath = pDirPath.get();
+ pScanResult->pScanListener = pListener;
+ pScanResult->requestId = reqId;
+
+ val = media_content_scan_folder(pDirPath.release(), recursive, OnScanCompleted, pScanResult);
+ SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val), "media_content_scan_folder failed[%d].", val);
+
+ return E_SUCCESS;
}
//
return r;
}
-result
-_ContentManagerImpl::ConvertError(int error) const
-{
- result r = E_SUCCESS;
-
- switch (error)
- {
- case MEDIA_CONTENT_ERROR_NONE:
- r = E_SUCCESS;
- break;
-
- case MEDIA_CONTENT_ERROR_INVALID_PARAMETER:
- r = E_INVALID_ARG;
- break;
-
- case MEDIA_CONTENT_ERROR_OUT_OF_MEMORY:
- r = E_OUT_OF_MEMORY;
- break;
-
- case MEDIA_CONTENT_ERROR_DB_BUSY:
- r = E_SERVICE_BUSY;
- break;
-
- case MEDIA_CONTENT_ERROR_DB_FAILED:
- r = E_SYSTEM;
- break;
-
- default:
- r = E_SYSTEM;
- break;
- }
-
- return r;
-}
-
bool
_ContentManagerImpl::VerifyHomeFilePathCompatibility(const String& contentPath) const
{
return true;
}
+void
+_ContentManagerImpl::SetListener(IContentUpdateEventListener* pListener)
+{
+ __pListener = pListener;
+}
+
+IContentUpdateEventListener*
+_ContentManagerImpl::GetListener(void) const
+{
+ return __pListener;
+}
+
}}
#include <stdlib.h>
#include <mime_type.h>
#include <FBaseSysLog.h>
+#include <FBaseByteBuffer.h>
#include <FIoDirectory.h>
#include <FAppApp.h>
#include <FSysEnvironment.h>
#include <FMediaImage.h>
+#include <FMediaImageBuffer.h>
#include <FMediaImageUtil.h>
#include <FCntImageMetadata.h>
#include <FCntAudioMetadata.h>
static const int THUMBNAIL_IMAGE_WIDTH = 80;
static const int THUMBNAIL_IMAGE_HEIGHT = 60;
static const int MINUTES = 60;
-static const int SECONDS = 3600; // 60*60
-static const wchar_t CONTENT_FORMAT[] =
- L"jpg1 JPG1 jpeg1 JPEG1 png1 PNG1 gif1 GIF1 wbmp1 WBMP1 bmp1 BMP1 tiff1 TIFF1 tif1 TIF1 \
- mp32 MP32 aac2 AAC2 wma2 WMA2 m4a2 M4A2 3ga2 3GA2 midi2 MIDI2 mid2 MID2 mmf2 MMF2 \
- wav2 WAV2 amr2 AMR2 imy2 IMY2 mxmf2 MXMF2 xmf2 XMF2 pmd2 PMD2 sdc2 SDC2 spm2 SPM2 flac2 FLAC2 pya2 PYA2 \
- ogg2 OGG2 oga2 OGA2 \
- wmv3 WMV3 avi3 AVI3 asf3 ASF3 sdp3 SDP3 divx3 DIVX3 mkv3 MKV3 skm3 SKM3 k3g3 K3G3 pyv3 PYV3 rv3 RV3 \
- rm3 RM3 ram3 RAM3 mov3 MOV3 qt3 QT3 mpeg3 MPEG3 flv3 FLV3 ra2 RA2 \
- txt0 TXT0 fb20 FB20 smt0 SMT0 docx0 DOCX0 doc0 DOC0 pdf0 PDF0 pptx0 PPTX0 ppt0 PPT0 xlsx0 XLSX0 \
- xls0 XLS0 html0 HTML0 htm0 HTM0 jad0 JAD0 jar0 JAR0 vbm0 VBM0 vcf0 VCF0 vcs0 VCS0 vmg0 VMG0 eml0 EML0 \
- zse0 ZSE0 cer0 CER0 crt0 CRT0 der0 DER0 p120 P120 pfx0 PFX0 wgt0 WGT0 svgz0 SVGZ0 svg0 SVG0 swf0 SWF0 \
- enc0 ENC0 ics0 ICS0 oap0 OAP0 mp45 MP45 3gpp5 3GPP5 3gp5 3GP5";
+static const int SECONDS = 3600;
//
// E_SUCCESS
if (imgType == IMG_FORMAT_JPG)
{
unique_ptr<char[]> pFileName(_StringConverter::CopyToCharArrayN(contentPath));
- SysTryReturn(NID_CNT, pFileName != null, pImageMetadata.release(), E_OUT_OF_MEMORY,
+ SysTryReturn(NID_CNT, pFileName != null, null, E_OUT_OF_MEMORY,
"[E_OUT_OF_MEMORY] The memory is insufficient.");
unique_ptr<ExifData, ExifDataDeleter> pExifdata(exif_data_new_from_file(pFileName.get()));
"[%s] metadata_extractor_get_metadata(title) failed.", GetErrorMessage(r));
}
+ // comment
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_COMMENT, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->pComment = new (nothrow) String(pAudioMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pComment != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(comment) failed.", GetErrorMessage(r));
+ }
+
// description
retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DESCRIPTION, &__pAudioMeta);
if (__pAudioMeta != null)
{
pAudioMeta.reset(__pAudioMeta);
+ pMetadata->pDescription = new (nothrow) String(pAudioMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pDescription != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(description) failed.", GetErrorMessage(r));
+ }
+
+ // recording date
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_RECDATE, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->pRecordingDate = new (nothrow) String(pAudioMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pRecordingDate != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(recording date) failed.", GetErrorMessage(r));
+ }
+
+ // author
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUTHOR, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->pComposer = new (nothrow) String(pAudioMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pComposer != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(author) failed.", GetErrorMessage(r));
+ }
+
+ // track info
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_TRACK_NUM, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->pTrackInfo = new (nothrow) String(pAudioMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pTrackInfo != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ // if the string contains the track info like track num/track position,
+ // then track position will be ignored and only track num is returned
+ // no need to parse this string, since only track number is required
+ pMetadata->trackNum = atoi(pAudioMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(track info) failed.", GetErrorMessage(r));
+ }
+
+ // date
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DATE, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->year = atoi(pAudioMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(date) failed.", GetErrorMessage(r));
+ }
+
+ // artwork
+ int size = 0;
+ void* __pArtwork = null;
+ unique_ptr<void, VoidDeleter> pArtwork(null);
+
+ // Get the artwork image in media file
+ retVal = metadata_extractor_get_artwork(*(pExtractor.get()), &__pArtwork, &size, &__pAudioMeta);
+
+ //Check if the albumart present and pass it to client if it is successfully processed, otherwise ignore any errors
+ //while processing albumart. This is to pass the other metadata tags to application.
+ if (__pArtwork != null)
+ {
+ pArtwork.reset(__pArtwork);
+
+ Image img;
+ ImageFormat format = IMG_FORMAT_NONE;
+ ByteBuffer buffer;
+
+ r = buffer.Construct(size);
+ if (!IsFailed(r)) //Ignore the error codes to send other metadata to app
+ {
+ r = buffer.SetArray((const byte*)(pArtwork.get()), 0, size);
+ if (!IsFailed(r))
+ {
+ r = img.Construct();
+ if (!IsFailed(r))
+ {
+ format = img.GetImageFormat(buffer);
+ pMetadata->pThumbnail = img.DecodeN(buffer, format, BITMAP_PIXEL_FORMAT_ARGB8888,
+ THUMBNAIL_IMAGE_WIDTH, THUMBNAIL_IMAGE_HEIGHT);
+ if (pMetadata->pThumbnail == null)
+ {
+ // Because Thumbnail is one of the metadata, it is not exception in this function.
+ SysLog(NID_CNT, "DecodeN failed.");
+ }
+ pMetadata->pAlbumArt = img.DecodeN(buffer, format, BITMAP_PIXEL_FORMAT_ARGB8888);
+ if (pMetadata->pAlbumArt == null)
+ {
+ // Because Album Art is one of the metadata, it is not exception in this function.
+ SysLog(NID_CNT, "DecodeN failed.");
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_artwork failed.", GetErrorMessage(r));
+ }
+
+ return pAudioMetadata.release();
+}
+
+//
+// E_SUCCESS
+// E_INVALID_ARG
+// E_OUT_OF_MEMORY
+//
+VideoMetadata*
+_ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
+{
+ ClearLastResult();
+
+ SysTryReturn(NID_CNT, VerifyFilePathCompatibility(contentPath), null, E_INVALID_ARG,
+ "[E_INVALID_ARG] %ls is not compatible.", contentPath.GetPointer());
+ SysTryReturn(NID_CNT, _FileImpl::IsFileExist(contentPath), null, E_INVALID_ARG,
+ "[E_INVALID_ARG] The file corresponding to contentPath could not be found.");
+
+ // need to create here to make sure that all get APIs will not crash in case of corrupted file
+ unique_ptr<VideoMetadata> pVideoMetadata(new (nothrow) VideoMetadata());
+ SysTryReturn(NID_CNT, pVideoMetadata != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory insufficient.");
+
+ _VideoMetadataImpl* pVideoMetaImpl = _VideoMetadataImpl::GetInstance(*(pVideoMetadata.get()));
+ SysTryReturn(NID_CNT, pVideoMetaImpl != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] pVideoMetaImpl is null.");
+
+ VideoMeta* pMetadata = pVideoMetaImpl->GetVideoMetadata();
+ SysTryReturn(NID_CNT, pMetadata != null, null, E_INVALID_ARG,
+ "[E_INVALID_ARG] pMetadata is null.");
+
+ pMetadata->contentPath = contentPath;
+
+ // Create the metadata extractor handle
+ unique_ptr<metadata_extractor_h, ExtractorDeleter> pExtractor(new (nothrow) metadata_extractor_h);
+ SysTryReturn(NID_CNT, pExtractor != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory insufficient.");
+
+ int retVal = metadata_extractor_create(pExtractor.get());
+ result r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, null, r,
+ "[%s] metadata_extractor_create failed.", GetErrorMessage(r));
+
+ // Set file path of content to extract the metadata
+ unique_ptr<char[]> pFileName(_StringConverter::CopyToCharArrayN(contentPath));
+ SysTryReturn(NID_CNT, pFileName != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ retVal = metadata_extractor_set_path(*(pExtractor.get()), pFileName.get());
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, null, r,
+ "[%s] metadata_extractor_set_path failed.", GetErrorMessage(r));
+
+ // Get all relavent video metadata by passing relavent attirbutes
+ char* __pVideoMeta = null;
+ unique_ptr<char, CharDeleter> pVideoMeta(null);
+
+ // width
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_WIDTH, &__pVideoMeta);
+ if (__pVideoMeta != null)
+ {
+ pVideoMeta.reset(__pVideoMeta);
+ pMetadata->width = atoi(pVideoMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(width) failed.", GetErrorMessage(r));
+ }
+
+ // height
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_HEIGHT, &__pVideoMeta);
+ if (__pVideoMeta != null)
+ {
+ pVideoMeta.reset(__pVideoMeta);
+ pMetadata->height = atoi(pVideoMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(height) failed.", GetErrorMessage(r));
+ }
+
+ // video bitrate
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_BITRATE, &__pVideoMeta);
+ if (__pVideoMeta != null)
+ {
+ pVideoMeta.reset(__pVideoMeta);
+ pMetadata->videoBitrate = atoi(pVideoMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(video bitrate) failed.", GetErrorMessage(r));
+ }
+
+ // audio bitrate
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_BITRATE, &__pVideoMeta);
+ if (__pVideoMeta != null)
+ {
+ pVideoMeta.reset(__pVideoMeta);
+ pMetadata->audioBitrate = atoi(pVideoMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(audio bitrate) failed.", GetErrorMessage(r));
+ }
+
+ // framerate
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_FPS, &__pVideoMeta);
+ if (__pVideoMeta != null)
+ {
+ pVideoMeta.reset(__pVideoMeta);
+ pMetadata->framerate = atoi(pVideoMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(framerate) failed.", GetErrorMessage(r));
+ }
+
+ // duration
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DURATION, &__pVideoMeta);
+ if (__pVideoMeta != null)
+ {
+ pVideoMeta.reset(__pVideoMeta);
+ pMetadata->duration = atoi(pVideoMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(duration) failed.", GetErrorMessage(r));
+ }
+
+ // genre
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_GENRE, &__pVideoMeta);
+ if (__pVideoMeta != null)
+ {
+ pVideoMeta.reset(__pVideoMeta);
+ pMetadata->pGenre = new (nothrow) String(pVideoMeta.get()); //allocate memory
+ SysTryReturn(NID_CNT, pMetadata->pGenre != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(genre) failed.", GetErrorMessage(r));
+ }
+
+ // comment
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_COMMENT, &__pVideoMeta);
+ if (__pVideoMeta != null)
+ {
+ pVideoMeta.reset(__pVideoMeta);
+ pMetadata->pComment = new (nothrow) String(pVideoMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pComment != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(comment) failed.", GetErrorMessage(r));
+ }
+
+ // description
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DESCRIPTION, &__pVideoMeta);
+ if (__pVideoMeta != null)
+ {
+ pVideoMeta.reset(__pVideoMeta);
+ pMetadata->pDescription = new (nothrow) String(pVideoMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pDescription != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(description) failed.", GetErrorMessage(r));
+ }
+
+ // artwork
+ int size = 0;
+ void* __pArtwork = null;
+ unique_ptr<void, VoidDeleter> pArtwork(null);
+
+ // Get the artwork image in media file
+ retVal = metadata_extractor_get_artwork(*(pExtractor.get()), &__pArtwork, &size, &__pVideoMeta);
+ if (__pArtwork != null)
+ {
+ pArtwork.reset(__pArtwork);
+
+ Image img;
+ ImageFormat format = IMG_FORMAT_NONE;
+ ByteBuffer buffer;
+
+ r = buffer.Construct(size);
+ if (!IsFailed(r)) //Ignore the error codes to send other metadata to app
+ {
+ r = buffer.SetArray((const byte*)(pArtwork.get()), 0, size);
+ if (!IsFailed(r))
+ {
+ r = img.Construct();
+ if (!IsFailed(r))
+ {
+ format = img.GetImageFormat(buffer);
+
+ pMetadata->pAlbumArt = img.DecodeN(buffer, format, BITMAP_PIXEL_FORMAT_ARGB8888);
+ if (pMetadata->pAlbumArt == null)
+ {
+ // Because Album Art is one of the metadata, it is not exception in this function.
+ SysLog(NID_CNT, "DecodeN failed.");
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_artwork failed.", GetErrorMessage(r));
+ }
+
+ return pVideoMetadata.release();
+}
+
+ImageMetadata*
+_ContentManagerUtilImpl::GetImageMetaN(const ByteBuffer& byteBuffer)
+{
+ ClearLastResult();
+
+ int bufferLen = byteBuffer.GetRemaining();
+ SysTryReturn(NID_CNT, bufferLen > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] The length of buffer is less than zero.");
+
+ // create object here as it needs to be passed to client in any case to make sure Get APIs do not crash
+ unique_ptr<ImageMetadata> pImageMetadata(new (nothrow) ImageMetadata());
+ SysTryReturn(NID_CNT, pImageMetadata != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] pImageMetadata is null.");
+
+ _ImageMetadataImpl* pImageMetaImpl = _ImageMetadataImpl::GetInstance(*(pImageMetadata.get()));
+ SysTryReturn(NID_CNT, pImageMetaImpl != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] pImageMetaImpl is null.");
+
+ ImageMeta* pMetadata = pImageMetaImpl->GetImageMetadata();
+ SysTryReturn(NID_CNT, pMetadata != null, null, E_INVALID_ARG,
+ "[E_INVALID_ARG] pMetadata is null.");
+
+ //assign by default here and overwrite below if width and height presents in EXIF data.
+ ImageFormat imgType = IMG_FORMAT_NONE;
+ int imageWidth = 0;
+ int imageHeight = 0;
+
+ result r = ImageBuffer::GetImageInfo(byteBuffer, imgType, imageWidth, imageHeight);
+ SysTryReturn(NID_CNT, r == E_SUCCESS, null, E_INVALID_ARG,
+ "[E_INVALID_ARG] GetImageInfo failed.");
+
+ pMetadata->width = imageWidth;
+ pMetadata->height = imageHeight;
+
+ if (imgType == IMG_FORMAT_JPG)
+ {
+ const byte* pByte = byteBuffer.GetPointer();
+
+ unique_ptr<ExifData, ExifDataDeleter> pExifdata(exif_data_new_from_data(pByte, bufferLen));
+ if (pExifdata != null)
+ {
+ ExifTag tag;
+ ExifByteOrder byteOrder;
+ ExifEntry** pEntries = null;
+ const char* pData = null;
+ char buf[IMAGE_BUFF_LENGTH] = {0, };
+ char mmBuff[IMAGE_BUFF_LENGTH] = {0, }; // to store minutes value of GPS data
+ char ssBuff[IMAGE_BUFF_LENGTH] = {0, }; // to store seconds value of GPS data
+ ExifContent* pExifcont[EXIF_IFD_COUNT];
+ int index = 0;
+ char latitudeRef = 0; // to store latitude reference (quadrasphere designation 'N', 'S', 'W' or 'E')
+ char longitudeRef = 0; // to store longitude reference (quadrasphere designation 'N', 'S', 'W' or 'E')
+ unsigned int entryCount = 0;
+
+ for (int i = 0; i < EXIF_IFD_COUNT; i++)
+ {
+ pExifcont[i] = pExifdata->ifd[i];
+ entryCount = pExifcont[i]->count;
+ pEntries = pExifcont[i]->entries;
+ for (unsigned int j = 0; j < entryCount; j++)
+ {
+ tag = pEntries[j]->tag;
+ pData = exif_entry_get_value(pEntries[j], buf, sizeof(buf));
+ SysTryReturn(NID_CNT, pData != null, pImageMetadata.release(), E_INVALID_ARG,
+ "[E_INVALID_ARG] exif_entry_get_value failed.");
+
+ if (tag == EXIF_TAG_PIXEL_X_DIMENSION)
+ {
+ pMetadata->width = atoi(buf);
+ }
+ else if (tag == EXIF_TAG_PIXEL_Y_DIMENSION)
+ {
+ pMetadata->height = atoi(buf);
+ }
+ else if (tag == EXIF_TAG_MAKE)
+ {
+ pMetadata->pManufacturer = new (nothrow) String(buf);
+ SysTryReturn(NID_CNT, pMetadata->pManufacturer != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else if (tag == EXIF_TAG_MODEL)
+ {
+ pMetadata->pModel = new (nothrow) String(buf);
+ SysTryReturn(NID_CNT, pMetadata->pModel != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else if (tag == EXIF_TAG_DATE_TIME)
+ {
+ pMetadata->pDateTime = new (nothrow) String(buf);
+ SysTryReturn(NID_CNT, pMetadata->pDateTime != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else if (tag == EXIF_TAG_ORIENTATION)
+ {
+ //get the byte order(little endian or big endian) before extracting orientation type
+ byteOrder = exif_data_get_byte_order(pEntries[j]->parent->parent);
+ pMetadata->orientation = static_cast<ImageOrientationType>(exif_get_short(pEntries[j]->data, byteOrder));
+ }
+ else if (tag == EXIF_TAG_SOFTWARE)
+ {
+ pMetadata->pSoftware = new (nothrow) String(buf);
+ SysTryReturn(NID_CNT, pMetadata->pSoftware != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else if (tag == EXIF_TAG_GPS_LATITUDE_REF)
+ {
+ latitudeRef = buf[0]; // GPS Latitude reference value will be 'N'(NORTH) or 'S'(SOUTH)
+ }
+ else if (tag == EXIF_TAG_GPS_LATITUDE)
+ {
+ ParseBuffer(buf, index); // to extract the minutes value of GPS data, if present
+ for (int l = 0; l < IMAGE_BUFF_LENGTH-1; l++)
+ {
+ mmBuff[l] = buf[l + index + 1]; //add 1 to skip the ','
+ }
+ index = 0; //re-assign index value as this is new buffer
+ ParseBuffer(mmBuff, index); // to extract the seconds value of GPS data, if present
+ for (int l = 0; l < IMAGE_BUFF_LENGTH-1; l++)
+ {
+ ssBuff[l] = mmBuff[l + index + 1]; //add 1 to skip the ','
+ }
+ double ddVal = atof(buf); // degree value
+ double mmVal = atof(mmBuff); // minutesvalue
+ double ssVal = atof(ssBuff); // seconds value
+ pMetadata->latitude = ddVal + (mmVal/MINUTES) + (ssVal/SECONDS);
+
+ // if latitude designation is Southern (SOUTH) then latitude degree will be negative DD
+ if (latitudeRef == 'S')
+ {
+ pMetadata->latitude = (pMetadata->latitude * (double)(-1));
+ }
+ }
+ else if (tag == EXIF_TAG_GPS_LONGITUDE_REF)
+ {
+ longitudeRef = buf[0]; // GPS Longitude reference value will be 'W'(WEST) or 'E'(EAST)
+ }
+ else if (tag == EXIF_TAG_GPS_LONGITUDE)
+ {
+ index = 0; //re-assign index value as this is new buffer
+ ParseBuffer(buf, index); // to extract the minutes value of GPS data, if present
+ for (int l = 0; l < IMAGE_BUFF_LENGTH-1; l++)
+ {
+ mmBuff[l] = buf[l + index + 1]; //add 1 to skip the ','
+ }
+ index = 0; //re-assign index value as this is new buffer
+ ParseBuffer(mmBuff, index); // to extract the seconds value of GPS data, if present
+ for (int l = 0; l < IMAGE_BUFF_LENGTH-1; l++)
+ {
+ ssBuff[l] = mmBuff[l + index + 1]; //add 1 to skip the ','
+ }
+ double ddVal = atof(buf); // degree value
+ double mmVal = atof(mmBuff); // minutesvalue
+ double ssVal = atof(ssBuff); // seconds value
+ pMetadata->longitude = ddVal + (mmVal/MINUTES) + (ssVal/SECONDS);
+
+ // if longitude designation is Western (WEST) then longitude degree will be negative DD
+ if (longitudeRef == 'W')
+ {
+ pMetadata->longitude = (pMetadata->longitude * (double)(-1));
+ }
+ }
+ else if (tag == EXIF_TAG_WHITE_BALANCE)
+ {
+ pMetadata->pWhiteBalance = new (nothrow) String(buf);
+ SysTryReturn(NID_CNT, pMetadata->pWhiteBalance != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ }
+ }
+ }
+ }
+
+ return pImageMetadata.release();
+}
+
+//
+// E_SUCCESS
+// E_INVALID_ARG
+// E_OUT_OF_MEMORY
+//
+AudioMetadata*
+_ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
+{
+ ClearLastResult();
+
+ int bufferLen = byteBuffer.GetRemaining();
+ SysTryReturn(NID_CNT, bufferLen > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] The length of buffer is less than zero.");
+
+ // create here to make sure that get apis will not crash though the below API calls fails in case of invalid file.
+ unique_ptr<AudioMetadata> pAudioMetadata(new (nothrow) AudioMetadata());
+ SysTryReturn(NID_CNT, pAudioMetadata != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ _AudioMetadataImpl* pAudioMetaImpl = _AudioMetadataImpl::GetInstance(*(pAudioMetadata.get()));
+ SysTryReturn(NID_CNT, pAudioMetaImpl != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] pAudioMetaImpl is null.");
+
+ AudioMeta* pMetadata = pAudioMetaImpl->GetAudioMetadata();
+ SysTryReturn(NID_CNT, pMetadata != null, null, E_INVALID_ARG,
+ "[E_INVALID_ARG] pMetadata is null.");
+
+ // Create the metadata extractor handle
+ unique_ptr<metadata_extractor_h, ExtractorDeleter> pExtractor(new (nothrow) metadata_extractor_h);
+ SysTryReturn(NID_CNT, pExtractor != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ int retVal = metadata_extractor_create(pExtractor.get());
+ result r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, null, r,
+ "[%s] metadata_extractor_create failed.", GetErrorMessage(r));
+
+ const byte* pByte = byteBuffer.GetPointer();
+
+ retVal = metadata_extractor_set_buffer(*(pExtractor.get()), pByte, bufferLen);
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, null, r,
+ "[%s] metadata_extractor_set_path failed.", GetErrorMessage(r));
+
+ // Get all relavent audio metadata by passing relavent attirbutes
+ char* __pAudioMeta = null;
+ unique_ptr<char, CharDeleter> pAudioMeta(null);
+
+ // bitrate
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_BITRATE, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->bitrate = atoi(pAudioMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(bitrate) failed.", GetErrorMessage(r));
+ }
+
+ // channelcount
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_CHANNELS, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->channelCount = atoi(pAudioMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(channels) failed.", GetErrorMessage(r));
+ }
+
+ // duration
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DURATION, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->duration = atoi(pAudioMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(duration) failed.", GetErrorMessage(r));
+ }
+
+ // frequency
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_SAMPLERATE, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->frequency = atoi(pAudioMeta.get());
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(frequency) failed.", GetErrorMessage(r));
+ }
+
+ // albumname
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_ALBUM, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->pAlbumName = new (nothrow) String(pAudioMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pAlbumName != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(album name) failed.", GetErrorMessage(r));
+ }
+
+ // artist
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_ARTIST, &__pAudioMeta);
+ if (pAudioMeta.get() != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->pArtist = new (nothrow) String(pAudioMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pArtist != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(artist) failed.", GetErrorMessage(r));
+ }
+
+ // copyright
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_COPYRIGHT, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->pCopyright = new (nothrow) String(pAudioMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pCopyright != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(copyright) failed.", GetErrorMessage(r));
+ }
+
+ // genre
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_GENRE, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->pGenre = new (nothrow) String(pAudioMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pGenre != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(genre) failed.", GetErrorMessage(r));
+ }
+
+ // title
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_TITLE, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->pTitle = new (nothrow) String(pAudioMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pTitle != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(title) failed.", GetErrorMessage(r));
+ }
+
+ // comment
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_COMMENT, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
pMetadata->pComment = new (nothrow) String(pAudioMeta.get());
SysTryReturn(NID_CNT, pMetadata->pComment != null, null, E_OUT_OF_MEMORY,
"[E_OUT_OF_MEMORY] The memory is insufficient.");
{
r = ErrorMapToRetVal(retVal);
SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(comment) failed.", GetErrorMessage(r));
+ }
+
+ // description
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DESCRIPTION, &__pAudioMeta);
+ if (__pAudioMeta != null)
+ {
+ pAudioMeta.reset(__pAudioMeta);
+ pMetadata->pDescription = new (nothrow) String(pAudioMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pDescription != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pAudioMetadata.release(), r,
"[%s] metadata_extractor_get_metadata(description) failed.", GetErrorMessage(r));
}
// E_OUT_OF_MEMORY
//
VideoMetadata*
-_ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
+_ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
{
ClearLastResult();
- SysTryReturn(NID_CNT, VerifyFilePathCompatibility(contentPath), null, E_INVALID_ARG,
- "[E_INVALID_ARG] %ls is not compatible.", contentPath.GetPointer());
- SysTryReturn(NID_CNT, _FileImpl::IsFileExist(contentPath), null, E_INVALID_ARG,
- "[E_INVALID_ARG] The file corresponding to contentPath could not be found.");
+ int bufferLen = byteBuffer.GetRemaining();
+ SysTryReturn(NID_CNT, bufferLen > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] The length of buffer is less than zero.");
// need to create here to make sure that all get APIs will not crash in case of corrupted file
unique_ptr<VideoMetadata> pVideoMetadata(new (nothrow) VideoMetadata());
SysTryReturn(NID_CNT, pMetadata != null, null, E_INVALID_ARG,
"[E_INVALID_ARG] pMetadata is null.");
- pMetadata->contentPath = contentPath;
-
// Create the metadata extractor handle
unique_ptr<metadata_extractor_h, ExtractorDeleter> pExtractor(new (nothrow) metadata_extractor_h);
SysTryReturn(NID_CNT, pExtractor != null, null, E_OUT_OF_MEMORY,
SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, null, r,
"[%s] metadata_extractor_create failed.", GetErrorMessage(r));
- // Set file path of content to extract the metadata
- unique_ptr<char[]> pFileName(_StringConverter::CopyToCharArrayN(contentPath));
- SysTryReturn(NID_CNT, pFileName != null, null, E_OUT_OF_MEMORY,
- "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ const byte* pByte = byteBuffer.GetPointer();
- retVal = metadata_extractor_set_path(*(pExtractor.get()), pFileName.get());
+ retVal = metadata_extractor_set_buffer(*(pExtractor.get()), pByte, bufferLen);
r = ErrorMapToRetVal(retVal);
SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, null, r,
"[%s] metadata_extractor_set_path failed.", GetErrorMessage(r));
"[%s] metadata_extractor_get_metadata(genre) failed.", GetErrorMessage(r));
}
+ // comment
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_COMMENT, &__pVideoMeta);
+ if (__pVideoMeta != null)
+ {
+ pVideoMeta.reset(__pVideoMeta);
+ pMetadata->pComment = new (nothrow) String(pVideoMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pComment != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(comment) failed.", GetErrorMessage(r));
+ }
+
+ // description
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DESCRIPTION, &__pVideoMeta);
+ if (__pVideoMeta != null)
+ {
+ pVideoMeta.reset(__pVideoMeta);
+ pMetadata->pDescription = new (nothrow) String(pVideoMeta.get());
+ SysTryReturn(NID_CNT, pMetadata->pDescription != null, null, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, pVideoMetadata.release(), r,
+ "[%s] metadata_extractor_get_metadata(description) failed.", GetErrorMessage(r));
+ }
+
// artwork
int size = 0;
void* __pArtwork = null;
"[E_INVALID_ARG] The length of contentPath is 0.");
SysTryReturn(NID_CNT, _FileImpl::IsFileExist(contentPath), contentType, E_FILE_NOT_FOUND,
"[E_FILE_NOT_FOUND] The file corresponding to contentPath could not be found.");
- String fileExt = _FileImpl::GetFileExtension(contentPath);
-
- // The type of ISMA and ISMV can be changed from other to video.
- String format;
- fileExt.ToLowerCase(format);
-
- if (format == L"isma" || format == L"ismv")
- {
- contentType = GetDrmFileType(format);
- result r = GetLastResult();
- SysTryReturn(NID_CNT, !IsFailed(r), contentType, r, "[%s] GetDrmFileType failed.", GetErrorMessage(r));
-
- return contentType;
- }
- int index = 0;
+ String fileExt = _FileImpl::GetFileExtension(contentPath);
+ result r = GetLastResult();
+ SysTryReturn(NID_CNT, !IsFailed(r), contentType, r, "[%s] GetFileExtension failed.", GetErrorMessage(r));
- result r = String(CONTENT_FORMAT).LastIndexOf(format, String(CONTENT_FORMAT).GetLength() - 1, index);
- if (IsFailed(r))
- {
- if (r == E_OBJ_NOT_FOUND)
- {
- SysLogException(NID_CNT, E_UNSUPPORTED_FORMAT,
- "[E_UNSUPPORTED_FORMAT] The file format is not supported[%ls].", format.GetPointer());
- }
- else
- {
- SysLogException(NID_CNT, E_INVALID_ARG,
- "[E_INVALID_ARG] The contentPath is invalid[%ls].", contentPath.GetPointer());
- }
- return contentType;
- }
+ unique_ptr<char[]> pFormat(_StringConverter::CopyToCharArrayN(fileExt));
+ SysTryReturn(NID_CNT, pFormat != null, contentType, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
- String subStr;
- int length = fileExt.GetLength();
+ char* __pMimeType = null;
+ int retVal = mime_type_get_mime_type(pFormat.get(), &__pMimeType);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, contentType, E_INVALID_ARG,
+ "[E_INVALID_ARG] mime_type_get_mime_type failed.");
+ SysTryReturn(NID_CNT, __pMimeType != null, contentType, E_INVALID_ARG,
+ "[E_INVALID_ARG] mime_type_get_mime_type failed.");
- r = String(CONTENT_FORMAT).SubString(index+length, 1, subStr);
- SysTryReturn(NID_CNT, !(IsFailed(r)), contentType, E_INVALID_ARG, "[E_INVALID_ARG] SubString failed.");
+ unique_ptr<char, CharDeleter> pMimeType;
+ pMimeType.reset(__pMimeType);
- SysLog(NID_CNT, "index = %d, length = %d, subStr = %ls", index, length, subStr.GetPointer());
+ SysLog(NID_CNT, "The MIME type for %ls is %s", fileExt.GetPointer(), __pMimeType);
- const String image(L"1");
- const String audio(L"2");
- const String video(L"3");
- const String other(L"0");
- const String audioOrVideo(L"5");
+ String mimeType(pMimeType.get());
- if (subStr.CompareTo(image) == 0)
+ if (mimeType.Contains(L"image"))
{
return CONTENT_TYPE_IMAGE;
}
- else if (subStr.CompareTo(audio) == 0)
+ else if (mimeType.Contains(L"audio"))
{
+ if (mimeType.Contains(L"x-mpegurl"))
+ {
+ SysLog(NID_CNT, "The type of x-mpegurl is other.");
+ return CONTENT_TYPE_OTHER;
+ }
return CONTENT_TYPE_AUDIO;
}
- else if (subStr.CompareTo(video) == 0)
+ else if (mimeType.Contains(L"video"))
{
+ String format;
+ fileExt.ToLowerCase(format);
+
+ if (format == L"3gp" || format == L"mp4")
+ {
+ return CheckStream(contentPath);
+ }
return CONTENT_TYPE_VIDEO;
}
- else if (subStr.CompareTo(other) == 0)
+ else if (mimeType.Contains(L"application"))
{
+ if (mimeType.Contains(L"x-smaf"))
+ {
+ SysLog(NID_CNT, "The type of x-smaf is audio.");
+ return CONTENT_TYPE_AUDIO;
+ }
return CONTENT_TYPE_OTHER;
}
- else if (subStr.CompareTo(audioOrVideo) == 0)
- {
- //Create metadata extractor handle
- unique_ptr<metadata_extractor_h, ExtractorDeleter> pExtractor(new (nothrow) metadata_extractor_h);
- SysTryReturn(NID_CNT, pExtractor != null, contentType, E_OUT_OF_MEMORY,
- "[E_OUT_OF_MEMORY] The memory is insufficient.");
- int retVal = metadata_extractor_create(pExtractor.get());
- result r = ErrorMapToRetVal(retVal);
- SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, contentType, r,
- "[%s] metadata_extractor_create failed.", GetErrorMessage(r));
+ return CONTENT_TYPE_OTHER;
+}
- //Set file path of content to extract metadata.
- unique_ptr<char[]> pContentPath(_StringConverter::CopyToCharArrayN(contentPath));
- SysTryReturn(NID_CNT, pContentPath != null, contentType, E_INVALID_ARG,
- "[E_INVALID_ARG] The memory is insufficient.");
+ContentType
+_ContentManagerUtilImpl::CheckStream(const String& contentPath)
+{
+ ClearLastResult();
- retVal = metadata_extractor_set_path(*(pExtractor.get()), pContentPath.get());
- r = ErrorMapToRetVal(retVal);
- SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE && pExtractor, contentType, r,
- "[%s] metadata_extractor_set_path failed.", GetErrorMessage(r));
+ ContentType contentType = CONTENT_TYPE_UNKNOWN;
- //Get the metadata info, to check whether audio or video present in the file
- char* __pAudio = null;
- unique_ptr<char> pAudio(null);
+ unique_ptr<metadata_extractor_h, ExtractorDeleter> pExtractor(new (nothrow) metadata_extractor_h);
+ SysTryReturn(NID_CNT, pExtractor != null, contentType, E_OUT_OF_MEMORY,
+ "[E_OUT_OF_MEMORY] The memory is insufficient.");
- char* __pVideo = null;
- unique_ptr<char> pVideo(null);
+ int retVal = metadata_extractor_create(pExtractor.get());
+ result r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, contentType, r,
+ "[%s] metadata_extractor_create failed.", GetErrorMessage(r));
- retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_HAS_AUDIO, &__pAudio);
- if (__pAudio != null)
- {
- pAudio.reset(__pAudio);
- }
- else
- {
- r = ErrorMapToRetVal(retVal);
- SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, contentType, r,
- "[%s] metadata_extractor_get_metadata failed.", GetErrorMessage(r));
- }
+ //Set the file path to extract metadata.
+ unique_ptr<char[]> pContentPath(_StringConverter::CopyToCharArrayN(contentPath));
+ SysTryReturn(NID_CNT, pContentPath != null, contentType, E_INVALID_ARG,
+ "[E_INVALID_ARG] The memory is insufficient.");
- retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_HAS_VIDEO, &__pVideo);
- if (__pVideo != null)
- {
- pVideo.reset(__pVideo);
- }
- else
- {
- r = ErrorMapToRetVal(retVal);
- SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, contentType, r,
- "[%s] metadata_extractor_get_metadata failed.", GetErrorMessage(r));
- }
+ retVal = metadata_extractor_set_path(*(pExtractor.get()), pContentPath.get());
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE && pExtractor, contentType, r,
+ "[%s] metadata_extractor_set_path failed.", GetErrorMessage(r));
- if (*(pAudio.get()) > 0 && *(pVideo.get()) == 0)
- {
- contentType = CONTENT_TYPE_AUDIO;
- }
- else if (*(pAudio.get()) == 0 && *(pVideo.get()) > 0)
- {
- contentType = CONTENT_TYPE_VIDEO;
- }
- else if (*(pAudio.get()) > 0 && *(pVideo.get()) > 0)
- {
- contentType = CONTENT_TYPE_VIDEO;
- }
- else
- {
- SysLogException(NID_CNT, E_UNSUPPORTED_FORMAT, "[E_UNSUPPORTED_FORMAT] The stream is empty.");
- }
+ //Check whether it is an audio or video file.
+ char* __pAudio = null;
+ unique_ptr<char, CharDeleter> pAudio(null);
+
+ char* __pVideo = null;
+ unique_ptr<char, CharDeleter> pVideo(null);
+
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_HAS_AUDIO, &__pAudio);
+ if (__pAudio != null)
+ {
+ pAudio.reset(__pAudio);
}
else
{
- // The file extension is invalid(.jp, .bm, .m).
- SysLogException(NID_CNT, E_UNSUPPORTED_FORMAT,
- "[E_UNSUPPORTED_FORMAT] The file extension is invalid[%ls].", subStr.GetPointer());
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, contentType, r,
+ "[%s] metadata_extractor_get_metadata failed.", GetErrorMessage(r));
}
- return contentType;
-}
-
-ContentType
-_ContentManagerUtilImpl::GetDrmFileType(const String& fileExt)
-{
- ClearLastResult();
-
- unique_ptr<char[]> pFormat(_StringConverter::CopyToCharArrayN(fileExt));
- SysTryReturn(NID_CNT, pFormat != null, CONTENT_TYPE_UNKNOWN, E_OUT_OF_MEMORY,
- "The memory is insufficient.");
-
- char* __pMimeType = null;
- int retVal = mime_type_get_mime_type(pFormat.get(), &__pMimeType);
- SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, CONTENT_TYPE_UNKNOWN, E_INVALID_ARG,
- "mime_type_get_mime_type failed.");
- SysTryReturn(NID_CNT, __pMimeType != null, CONTENT_TYPE_UNKNOWN, E_INVALID_ARG,
- "mime_type_get_mime_type failed.");
-
- unique_ptr<char, CharDeleter> pMimeType;
- pMimeType.reset(__pMimeType);
-
- SysLog(NID_CNT, "The MIME type for %ls is %s", fileExt.GetPointer(), __pMimeType);
-
- String mimeType(pMimeType.get());
+ retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_HAS_VIDEO, &__pVideo);
+ if (__pVideo != null)
+ {
+ pVideo.reset(__pVideo);
+ }
+ else
+ {
+ r = ErrorMapToRetVal(retVal);
+ SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, contentType, r,
+ "[%s] metadata_extractor_get_metadata failed.", GetErrorMessage(r));
+ }
- if (mimeType == L"audio/mp4")
+ if (*(pAudio.get()) > 0 && *(pVideo.get()) == 0)
{
+ SysLog(NID_CNT, "The result of CheckStream() is audio");
return CONTENT_TYPE_AUDIO;
}
- else if (mimeType == L"video/mp4")
+ else if (*(pAudio.get()) == 0 && *(pVideo.get()) > 0)
{
+ SysLog(NID_CNT, "The result of CheckStream() is video");
return CONTENT_TYPE_VIDEO;
}
- else if (mimeType == L"application/octet-stream")
+ else if (*(pAudio.get()) > 0 && *(pVideo.get()) > 0)
{
- return CONTENT_TYPE_OTHER;
+ SysLog(NID_CNT, "The result of CheckStream() is video");
+ return CONTENT_TYPE_VIDEO;
}
else
{
- SysLogException(NID_CNT, E_UNSUPPORTED_FORMAT, "The MIME type is invalid.");
+ SysLogException(NID_CNT, E_UNSUPPORTED_FORMAT, "[E_UNSUPPORTED_FORMAT] The stream is empty.");
}
- return CONTENT_TYPE_UNKNOWN;
+ return contentType;
}
bool
* This file contains implementation of the %_ContentSearchImpl class.\r
*/\r
\r
-// includes\r
-\r
#include <time.h>\r
#include <FBaseSysLog.h>\r
#include <FBaseInteger.h>\r
#include <FCnt_ContentUtility.h>\r
#include <FCnt_ContentSearchImpl.h>\r
\r
-// using namespace\r
using namespace Tizen::Base;\r
using namespace Tizen::Base::Collection;\r
using namespace Tizen::Base::Utility;\r
* This file contains implementation of the %_ContentUtility class.
*/
-// includes
-
#include <unique_ptr.h>
#include <FBaseSysLog.h>
#include <FBaseInteger.h>
#include <FBaseFloat.h>
#include <FCnt_ContentUtility.h>
-// using namespace
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
std::unique_ptr<char, UtilCharDeleter> pProvider;
std::unique_ptr<char, UtilCharDeleter> pKeyword;
std::unique_ptr<char, UtilCharDeleter> pContentRating;
+ std::unique_ptr<char, UtilCharDeleter> pMimeType;
media_content_type_e mediaType;
media_content_storage_e storageType;
ret = media_info_get_media_type(mediaHandle, &mediaType);
SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform media_info_get_media_type operation.");
+ ret = media_info_get_mime_type(mediaHandle, &pGetMediaValue);
+ if (pGetMediaValue != null)
+ {
+ pMimeType.reset(pGetMediaValue);
+ }
+ else
+ {
+ SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform media_info_get_mime_type operation.");
+ }
+
ret = media_info_get_keyword(mediaHandle, &pGetMediaValue);
if (pGetMediaValue != null)
{
SysLog(NID_CNT, "pContentData->pKeyword = %ls", pContentData->pKeyword->GetPointer());
}
+ if (pMimeType.get() != NULL)
+ {
+ pContentData->mimeType = String(pMimeType.get());
+ SysLog(NID_CNT, "pContentData->mimeType = %ls", (pContentData->mimeType).GetPointer());
+ }
+
switch (storageType)
{
case MEDIA_CONTENT_STORAGE_INTERNAL:
#include <FBaseSysLog.h>
#include <FBase_StringConverter.h>
+#include <FBaseInteger.h>
+#include <FBaseRtIEventArg.h>
#include <FBaseColIMap.h>
#include <FApp_AppInfo.h>
#include <FCntDownloadRequest.h>
#include <FCntIDownloadListener.h>
+#include <FCnt_DownloadRequestImpl.h>
#include "FCnt_DownloadManagerImpl.h"
using namespace std;
using namespace Tizen::Base;
+using namespace Tizen::Base::Runtime;
using namespace Tizen::Base::Collection;
namespace Tizen { namespace Content
_DownloadManagerImpl* _DownloadManagerImpl::__pInstance = null;
+class _DownloadEventArg
+ : public IEventArg
+{
+public:
+ _DownloadEventArg()
+ : __id(-1)
+ , __state((download_state_e)DOWNLOAD_STATE_NONE)
+ , __result(-1)
+ , __received(-1)
+ , __total(-1)
+ {
+ }
+ RequestId __id;
+ download_state_e __state;
+ String __path;
+ result __result;
+ String __errorCode;
+ unsigned long long __received;
+ unsigned long long __total;
+};
+
+class _DownloadEvent
+ : public Event
+{
+protected:
+ virtual void FireImpl(IEventListener& listener, const IEventArg& arg)
+ {
+ IDownloadListener* pListener = dynamic_cast<IDownloadListener*> (&listener);
+ if (pListener != null)
+ {
+ const _DownloadEventArg* pArg = dynamic_cast<const _DownloadEventArg*>(&arg);
+ if (pArg != null)
+ {
+ switch(pArg->__state)
+ {
+ case DOWNLOAD_STATE_NONE:
+ case DOWNLOAD_STATE_QUEUED:
+ break;
+
+ case DOWNLOAD_STATE_DOWNLOADING:
+ pListener->OnDownloadInProgress(pArg->__id, pArg->__received, pArg->__total);
+ break;
+
+ case DOWNLOAD_STATE_PAUSED:
+ pListener->OnDownloadPaused(pArg->__id);
+ break;
+
+ case DOWNLOAD_STATE_COMPLETED:
+ pListener->OnDownloadCompleted(pArg->__id, pArg->__path);
+ break;
+
+ case DOWNLOAD_STATE_FAILED:
+ pListener->OnDownloadFailed(pArg->__id, pArg->__result, pArg->__errorCode);
+ break;
+
+ case DOWNLOAD_STATE_CANCELED:
+ pListener->OnDownloadCanceled(pArg->__id);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+};
+
static void
OnStateChanged(int download_id, download_state_e state, void* data)
{
_DownloadManagerImpl* pDMImpl = (_DownloadManagerImpl*)data;
- if (!data || !pDMImpl->__pListener)
+ if (!data || !pDMImpl->__pEvent)
{
return;
}
break;
case DOWNLOAD_STATE_PAUSED:
- pDMImpl->__pListener->OnDownloadPaused(reqId);
- break;
+ {
+ _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
+ pEventArg->__id = reqId;
+ pEventArg->__state = state;
+
+ pDMImpl->__pEvent->Fire(*pEventArg);
+ break;
+ }
case DOWNLOAD_STATE_COMPLETED:
{
+ _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
+ pEventArg->__id = reqId;
+ pEventArg->__state = state;
+
char* path = null;
download_get_downloaded_file_path(download_id, &path);
- pDMImpl->__pListener->OnDownloadCompleted(reqId, path);
+ pEventArg->__path = path;
delete[] path;
+ pDMImpl->__pEvent->Fire(*pEventArg);
+
// Remove the resource from url_download
pDMImpl->DestroyResources(reqId);
+
break;
}
case DOWNLOAD_STATE_FAILED:
{
- result r = E_SUCCESS;
- download_error_e error;
- int http_status = 0;
+ _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
+ pEventArg->__id = reqId;
+ pEventArg->__state = state;
+ download_error_e error;
download_get_error(download_id, &error);
+ pEventArg->__result = pDMImpl->ConvertToResult(error);
+
+ int http_status = 0;
download_get_http_status(download_id, &http_status);
- r = pDMImpl->ConvertToResult(error);
+ pEventArg->__errorCode = Integer::ToString(http_status);
- String errorCode;
- pDMImpl->__pListener->OnDownloadFailed(reqId, r, http_status);
+ pDMImpl->__pEvent->Fire(*pEventArg);
// Comment out due to resume the failed request
//pDMImpl->DestroyResources(reqId);
+
break;
}
case DOWNLOAD_STATE_CANCELED:
- pDMImpl->__pListener->OnDownloadCanceled(reqId);
+ {
+ _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
+ pEventArg->__id = reqId;
+ pEventArg->__state = state;
+
+ pDMImpl->__pEvent->Fire(*pEventArg);
// Remove the resource from url_download
pDMImpl->DestroyResources(reqId);
- break;
+ break;
+ }
default:
break;
}
_DownloadManagerImpl* pDMImpl = (_DownloadManagerImpl*)data;
- if (data && pDMImpl->__pListener)
+ if (data && pDMImpl->__pEvent)
{
+ _DownloadEventArg* pEventArg = new (std::nothrow) _DownloadEventArg();
+ pEventArg->__id = reqId;
+ pEventArg->__state = (download_state_e)DOWNLOAD_STATE_DOWNLOADING;
+ pEventArg->__received = received;
+
unsigned long long total = 0;
download_get_content_size(download_id, &total);
+ pEventArg->__total = total;
SysLog(NID_CNT, "OnProgress, id = %d, received = %lld, total = %lld", download_id, received, total);
- pDMImpl->__pListener->OnDownloadInProgress(reqId, received, total);
+ pDMImpl->__pEvent->Fire(*pEventArg);
}
}
_DownloadManagerImpl::_DownloadManagerImpl(void)
- : __pListener(null)
+ : __pEvent(null)
{
}
_DownloadManagerImpl::~_DownloadManagerImpl(void)
{
+ if (__pEvent)
+ {
+ delete __pEvent;
+ }
}
result
result r = E_SUCCESS;
r = __handleMap.Construct(100, 0);
+ SysTryReturnResult(NID_IO, r == E_SUCCESS, r, "Failed to initialize a download manager.");
- return r;
+ return E_SUCCESS;
}
void
String url = request.GetUrl();
String dirPath = request.GetDirectoryPath();
String fileName = request.GetFileName();
+ NetworkType networkType = (NetworkType)request.GetNetworkType();
SysTryReturnResult(NID_CNT, !url.IsEmpty(), E_INVALID_ARG, "The url of the download request is empty.");
// Create a download id
ret = download_create(&download_id);
- SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available.");
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
// Set the url
unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
ret = download_set_url(download_id, pUrl.get());
- SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available.");
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
+
+ //Set network type
+ if (networkType == NETWORK_ALL)
+ {
+ ret = download_set_network_type(download_id, (download_network_type_e)DOWNLOAD_NETWORK_ALL);
+ }
+ else
+ {
+ ret = download_set_network_type(download_id, (download_network_type_e)networkType);
+ }
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
+
+ //Set notification
+ ret = download_set_notification(download_id, request.IsNotificationEnabled());
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
+
+ //Set notification extra data
+ std::unique_ptr<IMapEnumerator> pMapEnum(const_cast< IMap* >(request.GetNotificationExtraData())->GetMapEnumeratorN());
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ String* pMapKey = dynamic_cast<String*>(pMapEnum->GetKey());
+ unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pMapKey));
+ String* pMapValue = dynamic_cast<String*>(pMapEnum->GetValue());
+ const char* pValue = _StringConverter::CopyToCharArrayN(*pMapValue);
+
+ ret = download_add_notification_extra_param(download_id, pKey.get(), &pValue, 1);
+ delete[] pValue;
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
+ }
+
+ //Add http headers
+ IMap* pRequestHeader = _DownloadRequestImpl::GetInstance(&request)->GetRequestHeader();
+ std::unique_ptr<IMapEnumerator> pMapEnume(const_cast< IMap* >(pRequestHeader)->GetMapEnumeratorN());
+ while (pMapEnume->MoveNext() == E_SUCCESS)
+ {
+ String* pMapKey = dynamic_cast<String*>(pMapEnume->GetKey());
+ unique_ptr<char[]> pKey(_StringConverter::CopyToCharArrayN(*pMapKey));
+ String* pMapValue = dynamic_cast<String*>(pMapEnume->GetValue());
+ unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pMapValue));
+
+ ret = download_add_http_header_field(download_id, pKey.get(), pValue.get());
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
+ }
// Check the download path
if (!dirPath.IsEmpty())
}
ret = download_set_destination(download_id, pStr.get());
- SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available.");
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
}
// Set the file name
unique_ptr<char[]> pStr(_StringConverter::CopyToCharArrayN(fileName));
ret = download_set_file_name(download_id, pStr.get());
- SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available.");
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
}
// Set the callback functions
// Start the download request
ret = download_start(download_id);
SysTryCatch(NID_CNT, ret != DOWNLOAD_ERROR_INVALID_PARAMETER, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is not valid");
- SysTryCatch(NID_CNT, ret >= 0, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] The internal system service is not available. error = %d", ret);
+ SysTryCatch(NID_CNT, ret >= 0, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] The internal system service is not available. %d", ret);
// Set a request Id
reqId = (long)download_id;
result r = E_SUCCESS;
int ret = 0;
- DownloadRequest* pRequest = null;
State state = STATE_NONE;
- // Check the request Id
- pRequest = GetDownloadRequestN(reqId);
- if(pRequest == null)
- {
- r = GetLastResult();
- SysPropagate(NID_CNT, r);
- return r;
- }
-
- delete pRequest;
-
// Get the current state
state = GetState(reqId);
+ SysTryReturnResult(NID_CNT, state != STATE_NONE, E_INVALID_ARG, "There is no download request for the request ID.");
// Check the pre-state
r = CheckPrestate(DOWNLOAD_OPERATION_PAUSE, state);
// Pause the download request
ret = download_pause((int)reqId);
- SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available.");
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
return E_SUCCESS;
}
result r = E_SUCCESS;
int ret = 0;
-
- DownloadRequest* pRequest = null;
State state = STATE_NONE;
- // Check the request Id
- pRequest = GetDownloadRequestN(reqId);
- if(pRequest == null)
- {
- r = GetLastResult();
- SysPropagate(NID_CNT, r);
- return r;
- }
- delete pRequest;
-
// Get the current state
state = GetState(reqId);
+ SysTryReturnResult(NID_CNT, state != STATE_NONE, E_INVALID_ARG, "There is no download request for the request ID.");
// Check the pre-state
r = CheckPrestate(DOWNLOAD_OPERATION_RESUME, state);
// Resume the download request
ret = download_start((int)reqId);
- SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available.");
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
return E_SUCCESS;
}
_DownloadManagerImpl::Cancel(RequestId reqId)
{
int ret = 0;
+ State state = STATE_NONE;
- DownloadRequest* pRequest = null;
-
- // Check the request Id
- pRequest = GetDownloadRequestN(reqId);
- if(pRequest == null)
- {
- result r = GetLastResult();
- SysPropagate(NID_CNT, r);
- return r;
- }
-
- delete pRequest;
+ // Get the current state
+ state = GetState(reqId);
+ SysTryReturnResult(NID_CNT, state != STATE_NONE, E_INVALID_ARG, "There is no download request for the request ID.");
// Stop the download request
ret = download_cancel((int)reqId);
- SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available.");
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
return E_SUCCESS;
}
DownloadRequest* pRequest = null;
r = __handleMap.GetValue(reqId, pRequest);
- SysTryReturn(NID_CNT, r == E_SUCCESS, null, E_INVALID_ARG, "[E_INVALID_ARG] There is no download request for the request ID");
+ SysTryReturn(NID_CNT, r == E_SUCCESS, null, E_INVALID_ARG, "[E_INVALID_ARG] There is no download request for the request ID.");
pRequest = new (std::nothrow) DownloadRequest(*pRequest);
SysTryReturn(NID_CNT, pRequest != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
ret = download_get_mime_type((int)reqId, &pStr);
SysTryReturnResult(NID_CNT, ret != DOWNLOAD_ERROR_INVALID_STATE, E_INVALID_OPERATION, "The current download state is not downloading or paused.");
- SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available.");
+ SysTryReturnResult(NID_CNT, ret >= 0, E_SYSTEM, "The internal system service is not available. %d", ret);
mimeType = pStr;
delete[] pStr;
{
int ret = 0;
- download_state_e download_state = DOWNLOAD_STATE_NONE;
+ download_state_e download_state = (download_state_e)DOWNLOAD_STATE_NONE;
State state = STATE_NONE;
ret = download_get_state((int)reqId, &download_state);
- SysTryReturn(NID_CNT, ret >= 0, STATE_NONE, E_SYSTEM, "[E_SYSTEM] The internal system service is not available.");
+ SysTryReturn(NID_CNT, ret != DOWNLOAD_ERROR_ID_NOT_FOUND, STATE_NONE, E_INVALID_ARG, "[E_INVALID_ARG] The request ID is not valid.");
+ SysTryReturn(NID_CNT, ret >= 0, STATE_NONE, E_SYSTEM, "[E_SYSTEM] The internal system service is not available. %d", ret);
switch(download_state)
{
state = STATE_NONE;
break;
- case DOWNLOAD_STATE_READY:
- state = STATE_QUEUED;
- break;
+ //case DOWNLOAD_STATE_READY:
+ // state = STATE_QUEUED;
+ // break;
case DOWNLOAD_STATE_QUEUED:
state = STATE_QUEUED;
break;
default:
- state = STATE_NONE;
+ //state = STATE_NONE;
+ state = STATE_QUEUED;
break;
}
void
_DownloadManagerImpl::SetDownloadListener(IDownloadListener* pListener)
{
- __pListener = pListener;
+ if (pListener != null)
+ {
+ _DownloadEvent* pEvent = new (std::nothrow) _DownloadEvent();
+ SysTryReturnVoidResult(NID_IO, pEvent != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+ pEvent->AddListener(*pListener);
+
+ __pEvent = pEvent;
+ }
+ else
+ {
+ if (__pEvent != null)
+ {
+ delete __pEvent;
+ }
+
+ __pEvent = null;
+ }
}
result
break;
case DOWNLOAD_OPERATION_RESUME:
- // Check the pre-state: paused
+ // Check the pre-state: paused / failed
SysTryReturnResult(NID_CNT, !(current != STATE_PAUSED && current != STATE_FAILED), E_INVALID_OPERATION,
"The current download state is not STATE_PAUSED or STATE_FAILED.");
break;
case DOWNLOAD_OPERATION_CANCEL:
- // Check the pre-state: downloading
- //SysTryReturnResult(NID_CNT, current == STATE_DOWNLOADING, E_INVALID_OPERATION,
- //"The current download state prohibits the execution of this operation.");
break;
default:
r = E_INVALID_URL;
break;
+ case DOWNLOAD_ERROR_ID_NOT_FOUND:
+ r = E_INVALID_ARG;
+ break;
+
case DOWNLOAD_ERROR_CONNECTION_FAILED:
case DOWNLOAD_ERROR_NETWORK_UNREACHABLE:
r = E_CONNECTION_FAILED;
*
*/
+#include <unique_ptr.h>
#include <FBaseLog.h>
+#include <FBaseSysLog.h>
+#include <FCntDownloadRequest.h>
#include "FCnt_DownloadRequestImpl.h"
using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace std;
namespace Tizen { namespace Content
{
_DownloadRequestImpl::_DownloadRequestImpl(void)
+ : __notification(true)
+ , __networkType(DOWNLOAD_NETWORK_ALL)
{
+ __notifyExtraData.Construct();
+ __requestHeader.Construct();
}
_DownloadRequestImpl::_DownloadRequestImpl(const String& url)
: __url(url)
+ , __notification(true)
+ , __networkType(DOWNLOAD_NETWORK_ALL)
{
+ __notifyExtraData.Construct();
+ __requestHeader.Construct();
}
_DownloadRequestImpl::_DownloadRequestImpl(const String& url, const String& dirPath)
: __url(url)
, __dirPath(dirPath)
+ , __notification(true)
+ , __networkType(DOWNLOAD_NETWORK_ALL)
{
+ __notifyExtraData.Construct();
+ __requestHeader.Construct();
}
_DownloadRequestImpl::_DownloadRequestImpl(const _DownloadRequestImpl& rhs)
: __url(rhs.__url)
, __dirPath(rhs.__dirPath)
, __fileName(rhs.__fileName)
+ , __notification(rhs.__notification)
+ , __networkType(rhs.__networkType)
{
+ __notifyExtraData.Construct(rhs.__notifyExtraData);
+ __requestHeader.Construct(rhs.__requestHeader);
}
_DownloadRequestImpl::~_DownloadRequestImpl(void)
__url = rhs.__url;
__dirPath = rhs.__dirPath;
__fileName = rhs.__fileName;
+ __notification = rhs.__notification;
+ __networkType = rhs.__networkType;
+ __notifyExtraData.RemoveAll();
+ __notifyExtraData.Construct(rhs.__notifyExtraData);
+ __requestHeader.RemoveAll();
+ __requestHeader.Construct(rhs.__requestHeader);
return *this;
}
return __fileName;
}
+void
+_DownloadRequestImpl::SetNotification(bool enable)
+{
+ __notification = enable;
+}
+
+result
+_DownloadRequestImpl::SetNotificationExtraData(const IMap* pExtraData)
+{
+ String* pKey = null;
+ String* pValue = null;
+ result r = E_SUCCESS;
+
+ std::unique_ptr<IMapEnumerator> pMapEnum(const_cast< IMap* >(pExtraData)->GetMapEnumeratorN());
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ pKey = dynamic_cast< String* >(pMapEnum->GetKey());
+ SysTryReturnResult(NID_CNT, pKey != null, E_INVALID_ARG, "The object is not a String class.");
+
+ pValue = dynamic_cast< String* >(pMapEnum->GetValue());
+ SysTryReturnResult(NID_CNT, pValue != null, E_INVALID_ARG, "The object is not a String class.");
+
+ r = __notifyExtraData.Add(new String(*pKey), new String(*pValue));
+ }
+ return r;
+}
+
+void
+_DownloadRequestImpl::SetNetworkType(DownloadNetworkType type)
+{
+ __networkType = type;
+}
+
+bool
+_DownloadRequestImpl::IsNotificationEnabled(void) const
+{
+ return __notification;
+}
+
+const IMap*
+_DownloadRequestImpl::GetNotificationExtraData(void) const
+{
+ return &__notifyExtraData;
+}
+
+DownloadNetworkType
+_DownloadRequestImpl::GetNetworkType(void) const
+{
+ return __networkType;
+}
+
+result
+_DownloadRequestImpl::AddRequestHeader(const String& field, const String& value)
+{
+ SysTryReturnResult(NID_CNT, !field.IsEmpty(), E_INVALID_ARG, "The field is empty.");
+ SysTryReturnResult(NID_CNT, !__requestHeader.ContainsKey(field), E_INVALID_ARG, "The field already exist.");
+ return __requestHeader.Add(new String(field), new String(value));
+}
+
+result
+_DownloadRequestImpl::SetRequestHeader(const String& field, const String& value)
+{
+ SysTryReturnResult(NID_CNT, !field.IsEmpty(), E_INVALID_ARG, "The field is empty.");
+ SysTryReturnResult(NID_CNT, __requestHeader.ContainsKey(field), E_INVALID_ARG, "The field does not exist.");
+ return __requestHeader.SetValue(field, new String(value));
+}
+
+result
+_DownloadRequestImpl::RemoveRequestHeader(const String& field)
+{
+ SysTryReturnResult(NID_CNT, !field.IsEmpty(), E_INVALID_ARG, "The field is empty.");
+ SysTryReturnResult(NID_CNT, __requestHeader.ContainsKey(field), E_INVALID_ARG, "The field does not exist.");
+ return __requestHeader.Remove(field);
+}
+
+String*
+_DownloadRequestImpl::GetRequestHeaderN(const String& field)
+{
+ String* pValue = null;
+ String* pKey = null;
+ IMapEnumerator* pMapEnum = null;
+
+ pMapEnum = __requestHeader.GetMapEnumeratorN();
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ pKey = static_cast< String* > (pMapEnum->GetKey());
+ if (*pKey == field)
+ {
+ pValue = new String (*(static_cast< String* > (pMapEnum->GetValue())));
+ SysTryReturn(NID_CNT, pValue != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+ break;
+ }
+ }
+
+ delete pMapEnum;
+ return pValue;
+}
+
+_DownloadRequestImpl*
+_DownloadRequestImpl::GetInstance(const DownloadRequest* pRequest)
+{
+ return pRequest->__pDownloadRequestImpl;
+}
+
+IMap*
+_DownloadRequestImpl::GetRequestHeader(void)
+{
+ return &__requestHeader;
+}
+
} } // Tizen::Content
* This file contains implementation of the %_ImageMetadataImpl class.
*/
-// includes
#include <FBaseSysLog.h>
#include <FMediaImage.h>
#include <FGrpBitmap.h>
#include <FIo_FileImpl.h>
#include <FMedia_ImageImpl.h>
-// using namespaces
using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Io;
int
_ImageMetadataImpl::GetHashCode(void) const
{
- int hash = 0;
-
- hash += (this->GetCameraManufacturer()).GetHashCode();
- hash += (this->GetCameraModel()).GetHashCode();
- hash += (this->GetDateTime()).GetHashCode();
- hash += Integer::GetHashCode(this->GetHeight());
- hash += Double::GetHashCode(this->GetLatitude());
- hash += Double::GetHashCode(this->GetLongitude());
- hash += Integer::GetHashCode(this->GetOrientation());
- hash += (this->GetSoftware()).GetHashCode();
- hash += (this->GetWhiteBalance()).GetHashCode();
- hash += Integer::GetHashCode(this->GetWidth());
-
- return hash;
+ return (this->GetCameraManufacturer()).GetHashCode()
+ ^ (this->GetCameraModel()).GetHashCode()
+ ^ (this->GetDateTime()).GetHashCode()
+ ^ Integer::GetHashCode(this->GetHeight())
+ ^ Double::GetHashCode(this->GetLatitude())
+ ^ Double::GetHashCode(this->GetLongitude())
+ ^ Integer::GetHashCode(this->GetOrientation())
+ ^ (this->GetSoftware()).GetHashCode()
+ ^ (this->GetWhiteBalance()).GetHashCode()
+ ^ Integer::GetHashCode(this->GetWidth());
}
int
if (!nameExpr.IsEmpty())
{
- r = nameExpr.Insert('"', 0);
+ r = nameExpr.Replace("\'", "''");
+ SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Replace operation for nameExpr.");
+
+ r = nameExpr.Insert('\'', 0);
SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Insert operation for nameExpr.");
- r = nameExpr.Insert('"', nameExpr.GetLength());
+
+ r = nameExpr.Insert('\'', nameExpr.GetLength());
SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Insert operation for nameExpr.");
r = inputCondition.Append(nameExpr);
}
result
-_PlayListImpl::SetPlalyListName(const Tizen::Base::String& oldName, const Tizen::Base::String& newName)
+_PlayListImpl::SetPlayListName(const Tizen::Base::String& oldName, const Tizen::Base::String& newName)
{
std::unique_ptr<media_playlist_s, PlayListHandleDeleter> pPlayListHandle;
media_playlist_h tempHandle = NULL;
if (!nameExpr.IsEmpty())
{
- r = nameExpr.Insert('"', 0);
+ r = nameExpr.Replace("\'", "''");
+ SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Replace operation for nameExpr.");
+
+ r = nameExpr.Insert('\'', 0);
SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Insert operation for nameExpr.");
- r = nameExpr.Insert('"', nameExpr.GetLength());
+
+ r = nameExpr.Insert('\'', nameExpr.GetLength());
SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform Insert operation for nameExpr.");
r = inputCondition.Append(nameExpr);
* This file contains implementation of the %_VideoMetadataImpl class.
*/
-// includes
#include <FBaseSysLog.h>
#include <FCntVideoMetadata.h>
#include <FCnt_VideoMetadataImpl.h>
#include <FGrp_BitmapImpl.h>
-// using namespaces
using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Graphics;
__pVideoMeta->pGenre = new (nothrow) String(*(pVideoMeta->pGenre));
SysTryReturnResult(NID_CNT, __pVideoMeta->pGenre != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
}
+ if (pVideoMeta->pComment != null)
+ {
+ __pVideoMeta->pComment = new (nothrow) String(*(pVideoMeta->pComment));
+ SysTryReturnResult(NID_CNT, __pVideoMeta->pComment != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+ }
+ if (pVideoMeta->pDescription != null)
+ {
+ __pVideoMeta->pDescription = new (nothrow) String(*(pVideoMeta->pDescription));
+ SysTryReturnResult(NID_CNT, __pVideoMeta->pDescription != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+ }
if (pVideoMeta->pAlbumArt != null)
{
__pVideoMeta->pAlbumArt = _BitmapImpl::CloneN(*(pVideoMeta->pAlbumArt));
pNewVideoMeta->duration = (rhs.__pVideoMeta)->duration;
pNewVideoMeta->contentPath = (rhs.__pVideoMeta)->contentPath;
+ // pGenre
if ((rhs.__pVideoMeta)->pGenre != null)
{
pNewVideoMeta->pGenre = new (nothrow) String(*((rhs.__pVideoMeta)->pGenre));
return;
}
}
+ // pComment
+ if ((rhs.__pVideoMeta)->pComment != null)
+ {
+ pNewVideoMeta->pComment = new (nothrow) String(*((rhs.__pVideoMeta)->pComment));
+ if (pNewVideoMeta->pComment == null)
+ {
+ SysLog(NID_CNT, "The memory is insufficient.");
+ return;
+ }
+ }
+ // pDescription
+ if ((rhs.__pVideoMeta)->pDescription != null)
+ {
+ pNewVideoMeta->pDescription = new (nothrow) String(*((rhs.__pVideoMeta)->pDescription));
+ if (pNewVideoMeta->pDescription == null)
+ {
+ SysLog(NID_CNT, "The memory is insufficient.");
+ return;
+ }
+ }
if ((rhs.__pVideoMeta)->pAlbumArt != null)
{
pNewVideoMeta->pAlbumArt = _BitmapImpl::CloneN(*((rhs.__pVideoMeta)->pAlbumArt));
__pVideoMeta->pGenre = new String(*((rhs.__pVideoMeta)->pGenre));
}
+ // pComment
+ if (__pVideoMeta->pComment != null && (rhs.__pVideoMeta)->pComment != null)
+ {
+ // delete previous data
+ delete __pVideoMeta->pComment;
+ __pVideoMeta->pComment = null;
+
+ __pVideoMeta->pComment = new (nothrow) String(*((rhs.__pVideoMeta)->pComment));
+ }
+ else if (__pVideoMeta->pComment != null)
+ {
+ delete __pVideoMeta->pComment;
+ __pVideoMeta->pComment = null;
+ }
+ else if ((rhs.__pVideoMeta)->pComment != null)
+ {
+ __pVideoMeta->pComment = new (nothrow) String(*((rhs.__pVideoMeta)->pComment));
+ }
+
+ // pDescription
+ if (__pVideoMeta->pDescription != null && (rhs.__pVideoMeta)->pDescription != null)
+ {
+ // delete previous data
+ delete __pVideoMeta->pDescription;
+ __pVideoMeta->pDescription = null;
+
+ __pVideoMeta->pDescription = new (nothrow) String(*((rhs.__pVideoMeta)->pDescription));
+ }
+ else if (__pVideoMeta->pDescription != null)
+ {
+ delete __pVideoMeta->pDescription;
+ __pVideoMeta->pDescription = null;
+ }
+ else if ((rhs.__pVideoMeta)->pDescription != null)
+ {
+ __pVideoMeta->pDescription = new (nothrow) String(*((rhs.__pVideoMeta)->pDescription));
+ }
+
// pAlbumArt
if (__pVideoMeta->pAlbumArt != null && (rhs.__pVideoMeta)->pAlbumArt != null)
{
{
return false;
}
+ if (!((this->GetComment()).Equals(pRhs->GetComment())))
+ {
+ return false;
+ }
+ if (!((this->GetDescription()).Equals(pRhs->GetDescription())))
+ {
+ return false;
+ }
if (this->GetHeight() != pRhs->GetHeight())
{
return false;
int
_VideoMetadataImpl::GetHashCode(void) const
{
- int hash = 0;
-
- hash += Integer::GetHashCode(this->GetAudioBitrate());
- hash += Long::GetHashCode(this->GetDuration());
- hash += Integer::GetHashCode(this->GetFramerate());
- hash += (this->GetGenre()).GetHashCode();
- hash += Integer::GetHashCode(this->GetHeight());
- hash += Integer::GetHashCode(this->GetVideoBitrate());
- hash += Integer::GetHashCode(this->GetWidth());
-
- return hash;
+ return Integer::GetHashCode(this->GetAudioBitrate())
+ ^ Long::GetHashCode(this->GetDuration())
+ ^ Integer::GetHashCode(this->GetFramerate())
+ ^ (this->GetGenre()).GetHashCode()
+ ^ (this->GetComment()).GetHashCode()
+ ^ (this->GetDescription()).GetHashCode()
+ ^ Integer::GetHashCode(this->GetHeight())
+ ^ Integer::GetHashCode(this->GetVideoBitrate())
+ ^ Integer::GetHashCode(this->GetWidth());
}
int
return *(__pVideoMeta->pGenre);
}
+String
+_VideoMetadataImpl::GetComment(void) const
+{
+ if (__pVideoMeta == null || __pVideoMeta->pComment == null)
+ {
+ SysLog(NID_CNT, "__pVideoMeta or __pVideoMeta->pComment is null.");
+ return String();
+ }
+ return *(__pVideoMeta->pComment);
+}
+
+String
+_VideoMetadataImpl::GetDescription(void) const
+{
+ if (__pVideoMeta == null || __pVideoMeta->pDescription == null)
+ {
+ SysLog(NID_CNT, "__pVideoMeta or __pVideoMeta->pDescription is null.");
+ return String();
+ }
+ return *(__pVideoMeta->pDescription);
+}
+
//
// E_SUCCESS
// E_DATA_NOT_FOUND
, pAlbumName(null)
, pArtist(null)
, pComment(null)
+ , pDescription(null)
, pComposer(null)
, pCopyright(null)
, pGenre(null)
Tizen::Base::String* pAlbumName;
Tizen::Base::String* pArtist;
Tizen::Base::String* pComment;
+ Tizen::Base::String* pDescription;
Tizen::Base::String* pComposer;
Tizen::Base::String* pCopyright;
Tizen::Base::String* pGenre;
delete pAudioMeta->pComment;
pAudioMeta->pComment = null;
}
+ if (pAudioMeta->pDescription)
+ {
+ delete pAudioMeta->pDescription;
+ pAudioMeta->pDescription = null;
+ }
if (pAudioMeta->pComposer)
{
delete pAudioMeta->pComposer;
Tizen::Base::String GetComment(void) const;
/**
+ * @see @ref Tizen::Content::AudioMetadata::GetDescription()
+ */
+ Tizen::Base::String GetDescription(void) const;
+
+ /**
* @see @ref Tizen::Content::AudioMetadata::GetTrack()
*/
int GetTrack(void) const;
{
class ContentManager;
-class _IContentScanListener;
+class IContentScanListener;
+class IContentUpdateEventListener;
+
typedef struct media_info_s* media_info_h;
struct MediaInfoDeleter
struct ScanResult
{
- void* pData;
- char* pContentPath;
+ char* pScanPath;
+ IContentScanListener* pScanListener;
+ RequestId requestId;
};
class _ContentManagerImpl
*/
result DeleteContent(const ContentId& contentId);
- /*
+ /**
+ * @see @ref Tizen::Content::ContentManager::AddContentUpdateEventListener()
+ */
+ result AddContentUpdateEventListener(IContentUpdateEventListener& listener);
+
+ /**
+ * @see @ref Tizen::Content::ContentManager::RemoveContentUpdateEventListener()
+ */
+ result RemoveContentUpdateEventListener(IContentUpdateEventListener& listener);
+
+ /**
* @see @ref Tizen::Content::ContentManager::ScanFile()
*/
- result ScanFile(const Tizen::Base::String& contentPath);
+ static result ScanFile(const Tizen::Base::String& contentPath);
- /*
+ /**
* @see @ref Tizen::Content::ContentManager::ScanDirectory()
*/
- result ScanDirectory(const Tizen::Base::String& directoryPath, bool recursive, _IContentScanListener& listener);
+ static result ScanDirectory(const Tizen::Base::String& directoryPath, bool recursive, IContentScanListener* pListener, RequestId& reqId);
/**
* Gets the Impl instance.
*/
static const _ContentManagerImpl* GetInstance(const ContentManager& contentManager);
- void SetListener(_IContentScanListener* pListener);
+ void SetListener(IContentUpdateEventListener* pListener);
- _IContentScanListener* GetListener(void) const;
+ IContentUpdateEventListener* GetListener(void) const;
private:
_ContentManagerImpl(const _ContentManagerImpl& rhs);
ContentId SaveDataToDatabase(const media_info_h pMediaInfo, ContentInfo::_ContentData* pContentData) const;
result UpdateDataToDatabase(const ContentInfo::_ContentData* pContentData) const;
result MakeContentInfo(const media_info_h pMediaInfo, ContentInfo::_ContentData* pContentData, int systemType, void* pMetadata) const;
- result ConvertError(int error) const;
bool VerifyMediaFilePathCompatibility(const Tizen::Base::String& contentPath, bool checkVersion) const;
bool VerifyHomeFilePathCompatibility(const Tizen::Base::String& contentPath) const;
_ContentManagerImpl& operator =(const _ContentManagerImpl& rhs);
private:
bool __isConnected;
- _IContentScanListener* __pListener;
+ IContentUpdateEventListener* __pListener;
friend class _ContentDownloadHandler;
}; // class _ContentManagerImpl
{
public:
/**
- * @see @ref Tizen::Content::ContentManagerUtil::GetImageMetaN()
+ * @see @ref Tizen::Content::ContentManagerUtil::GetImageMetaN(const Tizen::Base::String&)
*/
static Tizen::Content::ImageMetadata* GetImageMetaN(const Tizen::Base::String& contentPath, bool internal = false);
/**
- * @see @ref Tizen::Content::ContentManagerUtil::GetAudioMetaN()
+ * @see @ref Tizen::Content::ContentManagerUtil::GetImageMetaN(const Tizen::Base::ByteBuffer&)
+ */
+ static Tizen::Content::ImageMetadata* GetImageMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
+
+ /**
+ * @see @ref Tizen::Content::ContentManagerUtil::GetAudioMetaN(const Tizen::Base::String&)
*/
static Tizen::Content::AudioMetadata* GetAudioMetaN(const Tizen::Base::String& contentPath);
/**
- * @see @ref Tizen::Content::ContentManagerUtil::GetVideoMetaN()
+ * @see @ref Tizen::Content::ContentManagerUtil::GetAudioMetaN(const Tizen::Base::ByteBuffer&)
+ */
+ static Tizen::Content::AudioMetadata* GetAudioMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
+
+ /**
+ * @see @ref Tizen::Content::ContentManagerUtil::GetVideoMetaN(const Tizen::Base::String&)
*/
static Tizen::Content::VideoMetadata* GetVideoMetaN(const Tizen::Base::String& contentPath);
/**
- * @see @ref Tizen::Content::ContentManagerUtil::CheckContentType()
+ * @see @ref Tizen::Content::ContentManagerUtil::GetVideoMetaN(const Tizen::Base::ByteBuffer&)
+ */
+ static Tizen::Content::VideoMetadata* GetVideoMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
+
+ /**
+ * @see @ref Tizen::Content::ContentManagerUtil::CheckContentType(const Tizen::Base::String&)
*/
static Tizen::Content::ContentType CheckContentType(const Tizen::Base::String& contentPath, bool internal = false);
static bool VerifyFilePathCompatibility(const Tizen::Base::String& contentPath);
_ContentManagerUtilImpl& operator =(const _ContentManagerUtilImpl& rhs);
static result ErrorMapToRetVal(int retVal);
- static ContentType GetDrmFileType(const Tizen::Base::String& fileExt);
+ static ContentType CheckStream(const Tizen::Base::String& contentPath);
}; // class _ContentManagerUtilImpl
#include <FBaseResult.h>
#include <FBaseString.h>
+#include <FBaseRtEvent.h>
#include <FBaseColHashMapT.h>
namespace Tizen { namespace Content
STATE_PAUSED,
STATE_CANCELLED,
STATE_COMPLETED,
- STATE_FAILED,
+ STATE_FAILED
+ };
+
+ enum NetworkType
+ {
+ NETWORK_DATA = 1,
+ NETWORK_WIFI,
+ NETWORK_ALL = 100
};
public:
public:
IDownloadListener* __pListener;
+ Tizen::Base::Runtime::Event* __pEvent;
private:
_DownloadManagerImpl(const _DownloadManagerImpl& clientChannel);
*
* This header file contains the declarations of the %_DownloadRequestImpl class.
*/
-#ifndef _FCNT_DOWNLOAD_MANAGER_IMPL_H_
-#define _FCNT_DOWNLOAD_MANAGER_IMPL_H_
+#ifndef _FCNT_DOWNLOAD_REQUEST_IMPL_H_
+#define _FCNT_DOWNLOAD_REQUEST_IMPL_H_
#include <FBaseResult.h>
#include <FBaseString.h>
+#include <FBaseColHashMap.h>
+#include <FBaseColIMap.h>
+
+#include <FCntTypes.h>
namespace Tizen { namespace Content
{
class IDownloadEventListener;
class IDownloadProgressListener;
+class DownloadRequest;
class _OSP_EXPORT_ _DownloadRequestImpl
: public Tizen::Base::Object
Tizen::Base::String GetDirectoryPath(void) const;
Tizen::Base::String GetFileName(void) const;
+ void SetNotification(bool enable);
+ result SetNotificationExtraData(const Tizen::Base::Collection::IMap *pExtraData);
+ void SetNetworkType(DownloadNetworkType type);
+
+ bool IsNotificationEnabled(void) const;
+ const Tizen::Base::Collection::IMap* GetNotificationExtraData(void) const;
+ DownloadNetworkType GetNetworkType(void) const;
+
+ result AddRequestHeader(const Tizen::Base::String& field, const Tizen::Base::String& value);
+ result SetRequestHeader(const Tizen::Base::String& field, const Tizen::Base::String& value);
+ result RemoveRequestHeader(const Tizen::Base::String& field);
+ Tizen::Base::String* GetRequestHeaderN(const Tizen::Base::String& field);
+
+ static _DownloadRequestImpl* GetInstance(const DownloadRequest* pRequest);
+ Tizen::Base::Collection::IMap* GetRequestHeader(void);
+
private:
Tizen::Base::String __url;
Tizen::Base::String __dirPath;
Tizen::Base::String __fileName;
+ bool __notification;
+ DownloadNetworkType __networkType;
+ Tizen::Base::Collection::HashMap __notifyExtraData;
+ Tizen::Base::Collection::HashMap __requestHeader;
}; // _DownloadRequestImpl
result RemoveItems(const Tizen::Base::Collection::IList& contentIdList);
- result SetPlalyListName(const Tizen::Base::String& oldName, const Tizen::Base::String& newName);
+ result SetPlayListName(const Tizen::Base::String& oldName, const Tizen::Base::String& newName);
result SetPlayOrder(const ContentId& contentId, const ContentId& nextContentId);
, duration(0)
, contentPath(L"")
, pGenre(null)
+ , pComment(null)
+ , pDescription(null)
, pAlbumArt(null) {}
int width;
long duration;
Tizen::Base::String contentPath;
Tizen::Base::String* pGenre;
+ Tizen::Base::String* pComment;
+ Tizen::Base::String* pDescription;
Tizen::Graphics::Bitmap* pAlbumArt;
};
delete pVideoMeta->pGenre;
pVideoMeta->pGenre = null;
}
+ if (pVideoMeta->pComment)
+ {
+ delete pVideoMeta->pComment;
+ pVideoMeta->pComment = null;
+ }
+ if (pVideoMeta->pDescription)
+ {
+ delete pVideoMeta->pDescription;
+ pVideoMeta->pDescription = null;
+ }
if (pVideoMeta->pAlbumArt != null)
{
delete pVideoMeta->pAlbumArt;
Tizen::Base::String GetGenre(void) const;
/**
+ * @see @ref Tizen::Content::VideoMetadata::GetComment()
+ */
+ Tizen::Base::String GetComment(void) const;
+
+ /**
+ * @see @ref Tizen::Content::VideoMetadata::GetDescription()
+ */
+ Tizen::Base::String GetDescription(void) const;
+
+ /**
* @see @ref Tizen::Content::VideoMetadata::GetAlbumArtN()
*/
Tizen::Graphics::Bitmap* GetAlbumArtN(void) const;