source: trunk/src/3rdparty/phonon/ds9/qpin.h@ 138

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

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 3.9 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_QPIN_H
19#define PHONON_QPIN_H
20
21#include "phononds9_namespace.h"
22
23#include <QtCore/QString>
24#include <QtCore/QVector>
25#include <QtCore/QReadWriteLock>
26
27#include <dshow.h>
28
29QT_BEGIN_NAMESPACE
30
31namespace Phonon
32{
33 namespace DS9
34 {
35 class QBaseFilter;
36
37 //this is the base class for our self-implemented Pins
38 class QPin : public IPin
39 {
40 public:
41 QPin(QBaseFilter *parent, PIN_DIRECTION dir, const QVector<AM_MEDIA_TYPE> &mt);
42 virtual ~QPin();
43
44 //reimplementation from IUnknown
45 STDMETHODIMP QueryInterface(REFIID iid, void** out);
46 STDMETHODIMP_(ULONG) AddRef();
47 STDMETHODIMP_(ULONG) Release();
48
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);
65
66 QVector<AM_MEDIA_TYPE> mediaTypes() const;
67
68 HRESULT setAcceptedMediaType(const AM_MEDIA_TYPE &);
69
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;
79
80 FILTER_STATE filterState() const;
81
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);
85
86 protected:
87 //this can be used by sub-classes
88 mutable QReadWriteLock m_lock;
89 QBaseFilter *m_parent;
90 bool m_flushing;
91
92 private:
93 HRESULT checkOutputMediaTypesConnection(IPin *pin);
94 HRESULT checkOwnMediaTypesConnection(IPin *pin);
95
96 LONG m_refCount;
97 IPin *m_connected;
98 const PIN_DIRECTION m_direction;
99 QVector<AM_MEDIA_TYPE> m_mediaTypes; //accepted media types
100 AM_MEDIA_TYPE m_connectedType;
101 QString m_name;
102 IMemAllocator *m_memAlloc;
103 };
104
105 //utility function
106 class QAMMediaType : public AM_MEDIA_TYPE
107 {
108 public:
109 ~QAMMediaType()
110 {
111 QPin::freeMediaType(*this);
112 }
113
114 };
115
116 }
117}
118
119QT_END_NAMESPACE
120
121#endif //PHONON_QPIN_H
Note: See TracBrowser for help on using the repository browser.