示例#1
0
bool CTextObject::AcceptDataFormat(IDataObject* pDataObject)
{
	if (pDataObject == NULL)
		return false;
	CLIPFORMAT cfFormat = GetDataFormat(pDataObject);
	return (cfFormat != CLIPFORMAT(0));
}
示例#2
0
 /// Return an object input stream (CObjectIStream)
 ///
 /// @param istr
 ///   underlying input stream
 /// @return
 ///   object stream
 static CObjectIStream*
 GetIStream(CNcbiIstream& istr)
 {
     static const enum ENcbiOwnership ownership = eTakeOwnership;
     auto_ptr<CCompressionIStream> instr_zip(
         new CCompressionIStream(
             istr,
             new CZipStreamDecompressor(CZipCompression::fAllowTransparentRead),
             CCompressionStream::fOwnProcessor
         )
     );
     return CObjectIStream::Open(GetDataFormat(), *instr_zip.release(), ownership);
 }
示例#3
0
 /// Return an object output stream (CObjectOStream)
 ///
 /// @param ostr
 ///   underlying output stream
 /// @return
 ///   object stream
 static CObjectOStream*
 GetOStream(CNcbiOstream& ostr)
 {
     static const enum ENcbiOwnership ownership = eTakeOwnership;
     auto_ptr<CCompressionOStream> outstr_zip(
         new CCompressionOStream(
             ostr,
             new CZipStreamCompressor(),
             CCompressionStream::fOwnProcessor
         )
     );
     return CObjectOStream::Open(GetDataFormat(), *outstr_zip.release(), ownership);
 }
