[content] Change codes fabout content path not including extension
[platform/framework/native/content.git] / src / FCnt_ContentManagerUtilImpl.cpp
index 2881d29..d73ed3d 100755 (executable)
@@ -1,5 +1,4 @@
 //
-// Open Service Platform
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
  * This file contains implementation of the %_ContentManagerUtilImpl class.
  */
 
+#include <new>
 #include <stdlib.h>
+#include <aul/aul.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 <FBaseByteBuffer.h>
+#include <FBaseSysLog.h>
+#include <FBaseUtilStringTokenizer.h>
 #include <FCntImageMetadata.h>
 #include <FCntAudioMetadata.h>
 #include <FCntVideoMetadata.h>
-#include <FCnt_ContentManagerUtilImpl.h>
-#include <FCnt_AudioMetadataImpl.h>
-#include <FCnt_VideoMetadataImpl.h>
-#include <FCnt_ImageMetadataImpl.h>
+#include <FMediaImage.h>
+#include <FMediaImageBuffer.h>
+#include <FMediaImageUtil.h>
+#include <FIoDirectory.h>
+#include <FSysEnvironment.h>
+#include <FApp_AppInfo.h>
+#include <FBase_LocalizedNumParser.h>
 #include <FBase_StringConverter.h>
-#include <FIo_FileImpl.h>
 #include <FGrp_BitmapImpl.h>
+#include <FIo_FileImpl.h>
 #include <FMedia_ImageDecoder.h>
 #include <FMedia_ImageImpl.h>
-#include <FApp_AppInfo.h>
+#include "FCnt_AudioMetadataImpl.h"
+#include "FCnt_ContentManagerUtilImpl.h"
+#include "FCnt_ImageMetadataImpl.h"
+#include "FCnt_VideoMetadataImpl.h"
 
+using namespace std;
+using namespace Tizen::App;
 using namespace Tizen::Base;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Graphics;
 using namespace Tizen::Io;
 using namespace Tizen::Media;
-using namespace Tizen::Graphics;
-using namespace Tizen::App;
 using namespace Tizen::System;
-using namespace std;
 
 namespace Tizen { namespace Content
 {
+
 // Types of content, format supported and default values
-static const int IMAGE_BUFF_LENGTH = 100;
-static const int THUMBNAIL_IMAGE_WIDTH = 80;
-static const int THUMBNAIL_IMAGE_HEIGHT = 60;
-static const int MINUTES = 60;
-static const int SECONDS = 3600;
+static const int _IMAGE_BUFF_LENGTH = 100;
+static const int _THUMBNAIL_IMAGE_WIDTH = 80;
+static const int _THUMBNAIL_IMAGE_HEIGHT = 60;
+static const int _MINUTES = 60;
+static const int _SECONDS = 3600;
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_OUT_OF_MEMORY
-//
 ImageMetadata*
 _ContentManagerUtilImpl::GetImageMetaN(const String& contentPath, bool internal)
 {
@@ -75,10 +75,10 @@ _ContentManagerUtilImpl::GetImageMetaN(const String& contentPath, bool internal)
        if (!internal)
        {
                SysTryReturn(NID_CNT, VerifyFilePathCompatibility(contentPath), null, E_INVALID_ARG,
-                               "[E_INVALID_ARG] %ls is not compatible.", contentPath.GetPointer());
+                               "[E_INVALID_ARG] The path is not compatible.");
        }
        SysTryReturn(NID_CNT, _FileImpl::IsFileExist(contentPath), null, E_INVALID_ARG,
-                       "[E_INVALID_ARG] The file corresponding to contentPath could not be found.(%ls)", contentPath.GetPointer());
+                       "[E_INVALID_ARG] The file corresponding to contentPath could not be found.");
 
        // 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());
@@ -118,11 +118,8 @@ _ContentManagerUtilImpl::GetImageMetaN(const String& contentPath, bool internal)
                        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
+                       char buf[_IMAGE_BUFF_LENGTH] = {0, };
                        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;
@@ -183,47 +180,31 @@ _ContentManagerUtilImpl::GetImageMetaN(const String& contentPath, bool internal)
                                        }
                                        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 ','
-                                               }
+                                               String tempLatitude(buf);
+                                               String delim(L",");
 
-                                               char *pLocal;
-                                               std::unique_ptr<char> pCurrentLocal(null);
-                                               pLocal = setlocale (LC_ALL, 0); // Get the name of the current locale.
-                                               if( pLocal == null )
-                                               {
-                                                       SysLog(NID_CNT, "setlocale failed. (get current locale)");
-                                                       continue;
-                                               }
-                                               pCurrentLocal.reset(strdup (pLocal));
+                                               StringTokenizer strTok(tempLatitude, delim);
+                                               String token[3] = {L"", };
 
