18 #include <libavformat/avformat.h>
19 #include <libavformat/avio.h>
20 #include <libavcodec/avcodec.h>
21 #include <libavutil/opt.h>
22 #include <libswresample/swresample.h>
25#include <sigc++/signal.h>
27#include <curlpp/Easy.hpp>
28#include <curlpp/Infos.hpp>
29#include <curlpp/Options.hpp>
30#include <curlpp/cURLpp.hpp>
32#include <stb/stb_image.h>
34#include <discdb/disc.h>
45 const char*
what()
const throw() {
46 return "No removable volumes are currently mounted.";
55 const char*
what()
const throw() {
77 CDRipper(
CDDrive& drive,
const DiscDB::Disc& disc,
const std::string& albumArtURL,
const std::string& mediaRoot);
87 void rip(
const int track);
125 std::string
make_safe(
const std::string& str)
const;
Abstracts the host's disc drive.
Glib::Dispatcher _dispatcher
Used by _thread to safely emit _sig_track_progress.
int _album_art_image_size
The size of _album_art_image.
const DiscDB::Disc & _disc
The fully populated DiscDB::Disc describing the album.
std::string _output_filename
The output filename.
std::string _output_dir
The path to the album folder on the removable volume.
~CDRipper()
CDRipper destructor.
sig_done _sig_done
Emiited when the rip (whole disc or single track) is done.
std::string _album_art_url
The URL of the album art currently shown.
void rip()
Rip the entire disc.
Glib::Dispatcher _dispatcher_done
Used by _thread to safely emit _sig_done.
void end_rip(RipContext *rip_ctx)
Ends the ripping process.
CDRipper(CDDrive &drive, const DiscDB::Disc &disc, const std::string &albumArtURL, const std::string &mediaRoot)
CDRipper constructor.
std::string make_safe(const std::string &str) const
Used to sanitize folder and file names.
unsigned int _progress
The current percentage completion ripping the current track.
void add_file_art(RipContext *rip_ctx)
Adds _album_art_image to the output file.
void on_done_notification()
Called when _dispatcher_done is notified.
void on_notification()
Called when _dispatcher is notified.
CDDrive & _drive
The parent CDDrive.
void start_file(RipContext *rip_ctx)
Creates the ouput file, tags it and writes the M4A header.
sigc::signal< void(void)> sig_done
"Rip done" signal type.
unsigned int _track
The 1-based index of the track currently being ripped.
sigc::signal< void(unsigned int, unsigned int)> sig_track_progress
"Track progress made" signal type.
void ensure_output_dir()
Verifies _media_root exists and sets _output_dir.
AVCodecID _album_art_image_codec
Reflects whether the _album_art_image is JPEG or PNG.
uint8_t * _album_art_image
Raw bytes received from the _album_art_url.
void do_rip(RipContext *rip_ctx, bool continuous=true)
The core ripping method interacting directly with ffmpeg.
sig_done signal_done()
Getter for ::_signal_done.
sig_track_progress _sig_track_progress
Emitted when the percentage progress ripping a track has increased.
void rip_helper()
Private helper for rip().
std::thread * _thread
Used to execute the ripping process.
void end_file(RipContext *rip_ctx)
Frees resources in the ripping context specific to the output file.
void start_rip(RipContext *rip_ctx)
Begins the ripping process.
sig_track_progress signal_track_progress()
Getter for ::_signal_track_progress.
std::string _media_root
The path to the root of the removable volume.
std::pair< int, int > _album_art_image_dims
The dimensions of _album_art_image in pixels.
void tag_file(RipContext *rip_ctx)
Adds textual metadata (album and track information) to the output file.
Contains resources that are shared by private helper functions.
AVFrame * frame
The unit of input to ffmpeg.
AVStream * sta
Video stream for album art.
AVFormatContext * fmt_ctx
Format (file) context.
const AVCodec * codec
The M4A codec.
AVPacket * packet
The unit of output from ffmpeg.
AVCodecContext * c
The codec context.
AVStream * st
Audio stream.
SwrContext * swr_ctx
Context for resampling from int16_t to float.
RipperErrorException(const std::string &what)
const char * what() const