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

PageMagickInfo Class Reference

Collaboration diagram for PageMagickInfo:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PageMagickInfo (KinoCommon *common)
 Info implementation.
 ~PageMagickInfo ()
void SetLowQuality (bool quality)
KinoCommonGetCommon ()
void Initialise ()
PageMagickFramesGetFrameSource ()
PageMagickImageGetImageManipulator ()
PageMagickAudioGetAudioManipulator ()
void SetBegin (int begin)
void SetEnd (int end)
void SetPostFrame (int postFrame)
void SetAnteFrame (int anteFrame)
void GetAnteFrame (uint8_t *pixels)
void GetPostFrame (uint8_t *pixels)
int GetPostFrame ()
int GetAnteFrame ()

Public Attributes

KinoCommoncommon
int begin
int end
double increment
bool reverse
int anteFrame
int postFrame
int width
int height
int isPAL
int isWide
int frequency
short channels
int samples_this_frame
bool preview

Private Attributes

PageMagickFramesframeSource
PageMagickImageimageManipulator
PageMagickAudioaudioManipulator

Constructor & Destructor Documentation

PageMagickInfo::PageMagickInfo KinoCommon common  ) 
 

Info implementation.

Definition at line 1230 of file page_magick.cc.

References audioManipulator, frameSource, and imageManipulator.

01230                                                    : preview( false )
01231 {
01232     this->common = common;
01233     this->frameSource = NULL;
01234     this->imageManipulator = NULL;
01235     this->audioManipulator = NULL;
01236 }

PageMagickInfo::~PageMagickInfo  ) 
 

Definition at line 1238 of file page_magick.cc.

References audioManipulator, frameSource, and imageManipulator.

01239 {
01240     delete frameSource;
01241     delete imageManipulator;
01242     delete audioManipulator;
01243 }


Member Function Documentation

int PageMagickInfo::GetAnteFrame  )  [inline]
 

Definition at line 583 of file page_magick.cc.

References anteFrame.

00584     {
00585         return this->anteFrame;
00586     }

void PageMagickInfo::GetAnteFrame uint8_t *  pixels  ) 
 

Definition at line 1427 of file page_magick.cc.

References common, GetFramePool(), KinoCommon::getPlayList(), height, preview, and width.

Referenced by PageMagickTransition::Initialise().

01428 {
01429     if ( this->anteFrame >= 0 )
01430     {
01431         Frame* infoFrame = GetFramePool()->GetFrame();
01432         common->getPlayList() ->GetFrame( this->anteFrame, *infoFrame );
01433         infoFrame->decoder->quality = DV_QUALITY_BEST;
01434         infoFrame->ExtractRGB( pixels );
01435         if ( preview )
01436         {
01437             GdkPixbuf * i1 = gdk_pixbuf_new_from_data( pixels, GDK_COLORSPACE_RGB, FALSE, 8,
01438                              width * 4, height * 4, width * 4 * 3, NULL, NULL );
01439             GdkPixbuf *i2 = gdk_pixbuf_scale_simple( i1, width, height, GDK_INTERP_NEAREST );
01440             memcpy( pixels, gdk_pixbuf_get_pixels( i2 ), width * height * 3 );
01441             g_object_unref( i2 );
01442             g_object_unref( i1 );
01443         }
01444         GetFramePool()->DoneWithFrame( infoFrame );
01445     }
01446     else
01447     {
01448         memset( pixels, 0, 720 * 576 * 3 );
01449     }
01450 }

PageMagickAudio * PageMagickInfo::GetAudioManipulator  ) 
 

Definition at line 1401 of file page_magick.cc.

References audioManipulator, PageMagickAudio::Initialise(), and lookup_widget().

Referenced by PageMagick::AudioThread(), and PageMagick::StartRender().

