this repo has no description
at fixPythonPipStalling 66 lines 2.4 kB view raw
1/* 2This file is part of Darling. 3 4Copyright (C) 2020 Lubos Dolezel 5 6Darling is free software: you can redistribute it and/or modify 7it under the terms of the GNU General Public License as published by 8the Free Software Foundation, either version 3 of the License, or 9(at your option) any later version. 10 11Darling is distributed in the hope that it will be useful, 12but WITHOUT ANY WARRANTY; without even the implied warranty of 13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14GNU General Public License for more details. 15 16You should have received a copy of the GNU General Public License 17along with Darling. If not, see <http://www.gnu.org/licenses/>. 18*/ 19 20#ifndef _AUDIO_FILE_FORMAT_GENERIC_H 21#define _AUDIO_FILE_FORMAT_GENERIC_H 22#include "AudioFileFormat.h" 23 24class AudioFileFormatGeneric : public AudioFileFormat 25{ 26public: 27 AudioFileFormatGeneric(UInt32 inFileType, const char* avformatShortName); 28 Boolean ExtensionIsThisFormat(CFStringRef inExtension) override; 29 void GetExtensions(CFArrayRef *outArray) override; 30 void GetUTIs(CFArrayRef *outArray) override; 31 void GetMIMETypes(CFArrayRef *outArray) override; 32 void GetFileTypeName(CFStringRef *outName) override; 33 UncertainResult FileDataIsThisFormat(UInt32 inDataByteSize, const void* inData) override; 34 35 AudioFileObject* New() override; 36 AudioFileStreamObject* NewStream() override { return NULL; } 37 38 // File format -> data formats 39 // https://developer.apple.com/library/archive/documentation/MusicAudio/Conceptual/CoreAudioOverview/SupportedAudioFormatsMacOSX/SupportedAudioFormatsMacOSX.html 40 OSStatus GetAvailableFormatIDs(UInt32* ioDataSize, void* outPropertyData) override; 41 42 OSStatus GetAvailableStreamDescriptions(UInt32 inFormatID, UInt32* ioDataSize, void* outPropertyData) override; 43private: 44 static CFArrayRef toCFArray(const std::vector<const char*>& array); 45protected: 46 struct Format : public AudioStreamBasicDescription 47 { 48 Format(UInt32 formatID) { mFormatID = formatID; } 49 Format(UInt32 formatID, UInt32 formatFlags, UInt32 bitsPerChannel) { mFormatID = formatID; mFormatFlags = formatFlags; mBitsPerChannel = bitsPerChannel; } 50 Format() {} 51 }; 52 struct Description 53 { 54 const char* name; 55 std::vector<const char*> extensions; 56 std::vector<const char*> utis; 57 std::vector<const char*> mimeTypes; 58 std::vector<Format> formats; 59 }; 60 virtual const Description& description() const = 0; 61private: 62 const char* m_avformatShortName; 63}; 64 65#endif 66