/// <summary> /// Constructor /// </summary> /// <param name="stream">Stream to access in-memory data to be parsed</param> /// <param name="mimeType">the file's mime type.</param> /// <param name="readEmbeddedPictures">Embedded pictures will be read if true; ignored if false</param> /// <param name="readAllMetaFrames">All metadata frames (including unmapped ones) will be read if true; ignored if false</param> public AudioFileIo(Stream stream, String mimeType, Boolean readEmbeddedPictures, Boolean readAllMetaFrames = false) { Byte alternate = 0; var found = false; _audioData = AudioDataIoFactory.GetInstance().GetFromMimeType(mimeType, "In-memory", alternate); _audioManager = new AudioDataManager(_audioData, stream); found = _audioManager.ReadFromFile(readEmbeddedPictures, readAllMetaFrames); while (!found && alternate < AudioDataIoFactory.MaxAlternates) { alternate++; _audioData = AudioDataIoFactory.GetInstance().GetFromMimeType(mimeType, "In-memory", alternate); _audioManager = new AudioDataManager(_audioData, stream); found = _audioManager.ReadFromFile(readEmbeddedPictures, readAllMetaFrames); } _metaData = MetaDataIOFactory.GetInstance().GetMetaReader(_audioManager); if (_metaData is DummyTag && (0 == _audioManager.getAvailableMetas().Count)) { LogDelegator.GetLogDelegate()(Log.LV_WARNING, "Could not find any metadata"); } }
/// <summary> /// Constructor /// </summary> /// <param name="stream">Stream to access in-memory data to be parsed</param> /// <param name="mimeType">Mime-type of the stream to process</param> /// <param name="readEmbeddedPictures">Embedded pictures will be read if true; ignored if false</param> /// <param name="readAllMetaFrames">All metadata frames (including unmapped ones) will be read if true; ignored if false</param> /// <param name="writeProgress">Object to use to signal writing progress (optional)</param> public AudioFileIO(Stream stream, String mimeType, bool readEmbeddedPictures, bool readAllMetaFrames = false, IProgress <float> writeProgress = null) { byte alternate = 0; bool found = false; audioData = AudioDataIOFactory.GetInstance().GetFromMimeType(mimeType, "In-memory", alternate); audioManager = new AudioDataManager(audioData, stream, writeProgress); this.writeProgress = writeProgress; found = audioManager.ReadFromFile(readEmbeddedPictures, readAllMetaFrames); while (!found && alternate < AudioDataIOFactory.MAX_ALTERNATES) { alternate++; audioData = AudioDataIOFactory.GetInstance().GetFromMimeType(mimeType, "In-memory", alternate); audioManager = new AudioDataManager(audioData, stream, writeProgress); found = audioManager.ReadFromFile(readEmbeddedPictures, readAllMetaFrames); } metaData = MetaDataIOFactory.GetInstance().GetMetaReader(audioManager); if (metaData is DummyTag && (0 == audioManager.getAvailableMetas().Count)) { LogDelegator.GetLogDelegate()(Log.LV_WARNING, "Could not find any metadata"); } }
// ------------------------------------------------------------------------------------------ /// <summary> /// Constructor /// </summary> /// <param name="path">Path of the file to be parsed</param> public AudioFileIO(string path, bool readEmbeddedPictures, bool readAllMetaFrames = false) { byte alternate = 0; bool found = false; thePath = path; audioData = AudioDataIOFactory.GetInstance().GetDataReader(path, alternate); audioManager = new AudioDataManager(audioData); found = audioManager.ReadFromFile(readEmbeddedPictures, readAllMetaFrames); while (!found && alternate < AudioDataIOFactory.MAX_ALTERNATES) { alternate++; audioData = AudioDataIOFactory.GetInstance().GetDataReader(path, alternate); audioManager = new AudioDataManager(audioData); found = audioManager.ReadFromFile(readEmbeddedPictures, readAllMetaFrames); } metaData = MetaDataIOFactory.GetInstance().GetMetaReader(audioManager); if (metaData is DummyTag && (0 == audioManager.getAvailableMetas().Count)) { LogDelegator.GetLogDelegate()(Log.LV_WARNING, "Could not find any metadata"); } }