Add Chromium-only Blender WebEngine parity work
This commit is contained in:
93
blender-5.2.0/extern/audaspace/include/file/File.h
vendored
Normal file
93
blender-5.2.0/extern/audaspace/include/file/File.h
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2009-2016 Jörg Müller
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file File.h
|
||||
* @ingroup file
|
||||
* The File class.
|
||||
*/
|
||||
|
||||
#include "ISound.h"
|
||||
#include "FileInfo.h"
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
class Buffer;
|
||||
|
||||
/**
|
||||
* The File sound tries to read a sound file via all available file inputs
|
||||
* that have been registered in the FileManager class.
|
||||
*/
|
||||
class AUD_API File : public ISound
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* The filename of the sound source file.
|
||||
*/
|
||||
std::string m_filename;
|
||||
|
||||
/**
|
||||
* The buffer to read from.
|
||||
*/
|
||||
std::shared_ptr<Buffer> m_buffer;
|
||||
|
||||
/**
|
||||
* The index of the stream within the file if it contains multiple.
|
||||
* The first audio stream in the file has index 0 and the index increments by one
|
||||
* for every other audio stream in the file. Other types of streams in the file
|
||||
* do not count.
|
||||
*/
|
||||
int m_stream;
|
||||
|
||||
// delete copy constructor and operator=
|
||||
File(const File&) = delete;
|
||||
File& operator=(const File&) = delete;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a new sound.
|
||||
* The file is read from the file system using the given path.
|
||||
* \param filename The sound file path.
|
||||
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
|
||||
*/
|
||||
File(const std::string &filename, int stream = 0);
|
||||
|
||||
/**
|
||||
* Creates a new sound.
|
||||
* The file is read from memory using the supplied buffer.
|
||||
* \param buffer The buffer to read from.
|
||||
* \param size The size of the buffer.
|
||||
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
|
||||
*/
|
||||
File(const data_t* buffer, int size, int stream = 0);
|
||||
|
||||
/**
|
||||
* Queries the streams of the file.
|
||||
* \return A vector with as many streams as there are in the file.
|
||||
* \exception Exception Thrown if the file specified cannot be read.
|
||||
*/
|
||||
std::vector<StreamInfo> queryStreams();
|
||||
|
||||
virtual std::shared_ptr<IReader> createReader();
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
42
blender-5.2.0/extern/audaspace/include/file/FileInfo.h
vendored
Normal file
42
blender-5.2.0/extern/audaspace/include/file/FileInfo.h
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2009-2016 Jörg Müller
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file FileInfo.h
|
||||
* @ingroup file
|
||||
* The FileInfo data structures.
|
||||
*/
|
||||
|
||||
#include "respec/Specification.h"
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
/// Specification of a sound source.
|
||||
struct StreamInfo
|
||||
{
|
||||
/// Start time in seconds.
|
||||
double start;
|
||||
|
||||
/// Duration in seconds. May be estimated or 0 if unknown.
|
||||
double duration;
|
||||
|
||||
/// Audio data parameters.
|
||||
DeviceSpecs specs;
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
116
blender-5.2.0/extern/audaspace/include/file/FileManager.h
vendored
Normal file
116
blender-5.2.0/extern/audaspace/include/file/FileManager.h
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2009-2016 Jörg Müller
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file FileManager.h
|
||||
* @ingroup file
|
||||
* The FileManager class.
|
||||
*/
|
||||
|
||||
#include "FileInfo.h"
|
||||
#include "respec/Specification.h"
|
||||
#include "IWriter.h"
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
class IFileInput;
|
||||
class IFileOutput;
|
||||
class IReader;
|
||||
class Buffer;
|
||||
|
||||
/**
|
||||
* The FileManager manages all file input and output plugins.
|
||||
*/
|
||||
class AUD_API FileManager
|
||||
{
|
||||
private:
|
||||
static std::list<std::shared_ptr<IFileInput>>& inputs();
|
||||
static std::list<std::shared_ptr<IFileOutput>>& outputs();
|
||||
|
||||
// delete copy constructor and operator=
|
||||
FileManager(const FileManager&) = delete;
|
||||
FileManager& operator=(const FileManager&) = delete;
|
||||
FileManager() = delete;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Registers a file input used to create an IReader to read from a file.
|
||||
* @param input The IFileInput to register.
|
||||
*/
|
||||
static void registerInput(std::shared_ptr<IFileInput> input);
|
||||
|
||||
/**
|
||||
* Registers a file output used to create an IWriter to write to a file.
|
||||
* @param output The IFileOutput to register.
|
||||
*/
|
||||
static void registerOutput(std::shared_ptr<IFileOutput> output);
|
||||
|
||||
/**
|
||||
* Creates a file reader for the given filename if a registed IFileInput is able to read it.
|
||||
* @param filename The path to the file.
|
||||
* @param stream The index of the audio stream within the file if it contains multiple audio streams.
|
||||
* @return The reader created.
|
||||
* @exception Exception If no file input can read the file an exception is thrown.
|
||||
*/
|
||||
static std::shared_ptr<IReader> createReader(const std::string &filename, int stream = 0);
|
||||
|
||||
/**
|
||||
* Creates a file reader for the given buffer if a registed IFileInput is able to read it.
|
||||
* @param buffer The buffer to read the file from.
|
||||
* @param stream The index of the audio stream within the file if it contains multiple audio streams.
|
||||
* @return The reader created.
|
||||
* @exception Exception If no file input can read the file an exception is thrown.
|
||||
*/
|
||||
static std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0);
|
||||
|
||||
/**
|
||||
* Queries the streams of a sound file.
|
||||
* \param filename Path to the file to be read.
|
||||
* \return A vector with as many streams as there are in the file.
|
||||
* \exception Exception Thrown if the file specified cannot be read.
|
||||
*/
|
||||
static std::vector<StreamInfo> queryStreams(const std::string &filename);
|
||||
|
||||
/**
|
||||
* Queries the streams of a sound file.
|
||||
* \param buffer The in-memory file buffer.
|
||||
* \return A vector with as many streams as there are in the file.
|
||||
* \exception Exception Thrown if the file specified cannot be read.
|
||||
*/
|
||||
static std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer);
|
||||
|
||||
/**
|
||||
* Creates a file writer that writes a sound to the given file path.
|
||||
* Existing files will be overwritten.
|
||||
* @param filename The file path to write to.
|
||||
* @param specs The output specification.
|
||||
* @param format The container format for the file.
|
||||
* @param codec The codec used inside the container.
|
||||
* @param bitrate The bitrate to write with.
|
||||
* @return A writer that creates the file.
|
||||
* @exception Exception If no file output can write the file with the given specification an exception is thrown.
|
||||
*/
|
||||
static std::shared_ptr<IWriter> createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
78
blender-5.2.0/extern/audaspace/include/file/FileWriter.h
vendored
Normal file
78
blender-5.2.0/extern/audaspace/include/file/FileWriter.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2009-2016 Jörg Müller
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file FileWriter.h
|
||||
* @ingroup file
|
||||
* The FileWriter class.
|
||||
*/
|
||||
|
||||
#include "respec/Specification.h"
|
||||
#include "file/IWriter.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
class IReader;
|
||||
|
||||
/**
|
||||
* The FileWriter class is able to create IWriter classes as well as write readers to them.
|
||||
*/
|
||||
class AUD_API FileWriter
|
||||
{
|
||||
private:
|
||||
// hide default constructor, copy constructor and operator=
|
||||
FileWriter() = delete;
|
||||
FileWriter(const FileWriter&) = delete;
|
||||
FileWriter& operator=(const FileWriter&) = delete;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a new IWriter.
|
||||
* \param filename The file to write to.
|
||||
* \param specs The file's audio specification.
|
||||
* \param format The file's container format.
|
||||
* \param codec The codec used for encoding the audio data.
|
||||
* \param bitrate The bitrate for encoding.
|
||||
* \return The writer to write data to.
|
||||
*/
|
||||
static std::shared_ptr<IWriter> createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
|
||||
|
||||
/**
|
||||
* Writes a reader to a writer.
|
||||
* \param reader The reader to read from.
|
||||
* \param writer The writer to write to.
|
||||
* \param length How many samples should be transferred.
|
||||
* \param buffersize How many samples should be transferred at once.
|
||||
*/
|
||||
static void writeReader(std::shared_ptr<IReader> reader, std::shared_ptr<IWriter> writer, unsigned int length, unsigned int buffersize, bool(*callback)(float, void*) = nullptr, void* data = nullptr);
|
||||
|
||||
/**
|
||||
* Writes a reader to several writers.
|
||||
* \param reader The reader to read from.
|
||||
* \param writers The writers to write to.
|
||||
* \param length How many samples should be transferred.
|
||||
* \param buffersize How many samples should be transferred at once.
|
||||
*/
|
||||
static void writeReader(std::shared_ptr<IReader> reader, std::vector<std::shared_ptr<IWriter> >& writers, unsigned int length, unsigned int buffersize, bool(*callback)(float, void*) = nullptr, void* data = nullptr);
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
85
blender-5.2.0/extern/audaspace/include/file/IFileInput.h
vendored
Normal file
85
blender-5.2.0/extern/audaspace/include/file/IFileInput.h
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2009-2016 Jörg Müller
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file IFileInput.h
|
||||
* @ingroup file
|
||||
* The IFileInput interface.
|
||||
*/
|
||||
|
||||
#include "Audaspace.h"
|
||||
#include "FileInfo.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
class IReader;
|
||||
class Buffer;
|
||||
|
||||
/**
|
||||
* @interface IFileInput
|
||||
* The IFileInput interface represents a file input plugin that can create file
|
||||
* input readers from filenames or buffers.
|
||||
*/
|
||||
class AUD_API IFileInput
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Destroys the file input.
|
||||
*/
|
||||
virtual ~IFileInput() {}
|
||||
|
||||
/**
|
||||
* Creates a reader for a file to be read.
|
||||
* \param filename Path to the file to be read.
|
||||
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
|
||||
* \return The reader that reads the file.
|
||||
* \exception Exception Thrown if the file specified cannot be read.
|
||||
*/
|
||||
virtual std::shared_ptr<IReader> createReader(const std::string &filename, int stream = 0)=0;
|
||||
|
||||
/**
|
||||
* Creates a reader for a file to be read from memory.
|
||||
* \param buffer The in-memory file buffer.
|
||||
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
|
||||
* \return The reader that reads the file.
|
||||
* \exception Exception Thrown if the file specified cannot be read.
|
||||
*/
|
||||
virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0)=0;
|
||||
|
||||
/**
|
||||
* Queries the streams of a sound file.
|
||||
* \param filename Path to the file to be read.
|
||||
* \return A vector with as many streams as there are in the file.
|
||||
* \exception Exception Thrown if the file specified cannot be read.
|
||||
*/
|
||||
virtual std::vector<StreamInfo> queryStreams(const std::string &filename)=0;
|
||||
|
||||
/**
|
||||
* Queries the streams of a sound file.
|
||||
* \param buffer The in-memory file buffer.
|
||||
* \return A vector with as many streams as there are in the file.
|
||||
* \exception Exception Thrown if the file specified cannot be read.
|
||||
*/
|
||||
virtual std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer)=0;
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
52
blender-5.2.0/extern/audaspace/include/file/IFileOutput.h
vendored
Normal file
52
blender-5.2.0/extern/audaspace/include/file/IFileOutput.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2009-2016 Jörg Müller
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file IFileOutput.h
|
||||
* @ingroup file
|
||||
* The IFileOutput interface.
|
||||
*/
|
||||
|
||||
#include "file/IWriter.h"
|
||||
#include "respec/Specification.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* @interface IFileOutput
|
||||
* The IFileOutput interface represents a file output plugin that can write files.
|
||||
*/
|
||||
class AUD_API IFileOutput
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Creates a new file writer.
|
||||
* \param filename The path to the file to be written.
|
||||
* \param specs The file's audio specification.
|
||||
* \param format The file's container format.
|
||||
* \param codec The codec used for encoding the audio data.
|
||||
* \param bitrate The bitrate for encoding.
|
||||
* \exception Exception Thrown if the file specified cannot be written.
|
||||
*/
|
||||
virtual std::shared_ptr<IWriter> createWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)=0;
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
90
blender-5.2.0/extern/audaspace/include/file/IWriter.h
vendored
Normal file
90
blender-5.2.0/extern/audaspace/include/file/IWriter.h
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2009-2016 Jörg Müller
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file IWriter.h
|
||||
* @ingroup file
|
||||
* Defines the IWriter interface as well as Container and Codec types.
|
||||
*/
|
||||
|
||||
#include "respec/Specification.h"
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
/// Container formats for writers.
|
||||
enum Container
|
||||
{
|
||||
CONTAINER_INVALID = 0,
|
||||
CONTAINER_AC3,
|
||||
CONTAINER_FLAC,
|
||||
CONTAINER_MATROSKA,
|
||||
CONTAINER_MP2,
|
||||
CONTAINER_MP3,
|
||||
CONTAINER_OGG,
|
||||
CONTAINER_WAV,
|
||||
CONTAINER_AAC
|
||||
};
|
||||
|
||||
/// Audio codecs for writers.
|
||||
enum Codec
|
||||
{
|
||||
CODEC_INVALID = 0,
|
||||
CODEC_AAC,
|
||||
CODEC_AC3,
|
||||
CODEC_FLAC,
|
||||
CODEC_MP2,
|
||||
CODEC_MP3,
|
||||
CODEC_PCM,
|
||||
CODEC_VORBIS,
|
||||
CODEC_OPUS
|
||||
};
|
||||
|
||||
/**
|
||||
* @interface IWriter
|
||||
* This class represents a sound sink where audio data can be written to.
|
||||
*/
|
||||
class AUD_API IWriter
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Destroys the writer.
|
||||
*/
|
||||
virtual ~IWriter() {}
|
||||
|
||||
/**
|
||||
* Returns how many samples have been written so far.
|
||||
* \return The writing position as sample count. May be negative if unknown.
|
||||
*/
|
||||
virtual int getPosition() const=0;
|
||||
|
||||
/**
|
||||
* Returns the specification of the audio data being written into the sink.
|
||||
* \return The DeviceSpecs structure.
|
||||
* \note Regardless of the format the input still has to be float!
|
||||
*/
|
||||
virtual DeviceSpecs getSpecs() const=0;
|
||||
|
||||
/**
|
||||
* Request to write the next length samples out into the sink.
|
||||
* \param length The count of samples to write.
|
||||
* \param buffer The pointer to the buffer containing the data.
|
||||
*/
|
||||
virtual void write(unsigned int length, sample_t* buffer)=0;
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
Reference in New Issue
Block a user