Andrew MacDonald | cb05b72 | 2015-05-08 05:17:51 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 11 | #ifndef MODULES_AUDIO_PROCESSING_TEST_PROTOBUF_UTILS_H_ |
| 12 | #define MODULES_AUDIO_PROCESSING_TEST_PROTOBUF_UTILS_H_ |
Andrew MacDonald | cb05b72 | 2015-05-08 05:17:51 | [diff] [blame] | 13 | |
kwiberg | 62eaacf | 2016-02-17 14:39:05 | [diff] [blame] | 14 | #include <memory> |
Sonia-Florina Horchidan | b75d14c | 2019-08-12 07:57:01 | [diff] [blame] | 15 | #include <sstream> // no-presubmit-check TODO(webrtc:8982) |
kwiberg | 62eaacf | 2016-02-17 14:39:05 | [diff] [blame] | 16 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 17 | #include "rtc_base/protobuf_utils.h" |
kwiberg | 77eab70 | 2016-09-29 00:42:01 | [diff] [blame] | 18 | |
Björn Terelius | efeeba0 | 2023-10-31 14:44:50 | [diff] [blame] | 19 | // Generated at build-time by the protobuf compiler. |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 20 | #include "modules/audio_processing/debug.pb.h" |
Andrew MacDonald | cb05b72 | 2015-05-08 05:17:51 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | |
kwiberg | 62eaacf | 2016-02-17 14:39:05 | [diff] [blame] | 24 | // Allocates new memory in the unique_ptr to fit the raw message and returns the |
Andrew MacDonald | cb05b72 | 2015-05-08 05:17:51 | [diff] [blame] | 25 | // number of bytes read. |
kwiberg | 62eaacf | 2016-02-17 14:39:05 | [diff] [blame] | 26 | size_t ReadMessageBytesFromFile(FILE* file, std::unique_ptr<uint8_t[]>* bytes); |
Andrew MacDonald | cb05b72 | 2015-05-08 05:17:51 | [diff] [blame] | 27 | |
| 28 | // Returns true on success, false on error or end-of-file. |
mbonadei | 7c2c843 | 2017-04-07 07:59:12 | [diff] [blame] | 29 | bool ReadMessageFromFile(FILE* file, MessageLite* msg); |
Andrew MacDonald | cb05b72 | 2015-05-08 05:17:51 | [diff] [blame] | 30 | |
Sonia-Florina Horchidan | b75d14c | 2019-08-12 07:57:01 | [diff] [blame] | 31 | // Returns true on success, false on error or end of string stream. |
| 32 | bool ReadMessageFromString( |
| 33 | std::stringstream* input, // no-presubmit-check TODO(webrtc:8982) |
| 34 | MessageLite* msg); |
| 35 | |
Andrew MacDonald | cb05b72 | 2015-05-08 05:17:51 | [diff] [blame] | 36 | } // namespace webrtc |
| 37 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 38 | #endif // MODULES_AUDIO_PROCESSING_TEST_PROTOBUF_UTILS_H_ |