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_DEMUX_H_ | 5 #ifndef SERVICES_MEDIA_FRAMEWORK_PARTS_DEMUX_H_ |
6 #define SERVICES_MEDIA_FRAMEWORK_PARTS_DEMUX_H_ | 6 #define SERVICES_MEDIA_FRAMEWORK_PARTS_DEMUX_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 // needs to be added. | 28 // needs to be added. |
29 public: | 29 public: |
30 virtual ~DemuxStream() {} | 30 virtual ~DemuxStream() {} |
31 | 31 |
32 virtual size_t index() const = 0; | 32 virtual size_t index() const = 0; |
33 | 33 |
34 virtual std::unique_ptr<StreamType> stream_type() const = 0; | 34 virtual std::unique_ptr<StreamType> stream_type() const = 0; |
35 }; | 35 }; |
36 | 36 |
37 // Creates a Demux object for a given reader. | 37 // Creates a Demux object for a given reader. |
38 static Result Create( | 38 static Result Create(std::shared_ptr<Reader> reader, |
39 std::shared_ptr<Reader> reader, | 39 std::shared_ptr<Demux>* demux_out); |
40 std::shared_ptr<Demux>* demux_out); | |
41 | 40 |
42 ~Demux() override {} | 41 ~Demux() override {} |
43 | 42 |
44 // TODO(dalesat): Don't let the demux talk to the reader. We're doing it this | 43 // TODO(dalesat): Don't let the demux talk to the reader. We're doing it this |
45 // way now because of ffmpeg's synchronous read call. Ideally, the demux | 44 // way now because of ffmpeg's synchronous read call. Ideally, the demux |
46 // would tell its owner how much data it needs from the reader, and the | 45 // would tell its owner how much data it needs from the reader, and the |
47 // owner would later hand over the data and possibly get a packet back. | 46 // owner would later hand over the data and possibly get a packet back. |
48 | 47 |
49 // TODO(dalesat): Make the demux use an allocator. Ffmpeg demuxes don't | 48 // TODO(dalesat): Make the demux use an allocator. Ffmpeg demuxes don't |
50 // support this. | 49 // support this. |
51 | 50 |
52 // Initializes the demux. | 51 // Initializes the demux. |
53 virtual Result Init(std::shared_ptr<Reader> reader) = 0; | 52 virtual Result Init(std::shared_ptr<Reader> reader) = 0; |
54 | 53 |
55 // Gets the current metadata. | 54 // Gets the current metadata. |
56 virtual std::unique_ptr<Metadata> metadata() const = 0; | 55 virtual std::unique_ptr<Metadata> metadata() const = 0; |
57 | 56 |
58 // Gets the stream collection. | 57 // Gets the stream collection. |
59 virtual const std::vector<DemuxStream*>& streams() const = 0; | 58 virtual const std::vector<DemuxStream*>& streams() const = 0; |
60 | 59 |
61 // Seeks to the specified position. | 60 // Seeks to the specified position. |
62 virtual void Seek(int64_t position) = 0; | 61 virtual void Seek(int64_t position) = 0; |
63 }; | 62 }; |
64 | 63 |
65 } // namespace media | 64 } // namespace media |
66 } // namespace mojo | 65 } // namespace mojo |
67 | 66 |
68 #endif // SERVICES_MEDIA_FRAMEWORK_PARTS_DEMUX_H_ | 67 #endif // SERVICES_MEDIA_FRAMEWORK_PARTS_DEMUX_H_ |
OLD | NEW |