Index: services/media/framework/stream_type.h |
diff --git a/services/media/framework/stream_type.h b/services/media/framework/stream_type.h |
index 31021e286443235f48fb5309b83f022938324199..82a61e8831f75be66bfeb443ea69800a31c5e503 100644 |
--- a/services/media/framework/stream_type.h |
+++ b/services/media/framework/stream_type.h |
@@ -81,9 +81,7 @@ class StreamType { |
virtual ~StreamType(); |
- Scheme scheme() const { |
- return scheme_; |
- } |
+ Scheme scheme() const { return scheme_; } |
virtual const MultiplexedStreamType* multiplexed() const; |
virtual const LpcmStreamType* lpcm() const; |
@@ -96,7 +94,7 @@ class StreamType { |
Scheme scheme_; |
}; |
-template<typename T> |
+template <typename T> |
struct Range { |
Range(T min_param, T max_param) : min(min_param), max(max_param) { |
DCHECK(min_param <= max_param); |
@@ -105,9 +103,7 @@ struct Range { |
T min; |
T max; |
- constexpr bool contains(const T& t) const { |
- return t >= min && t <= max; |
- } |
+ constexpr bool contains(const T& t) const { return t >= min && t <= max; } |
}; |
class StreamTypeSet; |
@@ -127,9 +123,7 @@ class StreamTypeSet { |
virtual ~StreamTypeSet(); |
- StreamType::Scheme scheme() const { |
- return scheme_; |
- } |
+ StreamType::Scheme scheme() const { return scheme_; } |
virtual const MultiplexedStreamTypeSet* multiplexed() const; |
virtual const LpcmStreamTypeSet* lpcm() const; |
@@ -149,10 +143,8 @@ class MultiplexedStreamType : public StreamType { |
std::unique_ptr<StreamType> multiplex_type, |
std::unique_ptr<std::vector<std::unique_ptr<StreamType>>> |
substream_types) { |
- return std::unique_ptr<StreamType>( |
- new MultiplexedStreamType( |
- std::move(multiplex_type), |
- std::move(substream_types))); |
+ return std::unique_ptr<StreamType>(new MultiplexedStreamType( |
+ std::move(multiplex_type), std::move(substream_types))); |
} |
MultiplexedStreamType( |
@@ -169,28 +161,26 @@ class MultiplexedStreamType : public StreamType { |
} |
const std::unique_ptr<std::vector<std::unique_ptr<StreamType>>>& |
- substream_types() const { |
+ substream_types() const { |
return substream_types_; |
} |
std::unique_ptr<StreamType> Clone() const override; |
-private: |
+ private: |
std::unique_ptr<StreamType> multiplex_type_; |
std::unique_ptr<std::vector<std::unique_ptr<StreamType>>> substream_types_; |
}; |
// Describes the type of a multiplexed stream. |
class MultiplexedStreamTypeSet : public StreamTypeSet { |
-public: |
+ public: |
static std::unique_ptr<StreamTypeSet> Create( |
std::unique_ptr<StreamTypeSet> multiplex_type_set, |
std::unique_ptr<std::vector<std::unique_ptr<StreamTypeSet>>> |
substream_type_sets) { |
- return std::unique_ptr<StreamTypeSet>( |
- new MultiplexedStreamTypeSet( |
- std::move(multiplex_type_set), |
- std::move(substream_type_sets))); |
+ return std::unique_ptr<StreamTypeSet>(new MultiplexedStreamTypeSet( |
+ std::move(multiplex_type_set), std::move(substream_type_sets))); |
} |
MultiplexedStreamTypeSet( |
@@ -207,13 +197,13 @@ public: |
} |
const std::unique_ptr<std::vector<std::unique_ptr<StreamTypeSet>>>& |
- substream_type_sets() const { |
+ substream_type_sets() const { |
return substream_type_sets_; |
} |
std::unique_ptr<StreamTypeSet> Clone() const override; |
-private: |
+ private: |
std::unique_ptr<StreamTypeSet> multiplex_type_set_; |
std::unique_ptr<std::vector<std::unique_ptr<StreamTypeSet>>> |
substream_type_sets_; |
@@ -231,44 +221,30 @@ class LpcmStreamType : public StreamType { |
kFloat |
}; |
- static std::unique_ptr<StreamType> Create( |
- SampleFormat sample_format, |
- uint32_t channels, |
- uint32_t frames_per_second) { |
- return std::unique_ptr<StreamType>(new LpcmStreamType( |
- sample_format, |
- channels, |
- frames_per_second)); |
+ static std::unique_ptr<StreamType> Create(SampleFormat sample_format, |
+ uint32_t channels, |
+ uint32_t frames_per_second) { |
+ return std::unique_ptr<StreamType>( |
+ new LpcmStreamType(sample_format, channels, frames_per_second)); |
} |
- LpcmStreamType( |
- SampleFormat sample_format, |
- uint32_t channels, |
- uint32_t frames_per_second); |
+ LpcmStreamType(SampleFormat sample_format, |
+ uint32_t channels, |
+ uint32_t frames_per_second); |
~LpcmStreamType() override; |
const LpcmStreamType* lpcm() const override; |
- SampleFormat sample_format() const { |
- return sample_format_; |
- } |
+ SampleFormat sample_format() const { return sample_format_; } |
- uint32_t channels() const { |
- return channels_; |
- } |
+ uint32_t channels() const { return channels_; } |
- uint32_t frames_per_second() const { |
- return frames_per_second_; |
- } |
+ uint32_t frames_per_second() const { return frames_per_second_; } |
- uint32_t sample_size() const { |
- return sample_size_; |
- } |
+ uint32_t sample_size() const { return sample_size_; } |
- uint32_t bytes_per_frame() const { |
- return sample_size_ * channels_; |
- } |
+ uint32_t bytes_per_frame() const { return sample_size_ * channels_; } |
uint64_t min_buffer_size(uint64_t frame_count) const { |
return frame_count * bytes_per_frame(); |
@@ -285,11 +261,10 @@ class LpcmStreamType : public StreamType { |
std::unique_ptr<StreamType> Clone() const override; |
protected: |
- LpcmStreamType( |
- Scheme scheme, |
- SampleFormat sample_format, |
- uint32_t channels, |
- uint32_t frames_per_second); |
+ LpcmStreamType(Scheme scheme, |
+ SampleFormat sample_format, |
+ uint32_t channels, |
+ uint32_t frames_per_second); |
private: |
SampleFormat sample_format_; |
@@ -305,43 +280,33 @@ class LpcmStreamTypeSet : public StreamTypeSet { |
LpcmStreamType::SampleFormat sample_format, |
Range<uint32_t> channels, |
Range<uint32_t> frames_per_second) { |
- return std::unique_ptr<StreamTypeSet>(new LpcmStreamTypeSet( |
- sample_format, |
- channels, |
- frames_per_second)); |
+ return std::unique_ptr<StreamTypeSet>( |
+ new LpcmStreamTypeSet(sample_format, channels, frames_per_second)); |
} |
- LpcmStreamTypeSet( |
- LpcmStreamType::SampleFormat sample_format, |
- Range<uint32_t> channels, |
- Range<uint32_t> frames_per_second); |
+ LpcmStreamTypeSet(LpcmStreamType::SampleFormat sample_format, |
+ Range<uint32_t> channels, |
+ Range<uint32_t> frames_per_second); |
~LpcmStreamTypeSet() override; |
const LpcmStreamTypeSet* lpcm() const override; |
- LpcmStreamType::SampleFormat sample_format() const { |
- return sample_format_; |
- } |
+ LpcmStreamType::SampleFormat sample_format() const { return sample_format_; } |
- Range<uint32_t> channels() const { |
- return channels_; |
- } |
+ Range<uint32_t> channels() const { return channels_; } |
- Range<uint32_t> frames_per_second() const { |
- return frames_per_second_; |
- } |
+ Range<uint32_t> frames_per_second() const { return frames_per_second_; } |
bool contains(const LpcmStreamType& type) const; |
std::unique_ptr<StreamTypeSet> Clone() const override; |
protected: |
- LpcmStreamTypeSet( |
- StreamType::Scheme scheme, |
- LpcmStreamType::SampleFormat sample_format, |
- Range<uint32_t> channels, |
- Range<uint32_t> frames_per_second); |
+ LpcmStreamTypeSet(StreamType::Scheme scheme, |
+ LpcmStreamType::SampleFormat sample_format, |
+ Range<uint32_t> channels, |
+ Range<uint32_t> frames_per_second); |
private: |
LpcmStreamType::SampleFormat sample_format_; |
@@ -352,11 +317,7 @@ class LpcmStreamTypeSet : public StreamTypeSet { |
// Describes the type of a compressed audio stream. |
class CompressedAudioStreamType : public LpcmStreamType { |
public: |
- enum class AudioEncoding { |
- kUnknown, |
- kAny, |
- kVorbis |
- }; |
+ enum class AudioEncoding { kUnknown, kAny, kVorbis }; |
static std::unique_ptr<StreamType> Create( |
AudioEncoding encoding, |
@@ -365,27 +326,21 @@ class CompressedAudioStreamType : public LpcmStreamType { |
uint32_t frames_per_second, |
std::unique_ptr<Bytes> encoding_details) { |
return std::unique_ptr<StreamType>(new CompressedAudioStreamType( |
- encoding, |
- sample_format, |
- channels, |
- frames_per_second, |
+ encoding, sample_format, channels, frames_per_second, |
std::move(encoding_details))); |
} |
- CompressedAudioStreamType( |
- AudioEncoding encoding, |
- SampleFormat sample_format, |
- uint32_t channels, |
- uint32_t frames_per_second, |
- std::unique_ptr<Bytes> encoding_details); |
+ CompressedAudioStreamType(AudioEncoding encoding, |
+ SampleFormat sample_format, |
+ uint32_t channels, |
+ uint32_t frames_per_second, |
+ std::unique_ptr<Bytes> encoding_details); |
~CompressedAudioStreamType() override; |
const CompressedAudioStreamType* compressed_audio() const override; |
- AudioEncoding encoding() const { |
- return encoding_; |
- } |
+ AudioEncoding encoding() const { return encoding_; } |
const std::unique_ptr<Bytes>& encoding_details() const { |
return encoding_details_; |
@@ -407,17 +362,14 @@ class CompressedAudioStreamTypeSet : public LpcmStreamTypeSet { |
Range<uint32_t> channels, |
Range<uint32_t> frames_per_second) { |
return std::unique_ptr<StreamTypeSet>(new CompressedAudioStreamTypeSet( |
- encoding, |
- sample_format, |
- channels, |
- frames_per_second)); |
+ encoding, sample_format, channels, frames_per_second)); |
} |
CompressedAudioStreamTypeSet( |
- CompressedAudioStreamType::AudioEncoding encoding, |
- CompressedAudioStreamType::SampleFormat sample_format, |
- Range<uint32_t> channels, |
- Range<uint32_t> frames_per_second); |
+ CompressedAudioStreamType::AudioEncoding encoding, |
+ CompressedAudioStreamType::SampleFormat sample_format, |
+ Range<uint32_t> channels, |
+ Range<uint32_t> frames_per_second); |
~CompressedAudioStreamTypeSet() override; |
@@ -499,63 +451,39 @@ class VideoStreamType : public StreamType { |
uint32_t coded_height, |
std::unique_ptr<Bytes> encoding_details) { |
return std::unique_ptr<StreamType>(new VideoStreamType( |
- encoding, |
- profile, |
- pixel_format, |
- color_space, |
- width, |
- height, |
- coded_width, |
- coded_height, |
- std::move(encoding_details))); |
+ encoding, profile, pixel_format, color_space, width, height, |
+ coded_width, coded_height, std::move(encoding_details))); |
} |
- VideoStreamType( |
- VideoEncoding encoding, |
- VideoProfile profile, |
- PixelFormat pixel_format, |
- ColorSpace color_space, |
- uint32_t width, |
- uint32_t height, |
- uint32_t coded_width, |
- uint32_t coded_height, |
- std::unique_ptr<Bytes> encoding_details); |
+ VideoStreamType(VideoEncoding encoding, |
+ VideoProfile profile, |
+ PixelFormat pixel_format, |
+ ColorSpace color_space, |
+ uint32_t width, |
+ uint32_t height, |
+ uint32_t coded_width, |
+ uint32_t coded_height, |
+ std::unique_ptr<Bytes> encoding_details); |
~VideoStreamType() override; |
const VideoStreamType* video() const override; |
- VideoEncoding encoding() const { |
- return encoding_; |
- } |
+ VideoEncoding encoding() const { return encoding_; } |
- VideoProfile profile() const { |
- return profile_; |
- } |
+ VideoProfile profile() const { return profile_; } |
- PixelFormat pixel_format() const { |
- return pixel_format_; |
- } |
+ PixelFormat pixel_format() const { return pixel_format_; } |
- ColorSpace color_space() const { |
- return color_space_; |
- } |
+ ColorSpace color_space() const { return color_space_; } |
- uint32_t width() const { |
- return width_; |
- } |
+ uint32_t width() const { return width_; } |
- uint32_t height() const { |
- return height_; |
- } |
+ uint32_t height() const { return height_; } |
- uint32_t coded_width() const { |
- return coded_width_; |
- } |
+ uint32_t coded_width() const { return coded_width_; } |
- uint32_t coded_height() const { |
- return coded_height_; |
- } |
+ uint32_t coded_height() const { return coded_height_; } |
const std::unique_ptr<Bytes>& encoding_details() const { |
return encoding_details_; |
@@ -582,32 +510,23 @@ class VideoStreamTypeSet : public StreamTypeSet { |
VideoStreamType::VideoEncoding encoding, |
Range<uint32_t> width, |
Range<uint32_t> height) { |
- return std::unique_ptr<StreamTypeSet>(new VideoStreamTypeSet( |
- encoding, |
- width, |
- height)); |
+ return std::unique_ptr<StreamTypeSet>( |
+ new VideoStreamTypeSet(encoding, width, height)); |
} |
- VideoStreamTypeSet( |
- VideoStreamType::VideoEncoding encoding, |
- Range<uint32_t> width, |
- Range<uint32_t> height); |
+ VideoStreamTypeSet(VideoStreamType::VideoEncoding encoding, |
+ Range<uint32_t> width, |
+ Range<uint32_t> height); |
~VideoStreamTypeSet() override; |
const VideoStreamTypeSet* video() const override; |
- VideoStreamType::VideoEncoding encoding() const { |
- return encoding_; |
- } |
+ VideoStreamType::VideoEncoding encoding() const { return encoding_; } |
- Range<uint32_t> width() const { |
- return width_; |
- } |
+ Range<uint32_t> width() const { return width_; } |
- Range<uint32_t> height() const { |
- return height_; |
- } |
+ Range<uint32_t> height() const { return height_; } |
std::unique_ptr<StreamTypeSet> Clone() const override; |
@@ -620,4 +539,4 @@ class VideoStreamTypeSet : public StreamTypeSet { |
} // namespace media |
} // namespace mojo |
-#endif // SERVICES_MEDIA_FRAMEWORK_STREAM_TYPE_H_ |
+#endif // SERVICES_MEDIA_FRAMEWORK_STREAM_TYPE_H_ |