#include <page_magick.h>
Inheritance diagram for PageMagick:


Public Member Functions | |
| PageMagick (KinoCommon *common) | |
| Constructor for Page Magick. | |
| virtual | ~PageMagick () |
| Destructor for Page Magick. | |
| void | newFile () |
| void | start () |
| Start when entering page. | |
| gulong | activate () |
| Activate scene list selection (for Frame sources). | |
| void | clean () |
| Clean up when leaving page. | |
| void | selectScene (int) |
| put the scene begin and end frame numbers into spinners | |
| void | videoStartOfMovie () |
| void | videoBack (int step=-1) |
| void | videoPlay () |
| void | videoForward (int step=1) |
| void | videoEndOfMovie () |
| void | videoPause () |
| void | videoStop () |
| void | videoPreviousScene () |
| void | videoNextScene () |
| void | videoStartOfScene () |
| void | videoEndOfScene () |
| void | showFrameInfo (int frame_number) |
| Update UI with metadata. | |
| void | showFrameInfo (int frame_number, int duration) |
| void | movedToFrame (int frame_number) |
| void | windowMoved () |
| void | timeFormatChanged () |
| gboolean | processKeyboard (GdkEventKey *event) |
| gboolean | processCommand (char *cmd) |
| std::string | getHelpPage () |
| void | PreviewFrame () |
| void | StartPreview () |
| void | AudioThread () |
| void | VideoThread () |
| void | StartRender () |
| Render the effect. | |
| void | Stop () |
| Stop whatever is running (either preview or rendering). | |
| void | StopPreview () |
| Stop the preview. | |
| void | UpdateProgress (gfloat) |
| Update the progress bar for the export process. | |
| void | UpdateStatus (int currentFrame, int begin, int end, int every) |
| void | RefreshStatus (bool with_fx_notify=false) |
| Refresh the status label to show the current selections. | |
| GDKImageCreate * | GetImageCreate () const |
| Return the currently selected image creator. | |
| GDKImageFilter * | GetImageFilter () const |
| Return the currently selected image filter. | |
| GDKImageTransition * | GetImageTransition () const |
| Return the currently selected image transition. | |
| GDKAudioFilter * | GetAudioFilter () const |
| Return the currently selected audio filter. | |
| GDKAudioTransition * | GetAudioTransition () const |
| Return the currently selected audio transition. | |
| GtkWidget * | GetWindow () const |
| bool | IsRepainting () const |
| bool | IsPreviewing () const |
| void | SetKeyFrameControllerClient (KeyFrameControllerClient *client) |
| void | ShowCurrentStatus (double position, frame_type type, bool hasPrev, bool hasNext) |
| double | GetCurrentPosition () |
| void | OnKeyFrameControllerKeyChanged (GtkToggleButton *togglebutton) |
| void | OnTimeRangeChanged () |
Public Attributes | |
| GtkWidget * | window |
Private Member Functions | |
| void | PlayAudio (int16_t *buffers[], int, int, int, bool) |
| Play an audio frame. | |
| void | ShowImage (GtkWidget *area, uint8_t *pixels, int, int, bool) |
| Show an image in the preview drawing area. | |
Private Attributes | |
| KinoCommon * | common |
| int | last_page |
| bool | rendering |
| bool | paused |
| bool | previewing |
| bool | repainting |
| GtkProgressBar * | progressBar |
| char | status [10240] |
| int | previewPosition |
| GtkWidget * | scrubBar |
| GtkAdjustment * | scrubAdjustment |
| PluginImageCreateRepository | image_creators |
| PluginImageFilterRepository | image_filters |
| PluginImageTransitionRepository | image_transitions |
| PluginAudioFilterRepository | audio_filters |
| PluginAudioTransitionRepository | audio_transitions |
| kino_sound_t * | audio_device |
| dv_audio_t | dv_audio |
| bool | audio_device_avail |
| gint | audio_sampling_rate |
| PluginCollection | plugins |
| string | last_fx_file |
| double | startTime |
| double | pauseTime |
| double | nextUpdateTime |
| KeyFrameControllerClient * | keyFrameControllerClient |
| bool | isGuiLocked |
| bool | isPreviousScene |
| bool | isNextScene |
| double | newPosition |
Definition at line 114 of file page_magick.h.
|
|
Constructor for Page Magick.
Definition at line 1482 of file page_magick.cc. References audio_filters, audio_transitions, PluginCollection::Count(), PluginCollection::Get(), Preferences::getInstance(), KinoCommon::getWidget(), gtk_enhanced_scale_new(), image_creators, image_filters, image_transitions, GDKAudioTransitionRepository::Initialise(), GDKAudioFilterRepository::Initialise(), GDKImageTransitionRepository::Initialise(), GDKImageCreateRepository::Initialise(), GDKImageFilterRepository::Initialise(), PluginCollection::Initialise(), PluginAudioTransitionRepository::InstallPlugins(), PluginAudioFilterRepository::InstallPlugins(), PluginImageTransitionRepository::InstallPlugins(), PluginImageFilterRepository::InstallPlugins(), PluginImageCreateRepository::InstallPlugins(), lookup_widget(), magick_glade, NORM_NTSC, on_drawingarea_refresh_required(), on_notebook_magick_switch_page(), on_notebook_magick_switch_video_page(), on_scrubbar_magick_button_press_event(), on_scrubbar_magick_button_release_event(), on_scrubbar_magick_value_changed_event(), on_spinbutton_magick_limit_value_changed(), on_time_range_changed(), on_togglebutton_key_frame_toggled(), plugins, progressBar, Repaint(), scrubAdjustment, scrubBar, and window. 01482 : 01483 last_page( 0 ), 01484 rendering( false ), 01485 previewing( false ), 01486 previewPosition( 0 ), 01487 keyFrameControllerClient( 0 ), 01488 isGuiLocked( false ), 01489 isPreviousScene( false ), 01490 isNextScene( false ) 01491 { 01492 cerr << "> Creating Magick Page" << endl; 01493 01494 window = glade_xml_get_widget( magick_glade, "window_magick" ); 01495 GtkWidget *bin = lookup_widget( common->getWidget(), "frame_magick" ); 01496 gtk_widget_reparent( gtk_bin_get_child( GTK_BIN( window ) ), bin ); 01497 01498 this->common = common; 01499 01500 progressBar = GTK_PROGRESS_BAR( lookup_widget( common->getWidget(), "progressbar" ) ); 01501 cerr << ">> Searching " << KINO_PLUGINDIR << " for plugins" << endl; 01502 plugins.Initialise( KINO_PLUGINDIR ); 01503 01504 for ( unsigned int index = 0; index < plugins.Count(); index ++ ) 01505 { 01506 image_creators.InstallPlugins( plugins.Get( index ) ); 01507 image_filters.InstallPlugins( plugins.Get( index ) ); 01508 image_transitions.InstallPlugins( plugins.Get( index ) ); 01509 audio_filters.InstallPlugins( plugins.Get( index ) ); 01510 audio_transitions.InstallPlugins( plugins.Get( index ) ); 01511 } 01512 01513 GtkOptionMenu *menu = GTK_OPTION_MENU( lookup_widget( window, "optionmenu_magick_filter" ) ); 01514 GtkBin *container = GTK_BIN( lookup_widget( window, "frame_magick_image_filter" ) ); 01515 image_filters.Initialise( menu, container ); 01516 01517 menu = GTK_OPTION_MENU( lookup_widget( window, "optionmenu_magick_frames_create" ) ); 01518 container = GTK_BIN( lookup_widget( window, "frame_magick_frames_create" ) ); 01519 image_creators.Initialise( menu, container ); 01520 01521 menu = GTK_OPTION_MENU( lookup_widget( window, "optionmenu_magick_transition" ) ); 01522 container = GTK_BIN( lookup_widget( window, "frame_magick_image_transition" ) ); 01523 image_transitions.Initialise( menu, container ); 01524 01525 menu = GTK_OPTION_MENU( lookup_widget( window, "optionmenu_magick_audio_filter" ) ); 01526 container = GTK_BIN( lookup_widget( window, "frame_magick_audio_filter" ) ); 01527 audio_filters.Initialise( menu, container ); 01528 01529 menu = GTK_OPTION_MENU( lookup_widget( window, "optionmenu_magick_audio_transition" ) ); 01530 container = GTK_BIN( lookup_widget( window, "frame_magick_audio_transition" ) ); 01531 audio_transitions.Initialise( menu, container ); 01532 01533 GtkWidget *drawing_area = lookup_widget( window, "drawingarea_magick_preview" ); 01534 g_signal_connect( G_OBJECT( drawing_area ), "expose_event", G_CALLBACK( on_drawingarea_refresh_required ), this ); 01535 gtk_widget_set_double_buffered( drawing_area, FALSE ); 01536 01537 GtkWidget *widget = lookup_widget( window, "notebook_magick_frames" ); 01538 g_signal_connect_after( G_OBJECT( widget ), "switch_page", G_CALLBACK( on_notebook_magick_switch_page ), this ); 01539 widget = lookup_widget( window, "notebook_magick_video" ); 01540 g_signal_connect_after( G_OBJECT( widget ), "switch_page", G_CALLBACK( on_notebook_magick_switch_video_page ), NULL ); 01541 widget = lookup_widget( window, "notebook_magick_audio" ); 01542 g_signal_connect_after( G_OBJECT( widget ), "switch_page", G_CALLBACK( on_notebook_magick_switch_page ), NULL ); 01543 01544 widget = lookup_widget( window, "checkbutton_magick_frame_limit" ); 01545 g_signal_connect( G_OBJECT( widget ), "clicked", G_CALLBACK( on_time_range_changed ), NULL ); 01546 widget = lookup_widget( window, "spinbutton_magick_limit" ); 01547 gtk_spin_button_set_value( GTK_SPIN_BUTTON( widget ), Preferences::getInstance().defaultNormalisation == NORM_NTSC ? 30 : 25 ); 01548 g_signal_connect( G_OBJECT( widget ), "value-changed", G_CALLBACK( on_spinbutton_magick_limit_value_changed ), NULL ); 01549 widget = lookup_widget( window, "optionmenu_magick_frame_offset" ); 01550 g_signal_connect( G_OBJECT( widget ), "changed", G_CALLBACK( on_time_range_changed ), NULL ); 01551 01552 // Attach the scrub bar 01553 scrubAdjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 0, 1, 10, 0 ) ); 01554 scrubBar = gtk_enhanced_scale_new( ( GtkObject** ) & scrubAdjustment, 1 ); 01555 gtk_widget_set_name( scrubBar, "scrubmar_magick" ); 01556 gtk_widget_ref( scrubBar ); 01557 gtk_object_set_data_full( GTK_OBJECT( window ), "scrubbar_magick", scrubBar, 01558 ( GtkDestroyNotify ) gtk_widget_unref ); 01559 GtkWidget *vbox_scrub = lookup_widget( window, "vbox_scrub" ); 01560 gtk_widget_show( scrubBar ); 01561 gtk_box_pack_start( GTK_BOX( vbox_scrub ), scrubBar, FALSE, TRUE, 0 ); 01562 g_signal_connect( G_OBJECT( scrubAdjustment ), "value_changed", 01563 G_CALLBACK( on_scrubbar_magick_value_changed_event ), NULL ); 01564 g_signal_connect( G_OBJECT( scrubBar ), "button_press_event", 01565 G_CALLBACK( on_scrubbar_magick_button_press_event ), NULL ); 01566 g_signal_connect( G_OBJECT( scrubBar ), "button_release_event", 01567 G_CALLBACK( on_scrubbar_magick_button_release_event ), NULL ); 01568 widget = lookup_widget( window, "togglebutton_key_frame" ); 01569 g_signal_connect( G_OBJECT( widget ), "toggled", G_CALLBACK( on_togglebutton_key_frame_toggled ), this ); 01570 widget = lookup_widget( window, "optionmenu_direction" ); 01571 g_signal_connect( G_OBJECT( widget ), "changed", G_CALLBACK( Repaint ), this ); 01572 widget = lookup_widget( window, "radiobutton_magick_transition_frame" ); 01573 g_signal_connect( G_OBJECT( widget ), "toggled", G_CALLBACK( Repaint ), this ); 01574 widget = lookup_widget( window, "optionmenu_magick_transition_frame" ); 01575 g_signal_connect( G_OBJECT( widget ), "changed", G_CALLBACK( Repaint ), this ); 01576 widget = lookup_widget( window, "radiobutton_magick_transition_colour" ); 01577 g_signal_connect( G_OBJECT( widget ), "toggled", G_CALLBACK( Repaint ), this ); 01578 widget = lookup_widget( window, "colorpicker_magick_transition" ); 01579 g_signal_connect( G_OBJECT( widget ), "color-set", G_CALLBACK( Repaint ), this ); 01580 widget = lookup_widget( window, "hscale_transition_start" ); 01581 g_signal_connect( G_OBJECT( widget ), "value-changed", G_CALLBACK( Repaint ), this ); 01582 widget = lookup_widget( window, "hscale_transition_end" ); 01583 g_signal_connect( G_OBJECT( widget ), "value-changed", G_CALLBACK( Repaint ), this ); 01584 }
|
|
|
Destructor for Page Magick.
Definition at line 1589 of file page_magick.cc. References common, KinoCommon::getWidget(), lookup_widget(), and window. 01590 {
01591 GtkBin * bin = GTK_BIN( lookup_widget( common->getWidget(), "frame_magick" ) );
01592 gtk_widget_reparent( ( GTK_BIN( bin ) ) ->child, GTK_WIDGET( window ) );
01593 gtk_widget_destroy( window );
01594 }
|
|
|
Activate scene list selection (for Frame sources).
Reimplemented from Page. Definition at line 1650 of file page_magick.cc. References isNextScene, isPreviousScene, rendering, SCENE_LIST, VIDEO_BACK, VIDEO_END_OF_MOVIE, VIDEO_FORWARD, VIDEO_NEXT_SCENE, VIDEO_PAUSE, VIDEO_PLAY, VIDEO_START_OF_MOVIE, VIDEO_START_OF_SCENE, and VIDEO_STOP. 01651 {
01652 if ( rendering )
01653 return VIDEO_PLAY | VIDEO_STOP;
01654 else
01655 return SCENE_LIST |
01656 VIDEO_START_OF_MOVIE |
01657 VIDEO_BACK |
01658 VIDEO_PLAY |
01659 VIDEO_PAUSE |
01660 VIDEO_STOP |
01661 VIDEO_FORWARD |
01662 VIDEO_END_OF_MOVIE |
01663 ( isPreviousScene ? VIDEO_START_OF_SCENE : 0 ) |
01664 ( isNextScene ? VIDEO_NEXT_SCENE : 0 );
01665 }
|
|
|
Definition at line 1890 of file page_magick.cc. References audio_device, audio_device_avail, audio_sampling_rate, PageMagickInfo::begin, PageMagickInfo::channels, common, DV_AUDIO_MAX_SAMPLES, PageMagickInfo::end, Frame::ExtractAudio(), FRAME_MAX_HEIGHT, FRAME_MAX_WIDTH, PageMagickInfo::frequency, PageMagickInfo::GetAudioManipulator(), PageMagickImage::GetFrame(), PageMagickAudio::GetFrame(), PageMagickFrames::GetFrame(), GetFramePool(), PageMagickInfo::GetFrameSource(), PageMagickInfo::GetImageManipulator(), Preferences::getInstance(), KinoCommon::getPlayList(), PageMagickInfo::height, PageMagickInfo::increment, info, PageMagickInfo::Initialise(), PageMagickInfo::isPAL, PageMagickInfo::isWide, kino_sound_close(), kino_sound_new(), lookup_widget(), modal_message(), pixels, PlayAudio(), PageMagickInfo::postFrame, PageMagickImage::PreGetFrame(), previewing, previewPosition, rendering, PageMagickInfo::reverse, PageMagickInfo::samples_this_frame, PageMagickInfo::SetLowQuality(), showFrameInfo(), ShowImage(), TriggerAction(), PageMagickInfo::width, and window. Referenced by audioThreadProxy(). 01891 {
01892 // Avoid reentrancy, interrupt rendering, and empty project
01893 if ( rendering )
01894 return;
01895
01896 GtkWidget *area = GTK_WIDGET( lookup_widget( window, "drawingarea_magick_preview" ) );
01897
01898 // Create the temporary space
01899 uint8_t *pixels = new uint8_t[ FRAME_MAX_WIDTH * FRAME_MAX_HEIGHT * 4 ];
01900 int16_t *audio_buffers[ 4 ];
01901 for ( int n = 0; n < 4; n++ )
01902 audio_buffers[ n ] = new int16_t [ 2 * DV_AUDIO_MAX_SAMPLES ];
01903
01904 // Generate the info
01905 PageMagickInfo *info = new PageMagickInfo( common );
01906
01907 audio_device = kino_sound_new();
01908 audio_device_avail = false;
01909 audio_sampling_rate = 0;
01910 int audio_number = 0;
01911 Frame* infoFrame = GetFramePool()->GetFrame();
01912
01913 GtkToggleButton *audioButton = GTK_TOGGLE_BUTTON( lookup_widget( window, "checkbutton_magick_preview_audio" ) );
01914 GtkToggleButton *everyButton = GTK_TOGGLE_BUTTON( lookup_widget( window, "checkbutton_magick_preview_every" ) );
01915 GtkToggleButton *loopButton = GTK_TOGGLE_BUTTON( lookup_widget( window, "checkbutton_magick_preview_loop" ) );
01916 GtkToggleButton *contextButton = GTK_TOGGLE_BUTTON( lookup_widget( window, "checkbutton_magick_preview_context" ) );
01917 GtkToggleButton *qualityButton = GTK_TOGGLE_BUTTON( lookup_widget( window, "checkbutton_low_quality" ) );
01918 GtkEntry *contextSpin = GTK_ENTRY( lookup_widget( window, "spinbutton_magick_preview_context" ) );
01919
01920 try
01921 {
01922 pthread_mutex_lock( &init_mutex );
01923 info->Initialise();
01924 info->SetLowQuality( gtk_toggle_button_get_active( qualityButton ) );
01925 do
01926 {
01927 PageMagickFrames *frames = info->GetFrameSource();
01928 PageMagickImage *image = info->GetImageManipulator();
01929 PageMagickAudio *sound = info->GetAudioManipulator();
01930 pthread_mutex_unlock( &init_mutex );
01931
01932 if ( info->begin > info->end )
01933 throw _( "Invalid frame range specified." );
01934
01935 if ( previewPosition <= 1 )
01936 for ( frameNumber = info->begin - atoi( gtk_entry_get_text( contextSpin ) );
01937 frameNumber < info->begin &&
01938 gtk_toggle_button_get_active( contextButton ) &&
01939 previewing;
01940 frameNumber++ )
01941 {
01942 if ( frameNumber >= 0 )
01943 {
01944 TriggerAction();
01945 common->getPlayList()->GetFrame( frameNumber, *( infoFrame ) );
01946 if ( !gtk_toggle_button_get_active( audioButton ) &&
01947 Preferences::getInstance().enableAudio )
01948 {
01949 if ( infoFrame->ExtractAudio( audio_buffers ) )
01950 PlayAudio( audio_buffers, info->samples_this_frame, info->frequency, info->channels, info->isPAL );
01951 }
01952 if ( !gtk_toggle_button_get_active( everyButton ) || gtk_toggle_button_get_active( audioButton ) )
01953 {
01954 infoFrame->ExtractPreviewRGB( pixels );
01955 gdk_threads_enter();
01956 ShowImage( area, pixels, infoFrame->GetWidth(), infoFrame->GetHeight(), infoFrame->IsWide() );
01957 gdk_flush();
01958 gdk_threads_leave();
01959 }
01960 }
01961 }
01962
01963 int frame_number = info->begin + previewPosition;
01964 for ( double i = ( double ) info->begin + previewPosition;
01965 frame_number <= info->end && previewing;
01966 frame_number = ( int )( ( i += info->increment ) + 0.5 ) )
01967 {
01968 previewPosition = frame_number - info->begin;
01969 gdk_threads_enter();
01970 showFrameInfo( frame_number, info->end - info->begin + 1 );
01971 gdk_threads_leave();
01972 if ( info->reverse )
01973 frame_number = info->end - ( ( int ) i - info->begin );
01974
01975 frameNumber = frame_number;
01976 TriggerAction();
01977 if ( !gtk_toggle_button_get_active( audioButton ) &&
01978 Preferences::getInstance().enableAudio )
01979 {
01980 int samples = info->samples_this_frame;
01981 int locked_samples = infoFrame->CalculateNumberSamples( info->frequency, audio_number ++ );
01982 if ( samples == 0 )
01983 samples = locked_samples;
01984 frames->GetFrame( NULL, 0, 0, audio_buffers, frame_number );
01985 if ( gtk_toggle_button_get_active( everyButton ) )
01986 image->PreGetFrame( );
01987 sound->GetFrame( audio_buffers, frame_number, samples, locked_samples );
01988 PlayAudio( audio_buffers, samples, info->frequency, info->channels, info->isPAL );
01989 }
01990 if ( !gtk_toggle_button_get_active( everyButton ) || gtk_toggle_button_get_active( audioButton ) )
01991 {
01992 frames->GetFrame( pixels, info->width, info->height, NULL, frame_number );
01993 image->PreGetFrame( );
01994 image->GetFrame( pixels, frame_number );
01995 gdk_threads_enter();
01996 ShowImage( area, pixels, info->width, info->height, info->isWide );
01997 gdk_flush();
01998 gdk_threads_leave();
01999 }
02000 }
02001
02002 for ( frameNumber = info->postFrame;
02003 frameNumber < info->postFrame + atoi( gtk_entry_get_text( contextSpin ) ) &&
02004 gtk_toggle_button_get_active( contextButton ) &&
02005 previewing;
02006 frameNumber++ )
02007 {
02008 if ( frameNumber < common->getPlayList()->GetNumFrames() )
02009 {
02010 TriggerAction();
02011 common->getPlayList()->GetFrame( frameNumber, *( infoFrame ) );
02012 if ( !gtk_toggle_button_get_active( audioButton ) &&
02013 Preferences::getInstance().enableAudio )
02014 {
02015 if ( infoFrame->ExtractAudio( audio_buffers ) )
02016 PlayAudio( audio_buffers, info->samples_this_frame, info->frequency, info->channels, info->isPAL );
02017 }
02018 if ( !gtk_toggle_button_get_active( everyButton ) || gtk_toggle_button_get_active( audioButton ) )
02019 {
02020 infoFrame->ExtractPreviewRGB( pixels );
02021 gdk_threads_enter();
02022 ShowImage( area, pixels, infoFrame->GetWidth(), infoFrame->GetHeight(), infoFrame->IsWide() );
02023 gdk_flush();
02024 gdk_threads_leave();
02025 }
02026 }
02027 }
02028 if ( previewing )
02029 previewPosition = 0;
02030 pthread_mutex_lock( &init_mutex );
02031 }
02032 while ( previewing && gtk_toggle_button_get_active( loopButton ) );
02033 }
02034 catch ( const char * exc )
02035 {
02036 modal_message( ( char * ) exc );
02037 }
02038 pthread_mutex_unlock( &init_mutex );
02039
02040 kino_sound_close( audio_device );
02041 previewing = false;
02042 delete info;
02043 delete[] pixels;
02044 for ( int n = 0; n < 4; n++ )
02045 delete[] audio_buffers[ n ];
02046 GetFramePool()->DoneWithFrame( infoFrame );
02047 TriggerAction();
02048 }
|
|
|
Clean up when leaving page.
Reimplemented from Page. Definition at line 1670 of file page_magick.cc. References status, and StopPreview(). 01671 {
01672 StopPreview();
01673 strcpy( status, "" );
01674 }
|
|
|
Return the currently selected audio filter.
Definition at line 2682 of file page_magick.cc. References audio_filters, and GDKAudioFilterRepository::Get(). Referenced by RefreshStatus(). 02683 {
02684 return audio_filters.Get( );
02685 }
|
|
|
Return the currently selected audio transition.
Definition at line 2690 of file page_magick.cc. References audio_transitions, and GDKAudioTransitionRepository::Get(). Referenced by RefreshStatus(). 02691 {
02692 return audio_transitions.Get( );
02693 }
|
|
|
Implements KeyFrameController. Definition at line 3345 of file page_magick.cc. References PageMagickInfo::begin, common, PageMagickInfo::GetFrameSource(), info, and previewPosition. Referenced by on_notebook_magick_switch_video_page(), OnKeyFrameControllerKeyChanged(), RefreshStatus(), videoNextScene(), and videoPreviousScene(). 03346 {
03347 try
03348 {
03349 PageMagickInfo info( common );
03350 info.GetFrameSource();
03351 return time_info( info, info.begin + previewPosition ).position();
03352 }
03353 catch( const char * exc )
03354 {
03355 return 0;
03356 }
03357 }
|
|
|
Reimplemented from Page. Definition at line 146 of file page_magick.h. 00147 {
00148 return "FX";
00149 }
|
|
|
Return the currently selected image creator.
Definition at line 2698 of file page_magick.cc. References GDKImageCreateRepository::Get(), and image_creators. Referenced by RefreshStatus(). 02699 {
02700 return image_creators.Get( );
02701 }
|
|
|
Return the currently selected image filter.
Definition at line 2666 of file page_magick.cc. References GDKImageFilterRepository::Get(), and image_filters. Referenced by RefreshStatus(). 02667 {
02668 return image_filters.Get( );
02669 }
|
|
|
Return the currently selected image transition.
Definition at line 2674 of file page_magick.cc. References GDKImageTransitionRepository::Get(), and image_transitions. Referenced by RefreshStatus(). 02675 {
02676 return image_transitions.Get( );
02677 }
|
|
|
Definition at line 169 of file page_magick.h. References window. 00170 {
00171 return window;
00172 }
|
|
|
Definition at line 177 of file page_magick.h. References previewing. Referenced by FXSelectedFrames::IsPreviewing(), GDKImageTransitionRepository::SelectionChange(), GDKImageFilterRepository::SelectionChange(), GDKAudioTransitionRepository::SelectionChange(), and GDKAudioFilterRepository::SelectionChange(). 00178 {
00179 return previewing;
00180 }
|
|
|
Definition at line 173 of file page_magick.h. References repainting. Referenced by FXSelectedFrames::IsRepainting(). 00174 {
00175 return repainting;
00176 }
|
|
|
Reimplemented from Page. Definition at line 1752 of file page_magick.cc. References common, KinoCommon::getPageEditor(), KinoCommon::getPlayList(), KinoCommon::hasListChanged, lookup_widget(), PreviewFrame(), previewPosition, scenes, selectScene(), StopPreview(), and window. Referenced by selectScene(), and windowMoved(). 01753 {
01754 if ( common->hasListChanged == TRUE )
01755 {
01756 common->getPageEditor()->ResetBar();
01757 common->hasListChanged = FALSE;
01758 if ( common->getPlayList() ->GetNumFrames() > 0 )
01759 {
01760 std::vector<int> scenes = common->getPageEditor()->GetScene();
01761 int i = 0;
01762 for ( i = 0; i < int( scenes.size() ) && frame_number >= scenes[ i ]; i++ );
01763 selectScene( i );
01764 }
01765 GtkSpinButton *startSpin = GTK_SPIN_BUTTON( lookup_widget( window, "spinbutton_magick_start" ) );
01766 GtkSpinButton *endSpin = GTK_SPIN_BUTTON( lookup_widget( window, "spinbutton_magick_end" ) );
01767 gtk_spin_button_set_range( startSpin, 0, gtk_spin_button_get_value( endSpin ) );
01768 gtk_spin_button_set_range( endSpin, gtk_spin_button_get_value( startSpin ),
01769 common->getPlayList() ->GetNumFrames() - 1 );
01770 }
01771 else
01772 {
01773 try {
01774 StopPreview();
01775 previewPosition = frame_number;
01776 PreviewFrame();
01777 } catch ( const char * exc )
01778 { }
01779 }
01780 }
|
|
|
Reimplemented from Page. Definition at line 1596 of file page_magick.cc. References last_fx_file. 01597 {
01598 last_fx_file = "";
01599 }
|
|
|
Definition at line 3389 of file page_magick.cc. References GetCurrentPosition(), isGuiLocked, keyFrameControllerClient, and KeyFrameControllerClient::OnControllerKeyChanged(). Referenced by on_togglebutton_key_frame_toggled(). 03390 {
03391 if ( !isGuiLocked && keyFrameControllerClient )
03392 {
03393 double position = GetCurrentPosition( );
03394 keyFrameControllerClient->OnControllerKeyChanged( position,
03395 gtk_toggle_button_get_active( togglebutton ) );
03396 }
03397 }
|
|
|
Definition at line 2896 of file page_magick.cc. References PageMagickInfo::begin, common, PageMagickInfo::end, PageMagickInfo::GetFrameSource(), info, PreviewFrame(), previewPosition, and scrubAdjustment. Referenced by on_notebook_magick_switch_page(), and on_notebook_magick_switch_video_page(). 02897 {
02898 try
02899 {
02900 PageMagickInfo *info = new PageMagickInfo( common );
02901
02902 info->GetFrameSource();
02903 scrubAdjustment->upper = info->end - info->begin + 1;
02904 if ( gtk_adjustment_get_value( scrubAdjustment ) >= scrubAdjustment->upper )
02905 previewPosition = info->end - info->begin;
02906 delete info;
02907 PreviewFrame();
02908 g_signal_emit_by_name( scrubAdjustment, "changed" );
02909 }
02910 catch ( const char * exc )
02911 {
02912 }
02913 }
|
|
||||||||||||||||||||||||
|
Play an audio frame.
Definition at line 1679 of file page_magick.cc. References audio_device, audio_device_avail, audio_sampling_rate, dv_audio, Preferences::getInstance(), kino_sound_init(), and kino_sound_play(). Referenced by AudioThread(). 01680 {
01681 dv_audio.frequency = frequency;
01682 dv_audio.samples_this_frame = samples;
01683 dv_audio.num_channels = channels;
01684
01685 if ( !audio_device_avail && ( audio_sampling_rate = kino_sound_init(
01686 &dv_audio, audio_device, Preferences::getInstance().audioDevice ) ) != 0 )
01687 audio_device_avail = true;
01688 if ( audio_device_avail )
01689 kino_sound_play( &dv_audio, audio_device, buffers );
01690 }
|
|
|
Definition at line 1788 of file page_magick.cc. References PageMagickInfo::begin, common, PageMagickInfo::end, FRAME_MAX_HEIGHT, FRAME_MAX_WIDTH, PageMagickImage::GetFrame(), PageMagickFrames::GetFrame(), PageMagickInfo::GetFrameSource(), PageMagickInfo::GetImageManipulator(), PageMagickInfo::height, PageMagickInfo::increment, info, PageMagickInfo::Initialise(), PageMagickInfo::isWide, magick_glade, modal_message(), pixels, PageMagickImage::PreGetFrame(), previewing, previewPosition, rendering, repainting, PageMagickInfo::reverse, PageMagickInfo::SetLowQuality(), showFrameInfo(), ShowImage(), and PageMagickInfo::width. Referenced by movedToFrame(), OnTimeRangeChanged(), RefreshStatus(), FXSelectedFrames::Repaint(), videoBack(), videoEndOfMovie(), videoForward(), videoNextScene(), videoPreviousScene(), and videoStartOfMovie(). 01789 {
01790 // Make sure we're not already previewing.
01791 // Do not interrupt rendering
01792 if ( rendering || previewing || repainting )
01793 return;
01794 repainting = true;
01795
01796 PageMagickInfo *info = new PageMagickInfo( common );
01797 info->Initialise();
01798 PageMagickFrames *frames = info->GetFrameSource();
01799 GtkWidget *area = glade_xml_get_widget( magick_glade, "drawingarea_magick_preview" );
01800 if ( previewPosition > info->end - info->begin )
01801 previewPosition = info->end - info->begin;
01802
01803 try
01804 {
01805 if ( GDK_IS_DRAWABLE(area->window) && ( info->begin <= info->end ) )
01806 {
01807 GtkWidget *qualityButton = glade_xml_get_widget( magick_glade, "checkbutton_low_quality" );
01808 info->SetLowQuality( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( qualityButton ) ) );
01809 PageMagickImage *image = info->GetImageManipulator();
01810 double i = double( info->begin ) + previewPosition * info->increment;
01811 int frame_number = int( i + 0.5 );
01812 uint8_t *pixels = new uint8_t[ FRAME_MAX_WIDTH * FRAME_MAX_HEIGHT * 4 ];
01813
01814 showFrameInfo( frame_number, info->end - info->begin + 1 );
01815
01816 // Apply the filter and show image
01817 if ( info->reverse )
01818 frame_number = int( double( info->end ) - ( i - info->begin ) + 0.5 );
01819 if ( frame_number > info->end )
01820 frame_number = info->end;
01821 frames->GetFrame( pixels, info->width, info->height, NULL, frame_number );
01822 image->PreGetFrame( frame_number - info->begin );
01823 image->GetFrame( pixels, frame_number );
01824 ShowImage( area, pixels, info->width, info->height, info->isWide );
01825 delete[] pixels;
01826 }
01827 else
01828 {
01829 showFrameInfo( 0, 0 );
01830 }
01831 }
01832 catch ( const char * exc )
01833 {
01834 modal_message( ( char * ) exc );
01835 }
01836
01837 repainting = false;
01838 delete info;
01839 }
|
|
|
Reimplemented from Page. Definition at line 2727 of file page_magick.cc. References _getOneSecond(), KinoCommon::changePageRequest(), common, KinoCommon::getWidget(), KinoCommon::keyboardFeedback(), kinoDeactivate(), KinoCommon::moveByFrames(), PAGE_EDITOR, PAGE_TIMELINE, PAGE_TRIM, previewing, KinoCommon::savePlayList(), KinoCommon::videoEndOfMovie(), KinoCommon::videoEndOfScene(), KinoCommon::videoNextScene(), KinoCommon::videoPause(), KinoCommon::videoPlay(), KinoCommon::videoPreviousScene(), KinoCommon::videoStartOfMovie(), KinoCommon::videoStartOfScene(), and KinoCommon::videoStop(). 02728 {
02729 /* play, pause */
02730
02731 if ( strcmp( cmd, " " ) == 0 )
02732 {
02733 if ( !previewing )
02734 {
02735 common->keyboardFeedback( cmd, _( "Play" ) );
02736 common->videoPlay( );
02737 }
02738 else
02739 {
02740 common->keyboardFeedback( cmd, _( "Pause" ) );
02741 common->videoPause( );
02742 }
02743 }
02744
02745 /* advance one frame */
02746
02747 else if ( strcmp( cmd, "l" ) == 0 )
02748 {
02749 common->keyboardFeedback( cmd, _( "Move forward" ) );
02750 common->moveByFrames( 1 );
02751 }
02752
02753 /* backspace one frame */
02754
02755 else if ( strcmp( cmd, "h" ) == 0 )
02756 {
02757 common->keyboardFeedback( cmd, _( "Move backward" ) );
02758 common->moveByFrames( -1 );
02759 }
02760
02761 /* advance one second */
02762
02763 else if ( strcmp( cmd, "w" ) == 0 || strcmp( cmd, "W" ) == 0 ||
02764 strcmp( cmd, "e" ) == 0 || strcmp( cmd, "E" ) == 0 )
02765 {
02766 common->keyboardFeedback( cmd, _( "Move forward second" ) );
02767 common->moveByFrames( _getOneSecond() );
02768 }
02769
02770 /* backspace one second */
02771
02772 else if ( ( strcmp( cmd, "b" ) == 0 ) || ( strcmp( cmd, "B" ) == 0 ) )
02773 {
02774 common->keyboardFeedback( cmd, _( "Move backwards one second" ) );
02775 common->moveByFrames( -1 * _getOneSecond() );
02776 }
02777
02778 /* start of scene */
02779
02780 else if ( ( strcmp( cmd, "0" ) == 0 ) || ( strcmp( cmd, "^" ) == 0 ) )
02781 {
02782 common->videoStartOfScene( );
02783 common->keyboardFeedback( cmd, _( "Move to start of scene" ) );
02784 }
02785
02786 /* end of scene */
02787
02788 else if ( strcmp( cmd, "$" ) == 0 )
02789 {
02790 common->videoEndOfScene( );
02791 common->keyboardFeedback( cmd, _( "Move to end of scene" ) );
02792 }
02793
02794 /* start of next scene */
02795
02796 else if ( ( strcmp( cmd, "j" ) == 0 ) || strcmp( cmd, "+" ) == 0 )
02797 {
02798 common->videoNextScene( );
02799 common->keyboardFeedback( cmd, _( "Move to start of next scene" ) );
02800 }
02801
02802 /* start of previous scene */
02803
02804 else if ( ( strcmp( cmd, "k" ) == 0 ) || ( strcmp( cmd, "-" ) == 0 ) )
02805 {
02806 common->videoPreviousScene( );
02807 common->keyboardFeedback( cmd, _( "Move to start of previous scene" ) );
02808 }
02809
02810 /* first frame */
02811
02812 else if ( strcmp( cmd, "gg" ) == 0 )
02813 {
02814 common->videoStartOfMovie( );
02815 common->keyboardFeedback( cmd, _( "Move to first frame" ) );
02816 }
02817
02818 /* last frame */
02819
02820 else if ( strcmp( cmd, "G" ) == 0 )
02821 {
02822 common->videoEndOfMovie( );
02823 common->keyboardFeedback( cmd, _( "Move to last frame" ) );
02824 }
02825
02826 /* write PlayList */
02827
02828 else if ( strcmp( cmd, ":w" ) == 0 )
02829 {
02830 common->keyboardFeedback( cmd, _( "Write playlist" ) );
02831 common->savePlayList( );
02832 }
02833
02834 else if ( strcmp( cmd, "Enter" ) == 0 )
02835 {
02836 common->keyboardFeedback( cmd, _( "Start Render" ) );
02837 GdkEvent ev;
02838 ev.key.type = GDK_KEY_PRESS;
02839 ev.key.window = common->getWidget()->window;
02840 ev.key.send_event = TRUE;
02841 ev.key.state = 0;
02842 ev.key.length = 0;
02843 ev.key.string = "";
02844 ev.key.keyval = GDK_Return;
02845 ev.key.group = 0;
02846 gdk_event_put( &ev );
02847 }
02848
02849 else if ( strcmp( cmd, "Esc" ) == 0 )
02850 {
02851 common->keyboardFeedback( cmd, _( "Stop" ) );
02852 common->videoStop();
02853 }
02854
02855 else if ( strcmp( cmd, "F2" ) == 0 )
02856 {
02857 common->keyboardFeedback( cmd, _( "Edit" ) );
02858 common->changePageRequest( PAGE_EDITOR );
02859 }
02860
02861 else if ( strcmp( cmd, "A" ) == 0 )
02862 {
02863 common->keyboardFeedback( cmd, _( "Capture, append to movie" ) );
02864 common->changePageRequest( PAGE_EDITOR );
02865 }
02866
02867 else if ( strcmp( cmd, "v" ) == 0 )
02868 {
02869 common->keyboardFeedback( cmd, _( "Timeline" ) );
02870 common->changePageRequest( PAGE_TIMELINE );
02871 }
02872
02873 else if ( strcmp( cmd, "t" ) == 0 )
02874 {
02875 common->keyboardFeedback( cmd, _( "Trim" ) );
02876 common->changePageRequest( PAGE_TRIM );
02877 }
02878
02879 else if ( strcmp( cmd, ":W" ) == 0 )
02880 {
02881 common->keyboardFeedback( cmd, _( "Export" ) );
02882 common->changePageRequest( PAGE_TIMELINE );
02883 }
02884
02885 /* quit */
02886
02887 else if ( strcmp( cmd, ":q" ) == 0 )
02888 {
02889 common->keyboardFeedback( cmd, _( "quit" ) );
02890 kinoDeactivate();
02891 }
02892
02893 return FALSE;
02894 }
|
|
|
Reimplemented from Page. Definition at line 2703 of file page_magick.cc. References KinoCommon::changePageRequest(), common, KinoCommon::keyboardFeedback(), PAGE_EDITOR, previewing, rendering, and KinoCommon::videoStop(). 02704 {
02705 gboolean ret = FALSE;
02706
02707 // Translate special keys to equivalent command
02708 switch ( event->keyval )
02709 {
02710 case GDK_Escape:
02711 if ( rendering || previewing )
02712 {
02713 common->keyboardFeedback( "", _( "Stop" ) );
02714 common->videoStop();
02715 }
02716 else
02717 {
02718 common->changePageRequest( PAGE_EDITOR );
02719 }
02720 default:
02721 break;
02722 }
02723
02724 return ret;
02725 }
|
|
|
Refresh the status label to show the current selections.
Definition at line 2595 of file page_magick.cc. References GetAudioFilter(), GetAudioTransition(), GetCurrentPosition(), GetImageCreate(), GetImageFilter(), GetImageTransition(), LOCKED_KEY, lookup_widget(), SelectionNotification::OnSelectionChange(), PreviewFrame(), previewing, ShowCurrentStatus(), StartPreview(), and StopPreview(). Referenced by selectScene(), and start(). 02596 {
02597 GtkNotebook *notebookFrame = GTK_NOTEBOOK( lookup_widget( this->window, "notebook_magick_frames" ) );
02598 GtkNotebook *notebookImage = GTK_NOTEBOOK( lookup_widget( this->window, "notebook_magick_video" ) );
02599 GtkNotebook *notebookAudio = GTK_NOTEBOOK( lookup_widget( this->window, "notebook_magick_audio" ) );
02600
02601 int page = gtk_notebook_get_current_page( notebookFrame );
02602 if ( page == 1 )
02603 {
02604 SelectionNotification *notify = dynamic_cast <SelectionNotification *>( GetImageCreate( ) );
02605 if ( with_fx_notify && notify != NULL )
02606 notify->OnSelectionChange( );
02607 }
02608
02609 page = gtk_notebook_get_current_page( notebookImage );
02610
02611 if ( page == 0 && GetImageFilter() != NULL )
02612 {
02613 SelectionNotification *notify = dynamic_cast <SelectionNotification *>( GetImageFilter( ) );
02614 if ( with_fx_notify && notify != NULL )
02615 notify->OnSelectionChange( );
02616 }
02617 else if ( page == 1 && GetImageTransition() != NULL )
02618 {
02619 SelectionNotification *notify = dynamic_cast <SelectionNotification *>( GetImageTransition( ) );
02620 if ( with_fx_notify && notify != NULL )
02621 notify->OnSelectionChange( );
02622 }
02623
02624 page = gtk_notebook_get_current_page( notebookAudio );
02625 if ( page == 0 )
02626 {
02627 SelectionNotification *notify = dynamic_cast <SelectionNotification *>( GetAudioFilter( ) );
02628 if ( with_fx_notify && notify != NULL )
02629 notify->OnSelectionChange( );
02630 }
02631 else if ( page == 1 )
02632 {
02633 SelectionNotification *notify = dynamic_cast <SelectionNotification *>( GetAudioTransition( ) );
02634 if ( with_fx_notify && notify != NULL )
02635 notify->OnSelectionChange( );
02636 }
02637
02638 ShowCurrentStatus( GetCurrentPosition(), LOCKED_KEY, false, false );
02639
02640 // This is a special case to cause preview to restart when fx options change
02641 if ( !with_fx_notify )
02642 {
02643 if ( previewing )
02644 {
02645 StopPreview();
02646 StartPreview();
02647 }
02648 else
02649 {
02650 PreviewFrame();
02651 }
02652 }
02653 }
|
|
|
put the scene begin and end frame numbers into spinners
Reimplemented from Page. Definition at line 2440 of file page_magick.cc. References common, KinoCommon::g_currentFrame, GetFramePool(), KinoCommon::getPageEditor(), KinoCommon::getPlayList(), lookup_widget(), movedToFrame(), previewing, RefreshStatus(), KinoCommon::setCurrentScene(), KinoCommon::showFrameMoreInfo(), StartPreview(), StopPreview(), and window. Referenced by movedToFrame(). 02441 {
02442 int begin = 0;
02443 int end = 0;
02444 vector <int> scene = common->getPageEditor() ->GetScene();
02445
02446 begin = i == 0 ? 0 : scene[ i - 1 ];
02447 end = scene[ i ] - 1;
02448 common->g_currentFrame = begin;
02449
02450 if ( GTK_WIDGET_SENSITIVE( lookup_widget( window, "hpaned_magick" ) ) )
02451 {
02452 GtkSpinButton *startSpin = GTK_SPIN_BUTTON( lookup_widget( window, "spinbutton_magick_start" ) );
02453 GtkSpinButton *endSpin = GTK_SPIN_BUTTON( lookup_widget( window, "spinbutton_magick_end" ) );
02454 gtk_spin_button_set_value( startSpin, begin );
02455 gtk_spin_button_set_value( endSpin, end );
02456
02457 if ( previewing )
02458 {
02459 StopPreview();
02460 StartPreview();
02461 }
02462 else
02463 {
02464 movedToFrame( 0 );
02465 }
02466 }
02467
02468 Frame &frame = *( GetFramePool( ) ->GetFrame( ) );
02469 FileHandler *media;
02470 common->getPlayList() ->GetMediaObject( begin, &media );
02471 common->getPlayList() ->GetFrame( begin, frame );
02472 common->showFrameMoreInfo( frame, media );
02473 GetFramePool( ) ->DoneWithFrame( &frame );
02474
02475 common->setCurrentScene( begin );
02476 RefreshStatus( true );
02477 }
|
|
|
Definition at line 181 of file page_magick.h. References keyFrameControllerClient. Referenced by on_notebook_magick_switch_video_page(). 00182 {
00183 keyFrameControllerClient = client;
00184 }
|
|
||||||||||||||||||||
|
Implements KeyFrameController. Definition at line 3306 of file page_magick.cc. References KinoCommon::activateWidgets(), common, isGuiLocked, isNextScene, isPreviousScene, KEY, keyFrameControllerClient, LOCKED_KEY, lookup_widget(), newPosition, rendering, and window. Referenced by on_notebook_magick_switch_video_page(), and RefreshStatus(). 03307 {
03308 newPosition = position;
03309 isGuiLocked = true;
03310 // Determine Key button status
03311 GtkWidget *widget = lookup_widget( window, "togglebutton_key_frame" );
03312 if ( rendering )
03313 {
03314 gtk_widget_set_sensitive( widget, false );
03315 }
03316 else
03317 {
03318 gtk_widget_set_sensitive( widget, keyFrameControllerClient != 0 );
03319 if ( type & LOCKED_KEY ) // Locked Key
03320 {
03321 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( widget ), true );
03322 GtkImage* img = GTK_IMAGE( lookup_widget( window, "image_key_frame" ) );
03323 gtk_image_set_from_stock( img, GTK_STOCK_REMOVE, GTK_ICON_SIZE_BUTTON );
03324 }
03325 else if ( type & KEY ) // Normal Key
03326 {
03327
03328 GtkImage* img = GTK_IMAGE( lookup_widget( window, "image_key_frame" ) );
03329 gtk_image_set_from_stock( img, GTK_STOCK_REMOVE, GTK_ICON_SIZE_BUTTON );
03330 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( widget ), true );
03331 }
03332 else // Not Key
03333 {
03334 GtkImage* img = GTK_IMAGE( lookup_widget( window, "image_key_frame" ) );
03335 gtk_image_set_from_stock( img, GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON );
03336 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( widget ), false );
03337 }
03338 isPreviousScene = hasPrev;
03339 isNextScene = hasNext;
03340 common->activateWidgets();
03341 }
03342 isGuiLocked = false;
03343 }
|
|
||||||||||||
|
Definition at line 1720 of file page_magick.cc. References common, KinoCommon::g_currentFrame, GetFramePool(), Frame::GetFrameRate(), KinoCommon::getPlayList(), KinoCommon::getTime(), KinoCommon::getTimeFormat(), KinoCommon::getWidget(), lookup_widget(), previewPosition, scrubAdjustment, and KinoCommon::showFrameMoreInfo(). 01721 {
01722 GtkLabel* positionLabelCurrent = GTK_LABEL( lookup_widget( common->getWidget(), "position_label_current" ) );
01723 GtkLabel* positionLabelTotal = GTK_LABEL( lookup_widget( common->getWidget(), "position_label_total" ) );
01724
01725 gtk_adjustment_set_value( scrubAdjustment, ( gfloat ) previewPosition );
01726 if ( common->getPlayList()->GetNumFrames() > 0 && duration > 0 )
01727 {
01728 Frame &frame = *( GetFramePool( ) ->GetFrame( ) );
01729 FileHandler *media;
01730
01731 common->g_currentFrame = common->getPlayList()->FindStartOfScene( common->g_currentFrame ) + previewPosition;
01732 if ( common->getPlayList()->GetMediaObject( frame_number, &media ) &&
01733 common->getPlayList()->GetFrame( frame_number, frame ) )
01734 {
01735 common->getTime().setFramerate( frame.GetFrameRate() );
01736 string tc = "<span size=\"x-large\">" + common->getTime().parseFramesToString( frame_number, common->getTimeFormat() ) + "</span>";
01737 gtk_label_set_markup( positionLabelCurrent, tc.c_str() );
01738 gtk_widget_set_redraw_on_allocate( GTK_WIDGET( positionLabelCurrent ), FALSE );
01739 tc = _("Duration: ") + common->getTime().parseFramesToString( duration, common->getTimeFormat() );
01740 gtk_label_set_markup( positionLabelTotal, tc.c_str() );
01741 common->showFrameMoreInfo( frame, media );
01742 }
01743 GetFramePool( ) ->DoneWithFrame( &frame );
01744 }
01745 else
01746 {
01747 gtk_label_set_text( positionLabelCurrent, "" );
01748 gtk_label_set_text( positionLabelTotal, "" );
01749 }
01750 }
|
|
|
Update UI with metadata.
Reimplemented from Page. Definition at line 1711 of file page_magick.cc. References PageMagickInfo::begin, common, PageMagickInfo::end, PageMagickInfo::GetFrameSource(), and info. Referenced by AudioThread(), and PreviewFrame(). 01712 {
01713 PageMagickInfo *info = new PageMagickInfo( common );
01714 info->GetFrameSource();
01715 int duration = info->end - info->begin + 1;
01716 delete info;
01717 showFrameInfo( frame_number, duration );
01718 }
|
|
||||||||||||||||||||||||
|
Show an image in the preview drawing area.
Definition at line 1695 of file page_magick.cc. References lookup_widget(). Referenced by AudioThread(), PreviewFrame(), and VideoThread(). 01696 {
01697 GdkPixbuf * pix = gdk_pixbuf_new_from_data( image, GDK_COLORSPACE_RGB, FALSE, 8, width, height, width * 3, NULL, NULL );
01698 GdkPixbuf *im = gdk_pixbuf_scale_simple( pix, area->allocation.width, area->allocation.height, GDK_INTERP_NEAREST );
01699 GdkGC *gc = gdk_gc_new( area->window );
01700 GtkWidget* aspectFrame = lookup_widget( area, "aspectframe1" );
01701 gtk_aspect_frame_set( GTK_ASPECT_FRAME( aspectFrame ), 0.5, 0, isWide ? (16.0/9.0) : (4.0/3.0), FALSE );
01702 gdk_draw_pixbuf( area->window, gc, im, 0, 0, area->allocation.x, area->allocation.y, -1, -1, GDK_RGB_DITHER_NORMAL, 0, 0 );
01703 g_object_unref( im );
01704 g_object_unref( pix );
01705 g_object_unref( gc );
01706 }
|
|
|
Start when entering page.
Reimplemented from Page. Definition at line 1604 of file page_magick.cc. References audio_transitions, common, KinoCommon::g_currentFrame, KinoCommon::getPlayList(), KinoCommon::getWidget(), last_fx_file, lookup_widget(), previewPosition, RefreshStatus(), GDKAudioTransitionRepository::SelectionChange(), status, timeFormatChanged(), and window. 01605 {
01606 cerr << ">>> Starting magick" << endl;
01607 strcpy( status, "" );
01608
01609 if ( common->getPlayList() ->GetNumFrames() > 0 )
01610 {
01611 int begin = common->getPlayList() ->FindStartOfScene( common->g_currentFrame );
01612 int end = common->getPlayList() ->FindEndOfScene( common->g_currentFrame );
01613
01614 GtkSpinButton *startSpin = GTK_SPIN_BUTTON( lookup_widget( window, "spinbutton_magick_start" ) );
01615 GtkSpinButton *endSpin = GTK_SPIN_BUTTON( lookup_widget( window, "spinbutton_magick_end" ) );
01616 gtk_spin_button_set_range( startSpin, 0, end );
01617 gtk_spin_button_set_value( startSpin, begin );
01618 gtk_spin_button_set_range( endSpin, begin, common->getPlayList() ->GetNumFrames() - 1 );
01619 gtk_spin_button_set_value( endSpin, end );
01620
01621 previewPosition = common->g_currentFrame - common->getPlayList()->FindStartOfScene( common->g_currentFrame );
01622 }
01623 else
01624 {
01625 GtkNotebook * notebook = GTK_NOTEBOOK( lookup_widget( this->window, "notebook_magick_frames" ) );
01626 gtk_notebook_set_current_page( notebook, 1 );
01627 }
01628
01629 // Default the file name
01630 GtkEntry *fileEntry = GTK_ENTRY( lookup_widget( window, "entry_magick_file" ) );
01631 string fx_file_name = common->getPlayList( ) ->GetProjectDirectory( ) + "/";
01632
01633 if ( fx_file_name != last_fx_file )
01634 {
01635 last_fx_file = fx_file_name;
01636 gtk_entry_set_text( fileEntry, fx_file_name.c_str() );
01637 }
01638
01639 audio_transitions.SelectionChange();
01640 gtk_notebook_set_page( GTK_NOTEBOOK( lookup_widget( common->getWidget(), "notebook_keyhelp" ) ), 3 );
01641 gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( lookup_widget( common->getWidget(), "menuitem_fx" ) ), TRUE );
01642
01643 timeFormatChanged();
01644 RefreshStatus();
01645 }
|
|
|
Definition at line 1883 of file page_magick.cc. References audioThreadProxy(), previewing, and videoThreadProxy(). Referenced by RefreshStatus(), selectScene(), and videoPlay(). 01884 {
01885 previewing = true;
01886 pthread_create( &audioThread, NULL, audioThreadProxy, this );
01887 pthread_create( &videoThread, NULL, videoThreadProxy, this );
01888 }
|
|
|
Render the effect.
Definition at line 2108 of file page_magick.cc. References KinoCommon::activateWidgets(), PageMagickInfo::begin, buttonMutex, PageMagickImage::ChangesImage(), PageMagickInfo::channels, AudioInfo::channels, PageMagickAudio::Close(), PageMagickImage::Close(), PageMagickFrames::Close(), KinoCommon::commitComponentState(), common, Frame::data, DV_AUDIO_MAX_SAMPLES, PageMagickInfo::end, Export::formatSecs(), FRAME_MAX_HEIGHT, FRAME_MAX_WIDTH, AudioInfo::frequency, PageMagickInfo::frequency, PageMagickInfo::GetAudioManipulator(), KinoCommon::getComponentState(), PageMagickImage::GetFrame(), PageMagickAudio::GetFrame(), PageMagickFrames::GetFrame(), GetFramePool(), PageMagickInfo::GetFrameSource(), PageMagickInfo::GetImageManipulator(), KinoCommon::getPageEditor(), KinoCommon::getPlayList(), PageMagickInfo::height, PageMagickInfo::increment, info, PageMagickInfo::Initialise(), PageMagickInfo::isPAL, PageMagickFrames::IsSynth(), PageMagickInfo::isWide, PlayList::LoadMediaObject(), lookup_widget(), modal_message(), paused, pauseTime, pixels, PageMagickImage::PreGetFrame(), previewing, rendering, PageMagickInfo::reverse, AudioInfo::samples, PageMagickInfo::samples_this_frame, scrubBar, KinoCommon::setCurrentScene(), KinoCommon::setStatusBar(), startTime, Stop(), KinoCommon::toggleComponents(), UpdateProgress(), UpdateStatus(), VIDEO_PLAY, VIDEO_STOP, and window. 02109 {
02110 // Allow immediate render from preview
02111 if ( previewing )
02112 Stop();
02113
02114 // Make sure we're not already rendering
02115 if ( rendering )
02116 return ;
02117
02118 // Set the page condition
02119 rendering = true;
02120 paused = false;
02121
02122 // Show the current button status
02123 buttonMutex = true;
02124 gtk_widget_set_sensitive( lookup_widget( window, "hpaned_magick" ), false );
02125 gtk_widget_set_sensitive( lookup_widget( window, "togglebutton_magick_start" ), false );
02126 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( lookup_widget( window, "togglebutton_magick_start" ) ), false );
02127 common->toggleComponents( common->getComponentState(), false );
02128 common->toggleComponents( VIDEO_STOP, false );
02129 common->toggleComponents( VIDEO_PLAY, true );
02130 common->commitComponentState();
02131 common->activateWidgets();
02132 gtk_widget_set_sensitive( scrubBar, FALSE );
02133 buttonMutex = false;
02134
02135 // Create the temporary space
02136 uint8_t *pixels = new unsigned char[ FRAME_MAX_WIDTH * FRAME_MAX_HEIGHT * 4 ];
02137 int16_t *audio_buffers[ 4 ];
02138 for ( int n = 0; n < 4; n++ )
02139 audio_buffers[ n ] = new int16_t [ 2 * DV_AUDIO_MAX_SAMPLES ];
02140 unsigned char *dv_pixels[ 3 ];
02141 dv_pixels[ 0 ] = pixels;
02142
02143 // Build the info
02144 PageMagickInfo *info = new PageMagickInfo( common );
02145
02146 // Output file
02147 FILE *output = NULL;
02148
02149 Frame* infoFrame = GetFramePool()->GetFrame();
02150
02151 // All exceptions thrown should be safely picked up in the try/catch
02152 try
02153 {
02154 // Get the current date and time to set in dv
02155 time_t datetime = time( NULL );
02156 int frameNum = 0;
02157
02158 // Initialise the info
02159 info->Initialise();
02160
02161 int audio_number = 0;
02162
02163 // Obtain the file name
02164 GtkEntry *fileEntry = GTK_ENTRY( lookup_widget( window, "entry_magick_file" ) );
02165 const char *filename = gtk_entry_get_text( fileEntry );
02166 int counter = 0;
02167 string thisfile;
02168 struct stat stats;
02169
02170 if ( !strcmp( filename, "" ) )
02171 throw _( "No file name specified" );
02172
02173 string directory = "";
02174
02175 // Relative/absolute file checks
02176 if ( filename[ 0 ] != '/' )
02177 directory = common->getPlayList() ->GetProjectDirectory( ) + "/";
02178
02179 // Generate the full file name
02180 do
02181 {
02182 char name[ 132 ];
02183 sprintf( name, "%s%03d.kinofx.dv", filename, ++ counter );
02184 thisfile = name;
02185 cerr << ">>> Trying " << thisfile << endl;
02186 }
02187 while ( stat( thisfile.c_str(), &stats ) == 0 );
02188
02189 infoFrame->CreateEncoder( ( info->height == 576 ), info->isWide );
02190
02191 // Get the source and manipulators
02192 PageMagickFrames *frames = info->GetFrameSource();
02193 PageMagickImage *image = info->GetImageManipulator();
02194 PageMagickAudio *sound = info->GetAudioManipulator();
02195
02196 // Check that we're rendering a valid set of frames
02197 if ( info->begin > info->end )
02198 throw _( "Invalid frame range specified." );
02199
02200 // Open the file
02201 output = fopen( thisfile.c_str(), "w" );
02202 if ( output == NULL )
02203 throw _( "Unable to open output file" );
02204
02205 bool change_image = image->ChangesImage( ) || frames->IsSynth( );
02206
02207 // Initialise status and progress
02208 startTime = pauseTime - 0.0;
02209
02210 // For each frame
02211 int frame_number = info->begin;
02212 for ( double i = ( double ) info->begin;
02213 frame_number <= info->end && rendering;
02214 frame_number = ( int )( ( i += info->increment ) + 0.5 ) )
02215 {
02216 if ( info->reverse )
02217 frame_number = info->end - ( ( int ) i - info->begin );
02218
02219 frames->GetFrame( pixels, audio_buffers, frame_number );
02220 image->PreGetFrame( );
02221
02222 int samples = info->samples_this_frame; // set in frames->GetFrame() above
02223 int locked_samples = infoFrame->CalculateNumberSamples( info->frequency, audio_number ++ );
02224 if ( samples == 0 )
02225 samples = locked_samples;
02226
02227 sound->GetFrame( audio_buffers, frame_number, samples, locked_samples );
02228
02229 if ( ! change_image )
02230 {
02231 common->getPlayList()->GetFrame( frame_number, *( infoFrame ) );
02232 }
02233 else
02234 {
02235 image->GetFrame( pixels, frame_number );
02236 infoFrame->EncodeRGB( pixels );
02237 }
02238 AudioInfo audioInfo;
02239 audioInfo.channels = info->channels;
02240 audioInfo.frequency = info->frequency;
02241 audioInfo.samples = samples;
02242 infoFrame->EncodeAudio( audioInfo, audio_buffers );
02243 infoFrame->SetRecordingDate( &datetime, frameNum );
02244 infoFrame->SetTimeCode( frameNum++ );
02245
02246 if ( fwrite( infoFrame->data, ( info->isPAL ? 144000 : 120000 ), 1, output ) != 1 )
02247 throw _( "Unable to write video - disk full?" );
02248
02249 if ( info->end != info->begin )
02250 UpdateStatus( int(i), info->begin, info->end, int( info->increment + 0.5) );
02251 }
02252 struct timeval tv;
02253 if ( 0 == gettimeofday( &tv, NULL ) )
02254 {
02255 double now = tv.tv_sec + tv.tv_usec / 1000000.0;
02256 char buf[ 17 ];
02257 string message;
02258
02259 if ( rendering )
02260 message = _( "Rendering finished - time: " );
02261 else
02262 message = _( "Rendering stopped - time: " );
02263 message += Export::formatSecs( buf, 16, now - startTime );
02264 common->setStatusBar( message.c_str() );
02265 }
02266 UpdateProgress( ( gfloat ) 1 );
02267
02268 frames->Close();
02269 image->Close();
02270 sound->Close();
02271
02272 fclose( output );
02273 output = NULL;
02274
02275 PlayList temp;
02276 temp.LoadMediaObject( ( char * ) thisfile.c_str() );
02277 bool isPlayListEmpty = ( common->getPlayList()->GetNumFrames() == 0 );
02278 common->getPlayList() ->InsertPlayList( temp, info->begin );
02279 common->getPageEditor() ->snapshot();
02280 common->getPageEditor() ->ResetBar();
02281 if ( isPlayListEmpty )
02282 common->setCurrentScene( 0 );
02283 }
02284 catch ( const char * exc )
02285 {
02286 common->setStatusBar( _( "Rendering failed" ) );
02287 modal_message( ( char * ) exc );
02288 }
02289
02290 rendering = false;
02291
02292 buttonMutex = true;
02293 gtk_widget_set_sensitive( lookup_widget( window, "hpaned_magick" ), true );
02294 gtk_widget_set_sensitive( lookup_widget( window, "togglebutton_magick_start" ), true );
02295 common->toggleComponents( VIDEO_STOP, true );
02296 common->commitComponentState();
02297 common->activateWidgets();
02298 gtk_widget_set_sensitive( scrubBar, TRUE );
02299 buttonMutex = false;
02300
02301 if ( output )
02302 fclose( output );
02303
02304 delete info;
02305 delete[] pixels;
02306 for ( int n = 0; n < 4; n++ )
02307 delete[] audio_buffers[ n ];
02308 GetFramePool()->DoneWithFrame( infoFrame );
02309 }
|
|
|
Stop whatever is running (either preview or rendering).
Definition at line 2314 of file page_magick.cc. References rendering, and StopPreview(). Referenced by StartRender(), and videoStop(). 02315 {
02316 StopPreview();
02317 rendering = false;
02318 }
|
|
|
Stop the preview.
Definition at line 2323 of file page_magick.cc. References previewing, and TriggerAction(). Referenced by clean(), movedToFrame(), RefreshStatus(), GDKImageTransitionRepository::SelectionChange(), GDKImageFilterRepository::SelectionChange(), GDKAudioTransitionRepository::SelectionChange(), GDKAudioFilterRepository::SelectionChange(), selectScene(), Stop(), videoBack(), videoEndOfMovie(), videoForward(), videoNextScene(), videoPreviousScene(), and videoStartOfMovie(). 02324 {
02325 if ( previewing )
02326 {
02327 previewing = false;
02328 gdk_threads_leave();
02329 pthread_join( audioThread, NULL );
02330 TriggerAction();
02331 pthread_join( videoThread, NULL );
02332 gdk_threads_enter();
02333 }
02334 }
|
|
|
Reimplemented from Page. Definition at line 2655 of file page_magick.cc. References lookup_widget(), on_spinbutton_magick_end_value_changed(), on_spinbutton_magick_limit_value_changed(), and on_spinbutton_magick_start_value_changed(). Referenced by start(). 02656 {
02657 on_spinbutton_magick_start_value_changed( GTK_SPIN_BUTTON( lookup_widget( this->window, "spinbutton_magick_start" ) ), NULL );
02658 on_spinbutton_magick_end_value_changed( GTK_SPIN_BUTTON( lookup_widget( this->window, "spinbutton_magick_end" ) ), NULL );
02659 on_spinbutton_magick_limit_value_changed( GTK_SPIN_BUTTON( lookup_widget( this->window, "spinbutton_magick_limit" ) ), NULL );
02660 }
|
|
|
Update the progress bar for the export process.
Definition at line 2340 of file page_magick.cc. References progressBar. Referenced by StartRender(), and UpdateStatus(). 02341 {
02342 struct timeval tv;
02343
02344 long long now;
02345 static long long lastUpdateTime = 0;
02346
02347 gettimeofday( &tv, 0 );
02348 now = 1000000 * ( long long ) tv.tv_sec + ( long long ) tv.tv_usec;
02349
02350 /* update every 0.3 second */
02351
02352 if ( val < 0.0 )
02353 val = 0;
02354 if ( val > 1.0 )
02355 val = 1.0;
02356
02357 if ( now > lastUpdateTime + 300000 || val == 1.0 )
02358 {
02359 gtk_progress_bar_update( progressBar, val );
02360 lastUpdateTime = now;
02361 }
02362
02363 while ( gtk_events_pending() )
02364 gtk_main_iteration();
02365 }
|
|
||||||||||||||||||||
|
Definition at line 2368 of file page_magick.cc. References common, Export::formatSecs(), nextUpdateTime, paused, pauseTime, KinoCommon::setStatusBar(), startTime, and UpdateProgress(). Referenced by StartRender(). 02369 {
02370 char buf[ 512 ];
02371 struct timeval tv;
02372 if ( 0 != gettimeofday( &tv, NULL ) )
02373 {
02374 cerr << ">>> Error calling gettimeofday?" << endl;
02375 }
02376 double now = tv.tv_sec + tv.tv_usec / 1000000.0;
02377 gfloat ratio = ( gfloat ) ( currentFrame - begin ) / ( gfloat ) ( end + 1 - begin ) ;
02378 /* Figure out how much time we have spend */
02379 if ( 0 == startTime )
02380 {
02381 /* First time */
02382 startTime = now;
02383 nextUpdateTime = now - 1;
02384 snprintf( buf, 512, _( "Rendering frame %i." ), currentFrame );
02385 }
02386 else
02387 {
02388 /* Not first time
02389 We do not care to use difftime on this... */
02390 double time_so_far = now - startTime - pauseTime;
02391 double total_est = time_so_far / ratio;
02392 /* Write the time values into buffers */
02393 char buf1[ 16 ];
02394 char buf2[ 16 ];
02395 char buf3[ 16 ];
02396 snprintf( buf, 512, _( "Rendering frame %i. Time used: %s, estimated: %s, left: %s" ),
02397 currentFrame + 1,
02398 Export::formatSecs( buf1, 16, time_so_far ),
02399 Export::formatSecs( buf2, 16, total_est ),
02400 Export::formatSecs( buf3, 16, total_est - time_so_far ) );
02401 }
02402
02403 /* Update status message
02404 TODO: Do filesystem checks first....
02405 */
02406 if ( now > nextUpdateTime )
02407 {
02408 common->setStatusBar( buf );
02409 nextUpdateTime = now + 0.25;
02410 }
02411
02412 /* Update progressbar - assuming currentFrame have yet to be exported
02413 Updating the progressbar will handle any pending events. */
02414 UpdateProgress( ratio );
02415
02416 /* Check pause - make sure we ignore time paused in export. */
02417 if ( paused )
02418 {
02419 struct timespec ts;
02420 ts.tv_sec = 0;
02421 ts.tv_nsec = 1000 * 1000 * 20; /* 20 ms + sched overhead */
02422 while ( paused )
02423 {
02424 while ( gtk_events_pending() )
02425 gtk_main_iteration();
02426 /* Lets try not to hog the CPU */
02427 nanosleep( &ts, NULL );
02428 }
02429 if ( 0 != gettimeofday( &tv, NULL ) )
02430 cerr << ">>> Error calling gettimeofday?" << endl;
02431 double foo = tv.tv_sec + tv.tv_usec / 1000000.0;
02432 pauseTime += ( foo - now );
02433 }
02434 }
|
|
|
Reimplemented from Page. Definition at line 2495 of file page_magick.cc. References common, KinoCommon::getComponentState(), PageMagickInfo::GetFrameSource(), info, PreviewFrame(), previewPosition, StopPreview(), KinoCommon::toggleComponents(), VIDEO_BACK, and VIDEO_STOP. 02496 {
02497 common->toggleComponents( common->getComponentState(), false );
02498 common->toggleComponents( VIDEO_BACK, false );
02499 common->toggleComponents( VIDEO_STOP, true );
02500 try
02501 {
02502 PageMagickInfo *info = new PageMagickInfo( common );
02503 info->GetFrameSource();
02504 StopPreview();
02505 previewPosition += step;
02506 if ( previewPosition < 0 )
02507 previewPosition = 0;
02508 delete info;
02509 PreviewFrame();
02510 }
02511 catch ( const char * exc )
02512 {
02513 }
02514 }
|
|
|
Reimplemented from Page. Definition at line 2561 of file page_magick.cc. References PageMagickInfo::begin, common, PageMagickInfo::end, KinoCommon::getComponentState(), PageMagickInfo::GetFrameSource(), info, PreviewFrame(), previewPosition, StopPreview(), KinoCommon::toggleComponents(), VIDEO_END_OF_MOVIE, and VIDEO_STOP. 02562 {
02563 common->toggleComponents( common->getComponentState(), false );
02564 common->toggleComponents( VIDEO_END_OF_MOVIE, false );
02565 common->toggleComponents( VIDEO_STOP, true );
02566 try
02567 {
02568 PageMagickInfo *info = new PageMagickInfo( common );
02569 info->GetFrameSource();
02570 StopPreview();
02571 previewPosition = info->end - info->begin;
02572 delete info;
02573 PreviewFrame();
02574 }
02575 catch ( const char * exc )
02576 {
02577 }
02578 }
|
|
|
Reimplemented from Page. Definition at line 137 of file page_magick.h. References videoNextScene(). 00138 { videoNextScene(); }
|
|
|
Reimplemented from Page. Definition at line 2540 of file page_magick.cc. References PageMagickInfo::begin, common, PageMagickInfo::end, KinoCommon::getComponentState(), PageMagickInfo::GetFrameSource(), info, PreviewFrame(), previewPosition, StopPreview(), KinoCommon::toggleComponents(), VIDEO_FORWARD, and VIDEO_STOP. 02541 {
02542 common->toggleComponents( common->getComponentState(), false );
02543 common->toggleComponents( VIDEO_FORWARD, false );
02544 common->toggleComponents( VIDEO_STOP, true );
02545 try
02546 {
02547 PageMagickInfo *info = new PageMagickInfo( common );
02548 info->GetFrameSource();
02549 StopPreview();
02550 previewPosition += step;
02551 if ( previewPosition > info->end - info->begin )
02552 previewPosition = info->end - info->begin;
02553 delete info;
02554 PreviewFrame();
02555 }
02556 catch ( const char * exc )
02557 {
02558 }
02559 }
|
|
|
Reimplemented from Page. Definition at line 3374 of file page_magick.cc. References common, KinoCommon::getComponentState(), GetCurrentPosition(), GetSelectedFramesForFX(), isGuiLocked, keyFrameControllerClient, newPosition, KeyFrameControllerClient::OnControllerNextKey(), PreviewFrame(), previewPosition, StopPreview(), KinoCommon::toggleComponents(), VIDEO_NEXT_SCENE, and VIDEO_STOP. Referenced by videoEndOfScene(). 03375 {
03376 common->toggleComponents( common->getComponentState(), false );
03377 common->toggleComponents( VIDEO_NEXT_SCENE, false );
03378 common->toggleComponents( VIDEO_STOP, true );
03379 StopPreview();
03380 if ( !isGuiLocked && keyFrameControllerClient )
03381 {
03382 double position = GetCurrentPosition( );
03383 keyFrameControllerClient->OnControllerNextKey( position );
03384 previewPosition = GetSelectedFramesForFX().GetIndex( newPosition );
03385 PreviewFrame();
03386 }
03387 }
|
|
|
Reimplemented from Page. Definition at line 2580 of file page_magick.cc. References videoStop(). 02581 {
02582 videoStop();
02583 }
|
|
|
Reimplemented from Page. Definition at line 2517 of file page_magick.cc. References KinoCommon::commitComponentState(), common, KinoCommon::getComponentState(), paused, previewing, rendering, StartPreview(), KinoCommon::toggleComponents(), VIDEO_PLAY, and videoStop(). 02518 {
02519 if ( previewing )
02520 {
02521 videoStop();
02522 }
02523 else if ( rendering )
02524 {
02525 common->toggleComponents( common->getComponentState(), false );
02526 common->toggleComponents( VIDEO_PLAY, paused );
02527 common->commitComponentState();
02528 paused = !paused;
02529 }
02530 else
02531 {
02532 // Start playing
02533 common->toggleComponents( common->getComponentState(), false );
02534 common->toggleComponents( VIDEO_PLAY, true );
02535 common->commitComponentState();
02536 StartPreview();
02537 }
02538 }
|
|
|
Reimplemented from Page. Definition at line 3359 of file page_magick.cc. References common, KinoCommon::getComponentState(), GetCurrentPosition(), GetSelectedFramesForFX(), isGuiLocked, keyFrameControllerClient, newPosition, KeyFrameControllerClient::OnControllerPrevKey(), PreviewFrame(), previewPosition, StopPreview(), KinoCommon::toggleComponents(), VIDEO_START_OF_SCENE, and VIDEO_STOP. Referenced by videoStartOfScene(). 03360 {
03361 common->toggleComponents( common->getComponentState(), false );
03362 common->toggleComponents( VIDEO_START_OF_SCENE, false );
03363 common->toggleComponents( VIDEO_STOP, true );
03364 StopPreview();
03365 if ( !isGuiLocked && keyFrameControllerClient )
03366 {
03367 double position = GetCurrentPosition( );
03368 keyFrameControllerClient->OnControllerPrevKey( position );
03369 previewPosition = GetSelectedFramesForFX().GetIndex( newPosition );
03370 PreviewFrame();
03371 }
03372 }
|
|
|
Reimplemented from Page. Definition at line 2479 of file page_magick.cc. References common, KinoCommon::getComponentState(), PreviewFrame(), previewPosition, StopPreview(), KinoCommon::toggleComponents(), VIDEO_START_OF_MOVIE, and VIDEO_STOP. 02480 {
02481 common->toggleComponents( common->getComponentState(), false );
02482 common->toggleComponents( VIDEO_START_OF_MOVIE, false );
02483 common->toggleComponents( VIDEO_STOP, true );
02484 try
02485 {
02486 StopPreview();
02487 previewPosition = 0;
02488 PreviewFrame();
02489 }
02490 catch ( const char * exc )
02491 {
02492 }
02493 }
|
|
|
Reimplemented from Page. Definition at line 135 of file page_magick.h. References videoPreviousScene(). 00136 { videoPreviousScene(); }
|
|
|
Reimplemented from Page. Definition at line 2585 of file page_magick.cc. References common, KinoCommon::getComponentState(), Stop(), KinoCommon::toggleComponents(), and VIDEO_STOP. Referenced by videoPause(), and videoPlay(). 02586 {
02587 common->toggleComponents( common->getComponentState(), false );
02588 common->toggleComponents( VIDEO_STOP, true );
02589 Stop();
02590 }
|
|
|
Definition at line 2050 of file page_magick.cc. References PageMagickInfo::begin, common, FRAME_MAX_HEIGHT, FRAME_MAX_WIDTH, PageMagickImage::GetFrame(), PageMagickFrames::GetFrame(), GetFramePool(), PageMagickInfo::GetFrameSource(), PageMagickInfo::GetImageManipulator(), Preferences::getInstance(), KinoCommon::getPlayList(), PageMagickInfo::height, info, PageMagickInfo::Initialise(), PageMagickInfo::isWide, lastFrame, lookup_widget(), pixels, PageMagickImage::PreGetFrame(), previewing, PageMagickInfo::SetLowQuality(), ShowImage(), WaitForAction(), PageMagickInfo::width, and window. Referenced by videoThreadProxy(). 02051 {
02052 GtkWidget *area = GTK_WIDGET( lookup_widget( window, "drawingarea_magick_preview" ) );
02053 uint8_t *pixels = new uint8_t[ FRAME_MAX_WIDTH * FRAME_MAX_HEIGHT * 4 ];
02054 PageMagickInfo *info = new PageMagickInfo( common );
02055 Frame* infoFrame = GetFramePool()->GetFrame();
02056 GtkToggleButton *audioButton = GTK_TOGGLE_BUTTON( lookup_widget( window, "checkbutton_magick_preview_audio" ) );
02057 GtkToggleButton *everyButton = GTK_TOGGLE_BUTTON( lookup_widget( window, "checkbutton_magick_preview_every" ) );
02058 int lastFrame = frameNumber;
02059
02060 pthread_mutex_lock( &init_mutex );
02061 info->Initialise();
02062 GtkToggleButton *qualityButton = GTK_TOGGLE_BUTTON( lookup_widget( window, "checkbutton_low_quality" ) );
02063 info->SetLowQuality( gtk_toggle_button_get_active( qualityButton ) );
02064 PageMagickFrames *frames = info->GetFrameSource();
02065 PageMagickImage *image = info->GetImageManipulator();
02066 pthread_mutex_unlock( &init_mutex );
02067
02068 if ( Preferences::getInstance().enableAudio )
02069 {
02070 while ( previewing )
02071 {
02072 int frame_number = WaitForAction( lastFrame );
02073 if ( gtk_toggle_button_get_active( everyButton ) && !gtk_toggle_button_get_active( audioButton ) )
02074 {
02075 if ( frame_number >= info->begin && frame_number <= info->end )
02076 {
02077 // Render the effect
02078 frames->GetFrame( pixels, info->width, info->height, NULL, frame_number );
02079 image->PreGetFrame( );
02080 image->GetFrame( pixels, frame_number );
02081 gdk_threads_enter();
02082 ShowImage( area, pixels, info->width, info->height, info->isWide );
02083 gdk_flush();
02084 gdk_threads_leave();
02085 }
02086 else
02087 {
02088 // Render video for the fore- and aft-context
02089 common->getPlayList()->GetFrame( frame_number, *( infoFrame ) );
02090 infoFrame->ExtractPreviewRGB( pixels );
02091 gdk_threads_enter();
02092 ShowImage( area, pixels, infoFrame->GetWidth(), infoFrame->GetHeight(), infoFrame->IsWide() );
02093 gdk_flush();
02094 gdk_threads_leave();
02095 }
02096 }
02097 lastFrame = frame_number;
02098 }
02099 }
02100 delete info;
02101 delete[] pixels;
02102 GetFramePool()->DoneWithFrame( infoFrame );
02103 }
|
|
|
Reimplemented from Page. Definition at line 1782 of file page_magick.cc. References movedToFrame(), previewing, and previewPosition. 01783 {
01784 if ( ! previewing )
01785 movedToFrame( previewPosition );
01786 }
|
|
|
Definition at line 220 of file page_magick.h. Referenced by AudioThread(), and PlayAudio(). |
|
|
Definition at line 222 of file page_magick.h. Referenced by AudioThread(), and PlayAudio(). |
|
|
Definition at line 216 of file page_magick.h. Referenced by GetAudioFilter(), and PageMagick(). |
|
|
Definition at line 223 of file page_magick.h. Referenced by AudioThread(), and PlayAudio(). |
|
|
Definition at line 217 of file page_magick.h. Referenced by GetAudioTransition(), PageMagick(), and start(). |
|
|
Definition at line 199 of file page_magick.h. Referenced by AudioThread(), GetCurrentPosition(), movedToFrame(), OnTimeRangeChanged(), PreviewFrame(), processCommand(), processKeyboard(), selectScene(), ShowCurrentStatus(), showFrameInfo(), start(), StartRender(), UpdateStatus(), videoBack(), videoEndOfMovie(), videoForward(), videoNextScene(), videoPlay(), videoPreviousScene(), videoStartOfMovie(), videoStop(), VideoThread(), and ~PageMagick(). |
|
|
Definition at line 221 of file page_magick.h. Referenced by PlayAudio(). |
|
|
Definition at line 213 of file page_magick.h. Referenced by GetImageCreate(), and PageMagick(). |
|
|
Definition at line 214 of file page_magick.h. Referenced by GetImageFilter(), and PageMagick(). |
|
|
Definition at line 215 of file page_magick.h. Referenced by GetImageTransition(), and PageMagick(). |
|
|
Definition at line 235 of file page_magick.h. Referenced by OnKeyFrameControllerKeyChanged(), ShowCurrentStatus(), videoNextScene(), and videoPreviousScene(). |
|
|
Definition at line 237 of file page_magick.h. Referenced by activate(), and ShowCurrentStatus(). |
|
|
Definition at line 236 of file page_magick.h. Referenced by activate(), and ShowCurrentStatus(). |
|
|
Definition at line 234 of file page_magick.h. Referenced by OnKeyFrameControllerKeyChanged(), SetKeyFrameControllerClient(), ShowCurrentStatus(), videoNextScene(), and videoPreviousScene(). |
|
|
Definition at line 230 of file page_magick.h. |
|
|
Definition at line 201 of file page_magick.h. |
|
|
Definition at line 238 of file page_magick.h. Referenced by ShowCurrentStatus(), videoNextScene(), and videoPreviousScene(). |
|
|
Definition at line 233 of file page_magick.h. Referenced by UpdateStatus(). |
|
|
Definition at line 203 of file page_magick.h. Referenced by StartRender(), UpdateStatus(), and videoPlay(). |
|
|
Definition at line 232 of file page_magick.h. Referenced by StartRender(), and UpdateStatus(). |
|
|
Definition at line 229 of file page_magick.h. Referenced by PageMagick(). |
|
|
Definition at line 204 of file page_magick.h. Referenced by AudioThread(), IsPreviewing(), PreviewFrame(), processCommand(), processKeyboard(), RefreshStatus(), selectScene(), StartPreview(), StartRender(), StopPreview(), videoPlay(), VideoThread(), and windowMoved(). |
|
|
Definition at line 208 of file page_magick.h. Referenced by AudioThread(), GetCurrentPosition(), movedToFrame(), OnTimeRangeChanged(), PreviewFrame(), showFrameInfo(), start(), videoBack(), videoEndOfMovie(), videoForward(), videoNextScene(), videoPreviousScene(), videoStartOfMovie(), and windowMoved(). |
|
|
Definition at line 206 of file page_magick.h. Referenced by PageMagick(), and UpdateProgress(). |
|
|
Definition at line 202 of file page_magick.h. Referenced by activate(), AudioThread(), PreviewFrame(), processKeyboard(), ShowCurrentStatus(), StartRender(), Stop(), and videoPlay(). |
|
|
Definition at line 205 of file page_magick.h. Referenced by IsRepainting(), and PreviewFrame(). |
|
|
Definition at line 210 of file page_magick.h. Referenced by OnTimeRangeChanged(), PageMagick(), and showFrameInfo(). |
|
|
Definition at line 209 of file page_magick.h. Referenced by PageMagick(), and StartRender(). |
|
|
Definition at line 231 of file page_magick.h. Referenced by StartRender(), and UpdateStatus(). |
|
|
Definition at line 207 of file page_magick.h. |
|
|
Definition at line 195 of file page_magick.h. Referenced by AudioThread(), GetWindow(), movedToFrame(), PageMagick(), selectScene(), ShowCurrentStatus(), start(), StartRender(), VideoThread(), and ~PageMagick(). |
1.4.2