1
/*  This file is part of the KDE project.
2
3
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4
5
This library is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 2.1 or 3 of the License.
8
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
GNU Lesser General Public License for more details.
13
14
You should have received a copy of the GNU Lesser General Public License
15
along with this library.  If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef PHONON_QMEMINPUTPIN_H
19
#define PHONON_QMEMINPUTPIN_H
20
21
22
#include <QtCore/QList>
23
#include <QtCore/QMutex>
24
#include "qpin.h"
25
26
#include <dshow.h>
27
28
QT_BEGIN_NAMESPACE
29
30
namespace Phonon
31
{
32
    namespace DS9
33
    {
34
        class QBaseFilter;
35
36
        //this class will be used for our effects
37
        class QMemInputPin : public QPin, public IMemInputPin
38
        {
39
        public:
40
            QMemInputPin(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &, bool transform, QPin *output);
41
            ~QMemInputPin();
42
43
            //reimplementation from IUnknown
44
            STDMETHODIMP QueryInterface(REFIID iid, void** out);
45
            STDMETHODIMP_(ULONG) AddRef();
46
            STDMETHODIMP_(ULONG) Release();
47
48
            //reimplementation from IPin
49
            STDMETHODIMP ReceiveConnection(IPin *,const AM_MEDIA_TYPE *);
50
            STDMETHODIMP BeginFlush();
51
            STDMETHODIMP EndFlush();
52
            STDMETHODIMP EndOfStream();
53
            STDMETHODIMP NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate);
54
55
            //reimplementation from IMemAllocator
56
            STDMETHODIMP GetAllocator(IMemAllocator **);
57
            STDMETHODIMP NotifyAllocator(IMemAllocator *,BOOL);
58
            STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES *);
59
            STDMETHODIMP Receive(IMediaSample *);
60
            STDMETHODIMP ReceiveMultiple(IMediaSample **,long,long *);
61
            STDMETHODIMP ReceiveCanBlock();
62
63
        private:
64
            IMediaSample *duplicateSampleForOutput(IMediaSample *, IMemAllocator *);
65
            ALLOCATOR_PROPERTIES getDefaultAllocatorProperties() const;
66
67
            bool m_shouldDuplicateSamples;
68
            const bool m_transform; //defines if the pin is transforming the samples
69
            QPin* const m_output;
70
            QMutex m_mutexReceive;
71
        };
72
    }
73
}
74
75
QT_END_NAMESPACE
76
77
#endif