throw failed_constructor ();
}
+ fix_writable_flags ();
}
AudioFileSource::AudioFileSource (Session& s, ustring path, Flag flags, SampleFormat samp_format, HeaderFormat hdr_format)
if (init (path, false)) {
throw failed_constructor ();
}
+
+ fix_writable_flags ();
}
AudioFileSource::AudioFileSource (Session& s, const XMLNode& node, bool must_exist)
if (init (foo, must_exist)) {
throw failed_constructor ();
}
+
+ fix_writable_flags ();
}
AudioFileSource::~AudioFileSource ()
}
}
+void
+AudioFileSource::fix_writable_flags ()
+{
+ if (!_session.writable()) {
+ _flags = Flag (_flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy|CanRename));
+ }
+}
+
bool
AudioFileSource::determine_embeddedness (ustring path)
{
return (_flags & Removable) && ((_flags & RemoveAtDestroy) || ((_flags & RemovableIfEmpty) && length() == 0));
}
+bool
+AudioFileSource::writable() const
+{
+ return (_flags & Writable);
+}
+
int
AudioFileSource::init (ustring pathstr, bool must_exist)
{
}
+ fix_writable_flags ();
+
if ((prop = node.property (X_("channel"))) != 0) {
_channel = atoi (prop->value());
} else {
// This operation is not allowed for sources for destructive tracks or embedded files.
// Fortunately mark_for_remove() is never called for embedded files. This function
// must be fixed if that ever happens.
- if (_flags & Destructive) {
+ if (!_session.writable() || (_flags & Destructive)) {
return;
}
} else {
_flags = Flag (_flags & ~RemovableIfEmpty);
}
+
+ fix_writable_flags ();
}
int
".maud", ".MAUD",
".vwe", ".VWE",
".paf",
-#ifdef HAVE_FLAC
".flac", ".FLAC",
-#endif // HAVE_FLAC
+ ".ogg", ".OGG",
#ifdef HAVE_COREAUDIO
".mp3", ".MP3",
".aac", ".AAC",