diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-04-30 01:13:23 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-04-30 01:13:23 (GMT) |
commit | 7adae4f0078fd9364081c66aa84431bf4a2108f5 (patch) | |
tree | d38e9c7e8a703c86a88cae5b7080db1c3bdb1057 /src/plugins | |
parent | 3f3b145039e9bc0620e8ff3111fa3c338e44502c (diff) | |
download | Qt-7adae4f0078fd9364081c66aa84431bf4a2108f5.zip Qt-7adae4f0078fd9364081c66aa84431bf4a2108f5.tar.gz Qt-7adae4f0078fd9364081c66aa84431bf4a2108f5.tar.bz2 |
Fix crash in direct show media service with mingw and a video surface.
Mingw appears unable to resolve a valid pointer to the IMemInputPin
interface from the DirectShowSampleScheduler class when it inherits from
QWinEventNotifier. Inheriting from QObject does not have the same
problem, so do that instead and connect to the activated signal of a
separate instance of QWinEventNotifier.
Task-number: 10221
Reviewed-by: Justin McPherson
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/mediaservices/directshow/mediaplayer/directshowsamplescheduler.cpp | 23 | ||||
-rw-r--r-- | src/plugins/mediaservices/directshow/mediaplayer/directshowsamplescheduler.h | 5 |
2 files changed, 8 insertions, 20 deletions
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowsamplescheduler.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowsamplescheduler.cpp index 150860f..23675fb 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowsamplescheduler.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowsamplescheduler.cpp @@ -118,7 +118,7 @@ bool DirectShowTimedSample::isReady(IReferenceClock *clock) const } DirectShowSampleScheduler::DirectShowSampleScheduler(IUnknown *pin, QObject *parent) - : QWinEventNotifier(parent) + : QObject(parent) , m_pin(pin) , m_clock(0) , m_allocator(0) @@ -131,13 +131,15 @@ DirectShowSampleScheduler::DirectShowSampleScheduler(IUnknown *pin, QObject *par { m_semaphore.release(m_maximumSamples); - setHandle(m_timeoutEvent); - setEnabled(true); + m_eventNotifier.setHandle(m_timeoutEvent); + m_eventNotifier.setEnabled(true); + + connect(&m_eventNotifier, SIGNAL(activated(HANDLE)), this, SIGNAL(sampleReady())); } DirectShowSampleScheduler::~DirectShowSampleScheduler() { - setEnabled(false); + m_eventNotifier.setEnabled(false); ::CloseHandle(m_timeoutEvent); @@ -398,17 +400,4 @@ bool DirectShowSampleScheduler::scheduleEndOfStream() } } -bool DirectShowSampleScheduler::event(QEvent *event) -{ - if (event->type() == QEvent::WinEventAct) { - QObject::event(event); - - emit sampleReady(); - - return true; - } else { - return QWinEventNotifier::event(event); - } -} - QT_END_NAMESPACE diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowsamplescheduler.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowsamplescheduler.h index 007fa99..21823c3 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowsamplescheduler.h +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowsamplescheduler.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE class DirectShowTimedSample; -class DirectShowSampleScheduler : public QWinEventNotifier, public IMemInputPin +class DirectShowSampleScheduler : public QObject, public IMemInputPin { Q_OBJECT public: @@ -101,8 +101,6 @@ public: IMediaSample *takeSample(bool *eos); - bool event(QEvent *event); - Q_SIGNALS: void sampleReady(); @@ -118,6 +116,7 @@ private: HANDLE m_timeoutEvent; QSemaphore m_semaphore; QMutex m_mutex; + QWinEventNotifier m_eventNotifier; }; QT_END_NAMESPACE |