-                                               pLocal = setlocale(LC_ALL, "C");
-                                               if( pLocal == null )
+                                               int count = 0;
+                                               while (strTok.HasMoreTokens() && count < 3)
                                                {
-                                                       SysLog(NID_CNT, "setlocale failed. (set POSIX C locale)");
-                                                       continue;
+                                                       strTok.GetNextToken(token[count++]);
                                                }
 
-                                               double ddVal = atof(buf); // degree value
-                                               double mmVal = atof(mmBuff); // minutesvalue
-                                               double ssVal = atof(ssBuff); // seconds value
+                                               double ddVal = _LocalizedNumParser::ToDouble(token[0], "C"); // degree value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, E_INVALID_ARG, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
 
-                                               pLocal = setlocale (LC_ALL, pCurrentLocal.get()); // restore the locale.
-                                               if( pLocal == null )
-                                               {
-                                                       SysLog(NID_CNT, "setlocale failed. (set current locale)");
-                                                       continue;
-                                               }
+                                               double mmVal = _LocalizedNumParser::ToDouble(token[1], "C"); // minutes value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, E_INVALID_ARG, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
 
-                                               pMetadata->latitude = ddVal + (mmVal/MINUTES) + (ssVal/SECONDS);
+                                               double ssVal = _LocalizedNumParser::ToDouble(token[2], "C"); // seconds value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, E_INVALID_ARG, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
+
+                                               pMetadata->latitude = ddVal + (mmVal/_MINUTES) + (ssVal/_SECONDS);
 
                                                // if latitude designation is Southern (SOUTH) then latitude degree will be negative DD
                                                if (latitudeRef == 'S')
@@ -237,48 +218,31 @@ _ContentManagerUtilImpl::GetImageMetaN(const String& contentPath, bool internal)
                                        }
                                        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 ','
-                                               }
+                                               String tempLongitude(buf);
+                                               String delim(L",");
 
-                                               char *pLocal;
-                                               std::unique_ptr<char> pCurrentLocal(null);
-                                               pLocal = setlocale (LC_ALL, 0); // Get the name of the current locale.
-                                               if( pLocal == null )
-                                               {
-                                                       SysLog(NID_CNT, "setlocale failed. (get current locale)");
-                                                       continue;
-                                               }
-                                               pCurrentLocal.reset(strdup (pLocal));
+                                               StringTokenizer strTok(tempLongitude, delim);
+                                               String token[3] = {L"", };
 
-                                               pLocal = setlocale(LC_ALL, "C");
-                                               if( pLocal == null )
+                                               int count = 0;
+                                               while (strTok.HasMoreTokens() && count < 3)
                                                {
-                                                       SysLog(NID_CNT, "setlocale failed. (set POSIX C locale)");
-                                                       continue;
+                                                       strTok.GetNextToken(token[count++]);
                                                }
 
-                                               double ddVal = atof(buf); // degree value
-                                               double mmVal = atof(mmBuff); // minutesvalue
-                                               double ssVal = atof(ssBuff); // seconds value
+                                               double ddVal = _LocalizedNumParser::ToDouble(token[0], "C"); // degree value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
 
-                                               pLocal = setlocale (LC_ALL, pCurrentLocal.get()); // restore the locale.
-                                               if( pLocal == null )
-                                               {
-                                                       SysLog(NID_CNT, "setlocale failed. (set current locale)");
-                                                       continue;
-                                               }
+                                               double mmVal = _LocalizedNumParser::ToDouble(token[1], "C"); // minutes value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
 
-                                               pMetadata->longitude = ddVal + (mmVal/MINUTES) + (ssVal/SECONDS);
+                                               double ssVal = _LocalizedNumParser::ToDouble(token[2], "C"); // seconds value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
+
+                                               pMetadata->longitude = ddVal + (mmVal/_MINUTES) + (ssVal/_SECONDS);
 
                                                // if longitude designation is Western (WEST) then longitude degree will be negative DD
                                                if (longitudeRef == 'W')
@@ -300,27 +264,13 @@ _ContentManagerUtilImpl::GetImageMetaN(const String& contentPath, bool internal)
        return pImageMetadata.release();
 }
 
