Audaspace 1.5.0
A high level audio library.
Loading...
Searching...
No Matches
FileManager.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright 2009-2016 Jörg Müller
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 ******************************************************************************/
16
17#pragma once
18
25#include "FileInfo.h"
27#include "IWriter.h"
28
29#include <list>
30#include <memory>
31#include <string>
32#include <vector>
33
35
36class IFileInput;
37class IFileOutput;
38class IReader;
39class Buffer;
40
45{
46private:
47 static std::list<std::shared_ptr<IFileInput>>& inputs();
48 static std::list<std::shared_ptr<IFileOutput>>& outputs();
49
50 // delete copy constructor and operator=
51 FileManager(const FileManager&) = delete;
52 FileManager& operator=(const FileManager&) = delete;
53 FileManager() = delete;
54
55public:
60 static void registerInput(std::shared_ptr<IFileInput> input);
61
66 static void registerOutput(std::shared_ptr<IFileOutput> output);
67
75 static std::shared_ptr<IReader> createReader(const std::string &filename, int stream = 0);
76
84 static std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0);
85
92 static std::vector<StreamInfo> queryStreams(const std::string &filename);
93
100 static std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer);
101
113 static std::shared_ptr<IWriter> createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
114};
115
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition Audaspace.h:119
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition Audaspace.h:116
#define AUD_API
Used for exporting symbols in the shared library.
Definition Audaspace.h:93
The FileInfo data structures.
Defines the IWriter interface as well as Container and Codec types.
Container
Container formats for writers.
Definition IWriter.h:31
Codec
Audio codecs for writers.
Definition IWriter.h:44
Defines all important macros and basic data structures for stream format descriptions.
This class is a simple buffer in RAM which is 32 Byte aligned and provides resize functionality.
Definition Buffer.h:34
The FileManager manages all file input and output plugins.
Definition FileManager.h:45
static std::shared_ptr< IReader > createReader(std::shared_ptr< Buffer > buffer, int stream=0)
Creates a file reader for the given buffer if a registed IFileInput is able to read it.
static std::shared_ptr< IWriter > createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
Creates a file writer that writes a sound to the given file path.
static void registerInput(std::shared_ptr< IFileInput > input)
Registers a file input used to create an IReader to read from a file.
static std::vector< StreamInfo > queryStreams(std::shared_ptr< Buffer > buffer)
Queries the streams of a sound file.
static void registerOutput(std::shared_ptr< IFileOutput > output)
Registers a file output used to create an IWriter to write to a file.
static std::shared_ptr< IReader > createReader(const std::string &filename, int stream=0)
Creates a file reader for the given filename if a registed IFileInput is able to read it.
static std::vector< StreamInfo > queryStreams(const std::string &filename)
Queries the streams of a sound file.
The IFileInput interface represents a file input plugin that can create file input readers from filen...
Definition IFileInput.h:43
The IFileOutput interface represents a file output plugin that can write files.
Definition IFileOutput.h:38
This class represents a sound source as stream or as buffer which can be read for example by another ...
Definition IReader.h:35
Specification of a sound device.
Definition Specification.h:129