diff --git a/lib-showfile/include/showfile.h b/lib-showfile/include/showfile.h index 834a8a44b..66a6a7a95 100644 --- a/lib-showfile/include/showfile.h +++ b/lib-showfile/include/showfile.h @@ -133,9 +133,6 @@ class ShowFile final: public ShowFileFormat { void Run() { ShowFileFormat::ShowFileRun(m_Status == showfile::Status::PLAYING); -#if defined (CONFIG_SHOWFILE_ENABLE_OSC) - m_showFileOSC.Run(); -#endif #if !defined(CONFIG_SHOWFILE_DISABLE_TFTP) if (m_pShowFileTFTP != nullptr) { m_pShowFileTFTP->Run(); diff --git a/lib-showfile/include/showfileosc.h b/lib-showfile/include/showfileosc.h index d658e3a59..f99bf239b 100644 --- a/lib-showfile/include/showfileosc.h +++ b/lib-showfile/include/showfileosc.h @@ -57,7 +57,7 @@ class ShowFileOSC { assert(s_pThis == nullptr); s_pThis = this; - m_nHandle = Network::Get()->Begin(m_nPortIncoming); + m_nHandle = Network::Get()->Begin(m_nPortIncoming, staticCallbackFunction); assert(m_nHandle != -1); DEBUG_EXIT @@ -72,28 +72,18 @@ class ShowFileOSC { } void Input(const uint8_t *pBuffer, uint32_t nSize, uint32_t nFromIp, uint16_t nFromPort) { - if (pBuffer != nullptr) { - m_pBuffer = pBuffer; - m_nRemoteIp = nFromIp; - m_nBytesReceived = nSize; - m_nRemotePort = nFromPort; - } + assert(pBuffer != nullptr); + + m_pBuffer = pBuffer; + m_nRemoteIp = nFromIp; + m_nBytesReceived = nSize; + m_nRemotePort = nFromPort; if (memcmp(m_pBuffer, showfileosc::CMD_PATH, showfileosc::PATH_LENGTH) == 0) { Process(); } } - void Run() { - m_nBytesReceived = Network::Get()->RecvFrom(m_nHandle, reinterpret_cast(&m_pBuffer), &m_nRemoteIp, &m_nRemotePort); - - if (__builtin_expect((m_nBytesReceived <= showfileosc::PATH_LENGTH), 1)) { - return; - } - - Input(nullptr, 0, 0, 0); - } - void Print() { puts("OSC Server"); printf(" Path : [%s]\n", showfileosc::CMD_PATH);