xref: /aosp_15_r20/external/webrtc/modules/audio_device/dummy/file_audio_device_factory.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef AUDIO_DEVICE_FILE_AUDIO_DEVICE_FACTORY_H_
12 #define AUDIO_DEVICE_FILE_AUDIO_DEVICE_FACTORY_H_
13 
14 #include <stdint.h>
15 
16 #include "absl/strings/string_view.h"
17 
18 namespace webrtc {
19 
20 class FileAudioDevice;
21 
22 // This class is used by audio_device_impl.cc when WebRTC is compiled with
23 // WEBRTC_DUMMY_FILE_DEVICES. The application must include this file and set the
24 // filenames to use before the audio device module is initialized. This is
25 // intended for test tools which use the audio device module.
26 class FileAudioDeviceFactory {
27  public:
28   static FileAudioDevice* CreateFileAudioDevice();
29 
30   // The input file must be a readable 48k stereo raw file. The output
31   // file must be writable. The strings will be copied.
32   static void SetFilenamesToUse(absl::string_view inputAudioFilename,
33                                 absl::string_view outputAudioFilename);
34 
35  private:
36   enum : uint32_t { MAX_FILENAME_LEN = 512 };
37   static bool _isConfigured;
38   static char _inputAudioFilename[MAX_FILENAME_LEN];
39   static char _outputAudioFilename[MAX_FILENAME_LEN];
40 };
41 
42 }  // namespace webrtc
43 
44 #endif  // AUDIO_DEVICE_FILE_AUDIO_DEVICE_FACTORY_H_
45