当前位置: 首页>>代码示例>>C++>>正文


C++ MetaData::SetSize方法代码示例

本文整理汇总了C++中MetaData::SetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaData::SetSize方法的具体用法?C++ MetaData::SetSize怎么用?C++ MetaData::SetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MetaData的用法示例。


在下文中一共展示了MetaData::SetSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
   char        sig[37];
   MetaData    m;
   struct stat s;
   int         index = 1;
   bool        hasmeta = false;

   if (argc < 2)
   {
       printf("Usage: sigapp [-q] [-n] <mp3 file>\n");
       printf("  -q => quiet mode\n");
       printf("  -l => don't lookup data at musicbrainz\n");
       exit(0);
   }

   if (strcmp(argv[index], "-q") == 0)
   {
       quiet = 1;
       index++;
   }

   if (strcmp(argv[index], "-l") == 0)
   {
       nosubmit = 1;
       index++;
   }

   if (get_metadata(argv[index], &m))
   {
       stat(argv[index], &s);
       m.SetSize(s.st_size);
       if (!quiet)
       {
          printf("Local metadata:\n");
          printf("    Title: %s\n", m.Title().c_str());
          printf("    Album: %s\n", m.Album().c_str());
          printf("   Artist: %s\n", m.Artist().c_str());
          printf("    Genre: %s\n", m.Genre().c_str());
          printf("  Comment: %s\n", m.Comment().c_str());
          printf("    Track: %d\n", m.Track());
          printf("     Time: %d\n", m.Time());
          printf("     Size: %d\n", m.Size());
       }
       hasmeta = true;
   }
   
   if (ff_decode(argv[index], sig, 0, 0, 0, 24000, 0))
   {
       m.SetGUID(sig);
       if (!quiet)
           printf("Signature: ");

       printf("%s\n", sig);
       if (!nosubmit)
       {
           lookup_metadata(&m);
       }
#ifdef SIG_DEBUG
       FILE *logfile = fopen("guid_mapping.txt", "a+");
       fprintf(logfile,"%s\t%s\n", argv[index], sig);
       fclose(logfile);
#endif
   }
   else
   {
       if (!quiet)
          printf("Error calculating signature.\n");
   }

   return 0;
}
开发者ID:pontocom,项目名称:opensdrm,代码行数:72,代码来源:sigmain.cpp

示例2: 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;
}
开发者ID:pontocom,项目名称:opensdrm,代码行数:71,代码来源:pmp300.cpp


注:本文中的MetaData::SetSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。