00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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
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
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
00187 void ShowCurrentStatus( double position, frame_type type, bool hasPrev, bool hasNext );
00188 double GetCurrentPosition( );
00189
00190
00191 void OnKeyFrameControllerKeyChanged( GtkToggleButton* togglebutton );
00192
00193
00194 void OnTimeRangeChanged();
00195 GtkWidget *window;
00196
00197 private:
00198
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
00213 PluginImageCreateRepository image_creators;
00214 PluginImageFilterRepository image_filters;
00215 PluginImageTransitionRepository image_transitions;
00216 PluginAudioFilterRepository audio_filters;
00217 PluginAudioTransitionRepository audio_transitions;
00218
00219
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
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