Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: media/base/demuxer.h

Issue 8936014: Removing DataSource from Filter hierarchy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build busters Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "media/base/data_source.h"
9 #include "media/base/demuxer_stream.h" 10 #include "media/base/demuxer_stream.h"
10 #include "media/base/media_export.h" 11 #include "media/base/media_export.h"
11 12
12 // TODO(acolwell): Remove include once DataSource & Preload are moved 13 // TODO(acolwell): Remove include once DataSource & Preload are moved
13 // out of "media/base/filters.h" and Stop() is converted to use new callbacks. 14 // out of "media/base/filters.h" and Stop() is converted to use new callbacks.
14 #include "media/base/filters.h" 15 #include "media/base/filters.h"
15 #include "media/base/pipeline_status.h" 16 #include "media/base/pipeline_status.h"
16 17
17 namespace media { 18 namespace media {
18 19
19 class FilterHost; 20 class DemuxerHost : public DataSourceHost {
21 public:
22 // Get the duration of the media in microseconds. If the duration has not
23 // been determined yet, then returns 0.
24 virtual void SetDuration(base::TimeDelta duration) = 0;
25
26 // Set the approximate amount of playable data buffered so far in micro-
27 // seconds.
28 virtual void SetBufferedTime(base::TimeDelta buffered_time) = 0;
29
30 // Sets the byte offset at which the client is requesting the video.
31 virtual void SetCurrentReadPosition(int64 offset) = 0;
32
33 // Stops execution of the pipeline due to a fatal error. Do not call this
34 // method with PIPELINE_OK.
35 virtual void OnDemuxerError(PipelineStatus error) = 0;
36
37 protected:
38 virtual ~DemuxerHost() {}
Ami GONE FROM CHROMIUM 2011/12/15 18:39:08 Out-of-line please. (even though here the clang pl
acolwell GONE FROM CHROMIUM 2011/12/15 20:57:59 Done and made public since I don't have a good rea
39 };
20 40
21 class MEDIA_EXPORT Demuxer 41 class MEDIA_EXPORT Demuxer
22 : public base::RefCountedThreadSafe<Demuxer> { 42 : public base::RefCountedThreadSafe<Demuxer> {
23 public: 43 public:
24 // Sets the private member |host_|. This is the first method called by 44 // Sets the private member |host_|. This is the first method called by
25 // the FilterHost after a demuxer is created. The host holds a strong 45 // the FilterHost after a demuxer is created. The host holds a strong
26 // reference to the demuxer. The reference held by the host is guaranteed 46 // reference to the demuxer. The reference held by the host is guaranteed
27 // to be released before the host object is destroyed by the pipeline. 47 // to be released before the host object is destroyed by the pipeline.
28 // 48 //
29 // TODO(acolwell): Change this to a narrow DemuxerHost interface. 49 // TODO(acolwell): Change this to a narrow DemuxerHost interface.
30 virtual void set_host(FilterHost* host); 50 virtual void set_host(DemuxerHost* host);
31 51
32 // The pipeline playback rate has been changed. Demuxers may implement this 52 // The pipeline playback rate has been changed. Demuxers may implement this
33 // method if they need to respond to this call. 53 // method if they need to respond to this call.
34 virtual void SetPlaybackRate(float playback_rate); 54 virtual void SetPlaybackRate(float playback_rate);
35 55
36 // Carry out any actions required to seek to the given time, executing the 56 // Carry out any actions required to seek to the given time, executing the
37 // callback upon completion. 57 // callback upon completion.
38 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& callback); 58 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& callback);
39 59
40 // The pipeline is being stopped either as a result of an error or because 60 // The pipeline is being stopped either as a result of an error or because
(...skipping 20 matching lines...) Expand all
61 // approximated. Returns 0 if it is unknown. 81 // approximated. Returns 0 if it is unknown.
62 virtual int GetBitrate() = 0; 82 virtual int GetBitrate() = 0;
63 83
64 // Returns true if the source is from a local file or stream (such as a 84 // Returns true if the source is from a local file or stream (such as a
65 // webcam stream), false otherwise. 85 // webcam stream), false otherwise.
66 virtual bool IsLocalSource() = 0; 86 virtual bool IsLocalSource() = 0;
67 87
68 // Returns true if seeking is possible; false otherwise. 88 // Returns true if seeking is possible; false otherwise.
69 virtual bool IsSeekable() = 0; 89 virtual bool IsSeekable() = 0;
70 90
71 protected: 91 protected:
Ami GONE FROM CHROMIUM 2011/12/15 18:39:08 Ditto q about documenting protected.
acolwell GONE FROM CHROMIUM 2011/12/15 20:57:59 Done.
72 Demuxer(); 92 Demuxer();
73 FilterHost* host() { return host_; } 93 DemuxerHost* host() { return host_; }
74 94
75 friend class base::RefCountedThreadSafe<Demuxer>; 95 friend class base::RefCountedThreadSafe<Demuxer>;
76 virtual ~Demuxer(); 96 virtual ~Demuxer();
77 97
78 private: 98 private:
79 FilterHost* host_; 99 DemuxerHost* host_;
80 100
81 DISALLOW_COPY_AND_ASSIGN(Demuxer); 101 DISALLOW_COPY_AND_ASSIGN(Demuxer);
82 }; 102 };
83 103
84 } // namespace media 104 } // namespace media
85 105
86 #endif // MEDIA_BASE_DEMUXER_H_ 106 #endif // MEDIA_BASE_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698