2007-04-02 20:28:09 +02:00
|
|
|
// Copyright (c) 2007, Niels Martin Hansen
|
|
|
|
// 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/
|
|
|
|
|
|
|
|
/// @file video_provider_dummy.h
|
|
|
|
/// @see video_provider_dummy.cpp
|
|
|
|
/// @ingroup video_input
|
|
|
|
///
|
2007-04-02 20:28:09 +02:00
|
|
|
|
2009-09-11 04:36:34 +02:00
|
|
|
#include "include/aegisub/video_provider.h"
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2012-10-26 16:09:14 +02:00
|
|
|
namespace agi { struct Color; }
|
2012-02-07 02:21:37 +01:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @class DummyVideoProvider
|
2012-02-07 02:21:37 +01:00
|
|
|
/// @brief A dummy video provider for when opening a file is just too much effort
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
///
|
2012-02-07 02:21:37 +01:00
|
|
|
/// This simply returns a single constant frame, which can either be a flat
|
|
|
|
/// color or a checkerboard pattern
|
2007-04-02 20:28:09 +02:00
|
|
|
class DummyVideoProvider : public VideoProvider {
|
2012-02-07 02:21:37 +01:00
|
|
|
int framecount; ///< Length of the dummy video in frames
|
|
|
|
agi::vfr::Framerate fps; ///< Frame rate to use
|
|
|
|
int width; ///< Width in pixels
|
|
|
|
int height; ///< Height in pixels
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2013-07-01 05:15:43 +02:00
|
|
|
/// The data for the image returned for all frames
|
|
|
|
std::vector<unsigned char> data;
|
2007-04-02 20:28:09 +02:00
|
|
|
|
2012-02-07 02:21:37 +01:00
|
|
|
/// Create the dummy frame from the given parameters
|
|
|
|
/// @param fps Frame rate of the dummy video
|
|
|
|
/// @param frames Length in frames of the dummy video
|
|
|
|
/// @param width Width in pixels of the dummy video
|
|
|
|
/// @param height Height in pixels of the dummy video
|
|
|
|
/// @param red Red component of the primary colour of the dummy video
|
|
|
|
/// @param green Green component of the primary colour of the dummy video
|
|
|
|
/// @param blue Blue component of the primary colour of the dummy video
|
|
|
|
/// @param pattern Use a checkerboard pattern rather than a solid colour
|
|
|
|
void Create(double fps, int frames, int width, int height, unsigned char red, unsigned char green, unsigned char blue, bool pattern);
|
2007-04-02 20:28:09 +02:00
|
|
|
|
|
|
|
public:
|
2012-02-07 02:21:37 +01:00
|
|
|
/// Create a dummy video from a string returned from MakeFilename
|
2013-10-17 16:23:45 +02:00
|
|
|
DummyVideoProvider(agi::fs::path const& filename, std::string const& colormatix);
|
2012-02-07 02:21:37 +01:00
|
|
|
|
|
|
|
/// Create a dummy video from separate parameters
|
|
|
|
/// @param fps Frame rate of the dummy video
|
|
|
|
/// @param frames Length in frames of the dummy video
|
|
|
|
/// @param width Width in pixels of the dummy video
|
|
|
|
/// @param height Height in pixels of the dummy video
|
|
|
|
/// @param colour Primary colour of the dummy video
|
|
|
|
/// @param pattern Use a checkerboard pattern rather than a solid colour
|
2012-10-26 16:09:14 +02:00
|
|
|
DummyVideoProvider(double fps, int frames, int width, int height, agi::Color colour, bool pattern);
|
2012-02-07 02:21:37 +01:00
|
|
|
|
|
|
|
/// Make a fake filename which when passed to the constructor taking a
|
|
|
|
/// string will result in a video with the given parameters
|
2013-01-04 16:01:50 +01:00
|
|
|
static std::string MakeFilename(double fps, int frames, int width, int height, agi::Color colour, bool pattern);
|
2007-04-02 20:28:09 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
std::shared_ptr<VideoFrame> GetFrame(int n) override;
|
2013-07-01 05:15:43 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
int GetFrameCount() const override { return framecount; }
|
|
|
|
int GetWidth() const override { return width; }
|
|
|
|
int GetHeight() const override { return height; }
|
|
|
|
double GetDAR() const override { return 0; }
|
|
|
|
agi::vfr::Framerate GetFPS() const override { return fps; }
|
2013-12-12 00:11:06 +01:00
|
|
|
std::vector<int> GetKeyFrames() const override { return {}; }
|
2013-11-21 18:13:36 +01:00
|
|
|
std::string GetColorSpace() const override { return "None"; }
|
|
|
|
std::string GetDecoderName() const override { return "Dummy Video Provider"; }
|
2007-04-02 20:28:09 +02:00
|
|
|
};
|