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

Side by Side Diff: media/base/filters.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 // Filters are connected in a strongly typed manner, with downstream filters 5 // Filters are connected in a strongly typed manner, with downstream filters
6 // always reading data from upstream filters. Upstream filters have no clue 6 // always reading data from upstream filters. Upstream filters have no clue
7 // who is actually reading from them, and return the results via callbacks. 7 // who is actually reading from them, and return the results via callbacks.
8 // 8 //
9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer 9 // DemuxerStream(Video) <- VideoDecoder <- VideoRenderer
10 // DataSource <- Demuxer < 10 // DataSource <- Demuxer <
(...skipping 28 matching lines...) Expand all
39 namespace media { 39 namespace media {
40 40
41 class Buffer; 41 class Buffer;
42 class Decoder; 42 class Decoder;
43 class DemuxerStream; 43 class DemuxerStream;
44 class Filter; 44 class Filter;
45 class FilterHost; 45 class FilterHost;
46 46
47 struct PipelineStatistics; 47 struct PipelineStatistics;
48 48
49 // Used to specify video preload states. They are "hints" to the browser about
50 // how aggressively the browser should load and buffer data.
51 // Please see the HTML5 spec for the descriptions of these values:
52 // http://www.w3.org/TR/html5/video.html#attr-media-preload
53 //
54 // Enum values must match the values in WebCore::MediaPlayer::Preload and
55 // there will be assertions at compile time if they do not match.
56 enum Preload {
57 NONE,
58 METADATA,
59 AUTO,
60 };
61
62 // Used for completing asynchronous methods. 49 // Used for completing asynchronous methods.
63 typedef base::Callback<void(PipelineStatus)> FilterStatusCB; 50 typedef base::Callback<void(PipelineStatus)> FilterStatusCB;
64 51
65 // These functions copy |*cb|, call Reset() on |*cb|, and then call Run() 52 // These functions copy |*cb|, call Reset() on |*cb|, and then call Run()
66 // on the copy. This is used in the common case where you need to clear 53 // on the copy. This is used in the common case where you need to clear
67 // a callback member variable before running the callback. 54 // a callback member variable before running the callback.
68 MEDIA_EXPORT void ResetAndRunCB(FilterStatusCB* cb, PipelineStatus status); 55 MEDIA_EXPORT void ResetAndRunCB(FilterStatusCB* cb, PipelineStatus status);
69 MEDIA_EXPORT void ResetAndRunCB(base::Closure* cb); 56 MEDIA_EXPORT void ResetAndRunCB(base::Closure* cb);
70 57
71 // Used for updating pipeline statistics. 58 // Used for updating pipeline statistics.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 virtual ~Filter(); 113 virtual ~Filter();
127 114
128 FilterHost* host() const { return host_; } 115 FilterHost* host() const { return host_; }
129 116
130 private: 117 private:
131 FilterHost* host_; 118 FilterHost* host_;
132 119
133 DISALLOW_COPY_AND_ASSIGN(Filter); 120 DISALLOW_COPY_AND_ASSIGN(Filter);
134 }; 121 };
135 122
136 class MEDIA_EXPORT DataSource : public Filter {
Ami GONE FROM CHROMIUM 2011/12/15 18:39:08 This is actually the more notable part of this CL
acolwell GONE FROM CHROMIUM 2011/12/15 20:57:59 Done.
137 public:
138 typedef base::Callback<void(size_t)> ReadCallback;
139 static const size_t kReadError;
140
141 // Reads |size| bytes from |position| into |data|. And when the read is done
142 // or failed, |read_callback| is called with the number of bytes read or
143 // kReadError in case of error.
144 // TODO(hclam): should change |size| to int! It makes the code so messy
145 // with size_t and int all over the place..
146 virtual void Read(int64 position, size_t size,
147 uint8* data,
148 const DataSource::ReadCallback& read_callback) = 0;
149
150 // Returns true and the file size, false if the file size could not be
151 // retrieved.
152 virtual bool GetSize(int64* size_out) = 0;
153
154 // Returns true if we are performing streaming. In this case seeking is
155 // not possible.
156 virtual bool IsStreaming() = 0;
157
158 // Alert the DataSource that the video preload value has been changed.
159 virtual void SetPreload(Preload preload) = 0;
160
161 // Notify the DataSource of the bitrate of the media.
162 // Values of |bitrate| <= 0 are invalid and should be ignored.
163 virtual void SetBitrate(int bitrate) = 0;
164 };
165
166 class MEDIA_EXPORT VideoDecoder : public Filter { 123 class MEDIA_EXPORT VideoDecoder : public Filter {
167 public: 124 public:
168 // Initialize a VideoDecoder with the given DemuxerStream, executing the 125 // Initialize a VideoDecoder with the given DemuxerStream, executing the
169 // callback upon completion. 126 // callback upon completion.
170 // stats_callback is used to update global pipeline statistics. 127 // stats_callback is used to update global pipeline statistics.
171 virtual void Initialize(DemuxerStream* stream, 128 virtual void Initialize(DemuxerStream* stream,
172 const PipelineStatusCB& callback, 129 const PipelineStatusCB& callback,
173 const StatisticsCallback& stats_callback) = 0; 130 const StatisticsCallback& stats_callback) = 0;
174 131
175 // Request a frame to be decoded and returned via the provided callback. 132 // Request a frame to be decoded and returned via the provided callback.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 228
272 // Resumes playback after underflow occurs. 229 // Resumes playback after underflow occurs.
273 // |buffer_more_audio| is set to true if you want to increase the size of the 230 // |buffer_more_audio| is set to true if you want to increase the size of the
274 // decoded audio buffer. 231 // decoded audio buffer.
275 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0; 232 virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0;
276 }; 233 };
277 234
278 } // namespace media 235 } // namespace media
279 236
280 #endif // MEDIA_BASE_FILTERS_H_ 237 #endif // MEDIA_BASE_FILTERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698