* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*
* @remarks The @a value should be released using free(). \n
- * You must call metadata_editor_update_metadata() to apply metadata changes to the media file. Otherwise, the previous metadata will be returned when you call metadata_editor_get_metadata().
+ * You must call metadata_editor_update_metadata() to apply metadata changes to the media file. Otherwise, the previous metadata will be returned when you call metadata_editor_get_metadata().
+ * This function doesn't support updating metadata which is malformed.
+ * Before 6.0, this function returned #METADATA_EDITOR_ERROR_OPERATION_FAILED. Since 6.0, #METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE is returned in such cases.
*
* @param[in] metadata The handle to metadata
* @param[in] attribute key attribute name to get
* @retval #METADATA_EDITOR_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #METADATA_EDITOR_ERROR_OUT_OF_MEMORY Out of memory
* @retval #METADATA_EDITOR_ERROR_OPERATION_FAILED Internal Operation Fail
+ * @retval #METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE Update not possible
* @pre Set path to read or write metadata by calling metadata_editor_set_path()
* @see metadata_editor_create()
* @see metadata_editor_set_path()
* Image type of the metadata supports jpeg and png. \n
* In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path. \n
* For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage.
+ * This function doesn't support updating metadata which is malformed.
+ * Before 6.0, this function returned #METADATA_EDITOR_ERROR_OPERATION_FAILED. Since 6.0, #METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE is returned in such cases.
*
* @param[in] metadata The handle to metadata
* @param[in] picture_path The path of picture for adding to the metadata
* @retval #METADATA_EDITOR_ERROR_NOT_SUPPORTED unsupported file type
* @retval #METADATA_EDITOR_ERROR_OPERATION_FAILED Internal Operation Fail
* @retval #METADATA_EDITOR_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE Update not possible
* @pre Set path to read or write metadata by calling metadata_editor_set_path()
* @see metadata_editor_create()
* @see metadata_editor_set_path()
static int __MP4_updateStringItem(MP4::Tag *tag, const char *itemname, const char *value)
{
- metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
+ metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE, "Tag does not exist");
metadata_editor_retvm_if(!itemname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid itemname");
// Get map of items directly from tag and launch a search of specific item
static int __MP4_updateIntegerItem(MP4::Tag *tag, const char *itemname, const char *value)
{
- metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
+ metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE, "Tag does not exist");
metadata_editor_retvm_if(!itemname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid itemname");
// Get map of items directly from tag and launch a search of specific item
static int __xiph_updateFieldValue(Ogg::XiphComment *xtag, const char *fieldname, const char *value)
{
- metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
+ metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE, "Tag does not exist");
metadata_editor_retvm_if(!fieldname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid fieldname");
// Check if it is a request for deletion
static int __set_ID3_tag(metadata_editor_attr_e attribute, ID3v1::Tag *tag1, ID3v2::Tag *tag2, const char *value)
{
- metadata_editor_retvm_if(!tag2, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating");
+ metadata_editor_retvm_if(!tag2, METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE, "Tag does not exist");
switch (attribute) {
case METADATA_EDITOR_ATTR_ARTIST: return __ID3_setTwixFrameByName(tag1, tag2, "TPE1", value);
metadata_editor_retvm_if(!_file, METADATA_EDITOR_ERROR_OPERATION_FAILED, "fail to dynamic_cast");
auto xtag = _file->tag();
- if (!xtag) { // Check if we have a valid tag for processing
- metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating");
- return METADATA_EDITOR_ERROR_OPERATION_FAILED;
- }
+ metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE, "Tag does not exist");
+
switch (attribute) { // Check which one of frame type was given for processing
case METADATA_EDITOR_ATTR_ARTIST: return __xiph_updateFieldValue(xtag, "ARTIST", value);
case METADATA_EDITOR_ATTR_TITLE: return __xiph_updateFieldValue(xtag, "TITLE", value);
metadata_editor_retvm_if(!_file, METADATA_EDITOR_ERROR_OPERATION_FAILED, "fail to dynamic_cast");
auto xtag = _file->tag();
- if (!xtag) { // Check if we have a valid tag for processing
- metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating");
- return METADATA_EDITOR_ERROR_OPERATION_FAILED;
- }
+ metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE, "Tag does not exist");
+
switch (attribute) { // Check which one of frame type was given for processing
case METADATA_EDITOR_ATTR_ARTIST: return __xiph_updateFieldValue(xtag, "ARTIST", value);
case METADATA_EDITOR_ATTR_TITLE: return __xiph_updateFieldValue(xtag, "TITLE", value);
static int __append_APIC(ID3v2::Tag *tag, const char *picture, size_t size, const char *mime_type)
{
- metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. No ID3v2 tag in file.");
+ metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE, "Tag does not exist");
auto pictureFrame = new ID3v2::AttachedPictureFrame();
static int __append_mp4_picture(metadata_editor_s *metadata, const char *picture, size_t size, const char *mime_type)
{
auto tag = dynamic_cast<MP4::Tag*>(metadata->file->tag());
- metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
+ metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE, "Tag does not exist");
MP4::CoverArtList lst;
auto format = MP4::CoverArt::Unknown;
int ret = METADATA_EDITOR_ERROR_NONE;
auto tag = dynamic_cast<MP4::Tag*>(metadata->file->tag());
- metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
+ metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Tag does not exist");
if (!(tag->contains("covr"))) {
metadata_editor_error("No item <covr> in file. No pictures in file");