Add : AlbumArtist and RecordedDate information for content 62/13362/1
authorSeokpil Park <seokpil.park@samsung.com>
Fri, 27 Sep 2013 09:56:25 +0000 (18:56 +0900)
committerSeokpil Park <seokpil.park@samsung.com>
Wed, 4 Dec 2013 07:12:21 +0000 (16:12 +0900)
Change-Id: Id3025e23961b0d2ad795e9917a140dc0b45d942f
Signed-off-by: Seokpil Park <seokpil.park@samsung.com>
src/FCnt_AudioContentInfoImpl.cpp
src/FCnt_ContentManagerImpl.cpp
src/FCnt_ContentUtility.cpp
src/FCnt_VideoContentInfoImpl.cpp
src/inc/FCnt_AudioContentInfoImpl.h
src/inc/FCnt_VideoContentInfoImpl.h

index 88a0e50..5afe79d 100644 (file)
@@ -46,6 +46,7 @@ _AudioContentInfoImpl::_AudioContentInfoImpl(void)
        , __title(L"")
        , __albumName(L"")
        , __artist(L"")
+       , __albumArtist(L"")
        , __composer(L"")
        , __genre(L"")
        , __copyright(L"")
@@ -205,6 +206,12 @@ _AudioContentInfoImpl::GetArtist(void) const
 }
 
 String
+_AudioContentInfoImpl::GetAlbumArtist(void) const
+{
+       return __albumArtist;
+}
+
+String
 _AudioContentInfoImpl::GetComposer(void) const
 {
        if (__composer.IsEmpty())
@@ -295,6 +302,12 @@ _AudioContentInfoImpl::SetArtist(const Tizen::Base::String& artist)
 }
 
 void
