Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

page_magick.h

Go to the documentation of this file.
00001 /*
00002 * page_magick.h -- FX Page
00003 * Copyright (C) 2002 Charles Yates <charles.yates@pandora.be>
00004 * Copyright (C) 2002-2007 Dan Dennedy <dan@dennedy.org>
00005 *
00006 * This program is free software; you can redistribute it and/or modify
00007 * it under the terms of the GNU General Public License as published by
00008 * the Free Software Foundation; either version 2 of the License, or
00009 * (at your option) any later version.
00010 *
00011 * This program is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 * GNU General Public License for more details.
00015 *
00016 * You should have received a copy of the GNU General Public License
00017 * along with this program; if not, write to the Free Software Foundation,
00018 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef _PAGE_MAGICK_H
00022 #define _PAGE_MAGICK_H
00023 
00024 #include "image_create.h"
00025 #include "image_filters.h"
00026 #include "image_transitions.h"
00027 #include "audio_filters.h"
00028 #include "audio_transitions.h"
00029 #include "kino_common.h"
00030 #include "page.h"
00031 #include "oss.h"
00032 #include "kino_extra.h"
00033 
00037 class Plugin
00038 {
00039 private:
00040     void *ptr;
00041 
00042 public:
00043     bool Open( char *file );
00044     void Close( );
00045     void *Find( char *symbol );
00046     const char *GetError( );
00047 };
00048 
00052 class PluginCollection
00053 {
00054 private:
00055     vector < Plugin * > collection;
00056 
00057 public:
00058     PluginCollection( );
00059     ~PluginCollection( );
00060     void Initialise( char *directory );
00061     void RegisterPlugin( char *filename );
00062     unsigned int Count();
00063     Plugin *Get( unsigned int index );
00064 };
00065 
00069 class PluginImageCreateRepository : public GDKImageCreateRepository
00070 {
00071 public:
00072     void InstallPlugins( Plugin * );
00073 };
00074 
00078 class PluginImageFilterRepository : public GDKImageFilterRepository
00079 {
00080 public:
00081     void InstallPlugins( Plugin * );
00082 };
00083 
00087 class PluginImageTransitionRepository : public GDKImageTransitionRepository
00088 {
00089 public:
00090     void InstallPlugins( Plugin * );
00091 };
00092 
00096 class PluginAudioFilterRepository : public GDKAudioFilterRepository
00097 {
00098 public:
00099     void InstallPlugins( Plugin * );
00100 };
00101 
00105 class PluginAudioTransitionRepository : public GDKAudioTransitionRepository
00106 {
00107 public:
00108     void InstallPlugins( Plugin * );
00109 };
00110 
00114 class PageMagick : public Page, public KeyFrameController
00115 {
00116 public:
00117     PageMagick( KinoCommon *common );
00118     virtual ~PageMagick();
00119 
00120     // Page interface implementation
00121     void newFile();
00122     void start();
00123     gulong activate();
00124     void clean();
00125     void selectScene( int );
00126     void videoStartOfMovie();
00127     void videoBack(int step = -1);
00128     void videoPlay();
00129     void videoForward(int step = 1);
00130     void videoEndOfMovie();
00131     void videoPause();
00132     void videoStop();
00133     void videoPreviousScene();
00134     void videoNextScene();
00135     void videoStartOfScene()
00136         { videoPreviousScene(); }
00137     void videoEndOfScene()
00138         { videoNextScene(); }
00139     void showFrameInfo( int frame_number );
00140     void showFrameInfo( int frame_number, int duration );
00141     void movedToFrame( int frame_number );
00142     void windowMoved();
00143     void timeFormatChanged();
00144     gboolean processKeyboard( GdkEventKey *event );
00145     gboolean processCommand( char *cmd );
00146     std::string getHelpPage()
00147     {
00148         return "FX";
00149     }
00150 
00151     // PageMagick methods
00152     void PreviewFrame();
00153     void StartPreview();
00154     void AudioThread();
00155     void VideoThread();
00156     void StartRender();
00157     void Stop();
00158     void StopPreview();
00159     void UpdateProgress( gfloat );
00160     void UpdateStatus( int currentFrame, int begin, int end, int every );
00161     void RefreshStatus( bool with_fx_notify = false );
00162 
00163     // PageMagick accessors
00164     GDKImageCreate *GetImageCreate() const;
00165     GDKImageFilter *GetImageFilter() const;
00166     GDKImageTransition *GetImageTransition() const;
00167     GDKAudioFilter *GetAudioFilter() const;
00168     GDKAudioTransition *GetAudioTransition() const;
00169     GtkWidget* GetWindow() const
00170     {
00171         return window;
00172     }
00173     bool IsRepainting() const
00174     {
00175         return repainting;
00176     }
00177     bool IsPreviewing() const
00178     {
00179         return previewing;
00180     }
00181     void SetKeyFrameControllerClient( KeyFrameControllerClient* client )
00182     {
00183         keyFrameControllerClient = client;
00184     }
00185 
00186     // KeyFrameController methods
00187     void ShowCurrentStatus( double position, frame_type type, bool hasPrev, bool hasNext );
00188     double GetCurrentPosition( );
00189 
00190     // KeyFrameController callbacks
00191     void OnKeyFrameControllerKeyChanged( GtkToggleButton* togglebutton );
00192 
00193     // Used by signal handlers
00194     void OnTimeRangeChanged();
00195     GtkWidget *window;
00196 
00197 private:
00198     // Imported
00199     KinoCommon *common;
00200 
00201     int last_page;
00202     bool rendering;
00203     bool paused;
00204     bool previewing;
00205     bool repainting;
00206     GtkProgressBar *progressBar;
00207     char status[ 10240 ];
00208     int previewPosition;
00209     GtkWidget *scrubBar;
00210     GtkAdjustment *scrubAdjustment;
00211 
00212     // Filters and Transitions
00213     PluginImageCreateRepository image_creators;
00214     PluginImageFilterRepository image_filters;
00215     PluginImageTransitionRepository image_transitions;
00216     PluginAudioFilterRepository audio_filters;
00217     PluginAudioTransitionRepository audio_transitions;
00218 
00219     // audio structures
00220     kino_sound_t *audio_device;
00221     dv_audio_t dv_audio;
00222     bool audio_device_avail;
00223     gint audio_sampling_rate;
00224     void PlayAudio( int16_t *buffers[], int, int, int, bool );
00225 
00226     // Video structures
00227     void ShowImage( GtkWidget *area, uint8_t *pixels, int, int, bool );
00228 
00229     PluginCollection plugins;
00230     string last_fx_file;
00231     double startTime;
00232     double pauseTime;
00233     double nextUpdateTime;
00234     KeyFrameControllerClient* keyFrameControllerClient;
00235     bool isGuiLocked;
00236     bool isPreviousScene;
00237     bool isNextScene;
00238     double newPosition;
00239 };
00240 
00241 #endif

Generated on Sun Mar 11 22:11:46 2007 for Kino by  doxygen 1.4.2