-void
-_ContentManagerUtilImpl::ParseBuffer(char* pBuffer, int& count)
-{
-       if ((*pBuffer != ',') && (*pBuffer != '\0')) // parse the buffer till ',' or '\0' and return the index
-       {
-               ParseBuffer(++pBuffer, ++count);
-       }
-}
-
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_OUT_OF_MEMORY
-//
 AudioMetadata*
 _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
 {
        ClearLastResult();
 
        SysTryReturn(NID_CNT, VerifyFilePathCompatibility(contentPath), null, E_INVALID_ARG,
-                       "[E_INVALID_ARG] %ls is not compatible.", contentPath.GetPointer());
+                       "[E_INVALID_ARG] The path is not compatible.");
        SysTryReturn(NID_CNT, _FileImpl::IsFileExist(contentPath), null, E_INVALID_ARG,
                        "[E_INVALID_ARG] The file corresponding to contentPath could not be found.");
 
@@ -340,34 +290,36 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        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 is insufficient.");
+       metadata_extractor_h tempExtractor = NULL;
 
-       int retVal = metadata_extractor_create(pExtractor.get());
+       int retVal = metadata_extractor_create(&tempExtractor);
        result r = ErrorMapToRetVal(retVal);
        SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, null, r,
                        "[%s] metadata_extractor_create failed.", GetErrorMessage(r));
 
+       unique_ptr<metadata_extractor_s, ExtractorDeleter> pExtractor(tempExtractor);
+       SysTryReturn(NID_CNT, pExtractor != null, null, E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
        // 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());
+       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 audio metadata by passing relavent attirbutes
-       char* __pAudioMeta = null;
+       char* pTempAudioMeta = null;
        unique_ptr<char, CharDeleter> pAudioMeta(null);
 
        // bitrate
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_BITRATE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_AUDIO_BITRATE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                pMetadata->bitrate = atoi(pAudioMeta.get());
        }
        else
@@ -378,10 +330,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // channelcount
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_CHANNELS, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_AUDIO_CHANNELS, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                pMetadata->channelCount = atoi(pAudioMeta.get());
        }
        else
@@ -392,10 +344,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // duration
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DURATION, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_DURATION, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                pMetadata->duration = atoi(pAudioMeta.get());
        }
        else
@@ -406,10 +358,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // frequency
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_SAMPLERATE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_AUDIO_SAMPLERATE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                pMetadata->frequency = atoi(pAudioMeta.get());
        }
        else
@@ -420,10 +372,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // albumname
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_ALBUM, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_ALBUM, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -436,10 +388,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // artist
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_ARTIST, &__pAudioMeta);
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_ARTIST, &pTempAudioMeta);
        if (pAudioMeta.get() != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -452,10 +404,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // copyright
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_COPYRIGHT, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_COPYRIGHT, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -468,10 +420,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // genre
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_GENRE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_GENRE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -484,10 +436,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // title
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_TITLE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_TITLE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -500,10 +452,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // comment
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_COMMENT, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_COMMENT, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -516,10 +468,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // description
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DESCRIPTION, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_DESCRIPTION, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -532,10 +484,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // recording date
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_RECDATE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_RECDATE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -548,10 +500,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // author
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUTHOR, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_AUTHOR, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -564,10 +516,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // track info
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_TRACK_NUM, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_TRACK_NUM, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -585,10 +537,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        }
 
        // date
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DATE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_DATE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                pMetadata->year = atoi(pAudioMeta.get());
        }
        else
@@ -600,17 +552,18 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
 
        // artwork
        int size = 0;
-       void* __pArtwork = null;
+       void* pTempArtwork = null;
        unique_ptr<void, VoidDeleter> pArtwork(null);
 
        // Get the artwork image in media file
-       retVal = metadata_extractor_get_artwork(*(pExtractor.get()), &__pArtwork, &size, &__pAudioMeta);
+       retVal = metadata_extractor_get_artwork(pExtractor.get(), &pTempArtwork, &size, &pTempAudioMeta);
+       pAudioMeta.reset(pTempAudioMeta);
 
        //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)
+       if (pTempArtwork != null)
        {
-               pArtwork.reset(__pArtwork);
+               pArtwork.reset(pTempArtwork);
 
                Image img;
                ImageFormat format = IMG_FORMAT_NONE;
@@ -627,7 +580,7 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
                                {
                                        format = img.GetImageFormat(buffer);
                                        pMetadata->pThumbnail = img.DecodeN(buffer, format, BITMAP_PIXEL_FORMAT_ARGB8888,
-                                                                        THUMBNAIL_IMAGE_WIDTH, THUMBNAIL_IMAGE_HEIGHT);
+                                                                        _THUMBNAIL_IMAGE_WIDTH, _THUMBNAIL_IMAGE_HEIGHT);
                                        if (pMetadata->pThumbnail == null)
                                        {
                                                // Because Thumbnail is one of the metadata, it is not exception in this function.
@@ -653,18 +606,13 @@ _ContentManagerUtilImpl::GetAudioMetaN(const String& contentPath)
        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());
+                       "[E_INVALID_ARG] The path is not compatible.");
        SysTryReturn(NID_CNT, _FileImpl::IsFileExist(contentPath), null, E_INVALID_ARG,
                        "[E_INVALID_ARG] The file corresponding to contentPath could not be found.");
 
