mirror of https://github.com/odrling/Aegisub
Fix dummy and pcm audio providers.
Originally committed to SVN as r5304.
This commit is contained in:
parent
65d216e60d
commit
37bcd0cc12
|
@ -27,6 +27,8 @@ SRC = \
|
||||||
common/video_frame.cpp \
|
common/video_frame.cpp \
|
||||||
audio/downmix.cpp \
|
audio/downmix.cpp \
|
||||||
audio/convert.cpp \
|
audio/convert.cpp \
|
||||||
|
audio/dummy_audio.cpp \
|
||||||
|
audio/pcm.cpp \
|
||||||
$(SRC_OPT)
|
$(SRC_OPT)
|
||||||
|
|
||||||
HEADERS = \
|
HEADERS = \
|
||||||
|
|
|
@ -36,8 +36,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "audio_provider_dummy.h"
|
#include "dummy_audio.h"
|
||||||
#include "utils.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace media {
|
namespace media {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
/// @ingroup audio_input
|
/// @ingroup audio_input
|
||||||
///
|
///
|
||||||
|
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "libmedia/audio.h"
|
||||||
|
|
||||||
namespace media {
|
namespace media {
|
||||||
|
|
||||||
|
|
|
@ -46,17 +46,14 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <wx/file.h>
|
|
||||||
#include <wx/filename.h>
|
|
||||||
#include <wx/log.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <libaegisub/log.h>
|
#include <libaegisub/log.h>
|
||||||
|
|
||||||
#include "aegisub_endian.h"
|
#include "aegisub_endian.h"
|
||||||
#include "audio_provider_pcm.h"
|
#include "pcm.h"
|
||||||
#include "compat.h"
|
//#include "compat.h"
|
||||||
#include "utils.h"
|
//#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
namespace media {
|
namespace media {
|
||||||
|
@ -64,7 +61,7 @@ namespace media {
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param filename
|
/// @param filename
|
||||||
///
|
///
|
||||||
PCMAudioProvider::PCMAudioProvider(const wxString &filename)
|
PCMAudioProvider::PCMAudioProvider(const std::string &filename)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
file_handle = CreateFile(
|
file_handle = CreateFile(
|
||||||
|
@ -103,10 +100,10 @@ PCMAudioProvider::PCMAudioProvider(const wxString &filename)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
file_handle = open(filename.mb_str(*wxConvFileName), O_RDONLY);
|
file_handle = open(filename.c_str(), O_RDONLY);
|
||||||
|
|
||||||
if (file_handle == -1) {
|
if (file_handle == -1) {
|
||||||
throw agi::FileNotFoundError(STD_STR(filename));
|
throw agi::FileNotFoundError(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct stat filestats;
|
struct stat filestats;
|
||||||
|
@ -330,7 +327,7 @@ public:
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param _filename
|
/// @param _filename
|
||||||
///
|
///
|
||||||
RiffWavPCMAudioProvider(const wxString &_filename)
|
RiffWavPCMAudioProvider(const std::string &_filename)
|
||||||
: PCMAudioProvider(_filename)
|
: PCMAudioProvider(_filename)
|
||||||
{
|
{
|
||||||
filename = _filename;
|
filename = _filename;
|
||||||
|
@ -520,7 +517,7 @@ public:
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param _filename
|
/// @param _filename
|
||||||
///
|
///
|
||||||
Wave64AudioProvider(const wxString &_filename)
|
Wave64AudioProvider(const std::string &_filename)
|
||||||
: PCMAudioProvider(_filename)
|
: PCMAudioProvider(_filename)
|
||||||
{
|
{
|
||||||
filename = _filename;
|
filename = _filename;
|
||||||
|
@ -614,7 +611,7 @@ public:
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
/// @param filename
|
/// @param filename
|
||||||
///
|
///
|
||||||
AudioProvider *CreatePCMAudioProvider(const wxString &filename)
|
AudioProvider *CreatePCMAudioProvider(const std::string &filename)
|
||||||
{
|
{
|
||||||
std::string msg;
|
std::string msg;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -36,16 +36,13 @@
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <wx/file.h>
|
|
||||||
#include <wx/thread.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "include/aegisub/audio_provider.h"
|
#include "libmedia/audio.h"
|
||||||
|
|
||||||
|
|
||||||
namespace media {
|
namespace media {
|
||||||
|
@ -81,7 +78,7 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PCMAudioProvider(const wxString &filename); // Create base object and open the file mapping
|
PCMAudioProvider(const std::string &filename); // Create base object and open the file mapping
|
||||||
virtual ~PCMAudioProvider(); // Closes the file mapping
|
virtual ~PCMAudioProvider(); // Closes the file mapping
|
||||||
char * EnsureRangeAccessible(int64_t range_start, int64_t range_length) const; // Ensure that the given range of bytes are accessible in the file mapping and return a pointer to the first byte of the requested range
|
char * EnsureRangeAccessible(int64_t range_start, int64_t range_length) const; // Ensure that the given range of bytes are accessible in the file mapping and return a pointer to the first byte of the requested range
|
||||||
|
|
||||||
|
@ -114,7 +111,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Construct the right PCM audio provider (if any) for the file
|
// Construct the right PCM audio provider (if any) for the file
|
||||||
AudioProvider *CreatePCMAudioProvider(const wxString &filename);
|
AudioProvider *CreatePCMAudioProvider(const std::string &filename);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue