Index: media/base/demuxer.h |
diff --git a/media/base/demuxer.h b/media/base/demuxer.h |
index 972d250a094cfdbd84d275718d3b837edaa4c15c..f049f6f49cafa038d33d7ae50c7ed5ad2b0b5381 100644 |
--- a/media/base/demuxer.h |
+++ b/media/base/demuxer.h |
@@ -6,28 +6,45 @@ |
#define MEDIA_BASE_DEMUXER_H_ |
#include "base/memory/ref_counted.h" |
+#include "base/time.h" |
+#include "media/base/data_source.h" |
#include "media/base/demuxer_stream.h" |
#include "media/base/media_export.h" |
- |
-// TODO(acolwell): Remove include once DataSource & Preload are moved |
-// out of "media/base/filters.h" and Stop() is converted to use new callbacks. |
-#include "media/base/filters.h" |
#include "media/base/pipeline_status.h" |
+#include "media/base/preload.h" |
namespace media { |
-class FilterHost; |
+class MEDIA_EXPORT DemuxerHost : public DataSourceHost { |
+ public: |
+ virtual ~DemuxerHost(); |
+ |
+ // Get the duration of the media in microseconds. If the duration has not |
+ // been determined yet, then returns 0. |
+ virtual void SetDuration(base::TimeDelta duration) = 0; |
+ |
+ // Set the approximate amount of playable data buffered so far in micro- |
+ // seconds. |
+ virtual void SetBufferedTime(base::TimeDelta buffered_time) = 0; |
+ |
+ // Sets the byte offset at which the client is requesting the video. |
+ virtual void SetCurrentReadPosition(int64 offset) = 0; |
+ |
+ // Stops execution of the pipeline due to a fatal error. Do not call this |
+ // method with PIPELINE_OK. |
+ virtual void OnDemuxerError(PipelineStatus error) = 0; |
+}; |
class MEDIA_EXPORT Demuxer |
: public base::RefCountedThreadSafe<Demuxer> { |
public: |
+ Demuxer(); |
+ |
// Sets the private member |host_|. This is the first method called by |
- // the FilterHost after a demuxer is created. The host holds a strong |
+ // the DemuxerHost after a demuxer is created. The host holds a strong |
// reference to the demuxer. The reference held by the host is guaranteed |
// to be released before the host object is destroyed by the pipeline. |
- // |
- // TODO(acolwell): Change this to a narrow DemuxerHost interface. |
- virtual void set_host(FilterHost* host); |
+ virtual void set_host(DemuxerHost* host); |
// The pipeline playback rate has been changed. Demuxers may implement this |
// method if they need to respond to this call. |
@@ -69,14 +86,18 @@ class MEDIA_EXPORT Demuxer |
virtual bool IsSeekable() = 0; |
protected: |
- Demuxer(); |
- FilterHost* host() { return host_; } |
+ // Only allow derived objects access to the DemuxerHost. This is |
+ // kept out of the public interface because demuxers need to be |
+ // aware of all calls made to the host object so they can insure |
+ // the state presented to the host is always consistent with its own |
+ // state. |
+ DemuxerHost* host() { return host_; } |
friend class base::RefCountedThreadSafe<Demuxer>; |
virtual ~Demuxer(); |
private: |
- FilterHost* host_; |
+ DemuxerHost* host_; |
DISALLOW_COPY_AND_ASSIGN(Demuxer); |
}; |