2011-02-03 00:11:17 +01:00
|
|
|
// Copyright (c) 2008-2009, Karl Blomster <thefluff@aegisub.org>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice appear in all copies.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file ffms_audio.h
|
|
|
|
/// @brief FFmpegSource Audio support.
|
|
|
|
/// @ingroup fmms audio
|
|
|
|
|
|
|
|
#include "../../libffms/include/ffms.h"
|
2011-02-06 03:58:49 +01:00
|
|
|
#include <libmedia/audio.h>
|
2011-02-03 00:11:17 +01:00
|
|
|
|
|
|
|
#ifndef AGI_PRE
|
|
|
|
#ifdef WIN32
|
|
|
|
#include <objbase.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#endif
|
|
|
|
|
2011-02-06 00:49:26 +01:00
|
|
|
#include "../common/ffms_common.h"
|
2011-02-06 03:58:49 +01:00
|
|
|
namespace media {
|
2011-02-03 00:23:48 +01:00
|
|
|
namespace ffms {
|
2011-02-03 00:11:17 +01:00
|
|
|
|
2011-02-03 00:20:03 +01:00
|
|
|
/// @class Audio
|
|
|
|
/// Audio file support.
|
2011-02-09 03:28:24 +01:00
|
|
|
class FFmpegSourceAudioProvider : public AudioProvider, FFmpegSourceProvider {
|
2011-02-03 00:11:17 +01:00
|
|
|
FFMS_AudioSource *AudioSource; ///< audio source object
|
|
|
|
bool COMInited; ///< COM initialization state
|
|
|
|
|
|
|
|
mutable char FFMSErrMsg[1024]; ///< FFMS error message
|
|
|
|
mutable FFMS_ErrorInfo ErrInfo; ///< FFMS error codes/messages
|
|
|
|
|
|
|
|
void Close();
|
|
|
|
void LoadAudio(std::string filename);
|
|
|
|
|
2011-02-09 03:28:24 +01:00
|
|
|
public:
|
|
|
|
FFmpegSourceAudioProvider(std::string filename);
|
|
|
|
virtual ~FFmpegSourceAudioProvider();
|
2011-02-03 00:11:17 +01:00
|
|
|
|
|
|
|
/// @brief Checks sample endianness
|
|
|
|
/// @return Returns true.
|
|
|
|
/// FFMS always delivers native endian samples.
|
|
|
|
bool AreSamplesNativeEndian() const { return true; }
|
|
|
|
bool NeedsCache() const { return true; }
|
|
|
|
|
|
|
|
virtual void GetAudio(void *buf, int64_t start, int64_t count) const;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2011-02-03 00:23:48 +01:00
|
|
|
} // namespace ffms
|
2011-02-06 03:58:49 +01:00
|
|
|
} // namespace media
|