2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "music/tags/MusicInfoTag.h"
12 #include "utils/Job.h"
26 class CCDDARipJob
: public CJob
30 * \brief Construct a ripper job
32 * \param[in] input The input file url
33 * \param[in] output The output file url
34 * \param[in] tag The music tag to attach to track
35 * \param[in] encoder The encoder to use. See Encoder.h
36 * \param[in] eject Should we eject tray on finish?
37 * \param[in] rate The sample rate of the input
38 * \param[in] channels Number of audio channels in input
39 * \param[in] bps The bits per sample for input
41 CCDDARipJob(const std::string
& input
,
42 const std::string
& output
,
43 const MUSIC_INFO::CMusicInfoTag
& tag
,
46 unsigned int rate
= 44100,
47 unsigned int channels
= 2,
48 unsigned int bps
= 16);
50 ~CCDDARipJob() override
;
52 const char* GetType() const override
{ return "cdrip"; }
53 bool operator==(const CJob
* job
) const override
;
54 bool DoWork() override
;
55 std::string
GetOutput() const { return m_output
; }
59 * \brief Setup the audio encoder
61 std::unique_ptr
<CEncoder
> SetupEncoder(XFILE::CFile
& reader
);
64 * \brief Helper used if output is a remote url
66 std::string
SetupTempFile();
69 * \brief Rip a chunk of audio
71 * \param[in] reader The input reader
72 * \param[in] encoder The audio encoder
73 * \param[out] percent The percentage completed on return
74 * \return 0 (CDDARIP_OK) if everything went okay, or
75 * a positive error code from the reader, or
76 * -1 if the encoder failed
77 * \sa CCDDARipper::GetData, CEncoder::Encode
79 int RipChunk(XFILE::CFile
& reader
, const std::unique_ptr
<CEncoder
>& encoder
, int& percent
);
81 unsigned int m_rate
; //< The sample rate of the input file
82 unsigned int m_channels
; //< The number of channels in input file
83 unsigned int m_bps
; //< The bits per sample of input
84 MUSIC_INFO::CMusicInfoTag m_tag
; //< Music tag to attach to output file
85 std::string m_input
; //< The input url
86 std::string m_output
; //< The output url
87 bool m_eject
; //< Should we eject tray when we are finished?
88 int m_encoder
; //< The audio encoder
91 } /* namespace CDRIP */
92 } /* namespace KODI */