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

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

Issue 149215: Big media::Pipeline cleanup. (Closed)
Patch Set: Test Created 11 years, 5 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
« no previous file with comments | « no previous file | media/base/filter_host_impl.h » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008-2009 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 // FilterHost describes an interface for individual filters to access and 5 // FilterHost describes an interface for individual filters to access and
6 // modify global playback information. Every filter is given a filter host 6 // modify global playback information. Every filter is given a filter host
7 // reference as part of initialization. 7 // reference as part of initialization.
8 // 8 //
9 // This interface is intentionally verbose to cover the needs for the different 9 // This interface is intentionally verbose to cover the needs for the different
10 // types of filters (see media/base/filters.h for filter definitionss). Filters 10 // types of filters (see media/base/filters.h for filter definitionss). Filters
11 // typically use parts of the interface that are relevant to their function. 11 // typically use parts of the interface that are relevant to their function.
12 // For example, an audio renderer filter typically calls SetTime as it feeds 12 // For example, an audio renderer filter typically calls SetTime as it feeds
13 // data to the audio hardware. A video renderer filter typically calls GetTime 13 // data to the audio hardware. A video renderer filter typically calls GetTime
14 // to synchronize video with audio. An audio and video decoder would typically 14 // to synchronize video with audio. An audio and video decoder would typically
15 // have no need to call either SetTime or GetTime. 15 // have no need to call either SetTime or GetTime.
16 16
17 #ifndef MEDIA_BASE_FILTER_HOST_H_ 17 #ifndef MEDIA_BASE_FILTER_HOST_H_
18 #define MEDIA_BASE_FILTER_HOST_H_ 18 #define MEDIA_BASE_FILTER_HOST_H_
19 19
20 #include "base/task.h" 20 #include "base/task.h"
21 #include "media/base/pipeline.h" 21 #include "media/base/pipeline.h"
22 22
23 namespace media { 23 namespace media {
24 24
25 class FilterHost { 25 class FilterHost {
26 public: 26 public:
27 // The PipelineStatus class allows read-only access to the pipeline state.
28 // This is the same object that is used by the pipeline client to examine
29 // the state of the running pipeline. The lifetime of the PipelineStatus
30 // interface is the same as the lifetime of the FilterHost interface, so
31 // it is acceptable for filters to use the returned pointer until their
32 // Stop method has been called.
33 virtual const PipelineStatus* GetPipelineStatus() const = 0;
34
35 // Registers a callback to receive global clock update notifications. The
36 // callback will be called repeatedly and filters do not need to re-register
37 // after each invocation of the callback. To remove the callback, filters
38 // may call this method passing NULL for the callback argument.
39 //
40 // Callback arguments:
41 // base::TimeDelta - the new pipeline time, in microseconds.
42 virtual void SetTimeUpdateCallback(Callback1<base::TimeDelta>::Type* cb) = 0;
43
44 // Request that the time callback be called at the specified stream
45 // time. This will set a timer specific to the filter that will be fired
46 // no sooner than the specified time based on the interpolated time. Note
47 // that, becuase the callback will be made with the interpolated time, it is
48 // possible for time to move "backward" slightly when the audio device updates
49 // the pipeline time though the SetTime method.
50 virtual void ScheduleTimeUpdateCallback(base::TimeDelta time) = 0;
51
52 // Filters must call this method to indicate that their initialization is 27 // Filters must call this method to indicate that their initialization is
53 // complete. They may call this from within their Initialize() method or may 28 // complete. They may call this from within their Initialize() method or may
54 // choose call it after processing some data. 29 // choose call it after processing some data.
55 virtual void InitializationComplete() = 0; 30 virtual void InitializationComplete() = 0;
56 31
57 // 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
58 // method with PIPELINE_OK or PIPELINE_STOPPING (used internally by pipeline). 33 // method with PIPELINE_OK or PIPELINE_STOPPING (used internally by pipeline).
59 virtual void Error(PipelineError error) = 0; 34 virtual void Error(PipelineError error) = 0;
60 35
61 // Sets the current time. Any filters that have registered a callback through 36 // Gets the current time in microseconds.
62 // the SetTimeUpdateCallback method will be notified of the change. 37 virtual base::TimeDelta GetTime() const = 0;
38
39 // Updates the current time. Other filters should poll to examine the updated
40 // time.
63 virtual void SetTime(base::TimeDelta time) = 0; 41 virtual void SetTime(base::TimeDelta time) = 0;
64 42
65 // Get the duration of the media in microseconds. If the duration has not 43 // Get the duration of the media in microseconds. If the duration has not
66 // been determined yet, then returns 0. 44 // been determined yet, then returns 0.
67 virtual void SetDuration(base::TimeDelta duration) = 0; 45 virtual void SetDuration(base::TimeDelta duration) = 0;
68 46
69 // Set the approximate amount of playable data buffered so far in micro- 47 // Set the approximate amount of playable data buffered so far in micro-
70 // seconds. 48 // seconds.
71 virtual void SetBufferedTime(base::TimeDelta buffered_time) = 0; 49 virtual void SetBufferedTime(base::TimeDelta buffered_time) = 0;
72 50
73 // Set the total size of the media file. 51 // Set the total size of the media file.
74 virtual void SetTotalBytes(int64 total_bytes) = 0; 52 virtual void SetTotalBytes(int64 total_bytes) = 0;
75 53
76 // Sets the total number of bytes that are buffered on the client and ready to 54 // Sets the total number of bytes that are buffered on the client and ready to
77 // be played. 55 // be played.
78 virtual void SetBufferedBytes(int64 buffered_bytes) = 0; 56 virtual void SetBufferedBytes(int64 buffered_bytes) = 0;
79 57
80 // Sets the size of the video output in pixel units. 58 // Sets the size of the video output in pixel units.
81 virtual void SetVideoSize(size_t width, size_t height) = 0; 59 virtual void SetVideoSize(size_t width, size_t height) = 0;
82 60
83 protected: 61 protected:
84 virtual ~FilterHost() {} 62 virtual ~FilterHost() {}
85 }; 63 };
86 64
87 } // namespace media 65 } // namespace media
88 66
89 #endif // MEDIA_BASE_FILTER_HOST_H_ 67 #endif // MEDIA_BASE_FILTER_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/filter_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698