kodi
CDDARipJob.h
1 /*
2  * Copyright (C) 2012-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "music/tags/MusicInfoTag.h"
12 #include "utils/Job.h"
13 
14 namespace XFILE
15 {
16 class CFile;
17 }
18 
19 namespace KODI
20 {
21 namespace CDRIP
22 {
23 
24 class CEncoder;
25 
26 class CCDDARipJob : public CJob
27 {
28 public:
41  CCDDARipJob(const std::string& input,
42  const std::string& output,
43  const MUSIC_INFO::CMusicInfoTag& tag,
44  int encoder,
45  bool eject = false,
46  unsigned int rate = 44100,
47  unsigned int channels = 2,
48  unsigned int bps = 16);
49 
50  ~CCDDARipJob() override;
51 
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; }
56 
57 protected:
61  std::unique_ptr<CEncoder> SetupEncoder(XFILE::CFile& reader);
62 
66  std::string SetupTempFile();
67 
79  int RipChunk(XFILE::CFile& reader, const std::unique_ptr<CEncoder>& encoder, int& percent);
80 
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
89 };
90 
91 } /* namespace CDRIP */
92 } /* namespace KODI */
Definition: Scraper.h:41
Base class for jobs that are executed asynchronously.
Definition: Job.h:109
Definition: File.h:37
Definition: SimpleFS.h:27
Definition: AudioDecoder.h:18
Definition: CDDARipJob.h:26
Definition: MusicInfoTag.h:27
const char * GetType() const override
Function that returns the type of job.
Definition: CDDARipJob.h:52