category, keyword, location_tag, content_name, age_rating, author, provider, last_played_time, played_count, favourite, \
bitrate, bitpersample, samplerate, channel, duration, longitude, latitude, altitude, exposure_time, fnumber, iso, model, width, height, datetaken, orientation, \
rating, is_drm, storage_type, burst_id, timeline, weather, sync_status, \
- file_name_pinyin, title_pinyin, album_pinyin, artist_pinyin, album_artist_pinyin, genre_pinyin, composer_pinyin, copyright_pinyin, description_pinyin, storage_uuid";
+ file_name_pinyin, title_pinyin, album_pinyin, artist_pinyin, album_artist_pinyin, genre_pinyin, composer_pinyin, copyright_pinyin, description_pinyin, storage_uuid, is_360";
/* This sql is due to sqlite3_mprintf's wrong operation when using floating point in the text format */
/* This code will be removed when sqlite3_mprintf works clearly */
%Q, %Q, %Q, %Q, %Q, %Q, %Q, %d, %d, %d, \
%d, %d, %d, %d, %d, %.6f, %.6f, %.6f, %Q, %.6f, %d, %Q, %d, %d, %Q, %d, \
%d, %d, %d, %Q, %d, %Q, %d, \
- %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q);",
+ %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %d);",
content_info->storage_uuid, db_fields,
content_info->media_uuid,
content_info->path,
content_info->media_meta.composer_pinyin,
content_info->media_meta.copyright_pinyin,
content_info->media_meta.description_pinyin,
- content_info->storage_uuid
+ content_info->storage_uuid,
+ content_info->media_meta.is_360
);
if (burst_id) {
recorded_date=%Q, copyright=%Q, track_num=%Q, description=%Q, bitrate=%d, bitpersample=%d, samplerate=%d, channel=%d, \
duration=%d, longitude=%.6f, latitude=%.6f, altitude=%.6f, width=%d, height=%d, datetaken=%Q, orientation=%d, exposure_time=%Q,\
fnumber=%.6f, iso=%d, model=%Q, rating=%d, weather=%Q, file_name_pinyin=%Q, title_pinyin=%Q, album_pinyin=%Q, \
- artist_pinyin=%Q, album_artist_pinyin=%Q, genre_pinyin=%Q, composer_pinyin=%Q, copyright_pinyin=%Q, description_pinyin=%Q WHERE path=%Q;",
+ artist_pinyin=%Q, album_artist_pinyin=%Q, genre_pinyin=%Q, composer_pinyin=%Q, copyright_pinyin=%Q, description_pinyin=%Q, is_360=%d WHERE path=%Q;",
storage_id,
//content_info->folder_uuid,
content_info->thumbnail_path,
content_info->media_meta.composer_pinyin,
content_info->media_meta.copyright_pinyin,
content_info->media_meta.description_pinyin,
+ content_info->media_meta.is_360,
content_info->path
);
return MS_MEDIA_ERR_NONE;
}
+int image_360_check(char *path)
+{
+ FILE *fp = NULL;
+ long app1_size = 0;
+ int size = 1;
+ unsigned char exif_header[4];
+ unsigned char exif_app1[2];
+ unsigned char *exif_app1_data;
+ unsigned char exif_app1_xmp[2];
+ long exif_app1_xmp_size = 0;
+ unsigned char exif_app1_xmp_t[2];
+ char *xmp_data = 0;
+ int size1 = 0;
+ int size2 = 0;
+ char ch;
+ int temp = 0;
+
+ fp = fopen(path, "rb");
+ if (fp == NULL)
+ return 0;
+
+ size = fread(exif_header, 1, sizeof (exif_header), fp);
+ if (size <= 0)
+ return 0;
+
+ if ((exif_header[0] == 0xff) && (exif_header[1] == 0xd8) && (exif_header[2] == 0xff) && (exif_header[3] == 0xe1)) {
+ size = fread(exif_app1, 1, sizeof (exif_app1), fp);
+ if (size <= 0)
+ return 0;
+
+ size1 = exif_app1[0];
+ size2 = exif_app1[1];
+
+ app1_size = size1 * 256 + size2 - 2;
+
+ if (fseek(fp, app1_size, SEEK_CUR) != 0)
+ return 0;
+
+ size = fread(exif_app1_xmp, 1, sizeof (exif_app1_xmp), fp);
+ if (size <= 0)
+ return 0;
+
+ if ((exif_app1_xmp[0] == 0xff) && (exif_app1_xmp[1] == 0xe1)) {
+ int result = 0;
+ size = fread(exif_app1_xmp_t, 1, sizeof (exif_app1_xmp_t), fp);
+ if (size <= 0)
+ return 0;
+
+ size1 = exif_app1_xmp_t[0];
+ size2 = exif_app1_xmp_t[1];
+
+ exif_app1_xmp_size = size1 * 256 + size2 - 2;
+
+ xmp_data = (char *)malloc(exif_app1_xmp_size);
+ memset(xmp_data, 0x00, exif_app1_xmp_size);
+ while (exif_app1_xmp_size >= 0) {
+ exif_app1_xmp_size--;
+ ch = (char)fgetc(fp);
+ if (ch == '\0')
+ continue;
+ *xmp_data = ch;
+ xmp_data++;
+ temp++;
+ }
+ xmp_data = xmp_data - temp;
+
+ if(strstr(xmp_data, "UsePanoramaViewer")
+ && strstr(xmp_data, "True")
+ && strstr(xmp_data, "ProjectionType")
+ && strstr(xmp_data, "equirectangular"))
+ result = 1;
+
+ free(xmp_data);
+
+ return result;
+ } else {
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+ return 0;
+}
+
int _media_svc_extract_image_metadata(sqlite3 *handle, media_svc_content_info_s *content_info)
{
int ret = MS_MEDIA_ERR_NONE;
goto GET_WIDTH_HEIGHT;
}
+ content_info->media_meta.is_360 = image_360_check(path);
+
if (__media_svc_get_exif_info(ed, NULL, NULL, &value, EXIF_TAG_GPS_LATITUDE) == MS_MEDIA_ERR_NONE) {
if (__media_svc_get_exif_info(ed, buf, NULL, NULL, EXIF_TAG_GPS_LATITUDE_REF) == MS_MEDIA_ERR_NONE) {
if (strlen(buf) > 0) {
SAFE_FREE(err_attr_name);
}
+ mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_360, &content_info->media_meta.is_360, NULL);
+
+ if (mmf_error != FILEINFO_ERROR_NONE) {
+ SAFE_FREE(err_attr_name);
+ }
+
mmf_error = mm_file_get_attrs(tag, &err_attr_name, MM_FILE_TAG_RECDATE, &p, &size, NULL);
if ((mmf_error == FILEINFO_ERROR_NONE) && (size > 0)) {
if (content_info->media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO) {