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

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

Issue 9968117: Move Demuxer::set_host() to Initialize(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: fixes Created 8 years, 8 months 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
« no previous file with comments | « no previous file | media/base/demuxer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 virtual void SetBufferedTime(base::TimeDelta buffered_time) = 0; 27 virtual void SetBufferedTime(base::TimeDelta buffered_time) = 0;
28 28
29 // Sets the byte offset at which the client is requesting the video. 29 // Sets the byte offset at which the client is requesting the video.
30 virtual void SetCurrentReadPosition(int64 offset) = 0; 30 virtual void SetCurrentReadPosition(int64 offset) = 0;
31 31
32 // Stops execution of the pipeline due to a fatal error. Do not call this 32 // Stops execution of the pipeline due to a fatal error. Do not call this
33 // method with PIPELINE_OK. 33 // method with PIPELINE_OK.
34 virtual void OnDemuxerError(PipelineStatus error) = 0; 34 virtual void OnDemuxerError(PipelineStatus error) = 0;
35 }; 35 };
36 36
37 class MEDIA_EXPORT Demuxer 37 class MEDIA_EXPORT Demuxer : public base::RefCountedThreadSafe<Demuxer> {
38 : public base::RefCountedThreadSafe<Demuxer> {
39 public: 38 public:
40 Demuxer(); 39 Demuxer();
41 40
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
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.
46 virtual void set_host(DemuxerHost* host);
47
48 // Completes initialization of the demuxer. 41 // Completes initialization of the demuxer.
49 // 42 //
50 // TODO(scherkus): pass in DemuxerHost here instead of using set_host(), 43 // The demuxer does not own |host| as it is guaranteed to outlive the
51 // see http://crbug.com/111585 44 // lifetime of the demuxer. Don't delete it!
52 virtual void Initialize(const PipelineStatusCB& status_cb) = 0; 45 virtual void Initialize(DemuxerHost* host,
46 const PipelineStatusCB& status_cb) = 0;
53 47
54 // The pipeline playback rate has been changed. Demuxers may implement this 48 // The pipeline playback rate has been changed. Demuxers may implement this
55 // method if they need to respond to this call. 49 // method if they need to respond to this call.
56 virtual void SetPlaybackRate(float playback_rate); 50 virtual void SetPlaybackRate(float playback_rate);
57 51
58 // Carry out any actions required to seek to the given time, executing the 52 // Carry out any actions required to seek to the given time, executing the
59 // callback upon completion. 53 // callback upon completion.
60 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& status_cb); 54 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& status_cb);
61 55
62 // The pipeline is being stopped either as a result of an error or because 56 // The pipeline is being stopped either as a result of an error or because
(...skipping 20 matching lines...) Expand all
83 // Returns true if the source is from a local file or stream (such as a 77 // Returns true if the source is from a local file or stream (such as a
84 // webcam stream), false otherwise. 78 // webcam stream), false otherwise.
85 // 79 //
86 // TODO(scherkus): See http://crbug.com/120426 on why we should remove this. 80 // TODO(scherkus): See http://crbug.com/120426 on why we should remove this.
87 virtual bool IsLocalSource() = 0; 81 virtual bool IsLocalSource() = 0;
88 82
89 // Returns true if seeking is possible; false otherwise. 83 // Returns true if seeking is possible; false otherwise.
90 virtual bool IsSeekable() = 0; 84 virtual bool IsSeekable() = 0;
91 85
92 protected: 86 protected:
93 // Only allow derived objects access to the DemuxerHost. This is
94 // kept out of the public interface because demuxers need to be
95 // aware of all calls made to the host object so they can insure
96 // the state presented to the host is always consistent with its own
97 // state.
98 DemuxerHost* host() { return host_; }
99
100 friend class base::RefCountedThreadSafe<Demuxer>; 87 friend class base::RefCountedThreadSafe<Demuxer>;
101 virtual ~Demuxer(); 88 virtual ~Demuxer();
102 89
103 private: 90 private:
104 DemuxerHost* host_;
105
106 DISALLOW_COPY_AND_ASSIGN(Demuxer); 91 DISALLOW_COPY_AND_ASSIGN(Demuxer);
107 }; 92 };
108 93
109 } // namespace media 94 } // namespace media
110 95
111 #endif // MEDIA_BASE_DEMUXER_H_ 96 #endif // MEDIA_BASE_DEMUXER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698