···11-/*
22-This file is part of Darling.
33-44-Copyright (C) 2020 Lubos Dolezel
55-66-Darling is free software: you can redistribute it and/or modify
77-it under the terms of the GNU General Public License as published by
88-the Free Software Foundation, either version 3 of the License, or
99-(at your option) any later version.
1010-1111-Darling is distributed in the hope that it will be useful,
1212-but WITHOUT ANY WARRANTY; without even the implied warranty of
1313-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414-GNU General Public License for more details.
1515-1616-You should have received a copy of the GNU General Public License
1717-along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818-*/
1919-2020-#include "AudioFileFormatMP3.h"
2121-2222-AudioFileFormatMP3::AudioFileFormatMP3()
2323-: AudioFileFormatGeneric('.mp3', "mp3")
2424-{
2525-}
2626-2727-AudioFileFormatMP3* AudioFileFormatMP3::instance()
2828-{
2929- static AudioFileFormatMP3 inst;
3030- return &inst;
3131-}
3232-3333-const AudioFileFormatMP3::Description& AudioFileFormatMP3::description() const
3434-{
3535- static const Description d = {
3636- .name = "MPEG Layer 3",
3737- .extensions = { "mp3" },
3838- .utis = { "public.mp3", "public.audio", "public.data" },
3939- .mimeTypes = { "audio/mpeg" },
4040- };
4141- return d;
4242-}
···11+/*
22+This file is part of Darling.
33+44+Copyright (C) 2020 Lubos Dolezel
55+66+Darling is free software: you can redistribute it and/or modify
77+it under the terms of the GNU General Public License as published by
88+the Free Software Foundation, either version 3 of the License, or
99+(at your option) any later version.
1010+1111+Darling is distributed in the hope that it will be useful,
1212+but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+GNU General Public License for more details.
1515+1616+You should have received a copy of the GNU General Public License
1717+along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+#include "AudioFileMP3.h"
2020+#include "AVFormatFileObject.h"
2121+#include "AudioFileFormatGeneric.h"
2222+2323+class AudioFileFormatMP3 : public AudioFileFormatGeneric
2424+{
2525+public:
2626+ AudioFileFormatMP3() : AudioFileFormatGeneric('.mp3', "mp3") {}
2727+protected:
2828+ const Description& description() const override
2929+ {
3030+ static const Description d = {
3131+ .name = "MPEG Layer 3",
3232+ .extensions = { "mp3" },
3333+ .utis = { "public.mp3", "public.audio", "public.data" },
3434+ .mimeTypes = { "audio/mpeg" },
3535+ .formats = { '.mp3' },
3636+ };
3737+ return d;
3838+ }
3939+};
4040+4141+class MP3Component : public AVFormatFileObject<AudioFileFormatMP3, AudioFileMP3, '.mp3'>
4242+{
4343+public:
4444+ MP3Component(AudioComponentInstance inInstance) : AVFormatFileObject(inInstance) {}
4545+};
4646+4747+#pragma GCC visibility push(default)
4848+AUDIOCOMPONENT_ENTRY(AudioFileComponentFactory, MP3Component);
4949+#pragma GCC visibility pop
5050+5151+AudioFileMP3::AudioFileMP3()
5252+: AudioFileObject('.mp3')
5353+{
5454+5555+}
5656+5757+Boolean AudioFileMP3::IsDataFormatSupported(const AudioStreamBasicDescription *inFormat)
5858+{
5959+ return true;
6060+}
···11+/*
22+This file is part of Darling.
33+44+Copyright (C) 2020 Lubos Dolezel
55+66+Darling is free software: you can redistribute it and/or modify
77+it under the terms of the GNU General Public License as published by
88+the Free Software Foundation, either version 3 of the License, or
99+(at your option) any later version.
1010+1111+Darling is distributed in the hope that it will be useful,
1212+but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+GNU General Public License for more details.
1515+1616+You should have received a copy of the GNU General Public License
1717+along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+#include "AudioFileWAV.h"
2020+#include "AVFormatFileObject.h"
2121+#include "AudioFileFormatGeneric.h"
2222+2323+class AudioFileFormatWAV : public AudioFileFormatGeneric
2424+{
2525+public:
2626+ AudioFileFormatWAV() : AudioFileFormatGeneric('.mp3', "wav") {}
2727+protected:
2828+ const Description& description() const override
2929+ {
3030+ static const Description d = {
3131+ .name = "WAVE",
3232+ .extensions = { "wav" },
3333+ .utis = { "com.microsoft.waveform-audio", "public.audio", "public.data" },
3434+ .mimeTypes = { "audio/wav" },
3535+ .formats = {
3636+ Format(kAudioFormatLinearPCM, 0, 8),
3737+ Format(kAudioFormatLinearPCM, kAudioFormatFlagIsSignedInteger, 16),
3838+ Format(kAudioFormatLinearPCM, kAudioFormatFlagIsSignedInteger, 24),
3939+ Format(kAudioFormatLinearPCM, kAudioFormatFlagIsSignedInteger, 32),
4040+ Format(kAudioFormatLinearPCM, kAudioFormatFlagIsFloat, 32),
4141+ Format(kAudioFormatLinearPCM, kAudioFormatFlagIsFloat, 64),
4242+ 'ulaw', 'alaw'
4343+ },
4444+ };
4545+ return d;
4646+ }
4747+};
4848+4949+class WAVComponent : public AVFormatFileObject<AudioFileFormatWAV, AudioFileWAV, '.wav'>
5050+{
5151+public:
5252+ WAVComponent(AudioComponentInstance inInstance) : AVFormatFileObject(inInstance) {}
5353+};
5454+5555+#pragma GCC visibility push(default)
5656+AUDIOCOMPONENT_ENTRY(AudioFileComponentFactory, WAVComponent);
5757+#pragma GCC visibility pop
5858+5959+AudioFileWAV::AudioFileWAV()
6060+: AudioFileObject('.wav')
6161+{
6262+6363+}
6464+6565+Boolean AudioFileWAV::IsDataFormatSupported(const AudioStreamBasicDescription *inFormat)
6666+{
6767+ return true;
6868+}
+31
src/CoreAudio/AFAVFormatComponent/AudioFileWAV.h
···11+/*
22+This file is part of Darling.
33+44+Copyright (C) 2020 Lubos Dolezel
55+66+Darling is free software: you can redistribute it and/or modify
77+it under the terms of the GNU General Public License as published by
88+the Free Software Foundation, either version 3 of the License, or
99+(at your option) any later version.
1010+1111+Darling is distributed in the hope that it will be useful,
1212+but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+GNU General Public License for more details.
1515+1616+You should have received a copy of the GNU General Public License
1717+along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+2020+#ifndef _AUDIO_FILE_WAV_H
2121+#define _AUDIO_FILE_WAV_H
2222+#include "AudioFileObject.h"
2323+2424+class AudioFileWAV : public AudioFileObject
2525+{
2626+public:
2727+ AudioFileWAV();
2828+ Boolean IsDataFormatSupported(const AudioStreamBasicDescription *inFormat) override;
2929+};
3030+3131+#endif