Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 127 lines (101 sloc) 4.693 kb
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
1 // -*- c++ -*-
4d4d90b3 »
2012-09-23 o More legalese
2 // Folve - A fuse filesystem that convolves audio files on-the-fly.
3 //
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
4 // Copyright (C) 2012 Henner Zeller <h.zeller@acm.org>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18
a9d3e538 »
2012-09-15 o Found a project name: "Folve". Some renamings because of that.
19 #ifndef FOLVE_FILESYSTEM_H
20 #define FOLVE_FILESYSTEM_H
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
21
22 #include <unistd.h>
23
ee675fea »
2012-09-17 o Provide a way to select between different filter diretories.
24 #include <string>
25 #include <vector>
08bbf282 »
2012-09-21 o First shot at gapless. Works pretty well for my test-case.
26 #include <set>
ee675fea »
2012-09-17 o Provide a way to select between different filter diretories.
27
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
28 #include "file-handler-cache.h"
a9d3e538 »
2012-09-15 o Found a project name: "Folve". Some renamings because of that.
29 #include "file-handler.h"
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
30
ee675fea »
2012-09-17 o Provide a way to select between different filter diretories.
31 #ifndef FOLVE_VERSION
32 #define FOLVE_VERSION "[unknown version - compile from git]"
33 #endif
34
a9d3e538 »
2012-09-15 o Found a project name: "Folve". Some renamings because of that.
35 class FolveFilesystem {
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
36 public:
ee675fea »
2012-09-17 o Provide a way to select between different filter diretories.
37 // Create a new filesystem. At least SetBasedir() needs to be called
38 // for this to be properly initialized.
39 FolveFilesystem();
40
41 // Underlying directory - the directory we read files from.
42 void set_underlying_dir(const std::string &dir) { underlying_dir_ = dir; }
43 const std::string &underlying_dir() const { return underlying_dir_; }
44
31096bbf »
2012-10-04 o remove option -c and add -C: give a base directory for all filters.
45 // Set the base configuration directory.
46 void SetBaseConfigDir(const std::string &config_dir) {
47 base_config_dir_ = config_dir;
ee675fea »
2012-09-17 o Provide a way to select between different filter diretories.
48 }
49
31096bbf »
2012-10-04 o remove option -c and add -C: give a base directory for all filters.
50 // Return a set of available named configurations. Essentially the names
51 // of subdirectories in the configuration dir.
52 const std::set<std::string> GetAvailableConfigDirs() const;
53
54 // Switch the current config to subdir. Returns 'true', if this was a valid
55 // choice and we actually did a switch to a new directory.
56 bool SwitchCurrentConfigDir(const std::string &subdir);
57 const std::string &current_config_subdir() const {
58 return current_config_subdir_;
59 }
ee675fea »
2012-09-17 o Provide a way to select between different filter diretories.
60
61 // Check if properly initialized. Return 'false' if not and print a message
62 // to stderr.
63 bool CheckInitialized();
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
64
a90d9224 »
2012-10-04 o Separate sanitizing of config subdirectories.
65 // After startup: choose the initial configuation.
66 void SetupInitialConfig();
67
0aee3bb1 »
2012-09-15 o Show base dir that is mounted.
68 // Create a new filter given the filesystem path and the underlying
69 // path.
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
70 // Returns NULL, if it cannot be created.
08bbf282 »
2012-09-21 o First shot at gapless. Works pretty well for my test-case.
71 FileHandler *GetOrCreateHandler(const char *fs_path);
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
72
ee675fea »
2012-09-17 o Provide a way to select between different filter diretories.
73 // Inform filesystem that this file handler is not needed anymore
74 // (FS still might consider keeping it around for a while).
75 void Close(const char *fs_path, const FileHandler *handler);
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
76
08bbf282 »
2012-09-21 o First shot at gapless. Works pretty well for my test-case.
77 // Return dynamic size of file.
78 int StatByFilename(const char *fs_path, struct stat *st);
79
ac40d857 »
2012-09-21 o Make sure we match the alphabetically next file with
80 // List files in given filesystem directory that match the suffix.
81 // Returns a set of filesystem paths of existing files.
82 // (We don't want globbing as filenames might contain weird characters).
83 bool ListDirectory(const std::string &fs_dir, const std::string &suffix,
84 std::set<std::string> *files);
08bbf282 »
2012-09-21 o First shot at gapless. Works pretty well for my test-case.
85
b5c1e960 »
2012-09-14 o more useful output on status server.
86 FileHandlerCache *handler_cache() { return &open_file_cache_; }
0aee3bb1 »
2012-09-15 o Show base dir that is mounted.
87
8c7e5c11 »
2012-09-18 o Only if -D is given, the debug toggle is active in the UI.
88 void set_debug_ui_enabled(bool b) { debug_ui_enabled_ = b; }
89 bool is_debug_ui_enabled() const { return debug_ui_enabled_; }
90
08bbf282 »
2012-09-21 o First shot at gapless. Works pretty well for my test-case.
91 void set_gapless_processing(bool b) { gapless_processing_ = b; }
92 bool gapless_processing() const { return gapless_processing_; }
93
0aee3bb1 »
2012-09-15 o Show base dir that is mounted.
94 // Some stats.
b5c1e960 »
2012-09-14 o more useful output on status server.
95 int total_file_openings() { return total_file_openings_; }
96 int total_file_reopen() { return total_file_reopen_; }
97
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
98 private:
ee675fea »
2012-09-17 o Provide a way to select between different filter diretories.
99 // Get cache key, depending on the given configuration.
31096bbf »
2012-10-04 o remove option -c and add -C: give a base directory for all filters.
100 std::string CacheKey(const std::string &config_path, const char *fs_path);
8268c37e »
2012-09-15 o Bubble up error messages in status server.
101
31096bbf »
2012-10-04 o remove option -c and add -C: give a base directory for all filters.
102 FileHandler *CreateFromDescriptor(int filedes, const std::string &cfg_dir,
ee675fea »
2012-09-17 o Provide a way to select between different filter diretories.
103 const char *fs_path,
08bbf282 »
2012-09-21 o First shot at gapless. Works pretty well for my test-case.
104 const std::string &underlying_file);
8268c37e »
2012-09-15 o Bubble up error messages in status server.
105
a90d9224 »
2012-10-04 o Separate sanitizing of config subdirectories.
106 // Sanitize path to configuration subdirectory. Checks if someone tries
107 // to break out of the given base directory.
108 // Return if this is a sane directory.
109 // Passes the sanitized directory in the parameter.
110 bool SanitizeConfigSubdir(std::string *subdir_path) const;
111
112 // List available config directories; if "warn_invalid" is true,
113 // non-directories or symbolic links breaking out of the directory are
114 // reported.
115 const std::set<std::string> ListConfigDirs(bool warn_invalid) const;
116
ee675fea »
2012-09-17 o Provide a way to select between different filter diretories.
117 std::string underlying_dir_;
31096bbf »
2012-10-04 o remove option -c and add -C: give a base directory for all filters.
118 std::string base_config_dir_;
119 std::string current_config_subdir_;
8c7e5c11 »
2012-09-18 o Only if -D is given, the debug toggle is active in the UI.
120 bool debug_ui_enabled_;
08bbf282 »
2012-09-21 o First shot at gapless. Works pretty well for my test-case.
121 bool gapless_processing_;
b5c1e960 »
2012-09-14 o more useful output on status server.
122 FileHandlerCache open_file_cache_;
123 int total_file_openings_;
124 int total_file_reopen_;
8d1fbe7c »
2012-09-13 o Move fuse-convolve.c to fuse-convolve.cc. Make filter-interface
125 };
126
a9d3e538 »
2012-09-15 o Found a project name: "Folve". Some renamings because of that.
127 #endif // FOLVE_FILESYSTEM_H
Something went wrong with that request. Please try again.