01402 {
01403     if ( audioManipulator == NULL )
01404     {
01405         GtkNotebook * notebook = GTK_NOTEBOOK( lookup_widget( this->common->getPageMagick() ->window, "notebook_magick_audio" ) );
01406         int page = gtk_notebook_get_current_page( notebook );
01407 
01408         switch ( page )
01409         {
01410         case 0:
01411             audioManipulator = new PageMagickAudioFilter();
01412             break;
01413         case 1:
01414             audioManipulator = new PageMagickAudioTransition();
01415             break;
01416         }
01417     }
01418 
01419     if ( audioManipulator != NULL )
01420         audioManipulator->Initialise( this );
01421     else
01422         throw _( "The requested audio manipulator has not been implemented yet..." );
01423 
01424     return audioManipulator;
01425 }

KinoCommon* PageMagickInfo::GetCommon  )  [inline]
 

Definition at line 553 of file page_magick.cc.

References common.

Referenced by PageMagickTransition::Close(), PageMagickOverwrite::Close(), PageMagickAudioTransition::Initialise(), PageMagickAudioFilter::Initialise(), PageMagickFilter::Initialise(), PageMagickTransition::Initialise(), PageMagickCreate::Initialise(), and PageMagickOverwrite::Initialise().

00554     {
00555         return this->common;
00556     }

PageMagickFrames * PageMagickInfo::GetFrameSource  ) 
 

Definition at line 1349 of file page_magick.cc.

References frameSource, PageMagickFrames::Initialise(), and lookup_widget().

Referenced by PageMagick::AudioThread(), PageMagick::GetCurrentPosition(), PageMagick::OnTimeRangeChanged(), PageMagick::PreviewFrame(), PageMagick::showFrameInfo(), PageMagick::StartRender(), PageMagick::videoBack(), PageMagick::videoEndOfMovie(), PageMagick::videoForward(), and PageMagick::VideoThread().

01350 {
01351     if ( frameSource == NULL )
01352     {
01353         GtkNotebook * notebook = GTK_NOTEBOOK( lookup_widget( this->common->getPageMagick() ->window, "notebook_magick_frames" ) );
01354         int page = gtk_notebook_get_current_page( notebook );
01355 
01356         switch ( page )
01357         {
01358         case 0:
01359             frameSource = new PageMagickOverwrite();
01360             break;
01361         case 1:
01362             frameSource = new PageMagickCreate();
01363             break;
01364         }
01365     }
01366 
01367     if ( frameSource != NULL )
01368         frameSource->Initialise( this );
01369     else
01370         throw _( "The requested frame source has not been implemented yet..." );
01371 
01372     return frameSource;
01373 }

PageMagickImage * PageMagickInfo::GetImageManipulator  ) 
 

Definition at line 1375 of file page_magick.cc.

References imageManipulator, PageMagickImage::Initialise(), and lookup_widget().

Referenced by PageMagick::AudioThread(), PageMagick::PreviewFrame(), PageMagick::StartRender(), and PageMagick::VideoThread().

01376 {
01377     if ( imageManipulator == NULL )
01378     {
01379         GtkNotebook * notebook = GTK_NOTEBOOK( lookup_widget( this->common->getPageMagick() ->window, "notebook_magick_video" ) );
01380         int page = gtk_notebook_get_current_page( notebook );
01381 
01382         switch ( page )
01383         {
01384         case 0:
01385             imageManipulator = new PageMagickFilter();
01386             break;
01387         case 1:
01388             imageManipulator = new PageMagickTransition();
01389             break;
01390         }
01391     }
01392 
01393     if ( imageManipulator != NULL )
01394         imageManipulator->Initialise( this );
01395     else
01396         throw _( "The requested image manipulator has not been implemented yet..." );
01397 
01398     return imageManipulator;
01399 }

int PageMagickInfo::GetPostFrame  )  [inline]
 

Definition at line 579 of file page_magick.cc.

References postFrame.

00580     {
00581         return this->postFrame;
00582     }

void PageMagickInfo::GetPostFrame uint8_t *  pixels  ) 
 

Definition at line 1452 of file page_magick.cc.

