当前位置: 首页>>代码示例>>C++>>正文


C++ CFileItem::GetContentType方法代码示例

本文整理汇总了C++中CFileItem::GetContentType方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItem::GetContentType方法的具体用法?C++ CFileItem::GetContentType怎么用?C++ CFileItem::GetContentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileItem的用法示例。


在下文中一共展示了CFileItem::GetContentType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Create

CPlayList* CPlayListFactory::Create(const CStdString& filename)
{
  CFileItem item(filename,false);

  CFileItem currentItem = g_application.CurrentFileItem();
  item.SetContentType(currentItem.GetContentType());

  return Create(item);
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:9,代码来源:PlayListFactory.cpp

示例2: Create

bool CAudioDecoder::Create(const CFileItem &file, __int64 seekOffset, unsigned int nBufferSize)
{
  Destroy();

  CSingleLock lock(m_critSection);
  // create our pcm buffer
  m_pcmBuffer.Create((int)std::max<unsigned int>(2, nBufferSize) *
                     INTERNAL_BUFFER_LENGTH);

  // reset our playback timing variables
  m_eof = false;

  // get correct cache size
  unsigned int filecache = g_guiSettings.GetInt("cacheaudio.lan");
  if ( file.IsHD() )
    filecache = g_guiSettings.GetInt("cache.harddisk");
  else if ( file.IsOnDVD() )
    filecache = g_guiSettings.GetInt("cacheaudio.dvdrom");
  else if ( file.IsInternetStream() )
    filecache = g_guiSettings.GetInt("cacheaudio.internet");

  // create our codec
  bool codecInitialized = false;
  m_codec=CodecFactory::CreateCodecDemux(file.m_strPath, file.GetContentType(), filecache * 1024, codecInitialized);

  if (!m_codec || (!codecInitialized && !m_codec->Init(file.m_strPath, filecache * 1024)))
  {
    CLog::Log(LOGERROR, "CAudioDecoder: Unable to Init Codec while loading file %s", file.m_strPath.c_str());
    Destroy();
    return false;
  }
  m_blockSize = m_codec->m_Channels * m_codec->m_BitsPerSample / 8;

  if( m_codec->UseHWDecoding() || m_codec->UsePassthrough() )
    m_outputUnitSize = sizeof(char);
  else
    m_outputUnitSize = sizeof(float);

  if (seekOffset)
    m_codec->Seek(seekOffset);

  m_status = STATUS_QUEUING;

  return true;
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:45,代码来源:AudioDecoder.cpp

示例3: IsPlaylist

bool CPlayListFactory::IsPlaylist(const CFileItem& item, bool bAllowQuery)
{
  CStdString extension = CUtil::GetExtension(item.m_strPath);
  extension.ToLower();

  if (extension == ".m3u") return true;
  if (extension == ".m3u8") return true;
  if (extension == ".b4s") return true;
  if (extension == ".pls") return true;
  if (extension == ".strm") return true;
  if (extension == ".wpl") return true;
  if (extension == ".asx") return true;
  if (extension == ".ram") return true;
  
  if (item.IsLastFM())
    return false;

  if (extension == ".url") return true;
  if (extension == ".pxml") return true;

  if (item.IsShoutCast())
    return false;

  if( item.IsInternetStream() )
  {
    CStdString strContentType = item.GetContentType(bAllowQuery);
    strContentType.MakeLower();

    if (strContentType == "video/x-ms-asf"
    || strContentType == "video/x-ms-asx"
    || strContentType == "video/x-ms-wfs"
    || strContentType == "video/x-ms-wvx"
    || strContentType == "video/x-ms-wax"
    || strContentType == "audio/x-pn-realaudio"
    || strContentType == "audio/x-scpls"
    || strContentType == "playlist"
    || strContentType == "audio/x-mpegurl"
    || strContentType == "application/vnd.ms-wpl")
      return true;
  }
  
  return false;
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:43,代码来源:PlayListFactory.cpp

示例4: GetPlayers

void CPlayerCoreFactory::GetPlayers( const CFileItem& item, VECPLAYERCORES &vecCores)
{
  CURL url(item.m_strPath);

  CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers(%s)", item.m_strPath.c_str());

  // ugly hack for ReplayTV. our filesystem is broken against real ReplayTV's (not the psuedo DVArchive)
  // it breaks down for small requests. As we can't allow truncated reads for all emulated dll file functions
  // we are often forced to do small reads to fill up the full buffer size wich seems gives garbage back
  if (url.GetProtocol().Equals("rtv"))
  {
    vecCores.push_back(EPC_MPLAYER); // vecCores.push_back(EPC_DVDPLAYER);
  }
  
  if (url.GetProtocol().Equals("hdhomerun")
  ||  url.GetProtocol().Equals("myth")
  ||  url.GetProtocol().Equals("cmyth")
  ||  url.GetProtocol().Equals("rtmp"))
  {
    vecCores.push_back(EPC_DVDPLAYER);
  }
  
  if (url.GetProtocol().Equals("lastfm") ||
      url.GetProtocol().Equals("shout"))
  {
    vecCores.push_back(EPC_PAPLAYER);
  }
   
  if (url.GetProtocol().Equals("mms"))
  {
    vecCores.push_back(EPC_DVDPLAYER);    
  }

  // dvdplayer can play standard rtsp streams
  if (url.GetProtocol().Equals("rtsp") 
  && !url.GetFileType().Equals("rm") 
  && !url.GetFileType().Equals("ra"))
  {
    vecCores.push_back(EPC_DVDPLAYER);
  }

  // Special care in case it's an internet stream
  if (item.IsInternetStream())
  {
    CStdString content = item.GetContentType();
    CLog::Log(LOGDEBUG, "%s - Item is an internet stream, content-type=%s", __FUNCTION__, content.c_str());

    if (content == "video/x-flv"
    ||  content == "video/flv")
    {
      vecCores.push_back(EPC_DVDPLAYER);
    }
    else if (content == "audio/aacp")
    {
      vecCores.push_back(EPC_DVDPLAYER);
    }
    else if (content == "application/sdp")
    {
      vecCores.push_back(EPC_DVDPLAYER);
    }
    else if (content == "application/octet-stream")
    {
      //unknown contenttype, send mp2 to pap
      if( url.GetFileType() == "mp2")
        vecCores.push_back(EPC_PAPLAYER);
    }
  }

  if (item.IsDVD() || item.IsDVDFile() || item.IsDVDImage())
  {
    if ( g_advancedSettings.m_videoDefaultDVDPlayer == "externalplayer" )
    {
      vecCores.push_back(EPC_EXTPLAYER);
      vecCores.push_back(EPC_DVDPLAYER);
    }
    else
    {
      vecCores.push_back(EPC_DVDPLAYER);
      vecCores.push_back(EPC_EXTPLAYER);
    }
  }

  
  // only dvdplayer can handle these normally
  if (url.GetFileType().Equals("sdp") 
  ||  url.GetFileType().Equals("asf"))
  {
    vecCores.push_back(EPC_DVDPLAYER);
  }

  // Set video default player. Check whether it's video first (overrule audio check)
  // Also push these players in case it is NOT audio either
  if (item.IsVideo() || !item.IsAudio())
  {
    if ( g_advancedSettings.m_videoDefaultPlayer == "externalplayer" )
    {
      vecCores.push_back(EPC_EXTPLAYER);
      vecCores.push_back(EPC_DVDPLAYER);
    }
    else
//.........这里部分代码省略.........
开发者ID:derobert,项目名称:debianlink-xbmc,代码行数:101,代码来源:PlayerCoreFactory.cpp

示例5: GetPlayers

void CPlayerCoreFactory::GetPlayers( const CFileItem& item, VECPLAYERCORES &vecCores)
{
  CURL url(item.m_strPath);

  CLog::Log(LOGDEBUG,"CPlayerCoreFactor::GetPlayers(%s)",item.m_strPath.c_str());

  // Plex media server streams.
  if (url.GetProtocol().Equals("plex", false))
      vecCores.push_back(EPC_PMSPLAYER);
  
  // Play audio files with iTunes DRM using QuickTime
  if (url.GetFileType().Equals("m4p") || url.GetFileType().Equals("m4b"))
  {
    vecCores.push_back(EPC_QTPLAYER);
    CLog::Log(LOGDEBUG,"CPlayerCoreFactor::GetPlayers(%s) - matched M4P file",item.m_strPath.c_str());
  }
  
  // ugly hack for ReplayTV. our filesystem is broken against real ReplayTV's (not the psuevdo DVArchive)
  // it breaks down for small requests. As we can't allow truncated reads for all emulated dll file functions
  // we are often forced to do small reads to fill up the full buffer size wich seems gives garbage back
  if (url.GetProtocol().Equals("rtv"))
    vecCores.push_back(EPC_MPLAYER); // vecCores.push_back(EPC_DVDPLAYER);

  if (url.GetProtocol().Equals("hdhomerun")
  ||  url.GetProtocol().Equals("myth")
  ||  url.GetProtocol().Equals("cmyth")
  ||  url.GetProtocol().Equals("rtmp"))
    vecCores.push_back(EPC_DVDPLAYER);

  if (url.GetProtocol().Equals("lastfm") ||
      url.GetProtocol().Equals("shout"))
  {
    vecCores.push_back(EPC_PAPLAYER);
  }
   
  if (url.GetProtocol().Equals("mms"))
  {
    vecCores.push_back(EPC_DVDPLAYER);    
  }

  // dvdplayer can play standard rtsp streams
  if (url.GetProtocol().Equals("rtsp") 
  && !url.GetFileType().Equals("rm") 
  && !url.GetFileType().Equals("ra"))
    vecCores.push_back(EPC_DVDPLAYER);

  // only dvdplayer can handle these normally
  if (url.GetFileType().Equals("sdp") ||
      url.GetFileType().Equals("asf"))
    vecCores.push_back(EPC_DVDPLAYER);

  if ( item.IsInternetStream() )
  {
    CStdString content = item.GetContentType();

    if (content == "video/x-flv"
     || content == "video/flv")
      vecCores.push_back(EPC_DVDPLAYER);
    else if (content == "audio/aacp")
      vecCores.push_back(EPC_DVDPLAYER);
    else if (content == "application/sdp")
      vecCores.push_back(EPC_DVDPLAYER);
    else if (content == "application/octet-stream")
    {
      //unknown contenttype, send mp2 to pap
      if( url.GetFileType() == "mp2")
        vecCores.push_back(EPC_PAPLAYER);
    }
  }

  if (((item.IsDVD()) || item.IsDVDFile() || item.IsDVDImage()))
  {
    vecCores.push_back(EPC_DVDPLAYER);
  }

  if( PAPlayer::HandlesType(url.GetFileType()) )
  {
    bool bAdd = true;
    if (url.GetProtocol().Equals("mms"))
    {
       bAdd = false;
    }
    else if (item.IsType(".wma"))
    {
      DVDPlayerCodec codec;
      if (!codec.Init(item.m_strPath,2048))
        bAdd = false;
      codec.DeInit();        
    }

    if (bAdd)
    {
      if(!g_audioConfig.UseDigitalOutput())
      {
        vecCores.push_back(EPC_PAPLAYER);
      }
      //else if( ( url.GetFileType().Equals("ac3") && g_audioConfig.GetAC3Enabled() )
      //  ||  ( url.GetFileType().Equals("dts") && g_audioConfig.GetDTSEnabled() ) ) 
      //{
      //  vecCores.push_back(EPC_DVDPLAYER);
//.........这里部分代码省略.........
开发者ID:Castlecard,项目名称:plex,代码行数:101,代码来源:PlayerCoreFactory.cpp


注:本文中的CFileItem::GetContentType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。