• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 #include "pvmf_buffer_data_sink.h"
19 
PVMFBufferDataSink(int32 aPortTag)20 OSCL_EXPORT_REF PVMFBufferDataSink::PVMFBufferDataSink(int32 aPortTag)
21         : PvmfPortBaseImpl(aPortTag, this)
22 {
23     iNumBytesReceived = 0;
24     iNumPktsReceived = 0;
25     iNumPktErrorsReceived = 0;
26 }
27 
~PVMFBufferDataSink()28 OSCL_EXPORT_REF PVMFBufferDataSink::~PVMFBufferDataSink()
29 {
30 }
31 
HandlePortActivity(const PVMFPortActivity & aActivity)32 void PVMFBufferDataSink::HandlePortActivity(const PVMFPortActivity &aActivity)
33 {
34     if (aActivity.iType != PVMF_PORT_ACTIVITY_INCOMING_MSG)
35         return;
36     PVMFSharedMediaMsgPtr aMsg;
37     PVMFStatus aStatus;
38     while (IncomingMsgQueueSize())
39     {
40         aStatus = DequeueIncomingMsg(aMsg);
41         PutData(aMsg);
42     }
43 }
44 
45 // PVMFPortInterface virtuals
46 
PutData(PVMFSharedMediaMsgPtr aMsg)47 PVMFStatus PVMFBufferDataSink::PutData(PVMFSharedMediaMsgPtr aMsg)
48 {
49     OSCL_UNUSED_ARG(aMsg);
50     iNumPktsReceived++;
51     PVMFSharedMediaDataPtr mediaData;
52     convertToPVMFMediaData(mediaData, aMsg);
53     iNumBytesReceived += (mediaData->getFilledSize());
54     if (mediaData->getErrorsFlag())
55         iNumPktErrorsReceived++;
56     return PVMFSuccess;
57 }
58 
GetData(PVMFSharedMediaMsgPtr aMsg)59 PVMFStatus PVMFBufferDataSink::GetData(PVMFSharedMediaMsgPtr aMsg)
60 {
61     OSCL_UNUSED_ARG(aMsg);
62     return PVMFSuccess;
63 }
64 
GetNumBytesReceived()65 OSCL_EXPORT_REF unsigned PVMFBufferDataSink::GetNumBytesReceived()
66 {
67     return iNumBytesReceived;
68 }
69 
GetNumPktsReceived()70 OSCL_EXPORT_REF unsigned PVMFBufferDataSink::GetNumPktsReceived()
71 {
72     return iNumPktsReceived;
73 }
74 
GetNumPktErrorsReceived()75 OSCL_EXPORT_REF unsigned PVMFBufferDataSink::GetNumPktErrorsReceived()
76 {
77     return iNumPktErrorsReceived;
78 }
79 
setObserver(PvmiConfigAndCapabilityCmdObserver * aObserver)80 OSCL_EXPORT_REF void PVMFBufferDataSink::setObserver(PvmiConfigAndCapabilityCmdObserver* aObserver)
81 {
82     OSCL_UNUSED_ARG(aObserver);
83 }
84 
getParametersSync(PvmiMIOSession aSession,PvmiKeyType aIdentifier,PvmiKvp * & aParameters,int & num_parameter_elements,PvmiCapabilityContext aContext)85 OSCL_EXPORT_REF PVMFStatus PVMFBufferDataSink::getParametersSync(PvmiMIOSession aSession, PvmiKeyType aIdentifier,
86         PvmiKvp*& aParameters, int& num_parameter_elements,
87         PvmiCapabilityContext aContext)
88 {
89     OSCL_UNUSED_ARG(aSession);
90     OSCL_UNUSED_ARG(aIdentifier);
91     OSCL_UNUSED_ARG(aParameters);
92     OSCL_UNUSED_ARG(num_parameter_elements);
93     OSCL_UNUSED_ARG(aContext);
94 
95     return PVMFSuccess;
96 }
97 
releaseParameters(PvmiMIOSession aSession,PvmiKvp * aParameters,int num_elements)98 OSCL_EXPORT_REF PVMFStatus PVMFBufferDataSink::releaseParameters(PvmiMIOSession aSession, PvmiKvp* aParameters, int num_elements)
99 {
100     OSCL_UNUSED_ARG(aSession);
101     OSCL_UNUSED_ARG(aParameters);
102     OSCL_UNUSED_ARG(num_elements);
103 
104     return PVMFSuccess;
105 }
106 
createContext(PvmiMIOSession aSession,PvmiCapabilityContext & aContext)107 OSCL_EXPORT_REF void PVMFBufferDataSink::createContext(PvmiMIOSession aSession, PvmiCapabilityContext& aContext)
108 {
109     OSCL_UNUSED_ARG(aSession);
110     OSCL_UNUSED_ARG(aContext);
111 }
112 
setContextParameters(PvmiMIOSession aSession,PvmiCapabilityContext & aContext,PvmiKvp * aParameters,int num_parameter_elements)113 OSCL_EXPORT_REF void PVMFBufferDataSink::setContextParameters(PvmiMIOSession aSession, PvmiCapabilityContext& aContext,
114         PvmiKvp* aParameters, int num_parameter_elements)
115 {
116     OSCL_UNUSED_ARG(aSession);
117     OSCL_UNUSED_ARG(aContext);
118     OSCL_UNUSED_ARG(aParameters);
119     OSCL_UNUSED_ARG(num_parameter_elements);
120 }
121 
DeleteContext(PvmiMIOSession aSession,PvmiCapabilityContext & aContext)122 OSCL_EXPORT_REF void PVMFBufferDataSink::DeleteContext(PvmiMIOSession aSession, PvmiCapabilityContext& aContext)
123 {
124     OSCL_UNUSED_ARG(aSession);
125     OSCL_UNUSED_ARG(aContext);
126 }
127 
setParametersSync(PvmiMIOSession aSession,PvmiKvp * aParameters,int num_elements,PvmiKvp * & aRet_kvp)128 OSCL_EXPORT_REF void PVMFBufferDataSink::setParametersSync(PvmiMIOSession aSession, PvmiKvp* aParameters,
129         int num_elements, PvmiKvp * & aRet_kvp)
130 {
131     OSCL_UNUSED_ARG(aSession);
132     OSCL_UNUSED_ARG(aParameters);
133     OSCL_UNUSED_ARG(num_elements);
134     OSCL_UNUSED_ARG(aRet_kvp);
135 }
136 
setParametersAsync(PvmiMIOSession aSession,PvmiKvp * aParameters,int num_elements,PvmiKvp * & aRet_kvp,OsclAny * context)137 OSCL_EXPORT_REF PVMFCommandId PVMFBufferDataSink::setParametersAsync(PvmiMIOSession aSession, PvmiKvp* aParameters,
138         int num_elements, PvmiKvp*& aRet_kvp, OsclAny* context)
139 {
140     OSCL_UNUSED_ARG(aSession);
141     OSCL_UNUSED_ARG(aParameters);
142     OSCL_UNUSED_ARG(num_elements);
143     OSCL_UNUSED_ARG(aRet_kvp);
144     OSCL_UNUSED_ARG(context);
145 
146     OSCL_LEAVE(OsclErrNotSupported);
147     return -1;
148 }
149 
getCapabilityMetric(PvmiMIOSession aSession)150 OSCL_EXPORT_REF uint32 PVMFBufferDataSink::getCapabilityMetric(PvmiMIOSession aSession)
151 {
152     OSCL_UNUSED_ARG(aSession);
153 
154     return 1;
155 }
156 
verifyParametersSync(PvmiMIOSession aSession,PvmiKvp * aParameters,int num_elements)157 OSCL_EXPORT_REF PVMFStatus PVMFBufferDataSink::verifyParametersSync(PvmiMIOSession aSession, PvmiKvp* aParameters, int num_elements)
158 {
159     OSCL_UNUSED_ARG(aSession);
160     OSCL_UNUSED_ARG(aParameters);
161     OSCL_UNUSED_ARG(num_elements);
162 
163     OSCL_LEAVE(OsclErrNotSupported);
164     return PVMFFailure;
165 }
166 
QueryInterface(const PVUuid & aUuid,OsclAny * & aPtr)167 OSCL_EXPORT_REF void PVMFBufferDataSink::QueryInterface(const PVUuid& aUuid, OsclAny*& aPtr)
168 {
169     aPtr = NULL;
170     if (aUuid == PVMI_CAPABILITY_AND_CONFIG_PVUUID)
171     {
172         aPtr = (PvmiCapabilityAndConfig*)this;
173     }
174     else
175     {
176         OSCL_LEAVE(OsclErrNotSupported);
177     }
178 }
179