@@ -684,34 +632,36 @@ _ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
        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.");
+       metadata_extractor_h tempExtractor = NULL;
 
-       int retVal = metadata_extractor_create(pExtractor.get());
+       int retVal = metadata_extractor_create(&tempExtractor);
        result r = ErrorMapToRetVal(retVal);
        SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, null, r,
                        "[%s] metadata_extractor_create failed.", GetErrorMessage(r));
 
+       unique_ptr<metadata_extractor_s, ExtractorDeleter> pExtractor(tempExtractor);
+       SysTryReturn(NID_CNT, pExtractor != null, null, E_OUT_OF_MEMORY,
+                               "[E_OUT_OF_MEMORY] The memory insufficient.");
+
        // 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());
+       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;
+       char* pTempVideoMeta = null;
        unique_ptr<char, CharDeleter> pVideoMeta(null);
 
        // width
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_WIDTH, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_VIDEO_WIDTH, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->width = atoi(pVideoMeta.get());
        }
        else
@@ -722,10 +672,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
        }
 
        // height
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_HEIGHT, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_VIDEO_HEIGHT, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->height = atoi(pVideoMeta.get());
        }
        else
@@ -736,10 +686,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
        }
 
        // video bitrate
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_BITRATE, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_VIDEO_BITRATE, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->videoBitrate = atoi(pVideoMeta.get());
        }
        else
@@ -750,10 +700,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
        }
 
        // audio bitrate
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_BITRATE, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_AUDIO_BITRATE, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->audioBitrate = atoi(pVideoMeta.get());
        }
        else
@@ -764,10 +714,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
        }
 
        // framerate
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_FPS, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_VIDEO_FPS, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->framerate = atoi(pVideoMeta.get());
        }
        else
@@ -778,10 +728,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
        }
 
        // duration
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DURATION, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_DURATION, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->duration = atoi(pVideoMeta.get());
        }
        else
@@ -792,10 +742,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
        }
 
        // genre
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_GENRE, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_GENRE, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                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.");
@@ -808,10 +758,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
        }
 
        // comment
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_COMMENT, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_COMMENT, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                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.");
@@ -824,10 +774,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
        }
 
        // description
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DESCRIPTION, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_DESCRIPTION, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                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.");
@@ -841,14 +791,15 @@ _ContentManagerUtilImpl::GetVideoMetaN(const String& contentPath)
 
        // artwork
        int size = 0;
-       void* __pArtwork = null;
+       void* pTempArtwork = 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)
+       retVal = metadata_extractor_get_artwork(pExtractor.get(), &pTempArtwork, &size, &pTempVideoMeta);
+       pVideoMeta.reset(pTempVideoMeta);
+       if (pTempArtwork != null)
        {
-               pArtwork.reset(__pArtwork);
+               pArtwork.reset(pTempArtwork);
 
                Image img;
                ImageFormat format = IMG_FORMAT_NONE;
@@ -929,11 +880,8 @@ _ContentManagerUtilImpl::GetImageMetaN(const ByteBuffer& byteBuffer)
                        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
+                       char buf[_IMAGE_BUFF_LENGTH] = {0, };
                        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;
@@ -994,21 +942,31 @@ _ContentManagerUtilImpl::GetImageMetaN(const ByteBuffer& byteBuffer)
                                        }
                                        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++)
+                                               String tempLatitude(buf);
+                                               String delim(L",");
+
+                                               StringTokenizer strTok(tempLatitude, delim);
+                                               String token[3] = {L"", };
+
+                                               int count = 0;
+                                               while (strTok.HasMoreTokens() && count < 3)
                                                {
-                                                       ssBuff[l] = mmBuff[l + index + 1]; //add 1 to skip the ','
+                                                       strTok.GetNextToken(token[count++]);
                                                }
-                                               double ddVal = atof(buf); // degree value
-                                               double mmVal = atof(mmBuff); // minutesvalue
-                                               double ssVal = atof(ssBuff); // seconds value
-                                               pMetadata->latitude = ddVal + (mmVal/MINUTES) + (ssVal/SECONDS);
+
+                                               double ddVal = _LocalizedNumParser::ToDouble(token[0], "C"); // degree value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
+
+                                               double mmVal = _LocalizedNumParser::ToDouble(token[1], "C"); // minutes value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
+
+                                               double ssVal = _LocalizedNumParser::ToDouble(token[2], "C"); // seconds value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
+
+                                               pMetadata->latitude = ddVal + (mmVal/_MINUTES) + (ssVal/_SECONDS);
 
                                                // if latitude designation is Southern (SOUTH) then latitude degree will be negative DD
                                                if (latitudeRef == 'S')
