// limitations under the License.
//
-#include <libexif/exif-loader.h>
+
#include <Commons/StringUtils.h>
#include <Commons/ThreadPool.h>
#include "IContentManager.h"
#include "ContentVideo.h"
#include "ContentAudio.h"
#include "ContentManager.h"
-#include "ContentExif.h"
#include "ContentUtility.h"
return ret;
}
-bool IMediacontentManager::updateMetadata(MediacontentImagePtr &ptr)
-{
- LogDebug("ContentManager::updateMetadata called");
- string orientation = ptr->getImageOrientation();
- unsigned char orientation_value;
- LogDebug("ContentManager::updateMetadata called1");
- if ( orientation.compare("NORMAL")==0)
- {
- orientation_value= 1; //MEDIA_CONTENT_ORIENTATION_NORMAL
- }
- else if (orientation.compare("FLIP_HORIZONTAL")==0)
- {
- orientation_value = 2; //MEDIA_CONTENT_ORIENTATION_HFLIP;
- }
- else if (orientation.compare("ROTATE_180")==0)
- {
- orientation_value = 3; //MEDIA_CONTENT_ORIENTATION_ROT_180;
- }
- else if (orientation.compare("FLIP_VERTICAL")==0)
- {
- orientation_value = 4; //MEDIA_CONTENT_ORIENTATION_VFLIP;
- }
- else if (orientation.compare("TRANSPOSE")==0)
- {
- orientation_value = 5; //MEDIA_CONTENT_ORIENTATION_TRANSPOSE;
- }
- else if (orientation.compare("ROTATE_90")==0)
- {
- orientation_value = 6; //MEDIA_CONTENT_ORIENTATION_ROT_90;
- }
- else if (orientation.compare("TRANSVERSE")==0)
- {
- orientation_value = 7; //MEDIA_CONTENT_ORIENTATION_TRANSVERSE;
- }
- else if (orientation.compare("ROTATE_270")==0)
- {
- orientation_value = 8; //MEDIA_CONTENT_ORIENTATION_ROT_270;
- }
- else
- {
- LogDebug("wrong value.");
- return false;
- }
- LogDebug("ContentManager::updateMetadata called2");
- string real_path = ContentUtility::convertUriToPath(ptr->getFilePath());
- ContentExif exif(real_path.c_str());
- int res = exif.LodExif();
- if( res == 0)
- {
- ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "Invalid image");
- return false;
- }
- else if(res < 0)
- {
- ThrowMsg(WrtDeviceApis::Commons::UnsupportedException, "Not supported image type");
- return false;
-
- }
- exif.SetExifChar(EXIF_TAG_ORIENTATION,orientation_value);
-
-
- return true;
-
-}
}
}