[stdstring] get rid of CStdString in cdrip/
authorArne Morten Kvarving <cptspiff@gmail.com>
Wed, 25 Jun 2014 14:27:15 +0000 (16:27 +0200)
committerJonathan Marshall <jmarshall@xbmc.org>
Sun, 13 Jul 2014 20:33:02 +0000 (08:33 +1200)
xbmc/cdrip/CDDARipJob.cpp
xbmc/cdrip/CDDARipJob.h
xbmc/cdrip/CDDARipper.cpp
xbmc/cdrip/CDDARipper.h
xbmc/cdrip/Encoder.h
xbmc/cdrip/EncoderFFmpeg.cpp

index 045a73b..bbacedb 100644 (file)
@@ -40,8 +40,8 @@ using namespace ADDON;
 using namespace MUSIC_INFO;
 using namespace XFILE;
 
-CCDDARipJob::CCDDARipJob(const CStdString& input,
-                         const CStdString& output,
+CCDDARipJob::CCDDARipJob(const std::string& input,
+                         const std::string& output,
                          const CMusicInfoTag& tag, 
                          int encoder,
                          bool eject,
@@ -88,7 +88,7 @@ bool CCDDARipJob::DoWork()
   CGUIDialogProgressBarHandle* handle = pDlgProgress->GetHandle(g_localizeStrings.Get(605));
 
   int iTrack = atoi(m_input.substr(13, m_input.size() - 13 - 5).c_str());
-  CStdString strLine0 = StringUtils::Format("%02i. %s - %s", iTrack,
+  std::string strLine0 = StringUtils::Format("%02i. %s - %s", iTrack,
                                             StringUtils::Join(m_tag.GetArtist(), g_advancedSettings.m_musicItemSeparator).c_str(),
                                             m_tag.GetTitle().c_str());
   handle->SetText(strLine0);
@@ -201,7 +201,7 @@ CEncoder* CCDDARipJob::SetupEncoder(CFile& reader)
     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));
+  std::string 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(),
@@ -223,7 +223,7 @@ CEncoder* CCDDARipJob::SetupEncoder(CFile& reader)
   return encoder;
 }
 
-CStdString CCDDARipJob::SetupTempFile()
+std::string CCDDARipJob::SetupTempFile()
 {
   char tmp[MAX_PATH];
 #ifndef TARGET_POSIX
index ee961c1..350d1ff 100644 (file)
@@ -20,7 +20,6 @@
 */
 
 #include "utils/Job.h"
-#include "utils/StdString.h"
 #include "music/tags/MusicInfoTag.h"
 
 class CEncoder;
@@ -42,7 +41,7 @@ public:
   //! \param rate The sample rate of the input
   //! \param channels Number of audio channels in input
   //! \param bps The bits per sample for input
-  CCDDARipJob(const CStdString& input, const CStdString& output,
+  CCDDARipJob(const std::string& input, const std::string& output,
               const MUSIC_INFO::CMusicInfoTag& tag, int encoder,
               bool eject=false, unsigned int rate=44100,
               unsigned int channels=2, unsigned int bps=16);
@@ -52,13 +51,13 @@ public:
   virtual const char* GetType() const { return "cdrip"; };
   virtual bool operator==(const CJob *job) const;
   virtual bool DoWork();
-  CStdString GetOutput() const { return m_output; }
+  std::string GetOutput() const { return m_output; }
 protected:
   //! \brief Setup the audio encoder
   CEncoder* SetupEncoder(XFILE::CFile& reader);
 
   //! \brief Helper used if output is a remote url
-  CStdString SetupTempFile();
+  std::string SetupTempFile();
 
   //! \brief Rip a chunk of audio
   //! \param reader The input reader
@@ -74,8 +73,8 @@ protected:
   unsigned int m_channels; //< The number of channels in input file
   unsigned int m_bps; //< The bits per sample of input
   MUSIC_INFO::CMusicInfoTag m_tag; //< Music tag to attach to output file
-  CStdString m_input; //< The input url
-  CStdString m_output; //< The output url
+  std::string m_input; //< The input url
+  std::string m_output; //< The output url
   bool m_eject; //< Should we eject tray when we are finished?
   int m_encoder; //< The audio encoder
 };
index b837cfe..73a8cac 100644 (file)
@@ -81,12 +81,12 @@ bool CCDDARipper::RipTrack(CFileItem* pItem)
   }
 
   // construct directory where the track is stored
