diff options
-rw-r--r-- | clientcontrol.c | 6 | ||||
-rw-r--r-- | osdworker.c | 18 | ||||
-rw-r--r-- | pes2ts.c | 4 |
3 files changed, 17 insertions, 11 deletions
diff --git a/clientcontrol.c b/clientcontrol.c index f333725..8673dae 100644 --- a/clientcontrol.c +++ b/clientcontrol.c @@ -202,7 +202,7 @@ bool cClientControl::SendPlayState(ePlayMode PlayMode, bool bPlay, bool bForward SClientControl data; SClientControlPlayState state; - if ((m_Instance == NULL) || (m_Instance->m_ClientSocket == NULL)) + if ((m_Instance == NULL) || (m_Instance->m_ClientSocket == NULL) || (!m_Instance->m_bHaveClient)) return false; m_Instance->m_bPlayStateReq = false; @@ -232,7 +232,7 @@ bool cClientControl::SendStillPicture(const uchar *Data, int Length) SClientControl data; int written, available, done; - if ((m_Instance == NULL) || (m_Instance->m_ClientSocket == NULL)) + if ((m_Instance == NULL) || (m_Instance->m_ClientSocket == NULL) || (!m_Instance->m_bHaveClient)) return false; data.pakType = ptStillPicture; @@ -274,7 +274,7 @@ bool cClientControl::SendSFreeze() SClientControl data; int written, available, done; - if ((m_Instance == NULL) || (m_Instance->m_ClientSocket == NULL)) + if ((m_Instance == NULL) || (m_Instance->m_ClientSocket == NULL) || (!m_Instance->m_bHaveClient)) return false; data.pakType = ptFreeze; diff --git a/osdworker.c b/osdworker.c index 0f3d746..3dcd5cb 100644 --- a/osdworker.c +++ b/osdworker.c @@ -223,7 +223,7 @@ bool cOSDWorker::SendScreen(int x1, int y1, int x2, int y2) return false; } - rfbFramebufferUpdateMsg fu; + struct timeval curtime; gettimeofday(&curtime, 0); curtime.tv_sec = curtime.tv_sec - (((int)curtime.tv_sec / 1000000) * 1000000); @@ -246,16 +246,20 @@ bool cOSDWorker::SendScreen(int x1, int y1, int x2, int y2) const tColor *OSDColors = (tColor*)m_Instance->m_pOsdBitmap->Colors(numOSDColors); cOSDWorker::SendCMAP(numOSDColors, OSDColors); } + + int BufferSize = m_Instance->m_pEncoder->RequiredBuffSize(x2-x1+1, y2-y1+1) + sizeof(rfbFramebufferUpdateMsg); + m_Instance->CreateSendBuffer(BufferSize); + rfbFramebufferUpdateMsg *fu = (rfbFramebufferUpdateMsg*)m_Instance->m_pSendBuffer; RECT rect = {x1, y1, x2, y2}; - fu.type=rfbFramebufferUpdate; - fu.nRects=Swap16IfLE(1); - OSDWrite((unsigned char*)&fu, sz_rfbFramebufferUpdateMsg); - //int BufferSize = m_Instance->m_pEncoder->RequiredBuffSize(x2-x1, y2-y1); - //m_Instance->CreateSendBuffer(BufferSize); + fu->type=rfbFramebufferUpdate; + fu->pad=0; + fu->nRects=Swap16IfLE(1); + if (m_Instance->m_pEncoder != NULL) { - int BufferSize = m_Instance->m_pEncoder->EncodeRect((BYTE*)(m_Instance->m_pOsdBitmap->Data(0, 0)), m_Instance->m_pSendBuffer, rect); + BufferSize = m_Instance->m_pEncoder->EncodeRect((BYTE*)(m_Instance->m_pOsdBitmap->Data(0, 0)), &(m_Instance->m_pSendBuffer[sizeof(rfbFramebufferUpdateMsg)]), rect); + BufferSize += sizeof(rfbFramebufferUpdateMsg); #ifdef DEBUG fprintf(stderr, "[ffnetdev] VNC: Send OSD Data %d/%d/%d/%d x1/y1/x2/y2 %d Bytes\n", x1, y1, x2, y2, BufferSize); #endif @@ -291,7 +291,9 @@ void cPES2PESRemux::Action(void) // check for valid stream id type: is it video or audio or unknown? - if (data[3]>=0x00) + if ( ((data[3]>=0xC0) && (data[3]<=0xDF)) || + (data[3] == 0xBD) || + ((data[3]>=0xE0) && (data[3]<=0xEF))) { while (m_OutputBuffer->Free() < (int)packetlen) { |