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/
2007-01-21 07:30:19 +01:00
//
2009-07-29 07:43:02 +02:00
// $Id$
/// @file video_context.cpp
/// @brief Keep track of loaded video and video displays
/// @ingroup video
///
2007-01-21 07:30:19 +01:00
////////////
// Includes
2009-01-04 07:31:48 +01:00
# include "config.h"
2007-09-12 01:22:26 +02:00
# ifdef __APPLE__
2007-04-22 04:24:27 +02:00
# include <OpenGL/GL.h>
# include <OpenGL/glu.h>
# else
2007-01-22 23:57:45 +01:00
# include <GL/gl.h>
# include <GL/glu.h>
2007-04-22 04:24:27 +02:00
# endif
2007-01-21 07:30:19 +01:00
# include <wx/image.h>
# include <string.h>
# include <wx/clipbrd.h>
# include <wx/filename.h>
# include <wx/config.h>
# include "utils.h"
# include "video_display.h"
# include "video_context.h"
2008-03-07 22:00:20 +01:00
# include "video_provider_manager.h"
2007-07-01 09:09:37 +02:00
# include "visual_tool.h"
2008-03-07 22:00:20 +01:00
# include "subtitles_provider_manager.h"
2007-01-21 07:30:19 +01:00
# include "vfr.h"
# include "ass_file.h"
# include "ass_exporter.h"
# include "ass_time.h"
# include "ass_dialogue.h"
# include "ass_style.h"
# include "subs_grid.h"
# include "options.h"
# include "subs_edit_box.h"
# include "audio_display.h"
# include "video_slider.h"
# include "video_box.h"
# include "utils.h"
2007-01-27 07:15:25 +01:00
# include "gl_wrap.h"
2007-06-21 00:23:55 +02:00
# include "standard_paths.h"
2007-01-21 07:30:19 +01:00
///////
// IDs
enum {
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
/// DOCME
2007-01-21 07:30:19 +01:00
VIDEO_PLAY_TIMER = 1300
} ;
///////////////
// Event table
BEGIN_EVENT_TABLE ( VideoContext , wxEvtHandler )
EVT_TIMER ( VIDEO_PLAY_TIMER , VideoContext : : OnPlayTimer )
END_EVENT_TABLE ( )
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
/// DOCME
2007-01-21 07:30:19 +01:00
VideoContext * VideoContext : : instance = NULL ;
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
/// @brief Constructor
///
2007-01-21 07:30:19 +01:00
VideoContext : : VideoContext ( ) {
// Set GL context
glContext = NULL ;
2009-07-14 04:00:56 +02:00
ownGlContext = false ;
2007-01-21 07:30:19 +01:00
lastTex = 0 ;
lastFrame = - 1 ;
// Set options
audio = NULL ;
provider = NULL ;
subsProvider = NULL ;
curLine = NULL ;
loaded = false ;
keyFramesLoaded = false ;
overKeyFramesLoaded = false ;
frame_n = 0 ;
2009-05-01 00:13:10 +02:00
length = 0 ;
fps = 0 ;
2007-01-23 07:32:16 +01:00
arType = 0 ;
arValue = 1.0 ;
2007-01-21 07:30:19 +01:00
isPlaying = false ;
nextFrame = - 1 ;
2007-06-02 15:48:36 +02:00
keepAudioSync = true ;
2007-04-08 01:45:46 +02:00
// Threads
2007-06-28 22:29:56 +02:00
//threaded = Options.AsBool(_T("Threaded Video"));
threaded = false ;
2007-04-08 01:45:46 +02:00
threadLocked = false ;
threadNextFrame = - 1 ;
2007-01-21 07:30:19 +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
/// @brief Destructor
///
2007-01-21 07:30:19 +01:00
VideoContext : : ~ VideoContext ( ) {
Reset ( ) ;
2009-07-14 04:00:56 +02:00
if ( ownGlContext )
delete glContext ;
2007-01-21 07:30:19 +01:00
glContext = NULL ;
}
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
/// @brief Get Instance
/// @return
///
2007-01-21 07:30:19 +01:00
VideoContext * VideoContext : : Get ( ) {
2007-01-23 21:50:41 +01:00
if ( ! instance ) {
instance = new VideoContext ;
}
2007-01-21 07:30:19 +01:00
return instance ;
}
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
/// @brief Clear
///
2007-01-21 07:30:19 +01:00
void VideoContext : : Clear ( ) {
instance - > audio = NULL ;
delete instance ;
instance = NULL ;
}
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
/// @brief Reset
///
2007-01-21 07:30:19 +01:00
void VideoContext : : Reset ( ) {
2007-06-21 00:23:55 +02:00
// Reset ?video path
StandardPaths : : SetPathValue ( _T ( " ?video " ) , _T ( " " ) ) ;
2007-01-21 07:30:19 +01:00
// Clear keyframes
KeyFrames . Clear ( ) ;
keyFramesLoaded = false ;
// Remove temporary audio provider
if ( audio & & audio - > temporary ) {
delete audio - > provider ;
audio - > provider = NULL ;
delete audio - > player ;
audio - > player = NULL ;
audio - > temporary = false ;
}
// Remove video data
loaded = false ;
frame_n = 0 ;
2009-05-01 00:13:10 +02:00
length = 0 ;
fps = 0 ;
2007-01-21 07:30:19 +01:00
keyFramesLoaded = false ;
overKeyFramesLoaded = false ;
isPlaying = false ;
nextFrame = - 1 ;
2007-06-28 22:29:56 +02:00
curLine = NULL ;
2007-01-21 07:30:19 +01:00
// Update displays
UpdateDisplays ( true ) ;
// Remove textures
UnloadTexture ( ) ;
// Clean up video data
wxRemoveFile ( tempfile ) ;
tempfile = _T ( " " ) ;
videoName = _T ( " " ) ;
tempFrame . Clear ( ) ;
// Remove provider
2007-04-08 21:27:46 +02:00
if ( provider ) {
delete provider ;
provider = NULL ;
}
2009-05-15 14:44:36 +02:00
delete subsProvider ;
2007-01-21 07:30:19 +01:00
subsProvider = NULL ;
2007-04-08 21:27:46 +02: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
/// @brief Reload video
///
2007-04-08 21:27:46 +02:00
void VideoContext : : Reload ( ) {
if ( IsLoaded ( ) ) {
wxString name = videoName ;
int n = frame_n ;
SetVideo ( _T ( " " ) ) ;
SetVideo ( name ) ;
JumpToFrame ( n ) ;
}
2007-01-21 07:30:19 +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
/// @brief Unload texture
///
2007-01-21 07:30:19 +01:00
void VideoContext : : UnloadTexture ( ) {
// Remove textures
if ( lastTex ! = 0 ) {
glDeleteTextures ( 1 , & lastTex ) ;
lastTex = 0 ;
}
lastFrame = - 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
/// @brief Sets video filename
/// @param filename
///
2007-01-21 07:30:19 +01:00
void VideoContext : : SetVideo ( const wxString & filename ) {
// Unload video
Reset ( ) ;
2007-04-10 04:55:23 +02:00
threaded = Options . AsBool ( _T ( " Threaded Video " ) ) ;
2007-01-21 07:30:19 +01:00
// Load video
if ( ! filename . IsEmpty ( ) ) {
try {
grid - > CommitChanges ( true ) ;
2007-01-27 08:13:29 +01:00
// Set GL context
GetGLContext ( displayList . front ( ) ) - > SetCurrent ( * displayList . front ( ) ) ;
2007-01-21 07:30:19 +01:00
// Choose a provider
2009-07-20 02:39:38 +02:00
provider = VideoProviderFactoryManager : : GetProvider ( filename ) ;
2007-01-23 01:38:59 +01:00
loaded = provider ! = NULL ;
2007-01-21 07:30:19 +01:00
// Get subtitles provider
2007-01-23 01:38:59 +01:00
try {
2009-05-15 14:44:36 +02:00
subsProvider = SubtitlesProviderFactoryManager : : GetProvider ( ) ;
2007-01-23 01:38:59 +01:00
}
catch ( wxString err ) { wxMessageBox ( _T ( " Error while loading subtitles provider: " ) + err , _T ( " Subtitles provider " ) ) ; }
catch ( const wchar_t * err ) { wxMessageBox ( _T ( " Error while loading subtitles provider: " ) + wxString ( err ) , _T ( " Subtitles provider " ) ) ; }
2007-01-21 07:30:19 +01:00
2008-07-15 02:08:05 +02:00
KeyFrames . Clear ( ) ;
// load keyframes if available
if ( provider - > AreKeyFramesLoaded ( ) ) {
KeyFrames = provider - > GetKeyFrames ( ) ;
keyFramesLoaded = true ;
}
else {
keyFramesLoaded = false ;
}
2007-01-21 07:30:19 +01:00
// Set frame rate
fps = provider - > GetFPS ( ) ;
2009-07-23 04:06:47 +02:00
// does this provider need special vfr treatment?
if ( provider - > NeedsVFRHack ( ) ) {
// FIXME:
// Unfortunately, this hack does not actually work for the one
// provider that needs it (Avisynth). Go figure.
bool isVfr = provider - > IsVFR ( ) ;
if ( ! isVfr | | provider - > IsNativelyByFrames ( ) ) {
VFR_Input . SetCFR ( fps ) ;
if ( VFR_Output . GetFrameRateType ( ) ! = VFR ) VFR_Output . SetCFR ( fps ) ;
}
else {
FrameRate temp = provider - > GetTrueFrameRate ( ) ;
provider - > OverrideFrameTimeList ( temp . GetFrameTimeList ( ) ) ;
}
2009-06-24 20:16:03 +02:00
}
2007-01-21 07:30:19 +01:00
// Gather video parameters
length = provider - > GetFrameCount ( ) ;
w = provider - > GetWidth ( ) ;
h = provider - > GetHeight ( ) ;
// Set filename
videoName = filename ;
Options . AddToRecentList ( filename , _T ( " Recent vid " ) ) ;
2007-06-21 00:23:55 +02:00
wxFileName fn ( filename ) ;
StandardPaths : : SetPathValue ( _T ( " ?video " ) , fn . GetPath ( ) ) ;
2007-01-21 07:30:19 +01:00
// Get frame
frame_n = 0 ;
2007-07-29 11:06:38 +02:00
// Show warning
2008-03-26 00:42:39 +01:00
wxString warning = provider - > GetWarning ( ) . c_str ( ) ;
2007-07-29 11:06:38 +02:00
if ( ! warning . IsEmpty ( ) ) wxMessageBox ( warning , _T ( " Warning " ) , wxICON_WARNING | wxOK ) ;
2007-01-21 07:30:19 +01:00
}
catch ( wxString & e ) {
wxMessageBox ( e , _T ( " Error setting video " ) , wxICON_ERROR | wxOK ) ;
}
}
loaded = provider ! = NULL ;
}
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
/// @brief Add new display
/// @param display
/// @return
///
2007-01-21 07:30:19 +01:00
void VideoContext : : AddDisplay ( VideoDisplay * display ) {
for ( std : : list < VideoDisplay * > : : iterator cur = displayList . begin ( ) ; cur ! = displayList . end ( ) ; cur + + ) {
if ( ( * cur ) = = display ) return ;
}
displayList . push_back ( display ) ;
}
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
/// @brief Remove display
/// @param display
///
2007-01-21 07:30:19 +01:00
void VideoContext : : RemoveDisplay ( VideoDisplay * display ) {
displayList . remove ( display ) ;
}
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
/// @brief Update displays
/// @param full
///
2007-01-21 07:30:19 +01:00
void VideoContext : : UpdateDisplays ( bool full ) {
for ( std : : list < VideoDisplay * > : : iterator cur = displayList . begin ( ) ; cur ! = displayList . end ( ) ; cur + + ) {
2007-01-23 05:42:08 +01:00
// Get display
2007-01-21 07:30:19 +01:00
VideoDisplay * display = * cur ;
2007-01-23 05:42:08 +01:00
// Update slider
2007-01-21 07:30:19 +01:00
if ( full ) {
display - > UpdateSize ( ) ;
display - > ControlSlider - > SetRange ( 0 , GetLength ( ) - 1 ) ;
}
display - > ControlSlider - > SetValue ( GetFrameN ( ) ) ;
2007-01-23 05:42:08 +01:00
//display->ControlSlider->Update();
2007-01-21 07:30:19 +01:00
display - > UpdatePositionDisplay ( ) ;
2007-01-23 05:42:08 +01:00
// If not shown, don't update the display itself
if ( ! display - > IsShownOnScreen ( ) ) continue ;
2007-07-01 09:09:37 +02:00
// Update visual controls
if ( display - > visual ) display - > visual - > Refresh ( ) ;
2007-01-23 05:42:08 +01:00
// Update controls
2007-07-01 09:09:37 +02:00
//display->Refresh();
//display->Update();
display - > Render ( ) ;
2007-01-21 07:30:19 +01:00
}
2008-01-14 02:18:24 +01:00
// Update audio display
2008-01-15 23:51:16 +01:00
if ( audio & & audio - > loaded & & audio - > IsShownOnScreen ( ) ) {
2008-01-14 02:18:24 +01:00
if ( Options . AsBool ( _T ( " Audio Draw Video Position " ) ) ) {
audio - > UpdateImage ( false ) ;
}
}
2007-01-21 07:30:19 +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
/// @brief Refresh subtitles
/// @param video
/// @param subtitles
///
2007-01-21 07:30:19 +01:00
void VideoContext : : Refresh ( bool video , bool subtitles ) {
// Reset frame
lastFrame = - 1 ;
2007-07-27 06:50:15 +02:00
// Update subtitles
2007-01-21 07:30:19 +01:00
if ( subtitles & & subsProvider ) {
2007-07-27 06:50:15 +02:00
// Re-export
2007-01-21 07:30:19 +01:00
AssExporter exporter ( grid - > ass ) ;
exporter . AddAutoFilters ( ) ;
2009-04-26 02:11:29 +02:00
try {
subsProvider - > LoadSubtitles ( exporter . ExportTransform ( ) ) ;
}
catch ( wxString err ) { wxMessageBox ( _T ( " Error while invoking subtitles provider: " ) + err , _T ( " Subtitles provider " ) ) ; }
catch ( const wchar_t * err ) { wxMessageBox ( _T ( " Error while invoking subtitles provider: " ) + wxString ( err ) , _T ( " Subtitles provider " ) ) ; }
2007-01-21 07:30:19 +01:00
}
// Jump to frame
JumpToFrame ( frame_n ) ;
}
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
/// @brief Jumps to a frame and update display
/// @param n
/// @return
///
2007-01-21 07:30:19 +01:00
void VideoContext : : JumpToFrame ( int n ) {
// Loaded?
if ( ! loaded ) return ;
// Prevent intervention during playback
if ( isPlaying & & n ! = playNextFrame ) return ;
2007-04-08 01:45:46 +02:00
// Threaded
2007-07-27 06:50:15 +02:00
if ( threaded & & false ) { // Doesn't work, so it's disabled
2007-04-08 01:45:46 +02:00
wxMutexLocker lock ( vidMutex ) ;
threadNextFrame = n ;
if ( ! threadLocked ) {
threadLocked = true ;
thread = new VideoContextThread ( this ) ;
thread - > Create ( ) ;
thread - > Run ( ) ;
}
}
// Not threaded
else {
2009-06-01 17:26:26 +02:00
try {
// Set frame number
frame_n = n ;
GetFrameAsTexture ( n ) ;
2007-01-21 07:30:19 +01:00
2009-06-01 17:26:26 +02:00
// Display
UpdateDisplays ( false ) ;
2007-01-21 07:30:19 +01:00
2009-06-01 17:26:26 +02:00
// Update grid
if ( ! isPlaying & & Options . AsBool ( _T ( " Highlight subs in frame " ) ) ) grid - > Refresh ( false ) ;
}
catch ( const wxChar * err ) {
wxLogError (
_T ( " Failed seeking video. The video will be closed because of this. \n " )
2009-06-01 17:29:22 +02:00
_T ( " If you get this error regardless of which video file you use, and also if you use dummy video, Aegisub might not work with your graphics card's OpenGL driver. \n " )
2009-06-01 17:26:26 +02:00
_T ( " Error message reported: %s " ) ,
err ) ;
Reset ( ) ;
}
catch ( . . . ) {
wxLogError (
_T ( " Failed seeking video. The video will be closed because of this. \n " )
2009-06-01 17:29:22 +02:00
_T ( " If you get this error regardless of which video file you use, and also if you use dummy video, Aegisub might not work with your graphics card's OpenGL driver. \n " )
2009-06-01 17:26:26 +02:00
_T ( " No further error message given. " ) ) ;
Reset ( ) ;
}
2007-04-08 01:45:46 +02:00
}
2007-01-21 07:30:19 +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
/// @brief Jumps to a specific time
/// @param ms
/// @param exact
///
2007-04-07 05:12:55 +02:00
void VideoContext : : JumpToTime ( int ms , bool exact ) {
int frame ;
if ( exact ) frame = VFR_Output . PFrameAtTime ( ms ) ;
else frame = VFR_Output . GetFrameAtTime ( ms ) ;
JumpToFrame ( frame ) ;
2007-01-21 07:30:19 +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
/// @brief Get GL context
/// @param canvas
/// @return
///
2007-01-21 07:30:19 +01:00
wxGLContext * VideoContext : : GetGLContext ( wxGLCanvas * canvas ) {
2009-07-14 04:00:56 +02:00
if ( ! glContext ) {
glContext = new wxGLContext ( canvas ) ;
ownGlContext = true ;
}
2007-01-21 07:30:19 +01:00
return glContext ;
}
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
/// @brief Requests a new frame
/// @param n
/// @param raw
/// @return
///
2007-04-08 00:03:06 +02:00
AegiVideoFrame VideoContext : : GetFrame ( int n , bool raw ) {
2007-04-03 04:55:43 +02:00
// Current frame if -1
if ( n = = - 1 ) n = frame_n ;
// Get frame
2009-07-20 05:50:25 +02:00
AegiVideoFrame frame = provider - > GetFrame ( n ) ;
2007-04-03 04:55:43 +02:00
// Raster subtitles if available/necessary
2009-05-15 14:44:36 +02:00
if ( ! raw & & subsProvider ) {
2007-04-08 20:12:51 +02:00
tempFrame . CopyFrom ( frame ) ;
2007-04-03 04:55:43 +02:00
subsProvider - > DrawSubtitles ( tempFrame , VFR_Input . GetTimeAtFrame ( n , true , true ) / 1000.0 ) ;
return tempFrame ;
}
// Return pure frame
2007-04-08 20:12:51 +02:00
else return frame ;
2007-04-03 04:55:43 +02: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
/// @brief Get GL Texture of frame
/// @param n
/// @return
///
2007-01-21 07:30:19 +01:00
GLuint VideoContext : : GetFrameAsTexture ( int n ) {
// Already uploaded
2007-01-22 23:57:45 +01:00
if ( n = = lastFrame | | n = = - 1 ) return lastTex ;
2007-01-21 07:30:19 +01:00
// Get frame
AegiVideoFrame frame = GetFrame ( n ) ;
// Set frame
lastFrame = n ;
2007-04-03 04:31:51 +02:00
// Set context
GetGLContext ( displayList . front ( ) ) - > SetCurrent ( * displayList . front ( ) ) ;
glEnable ( GL_TEXTURE_2D ) ;
if ( glGetError ( ) ! = 0 ) throw _T ( " Error enabling texture. " ) ;
2007-01-21 07:30:19 +01:00
// Image type
2009-07-20 05:50:25 +02:00
GLenum format ;
if ( frame . invertChannels ) format = GL_BGRA_EXT ;
else format = GL_RGBA ;
2007-04-03 04:55:43 +02:00
isInverted = frame . flipped ;
2007-01-21 07:30:19 +01:00
if ( lastTex = = 0 ) {
// Enable
glShadeModel ( GL_FLAT ) ;
// Generate texture with GL
2007-01-27 07:15:25 +01:00
//glActiveTexture(GL_TEXTURE0);
2007-01-21 07:30:19 +01:00
glGenTextures ( 1 , & lastTex ) ;
2007-01-22 21:01:07 +01:00
if ( glGetError ( ) ! = 0 ) throw _T ( " Error generating texture. " ) ;
2007-01-21 07:30:19 +01:00
glBindTexture ( GL_TEXTURE_2D , lastTex ) ;
2007-01-22 21:01:07 +01:00
if ( glGetError ( ) ! = 0 ) throw _T ( " Error binding texture. " ) ;
2007-01-21 07:30:19 +01:00
2007-01-22 23:57:45 +01:00
// Texture parameters
glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_NEAREST ) ;
2007-03-28 17:24:06 +02:00
if ( glGetError ( ) ! = 0 ) throw _T ( " Error setting min_filter texture parameter. " ) ;
2007-01-22 23:57:45 +01:00
glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_NEAREST ) ;
2007-03-28 17:24:06 +02:00
if ( glGetError ( ) ! = 0 ) throw _T ( " Error setting mag_filter texture parameter. " ) ;
2007-01-22 23:57:45 +01:00
glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_S , GL_CLAMP ) ;
2007-03-28 17:24:06 +02:00
if ( glGetError ( ) ! = 0 ) throw _T ( " Error setting wrap_s texture parameter. " ) ;
2007-01-22 23:57:45 +01:00
glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_WRAP_T , GL_CLAMP ) ;
2007-03-28 17:24:06 +02:00
if ( glGetError ( ) ! = 0 ) throw _T ( " Error setting wrap_t texture parameter. " ) ;
2007-01-22 23:57:45 +01:00
2007-04-13 05:52:25 +02:00
// Allocate texture
2007-04-03 04:55:43 +02:00
int height = frame . h ;
int tw = SmallestPowerOf2 ( MAX ( frame . pitch [ 0 ] / frame . GetBpp ( 0 ) , frame . pitch [ 1 ] + frame . pitch [ 2 ] ) ) ;
2007-01-27 07:15:25 +01:00
int th = SmallestPowerOf2 ( height ) ;
2007-03-28 17:24:06 +02:00
glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA8 , tw , th , 0 , format , GL_UNSIGNED_BYTE , NULL ) ;
if ( glGetError ( ) ! = 0 ) {
tw = MAX ( tw , th ) ;
th = tw ;
glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA8 , tw , th , 0 , format , GL_UNSIGNED_BYTE , NULL ) ;
if ( glGetError ( ) ! = 0 ) {
glTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGBA , tw , th , 0 , format , GL_UNSIGNED_BYTE , NULL ) ;
if ( glGetError ( ) ! = 0 ) throw _T ( " Error allocating texture. " ) ;
}
}
2007-04-03 04:55:43 +02:00
texW = float ( frame . w ) / float ( tw ) ;
texH = float ( frame . h ) / float ( th ) ;
2007-01-21 07:30:19 +01:00
// Set texture
2007-01-22 23:57:45 +01:00
//glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
2007-04-03 04:31:51 +02:00
//if (glGetError() != 0) throw _T("Error setting hinting.");
2007-01-22 23:57:45 +01:00
// Set priority
float priority = 1.0f ;
glPrioritizeTextures ( 1 , & lastTex , & priority ) ;
2007-01-21 07:30:19 +01:00
}
// Load texture data
2007-04-13 22:21:37 +02:00
glBindTexture ( GL_TEXTURE_2D , lastTex ) ;
2007-04-03 04:55:43 +02:00
glTexSubImage2D ( GL_TEXTURE_2D , 0 , 0 , 0 , frame . pitch [ 0 ] / frame . GetBpp ( 0 ) , frame . h , format , GL_UNSIGNED_BYTE , frame . data [ 0 ] ) ;
2007-01-22 21:01:07 +01:00
if ( glGetError ( ) ! = 0 ) throw _T ( " Error uploading primary plane " ) ;
2007-01-21 07:30:19 +01:00
// Return texture number
return lastTex ;
}
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
/// @brief Save snapshot
/// @param raw
///
2007-04-08 00:03:06 +02:00
void VideoContext : : SaveSnapshot ( bool raw ) {
2007-01-21 07:30:19 +01:00
// Get folder
2008-09-06 11:33:14 +02:00
wxString option = Options . AsText ( _T ( " Video Screenshot Path " ) ) ;
2007-01-21 07:30:19 +01:00
wxFileName videoFile ( videoName ) ;
wxString basepath ;
2008-01-10 23:28:47 +01:00
// Is it a path specifier and not an actual fixed path?
2007-06-21 02:46:50 +02:00
if ( option [ 0 ] = = _T ( ' ? ' ) ) {
2008-01-10 23:28:47 +01:00
// If dummy video is loaded, we can't save to the video location
2008-01-11 00:22:49 +01:00
if ( option . StartsWith ( _T ( " ?video " ) ) & & ( videoName . Find ( _T ( " ?dummy " ) ) ! = wxNOT_FOUND ) ) {
2008-01-10 23:28:47 +01:00
// So try the script location instead
option = _T ( " ?script " ) ;
}
// Find out where the ?specifier points to
2007-06-21 02:46:50 +02:00
basepath = StandardPaths : : DecodePath ( option ) ;
2008-01-10 23:28:47 +01:00
// If whereever that is isn't defined, we can't save there
if ( ( basepath = = _T ( " \\ " ) ) | | ( basepath = = _T ( " / " ) ) ) {
// So save to the current user's home dir instead
basepath = wxGetHomeDir ( ) ;
}
2007-01-21 07:30:19 +01:00
}
2008-01-10 23:28:47 +01:00
// Actual fixed (possibly relative) path, decode it
2007-06-21 02:46:50 +02:00
else basepath = DecodeRelativePath ( option , StandardPaths : : DecodePath ( _T ( " ?user/ " ) ) ) ;
2007-01-21 07:30:19 +01:00
basepath + = _T ( " / " ) + videoFile . GetName ( ) ;
// Get full path
int session_shot_count = 1 ;
wxString path ;
while ( 1 ) {
path = basepath + wxString : : Format ( _T ( " _%03i_%i.png " ) , session_shot_count , frame_n ) ;
+ + session_shot_count ;
wxFileName tryPath ( path ) ;
if ( ! tryPath . FileExists ( ) ) break ;
}
// Save
2007-04-08 00:03:06 +02:00
GetFrame ( frame_n , raw ) . GetImage ( ) . SaveFile ( path , wxBITMAP_TYPE_PNG ) ;
2007-01-21 07:30:19 +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
/// @brief Get dimensions of script
/// @param sw
/// @param sh
///
2007-01-21 07:30:19 +01:00
void VideoContext : : GetScriptSize ( int & sw , int & sh ) {
grid - > ass - > GetResolution ( sw , sh ) ;
}
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
/// @brief Play
/// @return
///
2007-01-21 07:30:19 +01:00
void VideoContext : : Play ( ) {
// Stop if already playing
if ( isPlaying ) {
Stop ( ) ;
return ;
}
// Set variables
startFrame = frame_n ;
endFrame = - 1 ;
// Start playing audio
audio - > Play ( VFR_Output . GetTimeAtFrame ( startFrame ) , - 1 ) ;
2007-03-18 02:20:25 +01:00
//audio->Play will override this if we put it before, so put it after.
isPlaying = true ;
2007-01-21 07:30:19 +01:00
// Start timer
2008-01-20 07:14:40 +01:00
playTime . Start ( ) ;
2007-01-21 07:30:19 +01:00
playback . SetOwner ( this , VIDEO_PLAY_TIMER ) ;
2008-01-20 07:14:40 +01:00
playback . Start ( 10 ) ;
2007-01-21 07:30:19 +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
/// @brief Play line
/// @return
///
2007-01-21 07:30:19 +01:00
void VideoContext : : PlayLine ( ) {
// Get line
AssDialogue * curline = grid - > GetDialogue ( grid - > editBox - > linen ) ;
if ( ! curline ) return ;
// Start playing audio
audio - > Play ( curline - > Start . GetMS ( ) , curline - > End . GetMS ( ) ) ;
// Set variables
isPlaying = true ;
startFrame = VFR_Output . GetFrameAtTime ( curline - > Start . GetMS ( ) , true ) ;
endFrame = VFR_Output . GetFrameAtTime ( curline - > End . GetMS ( ) , false ) ;
// Jump to start
playNextFrame = startFrame ;
JumpToFrame ( startFrame ) ;
// Set other variables
2008-01-20 20:51:48 +01:00
playTime . Start ( ) ;
2007-01-21 07:30:19 +01:00
// Start timer
playback . SetOwner ( this , VIDEO_PLAY_TIMER ) ;
2008-01-20 07:14:40 +01:00
playback . Start ( 10 ) ;
2007-01-21 07:30:19 +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
/// @brief Stop
///
2007-01-21 07:30:19 +01:00
void VideoContext : : Stop ( ) {
if ( isPlaying ) {
playback . Stop ( ) ;
isPlaying = false ;
audio - > Stop ( ) ;
}
}
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
/// @brief Play timer
/// @param event
/// @return
///
2007-01-21 07:30:19 +01:00
void VideoContext : : OnPlayTimer ( wxTimerEvent & event ) {
// Lock
wxMutexError res = playMutex . TryLock ( ) ;
if ( res = = wxMUTEX_BUSY ) return ;
playMutex . Unlock ( ) ;
wxMutexLocker lock ( playMutex ) ;
// Get time difference
2008-01-20 07:14:40 +01:00
int dif = playTime . Time ( ) ;
2007-01-21 07:30:19 +01:00
// Find next frame
int startMs = VFR_Output . GetTimeAtFrame ( startFrame ) ;
int nextFrame = frame_n ;
int i = 0 ;
for ( i = 0 ; i < 10 ; i + + ) {
if ( nextFrame > = length ) break ;
if ( dif < VFR_Output . GetTimeAtFrame ( nextFrame ) - startMs ) {
break ;
}
nextFrame + + ;
}
// End
if ( nextFrame > = length | | ( endFrame ! = - 1 & & nextFrame > endFrame ) ) {
Stop ( ) ;
return ;
}
// Same frame
if ( nextFrame = = frame_n ) return ;
// Next frame is before or over 2 frames ahead, so force audio resync
2009-04-28 12:23:20 +02:00
if ( audio - > player & & keepAudioSync & & ( nextFrame < frame_n | | nextFrame > frame_n + 2 ) ) audio - > player - > SetCurrentPosition ( audio - > GetSampleAtMS ( VFR_Output . GetTimeAtFrame ( nextFrame ) ) ) ;
2007-01-21 07:30:19 +01:00
// Jump to next frame
playNextFrame = nextFrame ;
frame_n = nextFrame ;
JumpToFrame ( nextFrame ) ;
// Sync audio
2007-07-30 06:05:45 +02:00
if ( keepAudioSync & & nextFrame % 10 = = 0 & & audio & & audio - > provider & & audio - > player ) {
2007-08-31 16:11:35 +02:00
int64_t audPos = audio - > GetSampleAtMS ( VFR_Output . GetTimeAtFrame ( nextFrame ) ) ;
int64_t curPos = audio - > player - > GetCurrentPosition ( ) ;
2007-01-21 07:30:19 +01:00
int delta = int ( audPos - curPos ) ;
if ( delta < 0 ) delta = - delta ;
int maxDelta = audio - > provider - > GetSampleRate ( ) ;
if ( delta > maxDelta ) audio - > player - > SetCurrentPosition ( audPos ) ;
}
}
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
/// @brief Get name of temp work file
/// @return
///
2007-01-21 07:30:19 +01:00
wxString VideoContext : : GetTempWorkFile ( ) {
if ( tempfile . IsEmpty ( ) ) {
tempfile = wxFileName : : CreateTempFileName ( _T ( " aegisub " ) ) ;
wxRemoveFile ( tempfile ) ;
tempfile + = _T ( " .ass " ) ;
}
return tempfile ;
}
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
/// @brief Get keyframes
/// @return
///
2007-01-21 07:30:19 +01:00
wxArrayInt VideoContext : : GetKeyFrames ( ) {
if ( OverKeyFramesLoaded ( ) ) return overKeyFrames ;
return 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
/// @brief Set keyframes
/// @param frames
///
2007-01-21 07:30:19 +01:00
void VideoContext : : SetKeyFrames ( wxArrayInt frames ) {
KeyFrames = frames ;
}
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
/// @brief Set keyframe override
/// @param frames
///
2007-01-21 07:30:19 +01:00
void VideoContext : : SetOverKeyFrames ( wxArrayInt frames ) {
overKeyFrames = frames ;
overKeyFramesLoaded = true ;
}
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
/// @brief Close keyframes
///
2007-01-21 07:30:19 +01:00
void VideoContext : : CloseOverKeyFrames ( ) {
overKeyFrames . Clear ( ) ;
overKeyFramesLoaded = false ;
}
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
/// @brief Check if override keyframes are loaded
/// @return
///
2007-01-21 07:30:19 +01:00
bool VideoContext : : OverKeyFramesLoaded ( ) {
return overKeyFramesLoaded ;
}
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
/// @brief Check if keyframes are loaded
/// @return
///
2007-01-21 07:30:19 +01:00
bool VideoContext : : KeyFramesLoaded ( ) {
return overKeyFramesLoaded | | keyFramesLoaded ;
}
2007-01-23 07:32:16 +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
/// @brief Calculate aspect ratio
/// @param type
/// @return
///
2007-01-23 07:32:16 +01:00
double VideoContext : : GetARFromType ( int type ) {
if ( type = = 0 ) return ( double ) VideoContext : : Get ( ) - > GetWidth ( ) / ( double ) VideoContext : : Get ( ) - > GetHeight ( ) ;
if ( type = = 1 ) return 4.0 / 3.0 ;
if ( type = = 2 ) return 16.0 / 9.0 ;
if ( type = = 3 ) return 2.35 ;
return 1.0 ; //error
}
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
/// @brief Sets aspect ratio
/// @param _type
/// @param value
///
2007-01-23 07:32:16 +01:00
void VideoContext : : SetAspectRatio ( int _type , double value ) {
// Get value
if ( _type ! = 4 ) value = GetARFromType ( _type ) ;
if ( value < 0.5 ) value = 0.5 ;
if ( value > 5.0 ) value = 5.0 ;
// Set
arType = _type ;
arValue = value ;
UpdateDisplays ( true ) ;
}
2007-01-27 07:15:25 +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
/// @brief Thread constructor
/// @param par
///
2007-04-08 01:45:46 +02:00
VideoContextThread : : VideoContextThread ( VideoContext * par )
: wxThread ( wxTHREAD_DETACHED )
{
parent = par ;
}
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
/// @brief Thread entry point
///
2007-04-08 01:45:46 +02:00
wxThread : : ExitCode VideoContextThread : : Entry ( ) {
// Set up thread
int frame = parent - > threadNextFrame ;
int curFrame = parent - > frame_n ;
bool highSubs = Options . AsBool ( _T ( " Highlight subs in frame " ) ) ;
// Loop while there is work to do
while ( true ) {
// Get frame and set frame number
2007-04-13 02:44:46 +02:00
{
wxMutexLocker glLock ( OpenGLWrapper : : glMutex ) ;
parent - > GetFrameAsTexture ( frame ) ;
parent - > frame_n = frame ;
}
2007-04-08 01:45:46 +02:00
// Display
parent - > UpdateDisplays ( false ) ;
// Update grid
if ( ! parent - > isPlaying & & highSubs ) parent - > grid - > Refresh ( false ) ;
// Get lock and check if there is more to do
wxMutexLocker lock ( parent - > vidMutex ) ;
curFrame = parent - > frame_n ;
frame = parent - > threadNextFrame ;
// Work done, kill thread and release context
if ( curFrame = = frame ) {
parent - > threadLocked = false ;
parent - > threadNextFrame = - 1 ;
Delete ( ) ;
return 0 ;
}
}
}
2009-07-29 07:43:02 +02: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