From ffff58d6989ceb82e689000329fd3a22a96a80de Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Thu, 3 Feb 2011 15:49:44 +0000 Subject: [PATCH] Compilation fixes now that ffmpegsource_common.cpp has been moved over. Everything compiles correctly now. Originally committed to SVN as r5279. --- aegisub/libaegisub/media/ffms_audio.cpp | 9 +++++---- aegisub/libaegisub/media/ffms_audio.h | 9 ++++++++- aegisub/libaegisub/media/ffms_video.cpp | 3 ++- aegisub/libaegisub/media/ffms_video.h | 3 ++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/aegisub/libaegisub/media/ffms_audio.cpp b/aegisub/libaegisub/media/ffms_audio.cpp index 9d1c32ff5..0c0b38c9e 100644 --- a/aegisub/libaegisub/media/ffms_audio.cpp +++ b/aegisub/libaegisub/media/ffms_audio.cpp @@ -25,6 +25,7 @@ #endif #include "ffms_audio.h" +#include "libaegisub/media.h" namespace agi { namespace ffms { @@ -161,9 +162,9 @@ void Audio::LoadAudio(std::string filename) { // } #if FFMS_VERSION >= ((2 << 24) | (14 << 16) | (1 << 8) | 0) - AudioSource = FFMS_CreateAudioSource(FileNameShort.utf8_str(), TrackNumber, Index, -1, &ErrInfo); + AudioSource = FFMS_CreateAudioSource(filename.c_str(), TrackNumber, Index, -1, &ErrInfo); #else - AudioSource = FFMS_CreateAudioSource(FileNameShort.utf8_str(), TrackNumber, Index, &ErrInfo); + AudioSource = FFMS_CreateAudioSource(filename.c_str(), TrackNumber, Index, &ErrInfo); #endif FFMS_DestroyIndex(Index); Index = NULL; @@ -197,9 +198,9 @@ Audio::~Audio() { Close(); } -/// @brief Clean up +/// @brief Clean up /// -void FFmpegSourceAudioProvider::Close() { +void Audio::Close() { if (AudioSource) FFMS_DestroyAudioSource(AudioSource); #ifdef WIN32 if (COMInited) diff --git a/aegisub/libaegisub/media/ffms_audio.h b/aegisub/libaegisub/media/ffms_audio.h index afa3b6a3e..8ad062a03 100644 --- a/aegisub/libaegisub/media/ffms_audio.h +++ b/aegisub/libaegisub/media/ffms_audio.h @@ -29,12 +29,14 @@ #include #endif +#include "ffms_common.h" + namespace agi { namespace ffms { /// @class Audio /// Audio file support. -class Audio { +class Audio : public FFmpegSourceProvider { FFMS_AudioSource *AudioSource; ///< audio source object bool COMInited; ///< COM initialization state @@ -44,6 +46,11 @@ class Audio { void Close(); void LoadAudio(std::string filename); + int channels; + int64_t num_samples; // for one channel, ie. number of PCM frames + int sample_rate; + int bytes_per_sample; + Audio(std::string filename); virtual ~Audio(); diff --git a/aegisub/libaegisub/media/ffms_video.cpp b/aegisub/libaegisub/media/ffms_video.cpp index aef0267e6..cfdcfbff0 100644 --- a/aegisub/libaegisub/media/ffms_video.cpp +++ b/aegisub/libaegisub/media/ffms_video.cpp @@ -36,6 +36,7 @@ #include "ffms_video.h" #include "libaegisub/media.h" +#include "libaegisub/util.h" //#include "aegisub_endian.h" //#include "compat.h" @@ -265,7 +266,7 @@ void Video::Close() { /// @return /// const media::AegiVideoFrame Video::GetFrame(int n) { - FrameNumber = mid(0, n, GetFrameCount() - 1); + FrameNumber = util::mid(0, n, GetFrameCount() - 1); // decode frame const FFMS_Frame *SrcFrame = FFMS_GetFrame(VideoSource, FrameNumber, &ErrInfo); diff --git a/aegisub/libaegisub/media/ffms_video.h b/aegisub/libaegisub/media/ffms_video.h index 3f7dd6a67..5eafdeb01 100644 --- a/aegisub/libaegisub/media/ffms_video.h +++ b/aegisub/libaegisub/media/ffms_video.h @@ -28,13 +28,14 @@ #include "libaegisub/media_video_frame.h" #include "libaegisub/vfr.h" #include "libaegisub/exception.h" +#include "ffms_common.h" namespace agi { namespace ffms { /// @class FFmpegSourceVideoProvider /// @brief Implements video loading through the FFMS library. -class Video { +class Video : public FFmpegSourceProvider { private: FFMS_VideoSource *VideoSource; /// video source object const FFMS_VideoProperties *VideoInfo; /// video properties