-  CStdString strDirectory;
+  std::string strDirectory;
   int legalType;
   if (!CreateAlbumDir(*pItem->GetMusicInfoTag(), strDirectory, legalType))
     return false;
 
-  CStdString strFile = URIUtils::AddFileToFolder(strDirectory, 
+  std::string strFile = URIUtils::AddFileToFolder(strDirectory, 
                       CUtil::MakeLegalFileName(GetTrackName(pItem), legalType));
 
   AddJob(new CCDDARipJob(pItem->GetPath(),strFile,
@@ -126,7 +126,7 @@ bool CCDDARipper::RipCD()
   }
 
   // construct directory where the tracks are stored
-  CStdString strDirectory;
+  std::string strDirectory;
   int legalType;
   if (!CreateAlbumDir(*vecItems[0]->GetMusicInfoTag(), strDirectory, legalType))
     return false;
@@ -137,7 +137,7 @@ bool CCDDARipper::RipCD()
     CFileItemPtr item = vecItems[i];
 
     // construct filename
-    CStdString strFile = URIUtils::AddFileToFolder(strDirectory, CUtil::MakeLegalFileName(GetTrackName(item.get()), legalType));
+    std::string strFile = URIUtils::AddFileToFolder(strDirectory, CUtil::MakeLegalFileName(GetTrackName(item.get()), legalType));
 
     // don't rip non cdda items
     if (item->GetPath().find(".cdda") == std::string::npos)
@@ -153,7 +153,7 @@ bool CCDDARipper::RipCD()
   return true;
 }
 
-bool CCDDARipper::CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, CStdString& strDirectory, int& legalType)
+bool CCDDARipper::CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, std::string& strDirectory, int& legalType)
 {
   CSettingPath *recordingpathSetting = (CSettingPath*)CSettings::Get().GetSetting("audiocds.recordingpath");
   if (recordingpathSetting != NULL)
@@ -186,7 +186,7 @@ bool CCDDARipper::CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, CStdS
     legalType = LEGAL_WIN32_COMPAT;
 #endif
 
-  CStdString strAlbumDir = GetAlbumDirName(infoTag);
+  std::string strAlbumDir = GetAlbumDirName(infoTag);
 
   if (!strAlbumDir.empty())
   {
@@ -206,9 +206,9 @@ bool CCDDARipper::CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, CStdS
   return true;
 }
 
-CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag)
+std::string CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag)
 {
-  CStdString strAlbumDir;
+  std::string strAlbumDir;
 
   // use audiocds.trackpathformat setting to format
   // directory name where CD tracks will be stored,
@@ -223,7 +223,7 @@ CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag
   // replace %A with album artist name
   if (strAlbumDir.find("%A") != std::string::npos)
   {
-    CStdString strAlbumArtist = StringUtils::Join(infoTag.GetAlbumArtist(), g_advancedSettings.m_musicItemSeparator);
+    std::string strAlbumArtist = StringUtils::Join(infoTag.GetAlbumArtist(), g_advancedSettings.m_musicItemSeparator);
     if (strAlbumArtist.empty())
       strAlbumArtist = StringUtils::Join(infoTag.GetArtist(), g_advancedSettings.m_musicItemSeparator);
     if (strAlbumArtist.empty())
@@ -236,7 +236,7 @@ CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag
   // replace %B with album title
   if (strAlbumDir.find("%B") != std::string::npos)
   {
-    CStdString strAlbum = infoTag.GetAlbum();
+    std::string strAlbum = infoTag.GetAlbum();
     if (strAlbum.empty())
       strAlbum = StringUtils::Format("Unknown Album %s", CDateTime::GetCurrentDateTime().GetAsLocalizedDateTime().c_str());
     else
@@ -247,7 +247,7 @@ CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag
   // replace %G with genre
   if (strAlbumDir.find("%G") != std::string::npos)
   {
-    CStdString strGenre = StringUtils::Join(infoTag.GetGenre(), g_advancedSettings.m_musicItemSeparator);
+    std::string strGenre = StringUtils::Join(infoTag.GetGenre(), g_advancedSettings.m_musicItemSeparator);
     if (strGenre.empty())
       strGenre = "Unknown Genre";
     else
@@ -258,7 +258,7 @@ CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag
   // replace %Y with year
   if (strAlbumDir.find("%Y") != std::string::npos)
   {
-    CStdString strYear = infoTag.GetYearString();
+    std::string strYear = infoTag.GetYearString();
     if (strYear.empty())
       strYear = "Unknown Year";
     else
@@ -269,7 +269,7 @@ CStdString CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag
   return strAlbumDir;
 }
 
-CStdString CCDDARipper::GetTrackName(CFileItem *item)
+std::string CCDDARipper::GetTrackName(CFileItem *item)
 {
   // get track number from "cdda://local/01.cdda"
   int trackNumber = atoi(item->GetPath().substr(13, item->GetPath().size() - 13 - 5).c_str());
@@ -280,7 +280,7 @@ CStdString CCDDARipper::GetTrackName(CFileItem *item)
 
   // get track file name format from audiocds.trackpathformat setting,
   // use only format part starting from the last '/'
-  CStdString strFormat = CSettings::Get().GetString("audiocds.trackpathformat");
+  std::string strFormat = CSettings::Get().GetString("audiocds.trackpathformat");
   size_t pos = strFormat.find_last_of("/\\");
   if (pos != std::string::npos)
     strFormat.erase(0, pos+1);
@@ -289,7 +289,7 @@ CStdString CCDDARipper::GetTrackName(CFileItem *item)
   formatter.FormatLabel(&destItem);
 
   // grab the label to use it as our ripped filename
-  CStdString track = destItem.GetLabel();
+  std::string track = destItem.GetLabel();
   if (track.empty())
     track = StringUtils::Format("%s%02i", "Track-", trackNumber);
 
@@ -310,7 +310,7 @@ void CCDDARipper::OnJobComplete(unsigned int jobID, bool success, CJob* job)
   {
     if(CJobQueue::QueueEmpty())
     {
-      CStdString dir = URIUtils::GetDirectory(((CCDDARipJob*)job)->GetOutput());
+      std::string dir = URIUtils::GetDirectory(((CCDDARipJob*)job)->GetOutput());
       bool unimportant;
       int source = CUtil::GetMatchingSource(dir, *CMediaSourceSettings::Get().CMediaSourceSettings::GetSources("music"), unimportant);
 
index 488ef7e..51cbab4 100644 (file)
@@ -82,19 +82,19 @@ private:
    \param[out] legalType created directory type (see LEGAL_... constants)
    \return true if success, false if failure
    */
-  bool CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, CStdString& strDirectory, int& legalType);
+  bool CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, std::string& strDirectory, int& legalType);
 
   /*! \brief Return formatted album subfolder for rip path
    \param infoTag music info tags for the CD, used to format album name
    \return album subfolder path name
    */
-  CStdString GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag);
+  std::string GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag);
 
   /*! \brief Return file name for the track
    \param item CFileItem representing a track
    \return track file name
    */
-  CStdString GetTrackName(CFileItem *item);
+  std::string GetTrackName(CFileItem *item);
 };
 
 #endif // _CCDDARIPPERMP3_H
index 38d8065..744f807 100644 (file)
  *
  */
 
-#include <string>
 #include <boost/shared_ptr.hpp>
 #include "IEncoder.h"
+#include <string>
+#include <stdint.h>
+#include <stdio.h>
 
 #define WRITEBUFFER_SIZE 131072 // 128k buffer
 
index f827f8a..3392f59 100644 (file)
@@ -67,7 +67,7 @@ bool CEncoderFFmpeg::Init(audioenc_callbacks &callbacks)
 
   m_callbacks = callbacks;
 
-  CStdString filename = URIUtils::GetFileName(m_strFile);
+  std::string filename = URIUtils::GetFileName(m_strFile);
   if(avformat_alloc_output_context2(&m_Format,NULL,NULL,filename.c_str()))
   {
     CLog::Log(LOGERROR, "CEncoderFFmpeg::Init - Unable to guess the output format for the file %s", filename.c_str());