Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Side by Side Diff: services/media/audio/platform/generic/output_formatter.h

Issue 1902183002: Motown: Change media type (stream type) representation (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Changes per review feedback. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SERVICES_MEDIA_AUDIO_PLATFORM_GENERIC_OUTPUT_FORMATTER_H_ 5 #ifndef SERVICES_MEDIA_AUDIO_PLATFORM_GENERIC_OUTPUT_FORMATTER_H_
6 #define SERVICES_MEDIA_AUDIO_PLATFORM_GENERIC_OUTPUT_FORMATTER_H_ 6 #define SERVICES_MEDIA_AUDIO_PLATFORM_GENERIC_OUTPUT_FORMATTER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "mojo/services/media/common/interfaces/media_types.mojom.h" 10 #include "mojo/services/media/common/interfaces/media_types.mojom.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace media { 13 namespace media {
14 namespace audio { 14 namespace audio {
15 15
16 class OutputFormatter; 16 class OutputFormatter;
17 using OutputFormatterPtr = std::unique_ptr<OutputFormatter>; 17 using OutputFormatterPtr = std::unique_ptr<OutputFormatter>;
18 18
19 class OutputFormatter { 19 class OutputFormatter {
20 public: 20 public:
21 static OutputFormatterPtr Select( 21 static OutputFormatterPtr Select(
22 const LpcmMediaTypeDetailsPtr& output_format); 22 const AudioMediaTypeDetailsPtr& output_format);
23 23
24 ~OutputFormatter(); 24 ~OutputFormatter();
25 25
26 /** 26 /**
27 * Take frames of audio from the source intermediate buffer and convert them 27 * Take frames of audio from the source intermediate buffer and convert them
28 * to the proper sample format for the output buffer, clipping the audio as 28 * to the proper sample format for the output buffer, clipping the audio as
29 * needed in the process. 29 * needed in the process.
30 * 30 *
31 * @note It is assumed that the source intermediate mixing buffer has the same 31 * @note It is assumed that the source intermediate mixing buffer has the same
32 * number of channels and channel ordering as the output buffer. 32 * number of channels and channel ordering as the output buffer.
(...skipping 13 matching lines...) Expand all
46 /** 46 /**
47 * Fill a destination buffer with silence. 47 * Fill a destination buffer with silence.
48 * 48 *
49 * @param dest A pointer to the destination buffer whose frames match the 49 * @param dest A pointer to the destination buffer whose frames match the
50 * format described by output_format during the call to Select. 50 * format described by output_format during the call to Select.
51 * 51 *
52 * @param frames The number of frames to produce. 52 * @param frames The number of frames to produce.
53 */ 53 */
54 virtual void FillWithSilence(void* dest, uint32_t frames) const = 0; 54 virtual void FillWithSilence(void* dest, uint32_t frames) const = 0;
55 55
56 const LpcmMediaTypeDetailsPtr& format() const { return format_; } 56 const AudioMediaTypeDetailsPtr& format() const { return format_; }
57 uint32_t channels() const { return channels_; } 57 uint32_t channels() const { return channels_; }
58 uint32_t bytes_per_sample() const { return bytes_per_sample_; } 58 uint32_t bytes_per_sample() const { return bytes_per_sample_; }
59 uint32_t bytes_per_frame() const { return bytes_per_frame_; } 59 uint32_t bytes_per_frame() const { return bytes_per_frame_; }
60 60
61 protected: 61 protected:
62 OutputFormatter(const LpcmMediaTypeDetailsPtr& output_format, 62 OutputFormatter(const AudioMediaTypeDetailsPtr& output_format,
63 uint32_t bytes_per_sample, 63 uint32_t bytes_per_sample,
64 uint32_t channels); 64 uint32_t channels);
65 65
66 LpcmMediaTypeDetailsPtr format_; 66 AudioMediaTypeDetailsPtr format_;
67 uint32_t channels_ = 0; 67 uint32_t channels_ = 0;
68 uint32_t bytes_per_sample_ = 0; 68 uint32_t bytes_per_sample_ = 0;
69 uint32_t bytes_per_frame_ = 0; 69 uint32_t bytes_per_frame_ = 0;
70 }; 70 };
71 71
72 } // namespace audio 72 } // namespace audio
73 } // namespace media 73 } // namespace media
74 } // namespace mojo 74 } // namespace mojo
75 75
76 #endif // SERVICES_MEDIA_AUDIO_PLATFORM_GENERIC_OUTPUT_FORMATTER_H_ 76 #endif // SERVICES_MEDIA_AUDIO_PLATFORM_GENERIC_OUTPUT_FORMATTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698