References common, GetFramePool(), KinoCommon::getPlayList(), height, preview, and width.

Referenced by PageMagickAudioTransition::GetFrame(), PageMagickTransition::Initialise(), and PageMagickTransition::PreGetFrame().

01453 {
01454     if ( this->postFrame < common->getPlayList() ->GetNumFrames() )
01455     {
01456         Frame* infoFrame = GetFramePool()->GetFrame();
01457         common->getPlayList() ->GetFrame( this->postFrame, *infoFrame );
01458         infoFrame->decoder->quality = DV_QUALITY_BEST;
01459         infoFrame->ExtractRGB( pixels );
01460         if ( preview )
01461         {
01462             GdkPixbuf * i1 = gdk_pixbuf_new_from_data( pixels, GDK_COLORSPACE_RGB, FALSE, 8,
01463                              width * 4, height * 4, width * 4 * 3, NULL, NULL );
01464             GdkPixbuf *i2 = gdk_pixbuf_scale_simple( i1, width, height, GDK_INTERP_NEAREST );
01465             memcpy( pixels, gdk_pixbuf_get_pixels( i2 ), width * height * 3 );
01466             g_object_unref( i2 );
01467             g_object_unref( i1 );
01468         }
01469         GetFramePool()->DoneWithFrame( infoFrame );
01470     }
01471     else
01472     {
01473         memset( pixels, 0, 720 * 576 * 3 );
01474     }
01475 }

void PageMagickInfo::Initialise  ) 
 

Definition at line 1245 of file page_magick.cc.

References ASPECT_169, AUDIO_32KHZ, AUDIO_44KHZ, AUDIO_48KHZ, channels, common, frequency, Frame::GetAudioInfo(), GetFramePool(), Preferences::getInstance(), KinoCommon::getPlayList(), height, info, Frame::IsPAL(), isPAL, isWide, modal_confirm(), NORM_NTSC, NORM_PAL, NORM_UNSPECIFIED, preview, samples_this_frame, and width.

Referenced by PageMagick::AudioThread(), PageMagick::PreviewFrame(), PageMagick::StartRender(), and PageMagick::VideoThread().

01246 {
01247     Frame* infoFrame = GetFramePool()->GetFrame();
01248     
01249     // Get a sample frame to obtain recording info
01250     if ( common->getPlayList() ->GetFrame( 0, *infoFrame ) )
01251     {
01252         // Get all video and audio info required
01253         width = infoFrame->GetWidth();
01254         height = infoFrame->GetHeight();
01255         isPAL = infoFrame->IsPAL();
01256         isWide = infoFrame->IsWide();
01257         AudioInfo info;
01258         infoFrame->GetAudioInfo( info );
01259         if ( info.channels && info.frequency )
01260         {
01261             channels = info.channels;
01262             frequency = info.frequency;
01263             samples_this_frame = frequency / ( isPAL ? 25 : 30 );
01264         }
01265         else
01266         {
01267             channels = ( short ) 2;
01268             switch ( Preferences::getInstance().defaultAudio )
01269             {
01270             case AUDIO_32KHZ:
01271                 frequency = 32000;
01272                 break;
01273             case AUDIO_44KHZ:
01274                 frequency = 44100;
01275                 break;
01276             case AUDIO_48KHZ:
01277                 frequency = 48000;
01278                 break;
01279             }
01280             samples_this_frame = frequency / ( isPAL ? 25 : 30 );
01281         }
01282     }
01283     else
01284     {
01285         if ( Preferences::getInstance().defaultNormalisation != NORM_UNSPECIFIED )
01286         {
01287             isPAL = Preferences::getInstance().defaultNormalisation == NORM_PAL;
01288         }
01289         else
01290         {
01291             switch ( modal_confirm( "PAL", "NTSC", _("Please choose a video standard") ) )
01292             {
01293             case GTK_RESPONSE_ACCEPT:
01294                 isPAL = true;
01295                 Preferences::getInstance().defaultNormalisation = NORM_PAL;
01296                 break;
01297             case GTK_RESPONSE_CLOSE:
01298                 isPAL = false;
01299                 Preferences::getInstance().defaultNormalisation = NORM_NTSC;
01300                 break;
01301             default:
01302                 // Do nothing - action cancelled
01303                 GetFramePool()->DoneWithFrame( infoFrame );
01304                 throw _("Aborted");
01305             }
01306         }
01307         width = 720;
01308         height = isPAL ? 576 : 480;
01309         isWide = Preferences::getInstance().defaultAspect == ASPECT_169;
01310         channels = ( short ) 2;
01311         switch ( Preferences::getInstance().defaultAudio )
01312         {
01313         case AUDIO_32KHZ:
01314             frequency = 32000;
01315             break;
01316         case AUDIO_44KHZ:
01317             frequency = 44100;
01318             break;
01319         case AUDIO_48KHZ:
01320             frequency = 48000;
01321             break;
01322         }
01323         samples_this_frame = frequency / ( isPAL ? 25 : 30 );
01324     }
01325     GetFramePool()->DoneWithFrame( infoFrame );
01326 
01327     preview = false;
01328 }