+_AudioContentInfoImpl::SetAlbumArtist(const Tizen::Base::String& albumArtist)
+{
+       __albumArtist = albumArtist;
+}
+
+void
 _AudioContentInfoImpl::SetComposer(const Tizen::Base::String& composer)
 {
        __composer = composer;
index 07614cb..fbede74 100644 (file)
@@ -1875,6 +1875,20 @@ _ContentManagerImpl::MakeAudioContentInfo(const media_info_h pMediaInfo, void* p
                SysLog(NID_CNT, "META: artist[%ls]", (String(pStrValue.get())).GetPointer());
        }
 
+       // album artist
+       val = audio_meta_get_album_artist(*(pAudioMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_album_artist failed[%d].", val);
+
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
+
+               pAudioContentInfoImpl->SetAlbumArtist(String(pStrValue.get()));
+
+               SysLog(NID_CNT, "META: album artist[%ls]", (String(pStrValue.get())).GetPointer());
+       }
+
        // composer
        val = audio_meta_get_composer(*(pAudioMeta.get()), &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
@@ -2049,6 +2063,92 @@ _ContentManagerImpl::MakeVideoContentInfo(const media_info_h pMediaInfo, void* p
        pVideoContentInfoImpl->SetDuration(intValue);
        SysLog(NID_CNT, "META: duration[%d]", intValue);
 
+       // recorded date
+       val = video_meta_get_recorded_date(*(pVideoMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "video_meta_get_recorded_date failed[%d].", val);
+
+       DateTime dt;
+
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
+               String recordedDate(pStrValue.get());
+               String newRecordedDate(L"");
+
+               // detour the unexpected recorded date format
+               String tempDelim(L"+-Z");
+               String token;
+
+               StringTokenizer tempStrTok(recordedDate, tempDelim);
+
+               result r = tempStrTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               recordedDate = token;
+
+               String delim(L": ");
+               String year(L"");
+
+               StringTokenizer strTok(recordedDate, 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 = newRecordedDate.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newRecordedDate.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 = newRecordedDate.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newRecordedDate.Append(L"/");
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               // Append year
+               r = newRecordedDate.Append(year);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newRecordedDate.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 = newRecordedDate.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = DateTime::Parse(newRecordedDate, dt);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform Parse operation for DateTime.");
+       }
+       else
+       {
+               dt = DateTime::GetMinValue();
+       }
+
+       pVideoContentInfoImpl->SetVideoRecordedDate(dt);
+       SysLog(NID_CNT, "META: recorded date[%ls]", dt.ToString().GetPointer());
+
        // Get some information from metadata extractor when calling VideoContentInfo (framerate, audio bitrate, video bitrate)
 
        return E_SUCCESS;
index ffb706b..3355556 100644 (file)
@@ -196,7 +196,6 @@ _ContentUtility::FillContentData(media_info_h mediaHandle, _ContentInfoImpl* pIn
        ret = media_info_get_size(mediaHandle, &contentSize);
        SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform media_info_get_size operation.");
 
-
        ret = media_info_get_latitude(mediaHandle, &latitude);
        SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform media_info_get_latitude operation.");
 
@@ -618,6 +617,7 @@ _ContentUtility::FillAudioContentData(media_info_h mediaHandle, _AudioContentInf
        std::unique_ptr<char, UtilCharDeleter> pTitle;
        std::unique_ptr<char, UtilCharDeleter> pAlbumName;
        std::unique_ptr<char, UtilCharDeleter> pArtistName;
+       std::unique_ptr<char, UtilCharDeleter> pAlbumArtistName;
        std::unique_ptr<char, UtilCharDeleter> pGenreName;
        std::unique_ptr<char, UtilCharDeleter> pComposerName;
        std::unique_ptr<char, UtilCharDeleter> pYear;
@@ -666,6 +666,16 @@ _ContentUtility::FillAudioContentData(media_info_h mediaHandle, _AudioContentInf
                SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform audio_meta_get_artist operation.");
        }
 
+       ret = audio_meta_get_album_artist(pAudioHandle.get(), &pAudioMetaValue);
+       if (pAudioMetaValue != null)
+       {
+               pAlbumArtistName.reset(pAudioMetaValue);
+       }
+       else
+       {
+               SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret), "Failed to perform audio_meta_get_album_artist operation.");
+       }
+
        ret = audio_meta_get_genre(pAudioHandle.get(), &pAudioMetaValue);
        if (pAudioMetaValue != null)
        {
@@ -755,6 +765,13 @@ _ContentUtility::FillAudioContentData(media_info_h mediaHandle, _AudioContentInf
                SysLog(NID_CNT, "pAudioContentInfoImpl->pArtist = %ls", (pAudioContentInfoImpl->GetArtist()).GetPointer());
        }
 
+       if (pAlbumArtistName.get() != NULL)
+       {
+               pAudioContentInfoImpl->SetAlbumArtist(String(pAlbumArtistName.get()));
+               SysLog(NID_CNT, "pAudioContentInfoImpl->pAlbumArtist = %ls", (pAudioContentInfoImpl->GetAlbumArtist()).GetPointer());
+       }
+
+
        if (pGenreName.get() != NULL)
        {
                pAudioContentInfoImpl->SetGenre(String(pGenreName.get()));
@@ -805,6 +822,7 @@ _ContentUtility::FillVideoContentData(media_info_h mediaHandle, _VideoContentInf
        std::unique_ptr<char, UtilCharDeleter> pGenreName;
        std::unique_ptr<char, UtilCharDeleter> pTitle;
        std::unique_ptr<char, UtilCharDeleter> pAlbumName;
+       std::unique_ptr<char, UtilCharDeleter> pRecordedDate;
        int duration = 0;
 
        video_meta_h tempMeta = NULL;
@@ -895,6 +913,92 @@ _ContentUtility::FillVideoContentData(media_info_h mediaHandle, _VideoContentInf
        pVideoContentInfoImpl->SetDuration(duration);
        SysLog(NID_CNT,"pVideoContentInfoImpl->duration = %d", pVideoContentInfoImpl->GetDuration());
 
+       // recorded date
+       ret = video_meta_get_recorded_date(pVideoHandle.get(), &pVideoMetaValue);
+       SysTryReturnResult(NID_CNT, ret == MEDIA_CONTENT_ERROR_NONE, MapCoreErrorToNativeResult(ret),
+                       "Failed to perform video_meta_get_recorded_date operation.");
+
+       DateTime dt;
+
+       if (pVideoMetaValue != NULL)
+       {
+               pRecordedDate.reset(pVideoMetaValue);
+               String recordedDate(pRecordedDate.get());
+               String newRecordedDate(L"");
+
+               // detour the unexpected recorded date format
+               String tempDelim(L"+-Z");
+               String token;
+
+               StringTokenizer tempStrTok(recordedDate, tempDelim);
+
+               r = tempStrTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               recordedDate = token;
+
+               String delim(L": ");
+               String year(L"");
+
+               StringTokenizer strTok(recordedDate, 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 = newRecordedDate.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newRecordedDate.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 = newRecordedDate.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newRecordedDate.Append(L"/");
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               // Append year
+               r = newRecordedDate.Append(year);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newRecordedDate.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 = newRecordedDate.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = DateTime::Parse(newRecordedDate, dt);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform Parse operation for DateTime.");
+       }
+       else
+       {
+               dt = DateTime::GetMinValue();
+       }
+
+       pVideoContentInfoImpl->SetVideoRecordedDate(dt);
+       SysLog(NID_CNT, "pVideoContentInfoImpl->recordedDate = %ls", dt.ToString().GetPointer());
+
        return r;
 }
 
index 46ee88a..88667d6 100644 (file)
@@ -290,6 +290,12 @@ _VideoContentInfoImpl::GetDuration(void) const
        return __duration;
 }
 
+DateTime
+_VideoContentInfoImpl::GetVideoRecordedDate(void) const
+{
+       return __recordedDate;
+}
+
 void
 _VideoContentInfoImpl::SetGenre(const Tizen::Base::String& genre)
 {
@@ -356,6 +362,12 @@ _VideoContentInfoImpl::SetDuration(long duration)
        __duration = duration;
 }
 
+void
+_VideoContentInfoImpl::SetVideoRecordedDate(const DateTime& recordedDate)
+{
+       __recordedDate = recordedDate;
+}
+
 result
 _VideoContentInfoImpl::GetVideoMetadata(void) const
 {
index 5802a1f..23ad234 100644 (file)
@@ -47,6 +47,8 @@ public:
 
        Tizen::Base::String GetArtist(void) const;
 
+       Tizen::Base::String GetAlbumArtist(void) const;
+
        Tizen::Base::String GetComposer(void) const;
 
        Tizen::Base::String GetAlbumName(void) const;
@@ -67,6 +69,8 @@ public:
 
        void SetArtist(const Tizen::Base::String& artist);
 
+       void SetAlbumArtist(const Tizen::Base::String& albumArtist);
+
        void SetComposer(const Tizen::Base::String& composer);
 
        void SetAlbumName(const Tizen::Base::String& albumName);
@@ -98,6 +102,7 @@ private:
        Tizen::Base::String __title;
        Tizen::Base::String __albumName;
        Tizen::Base::String __artist;
+       Tizen::Base::String __albumArtist;
        Tizen::Base::String __composer;
        Tizen::Base::String __genre;
        Tizen::Base::String __copyright;
index f56621e..8a31392 100644 (file)
@@ -65,6 +65,8 @@ public:
 
        long GetDuration(void) const;
 
+       Tizen::Base::DateTime GetVideoRecordedDate(void) const;
+
        void SetGenre(const Tizen::Base::String& genre);
 
        void SetArtist(const Tizen::Base::String& artist);
@@ -87,6 +89,8 @@ public:
 
        void SetDuration(long duration);
 
+       void SetVideoRecordedDate(const Tizen::Base::DateTime& recordedDate);
+
        static _VideoContentInfoImpl* GetInstance(VideoContentInfo& videoContentInfo);
 
        static const _VideoContentInfoImpl* GetInstance(const VideoContentInfo& videoContentInfo);
@@ -109,6 +113,7 @@ private:
        Tizen::Base::String __genre;
        Tizen::Base::String __title;
        Tizen::Base::String __albumName;
+       Tizen::Base::DateTime __recordedDate;
 
 };  // _VideoContentInfoImpl