source: trunk/src/3rdparty/phonon/ds9/qasyncreader.h

Last change on this file was 561, checked in by Dmitry A. Kuminov, 16 years ago

trunk: Merged in qt 4.6.1 sources.

File size: 2.4 KB
Line 
1/* This file is part of the KDE project.
2
3Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4
5This library is free software: you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation, either version 2.1 or 3 of the License.
8
9This library is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU Lesser General Public License for more details.
13
14You should have received a copy of the GNU Lesser General Public License
15along with this library. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef PHONON_QASYNCREADER_H
19#define PHONON_QASYNCREADER_H
20
21#include <QtCore/QWaitCondition>
22#include <QtCore/QQueue>
23#include <QtCore/QMutex>
24
25#include "qpin.h"
26
27QT_BEGIN_NAMESPACE
28
29namespace Phonon
30{
31 namespace DS9
32 {
33 //his class reads asynchronously from a QIODevice
34 class QAsyncReader : public QPin, public IAsyncReader
35 {
36 public:
37 QAsyncReader(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &mediaTypes);
38 ~QAsyncReader();
39
40 //reimplementation from IUnknown
41 STDMETHODIMP QueryInterface(REFIID iid, void** out);
42 STDMETHODIMP_(ULONG) AddRef();
43 STDMETHODIMP_(ULONG) Release();
44
45 //reimplementation from IAsyncReader
46 STDMETHODIMP RequestAllocator(IMemAllocator *,ALLOCATOR_PROPERTIES *,IMemAllocator **);
47 STDMETHODIMP Request(IMediaSample *,DWORD_PTR);
48 STDMETHODIMP WaitForNext(DWORD,IMediaSample **,DWORD_PTR *);
49 STDMETHODIMP SyncReadAligned(IMediaSample *);
50 STDMETHODIMP SyncRead(LONGLONG,LONG,BYTE *);
51 STDMETHODIMP Length(LONGLONG *,LONGLONG *) = 0;
52 STDMETHODIMP BeginFlush();
53 STDMETHODIMP EndFlush();
54
55 protected:
56 STDMETHODIMP syncReadAlignedUnlocked(IMediaSample *);
57 virtual HRESULT read(LONGLONG pos, LONG length, BYTE *buffer, LONG *actual) = 0;
58
59 private:
60 struct AsyncRequest
61 {
62 AsyncRequest(IMediaSample *s = 0, DWORD_PTR u = 0) : sample(s), user(u) {}
63 IMediaSample *sample;
64 DWORD_PTR user;
65 };
66
67 QQueue<AsyncRequest> m_requestQueue;
68 QWaitCondition m_requestWait;
69 };
70 }
71}
72
73QT_END_NAMESPACE
74
75#endif
Note: See TracBrowser for help on using the repository browser.