@@ -1022,22 +980,31 @@ _ContentManagerUtilImpl::GetImageMetaN(const ByteBuffer& byteBuffer)
                                        }
                                        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++)
+                                               String tempLongitude(buf);
+                                               String delim(L",");
+
+                                               StringTokenizer strTok(tempLongitude, delim);
+                                               String token[3] = {L"", };
+
+                                               int count = 0;
+                                               while (strTok.HasMoreTokens() && count < 3)
                                                {
-                                                       ssBuff[l] = mmBuff[l + index + 1]; //add 1 to skip the ','
+                                                       strTok.GetNextToken(token[count++]);
                                                }
-                                               double ddVal = atof(buf); // degree value
-                                               double mmVal = atof(mmBuff); // minutesvalue
-                                               double ssVal = atof(ssBuff); // seconds value
-                                               pMetadata->longitude = ddVal + (mmVal/MINUTES) + (ssVal/SECONDS);
+
+                                               double ddVal = _LocalizedNumParser::ToDouble(token[0], "C"); // degree value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
+
+                                               double mmVal = _LocalizedNumParser::ToDouble(token[1], "C"); // minutes value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
+
+                                               double ssVal = _LocalizedNumParser::ToDouble(token[2], "C"); // seconds value
+                                               r = GetLastResult();
+                                               SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[E_INVALID_ARG] Failed to perform ToDouble operation.");
+
+                                               pMetadata->longitude = ddVal + (mmVal/_MINUTES) + (ssVal/_SECONDS);
 
                                                // if longitude designation is Western (WEST) then longitude degree will be negative DD
                                                if (longitudeRef == 'W')
@@ -1059,11 +1026,6 @@ _ContentManagerUtilImpl::GetImageMetaN(const ByteBuffer& byteBuffer)
        return pImageMetadata.release();
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_OUT_OF_MEMORY
-//
 AudioMetadata*
 _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
 {
@@ -1086,31 +1048,33 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
                        "[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.");
+       metadata_extractor_h tempExtractor = NULL;
 
-       int retVal = metadata_extractor_create(pExtractor.get());
+       int retVal = metadata_extractor_create(&tempExtractor);
        result r = ErrorMapToRetVal(retVal);
        SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, null, r,
                        "[%s] metadata_extractor_create failed.", GetErrorMessage(r));
 
+       unique_ptr<metadata_extractor_s, ExtractorDeleter> pExtractor(tempExtractor);
+       SysTryReturn(NID_CNT, pExtractor != null, null, E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
        const byte* pByte = byteBuffer.GetPointer();
 
-       retVal = metadata_extractor_set_buffer(*(pExtractor.get()), pByte, bufferLen);
+       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;
+       char* pTempAudioMeta = null;
        unique_ptr<char, CharDeleter> pAudioMeta(null);
 
        // bitrate
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_BITRATE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_AUDIO_BITRATE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                pMetadata->bitrate = atoi(pAudioMeta.get());
        }
        else
@@ -1121,10 +1085,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // channelcount
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_CHANNELS, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_AUDIO_CHANNELS, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                pMetadata->channelCount = atoi(pAudioMeta.get());
        }
        else
@@ -1135,10 +1099,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // duration
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DURATION, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_DURATION, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                pMetadata->duration = atoi(pAudioMeta.get());
        }
        else
@@ -1149,10 +1113,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // frequency
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_SAMPLERATE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_AUDIO_SAMPLERATE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                pMetadata->frequency = atoi(pAudioMeta.get());
        }
        else
@@ -1163,10 +1127,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // albumname
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_ALBUM, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_ALBUM, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -1179,10 +1143,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // artist
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_ARTIST, &__pAudioMeta);
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_ARTIST, &pTempAudioMeta);
        if (pAudioMeta.get() != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -1195,10 +1159,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // copyright
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_COPYRIGHT, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_COPYRIGHT, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -1211,10 +1175,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // genre
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_GENRE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_GENRE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -1227,10 +1191,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // title
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_TITLE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_TITLE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -1243,10 +1207,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // comment
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_COMMENT, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_COMMENT, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -1259,10 +1223,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // description
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DESCRIPTION, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_DESCRIPTION, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -1275,10 +1239,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // recording date
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_RECDATE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_RECDATE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -1291,10 +1255,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // author
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUTHOR, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_AUTHOR, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -1307,10 +1271,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // track info
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_TRACK_NUM, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_TRACK_NUM, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                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.");
@@ -1328,10 +1292,10 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        }
 
        // date
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DATE, &__pAudioMeta);
-       if (__pAudioMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_DATE, &pTempAudioMeta);
+       if (pTempAudioMeta != null)
        {
-               pAudioMeta.reset(__pAudioMeta);
+               pAudioMeta.reset(pTempAudioMeta);
                pMetadata->year = atoi(pAudioMeta.get());
        }
        else
