Esempio n. 1
0
void OMXPlayerAudio::WaitCompletion()
{
	//ofLogVerbose(__func__) << "OMXPlayerAudio::WaitCompletion";
	if(!m_decoder)
	{
		return;
	}

	unsigned int nTimeOut = 2.0f * 1000;
	while(nTimeOut)
	{
		if(IsEOS())
		{
			ofLog(OF_LOG_VERBOSE, "%s::%s - got eos\n", "OMXPlayerAudio", __func__);
			break;
		}

		if(nTimeOut == 0)
		{
			ofLog(OF_LOG_ERROR, "%s::%s - wait for eos timed out\n", "OMXPlayerAudio", __func__);
			break;
		}
		m_av_clock->sleep(50);
		nTimeOut -= 50;
	}
}
Esempio n. 2
0
STDMETHODIMP
WMFByteStream::IsEndOfStream(BOOL *aEndOfStream)
{
  NS_ENSURE_TRUE(aEndOfStream, E_POINTER);
  *aEndOfStream = IsEOS();
  WMF_BS_LOG("[%p] WMFByteStream::IsEndOfStream() %d", this, *aEndOfStream);
  return S_OK;
}
Esempio n. 3
0
void OMXPlayerAudio::WaitCompletion()
{
  unsigned int nTimeOut = AUDIO_BUFFER_SECONDS * 1000;
  while(nTimeOut)
  {
    if(IsEOS())
    {
      CLog::Log(LOGDEBUG, "%s::%s - got eos\n", CLASSNAME, __func__);
      break;
    }

    if(nTimeOut == 0)
    {
      CLog::Log(LOGERROR, "%s::%s - wait for eos timed out\n", CLASSNAME, __func__);
      break;
    }
    Sleep(50);
    nTimeOut -= 50;
  }
}
Esempio n. 4
0
void OMXPlayerAudio::WaitCompletion()
{
  if(!m_decoder)
    return;

  unsigned int nTimeOut = m_fifo_size * 1000;
  while(nTimeOut)
  {
    if(IsEOS())
    {
      CLog::Log(LOGDEBUG, "%s::%s - got eos\n", "OMXPlayerAudio", __func__);
      break;
    }

    if(nTimeOut == 0)
    {
      CLog::Log(LOGERROR, "%s::%s - wait for eos timed out\n", "OMXPlayerAudio", __func__);
      break;
    }
    OMXClock::OMXSleep(50);
    nTimeOut -= 50;
  }
} 
Esempio n. 5
0
STDMETHODIMP
WMFByteStream::EndRead(IMFAsyncResult* aResult, ULONG *aBytesRead)
{
  NS_ENSURE_TRUE(aResult, E_POINTER);
  NS_ENSURE_TRUE(aBytesRead, E_POINTER);

  ReentrantMonitorAutoEnter mon(mReentrantMonitor);

  // Extract our state object.
  RefPtr<IUnknown> unknown;
  HRESULT hr = aResult->GetObject(byRef(unknown));
  if (FAILED(hr) || !unknown) {
    return E_INVALIDARG;
  }
  ReadRequest* requestState =
    static_cast<ReadRequest*>(unknown.get());

  // Report result.
  *aBytesRead = requestState->mBytesRead;

  WMF_BS_LOG("[%p] WMFByteStream::EndRead() offset=%lld *aBytesRead=%u mOffset=%lld status=0x%x hr=0x%x eof=%d",
             this, requestState->mOffset, *aBytesRead, mOffset, aResult->GetStatus(), hr, IsEOS());

  return aResult->GetStatus();
}
Esempio n. 6
0
bool StreamMemory::IsReadReady()
{
	return !IsEOS();
}
Esempio n. 7
0
    StringLexer::LEXEME_TYPE
    StringLexer::ParseString(SString &currentString, BOOL fPermitUnescapedQuotes)
    {
        BOOL fIsFirstCharacter = TRUE;
        WCHAR wcCurrentChar = INVALID_CHARACTER;
        WCHAR wcOpeningQuote = INVALID_CHARACTER;

        currentString.Clear();

        // Read until we find another lexeme that's not a string character
        for (;;)
        {
            BOOL fIsEscaped = FALSE;
            wcCurrentChar = PopCharacter(&fIsEscaped);

            if (wcCurrentChar == INVALID_CHARACTER)
            {
                // Found invalid character encoding
                BINDER_LOG(L"StringLexer::ParseString: Invalid character encoding");
                return LEXEME_TYPE_INVALID;
            }

            if (IsEOS(wcCurrentChar))
            {
                if (IsQuoteCharacter(wcOpeningQuote))
                {
                    // EOS and unclosed quotes is an error
                    BINDER_LOG(L"StringLexer::ParseString: EOS and unclosed quotes");
                    return LEXEME_TYPE_INVALID;
                }
                else
                {
                    // Reached end of input and therefore of string
                    break;
                }
            }

            if (fIsFirstCharacter)
            {
                fIsFirstCharacter = FALSE;

                // If first character is quote, then record its quoteness
                if (IsQuoteCharacter(wcCurrentChar))
                {
                    wcOpeningQuote = wcCurrentChar;
                    continue;
                }
            }
            
            if (wcCurrentChar == wcOpeningQuote)
            {
                // We've found the closing quote for a quoted string
                break;
            }
           
            if (!fPermitUnescapedQuotes && !fIsEscaped && IsQuoteCharacter(wcCurrentChar) && !IsQuoteCharacter(wcOpeningQuote))
            {
                // Unescaped quotes in the middle of the string are an error
                BINDER_LOG(L"StringLexer::ParseString: Quote in the middle of a string");
                return LEXEME_TYPE_INVALID;
            }

            if (IsSeparatorChar(wcCurrentChar) && !IsQuoteCharacter(wcOpeningQuote) && !fIsEscaped)
            {
                // Unescaped separator char terminates the string
                PushCharacter(wcCurrentChar, fIsEscaped);
                break;
            }

            // Add character to current string
            currentString.Append(wcCurrentChar);
        }

        if (!IsQuoteCharacter(wcOpeningQuote))
        {
            // Remove trailing white spaces from unquoted string
            BINDER_LOG(L"StringLexer::ParseString: Trimming string");
            TrimTrailingWhiteSpaces(currentString);
        }

        BINDER_LOG_STRING(L"string", currentString);

        return LEXEME_TYPE_STRING;
    }