void PageMagickInfo::SetAnteFrame int  anteFrame  )  [inline]
 

Definition at line 573 of file page_magick.cc.

Referenced by PageMagickCreate::Initialise(), and PageMagickOverwrite::Initialise().

00574     {
00575         this->anteFrame = anteFrame;
00576     }

void PageMagickInfo::SetBegin int  begin  )  [inline]
 

Definition at line 561 of file page_magick.cc.

Referenced by PageMagickCreate::Initialise(), and PageMagickOverwrite::Initialise().

00562     {
00563         this->begin = begin > 0 ? begin : 0;
00564     }

void PageMagickInfo::SetEnd int  end  )  [inline]
 

Definition at line 565 of file page_magick.cc.

Referenced by PageMagickCreate::Initialise(), and PageMagickOverwrite::Initialise().

00566     {
00567         this->end = end > 0 ? end : 0;
00568     }

void PageMagickInfo::SetLowQuality bool  quality  ) 
 

Definition at line 1330 of file page_magick.cc.

References height, preview, and width.

Referenced by PageMagick::AudioThread(), PageMagick::PreviewFrame(), and PageMagick::VideoThread().

01331 {
01332     if ( preview != low_quality )
01333     {
01334         if ( low_quality )
01335         {
01336             width /= 4;
01337             height /= 4;
01338         }
01339         else
01340         {
01341             width *= 4;
01342             height *= 4;
01343         }
01344 
01345         preview = low_quality;
01346     }
01347 }

void PageMagickInfo::SetPostFrame int  postFrame  )  [inline]
 

Definition at line 569 of file page_magick.cc.

Referenced by PageMagickCreate::Initialise(), and PageMagickOverwrite::Initialise().

00570     {
00571         this->postFrame = postFrame;
00572     }


Member Data Documentation

int PageMagickInfo::anteFrame
 

Definition at line 540 of file page_magick.cc.

Referenced by GetAnteFrame().

PageMagickAudio* PageMagickInfo::audioManipulator [private]
 

Definition at line 533 of file page_magick.cc.

Referenced by GetAudioManipulator(), PageMagickInfo(), and ~PageMagickInfo().

int PageMagickInfo::begin
 

Definition at line 536 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), PageMagickTransition::Close(), PageMagickOverwrite::Close(), PageMagick::GetCurrentPosition(), PageMagickCreate::Initialise(), PageMagickOverwrite::Initialise(), PageMagick::OnTimeRangeChanged(), PageMagick::PreviewFrame(), PageMagick::showFrameInfo(), PageMagick::StartRender(), PageMagick::videoEndOfMovie(), PageMagick::videoForward(), and PageMagick::VideoThread().

short PageMagickInfo::channels
 

