OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_BASE_DEMUXER_H_ | 5 #ifndef MEDIA_BASE_DEMUXER_H_ |
6 #define MEDIA_BASE_DEMUXER_H_ | 6 #define MEDIA_BASE_DEMUXER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "media/base/data_source.h" | 11 #include "media/base/data_source.h" |
12 #include "media/base/demuxer_stream.h" | 12 #include "media/base/demuxer_stream.h" |
| 13 #include "media/base/demuxer_stream_provider.h" |
13 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
14 #include "media/base/pipeline_status.h" | 15 #include "media/base/pipeline_status.h" |
15 | 16 |
16 namespace media { | 17 namespace media { |
17 | 18 |
18 class TextTrackConfig; | 19 class TextTrackConfig; |
19 | 20 |
20 class MEDIA_EXPORT DemuxerHost { | 21 class MEDIA_EXPORT DemuxerHost { |
21 public: | 22 public: |
22 // Notify the host that time range [start,end] has been buffered. | 23 // Notify the host that time range [start,end] has been buffered. |
(...skipping 12 matching lines...) Expand all Loading... |
35 virtual void AddTextStream(DemuxerStream* text_stream, | 36 virtual void AddTextStream(DemuxerStream* text_stream, |
36 const TextTrackConfig& config) = 0; | 37 const TextTrackConfig& config) = 0; |
37 | 38 |
38 // Remove |text_stream| from the presentation. | 39 // Remove |text_stream| from the presentation. |
39 virtual void RemoveTextStream(DemuxerStream* text_stream) = 0; | 40 virtual void RemoveTextStream(DemuxerStream* text_stream) = 0; |
40 | 41 |
41 protected: | 42 protected: |
42 virtual ~DemuxerHost(); | 43 virtual ~DemuxerHost(); |
43 }; | 44 }; |
44 | 45 |
45 class MEDIA_EXPORT Demuxer { | 46 class MEDIA_EXPORT Demuxer : public DemuxerStreamProvider { |
46 public: | 47 public: |
47 enum Liveness { | |
48 LIVENESS_UNKNOWN, | |
49 LIVENESS_RECORDED, | |
50 LIVENESS_LIVE, | |
51 }; | |
52 | |
53 // A new potentially encrypted stream has been parsed. | 48 // A new potentially encrypted stream has been parsed. |
54 // First parameter - The type of initialization data. | 49 // First parameter - The type of initialization data. |
55 // Second parameter - The initialization data associated with the stream. | 50 // Second parameter - The initialization data associated with the stream. |
56 typedef base::Callback<void(const std::string& type, | 51 typedef base::Callback<void(const std::string& type, |
57 const std::vector<uint8>& init_data)> NeedKeyCB; | 52 const std::vector<uint8>& init_data)> NeedKeyCB; |
58 | 53 |
59 Demuxer(); | 54 Demuxer(); |
60 virtual ~Demuxer(); | 55 virtual ~Demuxer(); |
61 | 56 |
62 // Completes initialization of the demuxer. | 57 // Completes initialization of the demuxer. |
63 // | 58 // |
64 // The demuxer does not own |host| as it is guaranteed to outlive the | 59 // The demuxer does not own |host| as it is guaranteed to outlive the |
65 // lifetime of the demuxer. Don't delete it! | 60 // lifetime of the demuxer. Don't delete it! |
66 virtual void Initialize(DemuxerHost* host, | 61 virtual void Initialize(DemuxerHost* host, |
67 const PipelineStatusCB& status_cb, | 62 const PipelineStatusCB& status_cb, |
68 bool enable_text_tracks) = 0; | 63 bool enable_text_tracks) = 0; |
69 | 64 |
70 // Carry out any actions required to seek to the given time, executing the | 65 // Carry out any actions required to seek to the given time, executing the |
71 // callback upon completion. | 66 // callback upon completion. |
72 virtual void Seek(base::TimeDelta time, | 67 virtual void Seek(base::TimeDelta time, |
73 const PipelineStatusCB& status_cb) = 0; | 68 const PipelineStatusCB& status_cb) = 0; |
74 | 69 |
75 // Stops this demuxer. | 70 // Stops this demuxer. |
76 // | 71 // |
77 // After this call the demuxer may be destroyed. It is illegal to call any | 72 // After this call the demuxer may be destroyed. It is illegal to call any |
78 // method (including Stop()) after a demuxer has stopped. | 73 // method (including Stop()) after a demuxer has stopped. |
79 virtual void Stop() = 0; | 74 virtual void Stop() = 0; |
80 | 75 |
81 // Returns the first stream of the given stream type (which is not allowed | |
82 // to be DemuxerStream::TEXT), or NULL if that type of stream is not present. | |
83 virtual DemuxerStream* GetStream(DemuxerStream::Type type) = 0; | |
84 | |
85 // Returns Time represented by presentation timestamp 0. | 76 // Returns Time represented by presentation timestamp 0. |
86 // If the timstamps are not associated with a Time, then | 77 // If the timstamps are not associated with a Time, then |
87 // a null Time is returned. | 78 // a null Time is returned. |
88 virtual base::Time GetTimelineOffset() const = 0; | 79 virtual base::Time GetTimelineOffset() const = 0; |
89 | 80 |
90 // Returns liveness of the stream, i.e. whether it is recorded or live. | |
91 virtual Liveness GetLiveness() const = 0; | |
92 | |
93 private: | 81 private: |
94 DISALLOW_COPY_AND_ASSIGN(Demuxer); | 82 DISALLOW_COPY_AND_ASSIGN(Demuxer); |
95 }; | 83 }; |
96 | 84 |
97 } // namespace media | 85 } // namespace media |
98 | 86 |
99 #endif // MEDIA_BASE_DEMUXER_H_ | 87 #endif // MEDIA_BASE_DEMUXER_H_ |
OLD | NEW |