Changeset 846 for trunk/src/3rdparty/phonon/qt7
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/3rdparty/phonon/qt7/audionode.h
r2 r846 73 73 74 74 // Only the following methods needs to 75 // be over idden by only_one-audio-unit nodes:75 // be overridden by only_one-audio-unit nodes: 76 76 virtual ComponentDescription getAudioNodeDescription() const; 77 77 virtual void initializeAudioUnit(); -
trunk/src/3rdparty/phonon/qt7/audionode.mm
r2 r846 78 78 // deal with at the moment, so we'll take the "deprecated" warning instead. 79 79 err = AUGraphNewNode(m_audioGraph->audioGraphRef(), &description, 0, 0, &m_auNode); 80 80 81 BACKEND_ASSERT2(err != kAUGraphErr_OutputNodeErr, "A MediaObject can only be connected to one audio output device.", FATAL_ERROR) 81 82 BACKEND_ASSERT2(err == noErr, "Could not create new AUNode.", FATAL_ERROR) -
trunk/src/3rdparty/phonon/qt7/backendinfo.mm
r2 r846 16 16 */ 17 17 18 #include "backendinfo.h"19 #include "backendheader.h"20 21 #include <AudioToolbox/AudioToolbox.h>22 #include <AudioUnit/AudioUnit.h>23 #include <CoreServices/CoreServices.h>24 25 #include <QtGui/qmacdefines_mac.h>26 18 #import <QTKit/QTMovie.h> 27 28 19 #ifdef QUICKTIME_C_API_AVAILABLE 29 20 #include <QuickTime/QuickTime.h> 30 21 #undef check // avoid name clash; 31 22 #endif 23 24 #include "backendinfo.h" 25 #include "backendheader.h" 26 27 #include <AudioToolbox/AudioToolbox.h> 28 #include <AudioUnit/AudioUnit.h> 29 #include <CoreServices/CoreServices.h> 30 32 31 33 32 QT_BEGIN_NAMESPACE -
trunk/src/3rdparty/phonon/qt7/mediaobject.h
r561 r846 26 26 #include "medianode.h" 27 27 28 #if QT_ALLOW_QUICKTIME29 #include <QuickTime/QuickTime.h>30 #endif31 32 28 QT_BEGIN_NAMESPACE 33 29 … … 43 39 44 40 class MediaObject : public MediaNode, 45 public Phonon::MediaObjectInterface 46 #ifndef QT_NO_PHONON_MEDIACONTROLLER 47 , public Phonon::AddonInterface 48 #endif 41 public Phonon::MediaObjectInterface, public Phonon::AddonInterface 49 42 { 50 43 Q_OBJECT … … 100 93 int videoOutputCount(); 101 94 102 #if QT_ALLOW_QUICKTIME103 void displayLinkEvent();104 #endif105 106 95 signals: 107 96 void stateChanged(Phonon::State,Phonon::State); … … 116 105 void metaDataChanged(QMultiMap<QString,QString>); 117 106 void currentSourceChanged(const MediaSource &newSource); 118 119 // Add-on interface:120 void availableSubtitlesChanged();121 void availableAudioChannelsChanged();122 void titleChanged(int);123 void availableTitlesChanged(int);124 void chapterChanged(int);125 void availableChaptersChanged(int);126 void angleChanged(int);127 void availableAnglesChanged(int);128 107 129 108 protected: … … 140 119 QuickTimeAudioPlayer *m_nextAudioPlayer; 141 120 MediaObjectAudioNode *m_mediaObjectAudioNode; 142 143 #if QT_ALLOW_QUICKTIME 144 CVDisplayLinkRef m_displayLink; 145 QMutex m_displayLinkMutex; 146 bool m_pendingDisplayLinkEvent; 147 void startDisplayLink(); 148 void stopDisplayLink(); 149 #endif 121 QuickTimeMetaData *m_metaData; 150 122 151 123 qint32 m_tickInterval; … … 156 128 157 129 int m_tickTimer; 158 int m_videoTimer; 159 int m_audioTimer; 130 int m_bufferTimer; 160 131 int m_rapidTimer; 161 132 … … 163 134 int m_swapTimeLeft; 164 135 QTime m_swapTime; 165 bool m_autoplayTitles;166 136 167 137 void synchAudioVideo(); … … 172 142 void play_internal(); 173 143 void setupAudioSystem(); 174 void restartAudioVideoTimers(); 144 void updateTimer(int &timer, int interval); 145 void bufferAudioVideo(); 175 146 void updateRapidly(); 176 147 void updateCrossFade(); … … 184 155 void inspectGraph(); 185 156 bool isCrossFading(); 186 void setCurrentTrack(int track);187 157 188 158 QString m_errorString; -
trunk/src/3rdparty/phonon/qt7/mediaobject.mm
r561 r846 47 47 setAudioNode(m_mediaObjectAudioNode); 48 48 49 m_metaData = new QuickTimeMetaData(); 49 50 m_audioGraph = new AudioGraph(this); 50 51 … … 55 56 m_percentageLoaded = 0; 56 57 m_waitNextSwap = false; 57 m_autoplayTitles = true;58 58 m_audioEffectCount = 0; 59 59 m_audioOutputCount = 0; … … 64 64 65 65 m_tickTimer = 0; 66 m_videoTimer = 0; 67 m_audioTimer = 0; 66 m_bufferTimer = 0; 68 67 m_rapidTimer = 0; 69 68 70 #if QT_ALLOW_QUICKTIME71 m_displayLink = 0;72 m_pendingDisplayLinkEvent = false;73 #endif74 75 69 checkForError(); 76 70 } 77 71 78 72 MediaObject::~MediaObject() 79 { 80 // m_mediaObjectAudioNode is owned by super class. 81 #if QT_ALLOW_QUICKTIME 82 stopDisplayLink(); 83 #endif 73 { 74 // m_mediaObjectAudioNode is owned by super class. 84 75 m_audioPlayer->unsetVideoPlayer(); 85 76 m_nextAudioPlayer->unsetVideoPlayer(); 86 77 delete m_videoPlayer; 87 78 delete m_nextVideoPlayer; 79 delete m_metaData; 88 80 checkForError(); 89 81 } … … 97 89 if (m_state != state){ 98 90 // End-application did something 99 // upon receiving the signal. 91 // upon receiving the signal. 100 92 return false; 101 93 } … … 131 123 // effects or outputs connected. This will have 132 124 // influence on the audio system and video system that ends up beeing used: 133 int prevVideoOutputCount = m_videoOutputCount; 125 int prevVideoOutputCount = m_videoOutputCount; 134 126 m_audioEffectCount = 0; 135 127 m_audioOutputCount = 0; … … 143 135 MediaNodeEvent e1(MediaNodeEvent::VideoOutputCountChanged, &m_videoOutputCount); 144 136 notify(&e1); 145 } 137 } 146 138 } 147 139 … … 176 168 if (newAudioSystem == m_audioSystem) 177 169 return; 178 170 179 171 // Enable selected audio system: 180 m_audioSystem = newAudioSystem; 172 m_audioSystem = newAudioSystem; 181 173 switch (newAudioSystem){ 182 174 case AS_Silent: 183 175 m_audioGraph->stop(); 184 176 m_videoPlayer->enableAudio(false); 185 m_nextVideoPlayer->enableAudio(false); 177 m_nextVideoPlayer->enableAudio(false); 186 178 m_audioPlayer->enableAudio(false); 187 179 m_nextAudioPlayer->enableAudio(false); … … 223 215 PhononAutoReleasePool pool; 224 216 setState(Phonon::LoadingState); 225 217 226 218 // Save current state for event/signal handling below: 227 219 bool prevHasVideo = m_videoPlayer->hasVideo(); 228 220 qint64 prevTotalTime = totalTime(); 229 int prevTrackCount = m_videoPlayer->trackCount();230 221 m_waitNextSwap = false; 231 222 232 223 // Cancel cross-fade if any: 233 224 m_nextVideoPlayer->pause(); 234 225 m_nextAudioPlayer->pause(); 235 226 m_mediaObjectAudioNode->cancelCrossFade(); 236 227 237 228 // Set new source: 238 229 m_audioPlayer->unsetVideoPlayer(); 239 230 m_videoPlayer->setMediaSource(source); 240 231 m_audioPlayer->setVideoPlayer(m_videoPlayer); 241 242 m_audioGraph->updateStreamSpecifications(); 232 m_metaData->setVideo(m_videoPlayer); 233 234 m_audioGraph->updateStreamSpecifications(); 243 235 m_nextAudioPlayer->unsetVideoPlayer(); 244 m_nextVideoPlayer->unset CurrentMediaSource();236 m_nextVideoPlayer->unsetVideo(); 245 237 m_currentTime = 0; 246 238 247 239 // Emit/notify information about the new source: 248 240 QRect videoRect = m_videoPlayer->videoRect(); … … 255 247 256 248 emit currentSourceChanged(source); 257 emit metaDataChanged(m_ videoPlayer->metaData());249 emit metaDataChanged(m_metaData->metaData()); 258 250 259 251 if (prevHasVideo != m_videoPlayer->hasVideo()) 260 emit hasVideoChanged(m_videoPlayer->hasVideo()); 252 emit hasVideoChanged(m_videoPlayer->hasVideo()); 261 253 if (prevTotalTime != totalTime()) 262 emit totalTimeChanged(totalTime()); 263 if (prevTrackCount != m_videoPlayer->trackCount()) 264 emit availableTitlesChanged(m_videoPlayer->trackCount()); 254 emit totalTimeChanged(totalTime()); 265 255 if (checkForError()) 266 256 return; … … 271 261 if (!m_videoPlayer->canPlayMedia()) 272 262 SET_ERROR("Cannot play media.", FATAL_ERROR) 273 263 274 264 // The state might have changed from LoadingState 275 265 // as a response to an error state change. So we … … 298 288 bool prevHasVideo = m_videoPlayer->hasVideo(); 299 289 qint64 prevTotalTime = totalTime(); 300 int prevTrackCount = m_videoPlayer->trackCount();301 290 302 291 qSwap(m_audioPlayer, m_nextAudioPlayer); … … 304 293 m_mediaObjectAudioNode->startCrossFade(transitionTime); 305 294 m_audioGraph->updateStreamSpecifications(); 295 m_metaData->setVideo(m_videoPlayer); 306 296 307 297 m_waitNextSwap = false; 308 298 m_currentTime = 0; 309 299 310 300 // Emit/notify information about the new source: 311 301 QRect videoRect = m_videoPlayer->videoRect(); … … 314 304 315 305 emit currentSourceChanged(m_videoPlayer->mediaSource()); 316 emit metaDataChanged(m_ videoPlayer->metaData());306 emit metaDataChanged(m_metaData->metaData()); 317 307 318 308 if (prevHasVideo != m_videoPlayer->hasVideo()) 319 emit hasVideoChanged(m_videoPlayer->hasVideo()); 309 emit hasVideoChanged(m_videoPlayer->hasVideo()); 320 310 if (prevTotalTime != totalTime()) 321 311 emit totalTimeChanged(totalTime()); 322 if (prevTrackCount != m_videoPlayer->trackCount())323 emit availableTitlesChanged(m_videoPlayer->trackCount());324 312 if (checkForError()) 325 313 return; … … 340 328 } 341 329 342 #if QT_ALLOW_QUICKTIME 343 static CVReturn displayLinkCallback(CVDisplayLinkRef /*displayLink*/, 344 const CVTimeStamp */*inNow*/, 345 const CVTimeStamp */*inOutputTime*/, 346 CVOptionFlags /*flagsIn*/, 347 CVOptionFlags */*flagsOut*/, 348 void *userData) 349 { 350 MediaObject *mediaObject = static_cast<MediaObject *>(userData); 351 mediaObject->displayLinkEvent(); 352 return kCVReturnSuccess; 353 } 354 355 void MediaObject::displayLinkEvent() 356 { 357 // This function is called from a 358 // thread != gui thread. So we post the event. 359 // But we need to make sure that we don't post faster 360 // than the event loop can eat: 361 m_displayLinkMutex.lock(); 362 bool pending = m_pendingDisplayLinkEvent; 363 m_pendingDisplayLinkEvent = true; 364 m_displayLinkMutex.unlock(); 365 366 if (!pending) 367 qApp->postEvent(this, new QEvent(QEvent::User), Qt::HighEventPriority); 368 } 369 370 void MediaObject::startDisplayLink() 371 { 372 if (m_displayLink) 373 return; 374 OSStatus err = CVDisplayLinkCreateWithCGDisplay(kCGDirectMainDisplay, &m_displayLink); 375 if (err != noErr) 376 goto fail; 377 err = CVDisplayLinkSetCurrentCGDisplay(m_displayLink, kCGDirectMainDisplay); 378 if (err != noErr) 379 goto fail; 380 err = CVDisplayLinkSetOutputCallback(m_displayLink, displayLinkCallback, this); 381 if (err != noErr) 382 goto fail; 383 err = CVDisplayLinkStart(m_displayLink); 384 if (err != noErr) 385 goto fail; 386 return; 387 fail: 388 stopDisplayLink(); 389 } 390 391 void MediaObject::stopDisplayLink() 392 { 393 if (!m_displayLink) 394 return; 395 CVDisplayLinkStop(m_displayLink); 396 CFRelease(m_displayLink); 397 m_displayLink = 0; 398 } 399 #endif 400 401 void MediaObject::restartAudioVideoTimers() 402 { 403 if (m_videoTimer) 404 killTimer(m_videoTimer); 405 if (m_audioTimer) 406 killTimer(m_audioTimer); 407 408 #if QT_ALLOW_QUICKTIME 409 // We prefer to use a display link as timer if available, since 410 // it is more steady, and results in better and smoother frame drawing: 411 startDisplayLink(); 412 if (!m_displayLink){ 413 float fps = m_videoPlayer->staticFps(); 414 long videoUpdateFrequency = fps ? long(1000.0f / fps) : 0.001; 415 m_videoTimer = startTimer(videoUpdateFrequency); 416 } 417 #else 418 float fps = m_videoPlayer->staticFps(); 419 long videoUpdateFrequency = fps ? long(1000.0f / fps) : 0.001; 420 m_videoTimer = startTimer(videoUpdateFrequency); 421 #endif 422 423 long audioUpdateFrequency = m_audioPlayer->regularTaskFrequency(); 424 m_audioTimer = startTimer(audioUpdateFrequency); 425 updateVideoFrames(); 426 updateAudioBuffers(); 330 void MediaObject::updateTimer(int &timer, int interval) 331 { 332 if (timer) 333 killTimer(timer); 334 timer = 0; 335 if (interval >= 0) 336 timer = startTimer(interval); 427 337 } 428 338 … … 431 341 // Play main audio/video: 432 342 m_videoPlayer->play(); 433 m_audioPlayer->play(); 343 m_audioPlayer->play(); 434 344 updateLipSynch(0); 435 345 // Play old audio/video to finish cross-fade: … … 438 348 m_nextAudioPlayer->play(); 439 349 } 440 restartAudioVideoTimers(); 441 if (!m_rapidTimer) 442 m_rapidTimer = startTimer(100); 350 bufferAudioVideo(); 351 updateTimer(m_rapidTimer, 100); 443 352 } 444 353 … … 450 359 m_videoPlayer->pause(); 451 360 m_nextVideoPlayer->pause(); 452 killTimer(m_rapidTimer); 453 killTimer(m_videoTimer); 454 killTimer(m_audioTimer); 455 m_rapidTimer = 0; 456 m_videoTimer = 0; 457 m_audioTimer = 0; 458 #if QT_ALLOW_QUICKTIME 459 stopDisplayLink(); 460 #endif 361 updateTimer(m_rapidTimer, -1); 362 updateTimer(m_bufferTimer, -1); 363 461 364 if (m_waitNextSwap) 462 365 m_swapTimeLeft = m_swapTime.msecsTo(QTime::currentTime()); … … 480 383 return; 481 384 if (!setState(Phonon::PlayingState)) 482 return; 385 return; 483 386 if (m_audioSystem == AS_Graph){ 484 387 m_audioGraph->start(); … … 521 424 return; 522 425 m_waitNextSwap = false; 523 m_nextVideoPlayer->unset CurrentMediaSource();426 m_nextVideoPlayer->unsetVideo(); 524 427 m_nextAudioPlayer->unsetVideoPlayer(); 525 428 pause_internal(); … … 533 436 if (m_state == Phonon::ErrorState) 534 437 return; 535 438 536 439 // Stop cross-fade if any: 537 m_nextVideoPlayer->unset CurrentMediaSource();440 m_nextVideoPlayer->unsetVideo(); 538 441 m_nextAudioPlayer->unsetVideoPlayer(); 539 442 m_mediaObjectAudioNode->cancelCrossFade(); … … 544 447 m_audioPlayer->seek(m_videoPlayer->currentTime()); 545 448 m_mediaObjectAudioNode->setMute(false); 546 449 547 450 // Update time and cancel pending swap: 548 451 if (m_currentTime < m_videoPlayer->duration()) … … 655 558 { 656 559 IMPLEMENTED_SILENT; 657 const_cast<MediaObject *>(this)->updateCurrentTime(); 560 const_cast<MediaObject *>(this)->updateCurrentTime(); 658 561 return m_currentTime; 659 562 } … … 665 568 quint64 total = m_videoPlayer->duration(); 666 569 667 if (m_videoPlayer->currentTrack() < m_videoPlayer->trackCount() - 1){ 668 // There are still more tracks to play after the current track. 669 if (m_autoplayTitles) { 670 if (lastUpdateTime < m_currentTime && m_currentTime == total) 671 setCurrentTrack(m_videoPlayer->currentTrack() + 1); 672 } 673 } else if (m_nextVideoPlayer->state() == QuickTimeVideoPlayer::NoMedia){ 674 // There is no more sources or tracks to play after the current source. 675 // Check if it's time to emit aboutToFinish: 676 quint32 mark = qMax(quint64(0), qMin(total, total + m_transitionTime - 2000)); 677 if (lastUpdateTime < mark && mark <= m_currentTime) 678 emit aboutToFinish(); 679 680 // Check if it's time to emit prefinishMarkReached: 681 mark = qMax(quint64(0), total - m_prefinishMark); 682 if (lastUpdateTime < mark && mark <= m_currentTime) 683 emit prefinishMarkReached(total - m_currentTime); 684 570 // Check if it's time to emit aboutToFinish: 571 quint32 mark = qMax(quint64(0), qMin(total, total + m_transitionTime - 2000)); 572 if (lastUpdateTime < mark && mark <= m_currentTime) 573 emit aboutToFinish(); 574 575 // Check if it's time to emit prefinishMarkReached: 576 mark = qMax(quint64(0), total - m_prefinishMark); 577 if (lastUpdateTime < mark && mark <= m_currentTime) 578 emit prefinishMarkReached(total - m_currentTime); 579 580 if (m_nextVideoPlayer->state() == QuickTimeVideoPlayer::NoMedia){ 581 // There is no next source in que. 582 // Check if it's time to emit finished: 685 583 if (lastUpdateTime < m_currentTime && m_currentTime == total){ 686 584 emit finished(); … … 692 590 // We have a next source. 693 591 // Check if it's time to swap to next source: 694 quint32mark = qMax(quint64(0), total + m_transitionTime);592 mark = qMax(quint64(0), total + m_transitionTime); 695 593 if (m_waitNextSwap && m_state == Phonon::PlayingState && 696 594 m_transitionTime < m_swapTime.msecsTo(QTime::currentTime())){ … … 795 693 void MediaObject::updateCrossFade() 796 694 { 797 m_mediaObjectAudioNode->updateCrossFade(m_currentTime); 695 m_mediaObjectAudioNode->updateCrossFade(m_currentTime); 798 696 // Clean-up previous movie if done fading: 799 697 if (m_mediaObjectAudioNode->m_fadeDuration == 0){ 800 698 if (m_nextVideoPlayer->isPlaying() || m_nextAudioPlayer->isPlaying()){ 801 m_nextVideoPlayer->unset CurrentMediaSource();699 m_nextVideoPlayer->unsetVideo(); 802 700 m_nextAudioPlayer->unsetVideoPlayer(); 803 701 } 804 } 702 } 805 703 } 806 704 … … 831 729 if (m_videoPlayer->videoFrameChanged()){ 832 730 updateLipSynch(50); 833 VideoFrame frame(m_videoPlayer); 731 VideoFrame frame(m_videoPlayer); 834 732 if (m_nextVideoPlayer->isPlaying() 835 733 && m_nextVideoPlayer->hasVideo() … … 839 737 frame.setBaseOpacity(m_mediaObjectAudioNode->m_volume1); 840 738 } 841 739 842 740 // Send the frame through the graph: 843 updateVideo(frame); 741 updateVideo(frame); 844 742 checkForError(); 845 743 } … … 852 750 if (m_videoSinkList.isEmpty() || m_audioSinkList.isEmpty()) 853 751 return; 854 752 855 753 if (m_videoPlayer->hasVideo()){ 856 754 qint64 diff = m_audioPlayer->currentTime() - m_videoPlayer->currentTime(); … … 864 762 m_nextAudioPlayer->seek(m_nextVideoPlayer->currentTime()); 865 763 } 764 } 765 766 void MediaObject::bufferAudioVideo() 767 { 768 long nextVideoUpdate = m_videoPlayer->hasVideo() ? 30 : INT_MAX; 769 long nextAudioUpdate = m_audioPlayer->regularTaskFrequency(); 770 updateAudioBuffers(); 771 updateVideoFrames(); 772 if (m_state == Phonon::PlayingState) 773 updateTimer(m_bufferTimer, qMin(nextVideoUpdate, nextAudioUpdate)); 866 774 } 867 775 … … 890 798 checkForError(); 891 799 m_mediaObjectAudioNode->setMute(false); 892 if (m_state == Phonon::PlayingState)893 restartAudioVideoTimers();800 if (m_state == Phonon::PlayingState) 801 bufferAudioVideo(); 894 802 break; 895 803 case MediaNodeEvent::AudioGraphCannotPlay: … … 902 810 m_mediaObjectAudioNode->setMute(false); 903 811 } 812 break; 813 default: 814 break; 815 } 816 } 817 818 bool MediaObject::event(QEvent *event) 819 { 820 switch (event->type()){ 821 case QEvent::Timer: { 822 QTimerEvent *timerEvent = static_cast<QTimerEvent *>(event); 823 if (timerEvent->timerId() == m_rapidTimer) 824 updateRapidly(); 825 else if (timerEvent->timerId() == m_tickTimer) 826 emit tick(currentTime()); 827 else if (timerEvent->timerId() == m_bufferTimer) 828 bufferAudioVideo(); 829 } 904 830 break; 905 831 default: 906 832 break; 907 833 } 908 }909 910 bool MediaObject::event(QEvent *event)911 {912 switch (event->type()){913 #if QT_ALLOW_QUICKTIME914 case QEvent::User:{915 m_displayLinkMutex.lock();916 m_pendingDisplayLinkEvent = false;917 m_displayLinkMutex.unlock();918 updateVideoFrames();919 break; }920 #endif921 case QEvent::Timer:{922 int timerId = static_cast<QTimerEvent *>(event)->timerId();923 if (timerId == m_rapidTimer)924 updateRapidly();925 else if (timerId == m_tickTimer)926 emit tick(currentTime());927 else if (timerId == m_videoTimer)928 updateVideoFrames();929 else if (timerId == m_audioTimer)930 updateAudioBuffers();931 break; }932 default:933 break;934 }935 834 return QObject::event(event); 936 835 } 937 836 938 void MediaObject::setCurrentTrack(int track) 939 { 940 if (track == m_videoPlayer->currentTrack() || track < 0 || track >= m_videoPlayer->trackCount()) 941 return; 942 943 m_videoPlayer->setCurrentTrack(track); 944 emit titleChanged(track); 945 emit metaDataChanged(m_videoPlayer->metaData()); 946 } 947 948 bool MediaObject::hasInterface(Interface iface) const 949 { 950 return iface == AddonInterface::TitleInterface; 951 } 952 953 QVariant MediaObject::interfaceCall(Interface iface, int command, const QList<QVariant> ¶ms) 954 { 955 switch (iface) { 956 case TitleInterface: 957 switch (command) { 958 case availableTitles: 959 return m_videoPlayer->trackCount(); 960 case title: 961 return m_videoPlayer->currentTrack(); 962 case setTitle: 963 setCurrentTrack(params.first().toInt()); 964 break; 965 case autoplayTitles: 966 return m_autoplayTitles; 967 case setAutoplayTitles: 968 m_autoplayTitles = params.first().toBool(); 969 break; 970 } 971 default: 972 break; 973 } 837 bool MediaObject::hasInterface(Interface /*interface*/) const 838 { 839 return false; 840 } 841 842 QVariant MediaObject::interfaceCall(Interface /*interface*/, int /*command*/, const QList<QVariant> &/*arguments*/) 843 { 974 844 return QVariant(); 975 845 } -
trunk/src/3rdparty/phonon/qt7/mediaobjectaudionode.mm
r2 r846 15 15 along with this library. If not, see <http://www.gnu.org/licenses/>. 16 16 */ 17 18 #import <QTKit/QTMovie.h> 17 19 18 20 #include "mediaobjectaudionode.h" -
trunk/src/3rdparty/phonon/qt7/quicktimeaudioplayer.mm
r2 r846 15 15 along with this library. If not, see <http://www.gnu.org/licenses/>. 16 16 */ 17 18 #import <QTKit/QTMovie.h> 17 19 18 20 #include "quicktimeaudioplayer.h" -
trunk/src/3rdparty/phonon/qt7/quicktimemetadata.h
r561 r846 39 39 { 40 40 public: 41 QuickTimeMetaData(QuickTimeVideoPlayer *videoPlayer); 42 void update(); 41 QuickTimeMetaData(); 42 virtual ~QuickTimeMetaData(); 43 44 void setVideo(QuickTimeVideoPlayer *videoPlayer); 43 45 QMultiMap<QString, QString> metaData(); 44 46 … … 48 50 QuickTimeVideoPlayer *m_videoPlayer; 49 51 void readMetaData(); 50 void guessMetaDataForCD();51 void readMetaDataFromMovie();52 52 53 53 #ifdef QUICKTIME_C_API_AVAILABLE -
trunk/src/3rdparty/phonon/qt7/quicktimemetadata.mm
r561 r846 16 16 */ 17 17 18 #include <QtCore/QFileInfo> 18 #import <QTKit/QTMovie.h> 19 19 20 #include "quicktimemetadata.h" 20 21 #include "quicktimevideoplayer.h" … … 27 28 { 28 29 29 QuickTimeMetaData::QuickTimeMetaData( QuickTimeVideoPlayer *videoPlayer)30 QuickTimeMetaData::QuickTimeMetaData() 30 31 { 31 m_videoPlayer = videoPlayer;32 m_videoPlayer = 0; 32 33 m_movieChanged = false; 33 34 } 34 35 35 void QuickTimeMetaData::update()36 QuickTimeMetaData::~QuickTimeMetaData() 36 37 { 38 } 39 40 void QuickTimeMetaData::setVideo(QuickTimeVideoPlayer *videoPlayer) 41 { 42 m_videoPlayer = videoPlayer; 37 43 m_movieChanged = true; 38 44 m_metaData.clear(); … … 142 148 #endif // QUICKTIME_C_API_AVAILABLE 143 149 144 void QuickTimeMetaData:: guessMetaDataForCD()150 void QuickTimeMetaData::readMetaData() 145 151 { 146 QString album = QFileInfo(m_videoPlayer->movieCompactDiscPath()).fileName(); 147 QString title = QFileInfo(m_videoPlayer->currentTrackPath()).fileName(); 148 title = title.left(title.lastIndexOf('.')); 149 m_metaData.insert(QLatin1String("ALBUM"), album); 150 m_metaData.insert(QLatin1String("TITLE"), title); 151 m_metaData.insert(QLatin1String("TRACKNUMBER"), QString::number(m_videoPlayer->currentTrack())); 152 } 153 154 void QuickTimeMetaData::readMetaDataFromMovie() 155 { 152 if (!m_videoPlayer) 153 return; 156 154 QMultiMap<QString, QString> metaMap; 157 155 158 156 #ifdef QUICKTIME_C_API_AVAILABLE 159 QTMetaDataRef metaDataRef; 157 QTMetaDataRef metaDataRef; 160 158 OSStatus err = QTCopyMovieMetaData([m_videoPlayer->qtMovie() quickTimeMovie], &metaDataRef); 161 159 BACKEND_ASSERT2(err == noErr, "Could not read QuickTime meta data", NORMAL_ERROR) … … 178 176 } 179 177 180 void QuickTimeMetaData::readMetaData()181 {182 if (!m_videoPlayer)183 return;184 185 if (m_videoPlayer->mediaSource().type() == Phonon::MediaSource::Disc)186 guessMetaDataForCD();187 else188 readMetaDataFromMovie();189 }190 191 178 QMultiMap<QString, QString> QuickTimeMetaData::metaData() 192 179 { -
trunk/src/3rdparty/phonon/qt7/quicktimevideoplayer.h
r561 r846 21 21 #include "backendheader.h" 22 22 23 #include <QtGui/qmacdefines_mac.h>24 23 #import <QTKit/QTDataReference.h> 25 24 #import <QTKit/QTMovie.h> … … 40 39 { 41 40 class QuickTimeStreamReader; 42 class QuickTimeMetaData;43 41 class VideoRenderWidgetQTMovieView; 44 42 … … 58 56 void setMediaSource(const MediaSource &source); 59 57 MediaSource mediaSource() const; 60 void unset CurrentMediaSource();58 void unsetVideo(); 61 59 62 60 void play(); … … 69 67 void *currentFrameAsCIImage(); 70 68 QImage currentFrameAsQImage(); 71 void releaseImageCache();72 69 QRect videoRect() const; 73 70 … … 75 72 quint64 currentTime() const; 76 73 long timeScale() const; 77 float staticFps();78 74 QString currentTimeString(); 79 75 … … 88 84 void setPlaybackRate(float rate); 89 85 QTMovie *qtMovie() const; 90 QMultiMap<QString, QString> metaData();91 86 92 87 float playbackRate() const; … … 108 103 quint64 timeLoaded(); 109 104 110 int trackCount() const;111 int currentTrack() const;112 void setCurrentTrack(int track);113 QString movieCompactDiscPath() const;114 QString currentTrackPath() const;115 116 105 static QString timeToString(quint64 ms); 117 106 … … 127 116 State m_state; 128 117 QGLPixelBuffer *m_QImagePixelBuffer; 129 QuickTimeMetaData *m_metaData;130 131 CVOpenGLTextureRef m_cachedCVTextureRef;132 QImage m_cachedQImage;133 118 134 119 bool m_playbackRateSat; … … 141 126 float m_relativeVolume; 142 127 float m_playbackRate; 143 float m_staticFps;144 128 quint64 m_currentTime; 145 129 MediaSource m_mediaSource; 146 147 130 void *m_primaryRenderingCIImage; 148 131 qreal m_brightness; … … 150 133 qreal m_hue; 151 134 qreal m_saturation; 152 NSArray *m_folderTracks;153 int m_currentTrack;154 QString m_movieCompactDiscPath;155 135 156 136 #ifdef QUICKTIME_C_API_AVAILABLE … … 160 140 QuickTimeStreamReader *m_streamReader; 161 141 162 void prepareCurrentMovieForPlayback();163 142 void createVisualContext(); 164 143 void openMovieFromCurrentMediaSource(); … … 167 146 void openMovieFromUrl(); 168 147 void openMovieFromStream(); 169 void openMovieFromCompactDisc();170 148 void openMovieFromData(QByteArray *data, char *fileType); 171 149 void openMovieFromDataGuessType(QByteArray *data); 172 150 QString mediaSourcePath(); 173 151 bool codecExistsAccordingToSuffix(const QString &fileName); 174 NSString* pathToCompactDisc();175 bool isCompactDisc(NSString *path);176 NSArray* scanFolder(NSString *path);177 152 178 153 void setError(NSError *error); 179 154 bool errorOccured(); 180 155 void readProtection(); 181 void calculateStaticFps();182 156 void checkIfVideoAwailable(); 183 157 bool movieNotLoaded(); -
trunk/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm
r561 r846 21 21 #include "audiodevice.h" 22 22 #include "quicktimestreamreader.h" 23 #include "quicktimemetadata.h"24 23 25 24 #include <QtCore/QCoreApplication> … … 54 53 m_state = NoMedia; 55 54 m_mediaSource = MediaSource(); 56 m_metaData = new QuickTimeMetaData(this);57 55 m_QTMovie = 0; 58 56 m_streamReader = 0; … … 64 62 m_audioEnabled = false; 65 63 m_hasVideo = false; 66 m_staticFps = 0;67 64 m_playbackRateSat = false; 68 65 m_isDrmProtected = false; … … 71 68 m_primaryRenderingCIImage = 0; 72 69 m_QImagePixelBuffer = 0; 73 m_cachedCVTextureRef = 0;74 m_folderTracks = 0;75 m_currentTrack = 0;76 70 77 71 #ifdef QUICKTIME_C_API_AVAILABLE … … 84 78 QuickTimeVideoPlayer::~QuickTimeVideoPlayer() 85 79 { 86 PhononAutoReleasePool pool; 87 unsetCurrentMediaSource(); 88 delete m_metaData; 80 unsetVideo(); 89 81 [(NSObject*)m_primaryRenderingTarget release]; 90 82 m_primaryRenderingTarget = 0; … … 93 85 CFRelease(m_visualContext); 94 86 #endif 95 }96 97 void QuickTimeVideoPlayer::releaseImageCache()98 {99 if (m_cachedCVTextureRef){100 CVOpenGLTextureRelease(m_cachedCVTextureRef);101 m_cachedCVTextureRef = 0;102 }103 m_cachedQImage = QImage();104 87 } 105 88 … … 143 126 144 127 QTVisualContextTask(m_visualContext); 145 bool changed = QTVisualContextIsNewImageAvailable(m_visualContext, 0); 146 if (changed) 147 releaseImageCache(); 148 return changed; 128 return QTVisualContextIsNewImageAvailable(m_visualContext, 0); 149 129 150 130 #elif defined(QT_MAC_USE_COCOA) … … 161 141 if (!m_visualContext) 162 142 return 0; 163 if (!m_cachedCVTextureRef){ 164 OSStatus err = QTVisualContextCopyImageForTime(m_visualContext, 0, 0, &m_cachedCVTextureRef); 165 BACKEND_ASSERT3(err == noErr, "Could not copy image for time in QuickTime player", FATAL_ERROR, 0) 166 } 167 return m_cachedCVTextureRef; 143 CVOpenGLTextureRef texture = 0; 144 OSStatus err = QTVisualContextCopyImageForTime(m_visualContext, 0, 0, &texture); 145 BACKEND_ASSERT3(err == noErr, "Could not copy image for time in QuickTime player", FATAL_ERROR, 0) 146 return texture; 168 147 169 148 #else … … 174 153 QImage QuickTimeVideoPlayer::currentFrameAsQImage() 175 154 { 176 if (!m_cachedQImage.isNull())177 return m_cachedQImage;178 179 155 #ifdef QUICKTIME_C_API_AVAILABLE 180 156 QGLContext *prevContext = const_cast<QGLContext *>(QGLContext::currentContext()); … … 206 182 glEnd(); 207 183 208 m_cachedQImage = m_QImagePixelBuffer->toImage(); 184 QImage image = m_QImagePixelBuffer->toImage(); 185 CVOpenGLTextureRelease(texture); 209 186 // Because of QuickTime, m_QImagePixelBuffer->doneCurrent() will fail. 210 187 // So we store, and restore, the context our selves: 211 188 prevContext->makeCurrent(); 212 return m_cachedQImage;189 return image; 213 190 #else 214 191 CIImage *img = (CIImage *)currentFrameAsCIImage(); … … 219 196 CGRect bounds = [img extent]; 220 197 QImage qImg([bitmap bitmapData], bounds.size.width, bounds.size.height, QImage::Format_ARGB32); 221 m_cachedQImage= qImg.rgbSwapped();198 QImage swapped = qImg.rgbSwapped(); 222 199 [bitmap release]; 223 200 [img release]; 224 return m_cachedQImage;201 return swapped; 225 202 #endif 226 203 } … … 274 251 CVOpenGLTextureRef cvImg = currentFrameAsCVTexture(); 275 252 CIImage *img = [[CIImage alloc] initWithCVImageBuffer:cvImg]; 276 return img; 253 CVOpenGLTextureRelease(cvImg); 254 return img; 277 255 #else 278 256 return 0; … … 296 274 int samplesPerPixel = [bitmap samplesPerPixel]; 297 275 if (![bitmap isPlanar] && (samplesPerPixel == 3 || samplesPerPixel == 4)){ 298 glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 276 glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 299 277 samplesPerPixel == 4 ? GL_RGBA8 : GL_RGB8, 300 278 [bitmap pixelsWide], [bitmap pixelsHigh], … … 325 303 m_relativeVolume = relativeVolume; 326 304 if (!m_QTMovie || !m_audioEnabled || m_mute) 327 return; 305 return; 328 306 [m_QTMovie setVolume:(m_masterVolume * m_relativeVolume)]; 329 307 } … … 336 314 337 315 // Work-around bug that happends if you set/unset mute 338 // before movie is playing, and audio is not played 316 // before movie is playing, and audio is not played 339 317 // through graph. Then audio is delayed. 340 318 [m_QTMovie setMuted:mute]; … … 349 327 350 328 // Work-around bug that happends if you set/unset mute 351 // before movie is playing, and audio is not played 329 // before movie is playing, and audio is not played 352 330 // through graph. Then audio is delayed. 353 331 [m_QTMovie setMuted:(!enable || m_mute)]; … … 368 346 // The following code will not work for some media codecs that 369 347 // typically mingle audio/video frames (e.g mpeg). 370 CFStringRef idString = PhononCFString::toCFStringRef(AudioDevice::deviceUID(id)); 348 CFStringRef idString = PhononCFString::toCFStringRef(AudioDevice::deviceUID(id)); 371 349 QTAudioContextRef context; 372 350 QTAudioContextCreateForAudioDevice(kCFAllocatorDefault, idString, 0, &context); … … 392 370 saturation += 1; 393 371 394 if (m_brightness == brightness395 && m_contrast == contrast396 && m_hue == hue397 && m_saturation == saturation)398 return;399 400 372 m_brightness = brightness; 401 373 m_contrast = contrast; 402 374 m_hue = hue; 403 375 m_saturation = saturation; 376 404 377 #ifdef QUICKTIME_C_API_AVAILABLE 405 378 Float32 value; … … 413 386 SetMovieVisualSaturation([m_QTMovie quickTimeMovie], value, 0); 414 387 #endif 415 releaseImageCache();416 388 } 417 389 … … 426 398 } 427 399 428 void QuickTimeVideoPlayer::unset CurrentMediaSource()400 void QuickTimeVideoPlayer::unsetVideo() 429 401 { 430 402 if (!m_QTMovie) … … 439 411 m_isDrmProtected = false; 440 412 m_isDrmAuthorized = true; 441 m_hasVideo = false;442 m_staticFps = 0;443 413 m_mediaSource = MediaSource(); 444 m_movieCompactDiscPath.clear();445 414 [(CIImage *)m_primaryRenderingCIImage release]; 446 415 m_primaryRenderingCIImage = 0; 447 416 delete m_QImagePixelBuffer; 448 417 m_QImagePixelBuffer = 0; 449 releaseImageCache();450 [m_folderTracks release];451 m_folderTracks = 0;452 418 } 453 419 … … 559 525 { 560 526 PhononAutoReleasePool pool; 561 unsetCurrentMediaSource(); 562 527 unsetVideo(); 563 528 m_mediaSource = mediaSource; 564 529 if (mediaSource.type() == MediaSource::Empty || mediaSource.type() == MediaSource::Invalid){ … … 566 531 return; 567 532 } 568 569 533 openMovieFromCurrentMediaSource(); 570 534 if (errorOccured()){ 571 unsetCurrentMediaSource(); 572 return; 573 } 574 575 prepareCurrentMovieForPlayback(); 576 } 577 578 void QuickTimeVideoPlayer::prepareCurrentMovieForPlayback() 579 { 535 unsetVideo(); 536 return; 537 } 538 580 539 #ifdef QUICKTIME_C_API_AVAILABLE 581 540 if (m_visualContext) … … 585 544 waitStatePlayable(); 586 545 if (errorOccured()){ 587 unset CurrentMediaSource();546 unsetVideo(); 588 547 return; 589 548 } … … 592 551 preRollMovie(); 593 552 if (errorOccured()){ 594 unset CurrentMediaSource();553 unsetVideo(); 595 554 return; 596 555 } … … 599 558 m_playbackRate = prefferedPlaybackRate(); 600 559 checkIfVideoAwailable(); 601 calculateStaticFps();602 560 enableAudio(m_audioEnabled); 603 561 setMute(m_mute); 604 562 setVolume(m_masterVolume, m_relativeVolume); 605 m_metaData->update();606 563 pause(); 607 564 } … … 617 574 break; 618 575 case MediaSource::Disc: 619 openMovieFromCompactDisc();576 CASE_UNSUPPORTED("Could not open media source.", FATAL_ERROR) 620 577 break; 621 578 case MediaSource::Stream: … … 679 636 // codecs *think* they can decode the stream, and crash... 680 637 #define TryOpenMovieWithCodec(type) gClearError(); \ 681 openMovieFromData(data, (char *)"."type); \638 openMovieFromData(data, "."type); \ 682 639 if (m_QTMovie) return; 683 640 … … 719 676 } 720 677 721 typedef void (*qt_sighandler_t)(int);722 static void sigtest(int) {723 qApp->exit(0);724 }725 726 void QuickTimeVideoPlayer::openMovieFromCompactDisc()727 {728 // Interrupting the application while the device is open729 // causes the application to hang. So we need to handle730 // this in a more graceful way:731 qt_sighandler_t hndl = signal(SIGINT, sigtest);732 if (hndl)733 signal(SIGINT, hndl);734 735 PhononAutoReleasePool pool;736 NSString *cd = 0;737 QString devName = m_mediaSource.deviceName();738 if (devName.isEmpty()) {739 cd = pathToCompactDisc();740 if (!cd) {741 SET_ERROR("Could not open media source.", NORMAL_ERROR)742 return;743 }744 m_movieCompactDiscPath = PhononCFString::toQString(reinterpret_cast<CFStringRef>(cd));745 } else {746 if (!QFileInfo(devName).isAbsolute())747 devName = QLatin1String("/Volumes/") + devName;748 cd = [reinterpret_cast<const NSString *>(PhononCFString::toCFStringRef(devName)) autorelease];749 if (!isCompactDisc(cd)) {750 SET_ERROR("Could not open media source.", NORMAL_ERROR)751 return;752 }753 m_movieCompactDiscPath = devName;754 }755 756 m_folderTracks = [scanFolder(cd) retain];757 setCurrentTrack(0);758 }759 760 QString QuickTimeVideoPlayer::movieCompactDiscPath() const761 {762 return m_movieCompactDiscPath;763 }764 765 678 MediaSource QuickTimeVideoPlayer::mediaSource() const 766 679 { … … 806 719 PhononAutoReleasePool pool; 807 720 return [[m_QTMovie attributeForKey:@"QTMovieTimeScaleAttribute"] longValue]; 808 }809 810 float QuickTimeVideoPlayer::staticFps()811 {812 return m_staticFps;813 }814 815 void QuickTimeVideoPlayer::calculateStaticFps()816 {817 if (!m_hasVideo){818 m_staticFps = 0;819 return;820 }821 822 #ifdef QT_ALLOW_QUICKTIME823 Boolean isMpeg = false;824 Track videoTrack = GetMovieIndTrackType([m_QTMovie quickTimeMovie], 1,825 FOUR_CHAR_CODE('vfrr'), // 'vfrr' means: has frame rate826 movieTrackCharacteristic | movieTrackEnabledOnly);827 Media media = GetTrackMedia(videoTrack);828 MediaHandler mediaH = GetMediaHandler(media);829 MediaHasCharacteristic(mediaH, FOUR_CHAR_CODE('mpeg'), &isMpeg);830 831 if (isMpeg){832 MHInfoEncodedFrameRateRecord frameRate;833 Size frameRateSize = sizeof(frameRate);834 MediaGetPublicInfo(mediaH, kMHInfoEncodedFrameRate, &frameRate, &frameRateSize);835 m_staticFps = float(Fix2X(frameRate.encodedFrameRate));836 } else {837 Media media = GetTrackMedia(videoTrack);838 long sampleCount = GetMediaSampleCount(media);839 TimeValue64 duration = GetMediaDisplayDuration(media);840 TimeValue64 timeScale = GetMediaTimeScale(media);841 m_staticFps = float((double)sampleCount * (double)timeScale / (double)duration);842 }843 #else844 m_staticFps = 30.0f;845 #endif846 721 } 847 722 … … 1076 951 } 1077 952 1078 QMultiMap<QString, QString> QuickTimeVideoPlayer::metaData()1079 {1080 return m_metaData->metaData();1081 }1082 1083 int QuickTimeVideoPlayer::trackCount() const1084 {1085 if (!m_folderTracks)1086 return 0;1087 return [m_folderTracks count];1088 }1089 1090 int QuickTimeVideoPlayer::currentTrack() const1091 {1092 return m_currentTrack;1093 }1094 1095 QString QuickTimeVideoPlayer::currentTrackPath() const1096 {1097 if (!m_folderTracks)1098 return QString();1099 1100 PhononAutoReleasePool pool;1101 NSString *trackPath = [m_folderTracks objectAtIndex:m_currentTrack];1102 return PhononCFString::toQString(reinterpret_cast<CFStringRef>(trackPath));1103 }1104 1105 NSString* QuickTimeVideoPlayer::pathToCompactDisc()1106 {1107 PhononAutoReleasePool pool;1108 NSArray *devices = [[NSWorkspace sharedWorkspace] mountedRemovableMedia];1109 for (unsigned int i=0; i<[devices count]; ++i) {1110 NSString *dev = [devices objectAtIndex:i];1111 if (isCompactDisc(dev))1112 return [dev retain];1113 }1114 return 0;1115 }1116 1117 bool QuickTimeVideoPlayer::isCompactDisc(NSString *path)1118 {1119 PhononAutoReleasePool pool;1120 NSString *type = [NSString string];1121 [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:path1122 isRemovable:01123 isWritable:01124 isUnmountable:01125 description:01126 type:&type];1127 return [type hasPrefix:@"cdd"];1128 }1129 1130 NSArray* QuickTimeVideoPlayer::scanFolder(NSString *path)1131 {1132 NSMutableArray *tracks = [NSMutableArray arrayWithCapacity:20];1133 if (!path)1134 return tracks;1135 1136 NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtPath:path];1137 while (NSString *track = [enumerator nextObject]) {1138 if (![track hasPrefix:@"."])1139 [tracks addObject:[path stringByAppendingPathComponent:track]];1140 }1141 return tracks;1142 }1143 1144 void QuickTimeVideoPlayer::setCurrentTrack(int track)1145 {1146 PhononAutoReleasePool pool;1147 [m_QTMovie release];1148 m_QTMovie = 0;1149 m_currentTime = 0;1150 m_currentTrack = track;1151 1152 if (!m_folderTracks)1153 return;1154 if (track < 0 || track >= (int)[m_folderTracks count])1155 return;1156 1157 NSString *trackPath = [m_folderTracks objectAtIndex:track];1158 QTDataReference *dataRef = [QTDataReference dataReferenceWithReferenceToFile:trackPath];1159 State currentState = m_state;1160 openMovieFromDataRef(dataRef);1161 prepareCurrentMovieForPlayback();1162 if (currentState == Playing)1163 play();1164 }1165 1166 953 }} 1167 954 -
trunk/src/3rdparty/phonon/qt7/videoframe.mm
r561 r846 20 20 #import <QuartzCore/CIFilter.h> 21 21 #import <QuartzCore/CIContext.h> 22 23 //#define CACHE_CV_TEXTURE24 22 25 23 QT_BEGIN_NAMESPACE … … 73 71 void VideoFrame::copyMembers(const VideoFrame& frame) 74 72 { 75 #ifdef CACHE_CV_TEXTURE76 73 m_cachedCVTextureRef = frame.m_cachedCVTextureRef; 77 #endif78 74 m_cachedCIImage = frame.m_cachedCIImage; 79 75 m_cachedQImage = frame.m_cachedQImage; … … 110 106 CVOpenGLTextureRef VideoFrame::cachedCVTexture() const 111 107 { 112 #ifdef CACHE_CV_TEXTURE113 108 if (!m_cachedCVTextureRef && m_videoPlayer){ 114 109 m_videoPlayer->setColors(m_brightness, m_contrast, m_hue, m_saturation); 115 110 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = m_videoPlayer->currentFrameAsCVTexture(); 116 CVOpenGLTextureRetain((const_cast<VideoFrame *>(this))->m_cachedCVTextureRef);117 111 } 118 112 return m_cachedCVTextureRef; 119 #else120 if (m_videoPlayer){121 m_videoPlayer->setColors(m_brightness, m_contrast, m_hue, m_saturation);122 return m_videoPlayer->currentFrameAsCVTexture();123 }124 return 0;125 #endif126 113 } 127 114 … … 343 330 void VideoFrame::invalidateImage() const 344 331 { 345 #ifdef CACHE_CV_TEXTURE346 332 if (m_cachedCVTextureRef){ 347 333 CVOpenGLTextureRelease(m_cachedCVTextureRef); 348 334 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0; 349 335 } 350 #endif351 336 if (m_cachedCIImage){ 352 337 [(CIImage *) m_cachedCIImage release]; … … 362 347 void VideoFrame::retain() const 363 348 { 364 #ifdef CACHE_CV_TEXTURE365 349 if (m_cachedCVTextureRef) 366 350 CVOpenGLTextureRetain(m_cachedCVTextureRef); 367 #endif368 351 if (m_cachedCIImage) 369 352 [(CIImage *) m_cachedCIImage retain]; … … 376 359 void VideoFrame::release() const 377 360 { 378 #ifdef CACHE_CV_TEXTURE 379 if (m_cachedCVTextureRef){ 361 if (m_cachedCVTextureRef) 380 362 CVOpenGLTextureRelease(m_cachedCVTextureRef); 381 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0;382 }383 #endif384 363 if (m_cachedCIImage) 385 364 [(CIImage *) m_cachedCIImage release]; … … 390 369 391 370 (const_cast<VideoFrame *>(this))->m_backgroundFrame = 0; 371 (const_cast<VideoFrame *>(this))->m_cachedCVTextureRef = 0; 392 372 (const_cast<VideoFrame *>(this))->m_cachedCIImage = 0; 393 373 (const_cast<VideoFrame *>(this))->m_cachedNSBitmap = 0;
Note:
See TracChangeset
for help on using the changeset viewer.