forked from mia/Aegisub
s/Video/FFmpegSourceVideoProvider/, originally I was planning something different now we're moving all media-related code, also add missing GetDecoderName() method which was somehow removed by accident in a previous revision.
Originally committed to SVN as r5328.
This commit is contained in:
parent
83fd95c605
commit
7d2594b134
2 changed files with 9 additions and 8 deletions
|
@ -49,7 +49,7 @@ namespace media {
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
/// @param filename The filename to open
|
/// @param filename The filename to open
|
||||||
Video::Video(std::string filename)
|
FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(std::string filename)
|
||||||
: VideoSource(NULL)
|
: VideoSource(NULL)
|
||||||
, VideoInfo(NULL)
|
, VideoInfo(NULL)
|
||||||
, Width(-1)
|
, Width(-1)
|
||||||
|
@ -95,14 +95,14 @@ Video::Video(std::string filename)
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
Video::~Video() {
|
FFmpegSourceVideoProvider::~FFmpegSourceVideoProvider() {
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// @brief Opens video
|
/// @brief Opens video
|
||||||
/// @param filename The filename to open
|
/// @param filename The filename to open
|
||||||
void Video::LoadVideo(std::string filename) {
|
void FFmpegSourceVideoProvider::LoadVideo(std::string filename) {
|
||||||
|
|
||||||
FFMS_Indexer *Indexer = FFMS_CreateIndexer(filename.c_str(), &ErrInfo);
|
FFMS_Indexer *Indexer = FFMS_CreateIndexer(filename.c_str(), &ErrInfo);
|
||||||
if (Indexer == NULL) {
|
if (Indexer == NULL) {
|
||||||
|
@ -252,7 +252,7 @@ void Video::LoadVideo(std::string filename) {
|
||||||
|
|
||||||
/// @brief Close video
|
/// @brief Close video
|
||||||
///
|
///
|
||||||
void Video::Close() {
|
void FFmpegSourceVideoProvider::Close() {
|
||||||
if (VideoSource) FFMS_DestroyVideoSource(VideoSource);
|
if (VideoSource) FFMS_DestroyVideoSource(VideoSource);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (COMInited)
|
if (COMInited)
|
||||||
|
@ -264,7 +264,7 @@ void Video::Close() {
|
||||||
/// @param _n
|
/// @param _n
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
const media::AegiVideoFrame Video::GetFrame(int n) {
|
const media::AegiVideoFrame FFmpegSourceVideoProvider::GetFrame(int n) {
|
||||||
FrameNumber = agi::util::mid(0, n, GetFrameCount() - 1);
|
FrameNumber = agi::util::mid(0, n, GetFrameCount() - 1);
|
||||||
|
|
||||||
// decode frame
|
// decode frame
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace media {
|
||||||
|
|
||||||
/// @class FFmpegSourceVideoProvider
|
/// @class FFmpegSourceVideoProvider
|
||||||
/// @brief Implements video loading through the FFMS library.
|
/// @brief Implements video loading through the FFMS library.
|
||||||
class Video : public VideoProvider, FFmpegSourceProvider {
|
class FFmpegSourceVideoProvider : public VideoProvider, FFmpegSourceProvider {
|
||||||
private:
|
private:
|
||||||
FFMS_VideoSource *VideoSource; /// video source object
|
FFMS_VideoSource *VideoSource; /// video source object
|
||||||
const FFMS_VideoProperties *VideoInfo; /// video properties
|
const FFMS_VideoProperties *VideoInfo; /// video properties
|
||||||
|
@ -55,8 +55,8 @@ private:
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Video(std::string filename);
|
FFmpegSourceVideoProvider(std::string filename);
|
||||||
~Video();
|
~FFmpegSourceVideoProvider();
|
||||||
|
|
||||||
const media::AegiVideoFrame GetFrame(int n);
|
const media::AegiVideoFrame GetFrame(int n);
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ public:
|
||||||
/// @brief Gets a list of keyframes
|
/// @brief Gets a list of keyframes
|
||||||
/// @return Returns a vector<int> of keyframes.
|
/// @return Returns a vector<int> of keyframes.
|
||||||
std::vector<int> GetKeyFrames() const { return KeyFramesList; };
|
std::vector<int> GetKeyFrames() const { return KeyFramesList; };
|
||||||
|
std::string GetDecoderName() const { return "FFmpegSource"; }
|
||||||
/// @brief Gets the desired cache behavior.
|
/// @brief Gets the desired cache behavior.
|
||||||
/// @return Returns true.
|
/// @return Returns true.
|
||||||
bool WantsCaching() const { return true; }
|
bool WantsCaching() const { return true; }
|
||||||
|
|
Loading…
Reference in a new issue