OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SERVICES_MEDIA_FRAMEWORK_PARTS_LPCM_REFORMATTER_H_ |
| 6 #define SERVICES_MEDIA_FRAMEWORK_PARTS_LPCM_REFORMATTER_H_ |
| 7 |
| 8 #include "services/media/framework/allocator.h" |
| 9 #include "services/media/framework/models/lpcm_transform.h" |
| 10 #include "services/media/framework/packet.h" |
| 11 #include "services/media/framework/stream_type.h" |
| 12 |
| 13 namespace mojo { |
| 14 namespace media { |
| 15 |
| 16 class LpcmReformatter; |
| 17 |
| 18 typedef SharedPtr<LpcmReformatter, LpcmTransform> LpcmReformatterPtr; |
| 19 |
| 20 // A transform that reformats samples. |
| 21 // TODO(dalesat): Some variations on this could be InPlacePacketTransforms. |
| 22 class LpcmReformatter : public LpcmTransform { |
| 23 public: |
| 24 static LpcmReformatterPtr New( |
| 25 const LpcmStreamType& in_type, |
| 26 const LpcmStreamTypeSet& out_type) { |
| 27 return LpcmReformatterPtr(NewImpl(in_type, out_type)); |
| 28 } |
| 29 |
| 30 private: |
| 31 static LpcmReformatter* NewImpl( |
| 32 const LpcmStreamType& in_type, |
| 33 const LpcmStreamTypeSet& out_type); |
| 34 }; |
| 35 |
| 36 // LpcmReformatter implementation that accepts samples of type TIn and |
| 37 // produces samples of type TOut. |
| 38 template<typename TIn, typename TOut> |
| 39 class LpcmReformatterImpl : public LpcmReformatter { |
| 40 public: |
| 41 LpcmReformatterImpl( |
| 42 const LpcmStreamType& in_type, |
| 43 const LpcmStreamTypeSet& out_type); |
| 44 |
| 45 ~LpcmReformatterImpl() override; |
| 46 |
| 47 // LpcmTransform implementation. |
| 48 const LpcmStreamType& input_stream_type() const override; |
| 49 |
| 50 const LpcmStreamType& output_stream_type() const override; |
| 51 |
| 52 void TransformFrames(LpcmFrames& source, LpcmFrames& dest, bool mix) override; |
| 53 |
| 54 private: |
| 55 LpcmStreamType in_type_; |
| 56 LpcmStreamType out_type_; |
| 57 }; |
| 58 |
| 59 } // namespace media |
| 60 } // namespace mojo |
| 61 |
| 62 #endif // SERVICES_MEDIA_FRAMEWORK_PARTS_LPCM_REFORMATTER_H_ |
OLD | NEW |