本文整理汇总了C++中MusicMetadata::setTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ MusicMetadata::setTitle方法的具体用法?C++ MusicMetadata::setTitle怎么用?C++ MusicMetadata::setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MusicMetadata
的用法示例。
在下文中一共展示了MusicMetadata::setTitle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switchTitlesAndArtists
void Ripper::switchTitlesAndArtists()
{
if (!m_compilationCheck->GetBooleanCheckState())
return;
MusicMetadata *data;
// Switch title and artist for each track
QString tmp;
if (m_tracks->size() > 0)
{
for (int track = 0; track < m_tracks->size(); ++track)
{
data = m_tracks->at(track)->metadata;
if (data)
{
tmp = data->Artist();
data->setArtist(data->Title());
data->setTitle(tmp);
}
}
updateTrackList();
}
}
示例2: shoutcastMeta
void DecoderIOFactoryShoutCast::shoutcastMeta(const QString &metadata)
{
LOG(VB_PLAYBACK, LOG_INFO,
QString("DecoderIOFactoryShoutCast: metadata changed - %1")
.arg(metadata));
ShoutCastMetaParser parser;
parser.setMetaFormat(getMetadata().MetadataFormat());
ShoutCastMetaMap meta_map = parser.parseMeta(metadata);
MusicMetadata mdata = getMetadata();
mdata.setTitle(meta_map["title"]);
mdata.setArtist(meta_map["artist"]);
mdata.setAlbum(meta_map["album"]);
mdata.setLength(-1);
DecoderHandlerEvent ev(DecoderHandlerEvent::Meta, mdata);
dispatch(ev);
}
示例3: checkMetatdata
void avfDecoder::checkMetatdata(void)
{
uint8_t *pdata = nullptr;
if (av_opt_get(m_inputContext->getContext(), "icy_metadata_packet", AV_OPT_SEARCH_CHILDREN, &pdata) >= 0)
{
QString s = QString::fromUtf8((const char*) pdata);
if (m_lastMetadata != s)
{
m_lastMetadata = s;
LOG(VB_PLAYBACK, LOG_INFO, QString("avfDecoder: shoutcast metadata changed - %1").arg(m_lastMetadata));
ShoutCastMetaParser parser;
parser.setMetaFormat(gPlayer->getDecoderHandler()->getMetadata().MetadataFormat());
ShoutCastMetaMap meta_map = parser.parseMeta(m_lastMetadata);
MusicMetadata mdata = gPlayer->getDecoderHandler()->getMetadata();
mdata.setTitle(meta_map["title"]);
mdata.setArtist(meta_map["artist"]);
mdata.setAlbum(meta_map["album"]);
mdata.setLength(-1);
DecoderHandlerEvent ev(DecoderHandlerEvent::Meta, mdata);
dispatch(ev);
}
av_free(pdata);
}
if (m_inputContext->getContext()->pb)
{
int available = (int) (m_inputContext->getContext()->pb->buf_end - m_inputContext->getContext()->pb->buffer);
int maxSize = m_inputContext->getContext()->pb->buffer_size;
DecoderHandlerEvent ev(DecoderHandlerEvent::BufferStatus, available, maxSize);
dispatch(ev);
}
}
示例4: initialize
bool avfDecoder::initialize()
{
m_inited = m_userStop = m_finish = false;
m_freq = m_bitrate = 0;
m_stat = m_channels = 0;
m_seekTime = -1.0;
// give up if we dont have an audiooutput set
if (!output())
{
error("avfDecoder: initialise called with a NULL audiooutput");
return false;
}
if (!m_outputBuffer)
{
error("avfDecoder: couldn't allocate memory");
return false;
}
output()->PauseUntilBuffered();
if (m_inputContext)
delete m_inputContext;
m_inputContext = new RemoteAVFormatContext(getURL());
if (!m_inputContext->isOpen())
{
error(QString("Could not open url (%1)").arg(m_url));
deinit();
return false;
}
// if this is a ice/shoutcast or MMS stream start polling for metadata changes and buffer status
if (getURL().startsWith("http://") || getURL().startsWith("mmsh://"))
{
m_mdataTimer = new QTimer;
m_mdataTimer->setSingleShot(false);
connect(m_mdataTimer, SIGNAL(timeout()), this, SLOT(checkMetatdata()));
m_mdataTimer->start(500);
// we don't get metadata updates for MMS streams so grab the metadata from the headers
if (getURL().startsWith("mmsh://"))
{
AVDictionaryEntry *tag = nullptr;
MusicMetadata mdata = gPlayer->getDecoderHandler()->getMetadata();
tag = av_dict_get(m_inputContext->getContext()->metadata, "title", tag, AV_DICT_IGNORE_SUFFIX);
mdata.setTitle(tag->value);
tag = av_dict_get(m_inputContext->getContext()->metadata, "artist", tag, AV_DICT_IGNORE_SUFFIX);
mdata.setArtist(tag->value);
mdata.setAlbum("");
mdata.setLength(-1);
DecoderHandlerEvent ev(DecoderHandlerEvent::Meta, mdata);
dispatch(ev);
}
}
// determine the stream format
// this also populates information needed for metadata
if (avformat_find_stream_info(m_inputContext->getContext(), nullptr) < 0)
{
error("Could not determine the stream format.");
deinit();
return false;
}
// let FFmpeg finds the best audio stream (should only be one), also catter
// should the file/stream not be an audio one
AVCodec *codec;
int selTrack = av_find_best_stream(m_inputContext->getContext(), AVMEDIA_TYPE_AUDIO,
-1, -1, &codec, 0);
if (selTrack < 0)
{
error(QString("Could not find audio stream."));
deinit();
return false;
}
// Store the audio codec of the stream
m_audioDec = gCodecMap->getCodecContext
(m_inputContext->getContext()->streams[selTrack]);
// Store the input format of the context
m_inputFormat = m_inputContext->getContext()->iformat;
if (avcodec_open2(m_audioDec, codec, nullptr) < 0)
{
error(QString("Could not open audio codec: %1")
.arg(m_audioDec->codec_id));
deinit();
return false;
}
//.........这里部分代码省略.........
示例5: UpdateMeta
static int UpdateMeta(const MythUtilCommandLineParser &cmdline)
{
bool ok = true;
int result = GENERIC_EXIT_OK;
if (cmdline.toString("songid").isEmpty())
{
LOG(VB_GENERAL, LOG_ERR, "Missing --songid option");
return GENERIC_EXIT_INVALID_CMDLINE;
}
int songID = cmdline.toInt("songid");
MusicMetadata *mdata = MusicMetadata::createFromID(songID);
if (!mdata)
{
LOG(VB_GENERAL, LOG_ERR, QString("Cannot find metadata for trackid: %1").arg(songID));
return GENERIC_EXIT_NOT_OK;
}
if (!cmdline.toString("title").isEmpty())
mdata->setTitle(cmdline.toString("title"));
if (!cmdline.toString("artist").isEmpty())
mdata->setArtist(cmdline.toString("artist"));
if (!cmdline.toString("album").isEmpty())
mdata->setAlbum(cmdline.toString("album"));
if (!cmdline.toString("genre").isEmpty())
mdata->setGenre(cmdline.toString("genre"));
if (!cmdline.toString("trackno").isEmpty())
mdata->setTrack(cmdline.toInt("trackno"));
if (!cmdline.toString("year").isEmpty())
mdata->setYear(cmdline.toInt("year"));
if (!cmdline.toString("rating").isEmpty())
mdata->setRating(cmdline.toInt("rating"));
if (!cmdline.toString("playcount").isEmpty())
mdata->setPlaycount(cmdline.toInt("playcount"));
if (!cmdline.toString("lastplayed").isEmpty())
mdata->setLastPlay(cmdline.toDateTime("lastplayed"));
mdata->dumpToDatabase();
MetaIO *tagger = mdata->getTagger();
if (tagger)
{
ok = tagger->write(mdata->getLocalFilename(), mdata);
if (!ok)
LOG(VB_GENERAL, LOG_ERR, QString("Failed to write to tag for trackid: %1").arg(songID));
}
// tell any clients that the metadata for this track has changed
gCoreContext->SendMessage(QString("MUSIC_METADATA_CHANGED %1").arg(songID));
if (!ok)
result = GENERIC_EXIT_NOT_OK;
return result;
}