2007-01-21 07:30:19 +01:00
|
|
|
// Copyright (c) 2005-2007, Rodrigo Braz Monteiro
|
|
|
|
// 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_context.h
|
|
|
|
/// @see video_context.cpp
|
|
|
|
/// @ingroup video
|
|
|
|
///
|
2007-01-21 07:30:19 +01:00
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
#include <libaegisub/fs_fwd.h>
|
|
|
|
#include <libaegisub/signal.h>
|
|
|
|
#include <libaegisub/vfr.h>
|
|
|
|
|
|
|
|
#include <boost/filesystem/path.hpp>
|
|
|
|
#include <chrono>
|
2012-12-17 17:27:11 +01:00
|
|
|
#include <ctime>
|
2009-09-11 04:36:34 +02:00
|
|
|
#include <list>
|
2010-07-08 06:29:04 +02:00
|
|
|
#include <memory>
|
2012-12-17 17:27:11 +01:00
|
|
|
#include <set>
|
2009-09-11 04:36:34 +02:00
|
|
|
|
2007-09-12 01:22:26 +02:00
|
|
|
#include <wx/timer.h>
|
2007-01-21 07:30:19 +01:00
|
|
|
|
2012-12-17 17:27:11 +01:00
|
|
|
class AssEntry;
|
2013-01-04 16:01:50 +01:00
|
|
|
struct SubtitlesProviderErrorEvent;
|
2010-07-23 07:58:39 +02:00
|
|
|
class ThreadedFrameSource;
|
2013-07-01 05:15:43 +02:00
|
|
|
struct VideoFrame;
|
2007-01-21 07:30:19 +01:00
|
|
|
class VideoProvider;
|
2013-01-04 16:01:50 +01:00
|
|
|
struct VideoProviderErrorEvent;
|
2010-06-08 08:09:13 +02:00
|
|
|
|
|
|
|
namespace agi {
|
2011-01-16 08:17:08 +01:00
|
|
|
struct Context;
|
2010-06-08 08:09:13 +02:00
|
|
|
class OptionValue;
|
|
|
|
}
|
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-01-20 22:05:24 +01:00
|
|
|
enum class AspectRatio {
|
|
|
|
Default = 0,
|
|
|
|
Fullscreen,
|
|
|
|
Widescreen,
|
|
|
|
Cinematic,
|
|
|
|
Custom
|
|
|
|
};
|
|
|
|
|
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 VideoContext
|
2012-03-12 01:07:09 +01:00
|
|
|
/// @brief Manage a bunch of things vaguely related to video playback
|
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-03-12 01:07:09 +01:00
|
|
|
/// VideoContext's core responsibility is opening and playing videos. Along
|
|
|
|
/// with that, it also manages video timecodes and keyframes, and some
|
|
|
|
/// video-related UI properties
|
2007-01-21 07:30:19 +01:00
|
|
|
class VideoContext : public wxEvtHandler {
|
2010-12-07 20:09:28 +01:00
|
|
|
/// Current frame number changed (new frame number)
|
2010-12-07 20:09:21 +01:00
|
|
|
agi::signal::Signal<int> Seek;
|
|
|
|
/// A new video was opened
|
|
|
|
agi::signal::Signal<> VideoOpen;
|
2010-12-07 20:09:28 +01:00
|
|
|
/// New keyframes opened (new keyframe data)
|
2010-12-07 20:09:21 +01:00
|
|
|
agi::signal::Signal<std::vector<int> const&> KeyframesOpen;
|
2010-12-31 22:03:18 +01:00
|
|
|
/// New timecodes opened (new timecode data)
|
|
|
|
agi::signal::Signal<agi::vfr::Framerate const&> TimecodesOpen;
|
2010-12-07 20:09:28 +01:00
|
|
|
/// Aspect ratio was changed (type, value)
|
2013-01-20 22:05:24 +01:00
|
|
|
agi::signal::Signal<AspectRatio, double> ARChange;
|
2010-12-07 20:09:21 +01:00
|
|
|
|
2011-01-16 08:17:08 +01:00
|
|
|
agi::Context *context;
|
|
|
|
|
2012-11-13 17:51:01 +01:00
|
|
|
/// The video provider owned by the threaded frame source, or nullptr if no
|
2011-12-06 01:18:04 +01:00
|
|
|
/// video is open
|
2013-01-04 16:01:50 +01:00
|
|
|
VideoProvider *video_provider;
|
2007-01-21 07:30:19 +01:00
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Asynchronous provider of video frames
|
2013-01-04 16:01:50 +01:00
|
|
|
std::unique_ptr<ThreadedFrameSource> provider;
|
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
|
|
|
|
2010-08-26 20:38:37 +02:00
|
|
|
/// Filename of currently open video
|
2013-01-04 16:01:50 +01:00
|
|
|
agi::fs::path video_filename;
|
2010-08-26 20:38:37 +02:00
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// List of frame numbers which are keyframes
|
2013-01-04 16:01:50 +01:00
|
|
|
std::vector<int> keyframes;
|
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
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// File name of the currently open keyframes or empty if keyframes are not overridden
|
2013-01-04 16:01:50 +01:00
|
|
|
agi::fs::path keyframes_filename;
|
2007-01-21 07:30:19 +01:00
|
|
|
|
2012-03-12 01:07:09 +01:00
|
|
|
/// Playback timer used to periodically check if we should go to the next
|
|
|
|
/// frame while playing video
|
2007-01-21 07:30:19 +01:00
|
|
|
wxTimer playback;
|
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-01-04 16:01:50 +01:00
|
|
|
/// Time when playback was last started
|
|
|
|
std::chrono::steady_clock::time_point playback_start_time;
|
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
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// The start time of the first frame of the current playback; undefined if
|
|
|
|
/// video is not currently playing
|
2013-12-12 01:29:48 +01:00
|
|
|
int start_ms = 0;
|
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
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// The last frame to play if video is currently playing
|
2013-12-12 01:29:48 +01:00
|
|
|
int end_frame = 0;
|
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
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// The frame number which was last requested from the video provider,
|
|
|
|
/// which may not be the same thing as the currently displayed frame
|
2013-12-12 01:29:48 +01:00
|
|
|
int frame_n = 0;
|
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
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// The picture aspect ratio of the video if the aspect ratio has been
|
|
|
|
/// overridden by the user
|
2013-12-12 01:29:48 +01:00
|
|
|
double ar_value = 1.;
|
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-01-20 22:05:24 +01:00
|
|
|
/// The current AR type
|
2013-12-12 01:29:48 +01:00
|
|
|
AspectRatio ar_type = AspectRatio::Default;
|
2007-01-23 07:32:16 +01:00
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Does the currently loaded video file have subtitles muxed into it?
|
2013-12-12 01:29:48 +01:00
|
|
|
bool has_subtitles = false;
|
2010-05-19 02:44:37 +02:00
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Filename of the currently loaded timecodes file, or empty if timecodes
|
2012-03-12 01:07:09 +01:00
|
|
|
/// have not been overridden
|
2013-01-04 16:01:50 +01:00
|
|
|
agi::fs::path timecodes_filename;
|
2010-07-08 06:29:04 +02:00
|
|
|
|
2012-03-12 01:07:09 +01:00
|
|
|
/// Cached option for audio playing when frame stepping
|
2010-11-08 06:08:24 +01:00
|
|
|
const agi::OptionValue* playAudioOnStep;
|
2010-06-08 08:09:13 +02:00
|
|
|
|
2013-01-14 17:15:12 +01:00
|
|
|
/// Amending the frame source's copy of the subtitle file requires that it
|
|
|
|
/// be kept in perfect sync. Saving the file can add lines to the file
|
|
|
|
/// without a commit, breaking this sync, so force a non-amend after each
|
|
|
|
/// save.
|
2013-12-12 01:29:48 +01:00
|
|
|
bool no_amend = false;
|
2013-01-14 17:15:12 +01:00
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
void OnPlayTimer(wxTimerEvent &event);
|
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// The timecodes from the video file
|
2013-01-04 16:01:50 +01:00
|
|
|
agi::vfr::Framerate video_fps;
|
2011-12-06 01:18:04 +01:00
|
|
|
/// External timecode which have been loaded, if any
|
2013-01-04 16:01:50 +01:00
|
|
|
agi::vfr::Framerate ovr_fps;
|
2010-07-08 06:29:04 +02:00
|
|
|
|
2010-07-23 07:58:39 +02:00
|
|
|
void OnVideoError(VideoProviderErrorEvent const& err);
|
|
|
|
void OnSubtitlesError(SubtitlesProviderErrorEvent const& err);
|
|
|
|
|
2012-12-17 17:27:11 +01:00
|
|
|
void OnSubtitlesCommit(int type, std::set<const AssEntry *> const& changed);
|
2011-01-16 08:16:40 +01:00
|
|
|
void OnSubtitlesSave();
|
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Close the video, keyframes and timecodes
|
2011-11-23 19:32:37 +01:00
|
|
|
void Reset();
|
|
|
|
|
2007-01-21 07:30:19 +01:00
|
|
|
public:
|
|
|
|
VideoContext();
|
|
|
|
~VideoContext();
|
|
|
|
|
2011-01-16 08:17:08 +01:00
|
|
|
/// @brief Set the context that this is the video controller for
|
|
|
|
/// @param context Initialized project context
|
|
|
|
///
|
|
|
|
/// Once this is no longer a singleton this can probably be moved into
|
|
|
|
/// the constructor
|
|
|
|
void SetContext(agi::Context *context);
|
|
|
|
|
2010-07-08 06:29:04 +02:00
|
|
|
/// @brief Get the video provider used for the currently open video
|
2013-01-04 16:01:50 +01:00
|
|
|
VideoProvider *GetProvider() const { return video_provider; }
|
2011-12-06 01:18:04 +01:00
|
|
|
|
|
|
|
/// Synchronously get a video frame
|
|
|
|
/// @param n Frame number to get
|
|
|
|
/// @param raw If true, subtitles are not rendered on the frame
|
|
|
|
/// @return The requested frame
|
2013-07-01 05:15:43 +02:00
|
|
|
std::shared_ptr<VideoFrame> GetFrame(int n, bool raw = false);
|
2011-12-06 01:18:04 +01:00
|
|
|
|
|
|
|
/// Asynchronously get a video frame, triggering a EVT_FRAME_READY event when it's ready
|
|
|
|
/// @param n Frame number to get
|
2010-07-23 07:58:39 +02:00
|
|
|
void GetFrameAsync(int n);
|
2007-04-08 00:03:06 +02:00
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Is there a video loaded?
|
2013-01-04 16:01:50 +01:00
|
|
|
bool IsLoaded() const { return !!video_provider; }
|
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
|
|
|
|
2011-12-06 01:17:54 +01:00
|
|
|
/// Get the file name of the currently open video, if any
|
2013-01-04 16:01:50 +01:00
|
|
|
agi::fs::path GetVideoName() const { return video_filename; }
|
2011-12-06 01:17:54 +01:00
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Is the video currently playing?
|
2011-12-05 06:26:45 +01:00
|
|
|
bool IsPlaying() const { return playback.IsRunning(); }
|
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
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Does the video file loaded have muxed subtitles that we can load?
|
2013-01-04 16:01:50 +01:00
|
|
|
bool HasSubtitles() const { return has_subtitles; }
|
2010-05-19 02:44:37 +02:00
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Get the width of the currently open video
|
2010-07-08 06:29:04 +02:00
|
|
|
int GetWidth() const;
|
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
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Get the height of the currently open video
|
2010-07-08 06:29:04 +02:00
|
|
|
int GetHeight() const;
|
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
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Get the length in frames of the currently open video
|
2011-12-05 06:26:45 +01:00
|
|
|
int GetLength() const;
|
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
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Get the current frame number
|
2010-07-08 06:29:04 +02:00
|
|
|
int GetFrameN() const { return frame_n; }
|
2007-01-21 07:30:19 +01:00
|
|
|
|
2012-03-12 01:07:09 +01:00
|
|
|
/// Get the actual aspect ratio from a predefined AR type
|
2013-01-20 22:05:24 +01:00
|
|
|
double GetARFromType(AspectRatio type) const;
|
|
|
|
|
|
|
|
/// Override the aspect ratio of the currently loaded video
|
|
|
|
void SetAspectRatio(double value);
|
2011-12-06 01:18:04 +01:00
|
|
|
|
|
|
|
/// Override the aspect ratio of the currently loaded video
|
2013-01-20 22:05:24 +01:00
|
|
|
/// @param type Predefined type to set the AR to. Must not be Custom.
|
|
|
|
void SetAspectRatio(AspectRatio type);
|
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-03-12 01:07:09 +01:00
|
|
|
/// Get the current AR type
|
2013-01-20 22:05:24 +01:00
|
|
|
AspectRatio GetAspectRatioType() const { return ar_type; }
|
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
|
|
|
|
2011-12-06 01:18:04 +01:00
|
|
|
/// Get the current aspect ratio of the video
|
2013-01-04 16:01:50 +01:00
|
|
|
double GetAspectRatioValue() const { return ar_value; }
|
2007-01-23 07:32:16 +01:00
|
|
|
|
2010-07-08 06:29:04 +02:00
|
|
|
/// @brief Open a new video
|
|
|
|
/// @param filename Video to open, or empty to close the current video
|
2013-01-04 16:01:50 +01:00
|
|
|
void SetVideo(const agi::fs::path &filename);
|
2010-08-26 20:38:37 +02:00
|
|
|
/// @brief Close and reopen the current video
|
|
|
|
void Reload();
|
2007-01-21 07:30:19 +01:00
|
|
|
|
2010-07-08 06:29:04 +02:00
|
|
|
/// @brief Jump to the beginning of a frame
|
|
|
|
/// @param n Frame number to jump to
|
2007-01-21 07:30:19 +01:00
|
|
|
void JumpToFrame(int n);
|
2010-07-08 06:29:04 +02:00
|
|
|
/// @brief Jump to a time
|
|
|
|
/// @param ms Time to jump to in milliseconds
|
|
|
|
/// @param end Type of time
|
|
|
|
void JumpToTime(int ms, agi::vfr::Time end = agi::vfr::START);
|
2007-01-21 07:30:19 +01:00
|
|
|
|
2010-07-08 06:29:04 +02:00
|
|
|
/// Starting playing the video
|
2007-01-21 07:30:19 +01:00
|
|
|
void Play();
|
2010-07-08 06:29:04 +02:00
|
|
|
/// Play the next frame then stop
|
2011-01-16 08:15:53 +01:00
|
|
|
void NextFrame();
|
2010-07-08 06:29:04 +02:00
|
|
|
/// Play the previous frame then stop
|
2011-01-16 08:15:53 +01:00
|
|
|
void PrevFrame();
|
2010-07-08 06:29:04 +02:00
|
|
|
/// Seek to the beginning of the current line, then play to the end of it
|
2007-01-21 07:30:19 +01:00
|
|
|
void PlayLine();
|
2010-07-08 06:29:04 +02:00
|
|
|
/// Stop playing
|
2007-01-21 07:30:19 +01:00
|
|
|
void Stop();
|
|
|
|
|
2010-12-07 20:09:21 +01:00
|
|
|
DEFINE_SIGNAL_ADDERS(Seek, AddSeekListener)
|
|
|
|
DEFINE_SIGNAL_ADDERS(VideoOpen, AddVideoOpenListener)
|
2010-12-31 22:03:18 +01:00
|
|
|
DEFINE_SIGNAL_ADDERS(KeyframesOpen, AddKeyframesListener)
|
|
|
|
DEFINE_SIGNAL_ADDERS(TimecodesOpen, AddTimecodesListener)
|
2010-12-07 20:09:28 +01:00
|
|
|
DEFINE_SIGNAL_ADDERS(ARChange, AddARChangeListener)
|
2010-12-07 20:09:21 +01:00
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
const std::vector<int>& GetKeyFrames() const { return keyframes; };
|
|
|
|
agi::fs::path GetKeyFramesName() const { return keyframes_filename; }
|
|
|
|
void LoadKeyframes(agi::fs::path const& filename);
|
|
|
|
void SaveKeyframes(agi::fs::path const& filename);
|
2010-07-08 06:29:04 +02:00
|
|
|
void CloseKeyframes();
|
2013-01-04 16:01:50 +01:00
|
|
|
bool OverKeyFramesLoaded() const { return !keyframes_filename.empty(); }
|
|
|
|
bool KeyFramesLoaded() const { return !keyframes.empty(); }
|
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-01-04 16:01:50 +01:00
|
|
|
agi::fs::path GetTimecodesName() const { return timecodes_filename; }
|
|
|
|
void LoadTimecodes(agi::fs::path const& filename);
|
|
|
|
void SaveTimecodes(agi::fs::path const& filename);
|
2010-07-08 06:29:04 +02:00
|
|
|
void CloseTimecodes();
|
2013-01-04 16:01:50 +01:00
|
|
|
bool OverTimecodesLoaded() const { return ovr_fps.IsLoaded(); }
|
|
|
|
bool TimecodesLoaded() const { return video_fps.IsLoaded() || ovr_fps.IsLoaded(); };
|
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-01-04 16:01:50 +01:00
|
|
|
const agi::vfr::Framerate& FPS() const { return ovr_fps.IsLoaded() ? ovr_fps : video_fps; }
|
|
|
|
const agi::vfr::Framerate& VideoFPS() const { return video_fps; }
|
2010-07-08 06:29:04 +02:00
|
|
|
|
|
|
|
int TimeAtFrame(int frame, agi::vfr::Time type = agi::vfr::EXACT) const;
|
|
|
|
int FrameAtTime(int time, agi::vfr::Time type = agi::vfr::EXACT) const;
|
2007-01-21 07:30:19 +01:00
|
|
|
|
|
|
|
static VideoContext *Get();
|
|
|
|
};
|