Commit edd5355e authored by Benjamin Meyer's avatar Benjamin Meyer
Browse files

QString -> const QString & in function args

Added ability to add comments to album which should have been there before

svn path=/trunk/kdemultimedia/kioslave/audiocd/; revision=401959
parent f2f15a37
......@@ -557,7 +557,10 @@ void AudioCDProtocol::get(const KURL & url)
// NO => title of the track.
trackName = d->track_titles[d->req_track];
encoder->fillSongInfo(trackName, d->cd_artist, d->cd_title, d->cd_category, d->req_track+1, d->cd_year);
encoder->fillSongInfo(trackName, d->cd_artist, d->cd_title, d->cd_category, d->req_track+1, d->cd_year, "");
}
else {
encoder->fillSongInfo("", "", "", "", d->req_track+1, 0, QString("CDDBDISCID=%1").arg(d->discid));
}
long totalByteCount = CD_FRAMESIZE_RAW * (lastSector - firstSector + 1);
long time_secs = (8 * totalByteCount) / (44100 * 2 * 16);
......
......@@ -84,12 +84,13 @@ public:
* information if they want to so it can be inserted
* where neccessary (start, middle, end, or combos etc).
*/
virtual void fillSongInfo(QString trackName,
QString cdArtist,
QString cdTitle,
QString cdCategory,
virtual void fillSongInfo( const QString &trackName,
const QString &cdArtist,
const QString &cdTitle,
const QString &cdCategory,
int trackNumber,
int cdYear) = 0;
int cdYear,
const QString &comment ) = 0;
/**
* Perform any initial file creation necessary for a new song (that
......
......@@ -152,9 +152,9 @@ long EncoderFLAC::readCleanup()
return 0;
}
void EncoderFLAC::fillSongInfo(QString trackName, QString cdArtist,
QString cdTitle, QString cdCategory,
int trackNumber, int cdYear)
void EncoderFLAC::fillSongInfo(const QString &trackName, const QString &cdArtist,
const QString &cdTitle, const QString &cdCategory,
int trackNumber, int cdYear, const QString &comment)
{
d->metadata = new FLAC__StreamMetadata*[1];
d->metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
......@@ -162,16 +162,16 @@ void EncoderFLAC::fillSongInfo(QString trackName, QString cdArtist,
// d->metadata[2] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE)
typedef QPair<QString, QString> Comment;
Comment comments[6] = { Comment("Title", trackName),
Comment comments[7] = { Comment("Title", trackName),
Comment("Artist", cdArtist),
Comment("Album", cdTitle),
Comment("Genre", cdCategory),
Comment("Tracknumber", QString::number(trackNumber)),
Comment("Date", QString::null) };
Comment("Comment", comment),
Comment("Date", QString::null )};
if (cdYear > 0) {
QDateTime dt = QDate(cdYear, 1, 1);
comments[5] = Comment("Date", dt.toString(Qt::ISODate));
comments[6] = Comment("Date", dt.toString(Qt::ISODate));
}
FLAC__StreamMetadata_VorbisComment_Entry entry;
......@@ -179,7 +179,7 @@ void EncoderFLAC::fillSongInfo(QString trackName, QString cdArtist,
QCString cfield;
int num_comments = 0;
for(int i=0; i<6; i++) {
for(int i=0; i<7; i++) {
if (!comments[i].second.isEmpty()) {
field = comments[i].first+"="+comments[i].second;
cfield = field.utf8();
......
......@@ -44,12 +44,13 @@ public:
virtual const char * fileType() const { return "flac"; };
virtual const char * mimeType() const { return "audio/x-flac"; }
virtual void fillSongInfo(QString trackName,
QString cdArtist,
QString cdTitle,
QString cdCategory,
virtual void fillSongInfo(const QString &trackName,
const QString &cdArtist,
const QString &cdTitle,
const QString &cdCategory,
int trackNumber,
int cdYear);
int cdYear,
const QString &comment);
virtual long readInit(long size);
virtual long read(int16_t * buf, int frames);
......
......@@ -104,7 +104,8 @@ extern "C"
static void (*_lamelib_id3tag_set_track)(lame_global_flags*, const char*) = NULL;
static void (*_lamelib_id3tag_set_year)(lame_global_flags*, const char *) = NULL;
static int (*_lamelib_id3tag_set_genre)(lame_global_flags *, const char *) = NULL;
static int (*_lamelib_id3tag_set_comment)(lame_global_flags *, const char *) = NULL;
static void (*_lamelib_lame_mp3_tags_fid)(lame_global_flags*, FILE *fpStream) = NULL;
static int (*_lamelib_lame_encode_buffer_interleaved) (
lame_global_flags*, short int*, int, unsigned char*, int) = NULL;
......@@ -292,7 +293,10 @@ bool EncoderLame::init(){
_lamelib_id3tag_set_genre =
(int (*) (lame_global_flags*, const char*))
_lamelib->symbol("id3tag_set_genre");
_lamelib_lame_mp3_tags_fid =
_lamelib_id3tag_set_comment =
(int (*) (lame_global_flags*, const char*))
_lamelib->symbol("id3tag_set_comment");
_lamelib_lame_mp3_tags_fid =
(void (*) (lame_global_flags*, FILE *))
_lamelib->symbol("lame_mp3_tags_fid");
......@@ -590,12 +594,13 @@ long EncoderLame::readCleanup(){
return mp3bytes;
}
void EncoderLame::fillSongInfo(QString trackName,
QString cdArtist,
QString cdTitle,
QString cdCategory,
void EncoderLame::fillSongInfo( const QString &trackName,
const QString &cdArtist,
const QString &cdTitle,
const QString &cdCategory,
int trackNumber,
int cdYear){
int cdYear,
const QString &comment ){
#if HAVE_TAGLIB
d->tag.setTitle(QStringToTString(trackName));
......@@ -604,14 +609,16 @@ void EncoderLame::fillSongInfo(QString trackName,
d->tag.setGenre(QStringToTString(cdCategory));
d->tag.setTrack(trackNumber);
d->tag.setYear(cdYear);
d->tag.setComment(QStringToTString(comment));
#else
if( d->write_id3 ){
/* If CDDB is used to determine the filenames, tell lame to append ID3v1 TAG to MP3 Files */
(_lamelib_id3tag_set_album) (d->gf, cdTitle.latin1());
(_lamelib_id3tag_set_artist) (d->gf, cdArtist.latin1());
(_lamelib_id3tag_set_title) (d->gf, trackName.latin1());
(_lamelib_id3tag_set_year) (d->gf, QString("%1").arg(cdYear).latin1());
(_lamelib_id3tag_set_genre) (d->gf, cdCategory.latin1());
(_lamelib_id3tag_set_album) (d->gf, cdTitle.latin1());
(_lamelib_id3tag_set_artist) (d->gf, cdArtist.latin1());
(_lamelib_id3tag_set_title) (d->gf, trackName.latin1());
(_lamelib_id3tag_set_year) (d->gf, QString("%1").arg(cdYear).latin1());
(_lamelib_id3tag_set_genre) (d->gf, cdCategory.latin1());
(_lamelib_id3tag_set_comment) (d->gf, comment.latin1());
QString tn;
tn.sprintf("%02d", trackNumber);
(_lamelib_id3tag_set_track) (d->gf, tn.latin1());
......
......@@ -47,12 +47,13 @@ public:
virtual const char * mimeType() const;
virtual void fillSongInfo(QString trackName,
QString cdArtist,
QString cdTitle,
QString cdCategory,
virtual void fillSongInfo( const QString &trackName,
const QString &cdArtist,
const QString &cdTitle,
const QString &cdCategory,
int trackNumber,
int cdYear);
int cdYear,
const QString &comment );
virtual long readInit(long size);
virtual long read(int16_t * buf, int frames);
......
......@@ -296,12 +296,13 @@ long EncoderVorbis::readCleanup(){
return processed;
}
void EncoderVorbis::fillSongInfo(QString trackName,
QString cdArtist,
QString cdTitle,
QString cdCategory,
void EncoderVorbis::fillSongInfo(const QString &trackName,
const QString &cdArtist,
const QString &cdTitle,
const QString &cdCategory,
int trackNumber,
int cdYear){
int cdYear,
const QString &comment){
if( !d->write_vorbis_comments )
return;
......@@ -313,7 +314,8 @@ void EncoderVorbis::fillSongInfo(QString trackName,
commentFields.append(CommentField("album", cdTitle));
commentFields.append(CommentField("genre", cdCategory));
commentFields.append(CommentField("tracknumber", QString::number(trackNumber)));
commentFields.append(CommentField("comment", comment));
if (cdYear > 0) {
QDateTime dt = QDate(cdYear, 1, 1);
commentFields.append(CommentField("date", dt.toString(Qt::ISODate).utf8().data()));
......
......@@ -49,12 +49,13 @@ public:
virtual const char * fileType() const { return "ogg"; };
virtual const char * mimeType() const;
virtual void fillSongInfo(QString trackName,
QString cdArtist,
QString cdTitle,
QString cdCategory,
virtual void fillSongInfo( const QString &trackName,
const QString &cdArtist,
const QString &cdTitle,
const QString &cdCategory,
int trackNumber,
int cdYear);
int cdYear,
const QString &comment );
virtual long readInit(long size);
virtual long read(int16_t * buf, int frames);
......
......@@ -46,12 +46,13 @@ public:
virtual QString type() const { return "CDA"; };
virtual const char * mimeType() const;
virtual const char * fileType() const { return "cda"; };
virtual void fillSongInfo(QString,
QString,
QString,
QString,
virtual void fillSongInfo(const QString &,
const QString &,
const QString &,
const QString &,
int,
int){};
int,
const QString &){};
virtual long readInit(long){ return 0; };
virtual long read(int16_t * buf, int frames);
virtual long readCleanup(){ return 0; };
......
......@@ -45,12 +45,13 @@ public:
virtual const char * fileType() const { return "wav"; };
virtual const char * mimeType() const;
virtual void fillSongInfo(QString ,
QString ,
QString ,
QString ,
virtual void fillSongInfo(const QString &,
const QString &,
const QString &,
const QString &,
int ,
int ){};
int,
const QString &){};
virtual long readInit(long size);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment