Remove existing Skia suppressions
[chromium-blink-merge.git] / media / base / video_renderer.h
blob454c6644127e85fc60b9d052dad1ab3210b2159c
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_BASE_VIDEO_RENDERER_H_
6 #define MEDIA_BASE_VIDEO_RENDERER_H_
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h"
11 #include "media/base/buffering_state.h"
12 #include "media/base/decryptor.h"
13 #include "media/base/media_export.h"
14 #include "media/base/pipeline_status.h"
15 #include "media/base/time_source.h"
17 namespace media {
19 class DemuxerStream;
20 class VideoDecoder;
21 class VideoFrame;
23 class MEDIA_EXPORT VideoRenderer {
24 public:
25 // Used to paint VideoFrame.
26 typedef base::Callback<void(const scoped_refptr<VideoFrame>&)> PaintCB;
28 VideoRenderer();
30 // Stops all operations and fires all pending callbacks.
31 virtual ~VideoRenderer();
33 // Initializes a VideoRenderer with |stream|, executing |init_cb| upon
34 // completion. If initialization fails, only |init_cb| (not |error_cb|) will
35 // be called.
37 // |set_decryptor_ready_cb| is fired when a Decryptor is needed, i.e. when the
38 // |stream| is encrypted.
40 // |statistics_cb| is executed periodically with video rendering stats, such
41 // as dropped frames.
43 // |buffering_state_cb| is executed when video rendering has either run out of
44 // data or has enough data to continue playback.
46 // |ended_cb| is executed when video rendering has reached the end of stream.
48 // |error_cb| is executed if an error was encountered after initialization.
50 // |wall_clock_time_cb| is used to convert media timestamps into wallclock
51 // timestamps.
53 // |waiting_for_decryption_key_cb| is executed whenever the key needed to
54 // decrypt the stream is not available.
55 virtual void Initialize(
56 DemuxerStream* stream,
57 const PipelineStatusCB& init_cb,
58 const SetDecryptorReadyCB& set_decryptor_ready_cb,
59 const StatisticsCB& statistics_cb,
60 const BufferingStateCB& buffering_state_cb,
61 const base::Closure& ended_cb,
62 const PipelineStatusCB& error_cb,
63 const TimeSource::WallClockTimeCB& wall_clock_time_cb,
64 const base::Closure& waiting_for_decryption_key_cb) = 0;
66 // Discards any video data and stops reading from |stream|, executing
67 // |callback| when completed.
69 // Clients should expect |buffering_state_cb| to be called with
70 // BUFFERING_HAVE_NOTHING while flushing is in progress.
71 virtual void Flush(const base::Closure& callback) = 0;
73 // Starts playback at |timestamp| by reading from |stream| and decoding and
74 // rendering video.
76 // Only valid to call after a successful Initialize() or Flush().
77 virtual void StartPlayingFrom(base::TimeDelta timestamp) = 0;
79 // Called when time starts or stops moving. Time progresses when a base time
80 // has been set and the playback rate is > 0. If either condition changes,
81 // |time_progressing| will be false.
82 virtual void OnTimeStateChanged(bool time_progressing) = 0;
84 private:
85 DISALLOW_COPY_AND_ASSIGN(VideoRenderer);
88 } // namespace media
90 #endif // MEDIA_BASE_VIDEO_RENDERER_H_