@@ -1343,17 +1307,18 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
 
        // artwork
        int size = 0;
-       void* __pArtwork = null;
+       void* pTempArtwork = null;
        unique_ptr<void, VoidDeleter> pArtwork(null);
 
        // Get the artwork image in media file
-       retVal = metadata_extractor_get_artwork(*(pExtractor.get()), &__pArtwork, &size, &__pAudioMeta);
+       retVal = metadata_extractor_get_artwork(pExtractor.get(), &pTempArtwork, &size, &pTempAudioMeta);
+       pAudioMeta.reset(pTempAudioMeta);
 
        //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)
+       if (pTempArtwork != null)
        {
-               pArtwork.reset(__pArtwork);
+               pArtwork.reset(pTempArtwork);
 
                Image img;
                ImageFormat format = IMG_FORMAT_NONE;
@@ -1370,7 +1335,7 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
                                {
                                        format = img.GetImageFormat(buffer);
                                        pMetadata->pThumbnail = img.DecodeN(buffer, format, BITMAP_PIXEL_FORMAT_ARGB8888,
-                                                                        THUMBNAIL_IMAGE_WIDTH, THUMBNAIL_IMAGE_HEIGHT);
+                                                                        _THUMBNAIL_IMAGE_WIDTH, _THUMBNAIL_IMAGE_HEIGHT);
                                        if (pMetadata->pThumbnail == null)
                                        {
                                                // Because Thumbnail is one of the metadata, it is not exception in this function.
@@ -1396,11 +1361,6 @@ _ContentManagerUtilImpl::GetAudioMetaN(const ByteBuffer& byteBuffer)
        return pAudioMetadata.release();
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_OUT_OF_MEMORY
-//
 VideoMetadata*
 _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
 {
@@ -1423,31 +1383,33 @@ _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
                        "[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 insufficient.");
+       metadata_extractor_h tempExtractor = NULL;
 
-       int retVal = metadata_extractor_create(pExtractor.get());
+       int retVal = metadata_extractor_create(&tempExtractor);
        result r = ErrorMapToRetVal(retVal);
        SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, null, r,
                        "[%s] metadata_extractor_create failed.", GetErrorMessage(r));
 
+       unique_ptr<metadata_extractor_s, ExtractorDeleter> pExtractor(tempExtractor);
+       SysTryReturn(NID_CNT, pExtractor != null, null, E_OUT_OF_MEMORY,
+                               "[E_OUT_OF_MEMORY] The memory insufficient.");
+
        const byte* pByte = byteBuffer.GetPointer();
 
-       retVal = metadata_extractor_set_buffer(*(pExtractor.get()), pByte, bufferLen);
+       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 video metadata by passing relavent attirbutes
-       char* __pVideoMeta = null;
+       char* pTempVideoMeta = null;
        unique_ptr<char, CharDeleter> pVideoMeta(null);
 
        // width
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_WIDTH, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_VIDEO_WIDTH, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->width = atoi(pVideoMeta.get());
        }
        else
@@ -1458,10 +1420,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
        }
 
        // height
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_HEIGHT, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_VIDEO_HEIGHT, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->height = atoi(pVideoMeta.get());
        }
        else
@@ -1472,10 +1434,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
        }
 
        // video bitrate
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_BITRATE, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_VIDEO_BITRATE, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->videoBitrate = atoi(pVideoMeta.get());
        }
        else
@@ -1486,10 +1448,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
        }
 
        // audio bitrate
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_AUDIO_BITRATE, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_AUDIO_BITRATE, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->audioBitrate = atoi(pVideoMeta.get());
        }
        else
@@ -1500,10 +1462,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
        }
 
        // framerate
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_VIDEO_FPS, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_VIDEO_FPS, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->framerate = atoi(pVideoMeta.get());
        }
        else
@@ -1514,10 +1476,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
        }
 
        // duration
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DURATION, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_DURATION, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                pMetadata->duration = atoi(pVideoMeta.get());
        }
        else
