text: ////////////////////////////////////////////////////////////////////////////////
  //
  // Copyright (c) The Ultraschall Project (https://ultraschall.fm)
  //
  // The MIT License (MIT)
  //
  // Permission is hereby granted, free of charge, to any person obtaining a copy
  // of this software and associated documentation files (the "Software"), to deal
  // in the Software without restriction, including without limitation the rights
  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  // copies of the Software, and to permit persons to whom the Software is
  // furnished to do so, subject to the following conditions:
  //
  // The above copyright notice and this permission notice shall be included in
  // all copies or substantial portions of the Software.
  //
  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  // THE SOFTWARE.
  //
  ////////////////////////////////////////////////////////////////////////////////
  
  #include "ID3V2Context.h"
  
  namespace ultraschall { namespace reaper { 
  
  ID3V2Context::ID3V2Context(const UnicodeString& targetName) : target_(new taglib_mp3::File(U2H(targetName).c_str())), tags_(nullptr)
  {
      if(target_->isOpen() == true)
      {
          if(target_->audioProperties() != nullptr)
          {
              duration_ = target_->audioProperties()->length() * 1000;
          }
  
          target_->strip(taglib_mp3::File::ID3v1 | taglib_mp3::File::APE);
          tags_ = target_->ID3v2Tag();
      }
  }
  
  ID3V2Context::~ID3V2Context()
  {
      tags_ = nullptr;
      SafeDelete(target_);
  }
  
  }} // namespace ultraschall::reaper::id3v2
  