1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-31 17:08:45 +01:00

AUP3: Reworked CopyTo() yet again

This time it has the potential to produce much smaller
output files since it ONLY copies the active blocks and
not all of the blocks related to undo history.  This is
done for "Save As" and "Backup Project".  Normal save
can't take advantage of this, but then it really doesn't
need it as it has to depend on vacuuming.

The vacuuming at close has been adjusted to utilize CopyTo()
so it should produce similarly small files as long as the
vacuuming happens when the project is definitely closing.
This commit is contained in:
Leland Lucius
2020-07-13 00:04:54 -05:00
parent a0008831e0
commit 0815344e5d
3 changed files with 171 additions and 31 deletions

View File

@@ -103,6 +103,9 @@ public:
void Bypass(bool bypass);
bool ShouldBypass();
// Remove all unused space within a project file
bool Vacuum();
private:
// XMLTagHandler callback methods
bool HandleXMLTag(const wxChar *tag, const wxChar **attrs) override;
@@ -118,8 +121,6 @@ private:
static int ExecCallback(void *data, int cols, char **vals, char **names);
int Exec(const char *query, ExecCB callback, wxString *result);
static int ProgressCallback(void *data);
// The opening of the database may be delayed until demanded.
// Returns a non-null pointer to an open database, or throws an exception
// if opening fails.
@@ -162,11 +163,14 @@ private:
bool CheckForOrphans(BlockIDs &blockids);
// Return a database connection if successful, which caller must close
sqlite3 *CopyTo(const FilePath &destpath);
sqlite3 *CopyTo(const FilePath &destpath, bool prune = false);
void SetError(const TranslatableString & msg);
void SetDBError(const TranslatableString & msg);
using UpdateCB = std::function<void(int operation, char const *dbname, char const *table, int64_t rowid)>;
static void UpdateCallback(void *data, int operation, char const *dbname, char const *table, int64_t rowid);
private:
// non-static data members
std::weak_ptr<AudacityProject> mpProject;