@@ -1528,10 +1490,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
        }
 
        // genre
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_GENRE, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_GENRE, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                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.");
@@ -1544,10 +1506,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
        }
 
        // comment
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_COMMENT, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_COMMENT, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                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.");
@@ -1560,10 +1522,10 @@ _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
        }
 
        // description
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_DESCRIPTION, &__pVideoMeta);
-       if (__pVideoMeta != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_DESCRIPTION, &pTempVideoMeta);
+       if (pTempVideoMeta != null)
        {
-               pVideoMeta.reset(__pVideoMeta);
+               pVideoMeta.reset(pTempVideoMeta);
                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.");
@@ -1577,14 +1539,15 @@ _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
 
        // artwork
        int size = 0;
-       void* __pArtwork = null;
+       void* pTempArtwork = 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)
+       retVal = metadata_extractor_get_artwork(pExtractor.get(), &pTempArtwork, &size, &pTempVideoMeta);
+       pVideoMeta.reset(pTempVideoMeta);
+       if (pTempArtwork != null)
        {
-               pArtwork.reset(__pArtwork);
+               pArtwork.reset(pTempArtwork);
 
                Image img;
                ImageFormat format = IMG_FORMAT_NONE;
@@ -1621,24 +1584,18 @@ _ContentManagerUtilImpl::GetVideoMetaN(const ByteBuffer& byteBuffer)
        return pVideoMetadata.release();
 }
 
-//
-// E_SUCCESS
-// E_INVALID_ARG
-// E_OUT_OF_MEMORY
-// E_FILE_NOT_FOUND
-// E_UNSUPPORTED_FORMAT
-//
 ContentType
 _ContentManagerUtilImpl::CheckContentType(const String& contentPath, bool internal)
 {
        ClearLastResult();
 
        ContentType contentType = CONTENT_TYPE_UNKNOWN;
+       String mimeType(L"");
 
        if (!internal)
        {
                SysTryReturn(NID_CNT, VerifyFilePathCompatibility(contentPath), contentType, E_INVALID_ARG,
-                               "[E_INVALID_ARG] %ls is not compatible.", contentPath.GetPointer());
+                               "[E_INVALID_ARG] The path is not compatible.");
        }
        SysTryReturn(NID_CNT, contentPath.GetLength() != 0, contentType, E_INVALID_ARG,
                        "[E_INVALID_ARG] The length of contentPath is 0.");
@@ -1647,25 +1604,46 @@ _ContentManagerUtilImpl::CheckContentType(const String& contentPath, bool intern
 
        String fileExt = _FileImpl::GetFileExtension(contentPath);
        result r = GetLastResult();
-       SysTryReturn(NID_CNT, !IsFailed(r), contentType, r, "[%s] GetFileExtension failed.", GetErrorMessage(r));
 
-       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.");
+       if (!IsFailed(r))
+       {
+               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.");
+
+               char* pTempMimeType = null;
+               int retVal = mime_type_get_mime_type(pFormat.get(), &pTempMimeType);
+               SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, contentType, E_INVALID_ARG,
+                               "[E_INVALID_ARG] mime_type_get_mime_type failed.");
+               SysTryReturn(NID_CNT, pTempMimeType != null, contentType, E_INVALID_ARG,
+                               "[E_INVALID_ARG] mime_type_get_mime_type failed.");
+
+               unique_ptr<char, CharDeleter> pMimeType;
+               pMimeType.reset(pTempMimeType);
 
-       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.");
+               SysLog(NID_CNT, "The MIME type for %ls is %s", fileExt.GetPointer(), pTempMimeType);
+
+               r = mimeType.Append(pMimeType.get());
+               SysTryReturn(NID_CNT, !IsFailed(r), contentType, E_OUT_OF_MEMORY,
+                               "[E_OUT_OF_MEMORY] Failed to perform Append operation.");
+       }
+       else
+       {
+               SysLog(NID_CNT, "[%s] Failed to perform GetFileExtension operation.", GetErrorMessage(r));
 
-       unique_ptr<char, CharDeleter> pMimeType;
-       pMimeType.reset(__pMimeType);
+               unique_ptr<char[]> pTempPath(_StringConverter::CopyToCharArrayN(contentPath));
+               SysTryReturn(NID_CNT, pTempPath != null, contentType, E_OUT_OF_MEMORY,
+                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-       SysLog(NID_CNT, "The MIME type for %ls is %s", fileExt.GetPointer(), __pMimeType);
+               char tempType[255] = {0, };
+               int ret = aul_get_mime_from_file(pTempPath.get(), tempType, sizeof(tempType));
+               SysTryReturn(NID_CNT, ret == AUL_R_OK, contentType, E_INVALID_ARG,
+                               "[E_INVALID_ARG] Failed to perform aul_get_mime_from_file operation.");
 
-       String mimeType(pMimeType.get());
+               r = mimeType.Append(tempType);
+               SysTryReturn(NID_CNT, !IsFailed(r), contentType, E_OUT_OF_MEMORY,
+                               "[E_OUT_OF_MEMORY] Failed to perform Append operation.");
+       }
 
        if (mimeType.Contains(L"image"))
        {
@@ -1682,10 +1660,7 @@ _ContentManagerUtilImpl::CheckContentType(const String& contentPath, bool intern
        }
        else if (mimeType.Contains(L"video"))
        {
-               String format;
-               fileExt.ToLowerCase(format);
-
-               if (format == L"3gp" || format == L"mp4")
+               if (mimeType == L"video/3gpp" || mimeType == L"video/mp4")
                {
                        return CheckStream(contentPath);
                }
@@ -1710,37 +1685,38 @@ _ContentManagerUtilImpl::CheckStream(const String& contentPath)
        ClearLastResult();
 
        ContentType contentType = CONTENT_TYPE_UNKNOWN;
+       metadata_extractor_h tempExtractor = 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.");
-
-       int retVal = metadata_extractor_create(pExtractor.get());
+       int retVal = metadata_extractor_create(&tempExtractor);
        result r = ErrorMapToRetVal(retVal);
        SysTryReturn(NID_CNT, retVal == METADATA_EXTRACTOR_ERROR_NONE, contentType, r,
                        "[%s] metadata_extractor_create failed.", GetErrorMessage(r));
 
+       unique_ptr<metadata_extractor_s, ExtractorDeleter> pExtractor(tempExtractor);
+       SysTryReturn(NID_CNT, pExtractor != null, contentType, E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
        //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_set_path(*(pExtractor.get()), pContentPath.get());
+       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));
 
        //Check whether it is an audio or video file.
-       char* __pAudio = null;
+       char* pTempAudio = null;
        unique_ptr<char, CharDeleter> pAudio(null);
 
-       char* __pVideo = null;
+       char* pTempVideo = null;
        unique_ptr<char, CharDeleter> pVideo(null);
 
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_HAS_AUDIO, &__pAudio);
-       if (__pAudio != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_HAS_AUDIO, &pTempAudio);
+       if (pTempAudio != null)
        {
-               pAudio.reset(__pAudio);
+               pAudio.reset(pTempAudio);
        }
        else
        {
@@ -1749,10 +1725,10 @@ _ContentManagerUtilImpl::CheckStream(const String& contentPath)
                                "[%s] metadata_extractor_get_metadata failed.", GetErrorMessage(r));
        }
 
