• 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 "pv_2way_cmd_control_datapath.h"
19 
20 
CloseDatapath(TPV2WayCmdInfo * aCmdInfo)21 bool CPV2WayCmdControlDatapath::CloseDatapath(TPV2WayCmdInfo *aCmdInfo)
22 {
23     PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_NOTICE, (0, "CPV2WayCmdControlDatapath::CloseDatapath state %d cmd %x\n", iState, aCmdInfo));
24     if (iState == EClosing)
25     {
26         if (iCmdInfo == NULL) iCmdInfo = aCmdInfo;
27         return false;
28     }
29     else
30     {
31         //If command was already in progress when close was initiated.
32         if (iCmdInfo)
33         {
34             if ((aCmdInfo == NULL) && (iState == EOpening))
35             {
36                 Close();
37                 return false;
38             }
39 
40             CommandComplete(PVMFErrCancelled);
41         }
42 
43         iCmdInfo = aCmdInfo;
44         Close();
45 
46         return true;
47     }
48 }
49 
CommandComplete(PVMFStatus aStatus)50 void CPV2WayCmdControlDatapath::CommandComplete(PVMFStatus aStatus)
51 {
52     iCmdInfo->status = aStatus;
53     i2Way->Dispatch(iCmdInfo);
54     iCmdInfo = NULL;
55 }
56 
57 
58 
59 
60 
61 
62 
63 
64 
65