本文整理汇总了C++中metadb_handle_ptr::get_info_async_locked方法的典型用法代码示例。如果您正苦于以下问题:C++ metadb_handle_ptr::get_info_async_locked方法的具体用法?C++ metadb_handle_ptr::get_info_async_locked怎么用?C++ metadb_handle_ptr::get_info_async_locked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类metadb_handle_ptr
的用法示例。
在下文中一共展示了metadb_handle_ptr::get_info_async_locked方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_metadata
void stream_encoders::update_metadata(metadb_handle_ptr p_track){
if(p_track!=0){
p_track->metadb_lock();
const file_info*p_info;
if(p_track->get_info_async_locked(p_info))
update_metadata(*p_info);
p_track->metadb_unlock();
}
}
示例2: query_scale
audio_sample t_replaygain_config::query_scale(const metadb_handle_ptr & p_object) const
{
audio_sample rv = 1.0;
p_object->metadb_lock();
const file_info * info;
if (p_object->get_info_async_locked(info))
rv = query_scale(*info);
p_object->metadb_unlock();
return rv;
}
示例3: exception
pfc::string8 get_track_info(const metadb_handle_ptr track, abort_callback &p_abort) {
pfc::string8 api_key = "803d3cbea0bbe50c61ab81c4fe5fe20f";
pfc::string8 url, page, artist_enc, title_enc;
const file_info *file_info;
const char *artist;
const char *title;
bool meta;
static_api_ptr_t<metadb> db;
db->database_lock();
meta = track->get_info_async_locked(file_info);
db->database_unlock();
if (meta && file_info->meta_exists("artist") &&
file_info->meta_exists("title")) {
artist = file_info->meta_get("artist", 0);
title = file_info->meta_get("title", 0);
} else {
throw pfc::exception("Unknown track");
}
pfc::urlEncode(artist_enc, artist);
pfc::urlEncode(title_enc, title);
url << "http://ws.audioscrobbler.com/2.0/?method=track.getInfo"
<< "&api_key=" << api_key << "&artist=" << artist_enc << "&track=" << title_enc;
console::print(url);
page = get_url(url, p_abort);
if (page.get_length() < 10) {
throw pfc::exception("Last.fm returned an empty page");
}
return page;
}
示例4: on_playback_new_track
virtual void on_playback_new_track(metadb_handle_ptr track)
{
pfc::string8 out = "";
pfc::string8 fullTitle = "";
pfc::string8 artist = "";
pfc::string8 title = "";
char songTitle[1024] = "";
char songTitle2[1024] = "";
static char currentTitle[1024] = "";
int windowTitle = 1;
char newTitle[2046] = "";
if (track != NULL) {
track->metadb_lock();
const file_info * info;
track->get_info_async_locked(info);
if (info) {
freeComment();
int numInfos = info->meta_get_count();
for (int i=0;i<numInfos;i++) {
const char *pName = info->meta_enum_name(i);
const char *pValue = info->meta_enum_value(i,0);
char *buffer;
int bufferlen = 0;
bufferlen = strlen(pName) + strlen(pValue) + strlen("=") + 1;
buffer = (char *)calloc(1, bufferlen);
sprintf(buffer, "%s=%s", pName, pValue);
pfc::string8 theout = "";
theout.add_string(buffer);
addComment((char *)(const char *)pfc::stringcvt::string_ansi_from_utf8(theout));
free(buffer);
if (pName) {
if (!stricmp(pName, "ARTIST")) {
if (pValue) {
artist.add_string(pValue);
}
}
if (!stricmp(pName, "TITLE")) {
if (pValue) {
title.add_string(" - ");
title.add_string(pValue);
}
}
}
}
if (numInfos == 0) {
static const char * TITLE_FORMAT = "%_filename%";
track->format_title_legacy(0,fullTitle,TITLE_FORMAT,0);
}
else {
fullTitle.add_string(artist);
fullTitle.add_string(title);
/*
track->handle_query_meta_field("ARTIST", 0, out);
fullTitle.add_string(out);
track->handle_query_meta_field("TITLE", 0, out);
fullTitle.add_string(" - ");
fullTitle.add_string(out);
*/
;
}
setMetadataFromMediaPlayer((char *)(const char *)pfc::stringcvt::string_ansi_from_utf8(fullTitle));
}
track->metadb_unlock();
}
}