示例#4
0
bool OMXPlayerAudio::OpenDecoder()
{
  m_passthrough = false;

  if(m_DecoderOpen)
  {
    m_omxAudio.Deinitialize();
    m_DecoderOpen = false;
  }

  /* setup audi format for audio render */
  m_format = GetDataFormat(m_hints);

  CAEChannelInfo channelMap;
  if (m_pAudioCodec && !m_passthrough)
  {
    channelMap = m_pAudioCodec->GetChannelMap();
  }
  else if (m_passthrough)
  {
    // we just want to get the channel count right to stop OMXAudio.cpp rejecting stream
    // the actual layout is not used
    channelMap = AE_CH_LAYOUT_5_1;

    if (m_hints.codec == AV_CODEC_ID_AC3)
      m_processInfo.SetAudioDecoderName("PT_AC3");
    else if (m_hints.codec == AV_CODEC_ID_EAC3)
      m_processInfo.SetAudioDecoderName("PT_EAC3");
    else
      m_processInfo.SetAudioDecoderName("PT_DTS");
  }
  m_processInfo.SetAudioChannels(channelMap);
  bool bAudioRenderOpen = m_omxAudio.Initialize(m_format, m_av_clock, m_hints, channelMap, m_passthrough);

  m_codec_name = "";
  m_bad_state  = !bAudioRenderOpen;
  
  if(!bAudioRenderOpen)
  {
    CLog::Log(LOGERROR, "OMXPlayerAudio : Error open audio output");
    m_omxAudio.Deinitialize();
  }
  else
  {
    CLog::Log(LOGINFO, "Audio codec %s channels %d samplerate %d bitspersample %d\n",
      m_codec_name.c_str(), m_hints.channels, m_hints.samplerate, m_hints.bitspersample);
  }

  return bAudioRenderOpen;
}
示例#5
0
bool CObjectOStream::WriteClassMember(const CMemberId& memberId,
                                      const CDelayBuffer& buffer)
{
    if ( !buffer.HaveFormat(GetDataFormat()) )
        return false;

    BEGIN_OBJECT_FRAME2(eFrameClassMember, memberId);
    BeginClassMember(memberId);

    Write(buffer.GetSource());

    EndClassMember();
    END_OBJECT_FRAME();
    return true;
}
示例#6
0
static
int LocateSample(LPIT8 it8, const char* cSample)
{
    int i;
    const char *fld;

    for (i=0; i < it8->nSamples; i++) {

        fld = GetDataFormat(it8, i);
        if (stricmp(fld, cSample) == 0)
            return i;
    }

    return -1;
}
示例#7
0
bool OMXPlayerAudio::OpenDecoder()
{
  m_nChannels   = m_hints.channels;
  m_passthrough = false;
  m_hw_decode   = false;

  if(m_DecoderOpen)
  {
    WaitCompletion();
    m_omxAudio.Deinitialize();
    m_DecoderOpen = false;
  }

  /* setup audi format for audio render */
  m_format.m_sampleRate    = m_hints.samplerate;
  m_format.m_channelLayout = m_pAudioCodec->GetChannelMap(); 
  /* GetDataFormat is setting up evrything */
  m_format.m_dataFormat = GetDataFormat(m_hints);

  std::string device = "";
  
  if(CSettings::Get().GetInt("audiooutput.mode") == AUDIO_HDMI)
    device = "hdmi";
  else
    device = "local";

  bool bAudioRenderOpen = m_omxAudio.Initialize(m_format, device, m_av_clock, m_hints, m_passthrough, m_hw_decode);

  m_codec_name = "";
  m_bad_state  = !bAudioRenderOpen;
  
  if(!bAudioRenderOpen)
  {
    CLog::Log(LOGERROR, "OMXPlayerAudio : Error open audio output");
    m_omxAudio.Deinitialize();
  }
  else
  {
    CLog::Log(LOGINFO, "Audio codec %s channels %d samplerate %d bitspersample %d\n",
      m_codec_name.c_str(), m_nChannels, m_hints.samplerate, m_hints.bitspersample);
  }

  m_started = false;

  return bAudioRenderOpen;
}
示例#8
0
void OMXPlayerAudio::OpenStream(CDVDStreamInfo &hints, COMXAudioCodecOMX *codec)
{
  SAFE_DELETE(m_pAudioCodec);

  m_hints           = hints;
  m_pAudioCodec     = codec;

  if(m_hints.bitspersample == 0)
    m_hints.bitspersample = 16;

  m_speed           = DVD_PLAYSPEED_NORMAL;
  m_audioClock      = DVD_NOPTS_VALUE;
  m_syncState = IDVDStreamPlayer::SYNC_STARTING;
  m_flush           = false;
  m_stalled         = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0;
  m_format = GetDataFormat(m_hints);
  m_format.m_sampleRate    = 0;
  m_format.m_channelLayout = 0;

  CServiceBroker::GetDataCacheCore().SignalAudioInfoChange();
}
示例#9
0
bool CTextObject::SetObjectText(IDataObject* pDataObject)
{
	if (pDataObject == NULL)
		return false;
	CLIPFORMAT cfFormat = GetDataFormat(pDataObject);
	if (cfFormat == CLIPFORMAT(0))
		return false;
	FORMATETC format;
	format.cfFormat = cfFormat;
	format.dwAspect = DVASPECT_CONTENT;
	format.lindex = -1;
	format.ptd = NULL;
	format.tymed = SUPPORTED_MEDIUM_TYPES;
	STGMEDIUM stgm;
	stgm.tymed = TYMED_NULL;
	stgm.pUnkForRelease = NULL;
	HRESULT hRes = pDataObject->GetData(&format, &stgm);
	if (FAILED(hRes))
		return false;
	hRes = SetData(&format, &stgm, TRUE);
	return SUCCEEDED(hRes);
}
示例#10
0
 /// Return an object input stream (CObjectIStream)
 ///
 /// @param istr
 ///   underlying input stream
 /// @return
 ///   object stream
 static CObjectIStream*
 GetIStream(CNcbiIstream& istr)
 {
     return CObjectIStream::Open(GetDataFormat(), istr);
 }
示例#11
0
 /// Return an object output stream (CObjectOStream)
 ///
 /// @param ostr
 ///   underlying output stream
 /// @return
 ///   object stream
 static CObjectOStream*
 GetOStream(CNcbiOstream& ostr)
 {
     return CObjectOStream::Open(GetDataFormat(), ostr);
 }