Ticket #2434: 2434-v1.patch
File 2434-v1.patch, 6.2 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
446 446 return (actuallypaused && 447 447 (ringBuffer == NULL || ringBuffer->isPaused()) && 448 448 (audioOutput == NULL || audioOutput->GetPause()) && 449 GetVideoPause());449 IsVideoActuallyPaused()); 450 450 } 451 451 452 452 void NuppelVideoPlayer::PauseVideo(bool wait) 453 453 { 454 QMutexLocker locker(&pauseUnpauseLock); 454 455 video_actually_paused = false; 455 456 pausevideo = true; 456 457 457 if (wait && !video_actually_paused)458 for (uint i = 0; wait && !video_actually_paused; i++) 458 459 { 459 while (!videoThreadPaused.wait(1000)) 460 { 461 if (eof) 462 return; 460 videoThreadPaused.wait(&pauseUnpauseLock, 250); 461 462 if (video_actually_paused || eof) 463 break; 464 465 if ((i % 10) == 9) 463 466 VERBOSE(VB_IMPORTANT, "Waited too long for video out to pause"); 464 }465 467 } 466 468 } 467 469 468 void NuppelVideoPlayer::UnpauseVideo( void)470 void NuppelVideoPlayer::UnpauseVideo(bool wait) 469 471 { 472 QMutexLocker locker(&pauseUnpauseLock); 470 473 pausevideo = false; 474 475 for (uint i = 0; wait && video_actually_paused; i++) 476 { 477 videoThreadUnpaused.wait(&pauseUnpauseLock, 250); 478 479 if (!video_actually_paused || eof) 480 break; 481 482 if ((i % 10) == 9) 483 VERBOSE(VB_IMPORTANT, "Waited too long for video out to unpause"); 484 } 471 485 } 472 486 487 void NuppelVideoPlayer::SetVideoActuallyPaused(bool val) 488 { 489 QMutexLocker locker(&pauseUnpauseLock); 490 video_actually_paused = val; 491 492 if (val) 493 videoThreadPaused.wakeAll(); 494 else 495 videoThreadUnpaused.wakeAll(); 496 } 497 473 498 void NuppelVideoPlayer::SetPrebuffering(bool prebuffer) 474 499 { 475 500 prebuffering_lock.lock(); … … 2301 2326 resetvideo = false; 2302 2327 } 2303 2328 2304 video_actually_paused = true; 2305 videoThreadPaused.wakeAll(); 2329 SetVideoActuallyPaused(true); 2306 2330 2307 2331 if (videoOutput->IsErrored()) 2308 2332 { … … 2401 2425 2402 2426 void NuppelVideoPlayer::DisplayNormalFrame(void) 2403 2427 { 2404 video_actually_paused = false;2428 SetVideoActuallyPaused(false); 2405 2429 resetvideo = false; 2406 2430 2407 2431 if (!ringBuffer->InDVDMenuOrStillFrame() || … … 2687 2711 } 2688 2712 2689 2713 resetvideo = false; 2690 video_actually_paused = pausevideo;2714 SetVideoActuallyPaused(pausevideo); 2691 2715 2692 2716 if (pausevideo) 2693 2717 { 2694 videoThreadPaused.wakeAll();2695 2718 videofiltersLock.lock(); 2696 2719 videoOutput->ProcessFrame(NULL, osd, videoFilters, pipplayer); 2697 2720 videofiltersLock.unlock(); … … 3330 3353 3331 3354 if (rewindtime >= 1) 3332 3355 { 3333 PauseVideo(); 3334 3356 PauseVideo(true); 3335 3357 DoRewind(); 3336 3337 UnpauseVideo(); 3338 while (GetVideoPause()) 3339 usleep(1000); 3358 UnpauseVideo(true); 3340 3359 } 3341 3360 rewindtime = 0; 3342 3361 } … … 3347 3366 3348 3367 if (fftime >= 5) 3349 3368 { 3350 PauseVideo( );3369 PauseVideo(true); 3351 3370 3352 3371 if (fftime >= 5) 3353 3372 DoFastForward(); … … 3355 3374 if (eof) 3356 3375 continue; 3357 3376 3358 UnpauseVideo(); 3359 while (GetVideoPause()) 3360 usleep(1000); 3377 UnpauseVideo(true); 3361 3378 } 3362 3379 3363 3380 fftime = 0; … … 3365 3382 3366 3383 if (need_change_dvd_track) 3367 3384 { 3368 PauseVideo(); 3369 3385 PauseVideo(true); 3370 3386 DoChangeDVDTrack(); 3387 UnpauseVideo(true); 3371 3388 3372 UnpauseVideo();3373 while (GetVideoPause())3374 usleep(1000);3375 3376 3389 need_change_dvd_track = 0; 3377 3390 } 3378 3391 3379 3392 if (skipcommercials != 0 && ffrew_skip == 1) 3380 3393 { 3381 PauseVideo(); 3382 3394 PauseVideo(true); 3383 3395 DoSkipCommercials(skipcommercials); 3384 UnpauseVideo(); 3385 while (GetVideoPause()) 3386 usleep(1000); 3396 UnpauseVideo(true); 3387 3397 3388 3398 skipcommercials = 0; 3389 3399 continue; … … 3416 3426 } 3417 3427 else 3418 3428 { 3419 PauseVideo( );3429 PauseVideo(true); 3420 3430 JumpToFrame(deleteIter.key()); 3421 UnpauseVideo(); 3422 while (GetVideoPause()) 3423 usleep(1000); 3431 UnpauseVideo(true); 3424 3432 } 3425 3433 } 3426 3434 } … … 5672 5680 .arg(commBreakIter.key() - 5673 5681 (int)(commrewindamount * video_frame_rate))); 5674 5682 5675 PauseVideo( );5683 PauseVideo(true); 5676 5684 JumpToFrame(commBreakIter.key() - 5677 5685 (int)(commrewindamount * video_frame_rate)); 5678 UnpauseVideo(); 5679 while (GetVideoPause()) 5680 usleep(1000); 5686 UnpauseVideo(true); 5681 5687 5682 5688 GetFrame(1, true); 5683 5689 } -
libs/libmythtv/NuppelVideoPlayer.h
414 414 415 415 // Private pausing stuff 416 416 void PauseVideo(bool wait = true); 417 void UnpauseVideo(void); 418 bool GetVideoPause(void) const { return video_actually_paused; } 417 void UnpauseVideo(bool wait = false); 418 bool IsVideoActuallyPaused(void) const { return video_actually_paused; } 419 void SetVideoActuallyPaused(bool val); 419 420 420 421 // Private decoder stuff 421 422 void SetDecoder(DecoderBase *dec); … … 520 521 // State 521 522 QWaitCondition decoderThreadPaused; 522 523 QWaitCondition videoThreadPaused; 524 QWaitCondition videoThreadUnpaused; 523 525 QMutex vidExitLock; 526 QMutex pauseUnpauseLock; 524 527 bool eof; ///< At end of file/ringbuffer 525 528 bool m_double_framerate;///< Output fps is double Video (input) rate 526 529 bool m_can_double; ///< VideoOutput capable of doubling frame rate