source: trunk/src/3rdparty/phonon/ds9/backendnode.cpp@ 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: 4.0 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#include "backendnode.h"
19#include "mediaobject.h"
20
21#include <ocidl.h> // ISpecifyPropertyPages
22#include <olectl.h> // OleCreatePropertyFrame
23
24QT_BEGIN_NAMESPACE
25
26namespace Phonon
27{
28 namespace DS9
29 {
30 // Displays a property dialog for a filter (experimental but should be put into main
31 /*static void showPropertyDialog(const Filter &filter)
32 {
33 ComPointer<ISpecifyPropertyPages> prop(filter, IID_ISpecifyPropertyPages);
34 if (prop != 0) {
35 IUnknown *iunk[] = {filter};
36 // Show the page.
37 CAUUID caGUID;
38 prop->GetPages(&caGUID);
39 OleCreatePropertyFrame(
40 0, // Parent window
41 0, 0, // (Reserved)
42 0, // Caption for the dialog box
43 1, // Number of objects (just the filter)
44 iunk, // Array of object pointers.
45 caGUID.cElems, // Number of property pages
46 caGUID.pElems, // Array of property page CLSIDs
47 0, // Locale identifier
48 0, 0 // Reserved
49 );
50 }
51 }*/
52
53 //for now we have 2 graphs that do the same
54 BackendNode::BackendNode(QObject *parent) : QObject(parent), m_mediaObject(0)
55 {
56 }
57
58 BackendNode::~BackendNode()
59 {
60 }
61
62 void BackendNode::setMediaObject(MediaObject *mo)
63 {
64 if (m_mediaObject) {
65 disconnect(m_mediaObject, SIGNAL(destroyed()), this, SLOT(mediaObjectDestroyed()));
66 }
67 m_mediaObject = mo;
68 connect(mo, SIGNAL(destroyed()), SLOT(mediaObjectDestroyed()));
69 }
70
71 void BackendNode::mediaObjectDestroyed()
72 {
73 //remove the filter from its graph
74 FILTER_INFO info;
75 for(int i = 0; i < FILTER_COUNT; ++i) {
76 const Filter &filter = m_filters[i];
77 if (!filter)
78 continue;
79 filter->QueryFilterInfo(&info);
80 if (info.pGraph) {
81 HRESULT hr = info.pGraph->RemoveFilter(filter);
82 Q_ASSERT(SUCCEEDED(hr));
83 Q_UNUSED(hr);
84 info.pGraph->Release();
85 }
86 }
87 m_mediaObject = 0;
88 }
89
90 QList<InputPin> BackendNode::pins(const Filter &filter, PIN_DIRECTION wantedDirection)
91 {
92 QList<InputPin> ret;
93 if (filter) {
94 ComPointer<IEnumPins> enumPin;
95 HRESULT hr = filter->EnumPins(enumPin.pparam());
96 Q_UNUSED(hr);
97 Q_ASSERT( SUCCEEDED(hr));
98 InputPin pin;
99 while (enumPin->Next(1, pin.pparam(), 0) == S_OK) {
100 PIN_DIRECTION dir;
101 hr = pin->QueryDirection(&dir);
102 Q_ASSERT( SUCCEEDED(hr));
103 if (dir == wantedDirection) {
104 ret.append(pin);
105 }
106 }
107 }
108 return ret;
109 }
110 }
111}
112
113QT_END_NAMESPACE
114
115#include "moc_backendnode.cpp"
Note: See TracBrowser for help on using the repository browser.