コード例 #1
0
ファイル: encoder.cpp プロジェクト: dalinhuang/ffmpeg-port
CEncoder * CEncoder::CreateEncoder( ECodecId eCodecId, LPCTSTR strName /* = NULL */ )
{
	CEncoder *pEec = NULL;
	switch( eCodecId )
	{
	case CODEC_JPEG:
		pEec = new CJpegEncoder();
		break;
	default:
		Log() << _T( "Unknown encoder!" ) << eCodecId << endl;
		_ASSERT( FALSE );
		return 0;
		break;
	}

	BOOL bResult = pEec->Init();
	if ( !bResult )
	{
		Log() << _T( "Encoder init Fail!" ) << endl;
	}
	
	_ASSERT( bResult );
	if ( !bResult )
	{
		Release( pEec );
		pEec = NULL;
	}

	RegDec( strName, pEec );


	return pEec;
}
コード例 #2
0
ファイル: CDDARipJob.cpp プロジェクト: B0k0/xbmc
CEncoder* CCDDARipJob::SetupEncoder(CFile& reader)
{
  CEncoder* encoder;
  switch (m_encoder)
  {
#ifdef HAVE_LIBVORBISENC
  case CDDARIP_ENCODER_VORBIS:
    encoder = new CEncoderVorbis();
    break;
#endif
#ifdef HAVE_LIBMP3LAME
  case CDDARIP_ENCODER_LAME:
    encoder = new CEncoderLame();
    break;
#endif
  case CDDARIP_ENCODER_FLAC:
    encoder = new CEncoderFlac();
    break;
  case CDDARIP_ENCODER_FFMPEG_M4A:
  case CDDARIP_ENCODER_FFMPEG_WMA:
    encoder = new CEncoderFFmpeg();
    break;
  case CDDARIP_ENCODER_WAV:
  default:
    encoder = new CEncoderWav();
    break;
  }

  if (!encoder)
    return NULL;

  // we have to set the tags before we init the Encoder
  CStdString strTrack = StringUtils::Format("%i", strtol(m_input.substr(13, m_input.size() - 13 - 5).c_str(),NULL,10));

  encoder->SetComment("Ripped with XBMC");
  encoder->SetArtist(StringUtils::Join(m_tag.GetArtist(),
                                      g_advancedSettings.m_musicItemSeparator));
  encoder->SetTitle(m_tag.GetTitle());
  encoder->SetAlbum(m_tag.GetAlbum());
  encoder->SetAlbumArtist(StringUtils::Join(m_tag.GetAlbumArtist(),
                                      g_advancedSettings.m_musicItemSeparator));
  encoder->SetGenre(StringUtils::Join(m_tag.GetGenre(),
                                      g_advancedSettings.m_musicItemSeparator));
  encoder->SetTrack(strTrack);
  encoder->SetTrackLength(static_cast<int>(reader.GetLength()));
  encoder->SetYear(m_tag.GetYearString());

  // init encoder
  if (!encoder->Init(m_output.c_str(), m_channels, m_rate, m_bps))
    delete encoder, encoder = NULL;

  return encoder;
}
コード例 #3
0
ファイル: CDDARipJob.cpp プロジェクト: fritsch/xbmc-cmake
CEncoder* CCDDARipJob::SetupEncoder(CFile& reader)
{
  CEncoder* encoder;
  if (CSettings::Get().GetString("audiocds.encoder") == "audioencoder.xbmc.builtin.wav")
  {
    boost::shared_ptr<IEncoder> enc(new CEncoderWav());
    encoder = new CEncoder(enc);
  }
  else if (CSettings::Get().GetString("audiocds.encoder") == "audioencoder.xbmc.builtin.aac" ||
           CSettings::Get().GetString("audiocds.encoder") == "audioencoder.xbmc.builtin.wma")
  {
    encoder = new CEncoderFFmpeg();
  }
  else
  {
    AddonPtr addon;
    CAddonMgr::Get().GetAddon(CSettings::Get().GetString("audiocds.encoder"), addon);
    if (addon)
    {
      boost::shared_ptr<CAudioEncoder> aud =  boost::static_pointer_cast<CAudioEncoder>(addon);
      aud->Create();
      boost::shared_ptr<IEncoder> enc =  boost::static_pointer_cast<IEncoder>(aud);
      encoder = new CEncoder(enc);
    }
  }
  if (!encoder)
    return NULL;

  // we have to set the tags before we init the Encoder
  CStdString strTrack = StringUtils::Format("%i", strtol(m_input.substr(13, m_input.size() - 13 - 5).c_str(),NULL,10));

  encoder->SetComment("Ripped with XBMC");
  encoder->SetArtist(StringUtils::Join(m_tag.GetArtist(),
                                      g_advancedSettings.m_musicItemSeparator));
  encoder->SetTitle(m_tag.GetTitle());
  encoder->SetAlbum(m_tag.GetAlbum());
  encoder->SetAlbumArtist(StringUtils::Join(m_tag.GetAlbumArtist(),
                                      g_advancedSettings.m_musicItemSeparator));
  encoder->SetGenre(StringUtils::Join(m_tag.GetGenre(),
                                      g_advancedSettings.m_musicItemSeparator));
  encoder->SetTrack(strTrack);
  encoder->SetTrackLength(static_cast<int>(reader.GetLength()));
  encoder->SetYear(m_tag.GetYearString());

  // init encoder
  if (!encoder->Init(m_output.c_str(), m_channels, m_rate, m_bps))
    delete encoder, encoder = NULL;

  return encoder;
}
コード例 #4
0
ファイル: CDDARipJob.cpp プロジェクト: IchabodFletchman/xbmc
CEncoder* CCDDARipJob::SetupEncoder(CFile& reader)
{
  CEncoder* encoder = NULL;
  if (CServiceBroker::GetSettings().GetString(CSettings::SETTING_AUDIOCDS_ENCODER) == "audioencoder.xbmc.builtin.aac" ||
           CServiceBroker::GetSettings().GetString(CSettings::SETTING_AUDIOCDS_ENCODER) == "audioencoder.xbmc.builtin.wma")
  {
    std::shared_ptr<IEncoder> enc(new CEncoderFFmpeg());
    encoder = new CEncoder(enc);
  }
  else
  {
    AddonPtr addon;
    CAddonMgr::GetInstance().GetAddon(CServiceBroker::GetSettings().GetString(CSettings::SETTING_AUDIOCDS_ENCODER), addon);
    if (addon)
    {
      std::shared_ptr<CAudioEncoder> aud =  std::static_pointer_cast<CAudioEncoder>(addon);
      aud->Create();
      std::shared_ptr<IEncoder> enc =  std::static_pointer_cast<IEncoder>(aud);
      encoder = new CEncoder(enc);
    }
  }
  if (!encoder)
    return NULL;

  // we have to set the tags before we init the Encoder
  std::string strTrack = StringUtils::Format("%li", strtol(m_input.substr(13, m_input.size() - 13 - 5).c_str(),NULL,10));

  encoder->SetComment(std::string("Ripped with ") + CSysInfo::GetAppName());
  encoder->SetArtist(StringUtils::Join(m_tag.GetArtist(),
                                      g_advancedSettings.m_musicItemSeparator));
  encoder->SetTitle(m_tag.GetTitle());
  encoder->SetAlbum(m_tag.GetAlbum());
  encoder->SetAlbumArtist(StringUtils::Join(m_tag.GetAlbumArtist(),
                                      g_advancedSettings.m_musicItemSeparator));
  encoder->SetGenre(StringUtils::Join(m_tag.GetGenre(),
                                      g_advancedSettings.m_musicItemSeparator));
  encoder->SetTrack(strTrack);
  encoder->SetTrackLength(static_cast<int>(reader.GetLength()));
  encoder->SetYear(m_tag.GetYearString());

  // init encoder
  if (!encoder->Init(m_output.c_str(), m_channels, m_rate, m_bps))
    delete encoder, encoder = NULL;

  return encoder;
}
コード例 #5
0
ファイル: CDDARipJob.cpp プロジェクト: 68foxboris/xbmc
CEncoder* CCDDARipJob::SetupEncoder(CFile& reader)
{
  CEncoder* encoder = nullptr;
  const std::string audioEncoder = CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_AUDIOCDS_ENCODER);
  if (audioEncoder == "audioencoder.kodi.builtin.aac" || audioEncoder == "audioencoder.kodi.builtin.wma")
  {
    std::shared_ptr<IEncoder> enc(new CEncoderFFmpeg());
    encoder = new CEncoder(enc);
  }
  else
  {
    const BinaryAddonBasePtr addonInfo = CServiceBroker::GetBinaryAddonManager().GetInstalledAddonInfo(audioEncoder, ADDON_AUDIOENCODER);
    if (addonInfo)
    {
      std::shared_ptr<IEncoder> enc = std::make_shared<CAudioEncoder>(addonInfo);
      encoder = new CEncoder(enc);
    }
  }
  if (!encoder)
    return NULL;

  // we have to set the tags before we init the Encoder
  const std::string strTrack = StringUtils::Format("%li", strtol(m_input.substr(13, m_input.size() - 13 - 5).c_str(), nullptr, 10));

  const std::string itemSeparator = CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_musicItemSeparator;

  encoder->SetComment(std::string("Ripped with ") + CSysInfo::GetAppName());
  encoder->SetArtist(StringUtils::Join(m_tag.GetArtist(), itemSeparator));
  encoder->SetTitle(m_tag.GetTitle());
  encoder->SetAlbum(m_tag.GetAlbum());
  encoder->SetAlbumArtist(StringUtils::Join(m_tag.GetAlbumArtist(), itemSeparator));
  encoder->SetGenre(StringUtils::Join(m_tag.GetGenre(), itemSeparator));
  encoder->SetTrack(strTrack);
  encoder->SetTrackLength(static_cast<int>(reader.GetLength()));
  encoder->SetYear(m_tag.GetYearString());

  // init encoder
  if (!encoder->Init(m_output.c_str(), m_channels, m_rate, m_bps))
    delete encoder, encoder = nullptr;

  return encoder;
}