Projects
Multimedia
mediatomb
mediatomb-taglib-readonly.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File mediatomb-taglib-readonly.patch of Package mediatomb
Mediatomb uses the TagLib::FileRef(char*) constructor of taglib. This will open the file in read-write mode and thus trigger a CLOSE_WRITE notify event for the file afterwards. This, obviously, makes mediatomb re-read the file if inotify-support is enabled. This causes unnecessary load during initial scanning and may even make mediatomb fail to work for UPNP clients that read the album art while displaying the object list (as the object ID is unexpectedly changed). This is fixed by the patch mediatomb-taglib-readonly.patch which uses TagLib::FileStream in read-only mode. diff -ur mediatomb-0.12.1.svn2103.orig/src/metadata/taglib_handler.cc mediatomb-0.12.1.svn2103/src/metadata/taglib_handler.cc --- mediatomb-0.12.1.svn2103.orig/src/metadata/taglib_handler.cc 2012-11-09 03:02:02.306177095 +0100 +++ mediatomb-0.12.1.svn2103/src/metadata/taglib_handler.cc 2018-04-13 15:32:24.990041623 +0200 @@ -45,6 +45,7 @@ #include <attachedpictureframe.h> #include <textidentificationframe.h> #include <tstring.h> +#include <tfilestream.h> #include "taglib_handler.h" #include "string_converter.h" @@ -135,7 +136,9 @@ Ref<Array<StringBase> > aux; Ref<StringConverter> sc = StringConverter::i2i(); - TagLib::FileRef f(item->getLocation().c_str()); + // use read-only file stream to prevent unnecessary inotify events + TagLib::FileStream fs(item->getLocation().c_str(), true); + TagLib::FileRef f(&fs, true); if (f.isNull() || (!f.tag())) return; @@ -192,7 +195,7 @@ // did not yet found a way on how to get to the picture from the file // reference that we already have - TagLib::MPEG::File mp(item->getLocation().c_str()); + TagLib::MPEG::File mp(&fs, TagLib::ID3v2::FrameFactory::instance()); if (!mp.isValid() || !mp.ID3v2Tag()) return; @@ -274,8 +277,10 @@ Ref<IOHandler> TagHandler::serveContent(Ref<CdsItem> item, int resNum, off_t *data_size) { + // use read-only file stream to prevent unnecessary inotify events + TagLib::FileStream fs(item->getLocation().c_str(), true); // we should only get mp3 files here - TagLib::MPEG::File f(item->getLocation().c_str()); + TagLib::MPEG::File f(&fs, TagLib::ID3v2::FrameFactory::instance()); if (!f.isValid()) throw _Exception(_("TagHandler: could not open file: ") +
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.