Definition at line 547 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), PageMagickAudioTransition::GetFrame(), PageMagickAudioFilter::GetFrame(), PageMagickCreate::GetFrame(), Initialise(), and PageMagick::StartRender().

KinoCommon* PageMagickInfo::common
 

Definition at line 535 of file page_magick.cc.

Referenced by GetAnteFrame(), GetCommon(), GetPostFrame(), and Initialise().

int PageMagickInfo::end
 

Definition at line 537 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), PageMagickTransition::Close(), PageMagickOverwrite::Close(), PageMagickOverwrite::Initialise(), PageMagick::OnTimeRangeChanged(), PageMagickFilter::PreGetFrame(), PageMagickTransition::PreGetFrame(), PageMagick::PreviewFrame(), PageMagick::showFrameInfo(), PageMagick::StartRender(), PageMagick::videoEndOfMovie(), and PageMagick::videoForward().

PageMagickFrames* PageMagickInfo::frameSource [private]
 

Definition at line 531 of file page_magick.cc.

Referenced by GetFrameSource(), PageMagickInfo(), and ~PageMagickInfo().

int PageMagickInfo::frequency
 

Definition at line 546 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), PageMagickAudioTransition::GetFrame(), PageMagickAudioFilter::GetFrame(), PageMagickCreate::GetFrame(), PageMagickOverwrite::GetFrame(), Initialise(), and PageMagick::StartRender().

int PageMagickInfo::height
 

Definition at line 543 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), GetAnteFrame(), PageMagickFilter::GetFrame(), PageMagickTransition::GetFrame(), PageMagickCreate::GetFrame(), GetPostFrame(), Initialise(), PageMagickTransition::Initialise(), PageMagick::PreviewFrame(), SetLowQuality(), PageMagick::StartRender(), and PageMagick::VideoThread().

PageMagickImage* PageMagickInfo::imageManipulator [private]
 

Definition at line 532 of file page_magick.cc.

Referenced by GetImageManipulator(), PageMagickInfo(), and ~PageMagickInfo().

double PageMagickInfo::increment
 

Definition at line 538 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), PageMagickTransition::Close(), PageMagickCreate::Initialise(), PageMagickOverwrite::Initialise(), PageMagick::PreviewFrame(), and PageMagick::StartRender().

int PageMagickInfo::isPAL
 

Definition at line 544 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), Initialise(), PageMagickCreate::Initialise(), and PageMagick::StartRender().

int PageMagickInfo::isWide
 

Definition at line 545 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), Initialise(), PageMagick::PreviewFrame(), PageMagick::StartRender(), and PageMagick::VideoThread().

int PageMagickInfo::postFrame
 

Definition at line 541 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), GetPostFrame(), PageMagickFilter::PreGetFrame(), and PageMagickTransition::PreGetFrame().

bool PageMagickInfo::preview
 

Definition at line 549 of file page_magick.cc.

Referenced by GetAnteFrame(), GetPostFrame(), Initialise(), and SetLowQuality().

bool PageMagickInfo::reverse
 

Definition at line 539 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), PageMagickCreate::Initialise(), PageMagickOverwrite::Initialise(), PageMagick::PreviewFrame(), and PageMagick::StartRender().

int PageMagickInfo::samples_this_frame
 

Definition at line 548 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), PageMagickCreate::GetFrame(), PageMagickOverwrite::GetFrame(), Initialise(), and PageMagick::StartRender().

int PageMagickInfo::width
 

Definition at line 542 of file page_magick.cc.

Referenced by PageMagick::AudioThread(), GetAnteFrame(), PageMagickFilter::GetFrame(), PageMagickTransition::GetFrame(), PageMagickCreate::GetFrame(), GetPostFrame(), Initialise(), PageMagick::PreviewFrame(), SetLowQuality(), and PageMagick::VideoThread().


The documentation for this class was generated from the following file:
Generated on Sun Mar 11 22:13:18 2007 for Kino by  doxygen 1.4.2