summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/loopcontrol_threaded.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/loopcontrol_threaded.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/loopcontrol_threaded.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
index 3796549..0a1fc17 100644
--- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp
+++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
@@ -536,89 +536,89 @@ bool LoopControl::init( const QString& filename ) {
536 536
537 if ( !total_audio_samples ) 537 if ( !total_audio_samples )
538 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); 538 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream );
539 539
540 mediaPlayerState->setLength( total_audio_samples ); 540 mediaPlayerState->setLength( total_audio_samples );
541 541
542 freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); 542 freq = mediaPlayerState->curDecoder()->audioFrequency( astream );
543 DecodeLoopDebug(( "frequency = %d\n", freq )); 543 DecodeLoopDebug(( "frequency = %d\n", freq ));
544 544
545 audioSampleCounter = 0; 545 audioSampleCounter = 0;
546 546
547 static const int bytes_per_sample = 2; //16 bit 547 static const int bytes_per_sample = 2; //16 bit
548 548
549 audioDevice = new AudioDevice( freq, channels, bytes_per_sample ); 549 audioDevice = new AudioDevice( freq, channels, bytes_per_sample );
550 audioBuffer = new char[ audioDevice->bufferSize() ]; 550 audioBuffer = new char[ audioDevice->bufferSize() ];
551 channels = audioDevice->channels(); 551 channels = audioDevice->channels();
552 552
553 //### must check which frequency is actually used. 553 //### must check which frequency is actually used.
554 static const int size = 1; 554 static const int size = 1;
555 short int buf[size]; 555 short int buf[size];
556 long samplesRead = 0; 556 long samplesRead = 0;
557 mediaPlayerState->curDecoder()->audioReadSamples( buf, channels, size, samplesRead, stream ); 557 mediaPlayerState->curDecoder()->audioReadSamples( buf, channels, size, samplesRead, stream );
558 } 558 }
559 559
560 if ( hasVideoChannel ) { 560 if ( hasVideoChannel ) {
561 total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream ); 561 total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream );
562 562
563 mediaPlayerState->setLength( total_video_frames ); 563 mediaPlayerState->setLength( total_video_frames );
564 564
565 framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream ); 565 framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream );
566 DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames )); 566 DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames ));
567 567
568 if ( framerate <= 1.0 ) { 568 if ( framerate <= 1.0 ) {
569 DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" )); 569 DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" ));
570 framerate = 25; 570 framerate = 25;
571 } 571 }
572 572
573 if ( total_video_frames == 1 ) { 573 if ( total_video_frames == 1 ) {
574 DecodeLoopDebug(( "Cannot seek to frame" )); 574 DecodeLoopDebug(( "Cannot seek to frame" ));
575 } 575 }
576 576
577 } 577 }
578 578
579 videoMutex->lock(); 579 videoMutex->lock();
580 current_frame = 0; 580 current_frame = 0;
581 prev_frame = -1; 581 prev_frame = -1;
582 videoMutex->unlock(); 582 videoMutex->unlock();
583 583
584 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( setPosition( long ) ) ); 584 connect( mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( setPosition(long) ) );
585 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( setPaused( bool ) ) ); 585 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
586 586
587 //setBackgroundColor( black ); 587 //setBackgroundColor( black );
588 return TRUE; 588 return TRUE;
589} 589}
590 590
591 591
592void LoopControl::play() { 592void LoopControl::play() {
593 593
594#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 594#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
595 if ( !disabledSuspendScreenSaver ) { 595 if ( !disabledSuspendScreenSaver ) {
596 disabledSuspendScreenSaver = TRUE; 596 disabledSuspendScreenSaver = TRUE;
597 // Stop the screen from blanking and power saving state 597 // Stop the screen from blanking and power saving state
598 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) 598 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
599 << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 599 << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend );
600 } 600 }
601#endif 601#endif
602 602
603 //begin = clock(); 603 //begin = clock();
604 playtime.start(); 604 playtime.start();
605 startTimers(); 605 startTimers();
606 //updateGeometry(); 606 //updateGeometry();
607} 607}
608 608
609 609
610void LoopControl::setMute( bool on ) { 610void LoopControl::setMute( bool on ) {
611 if ( isMuted != on ) { 611 if ( isMuted != on ) {
612 isMuted = on; 612 isMuted = on;
613 if ( isMuted ) { 613 if ( isMuted ) {
614 } else { 614 } else {
615 int frame = current_frame; // mediaPlayerState->curDecoder()->videoGetFrame( stream ); 615 int frame = current_frame; // mediaPlayerState->curDecoder()->videoGetFrame( stream );
616 playtime.restart(); 616 playtime.restart();
617 playtime = playtime.addMSecs( -frame * 1000 / framerate ); 617 playtime = playtime.addMSecs( -frame * 1000 / framerate );
618 //begin = clock() - (double)frame * CLOCKS_PER_SEC / framerate; 618 //begin = clock() - (double)frame * CLOCKS_PER_SEC / framerate;
619 mediaPlayerState->curDecoder()->audioSetSample( frame*freq/framerate, stream ); 619 mediaPlayerState->curDecoder()->audioSetSample( frame*freq/framerate, stream );
620 } 620 }
621 } 621 }
622} 622}
623 623
624 624