X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FFCnt_ContentUtility.cpp;h=ffb706ba20a7a6ac532808e7e00328d72db81869;hb=acbcabe49f4af6e36412974089c1a33260e2e55d;hp=6484f835045570fef6253b1160f29606d377d4a1;hpb=a8116a76346b5c66b7a91649c1fd3ea96cbaed53;p=platform%2Fframework%2Fnative%2Fcontent.git diff --git a/src/FCnt_ContentUtility.cpp b/src/FCnt_ContentUtility.cpp index 6484f83..ffb706b 100644 --- a/src/FCnt_ContentUtility.cpp +++ b/src/FCnt_ContentUtility.cpp @@ -22,13 +22,23 @@ #include #include +#include #include #include #include -#include +#include +#include +#include +#include "FCnt_ContentUtility.h" +#include "FCnt_ContentInfoImpl.h" +#include "FCnt_ImageContentInfoImpl.h" +#include "FCnt_AudioContentInfoImpl.h" +#include "FCnt_VideoContentInfoImpl.h" using namespace Tizen::Base; using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Locations; namespace Tizen { namespace Content { @@ -37,16 +47,15 @@ static const double DEFAULT_COORDINATE = -200.0; // Default constructor _ContentUtility::_ContentUtility(void) - : Object() { - SysLog(NID_CNT, "Enter\n"); + } // Default destructor _ContentUtility::~_ContentUtility(void) { - SysLog(NID_CNT, "Enter\n"); + } void @@ -55,26 +64,14 @@ _ContentUtility::DoSafeFree(char* pSrc) if (pSrc != NULL) { free(pSrc); - pSrc = NULL; - } -} - -void -_ContentUtility::DoSafeDelete(String* pSrc) -{ - if (pSrc != NULL) - { - delete pSrc; - pSrc = NULL; } } -// fills contentinfo information in the content data object. +// Fills ContentInfo information in the content data object. result -_ContentUtility::FillContentData(media_info_h mediaHandle, ContentInfo::_ContentData* pContentData) +_ContentUtility::FillContentData(media_info_h mediaHandle, _ContentInfoImpl* pInfoImpl) { - - SysTryReturnResult(NID_CNT, mediaHandle != null && pContentData != null, E_INVALID_ARG, "mediaHandle or pContentData is null."); + SysTryReturnResult(NID_CNT, mediaHandle != null && pInfoImpl != null, E_INVALID_ARG, "mediaHandle or pInfoImpl is null."); int ret = MEDIA_CONTENT_ERROR_NONE; result r = E_SUCCESS; @@ -97,9 +94,11 @@ _ContentUtility::FillContentData(media_info_h mediaHandle, ContentInfo::_Content unsigned long long contentSize = 0; time_t addedTime = 0; + time_t modifiedTime = 0; double latitude = 0; double longitude = 0; double altitude = 0; + Coordinates coordinates; bool isDrm = 0; @@ -223,6 +222,9 @@ _ContentUtility::FillContentData(media_info_h mediaHandle, ContentInfo::_Content ret = media_info_get_added_time(mediaHandle, &addedTime); SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform media_info_get_added_time operation."); + ret = media_info_get_modified_time(mediaHandle, &modifiedTime); + SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform media_info_get_modified_time operation."); + ret = media_info_get_storage_type(mediaHandle, &storageType); SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform media_info_get_storage_type operation."); @@ -251,111 +253,133 @@ _ContentUtility::FillContentData(media_info_h mediaHandle, ContentInfo::_Content if (pMediaId.get() != null) { - r = UuId::Parse(String(pMediaId.get()), pContentData->contentId); + ContentId contentId; + + r = UuId::Parse(String(pMediaId.get()), contentId); SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform UuId::Parse operation."); + + pInfoImpl->SetContentId(contentId); } - pContentData->isDrm = isDrm; - SysLog(NID_CNT, "pContentData->isDrm = %d", pContentData->isDrm); + pInfoImpl->SetDrmProtected(isDrm); + SysLog(NID_CNT, "pContentInfoImpl->isDrm = %d", pInfoImpl->IsDrmProtected()); - pContentData->contentSize = contentSize; - SysLog(NID_CNT, "pContentData->contentSize = %lu", pContentData->contentSize); + pInfoImpl->SetContentSize(contentSize); + SysLog(NID_CNT, "pContentInfoImpl->contentSize = %lu", pInfoImpl->GetContentSize()); if (Double::Compare(latitude, DEFAULT_COORDINATE) != 0) { - pContentData->latitude = latitude; + pInfoImpl->SetLatitude(latitude); + coordinates.SetLatitude(latitude); } if (Double::Compare(longitude, DEFAULT_COORDINATE) != 0) { - pContentData->longitude = longitude; + pInfoImpl->SetLongitude(longitude); + coordinates.SetLongitude(longitude); } if (Double::Compare(altitude, DEFAULT_COORDINATE) != 0) { - pContentData->altitude = altitude; + pInfoImpl->SetAltitude(altitude); + coordinates.SetAltitude(altitude); } + pInfoImpl->SetCoordinates(coordinates); + if (pMediaPath.get() != NULL) { - pContentData->contentPath = String(pMediaPath.get()); - SysSecureLog(NID_CNT, "pContentData->contentPath = %ls", pContentData->contentPath.GetPointer()); + String contentPath(pMediaPath.get()); + + pInfoImpl->SetContentPath(contentPath); + SysSecureLog(NID_CNT, "pContentInfoImpl->contentPath = %ls", (pInfoImpl->GetContentPath()).GetPointer()); } if (pThumbnailPath.get() != NULL) { - pContentData->pThumbnailPath = new (std::nothrow) String(pThumbnailPath.get()); - SysTryReturnResult(NID_CNT, pContentData->pThumbnailPath != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysSecureLog(NID_CNT, "pContentData->pThumbnailPath = %ls", pContentData->pThumbnailPath->GetPointer()); + String thumbnailPath(pThumbnailPath.get()); + + pInfoImpl->SetThumbnailPath(thumbnailPath); + SysSecureLog(NID_CNT, "pContentInfoImpl->pThumbnailPath = %ls", (pInfoImpl->GetThumbnailPath()).GetPointer()); } if (pAuthor.get() != NULL) { - pContentData->pAuthor = new (std::nothrow) String(pAuthor.get()); - SysTryReturnResult(NID_CNT, pContentData->pAuthor != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pContentData->pAuthor = %ls", pContentData->pAuthor->GetPointer()); + String author(pAuthor.get()); + + pInfoImpl->SetAuthor(author); + SysLog(NID_CNT, "pContentInfoImpl->pAuthor = %ls", (pInfoImpl->GetAuthor()).GetPointer()); } if (pCategory.get() != NULL) { - pContentData->pCategory = new (std::nothrow) String(pCategory.get()); - SysTryReturnResult(NID_CNT, pContentData->pCategory != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pContentData->pCategory = %ls", pContentData->pCategory->GetPointer()); + String category(pCategory.get()); + + pInfoImpl->SetCategory(category); + SysLog(NID_CNT, "pContentInfoImpl->pCategory = %ls", (pInfoImpl->GetCategory()).GetPointer()); } if (pContentName.get() != NULL) { - pContentData->pContentName = new (std::nothrow) String(pContentName.get()); - SysTryReturnResult(NID_CNT, pContentData->pContentName != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pContentData->pContentName = %ls", pContentData->pContentName->GetPointer()); + String contentName(pContentName.get()); + + pInfoImpl->SetContentName(contentName); + SysLog(NID_CNT, "pContentInfoImpl->pContentName = %ls", (pInfoImpl->GetContentName()).GetPointer()); } if (pDescription.get() != NULL) { - pContentData->pDescription = new (std::nothrow) String(pDescription.get()); - SysTryReturnResult(NID_CNT, pContentData->pDescription != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pContentData->pDescription = %ls", pContentData->pDescription->GetPointer()); + String description(pDescription.get()); + + pInfoImpl->SetDescription(description); + SysLog(NID_CNT, "pContentInfoImpl->pDescription = %ls", (pInfoImpl->GetDescription()).GetPointer()); } if (pLocationTag.get() != NULL) { - pContentData->pLocationTag = new (std::nothrow) String(pLocationTag.get()); - SysTryReturnResult(NID_CNT, pContentData->pLocationTag != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pContentData->pLocationTag = %ls", pContentData->pLocationTag->GetPointer()); + String locationTag(pLocationTag.get()); + + pInfoImpl->SetLocationTag(locationTag); + SysLog(NID_CNT, "pContentInfoImpl->pLocationTag = %ls", (pInfoImpl->GetLocationTag()).GetPointer()); } if (pProvider.get() != NULL) { - pContentData->pProvider = new (std::nothrow) String(pProvider.get()); - SysTryReturnResult(NID_CNT, pContentData->pProvider != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pContentData->pProvider = %ls", pContentData->pProvider->GetPointer()); + String provider(pProvider.get()); + + pInfoImpl->SetProvider(provider); + SysLog(NID_CNT, "pContentInfoImpl->pProvider = %ls", (pInfoImpl->GetProvider()).GetPointer()); } if (pContentRating.get() != NULL) { - pContentData->pRating = new (std::nothrow) String(pContentRating.get()); - SysTryReturnResult(NID_CNT, pContentData->pRating != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pContentData->pRating = %ls", pContentData->pRating->GetPointer()); + String rating(pContentRating.get()); + + pInfoImpl->SetRating(rating); + SysLog(NID_CNT, "pContentInfoImpl->pRating = %ls", (pInfoImpl->GetRating()).GetPointer()); } if (pKeyword.get() != NULL) { - pContentData->pKeyword = new (std::nothrow) String(pKeyword.get()); - SysTryReturnResult(NID_CNT, pContentData->pKeyword != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pContentData->pKeyword = %ls", pContentData->pKeyword->GetPointer()); + String keyword(pKeyword.get()); + + pInfoImpl->SetKeyword(keyword); + SysLog(NID_CNT, "pContentInfoImpl->pKeyword = %ls", (pInfoImpl->GetKeyword()).GetPointer()); } if (pMimeType.get() != NULL) { - pContentData->mimeType = String(pMimeType.get()); - SysLog(NID_CNT, "pContentData->mimeType = %ls", (pContentData->mimeType).GetPointer()); + String mimeType(pMimeType.get()); + + pInfoImpl->SetMimeType(mimeType); + SysLog(NID_CNT, "pContentInfoImpl->mimeType = %ls", (pInfoImpl->GetMimeType()).GetPointer()); } switch (storageType) { case MEDIA_CONTENT_STORAGE_INTERNAL: - pContentData->storageType = 0; + pInfoImpl->SetStorageType(0); break; case MEDIA_CONTENT_STORAGE_EXTERNAL: - pContentData->storageType = 1; + pInfoImpl->SetStorageType(1); break; default: break; @@ -363,59 +387,66 @@ _ContentUtility::FillContentData(media_info_h mediaHandle, ContentInfo::_Content switch (mediaType) { case MEDIA_CONTENT_TYPE_OTHERS: - pContentData->contentType = CONTENT_TYPE_OTHER; + pInfoImpl->SetContentType(CONTENT_TYPE_OTHER); break; case MEDIA_CONTENT_TYPE_IMAGE: - pContentData->contentType = CONTENT_TYPE_IMAGE; + pInfoImpl->SetContentType(CONTENT_TYPE_IMAGE); break; case MEDIA_CONTENT_TYPE_SOUND: //fall through case MEDIA_CONTENT_TYPE_MUSIC: - pContentData->contentType = CONTENT_TYPE_AUDIO; + pInfoImpl->SetContentType(CONTENT_TYPE_AUDIO); break; case MEDIA_CONTENT_TYPE_VIDEO: - pContentData->contentType = CONTENT_TYPE_VIDEO; + pInfoImpl->SetContentType(CONTENT_TYPE_VIDEO); break; default: break; } - r = (pContentData->dateTime).SetValue(1970, 1, 1); + // addedTime + DateTime dt; + + r = dt.SetValue(1970, 1, 1); SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform datetime.SetValue operation."); - r = (pContentData->dateTime).AddSeconds(addedTime);// need to check addedTime is secs/millisec + r = dt.AddSeconds(addedTime);// need to check addedTime is secs/millisec SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform datetime.AddSeconds operation."); + pInfoImpl->SetDateTime(dt); + SysLog(NID_CNT, "addedTime = %ld", addedTime); - SysLog(NID_CNT, "pContentData->dateTime : %ls", pContentData->dateTime.ToString().GetPointer()); + SysLog(NID_CNT, "pContentInfoImpl->dateTime : %ls", (pInfoImpl->GetDateTime()).ToString().GetPointer()); + + // modifiedTime + r = dt.SetValue(1970, 1, 1); + SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform datetime.SetValue operation."); + + r = dt.AddSeconds(modifiedTime);// need to check addedTime is secs/millisec + SysTryReturnResult(NID_CNT, r == E_SUCCESS, r, "Failed to perform datetime.AddSeconds operation."); + + pInfoImpl->SetModifiedTime(dt); + + SysLog(NID_CNT, "modifiedTime = %ld", modifiedTime); + SysLog(NID_CNT, "pContentInfoImpl->modifiedTime : %ls", (pInfoImpl->GetModifiedTime()).ToString().GetPointer()); return r; } -// fills Imagecontentinfo information in the image content data object . +// Fills ImageContentInfo information in the image content data object . result -_ContentUtility::FillImageContentData(media_info_h mediaHandle, ImageContentInfo::_ImageContentData* pImageContentData) +_ContentUtility::FillImageContentData(media_info_h mediaHandle, _ImageContentInfoImpl* pImageContentInfoImpl) { - SysTryReturnResult(NID_CNT, mediaHandle != null && pImageContentData != null, E_INVALID_ARG, "mediaHandle or pImageContentData is null."); + SysTryReturnResult(NID_CNT, mediaHandle != null && pImageContentInfoImpl != null, E_INVALID_ARG, "mediaHandle or pImageContentInfoImpl is null."); int ret = MEDIA_CONTENT_ERROR_NONE; result r = E_SUCCESS; int width = 0; int height = 0; + bool isBurst = false; media_content_orientation_e orientation; - std::unique_ptr pDisplayName; + std::unique_ptr pStrValue; - char* pDisplayValue = null; - ret = media_info_get_display_name(mediaHandle, &pDisplayValue); - if (pDisplayValue != null) - { - pDisplayName.reset(pDisplayValue); - } - else - { - SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform media_info_get_display_name operation."); - } - image_meta_h tempMeta = NULL; ret = media_info_get_image(mediaHandle, &tempMeta); @@ -433,15 +464,26 @@ _ContentUtility::FillImageContentData(media_info_h mediaHandle, ImageContentInfo ret = image_meta_get_height(pImageHandle.get(), &height); SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform image_meta_get_height operation."); - pImageContentData->width = width; - pImageContentData->height = height; - pImageContentData->orientationType = static_cast(orientation); + ret = image_meta_is_burst_shot(pImageHandle.get(), &isBurst); + SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform image_meta_is_burst_shot operation."); + + pImageContentInfoImpl->SetWidth(width); + pImageContentInfoImpl->SetHeight(height); + pImageContentInfoImpl->SetOrientation(static_cast< ImageOrientationType >(orientation)); + pImageContentInfoImpl->SetBurstShot(isBurst); + + // title + char* pTempValue = null; + ret = media_info_get_display_name(mediaHandle, &pTempValue); + SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform media_info_get_display_name operation."); - if (pDisplayName != NULL) + if (pTempValue != NULL) { + pStrValue.reset(pTempValue); + int pos = 0; String fileName = L""; - String strTitle(pDisplayName.get()); + String strTitle(pStrValue.get()); r = strTitle.LastIndexOf(L'.', strTitle.GetLength() - 1, pos); if (r == E_SUCCESS) @@ -455,18 +497,118 @@ _ContentUtility::FillImageContentData(media_info_h mediaHandle, ImageContentInfo r = E_SUCCESS; fileName = strTitle; } - pImageContentData->title = fileName; - SysLog(NID_CNT, "pImageContentData->title = %ls", pImageContentData->title.GetPointer()); + pImageContentInfoImpl->SetTitle(fileName); + SysLog(NID_CNT, "pImageContentInfoImpl->title = %ls", (pImageContentInfoImpl->GetTitle()).GetPointer()); + } + + // dateTaken + ret = image_meta_get_date_taken(pImageHandle.get(), &pTempValue); + SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), + "Failed to perform image_meta_get_date_taken operation."); + + DateTime dt; + + if (pTempValue != NULL) + { + pStrValue.reset(pTempValue); + String dateTaken(pStrValue.get()); + String newDateTaken(L""); + + // detour the unexpected datetaken format + String tempDelim(L"+-Z"); + String token; + + StringTokenizer tempStrTok(dateTaken, tempDelim); + + r = tempStrTok.GetNextToken(token); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation."); + + dateTaken = token; + + String delim(L": "); + String year(L""); + + StringTokenizer strTok(dateTaken, delim); + + r = strTok.SetDelimiters(delim); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform SetDelimiters operation."); + + r = strTok.GetNextToken(token); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation."); + + year = token; + + // Append month + r = strTok.GetNextToken(token); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation."); + + r = newDateTaken.Append(token); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation."); + + r = newDateTaken.Append(L"/"); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation."); + + // Append day + r = strTok.GetNextToken(token); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation."); + + r = newDateTaken.Append(token); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation."); + + r = newDateTaken.Append(L"/"); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation."); + + // Append year + r = newDateTaken.Append(year); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation."); + + r = newDateTaken.Append(L" "); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation."); + + String newDelim(L" "); + + r = strTok.SetDelimiters(newDelim); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform SetDelimiters operation."); + + r = strTok.GetNextToken(token); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation."); + + r = newDateTaken.Append(token); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation."); + + r = DateTime::Parse(newDateTaken, dt); + SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform Parse operation for DateTime."); + } + else + { + dt = DateTime::GetMinValue(); + } + + pImageContentInfoImpl->SetImageTakenDate(dt); + SysLog(NID_CNT, "pImageContentInfoImpl->takenDate = %ls", dt.ToString().GetPointer()); + + // burstShotId + ret = image_meta_get_burst_id(pImageHandle.get(), &pTempValue); + SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), + "Failed to perform image_meta_get_burst_id operation."); + + if (pTempValue != NULL) + { + pStrValue.reset(pTempValue); + String burstShotId(pStrValue.get()); + + pImageContentInfoImpl->SetBurstShotId(burstShotId); + SysLog(NID_CNT, "pImageContentInfoImpl->burstShotId = %ls", burstShotId.GetPointer()); } return r; } -// fills audio contentinfo information in the audio content data object. +// Fills AudioContentInfo information in the audio content data object. result -_ContentUtility::FillAudioContentData(media_info_h mediaHandle, AudioContentInfo::_AudioContentData* pAudioContentData) +_ContentUtility::FillAudioContentData(media_info_h mediaHandle, _AudioContentInfoImpl* pAudioContentInfoImpl) { - SysTryReturnResult(NID_CNT, mediaHandle != null && pAudioContentData != null, E_INVALID_ARG, "mediaHandle or pAudioContentData is null."); + SysTryReturnResult(NID_CNT, mediaHandle != null && pAudioContentInfoImpl != null, E_INVALID_ARG, "mediaHandle or pAudioContentInfoImpl is null."); int ret = MEDIA_CONTENT_ERROR_NONE; result r = E_SUCCESS; @@ -577,86 +719,83 @@ _ContentUtility::FillAudioContentData(media_info_h mediaHandle, AudioContentInfo ret = audio_meta_get_duration(pAudioHandle.get(), &duration); SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform audio_meta_get_duration operation."); - pAudioContentData->bitrate = bitrate; + pAudioContentInfoImpl->SetBitrate(bitrate); if (pYear.get() != null) { - SysLog(NID_CNT, "pAudioContentData->pYear = %s", pYear.get()); + SysLog(NID_CNT, "pAudioContentInfoImpl->pYear = %s", pYear.get()); String strYear(pYear.get()); if (strYear.CompareTo(L"Unknown") != 0) { - r = Integer::Parse(strYear, pAudioContentData->releaseYear); + int releaseYear = 0; + + r = Integer::Parse(strYear, releaseYear); if (IsFailed(r)) { // It is one of the metadata. If error occurs, skip it for other metadata. - pAudioContentData->releaseYear = 0; + pAudioContentInfoImpl->SetReleaseYear(0); r = E_SUCCESS; - SysLog(NID_CNT, "pAudioContentData->pYear(invalid data) = %ls", strYear.GetPointer()); + SysLog(NID_CNT, "pAudioContentInfoImpl->pYear(invalid data) = %ls", strYear.GetPointer()); } + + pAudioContentInfoImpl->SetReleaseYear(releaseYear); } } if (pTitle.get() != NULL) { - pAudioContentData->pTitle = new (std::nothrow) String(pTitle.get()); - SysTryReturnResult(NID_CNT, pAudioContentData->pTitle != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pAudioContentData->pTitle = %ls", pAudioContentData->pTitle->GetPointer()); + pAudioContentInfoImpl->SetTitle(String(pTitle.get())); + SysLog(NID_CNT, "pAudioContentInfoImpl->pTitle = %ls", (pAudioContentInfoImpl->GetTitle()).GetPointer()); } if (pArtistName.get() != NULL) { - pAudioContentData->pArtist = new (std::nothrow) String(pArtistName.get()); - SysTryReturnResult(NID_CNT, pAudioContentData->pArtist != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pAudioContentData->pArtist = %ls", pAudioContentData->pArtist->GetPointer()); + pAudioContentInfoImpl->SetArtist(String(pArtistName.get())); + SysLog(NID_CNT, "pAudioContentInfoImpl->pArtist = %ls", (pAudioContentInfoImpl->GetArtist()).GetPointer()); } if (pGenreName.get() != NULL) { - pAudioContentData->pGenre = new (std::nothrow) String(pGenreName.get()); - SysTryReturnResult(NID_CNT, pAudioContentData->pGenre != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pAudioContentData->pGenre = %ls", pAudioContentData->pGenre->GetPointer()); + pAudioContentInfoImpl->SetGenre(String(pGenreName.get())); + SysLog(NID_CNT, "pAudioContentInfoImpl->pGenre = %ls", (pAudioContentInfoImpl->GetGenre()).GetPointer()); } if (pComposerName.get() != NULL) { - pAudioContentData->pComposer = new (std::nothrow) String(pComposerName.get()); - SysTryReturnResult(NID_CNT, pAudioContentData->pComposer != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pAudioContentData->pComposer = %ls", pAudioContentData->pComposer->GetPointer()); + pAudioContentInfoImpl->SetComposer(String(pComposerName.get())); + SysLog(NID_CNT, "pAudioContentInfoImpl->pComposer = %ls", (pAudioContentInfoImpl->GetComposer()).GetPointer()); } if (pAlbumName.get() != NULL) { - pAudioContentData->pAlbumName = new (std::nothrow) String(pAlbumName.get()); - SysTryReturnResult(NID_CNT, pAudioContentData->pAlbumName != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pAudioContentData->pAlbumName = %ls", pAudioContentData->pAlbumName->GetPointer()); + pAudioContentInfoImpl->SetAlbumName(String(pAlbumName.get())); + SysLog(NID_CNT, "pAudioContentInfoImpl->pAlbumName = %ls", (pAudioContentInfoImpl->GetAlbumName()).GetPointer()); } if (pCopyRight.get() != NULL) { - pAudioContentData->pCopyright = new (std::nothrow) String(pCopyRight.get()); - SysTryReturnResult(NID_CNT, pAudioContentData->pCopyright != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pAudioContentData->pCopyright = %ls", pAudioContentData->pCopyright->GetPointer()); + pAudioContentInfoImpl->SetCopyright(String(pCopyRight.get())); + SysLog(NID_CNT, "pAudioContentInfoImpl->pCopyright = %ls", (pAudioContentInfoImpl->GetCopyright()).GetPointer()); } if (pTrackNum.get() != NULL) { - pAudioContentData->pTrackInfo = new (std::nothrow) String(pTrackNum.get()); - SysTryReturnResult(NID_CNT, pAudioContentData->pTrackInfo != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pAudioContentData->pTrackInfo = %ls", pAudioContentData->pTrackInfo->GetPointer()); + pAudioContentInfoImpl->SetTrackInfo(String(pTrackNum.get())); + SysLog(NID_CNT, "pAudioContentInfoImpl->pTrackInfo = %ls", (pAudioContentInfoImpl->GetTrackInfo()).GetPointer()); } - pAudioContentData->duration = duration; - SysLog(NID_CNT,"pAudioContentData->duration = %d", pAudioContentData->duration); + pAudioContentInfoImpl->SetDuration(duration); + SysLog(NID_CNT,"pAudioContentInfoImpl->duration = %d", pAudioContentInfoImpl->GetDuration()); return r; } -// fills video contentinfo information in the video content data object. +// Fills VideoContentInfo information in the video content data object. result -_ContentUtility::FillVideoContentData(media_info_h mediaHandle, VideoContentInfo::_VideoContentData* pVideoContentData) +_ContentUtility::FillVideoContentData(media_info_h mediaHandle, _VideoContentInfoImpl* pVideoContentInfoImpl) { - SysTryReturnResult(NID_CNT, mediaHandle != null && pVideoContentData != null, E_INVALID_ARG, "mediaHandle or pVideoContentData is null."); + SysTryReturnResult(NID_CNT, mediaHandle != null && pVideoContentInfoImpl != null, E_INVALID_ARG, "mediaHandle or pVideoContentInfoImpl is null."); int ret = MEDIA_CONTENT_ERROR_NONE; result r = E_SUCCESS; @@ -726,44 +865,40 @@ _ContentUtility::FillVideoContentData(media_info_h mediaHandle, VideoContentInfo ret = video_meta_get_duration(pVideoHandle.get(), &duration); SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform video_meta_get_duration operation."); - pVideoContentData->width = width; - pVideoContentData->height = height; + pVideoContentInfoImpl->SetWidth(width); + pVideoContentInfoImpl->SetHeight(height); if (pTitle.get() != NULL) { - pVideoContentData->pTitle = new (std::nothrow) String(pTitle.get()); - SysTryReturnResult(NID_CNT, pVideoContentData->pTitle != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pVideoContentData->pTitle = %ls", pVideoContentData->pTitle->GetPointer()); + pVideoContentInfoImpl->SetTitle(String(pTitle.get())); + SysLog(NID_CNT, "pVideoContentInfoImpl->pTitle = %ls", (pVideoContentInfoImpl->GetTitle()).GetPointer()); } if (pArtistName.get() != NULL) { - pVideoContentData->pArtist = new (std::nothrow) String(pArtistName.get()); - SysTryReturnResult(NID_CNT, pVideoContentData->pArtist != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pVideoContentData->pArtist = %ls", pVideoContentData->pArtist->GetPointer()); + pVideoContentInfoImpl->SetArtist(String(pArtistName.get())); + SysLog(NID_CNT, "pVideoContentInfoImpl->pArtist = %ls", (pVideoContentInfoImpl->GetArtist()).GetPointer()); } if (pGenreName.get() != NULL) { - pVideoContentData->pGenre = new (std::nothrow) String(pGenreName.get()); - SysTryReturnResult(NID_CNT, pVideoContentData->pGenre != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pVideoContentData->pGenre = %ls", pVideoContentData->pGenre->GetPointer()); + pVideoContentInfoImpl->SetGenre(String(pGenreName.get())); + SysLog(NID_CNT, "pVideoContentInfoImpl->pGenre = %ls", (pVideoContentInfoImpl->GetGenre()).GetPointer()); } if (pAlbumName.get() != NULL) { - pVideoContentData->pAlbumName = new (std::nothrow) String(pAlbumName.get()); - SysTryReturnResult(NID_CNT, pVideoContentData->pAlbumName != null, E_OUT_OF_MEMORY, "The memory is insufficient."); - SysLog(NID_CNT, "pVideoContentData->pAlbumName = %ls", pVideoContentData->pAlbumName->GetPointer()); + pVideoContentInfoImpl->SetAlbumName(String(pAlbumName.get())); + SysLog(NID_CNT, "pVideoContentInfoImpl->pAlbumName = %ls", (pVideoContentInfoImpl->GetAlbumName()).GetPointer()); } - pVideoContentData->duration = duration; - SysLog(NID_CNT,"pVideoContentData->duration = %d", pVideoContentData->duration); + pVideoContentInfoImpl->SetDuration(duration); + SysLog(NID_CNT,"pVideoContentInfoImpl->duration = %d", pVideoContentInfoImpl->GetDuration()); return r; } -// Convertion of system errors to osp errors +// Conversion of system errors to native errors result _ContentUtility::MapCoreErrorToNativeResult(int reason) {