static int __metadata_editor_get_picture_type(const char *path, char **type) {
int ret = 0;
char mimetype[255] = {0, };
- const char *type_jpeg = "image/jpeg";
- const char *type_png = "image/png";
/* get content type and mime type from file. */
ret = aul_get_mime_from_file(path, mimetype, sizeof(mimetype));
metadata_editor_retvm_if(ret < 0, METADATA_EDITOR_ERROR_OPERATION_FAILED, "__metadata_editor_get_file_ext failed");
if (strcasecmp(ext, "JPG") == 0 || strcasecmp(ext, "JPEG") == 0) {
- *type = g_strndup(type_jpeg, strlen(type_jpeg));
+ *type = g_strdup(MIME_TYPE_JPEG);
return METADATA_EDITOR_ERROR_NONE;
} else if (strcasecmp(ext, "PNG") == 0) {
- *type = g_strndup(type_png, strlen(type_png));
+ *type = g_strdup(MIME_TYPE_JPEG);
return METADATA_EDITOR_ERROR_NONE;
} else {
return METADATA_EDITOR_ERROR_NOT_SUPPORTED;
metadata_editor_info("The item <covr> exists. Adding picture");
TagLib::MP4::CoverArtList lst = it->second.toCoverArtList();
TagLib::MP4::CoverArt::Format format;
- if (strncmp(type, "image/jpeg", strlen("image/jpeg")) == 0)
+ if (strncmp(type, MIME_TYPE_JPEG, strlen(MIME_TYPE_JPEG)) == 0)
format = TagLib::MP4::CoverArt::JPEG;
- else if (strncmp(type, "image/png", strlen("image/jpeg")) == 0)
+ else if (strncmp(type, MIME_TYPE_PNG, strlen(MIME_TYPE_PNG)) == 0)
format = TagLib::MP4::CoverArt::PNG;
else
format = (TagLib::MP4::CoverArt::Format)0xFFFF;
} else { // Item was not found
metadata_editor_info("The item <covr> does not exist. Adding picture");
TagLib::MP4::CoverArt::Format format;
- if (strncmp(type, "image/jpeg", strlen("image/jpeg")) == 0)
+ if (strncmp(type, MIME_TYPE_JPEG, strlen(MIME_TYPE_JPEG)) == 0)
format = TagLib::MP4::CoverArt::JPEG;
- else if (strncmp(type, "image/png", strlen("image/jpeg")) == 0)
+ else if (strncmp(type, MIME_TYPE_PNG, strlen(MIME_TYPE_PNG)) == 0)
format = TagLib::MP4::CoverArt::PNG;
else
format = (TagLib::MP4::CoverArt::Format)0xFFFF;