1
/* This file is part of the KDE project.
3
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
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.
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.
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/>.
21
#include "phononds9_namespace.h"
23
#include <QtCore/QString>
24
#include <QtCore/QVector>
25
#include <QtCore/QMutex>
37
//this is the base class for our self-implemented Pins
38
class QPin : public IPin
41
QPin(QBaseFilter *parent, PIN_DIRECTION dir, const QVector<AM_MEDIA_TYPE> &mt);
44
//reimplementation from IUnknown
45
STDMETHODIMP QueryInterface(REFIID iid, void** out);
46
STDMETHODIMP_(ULONG) AddRef();
47
STDMETHODIMP_(ULONG) Release();
49
//reimplementation from IPin
50
STDMETHODIMP Connect(IPin *,const AM_MEDIA_TYPE *);
51
STDMETHODIMP ReceiveConnection(IPin *,const AM_MEDIA_TYPE *);
52
STDMETHODIMP Disconnect();
53
STDMETHODIMP ConnectedTo(IPin **);
54
STDMETHODIMP ConnectionMediaType(AM_MEDIA_TYPE *);
55
STDMETHODIMP QueryPinInfo(PIN_INFO *);
56
STDMETHODIMP QueryDirection(PIN_DIRECTION *);
57
STDMETHODIMP QueryId(LPWSTR*);
58
STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE*);
59
STDMETHODIMP EnumMediaTypes(IEnumMediaTypes **);
60
STDMETHODIMP QueryInternalConnections(IPin **, ULONG*);
61
STDMETHODIMP EndOfStream();
62
STDMETHODIMP BeginFlush();
63
STDMETHODIMP EndFlush();
64
STDMETHODIMP NewSegment(REFERENCE_TIME, REFERENCE_TIME, double);
66
QVector<AM_MEDIA_TYPE> mediaTypes() const;
68
HRESULT setAcceptedMediaType(const AM_MEDIA_TYPE &);
70
bool isFlushing() const;
71
void setConnectedType(const AM_MEDIA_TYPE &type);
72
const AM_MEDIA_TYPE &connectedType() const;
73
void setConnected(IPin *pin);
74
IPin *connected(bool = false) const;
75
void setMemoryAllocator(IMemAllocator *alloc);
76
IMemAllocator *memoryAllocator(bool = false) const;
77
void createDefaultMemoryAllocator(ALLOCATOR_PROPERTIES * = 0);
78
PIN_DIRECTION direction() const;
80
FILTER_STATE filterState() const;
82
static AM_MEDIA_TYPE copyMediaType(const AM_MEDIA_TYPE &type);
83
static void freeMediaType(AM_MEDIA_TYPE *type);
84
static void freeMediaType(const AM_MEDIA_TYPE &type);
87
//this can be used by sub-classes
88
mutable QMutex m_mutex;
89
QBaseFilter * const m_parent;
93
HRESULT checkOutputMediaTypesConnection(IPin *pin);
94
HRESULT checkOwnMediaTypesConnection(IPin *pin);
98
const PIN_DIRECTION m_direction;
99
QVector<AM_MEDIA_TYPE> m_mediaTypes; //accepted media types
100
AM_MEDIA_TYPE m_connectedType;
101
IMemAllocator *m_memAlloc;
105
class QAMMediaType : public AM_MEDIA_TYPE
110
QPin::freeMediaType(*this);
120
#endif //PHONON_QPIN_H