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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "media/base/data_source.h" | 10 #include "media/base/data_source.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 : public base::RefCountedThreadSafe<Demuxer> { | 38 : public base::RefCountedThreadSafe<Demuxer> { |
39 public: | 39 public: |
40 Demuxer(); | 40 Demuxer(); |
41 | 41 |
42 // Sets the private member |host_|. This is the first method called by | 42 // Sets the private member |host_|. This is the first method called by |
43 // the DemuxerHost after a demuxer is created. The host holds a strong | 43 // the DemuxerHost after a demuxer is created. The host holds a strong |
44 // reference to the demuxer. The reference held by the host is guaranteed | 44 // reference to the demuxer. The reference held by the host is guaranteed |
45 // to be released before the host object is destroyed by the pipeline. | 45 // to be released before the host object is destroyed by the pipeline. |
46 virtual void set_host(DemuxerHost* host); | 46 virtual void set_host(DemuxerHost* host); |
47 | 47 |
| 48 // Completes initialization of the demuxer. |
| 49 // |
| 50 // TODO(scherkus): pass in DemuxerHost here instead of using set_host(), |
| 51 // see http://crbug.com/111585 |
| 52 virtual void Initialize(const PipelineStatusCB& status_cb) = 0; |
| 53 |
48 // The pipeline playback rate has been changed. Demuxers may implement this | 54 // The pipeline playback rate has been changed. Demuxers may implement this |
49 // method if they need to respond to this call. | 55 // method if they need to respond to this call. |
50 virtual void SetPlaybackRate(float playback_rate); | 56 virtual void SetPlaybackRate(float playback_rate); |
51 | 57 |
52 // Carry out any actions required to seek to the given time, executing the | 58 // Carry out any actions required to seek to the given time, executing the |
53 // callback upon completion. | 59 // callback upon completion. |
54 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& status_cb); | 60 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& status_cb); |
55 | 61 |
56 // The pipeline is being stopped either as a result of an error or because | 62 // The pipeline is being stopped either as a result of an error or because |
57 // the client called Stop(). | 63 // the client called Stop(). |
(...skipping 11 matching lines...) Expand all Loading... |
69 | 75 |
70 // Returns the starting time for the media file. | 76 // Returns the starting time for the media file. |
71 virtual base::TimeDelta GetStartTime() const = 0; | 77 virtual base::TimeDelta GetStartTime() const = 0; |
72 | 78 |
73 // Returns the content bitrate. May be obtained from container or | 79 // Returns the content bitrate. May be obtained from container or |
74 // approximated. Returns 0 if it is unknown. | 80 // approximated. Returns 0 if it is unknown. |
75 virtual int GetBitrate() = 0; | 81 virtual int GetBitrate() = 0; |
76 | 82 |
77 // Returns true if the source is from a local file or stream (such as a | 83 // Returns true if the source is from a local file or stream (such as a |
78 // webcam stream), false otherwise. | 84 // webcam stream), false otherwise. |
| 85 // |
| 86 // TODO(scherkus): See http://crbug.com/120426 on why we should remove this. |
79 virtual bool IsLocalSource() = 0; | 87 virtual bool IsLocalSource() = 0; |
80 | 88 |
81 // Returns true if seeking is possible; false otherwise. | 89 // Returns true if seeking is possible; false otherwise. |
82 virtual bool IsSeekable() = 0; | 90 virtual bool IsSeekable() = 0; |
83 | 91 |
84 protected: | 92 protected: |
85 // Only allow derived objects access to the DemuxerHost. This is | 93 // Only allow derived objects access to the DemuxerHost. This is |
86 // kept out of the public interface because demuxers need to be | 94 // kept out of the public interface because demuxers need to be |
87 // aware of all calls made to the host object so they can insure | 95 // aware of all calls made to the host object so they can insure |
88 // the state presented to the host is always consistent with its own | 96 // the state presented to the host is always consistent with its own |
89 // state. | 97 // state. |
90 DemuxerHost* host() { return host_; } | 98 DemuxerHost* host() { return host_; } |
91 | 99 |
92 friend class base::RefCountedThreadSafe<Demuxer>; | 100 friend class base::RefCountedThreadSafe<Demuxer>; |
93 virtual ~Demuxer(); | 101 virtual ~Demuxer(); |
94 | 102 |
95 private: | 103 private: |
96 DemuxerHost* host_; | 104 DemuxerHost* host_; |
97 | 105 |
98 DISALLOW_COPY_AND_ASSIGN(Demuxer); | 106 DISALLOW_COPY_AND_ASSIGN(Demuxer); |
99 }; | 107 }; |
100 | 108 |
101 } // namespace media | 109 } // namespace media |
102 | 110 |
103 #endif // MEDIA_BASE_DEMUXER_H_ | 111 #endif // MEDIA_BASE_DEMUXER_H_ |
OLD | NEW |