OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_FRAMEWORK_PARTS_DECODER_H_ | 5 #ifndef SERVICES_MEDIA_FRAMEWORK_PARTS_DECODER_H_ |
6 #define SERVICES_MEDIA_FRAMEWORK_PARTS_DECODER_H_ | 6 #define SERVICES_MEDIA_FRAMEWORK_PARTS_DECODER_H_ |
7 | 7 |
8 #include "services/media/framework/models/transform.h" | 8 #include "services/media/framework/models/transform.h" |
9 #include "services/media/framework/packet.h" | 9 #include "services/media/framework/packet.h" |
10 #include "services/media/framework/payload_allocator.h" | 10 #include "services/media/framework/payload_allocator.h" |
11 #include "services/media/framework/result.h" | 11 #include "services/media/framework/result.h" |
12 #include "services/media/framework/stream_type.h" | 12 #include "services/media/framework/stream_type.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 // Abstract base class for transforms that decode compressed media. | 17 // Abstract base class for transforms that decode compressed media. |
18 class Decoder : public Transform { | 18 class Decoder : public Transform { |
19 public: | 19 public: |
20 // Creates a Decoder object for a given stream type. | 20 // Creates a Decoder object for a given stream type. |
21 static Result Create( | 21 static Result Create( |
22 const StreamType& stream_type, | 22 const StreamType& stream_type, |
23 std::shared_ptr<Decoder>* decoder_out); | 23 std::shared_ptr<Decoder>* decoder_out); |
24 | 24 |
25 ~Decoder() override {} | 25 ~Decoder() override {} |
26 | 26 |
27 // Returns the type of the stream the decoder will produce. | 27 // Returns the type of the stream the decoder will produce. |
28 virtual std::unique_ptr<StreamType> output_stream_type() = 0; | 28 virtual std::unique_ptr<StreamType> output_stream_type() = 0; |
29 | |
30 protected: | |
31 // Initializes the decoder. Called by Decoder::Create. | |
32 virtual Result Init(const StreamType& stream_type) = 0; | |
33 }; | 29 }; |
34 | 30 |
35 } // namespace media | 31 } // namespace media |
36 } // namespace mojo | 32 } // namespace mojo |
37 | 33 |
38 #endif // SERVICES_MEDIA_FRAMEWORK_PARTS_DECODER_H_ | 34 #endif // SERVICES_MEDIA_FRAMEWORK_PARTS_DECODER_H_ |
OLD | NEW |