2008-03-06 20:20:25 +01:00
|
|
|
// Copyright (c) 2006-2008, Rodrigo Braz Monteiro, Fredrik Mellbin
|
2006-01-22 13:44:53 +01:00
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2006-01-22 13:44:53 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file video_provider.h
|
|
|
|
/// @brief Declaration of base-class for video providers
|
|
|
|
/// @ingroup main_headers video_input
|
|
|
|
///
|
2006-01-22 13:44:53 +01:00
|
|
|
|
2006-02-23 04:41:29 +01:00
|
|
|
#pragma once
|
2006-01-22 13:44:53 +01:00
|
|
|
|
2009-09-11 04:36:34 +02:00
|
|
|
#include "video_frame.h"
|
2010-08-02 08:32:01 +02:00
|
|
|
#include <libaegisub/exception.h>
|
2010-07-08 06:29:04 +02:00
|
|
|
#include <libaegisub/vfr.h>
|
2009-07-30 06:24:23 +02:00
|
|
|
|
|
|
|
/// @class VideoProvider
|
|
|
|
/// @brief DOCME
|
|
|
|
///
|
|
|
|
/// DOCME
|
2006-02-23 04:41:29 +01:00
|
|
|
class VideoProvider {
|
2007-01-21 07:30:19 +01:00
|
|
|
public:
|
2008-03-06 20:20:25 +01:00
|
|
|
virtual ~VideoProvider() {}
|
2006-01-22 13:44:53 +01:00
|
|
|
|
2008-03-06 20:20:25 +01:00
|
|
|
// Override this method to actually get frames
|
2009-07-20 05:50:25 +02:00
|
|
|
virtual const AegiVideoFrame GetFrame(int n)=0;
|
2006-02-24 09:30:08 +01:00
|
|
|
|
2008-03-06 20:20:25 +01:00
|
|
|
// Override the following methods to get video information:
|
2010-07-08 06:29:04 +02:00
|
|
|
virtual int GetPosition() const=0; ///< Get the number of the last frame loaded
|
|
|
|
virtual int GetFrameCount() const=0; ///< Get total number of frames
|
|
|
|
virtual int GetWidth() const=0; ///< Returns the video width in pixels
|
|
|
|
virtual int GetHeight() const=0; ///< Returns the video height in pixels
|
|
|
|
virtual agi::vfr::Framerate GetFPS() const=0; ///< Get frame rate
|
|
|
|
virtual std::vector<int> GetKeyFrames() const=0;///< Returns list of keyframes
|
2008-03-06 20:20:25 +01:00
|
|
|
|
2009-07-30 06:24:23 +02:00
|
|
|
|
2010-07-08 06:29:04 +02:00
|
|
|
/// @brief Use this to set any post-loading warnings, such as "being loaded with unreliable seeking"
|
2011-09-28 21:43:11 +02:00
|
|
|
virtual wxString GetWarning() const { return ""; }
|
2008-03-06 20:20:25 +01:00
|
|
|
|
2010-07-08 06:29:04 +02:00
|
|
|
/// @brief Name of decoder, e.g. "Avisynth/FFMpegSource"
|
|
|
|
virtual wxString GetDecoderName() const = 0;
|
2009-07-30 06:24:23 +02:00
|
|
|
|
2009-11-29 20:09:55 +01:00
|
|
|
/// @brief Does this provider want Aegisub to cache video frames?
|
|
|
|
/// @return Returns true if caching is desired, false otherwise.
|
2010-07-08 06:29:04 +02:00
|
|
|
virtual bool WantsCaching() const { return false; }
|
2007-01-21 07:30:19 +01:00
|
|
|
};
|
2010-08-02 08:32:01 +02:00
|
|
|
|
2011-12-28 22:27:06 +01:00
|
|
|
DEFINE_BASE_EXCEPTION_NOINNER(VideoProviderError, agi::Exception)
|
2010-08-02 08:32:01 +02:00
|
|
|
/// File could be opened, but is not a supported format
|
2011-12-28 22:27:06 +01:00
|
|
|
DEFINE_SIMPLE_EXCEPTION_NOINNER(VideoNotSupported, VideoProviderError, "video/open/notsupported")
|
2010-08-02 08:32:01 +02:00
|
|
|
/// File appears to be a supported format, but could not be opened
|
2011-12-28 22:27:06 +01:00
|
|
|
DEFINE_SIMPLE_EXCEPTION_NOINNER(VideoOpenError, VideoProviderError, "video/open/failed")
|
2010-08-02 08:32:01 +02:00
|
|
|
|
|
|
|
/// Error of some sort occurred while decoding a frame
|
2011-12-28 22:27:06 +01:00
|
|
|
DEFINE_SIMPLE_EXCEPTION_NOINNER(VideoDecodeError, VideoProviderError, "video/error")
|