-       retVal = metadata_extractor_get_metadata(*(pExtractor.get()), METADATA_HAS_VIDEO, &__pVideo);
-       if (__pVideo != null)
+       retVal = metadata_extractor_get_metadata(pExtractor.get(), METADATA_HAS_VIDEO, &pTempVideo);
+       if (pTempVideo != null)
        {
-               pVideo.reset(__pVideo);
+               pVideo.reset(pTempVideo);
        }
        else
        {
@@ -1761,17 +1737,17 @@ _ContentManagerUtilImpl::CheckStream(const String& contentPath)
                                "[%s] metadata_extractor_get_metadata failed.", GetErrorMessage(r));
        }
 
-       if (*(pAudio.get()) > 0 && *(pVideo.get()) == 0)
+       if (*(pAudio.get()) > '0' && *(pVideo.get()) == '0')
        {
                SysLog(NID_CNT, "The result of CheckStream() is audio");
                return CONTENT_TYPE_AUDIO;
        }
-       else if (*(pAudio.get()) == 0 && *(pVideo.get()) > 0)
+       else if (*(pAudio.get()) == '0' && *(pVideo.get()) > '0')
        {
                SysLog(NID_CNT, "The result of CheckStream() is video");
                return CONTENT_TYPE_VIDEO;
        }
-       else if (*(pAudio.get()) > 0 && *(pVideo.get()) > 0)
+       else if (*(pAudio.get()) > '0' && *(pVideo.get()) > '0')
        {
                SysLog(NID_CNT, "The result of CheckStream() is video");
                return CONTENT_TYPE_VIDEO;
@@ -1839,9 +1815,6 @@ _ContentManagerUtilImpl::ErrorMapToRetVal(int retVal)
        return r;
 }
 
-/**
- * deprecation
- */
 result
 _ContentManagerUtilImpl::CopyToMediaDirectory(const String& srcContentPath, const String& destContentPath)
 {
@@ -1865,9 +1838,6 @@ _ContentManagerUtilImpl::CopyToMediaDirectory(const String& srcContentPath, cons
        return r;
 }
 
-/**
- * deprecation
- */
 result
 _ContentManagerUtilImpl::MoveToMediaDirectory(const String& srcContentPath, const String& destContentPath)
 {
@@ -1890,4 +1860,5 @@ _ContentManagerUtilImpl::MoveToMediaDirectory(const String& srcContentPath, cons
 
        return r;
 }
+
 }}