本文整理汇总了C++中MetaData::SetTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaData::SetTitle方法的具体用法?C++ MetaData::SetTitle怎么用?C++ MetaData::SetTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaData
的用法示例。
在下文中一共展示了MetaData::SetTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: privateReadPlaylist
Error privateReadPlaylist(CRio& rio,
bool useExternal,
uint32* totalMem,
uint32* usedMem,
vector<PlaylistItem*>* list,
PLMCallBackFunction function,
void* cookie)
{
Error result = kError_UnknownErr;
if(rio.RxDirectory())
{
result = kError_NoErr;
CDirBlock& cDirBlock = rio.GetDirectoryBlock();
CDirHeader& cDirHeader = cDirBlock.m_cDirHeader;
*totalMem = ((long)cDirHeader.m_usCount32KBlockAvailable * CRIO_SIZE_32KBLOCK);
*usedMem = ((long)cDirHeader.m_usCount32KBlockUsed * CRIO_SIZE_32KBLOCK);
uint32 count = cDirHeader.m_usCountEntry;
if(count)
{
CDirEntry* pDirEntry = cDirBlock.m_acDirEntry;
if(count > CRIO_MAX_DIRENTRY)
count = CRIO_MAX_DIRENTRY;
for(uint32 index = 0; index < count; ++index, ++pDirEntry)
{
string url;
ostringstream ost;
MetaData metadata;
ost << "portable://rio_pmp300/" <<
(useExternal ? "external/" : "internal/") << index <<
"/" << pDirEntry->m_szName;
url = ost.str();
metadata.SetSize(pDirEntry->m_lSize);
metadata.SetTitle(pDirEntry->m_szName);
PlaylistItem* item = new PlaylistItem(url.c_str(), &metadata);
if(!item)
{
result = kError_OutOfMemory;
break;
}
list->push_back(item);
if(function)
{
PLMEvent event;
event.type = kPLMEvent_Progress;
event.data.progressData.position = index + 1;
event.data.progressData.total = count;
event.data.progressData.item = item;
function(&event, cookie);
}
}
}
}
return result;
}
示例2: DecodeWork
//.........这里部分代码省略.........
if (Err != kError_NoErr)
{
ReportError(szFailWrite);
m_pContext->log->Error("LMC: Cannot write to eventbuffer: %s (%d)\n",
m_szError, Err);
break;
}
section = -1;
ret = ov_read(&m_vf, (char *)pOutBuffer, iDecodeBlockSize,
0, 2, 1, §ion);
if (ret == 0)
{
m_pOutputBuffer->EndWrite(0);
break;
}
if (section != m_section)
{
vi = ov_info(&m_vf, -1);
info = new OutputInfo;
info->bits_per_sample = 16;
info->number_of_channels = m_channels = vi->channels;
info->samples_per_second = m_rate = vi->rate;
info->samples_per_frame = vi->rate / iFramesPerSecond;
info->max_buffer_size = 16384;
m_frameCounter = 0;
bytesCopied = 0;
bytesPerFrame = (vi->rate / iFramesPerSecond) *
sizeof(ogg_int16_t) * vi->channels;
m_section = section;
m_pOutputBuffer->EndWrite(0);
((EventBuffer *)m_pOutputBuffer)->AcceptEvent(new PMOInitEvent(info));
((EventBuffer *)m_pOutputBuffer)->AcceptEvent(
new PMOTimeInfoEvent(m_frameCounter));
Err = m_pOutputBuffer->BeginWrite(pOutBuffer, iDecodeBlockSize);
if (Err != kError_NoErr)
{
assert(0);
}
vorbis_comment *comment;
comment = ov_comment(&m_vf, -1);
if (comment)
{
PlaylistItem *plItem = m_pContext->plm->GetCurrentItem();
if (plItem)
{
MetaData mdata = plItem->GetMetaData();
string iso;
char *temp;
temp = vorbis_comment_query(comment, "title", 0);
if (temp)
{
iso = ConvertToISO(temp);
mdata.SetTitle(iso);
}
temp = vorbis_comment_query(comment, "artist", 0);
if (temp)
{
iso = ConvertToISO(temp);
mdata.SetArtist(iso);
}
temp = vorbis_comment_query(comment, "album", 0);
if (temp)
{
iso = ConvertToISO(temp);
mdata.SetAlbum(iso);
}
temp = vorbis_comment_query(comment, "tracknumber", 0);
if (temp)
mdata.SetTrack(atoi(temp));
plItem->SetMetaData(&mdata);
m_pContext->target->AcceptEvent(
new PlaylistCurrentItemInfoEvent(plItem,
m_pContext->plm));
}
}
}
if(ret <0)
ret=0; // hole/error in data - we can safely ignore this
m_pOutputBuffer->EndWrite(ret);
bytesCopied += ret;
}
((EventBuffer *)m_pOutputBuffer)->AcceptEvent(new PMOQuitEvent());
ov_clear(&m_vf);
return;
}
示例3: AddItem
void PLS::AddItem(vector<PlaylistItem*>* list, char *entry,
char *title, int32 len, char *root)
{
int32 index;
uint32 length;
char path[_MAX_PATH];
PlaylistItem *item;
// if this is not a URL then let's
// enable people with different platforms
// to swap files by changing the path
// separator as necessary
if( strncmp(entry, "http://", 7) &&
strncmp(entry, "rtp://", 6) &&
strncmp(entry, "file://", 7))
{
for (index = strlen(entry) - 1; index >=0; index--)
{
if(entry[index] == '\\' && DIR_MARKER == '/')
entry[index] = DIR_MARKER;
else if(entry[index] == '/' && DIR_MARKER == '\\')
entry[index] = DIR_MARKER;
}
}
// get rid of nasty trailing whitespace
for (index = strlen(entry) - 1; index >=0; index--)
{
if(isspace(entry[index]))
{
entry[index] = 0x00;
}
else
break;
}
// is there anything left?
if(strlen(entry))
{
// is it a url already?
if (!strncmp(entry, "http://", 7) ||
!strncmp(entry, "rtp://", 6) ||
!strncmp(entry, "file://", 7))
{
strcpy(path, entry);
}
else
{
// is the path relative?
if( !strncmp(entry, "..", 2) ||
(strncmp(entry + 1, ":\\", 2) &&
strncmp(entry, DIR_MARKER_STR, 1)))
{
strcpy(path, root);
strcat(path, entry);
}
else
{
strcpy(path, entry);
}
// make it a url so we can add it to the playlist
length = strlen(path) + 15;
char *itemurl = new char[length];
if (IsntError(FilePathToURL(path, itemurl, &length)))
strcpy(path, itemurl);
delete [] itemurl;
}
if (title || len > 0)
{
MetaData oData;
if (title)
oData.SetTitle(title);
if (len > 0)
oData.SetTime(len);
item = new PlaylistItem(path, &oData);
}
else
item = new PlaylistItem(path);
list->push_back(item);
}
}