extern "C" int metadata_editor_create(metadata_editor_h *metadata)
{
- metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata");
+ metadata_editor_debug_fenter();
+
+ metadata_editor_retvm_if(!metadata, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata");
metadata_editor_s *_metadata = g_new0(metadata_editor_s, 1);
- _metadata->file = NULL;
- _metadata->filetype = METADATA_EDITOR_FORMAT_NOTYPE; // Specify file type out of range
+ _metadata->filetype = METADATA_EDITOR_FORMAT_NOTYPE;
- // Save the structure in the metadata
*metadata = (metadata_editor_h)_metadata;
return METADATA_EDITOR_ERROR_NONE;
metadata_editor_s *_metadata = (metadata_editor_s*)metadata;
File *_file = NULL;
+ metadata_editor_debug_fenter();
+
metadata_editor_retvm_if(!_metadata, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata");
ret = __check_file_validity(path);
extern "C" int metadata_editor_get_metadata(metadata_editor_h metadata, metadata_editor_attr_e attribute, char **value)
{
-
metadata_editor_s *_metadata = (metadata_editor_s*)metadata;
metadata_editor_retvm_if(!_metadata, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata");
+ metadata_editor_debug("file format [%d]", _metadata->filetype);
+
switch (_metadata->filetype) {
case METADATA_EDITOR_FORMAT_MP3:
return __metadata_editor_get_mp3_metadata(_metadata, attribute, value);
extern "C" int metadata_editor_set_metadata(metadata_editor_h metadata, metadata_editor_attr_e attribute, const char *value)
{
-
metadata_editor_s *_metadata = (metadata_editor_s*) metadata;
metadata_editor_retvm_if(!_metadata, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata");
+ metadata_editor_debug("file format [%d]", _metadata->filetype);
+
switch (_metadata->filetype) {
case METADATA_EDITOR_FORMAT_MP3:
return __metadata_editor_set_mp3_metadata(_metadata, attribute, value);
ret = __check_metadata_set_parameter(_metadata);
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret);
+ metadata_editor_debug("file format [%d]", _metadata->filetype);
+
switch (_metadata->filetype) {
case METADATA_EDITOR_FORMAT_MP3: {
auto _file = dynamic_cast<MPEG::File*>(_metadata->file);
metadata_editor_retvm_if(!picture, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid picture");
metadata_editor_retvm_if(!size, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid size");
+ metadata_editor_debug("file format [%d]", _metadata->filetype);
+
switch (_metadata->filetype) { // Process the file according to the specified file type
case METADATA_EDITOR_FORMAT_MP3:
return __get_mp3_picture(_metadata, index, picture, size, mime_type);
auto frontCover = new FLAC::Picture;
- metadata_editor_debug_fenter();
-
frontCover->setData(ByteVector(picture, size));
frontCover->setType(FLAC::Picture::FrontCover);
frontCover->setMimeType(mime_type);
ret = __metadata_editor_get_picture_info(path, &picture, &size, &mime_type);
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "File does not exist or you have no rights to open it");
+ metadata_editor_debug("file format [%d]", _metadata->filetype);
+
switch (_metadata->filetype) {
case METADATA_EDITOR_FORMAT_MP3:
ret = __append_mp3_picture(_metadata, picture, size, mime_type);
ret = __check_metadata_set_parameter(_metadata);
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret);
+ metadata_editor_debug("file format [%d]", _metadata->filetype);
+
switch (_metadata->filetype) {
case METADATA_EDITOR_FORMAT_MP3:
return __remove_mp3_picture(_metadata, index);
extern "C" int metadata_editor_destroy(metadata_editor_h metadata)
{
metadata_editor_s *_metadata = (metadata_editor_s*)metadata;
-
metadata_editor_retvm_if(!_metadata, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid metadata");
+ metadata_editor_debug("file format [%d]", _metadata->filetype);
+
switch (_metadata->filetype) {
case METADATA_EDITOR_FORMAT_MP3:
delete dynamic_cast<TagLib::MPEG::File*>(_metadata->file);