Index: services/media/framework/parts/lpcm_reformatter.h |
diff --git a/services/media/framework/parts/lpcm_reformatter.h b/services/media/framework/parts/lpcm_reformatter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d8a19c06bec67256de4dd6daab392750b3d5b137 |
--- /dev/null |
+++ b/services/media/framework/parts/lpcm_reformatter.h |
@@ -0,0 +1,62 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SERVICES_MEDIA_FRAMEWORK_PARTS_LPCM_REFORMATTER_H_ |
+#define SERVICES_MEDIA_FRAMEWORK_PARTS_LPCM_REFORMATTER_H_ |
+ |
+#include "services/media/framework/allocator.h" |
+#include "services/media/framework/models/lpcm_transform.h" |
+#include "services/media/framework/packet.h" |
+#include "services/media/framework/stream_type.h" |
+ |
+namespace mojo { |
+namespace media { |
+ |
+class LpcmReformatter; |
+ |
+typedef SharedPtr<LpcmReformatter, LpcmTransform> LpcmReformatterPtr; |
+ |
+// A transform that reformats samples. |
+// TODO(dalesat): Some variations on this could be InPlacePacketTransforms. |
+class LpcmReformatter : public LpcmTransform { |
+ public: |
+ static LpcmReformatterPtr New( |
+ const LpcmStreamType& in_type, |
+ const LpcmStreamTypeSet& out_type) { |
+ return LpcmReformatterPtr(NewImpl(in_type, out_type)); |
johngro
2016/01/26 23:47:29
What is the advantage of having an inline public n
dalesat
2016/01/28 18:49:16
Done.
|
+ } |
+ |
+ private: |
+ static LpcmReformatter* NewImpl( |
+ const LpcmStreamType& in_type, |
+ const LpcmStreamTypeSet& out_type); |
+}; |
+ |
+// LpcmReformatter implementation that accepts samples of type TIn and |
+// produces samples of type TOut. |
+template<typename TIn, typename TOut> |
+class LpcmReformatterImpl : public LpcmReformatter { |
johngro
2016/01/26 23:47:29
You can just hide this class in the .cc file. The
dalesat
2016/01/28 18:49:16
Done.
|
+ public: |
+ LpcmReformatterImpl( |
+ const LpcmStreamType& in_type, |
+ const LpcmStreamTypeSet& out_type); |
+ |
+ ~LpcmReformatterImpl() override; |
+ |
+ // LpcmTransform implementation. |
+ const LpcmStreamType& input_stream_type() const override; |
+ |
+ const LpcmStreamType& output_stream_type() const override; |
+ |
+ void TransformFrames(LpcmFrames* source, LpcmFrames* dest, bool mix) override; |
+ |
+ private: |
+ LpcmStreamType in_type_; |
+ LpcmStreamType out_type_; |
+}; |
+ |
+} // namespace media |
+} // namespace mojo |
+ |
+#endif // SERVICES_MEDIA_FRAMEWORK_PARTS_LPCM_REFORMATTER_H_ |