// // Check the details of an existing sender // // 1) Find the sender // 2) Get it's texture info // 3) Return the sharehandle, width, height, and format // // Returns : // true - all OK. // width and height are returned changed for sender size change // false - sender not found or size changed // width and height are returned zero for sender not found // bool spoutSenderNames::CheckSender(const char *sendername, unsigned int &theWidth, unsigned int &theHeight, HANDLE &hSharehandle, DWORD &dwFormat) { SharedTextureInfo info; char sname[SpoutMaxSenderNameLen]; // Is the given sender registered ? if(FindSenderName(sendername)) { // Does it still exist ? if(getSharedInfo(sendername, &info)) { // Return the texture info // strcpy_s(sendername, 256, sname); theWidth = (unsigned int)info.width; theHeight = (unsigned int)info.height; hSharehandle = (HANDLE)info.shareHandle; dwFormat = (DWORD)info.format; return true; } else { // Sender is registered but does not exist so close it ReleaseSenderName(sname); } } // Return zero width and height to indicate sender not found theHeight = 0; theWidth = 0; return false; } // end CheckSender
// // Check the details of an existing sender // // 1) Find the sender // 2) Get it's texture info // 3) Return the sharehandle, width, height, and format // // Returns : // true - all OK. // width and height are returned changed for sender size change // false - sender not found or size changed // width and height are returned zero for sender not found // bool spoutSenderNames::CheckSender(const char *sendername, unsigned int &theWidth, unsigned int &theHeight, HANDLE &hSharehandle, DWORD &dwFormat) { SharedTextureInfo info; // Is the given sender registered ? if(FindSenderName(sendername)) { // Does it still exist ? if(getSharedInfo(sendername, &info)) { // Return the texture info theWidth = (unsigned int)info.width; theHeight = (unsigned int)info.height; #ifdef _M_X64 hSharehandle = (HANDLE)(LongToHandle((long)info.shareHandle)); #else hSharehandle = (HANDLE)info.shareHandle; #endif // hSharehandle = (HANDLE)info.shareHandle; dwFormat = (DWORD)info.format; return true; } else { // Sender is registered but does not exist so close it ReleaseSenderName(sendername); } } // Return zero width and height to indicate sender not found theHeight = 0; theWidth = 0; return false; } // end CheckSender
// Find a sender and return the name, width and height, sharhandle and format bool spoutSenderNames::FindSender(char *sendername, unsigned int &width, unsigned int &height, HANDLE &hSharehandle, DWORD &dwFormat) { SharedTextureInfo info; // --------------------------------------------------------- // For a receiver check the user entered Sender name, if one, to see if it exists if(sendername[0] == 0) { // Passed name was null, so find the active sender if(!GetActiveSender(sendername)) { return false; } } // now we have either an existing sender name or the active sender name // 01.08.15 - Is the given sender registered ? if(!FindSenderName(sendername)) return false; // Sender is registered so try to get the sender information if(getSharedInfo(sendername, &info)) { width = (unsigned int)info.width; // pass back sender size height = (unsigned int)info.height; hSharehandle = (HANDLE)info.shareHandle; dwFormat = (DWORD)info.format; return true; } // 01.08.15 - Registered sender is no longer there so release it ReleaseSenderName(sendername); return false; } // end FindSender