

Public Member Functions | |
| void | Initialise (PageMagick *page) |
| int | GetNumInputFrames () |
| bool | IsEffectReversed () |
| double | GetRealStart () |
| double | GetRealEnd () |
| int | GetNumOutputFrames () |
| double | GetPosition (int index) |
| double | GetFrameDelta () |
| int | GetIndex (double position) |
| void | GetScaledImage (int index, uint8_t *image, int width=0, int height=0) |
| void | GetImageA (double position, uint8_t *image, int width=0, int height=0) |
| void | GetImageB (double position, uint8_t *image, int width=0, int height=0) |
| void | GetAudio (int index, int16_t **audio, short int &channels, int &frequency, int &samples) |
| void | GetAudioA (double position, int16_t **audio, short int &channels, int &frequency, int &samples) |
| void | GetAudioB (double position, int16_t **audio, short int &channels, int &frequency, int &samples) |
| void | Repaint () |
| bool | IsRepainting () |
| bool | IsPreviewing () |
Protected Attributes | |
| bool | seekable |
| int | start |
| int | end |
| double | increment |
| bool | frames_reverse |
| bool | effect_reverse |
| double | real_start |
| double | real_end |
| int | b_frame_type |
| GdkColor | color |
| PageMagick * | magick |
|
||||||||||||||||||||||||
|
Definition at line 3188 of file page_magick.cc. References Frame::ExtractAudio(), Frame::GetAudioInfo(), GetCurrentPlayList(), PlayList::GetFrame(), GetFramePool(), Frame::GetFrameRate(), PlayList::GetNumFrames(), and info. Referenced by GetAudioA(), and GetAudioB(). 03189 {
03190 // Get the current playlist
03191 PlayList & list = GetCurrentPlayList();
03192
03193 if ( index >= 0 && index < list.GetNumFrames( ) )
03194 {
03195 // Get a frame to work with
03196 Frame & frame = *( GetFramePool() ->GetFrame() );
03197
03198 // Obtain the frame as specified by the index
03199 list.GetFrame( index, frame );
03200
03201 // Extract the audio
03202 if ( frame.ExtractAudio( audio ) )
03203 {
03204 // Update the info
03205 AudioInfo info;
03206 frame.GetAudioInfo( info );
03207 channels = info.channels;
03208 frequency = info.frequency;
03209 samples = info.samples;
03210 }
03211 else
03212 {
03213 channels = 2;
03214 // XXX: frequency not known! But are any plugins really using this?
03215 frequency = 48000;
03216 samples = frequency / int( frame.GetFrameRate() );
03217 for ( int i = 0; i < channels; i++ )
03218 memset( audio[i], 0, samples * sizeof(int16_t) );
03219 }
03220 // Return the frame to the pool
03221 GetFramePool() ->DoneWithFrame( &frame );
03222 }
03223 else if ( list.GetNumFrames( ) )
03224 {
03225 // Get a frame to work with
03226 Frame & frame = *( GetFramePool() ->GetFrame() );
03227
03228 // Obtain the frame as specified by the index
03229 list.GetFrame( index, frame );
03230
03231 // Update the info
03232 AudioInfo info;
03233 frame.GetAudioInfo( info );
03234 channels = info.channels;
03235 frequency = info.frequency;
03236 samples = info.samples;
03237
03238 // Wipe the audio
03239 for ( int i = 0; i < channels; i ++ )
03240 memset( audio[ i ], 0, samples * sizeof( int16_t ) );
03241
03242 // Return the frame to the pool
03243 GetFramePool() ->DoneWithFrame( &frame );
03244 }
03245 }
|
|
||||||||||||||||||||||||
|
Implements SelectedFrames. Definition at line 3247 of file page_magick.cc. References GetAudio(), GetIndex(), and start. 03248 {
03249 GetAudio( start + GetIndex( position ), audio, channels, frequency, samples );
03250 }
|
|
||||||||||||||||||||||||
|
Implements SelectedFrames. Definition at line 3252 of file page_magick.cc. References b_frame_type, end, GetAudio(), and GetNumInputFrames(). 03253 {
03254 switch ( b_frame_type )
03255 {
03256 case 0:
03257 GetAudio( ( int ) ( end + 1 + position * GetNumInputFrames( ) ), audio, channels, frequency, samples );
03258 break;
03259 case - 1:
03260 case 1:
03261 case 2:
03262 case 3:
03263 GetAudio( -1, audio, channels, frequency, samples );
03264 break;
03265 }
03266 }
|
|
|
Implements SelectedFrames. Definition at line 3082 of file page_magick.cc. References GetNumOutputFrames(). 03083 {
03084 return 1 / GetNumOutputFrames( );
03085 }
|
|
||||||||||||||||||||
|
Implements SelectedFrames. Definition at line 3155 of file page_magick.cc. References GetIndex(), GetScaledImage(), and start. 03156 {
03157 GetScaledImage( start + GetIndex( position ), image, width, height );
03158 }
|
|
||||||||||||||||||||
|
Implements SelectedFrames. Definition at line 3160 of file page_magick.cc. References b_frame_type, color, end, GetNumInputFrames(), GetScaledImage(), and start. 03161 {
03162 switch ( b_frame_type )
03163 {
03164 case 1:
03165 GetScaledImage( ( int ) ( end + 1 ), image, width, height );
03166 break;
03167 case 2:
03168 GetScaledImage( ( int ) ( start - 1 ), image, width, height );
03169 break;
03170 case 0:
03171 GetScaledImage( ( int ) ( end + 1 + position * GetNumInputFrames( ) ), image, width, height );
03172 break;
03173 case - 1:
03174 case 3:
03175 {
03176 uint8_t *end = image + width * height * 3;
03177 for ( uint8_t * p = image; p < end; )
03178 {
03179 *p ++ = color.red >> 8;
03180 *p ++ = color.green >> 8;
03181 *p ++ = color.blue >> 8;
03182 }
03183 }
03184 break;
03185 }
03186 }
|
|
|
Implements SelectedFrames. Definition at line 3087 of file page_magick.cc. References frames_reverse, and GetNumOutputFrames(). Referenced by GetAudioA(), and GetImageA(). 03088 {
03089 if ( frames_reverse )
03090 position = 1 - position;
03091 return ( int ) ( GetNumOutputFrames( ) * position + 0.5 );
03092 }
|
|
|
Implements SelectedFrames. Definition at line 3049 of file page_magick.cc. References end, seekable, and start. Referenced by GetAudioB(), GetImageB(), and GetNumOutputFrames().
|
|
|
Implements SelectedFrames. Definition at line 3072 of file page_magick.cc. References GetNumInputFrames(), and increment. Referenced by GetFrameDelta(), GetIndex(), and GetPosition(). 03073 {
03074 return ( int ) ( GetNumInputFrames( ) / increment );
03075 }
|
|
|
Implements SelectedFrames. Definition at line 3077 of file page_magick.cc. References GetNumOutputFrames(). 03078 {
03079 return index / GetNumOutputFrames( );
03080 }
|
|
|
Implements SelectedFrames. Definition at line 3067 of file page_magick.cc. References real_end. 03068 {
03069 return real_end;
03070 }
|
|
|
Implements SelectedFrames. Definition at line 3062 of file page_magick.cc. References real_start. 03063 {
03064 return real_start;
03065 }
|
|
||||||||||||||||||||
|
Definition at line 3094 of file page_magick.cc. References color, end, GetCurrentPlayList(), PlayList::GetFrame(), GetFramePool(), and PlayList::GetNumFrames(). Referenced by GetImageA(), and GetImageB(). 03095 {
03096 // Get the current playlist
03097 PlayList & list = GetCurrentPlayList();
03098
03099 if ( index >= 0 && index < list.GetNumFrames( ) )
03100 {
03101 // Get a frame to work with
03102 Frame & frame = *( GetFramePool() ->GetFrame() );
03103
03104 frame.decoder->quality = DV_QUALITY_BEST;
03105
03106 // Obtain the frame as specified by the index
03107 list.GetFrame( index, frame );
03108
03109 // If the width and height is specified
03110 if ( width != 0 && height != 0 )
03111 {
03112 // Create a temporary space to hold the full RGB image
03113 uint8_t * temp = new uint8_t[ frame.GetWidth( ) * frame.GetHeight( ) * 3 ];
03114
03115 // Extract it
03116 frame.ExtractRGB( temp );
03117
03118 // Convert to a GDK Image
03119 GdkPixbuf *im1 = gdk_pixbuf_new_from_data( temp, GDK_COLORSPACE_RGB, FALSE, 8,
03120 frame.GetWidth( ), frame.GetHeight( ), frame.GetWidth( ) * 3, NULL, NULL );
03121
03122 // Clone and scale
03123 GdkPixbuf *im2 = gdk_pixbuf_scale_simple( im1, width, height, GDK_INTERP_HYPER );
03124
03125 // Copy it into the image
03126 memcpy( image, gdk_pixbuf_get_pixels( im2 ), width * height * 3 );
03127
03128 // Destroy the GDK images
03129 g_object_unref( im2 );
03130 g_object_unref( im1 );
03131
03132 // Delete the temporary space
03133 delete[] temp;
03134 }
03135 else
03136 {
03137 // Extract it
03138 frame.ExtractRGB( image );
03139 }
03140
03141 GetFramePool() ->DoneWithFrame( &frame );
03142 }
03143 else
03144 {
03145 uint8_t *end = image + width * height * 3;
03146 for ( uint8_t * p = image; p < end; )
03147 {
03148 *p ++ = color.red >> 8;
03149 *p ++ = color.green >> 8;
03150 *p ++ = color.blue >> 8;
03151 }
03152 }
03153 }
|
|
|
Definition at line 2943 of file page_magick.cc. References b_frame_type, color, effect_reverse, end, frames_reverse, GetCurrentPlayList(), increment, lookup_widget(), magick, real_end, real_start, seekable, and start. Referenced by GetSelectedFramesForFX(). 02944 {
02945 GtkNotebook * notebook = GTK_NOTEBOOK( lookup_widget( page->window, "notebook_magick_frames" ) );
02946 int source = gtk_notebook_get_current_page( notebook );
02947 magick = page;
02948
02949 if ( source == 0 )
02950 {
02951 // Obtain begining and ending of sequence
02952 start = 0;
02953 end = GetCurrentPlayList().GetNumFrames();
02954 increment = 1;
02955 frames_reverse = false;
02956 effect_reverse = false;
02957 real_start = 0;
02958 real_end = 1;
02959
02960 GtkEntry *startSpin = GTK_ENTRY( lookup_widget( page->window, "spinbutton_magick_start" ) );
02961 GtkEntry *endSpin = GTK_ENTRY( lookup_widget( page->window, "spinbutton_magick_end" ) );
02962
02963 if ( GetCurrentPlayList().GetNumFrames() != 0 )
02964 {
02965 seekable = true;
02966 start = atoi( gtk_entry_get_text( startSpin ) );
02967 end = atoi( gtk_entry_get_text( endSpin ) );
02968 GtkToggleButton *limit = GTK_TOGGLE_BUTTON( lookup_widget( page->window, "checkbutton_magick_frame_limit" ) );
02969 if ( gtk_toggle_button_get_active( limit ) )
02970 {
02971 GtkEntry * spin = GTK_ENTRY( lookup_widget( page->window, "spinbutton_magick_limit" ) );
02972 GtkMenu *menu = GTK_MENU( gtk_option_menu_get_menu( GTK_OPTION_MENU( lookup_widget( page->window, "optionmenu_magick_frame_offset" ) ) ) );
02973 GtkWidget *active_item = gtk_menu_get_active( menu );
02974 if ( g_list_index ( GTK_MENU_SHELL ( menu ) ->children, active_item ) == 1 )
02975 {
02976 int requested_end = start + atoi( gtk_entry_get_text( spin ) ) - 1;
02977 if ( requested_end < end )
02978 end = requested_end;
02979 }
02980 else
02981 {
02982 start = end - atoi( gtk_entry_get_text( spin ) ) + 1;
02983 }
02984 }
02985 }
02986 else
02987 {
02988 seekable = false;
02989 }
02990
02991 // Determine speed
02992 GtkToggleButton *speed = GTK_TOGGLE_BUTTON( lookup_widget( page->window, "checkbutton_speed" ) );
02993 if ( gtk_toggle_button_get_active( speed ) )
02994 {
02995 GtkRange * range = GTK_RANGE( lookup_widget( page->window, "hscale_speed" ) );
02996 increment = range->adjustment->value;
02997 }
02998
02999 // Determine direction
03000 GtkToggleButton *reverse_button = GTK_TOGGLE_BUTTON( lookup_widget( page->window, "checkbutton_reverse" ) );
03001 frames_reverse = gtk_toggle_button_get_active( reverse_button );
03002 }
03003 else
03004 {
03005 seekable = false;
03006 }
03007
03008 // Check if we're reversed (currently only image transitions have a global effect reverse)
03009 GtkNotebook *notebookImage = GTK_NOTEBOOK( lookup_widget( page->window, "notebook_magick_video" ) );
03010
03011 int current = gtk_notebook_get_current_page( notebookImage );
03012
03013 if ( current == 1 )
03014 {
03015 GtkMenu * menu = GTK_MENU( gtk_option_menu_get_menu( GTK_OPTION_MENU( lookup_widget( page->window, "optionmenu_direction" ) ) ) );
03016 GtkWidget *active_item = gtk_menu_get_active( menu );
03017 effect_reverse = g_list_index ( GTK_MENU_SHELL ( menu ) ->children, active_item ) == 1;
03018
03019 GtkRange *range = GTK_RANGE( lookup_widget( page->window, "hscale_transition_start" ) );
03020 real_start = range->adjustment->value;
03021 range = GTK_RANGE( lookup_widget( page->window, "hscale_transition_end" ) );
03022 real_end = range->adjustment->value;
03023
03024 GtkColorButton *colorButton = GTK_COLOR_BUTTON( lookup_widget( page->window, "colorpicker_magick_transition" ) );
03025 gtk_color_button_get_color( colorButton, &color );
03026
03027 GtkToggleButton *toggle = GTK_TOGGLE_BUTTON( lookup_widget( page->window, "radiobutton_magick_transition_colour" ) );
03028
03029 if ( !gtk_toggle_button_get_active( toggle ) )
03030 {
03031 GtkMenu * menu = GTK_MENU( gtk_option_menu_get_menu( GTK_OPTION_MENU( lookup_widget( page->window, "optionmenu_magick_transition_frame" ) ) ) );
03032 GtkWidget *active_item = gtk_menu_get_active( menu );
03033 b_frame_type = g_list_index ( GTK_MENU_SHELL ( menu ) ->children, active_item );
03034 }
03035 else
03036 {
03037 b_frame_type = 3;
03038 }
03039 }
03040 else
03041 {
03042 b_frame_type = -1;
03043 effect_reverse = false;
03044 real_start = 0;
03045 real_end = 1;
03046 }
03047 }
|
|
|
Implements SelectedFrames. Definition at line 3057 of file page_magick.cc. References effect_reverse. 03058 {
03059 return effect_reverse;
03060 }
|
|
|
Implements SelectedFrames. Definition at line 3281 of file page_magick.cc. References PageMagick::IsPreviewing(), and magick. 03282 {
03283 return magick->IsPreviewing();
03284 }
|
|
|
Implements SelectedFrames. Definition at line 3276 of file page_magick.cc. References PageMagick::IsRepainting(), and magick. 03277 {
03278 return magick->IsRepainting();
03279 }
|
|
|
Implements SelectedFrames. Definition at line 3268 of file page_magick.cc. References magick, and PageMagick::PreviewFrame(). 03269 {
03270 while ( gtk_events_pending() )
03271 gtk_main_iteration();
03272 if ( magick )
03273 magick->PreviewFrame();
03274 }
|
|
|
Definition at line 2938 of file page_magick.cc. Referenced by GetAudioB(), GetImageB(), and Initialise(). |
|
|
Definition at line 2939 of file page_magick.cc. Referenced by GetImageB(), GetScaledImage(), and Initialise(). |
|
|
Definition at line 2935 of file page_magick.cc. Referenced by Initialise(), and IsEffectReversed(). |
|
|
Definition at line 2932 of file page_magick.cc. Referenced by GetAudioB(), GetImageB(), GetNumInputFrames(), GetScaledImage(), and Initialise(). |
|
|
Definition at line 2934 of file page_magick.cc. Referenced by GetIndex(), and Initialise(). |
|
|
Definition at line 2933 of file page_magick.cc. Referenced by GetNumOutputFrames(), and Initialise(). |
|
|
Definition at line 2940 of file page_magick.cc. Referenced by Initialise(), IsPreviewing(), IsRepainting(), and Repaint(). |
|
|
Definition at line 2937 of file page_magick.cc. Referenced by GetRealEnd(), and Initialise(). |
|
|
Definition at line 2936 of file page_magick.cc. Referenced by GetRealStart(), and Initialise(). |
|
|
Definition at line 2930 of file page_magick.cc. Referenced by GetNumInputFrames(), and Initialise(). |
|
|
Definition at line 2931 of file page_magick.cc. Referenced by GetAudioA(), GetImageA(), GetImageB(), GetNumInputFrames(), and Initialise(). |
1.4.2