| 88 | } |
| 89 | |
| 90 | XnStatus RecorderImpl::AddNode(ProductionNode &node, XnCodecID compression) |
| 91 | { |
| 92 | if (!node.IsValid()) |
| 93 | { |
| 94 | return XN_STATUS_BAD_PARAM; |
| 95 | } |
| 96 | |
| 97 | NodeWatchersMap::ConstIterator it = m_nodeWatchersMap.Find(node.GetHandle()); |
| 98 | if (it != m_nodeWatchersMap.End()) |
| 99 | { |
| 100 | return XN_STATUS_NODE_ALREADY_RECORDED; |
| 101 | } |
| 102 | |
| 103 | if (compression == XN_CODEC_NULL) |
| 104 | { |
| 105 | compression = GetDefaultCodecID(node); |
| 106 | } |
| 107 | |
| 108 | // take the predefined type (if we'll store extension types, we won't be able to play them later on) |
| 109 | XnProductionNodeType type = TypeManager::GetInstance().GetPredefinedBaseType(node.GetInfo().GetDescription().Type); |
| 110 | |
| 111 | NodeWatcher* pNodeWatcher = NULL; |
| 112 | XnStatus nRetVal = CreateNodeWatcher(node, type, ModuleHandle(), Notifications(), pNodeWatcher); |
| 113 | XN_IS_STATUS_OK(nRetVal); |
| 114 | nRetVal = pNodeWatcher->Register(); |
| 115 | if (nRetVal != XN_STATUS_OK) |
| 116 | { |
| 117 | XN_DELETE(pNodeWatcher); |
| 118 | return nRetVal; |
| 119 | } |
| 120 | |
| 121 | nRetVal = NotifyNodeAdded(node.GetHandle(), type, compression); |
| 122 | if (nRetVal != XN_STATUS_OK) |
| 123 | { |
| 124 | XN_DELETE(pNodeWatcher); |
| 125 | return nRetVal; |
| 126 | } |
| 127 | |
| 128 | nRetVal = pNodeWatcher->NotifyState(); |
| 129 | if (nRetVal != XN_STATUS_OK) |
| 130 | { |
| 131 | XN_DELETE(pNodeWatcher); |
| 132 | return nRetVal; |
| 133 | } |
| 134 | |
| 135 | nRetVal = m_nodeWatchersMap.Set(node.GetHandle(), pNodeWatcher); |
| 136 | if (nRetVal != XN_STATUS_OK) |
| 137 | { |
| 138 | XN_DELETE(pNodeWatcher); |
| 139 | return nRetVal; |
| 140 | } |
| 141 | |
| 142 | return XN_STATUS_OK; |
| 143 | } |
| 144 | |
| 145 | XnStatus RecorderImpl::RemoveNode(ProductionNode &node) |
| 146 | { |
nothing calls this directly
no test coverage detected