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_DEMUX_H_ | |
6 #define SERVICES_MEDIA_FRAMEWORK_PARTS_DEMUX_H_ | |
7 | |
8 #include <memory> | |
9 #include <vector> | |
10 | |
11 #include "services/media/framework/metadata.h" | |
12 #include "services/media/framework/models/multistream_packet_source.h" | |
13 #include "services/media/framework/packet.h" | |
14 #include "services/media/framework/parts/reader.h" | |
15 #include "services/media/framework/result.h" | |
16 #include "services/media/framework/stream_type.h" | |
17 | |
18 namespace mojo { | |
19 namespace media { | |
20 | |
21 class Demux; | |
22 | |
23 typedef SharedPtr<Demux, MultiStreamPacketSource> DemuxPtr; | |
24 | |
25 // Abstract base class for sources that parse input from a reader and | |
26 // produce one or more output streams. | |
27 class Demux : public MultiStreamPacketSource { | |
28 public: | |
29 // Represents a stream produced by the demux. | |
30 class DemuxStream { | |
31 // TODO(dalesat): Replace this class with stream_type_, unless more stuff | |
32 // needs to be added. | |
33 public: | |
34 virtual ~DemuxStream() {} | |
35 | |
36 virtual uint32_t index() const = 0; | |
37 | |
38 virtual StreamTypePtr stream_type() const = 0; | |
39 }; | |
40 | |
41 // Creates a Demux object for a given reader. | |
42 static Result Create(ReaderPtr reader, DemuxPtr* demux_out); | |
43 | |
44 ~Demux() override {} | |
45 | |
46 // TODO(dalesat): Don't let the demux talk to the reader. We're doing it this | |
47 // way now because of ffmpeg's synchronous read call. Ideally, the demux | |
48 // would tell its owner how much data it needs from the reader, and the | |
49 // owner would later hand over the data and possibly get a packet back. | |
50 | |
51 // TODO(dalesat): Implement seek, etc. | |
52 | |
53 // TODO(dalesat): Make the demux use an allocator. Ffmpeg demuxes don't | |
54 // support this. | |
55 | |
56 // Initializes the demux. | |
57 virtual Result Init(ReaderPtr reader) = 0; | |
58 | |
59 // Gets the current metadata. | |
60 virtual MetadataPtr metadata() const = 0; | |
jeffbrown
2016/02/02 05:35:48
same style nits here for accessors
Is this data i
dalesat
2016/02/02 21:46:39
Currently, there's no support for mutability. That
| |
61 | |
62 // Gets the stream collection. | |
63 virtual const std::vector<DemuxStream*>& streams() const = 0; | |
jeffbrown
2016/02/02 05:35:48
Ok, I think you're overusing virtual throughout th
dalesat
2016/02/02 21:46:39
Given that 'parts' such as these are always hosted
| |
64 | |
65 // MultiStreamProducer implementation (deferred to subclasses). | |
66 // bool can_accept_allocator(uint32_t stream_index) const override; | |
67 // void set_allocator(uint32_t stream_index, Allocator* allocator) override; | |
68 | |
69 // MultiStreamPacketSource implementation (deferred to subclasses). | |
70 // uint32_t stream_count() const override; | |
71 // PacketPtr PullPacket(uint32_t* stream_index_out) override; | |
72 }; | |
73 | |
74 } // namespace media | |
75 } // namespace mojo | |
76 | |
77 #endif // SERVICES_MEDIA_FRAMEWORK_PARTS_DEMUX_H_ | |
OLD | NEW |