|
1 //buffersink.cpp |
|
2 |
|
3 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 // All rights reserved. |
|
5 // This component and the accompanying materials are made available |
|
6 // under the terms of "Eclipse Public License v1.0" |
|
7 // which accompanies this distribution, and is available |
|
8 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 // |
|
10 // Initial Contributors: |
|
11 // Nokia Corporation - initial contribution. |
|
12 // |
|
13 // Contributors: |
|
14 // |
|
15 // Description: |
|
16 // |
|
17 |
|
18 |
|
19 |
|
20 #include "buffersink.h" |
|
21 #include "moutputport.h" |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // Constructor |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 CBufferSink::CBufferSink() |
|
28 { |
|
29 TRACE_CREATE(); |
|
30 DP_CONTEXT(CBufferSink::CBufferSink *CD1*, CtxDevSound, DPLOCAL); |
|
31 DP_IN(); |
|
32 DP_OUT(); |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // Factory method |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 EXPORT_C CBufferSink* CBufferSink::NewL() |
|
40 { |
|
41 DP_STATIC_CONTEXT(CBufferSink::NewL *CD0*, CtxDevSound, DPLOCAL); |
|
42 DP_IN(); |
|
43 CBufferSink* self = new(ELeave)CBufferSink(); |
|
44 CleanupStack::PushL(self); |
|
45 self->ConstructL(); |
|
46 CleanupStack::Pop(self); |
|
47 DP0_RET(self, "0x%x"); |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // Second phase constructor |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 void CBufferSink::ConstructL() |
|
55 { |
|
56 DP_CONTEXT(CBufferSink::ConstructL *CD1*, CtxDevSound, DPLOCAL); |
|
57 DP_IN(); |
|
58 DP_OUT(); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // Destructor |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CBufferSink::~CBufferSink() |
|
66 { |
|
67 DP_CONTEXT(CBufferSink::~CBufferSink *CD1*, CtxDevSound, DPLOCAL); |
|
68 DP_IN(); |
|
69 DP_OUT(); |
|
70 } |
|
71 |
|
72 // from class MInputPort |
|
73 // --------------------------------------------------------------------------- |
|
74 // CBufferSink::GetInputPort |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 TInt CBufferSink::GetInputPort(MInputPort*& aInput) |
|
78 { |
|
79 DP_CONTEXT(CBufferSource::GetInputPort *CD1*, CtxDevSound, DPLOCAL); |
|
80 DP_IN(); |
|
81 aInput = this; |
|
82 DP0_RET(KErrNone, "%d"); |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CBufferSink::EmptyBuffer |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 TInt CBufferSink::EmptyBuffer(CMMFBuffer* aBuffer, MOutputPort* aSupplier) |
|
90 { |
|
91 DP_CONTEXT(CBufferSink::EmptyBuffer *CD1*, CtxDevSound, DPLOCAL); |
|
92 DP_IN(); |
|
93 TInt err = KErrNone; |
|
94 if (aSupplier == iOutput) |
|
95 { |
|
96 iConsumer->BufferToBeEmptied(static_cast<MMMFBufferSink*>(this), aBuffer); |
|
97 } |
|
98 else |
|
99 { |
|
100 err = KErrNotSupported; |
|
101 } |
|
102 DP0_RET(err, "%d"); |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // CBufferSink::BufferFilled |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 TInt CBufferSink::BufferFilled(CMMFBuffer* /*aBuffer*/) |
|
110 { |
|
111 DP_CONTEXT(CBufferSink::BufferFilled *CD1*, CtxDevSound, DPLOCAL); |
|
112 DP_IN(); |
|
113 DP0_RET(KErrNone, "%d"); |
|
114 } |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // CBufferSink::SetOutput |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 TInt CBufferSink::SetOutput(MOutputPort* aOutput) |
|
121 { |
|
122 DP_CONTEXT(CBufferSink::SetOutput *CD1*, CtxDevSound, DPLOCAL); |
|
123 DP_IN(); |
|
124 iOutput = aOutput; |
|
125 DP0_RET(KErrNone, "%d"); |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------------------------- |
|
129 // CBufferSink::RemoveOutput |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 TInt CBufferSink::RemoveOutput(MOutputPort* /*aOutput*/) |
|
133 { |
|
134 DP_CONTEXT(CBufferSink::RemoveOutput *CD1*, CtxDevSound, DPLOCAL); |
|
135 DP_IN(); |
|
136 iOutput=NULL; |
|
137 DP0_RET(KErrNone, "%d"); |
|
138 } |
|
139 |
|
140 // from MMMFBufferSink |
|
141 // --------------------------------------------------------------------------- |
|
142 // CBufferSink::SetDataConsumer |
|
143 // --------------------------------------------------------------------------- |
|
144 // |
|
145 TInt CBufferSink::SetDataConsumer(MMMFAudioDataConsumer& aConsumer) |
|
146 { |
|
147 DP_CONTEXT(CBufferSink::SetDataConsumer *CD1*, CtxDevSound, DPLOCAL); |
|
148 DP_IN(); |
|
149 iConsumer = &aConsumer; |
|
150 DP0_RET(KErrNone, "%d"); |
|
151 } |
|
152 |
|
153 // --------------------------------------------------------------------------- |
|
154 // CBufferSink::BufferEmptied |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 TInt CBufferSink::BufferEmptied(CMMFBuffer* aBuffer) |
|
158 { |
|
159 DP_CONTEXT(CBufferSink::BufferFilled *CD1*, CtxDevSound, DPLOCAL); |
|
160 DP_IN(); |
|
161 // Check if need a switch |
|
162 iBuffer = aBuffer; |
|
163 DP_OUT(); |
|
164 return(iOutput->BufferEmptied(aBuffer)); |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------------------------- |
|
168 // CBufferSink::BuffersDiscarded |
|
169 // --------------------------------------------------------------------------- |
|
170 // |
|
171 TInt CBufferSink::BuffersDiscarded() |
|
172 { |
|
173 DP_CONTEXT(CBufferSink::BuffersDiscarded *CD1*, CtxDevSound, DPLOCAL); |
|
174 DP_IN(); |
|
175 // Check what we are suppose to do |
|
176 if(iBuffer) |
|
177 { |
|
178 iBuffer = NULL; |
|
179 } |
|
180 DP0_RET(KErrNone, "%d"); |
|
181 } |
|
182 |
|
183 // end of file |