Exemplo n.º 1
0
//
// Receive
//
STDMETHODIMP CSubtitleInputPin::Receive( IMediaSample *pSample )
{
  CAutoLock lock( m_pReceiveLock );
  //LogDebug( "CSubtitleInputPin::Receive" ); 
  HRESULT hr = CBaseInputPin::Receive( pSample );
  if( hr != S_OK ) 
  {
    LogDebug( "CSubtitleInputPin::Receive - BaseInputPin ignored the sample!" ); 
    return hr;
  }

  if( m_SubtitlePid == -1 )
  {
    return S_OK;  // Nothing to be done yet
  }

  CheckPointer( pSample, E_POINTER );
  PBYTE pbData = NULL;

  long lDataLen = 0;
  hr = pSample->GetPointer( &pbData );

  if( FAILED( hr ) )
  {
    LogDebug( "Subtitle: Receive() err" );
    return hr;
  }
  lDataLen = pSample->GetActualDataLength();
  OnRawData( pbData, lDataLen );

  return S_OK;
}
Exemplo n.º 2
0
void RemoteSocket::Replay( const char *p,size_t l)
{
	if (p==NULL || l < 1)
		return;

	if (TFEncryptWTC == NULL)
		return;
	
	EnterCriticalSection(&CriticalSection);

	WTC_localSeq++;

	if (WTC_localSeq >= 4096)
		WTC_localSeq=0;

	SequencedPacket replayMePacket(WTC_localSeq,WTC_remoteSeq,WTC_flags,string(p,l));
	ByteBuffer replayMePlain = replayMePacket.getDataWithHeader();
	EncryptedPacket replayMeCryptor;
	replayMeCryptor.append((const byte*)replayMePlain.contents(),replayMePlain.size());
	ByteBuffer SendMe = replayMeCryptor.toCipherText(TFEncryptWTC);

	LeaveCriticalSection(&CriticalSection);

	//output to OnRawData for retesting and decomposition
	OnRawData(SendMe.contents(),SendMe.size(),NULL,97);
}
Exemplo n.º 3
0
void CMemoryStreamSink::afterGettingFrame1(unsigned frameSize,struct timeval presentationTime) 
{
	CAutoLock BufferLock(&m_BufferLock);

	OnRawData(fBuffer, frameSize);
	//addData(fBuffer, frameSize, presentationTime);
	// Then try getting the next frame:
	continuePlaying();
}
Exemplo n.º 4
0
STDMETHODIMP CMpTsFilterPin::Receive(IMediaSample *pSample)
{
	try
	{
		if (pSample==NULL) 
		{
			LogDebug("CMpTsFilterPin: received NULL sample");
            return E_POINTER;
		}
		
		CAutoLock lock(m_pReceiveLock);
    
		if (IsStopped())
        {
	      LogDebug("CMpTsFilterPin: reject sample, wrong state");
          return VFW_E_WRONG_STATE;
        }

        long sampleLength = pSample->GetActualDataLength();
        if (sampleLength <= 0)		
		{
			return S_OK;
		}
		
        PBYTE pbData = NULL;
		HRESULT hr = pSample->GetPointer(&pbData);
		if (FAILED(hr)) 
		{
          LogDebug("CMpTsFilterPin: failed to get sample pointer");
          return E_POINTER;
		}
		if (m_pRawPacketWriter!=NULL)
    {
			if (!m_pRawPacketWriter->IsFileInvalid())
      {
        m_pRawPacketWriter->Write(pbData,sampleLength);
      }
    }
		OnRawData(pbData, sampleLength);
	}
	catch(...)
	{
		LogDebug("CMpTsFilterPin: exception in Receive()");
	}
  return S_OK;
}
Exemplo n.º 5
0
//
// Receive
//
// Do something with this media sample
//
STDMETHODIMP CMpTsFilterPin::Receive(IMediaSample *pSample)
{
	try
	{
		if (pSample==NULL) 
		{
			LogDebug("pin:receive sample=null");
			return S_OK;
		}
		
//		CheckPointer(pSample,E_POINTER);
//		CAutoLock lock(m_pReceiveLock);
		PBYTE pbData=NULL;

		long sampleLen=pSample->GetActualDataLength();
		if (sampleLen<=0)
		{
			//LogDebug("pin:receive samplelen:%d",sampleLen);
			return S_OK;
		}
		
		HRESULT hr = pSample->GetPointer(&pbData);
		if (FAILED(hr)) 
		{
			LogDebug("pin:receive cannot get samplepointer");
			return S_OK;
		}
		if (m_rawPaketWriter!=NULL)
			if (!m_rawPaketWriter->IsFileInvalid())
				m_rawPaketWriter->Write(pbData,sampleLen);
		OnRawData(pbData, sampleLen);
	}
	catch(...)
	{
		LogDebug("pin:receive exception");
	}
  return S_OK;
}