bool parseURI(string stringUri, URI &uri) { /* * schema://[username[:password]@]host[:port][/[path[?parameters]]] */ LOG_URI("------------------------"); LOG_URI("stringUri: `%s`", STR(stringUri)); string fullUri; string fullUriWithAuth = stringUri; string scheme; string authentication; string username; string password; string hostPort; string host; string portString; uint16_t port = 0; bool portSpecified = false; string fullDocumentPathWithParameters; string fullDocumentPath; string fullParameters; string documentPath; string document; string documentWithFullParameters; Variant parameters; string::size_type cursor = 0; string::size_type pos = 0; //1. Reset uri.Reset(); //2. trim trim(stringUri); if (stringUri == "") { FATAL("Empty uri"); return false; } //2. Get the scheme and the default port pos = stringUri.find("://", cursor); if (pos == string::npos) { FATAL("Unable to determine scheme"); return false; } scheme = lowerCase(stringUri.substr(cursor, pos - cursor)); cursor = pos + 3; if (_schemeToPort.size() == 0) { _schemeToPort["http"] = 80; _schemeToPort["rtmpt"] = 80; _schemeToPort["rtmpte"] = 80; _schemeToPort["ws"] = 80; _schemeToPort["https"] = 443; _schemeToPort["rtmps"] = 443; _schemeToPort["wss"] = 443; _schemeToPort["rtsp"] = 554; _schemeToPort["rtmp"] = 1935; _schemeToPort["rtmpe"] = 1935; _schemeToPort["mms"] = 1755; } if (MAP_HAS1(_schemeToPort, scheme)) { port = _schemeToPort[scheme]; } // else { // FATAL("Scheme `%s` not supported", STR(scheme)); // return false; // } LOG_URI("scheme: %s; default port: %"PRIu16, STR(scheme), port); //3. get the authentication portion. the search starts from //where the scheme detection left and up to the first / character string::size_type limit = stringUri.find("/", cursor); bool hasAuthentication = false; pos = stringUri.find("@", cursor); if (pos != string::npos) { if (limit != string::npos) { hasAuthentication = pos<limit; } else { hasAuthentication = true; } } if (hasAuthentication) { authentication = stringUri.substr(cursor, pos - cursor); fullUri = stringUri.substr(0, cursor); fullUri += stringUri.substr(pos + 1); cursor = pos + 1; } else { fullUri = fullUriWithAuth; } if (authentication != "") { pos = authentication.find(":"); if (pos != string::npos) { username = authentication.substr(0, pos); password = authentication.substr(pos + 1); } else { username = authentication; password = ""; } } LOG_URI("fullUri: `%s`; fullUriWithAuth: `%s`", STR(fullUri), STR(fullUriWithAuth)); LOG_URI("username: `%s`; password: `%s`", STR(username), STR(password)); //4. Get the host:port pos = stringUri.find("/", cursor); if (pos == string::npos) { hostPort = stringUri.substr(cursor); cursor = stringUri.size() - 1; fullDocumentPathWithParameters = "/"; } else { hostPort = stringUri.substr(cursor, pos - cursor); cursor = pos + 1; fullDocumentPathWithParameters = "/" + stringUri.substr(cursor); } trim(hostPort); if (hostPort == "") { FATAL("Invalid host:port specified"); return false; } pos = hostPort.find(":"); if (pos == string::npos) { host = hostPort; portSpecified = false; } else { host = hostPort.substr(0, pos); trim(host); portString = hostPort.substr(pos + 1); portSpecified = true; port = (uint16_t) atoi(STR(portString)); if (format("%"PRIu16, port) != portString) { FATAL("Invalid port number specified: `%s`", STR(portString)); return false; } } LOG_URI("host: %s; port: %"PRIu16"; portSpecified: %d", STR(host), port, portSpecified); //5. fullDocumentPathWithParameters fullDocumentPath = "/"; fullParameters = ""; documentPath = "/"; document = ""; documentWithFullParameters = ""; parameters.Reset(); parameters.IsArray(false); if (fullDocumentPathWithParameters != "/") { pos = fullDocumentPathWithParameters.find("?"); if (pos == string::npos) { fullDocumentPath = fullDocumentPathWithParameters; fullParameters = ""; } else { fullDocumentPath = fullDocumentPathWithParameters.substr(0, pos); fullParameters = fullDocumentPathWithParameters.substr(pos + 1); } trim(fullParameters); if (fullParameters != "") { vector<string> elements; split(fullParameters, "&", elements); for (uint32_t i = 0; i < elements.size(); i++) { string kvp = elements[i]; if (kvp == "") continue; string k = ""; string v = ""; pos = kvp.find("="); if (pos == string::npos) { k = kvp; v = ""; } else { k = kvp.substr(0, pos); v = kvp.substr(pos + 1); } if (k == "") continue; parameters[k] = v; //DEBUG("k=%s, v=%s", STR(k), STR(v)); } } bool rtmpDocument = false; if (scheme.find("rtmp") == 0) { pos = fullDocumentPath.find(':'); if (pos == string::npos) { rtmpDocument = false; } else { pos = fullDocumentPath.rfind('/', pos); if (pos == string::npos) { rtmpDocument = false; } else { rtmpDocument = true; } } } else { rtmpDocument = false; } if (rtmpDocument) { pos = fullDocumentPath.find(':'); pos = fullDocumentPath.rfind('/', pos); documentPath = fullDocumentPath.substr(0, pos + 1); document = fullDocumentPath.substr(pos + 1); } else { for (string::size_type i = fullDocumentPath.size() - 1; i != 0; i--) { if (fullDocumentPath[i] == '/') break; document = fullDocumentPath[i] + document; } documentPath = fullDocumentPath.substr(0, fullDocumentPath.size() - document.size()); } documentWithFullParameters = document; if (fullParameters != "") documentWithFullParameters += "?" + fullParameters; } LOG_URI("fullDocumentPathWithParameters: `%s`", STR(fullDocumentPathWithParameters)); LOG_URI("fullDocumentPath: `%s`", STR(fullDocumentPath)); LOG_URI("fullParameters: `%s`", STR(fullParameters)); LOG_URI("documentPath: `%s`", STR(documentPath)); LOG_URI("document: `%s`", STR(document)); LOG_URI("documentWithFullParameters: `%s`", STR(documentWithFullParameters)); LOG_URI("parameters:"); #ifdef DEBUG_URI FOR_MAP(parameters, string, Variant, i) { LOG_URI("\t`%s`: `%s`", STR(MAP_KEY(i)), STR(MAP_VAL(i))); }
void IOHandlerManager::ShutdownIOHandlers() { FOR_MAP(_activeIOHandlers, uint32_t, IOHandler *, i) { EnqueueForDelete(MAP_VAL(i)); }
void ProtocolManager::Shutdown() { while (_activeProtocols.size() > 0) { EnqueueForDelete(MAP_VAL(_activeProtocols.begin())); } }
FOR_MAP(_modules, string, Module, i) { MAP_VAL(i).Release(); }
BaseInStream::~BaseInStream() { _canCallOutStreamDetached = false; while (_linkedStreams.size() > 0) { UnLink(MAP_VAL(_linkedStreams.begin()), true); } }
FOR_MAP(config[CONF_ACCEPTORS], string, Variant, i) { if (!BindAcceptor(MAP_VAL(i))) { FATAL("Unable to configure acceptor:\n%s", STR(MAP_VAL(i).ToString())); return false; } }
bool parseURI(string stringUri, URI &uri) { LOG_URI_SPLIT("stringUri: %s", STR(stringUri)); uri.Reset(); trim(stringUri); if (stringUri == "") return false; if (stringUri.size() > 1024) return false; uri.fullUri = stringUri; LOG_URI_SPLIT("uri.fullUri: %s", STR(uri.fullUri)); // scheme://user:pwd@host:port/document/parts/here vector<string> components; split(stringUri, "/", components); for (uint32_t i = 0; i < components.size(); i++) { LOG_URI_SPLIT("%u: %s", i, STR(components[i])); } //0 - scheme: if (components[0] == "") return false; if (components[0][components[0].size() - 1] != ':') return false; uri.scheme = lowerCase(components[0].substr(0, components[0].size() - 1)); LOG_URI_SPLIT("uri.scheme: %s", STR(uri.scheme)); //1 - nothing if (components[1] != "") return false; //2 - user:pwd@host:port vector<string> hostComponents; if (components[2].find("@") != string::npos) { split(components[2], "@", hostComponents); if (hostComponents.size() != 2) return false; if ((hostComponents[0] == "") || (hostComponents[1] == "")) { return false; } components[2] = hostComponents[1]; vector<string> userNamePasswordComponents; split(hostComponents[0], ":", userNamePasswordComponents); if (userNamePasswordComponents.size() != 2) return false; if ((userNamePasswordComponents[0] == "") || (userNamePasswordComponents[1] == "")) { return false; } uri.userName = userNamePasswordComponents[0]; LOG_URI_SPLIT("uri.userName: %s", STR(uri.userName)); uri.password = userNamePasswordComponents[1]; LOG_URI_SPLIT("uri.password: %s", STR(uri.password)); } split(components[2], ":", hostComponents); if (hostComponents.size() == 1) { if (hostComponents[0] == "") return false; uri.host = hostComponents[0]; LOG_URI_SPLIT("uri.host: %s", STR(uri.host)); } else if (hostComponents.size() == 2) { if ((hostComponents[0] == "") || (hostComponents[0] == "")) return false; uri.host = hostComponents[0]; LOG_URI_SPLIT("uri.host: %s", STR(uri.host)); int32_t port = atoi(STR(hostComponents[1])); if ((port <= 0) || (port > 65535)) return false; uri.port = (uint16_t) port; } else { return false; } if (uri.port == 0) { if (___schemeToPort.size() == 0) { ___schemeToPort["http"] = 80; ___schemeToPort["rtmpt"] = 80; ___schemeToPort["rtmpte"] = 80; ___schemeToPort["https"] = 443; ___schemeToPort["rtmps"] = 443; ___schemeToPort["rtsp"] = 554; ___schemeToPort["rtmp"] = 1935; ___schemeToPort["rtmpe"] = 1935; ___schemeToPort["mms"] = 1755; } if (MAP_HAS1(___schemeToPort, uri.scheme)) uri.port = ___schemeToPort[uri.scheme]; else return false; } LOG_URI_SPLIT("uri.port: %u", uri.port); for (uint32_t i = 3; i < components.size(); i++) { uri.fullDocumentPath += "/" + components[i]; } LOG_URI_SPLIT("uri.fullDocumentPath: %s", STR(uri.fullDocumentPath)); uri.documentPath = "/"; for (uint32_t i = 3; i < components.size() - 1; i++) { uri.documentPath += components[i]; if (i != components.size() - 2) uri.documentPath += "/"; } LOG_URI_SPLIT("uri.documentPath: %s", STR(uri.documentPath)); if ((components.size() - 1) >= 3) { uri.document = components[components.size() - 1]; vector<string> documentComponents; split(uri.document, "?", documentComponents); if (documentComponents.size() == 2) { uri.document = documentComponents[0]; map<string, string> params; params = mapping(documentComponents[1], "&", "=", true); FOR_MAP(params, string, string, i) { uri.parameters[MAP_KEY(i)] = MAP_VAL(i); LOG_URI_SPLIT("uri.parameters[\"%s\"]: %s", STR(MAP_KEY(i)), STR(MAP_VAL(i))); }
bool PushVariant(lua_State *pLuaState, Variant &variant, bool substituteNullables) { switch ((VariantType) variant) { case V_UNDEFINED: case V_NULL: { if (substituteNullables) lua_pushstring(pLuaState, VAR_NULL_VALUE); else lua_pushnil(pLuaState); return true; break; } case V_STRING: { lua_pushstring(pLuaState, STR(variant)); return true; break; } case V_INT8: case V_INT16: case V_INT32: case V_INT64: case V_UINT8: case V_UINT16: case V_UINT32: case V_UINT64: case V_DOUBLE: { lua_pushnumber(pLuaState, (double) variant); return true; break; } case V_BOOL: { lua_pushboolean(pLuaState, (bool)variant); return true; break; } case V_TIMESTAMP: { struct tm tempTm = (struct tm) variant; lua_createtable(pLuaState, 0, 0); lua_pushstring(pLuaState, VAR_TYPE); lua_pushstring(pLuaState, VAR_TIMESTAMP); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_YEAR); lua_pushnumber(pLuaState, tempTm.tm_year + 1900); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_MONTH); lua_pushnumber(pLuaState, tempTm.tm_mon+1); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_DAY); lua_pushnumber(pLuaState, tempTm.tm_mday); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_HOUR); lua_pushnumber(pLuaState, tempTm.tm_hour); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_MIN); lua_pushnumber(pLuaState, tempTm.tm_min); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_SEC); lua_pushnumber(pLuaState, tempTm.tm_sec); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_ISDST); lua_pushboolean(pLuaState, false); lua_settable(pLuaState, -3); return true; break; } case V_DATE: { struct tm tempTm = (struct tm) variant; lua_createtable(pLuaState, 0, 0); lua_pushstring(pLuaState, VAR_TYPE); lua_pushstring(pLuaState, VAR_DATE); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_YEAR); lua_pushnumber(pLuaState, tempTm.tm_year + 1900); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_MONTH); lua_pushnumber(pLuaState, tempTm.tm_mon); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_DAY); lua_pushnumber(pLuaState, tempTm.tm_mday); lua_settable(pLuaState, -3); return true; break; } case V_TIME: { struct tm tempTm = (struct tm) variant; lua_createtable(pLuaState, 0, 0); lua_pushstring(pLuaState, VAR_TYPE); lua_pushstring(pLuaState, VAR_TIME); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_YEAR); lua_pushnumber(pLuaState, 1970); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_MONTH); lua_pushnumber(pLuaState, 1); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_DAY); lua_pushnumber(pLuaState, 1); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_HOUR); lua_pushnumber(pLuaState, tempTm.tm_hour); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_MIN); lua_pushnumber(pLuaState, tempTm.tm_min); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_SEC); lua_pushnumber(pLuaState, tempTm.tm_sec); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_ISDST); lua_pushboolean(pLuaState, false); lua_settable(pLuaState, -3); return true; break; } case V_TYPED_MAP: case V_MAP: { lua_createtable(pLuaState, 0, 0); if ((VariantType) variant == V_TYPED_MAP) { lua_pushstring(pLuaState, VAR_MAP_NAME); lua_pushstring(pLuaState, STR(variant.GetTypeName())); lua_settable(pLuaState, -3); } FOR_MAP(variant, string, Variant, i) { if (MAP_KEY(i).find(VAR_INDEX_VALUE) == 0) { string temp = MAP_KEY(i).substr(VAR_INDEX_VALUE_LEN, string::npos); char *error = NULL; double index = strtod(STR(temp), &error); if (error == STR(temp) + temp.size()) { lua_pushnumber(pLuaState, index); } else { lua_pushstring(pLuaState, STR(MAP_KEY(i))); } } else { lua_pushstring(pLuaState, STR(MAP_KEY(i))); } if (!PushVariant(pLuaState, MAP_VAL(i), true)) { FINEST("Unable to push primitive"); return false; } lua_settable(pLuaState, -3); } return true; break; } default: { FATAL("Unknown type %hhu", (VariantType) variant); return false; break; } } return true; }
bool InboundConnectivity::Initialize() { //1. get the application BaseClientApplication *pApplication = _pRTSP->GetApplication(); if (pApplication == NULL) { FATAL("RTSP protocol not yet assigned to an application"); return false; } //2. Compute the bandwidthHint uint32_t bandwidth = 0; if (_videoTrack != V_NULL) { bandwidth += (uint32_t) SDP_TRACK_BANDWIDTH(_videoTrack); } if (_audioTrack != V_NULL) { bandwidth += (uint32_t) SDP_TRACK_BANDWIDTH(_audioTrack); } if (bandwidth == 0) { bandwidth = _bandwidthHint; } //5. Create the in stream if (_streamName == "") _streamName = format("rtsp_%u", _pRTSP->GetId()); if (!pApplication->StreamNameAvailable(_streamName, _pRTSP)) { FATAL("Stream name %s already taken", STR(_streamName)); return false; } _pInStream = new InNetRTPStream(_pRTSP, pApplication->GetStreamsManager(), _streamName, _videoTrack != V_NULL ? unb64((string) SDP_VIDEO_CODEC_H264_SPS(_videoTrack)) : "", _videoTrack != V_NULL ? unb64((string) SDP_VIDEO_CODEC_H264_PPS(_videoTrack)) : "", _audioTrack != V_NULL ? unhex(SDP_AUDIO_CODEC_SETUP(_audioTrack)) : "", bandwidth, _rtcpDetectionInterval); //6. override the width/height with the values in session (if any) Variant &session = _pRTSP->GetCustomParameters(); if ((session.HasKeyChain(_V_NUMERIC, true, 3, "customParameters", "externalStreamConfig", "width")) && (session.HasKeyChain(_V_NUMERIC, true, 3, "customParameters", "externalStreamConfig", "height"))) { StreamCapabilities *pCap = _pInStream->GetCapabilities(); if (pCap->videoCodecId == CODEC_VIDEO_AVC) { pCap->avc._widthOverride = (uint32_t) session["customParameters"]["externalStreamConfig"]["width"]; pCap->avc._heightOverride = (uint32_t) session["customParameters"]["externalStreamConfig"]["height"]; } } // pCap->avc._widthOverride=session["width"]; // pCap->avc._widthOverride=session[""]; //6. make the stream known to inbound RTP protocols //and plug in the connectivity if (_pRTPVideo != NULL) { _pRTPVideo->SetStream(_pInStream, false); _pRTPVideo->SetInbboundConnectivity(this); _pRTCPVideo->SetInbboundConnectivity(this, false); } if (_pRTPAudio != NULL) { _pRTPAudio->SetStream(_pInStream, true); _pRTPAudio->SetInbboundConnectivity(this); _pRTCPAudio->SetInbboundConnectivity(this, true); } //7. Pickup all outbound waiting streams map<uint32_t, BaseOutStream *> subscribedOutStreams = pApplication->GetStreamsManager()->GetWaitingSubscribers( _streamName, _pInStream->GetType(), true); //FINEST("subscribedOutStreams count: %"PRIz"u", subscribedOutStreams.size()); //8. Bind the waiting subscribers FOR_MAP(subscribedOutStreams, uint32_t, BaseOutStream *, i) { BaseOutStream *pBaseOutStream = MAP_VAL(i); pBaseOutStream->Link(_pInStream); }
InboundTSProtocol::~InboundTSProtocol() { //1. Cleanup the pid mappings FOR_MAP(_pidMapping, uint16_t, PIDDescriptor *, i) { FreePidDescriptor(MAP_VAL(i)); }
void StreamsManager::UnRegisterStreams(uint32_t protocolId) { map<uint32_t, BaseStream *> streams = FindByProtocolId(protocolId); FOR_MAP(streams, uint32_t, BaseStream *, i) { UnRegisterStream(MAP_VAL(i)); }
bool PushVariant(lua_State *pLuaState, Variant &variant, bool substituteNullables) { switch ((VariantType) variant) { case V_UNDEFINED: case V_NULL: { if (substituteNullables) lua_pushstring(pLuaState, VAR_NULL_VALUE); else lua_pushnil(pLuaState); return true; break; } case V_STRING: { lua_pushstring(pLuaState, STR(variant)); return true; break; } case V_INT8: case V_INT16: case V_INT32: case V_INT64: case V_UINT8: case V_UINT16: case V_UINT32: case V_UINT64: case V_DOUBLE: { lua_pushnumber(pLuaState, (double) variant); return true; break; } case V_BOOL: { lua_pushboolean(pLuaState, (bool)variant); return true; break; } case V_TIMESTAMP: { struct tm tempTm = (struct tm) variant; lua_createtable(pLuaState, 0, 0); lua_pushstring(pLuaState, VAR_TYPE); lua_pushstring(pLuaState, VAR_TIMESTAMP); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_YEAR); lua_pushnumber(pLuaState, tempTm.tm_year + 1900); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_MONTH); lua_pushnumber(pLuaState, tempTm.tm_mon + 1); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_DAY); lua_pushnumber(pLuaState, tempTm.tm_mday); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_HOUR); lua_pushnumber(pLuaState, tempTm.tm_hour + 1); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_MIN); lua_pushnumber(pLuaState, tempTm.tm_min); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_SEC); lua_pushnumber(pLuaState, tempTm.tm_sec); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_ISDST); lua_pushboolean(pLuaState, false); lua_settable(pLuaState, -3); return true; break; } case V_DATE: { struct tm tempTm = (struct tm) variant; lua_createtable(pLuaState, 0, 0); lua_pushstring(pLuaState, VAR_TYPE); lua_pushstring(pLuaState, VAR_DATE); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_YEAR); lua_pushnumber(pLuaState, tempTm.tm_year + 1900); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_MONTH); lua_pushnumber(pLuaState, tempTm.tm_mon + 1); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_DAY); lua_pushnumber(pLuaState, tempTm.tm_mday); lua_settable(pLuaState, -3); return true; break; } case V_TIME: { struct tm tempTm = (struct tm) variant; lua_createtable(pLuaState, 0, 0); lua_pushstring(pLuaState, VAR_TYPE); lua_pushstring(pLuaState, VAR_TIME); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_YEAR); lua_pushnumber(pLuaState, 1970); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_MONTH); lua_pushnumber(pLuaState, 1); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_DAY); lua_pushnumber(pLuaState, 1); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_HOUR); lua_pushnumber(pLuaState, tempTm.tm_hour + 1); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_MIN); lua_pushnumber(pLuaState, tempTm.tm_min); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_SEC); lua_pushnumber(pLuaState, tempTm.tm_sec); lua_settable(pLuaState, -3); lua_pushstring(pLuaState, VAR_ISDST); lua_pushboolean(pLuaState, false); lua_settable(pLuaState, -3); return true; break; } case V_TYPED_MAP: case V_MAP: { lua_createtable(pLuaState, 0, 0); if ((VariantType) variant == V_TYPED_MAP) { lua_pushstring(pLuaState, VAR_MAP_NAME); lua_pushstring(pLuaState, STR(variant.GetTypeName())); lua_settable(pLuaState, -3); } FOR_MAP(variant, string, Variant, i) { const char *pKey = MAP_KEY(i).c_str(); if ((MAP_KEY(i).length() == 10) && (pKey[0] == '0') && (pKey[1] == 'x')) { uint32_t index = (uint32_t) strtol(pKey, NULL, 16); lua_pushnumber(pLuaState, index); } else { lua_pushstring(pLuaState, pKey); } if (!PushVariant(pLuaState, MAP_VAL(i), true)) { FINEST("Unable to push primitive"); return false; } lua_settable(pLuaState, -3); } return true; break; } default: { FATAL("Unknown type %d", (VariantType) variant); return false; break; } } }
SOManager::~SOManager() { FOR_MAP(_sos, string, SO *, i) { delete MAP_VAL(i); }
uint32_t BaseV4L2VideoCapture::GetHeight() { return MAP_VAL(_pCurrentDeviceStream.begin())->GetConfig()->height; }
uint32_t BaseV4L2VideoCapture::GetWidth() { return MAP_VAL(_pCurrentDeviceStream.begin())->GetConfig()->width; }
DeviceVideoStream* BaseV4L2VideoCapture::GetCurrentDeviceStream() { return MAP_VAL(_pCurrentDeviceStream.begin()); }