[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / cdrip / CDDARipper.h
1 #ifndef _CCDDARIPPER_H
2 #define _CCDDARIPPER_H
3
4 /*
5  *      Copyright (C) 2005-2013 Team XBMC
6  *      http://www.xbmc.org
7  *
8  *  This Program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2, or (at your option)
11  *  any later version.
12  *
13  *  This Program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with XBMC; see the file COPYING.  If not, see
20  *  <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #include "Encoder.h"
25 #include "utils/JobManager.h"
26
27 class CFileItem;
28
29 namespace MUSIC_INFO
30 {
31   class CMusicInfoTag;
32 }
33
34 /*! \brief Rip an entire CD or a single track
35
36  The CCDDARipper class is used to rip an entire CD or just a single track.
37  Tracks are stored in a folder constructed from two user settings: audiocds.recordingpath and 
38  audiocds.trackpathformat. The former is the absolute file system path for the root folder 
39  where ripped music is stored, and the latter specifies the format for the album subfolder and 
40  for the track file name.
41  Format used to encode ripped tracks is defined by the audiocds.encoder user setting, and 
42  there are several choices: wav, ogg vorbis and mp3.
43  */
44 class CCDDARipper : public CJobQueue
45 {
46 public:
47   /*!
48    \brief The only way through which the global instance of the CDDARipper should be accessed.
49    \return the global instance.
50    */
51   static CCDDARipper& GetInstance();
52
53   /*! \brief Rip a single track
54    \param[in] pItem CFileItem representing a track to rip
55    \return true if success, false if failure
56    */
57   bool RipTrack(CFileItem* pItem);
58
59   /*! \brief Rip an entire CD
60    \return true if success, false if failure
61    */
62   bool RipCD();
63
64   virtual void OnJobComplete(unsigned int jobID, bool success, CJob* job);
65
66 private:
67   // private construction and no assignments
68   CCDDARipper();
69   CCDDARipper(const CCDDARipper&);
70   virtual ~CCDDARipper();
71   CCDDARipper const& operator=(CCDDARipper const&);
72   
73   /*! \brief Return track file name extension for the given encoder type
74    \param[in] iEncoder encoder type (see CDDARIP_ENCODER_... constants)
75    \return file extension string (i.e. ".wav", ".mp3", ...)
76    */
77   const char* GetExtension(int iEncoder);
78
79   /*! \brief Create folder where CD tracks will be stored
80    \param[in]  infoTag music info tags for the CD, used to format album name
81    \param[out] strDirectory full path of the created folder
82    \param[out] legalType created directory type (see LEGAL_... constants)
83    \return true if success, false if failure
84    */
85   bool CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, CStdString& strDirectory, int& legalType);
86
87   /*! \brief Return formatted album subfolder for rip path
88    \param infoTag music info tags for the CD, used to format album name
89    \return album subfolder path name
90    */
91   CStdString GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTag);
92
93   /*! \brief Return file name for the track
94    \param item CFileItem representing a track
95    \return track file name
96    */
97   CStdString GetTrackName(CFileItem *item);
98 };
99
100 #endif // _CCDDARIPPERMP3_H