コード例 #1
0
///there could be the ODBlockFiles of several FLACs in one track (after copy and pasting)
///so we keep a list of decoders that keep track of the file names, etc, and check the blocks against them.
///Blocks that have IsDataAvailable()==false are blockfiles to be decoded.  if BlockFile::GetDecodeType()==ODDecodeTask::GetDecodeType() then
///this decoder should handle it.  Decoders are accessible with the methods below.  These aren't thread-safe and should only
///be called from the decoding thread.
ODFileDecoder* ODDecodeTask::GetOrCreateMatchingFileDecoder(ODDecodeBlockFile* blockFile)
{
   ODFileDecoder* ret=NULL;
   //see if the filename matches any of our decoders, if so, return it.
   for(int i=0;i<(int)mDecoders.size();i++)
   {
      if(strcmp(mDecoders[i]->GetFileName(),blockFile->GetAudioFileName().GetFullPath().mb_str()) ==0)
      {
         ret = mDecoders[i];
         break;
      }
   }
   
   //otherwise, create and add one, and return it.
   if(!ret)
   {
      ret=CreateFileDecoder(blockFile->GetFileName().GetFullPath().mb_str());
      mDecoders.push_back(ret);
   }
   return ret;
}
コード例 #2
0
ファイル: ODDecodeTask.cpp プロジェクト: MartynShaw/audacity
///there could be the ODBlockFiles of several FLACs in one track (after copy and pasting)
///so we keep a list of decoders that keep track of the file names, etc, and check the blocks against them.
///Blocks that have IsDataAvailable()==false are blockfiles to be decoded.  if BlockFile::GetDecodeType()==ODDecodeTask::GetODType() then
///this decoder should handle it.  Decoders are accessible with the methods below.  These aren't thread-safe and should only
///be called from the decoding thread.
ODFileDecoder* ODDecodeTask::GetOrCreateMatchingFileDecoder(ODDecodeBlockFile* blockFile)
{
   ODFileDecoder* ret=NULL;
   //see if the filename matches any of our decoders, if so, return it.
   for(int i=0;i<(int)mDecoders.size();i++)
   {
      //we check filename and decode type, since two types of ODDecoders might work with the same filetype
      //e.g., FFmpeg and LibMad import both do MP3s.  TODO: is this necessary? in theory we filter this when
      //updating our list of blockfiles.
      if(mDecoders[i]->GetFileName()==blockFile->GetAudioFileName().GetFullPath() &&
         GetODType() == blockFile->GetDecodeType() )
      {
         ret = mDecoders[i];
         break;
      }
   }

   //otherwise, create and add one, and return it.
   if(!ret)
   {
      ret=CreateFileDecoder(blockFile->GetAudioFileName().GetFullPath());
   }
   return ret;
}