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

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

Issue 1955843002: Move Renderer permanent callbacks into RendererClient interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 7 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 | « media/base/renderer_client.h ('k') | media/mojo/services/mojo_renderer_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) 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_VIDEO_RENDERER_H_ 5 #ifndef MEDIA_BASE_VIDEO_RENDERER_H_
6 #define MEDIA_BASE_VIDEO_RENDERER_H_ 6 #define MEDIA_BASE_VIDEO_RENDERER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback_forward.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/time/time.h"
12 #include "media/base/buffering_state.h"
13 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
14 #include "media/base/pipeline_status.h" 11 #include "media/base/pipeline_status.h"
15 #include "media/base/time_source.h" 12 #include "media/base/time_source.h"
16 13
17 namespace media { 14 namespace media {
18 15
19 class CdmContext; 16 class CdmContext;
20 class DemuxerStream; 17 class DemuxerStream;
21 class VideoDecoder; 18 class RendererClient;
22 class VideoFrame;
23 19
24 class MEDIA_EXPORT VideoRenderer { 20 class MEDIA_EXPORT VideoRenderer {
25 public: 21 public:
26 // Used to paint VideoFrame.
27 typedef base::Callback<void(const scoped_refptr<VideoFrame>&)> PaintCB;
28
29 VideoRenderer(); 22 VideoRenderer();
30 23
31 // Stops all operations and fires all pending callbacks. 24 // Stops all operations and fires all pending callbacks.
32 virtual ~VideoRenderer(); 25 virtual ~VideoRenderer();
33 26
34 // Initializes a VideoRenderer with |stream|, executing |init_cb| upon 27 // Initializes a VideoRenderer with |stream|, executing |init_cb| upon
35 // completion. If initialization fails, only |init_cb| (not |error_cb|) will 28 // completion. If initialization fails, only |init_cb|
36 // be called. 29 // (not RendererClient::OnError) will be called.
37 // 30 //
38 // |cdm_context| can be used to handle encrypted streams. May be null if the 31 // |cdm_context| can be used to handle encrypted streams. May be null if the
39 // stream is not encrypted. 32 // stream is not encrypted.
40 // 33 //
41 // |statistics_cb| is executed periodically with video rendering stats, such
42 // as dropped frames.
43 //
44 // |buffering_state_cb| is executed when video rendering has either run out of
45 // data or has enough data to continue playback.
46 //
47 // |ended_cb| is executed when video rendering has reached the end of stream.
48 //
49 // |error_cb| is executed if an error was encountered after initialization.
50 //
51 // |wall_clock_time_cb| is used to convert media timestamps into wallclock 34 // |wall_clock_time_cb| is used to convert media timestamps into wallclock
52 // timestamps. 35 // timestamps.
53 // 36 virtual void Initialize(DemuxerStream* stream,
54 // |waiting_for_decryption_key_cb| is executed whenever the key needed to 37 CdmContext* cdm_context,
55 // decrypt the stream is not available. 38 RendererClient* client,
56 virtual void Initialize( 39 const TimeSource::WallClockTimeCB& wall_clock_time_cb,
57 DemuxerStream* stream, 40 const PipelineStatusCB& init_cb) = 0;
58 const PipelineStatusCB& init_cb,
59 CdmContext* cdm_context,
60 const StatisticsCB& statistics_cb,
61 const BufferingStateCB& buffering_state_cb,
62 const base::Closure& ended_cb,
63 const PipelineStatusCB& error_cb,
64 const TimeSource::WallClockTimeCB& wall_clock_time_cb,
65 const base::Closure& waiting_for_decryption_key_cb) = 0;
66 41
67 // Discards any video data and stops reading from |stream|, executing 42 // Discards any video data and stops reading from |stream|, executing
68 // |callback| when completed. 43 // |callback| when completed.
69 // 44 //
70 // Clients should expect |buffering_state_cb| to be called with 45 // Clients should expect |buffering_state_cb| to be called with
71 // BUFFERING_HAVE_NOTHING while flushing is in progress. 46 // BUFFERING_HAVE_NOTHING while flushing is in progress.
72 virtual void Flush(const base::Closure& callback) = 0; 47 virtual void Flush(const base::Closure& callback) = 0;
73 48
74 // Starts playback at |timestamp| by reading from |stream| and decoding and 49 // Starts playback at |timestamp| by reading from |stream| and decoding and
75 // rendering video. 50 // rendering video.
76 // 51 //
77 // Only valid to call after a successful Initialize() or Flush(). 52 // Only valid to call after a successful Initialize() or Flush().
78 virtual void StartPlayingFrom(base::TimeDelta timestamp) = 0; 53 virtual void StartPlayingFrom(base::TimeDelta timestamp) = 0;
79 54
80 // Called when time starts or stops moving. Time progresses when a base time 55 // Called when time starts or stops moving. Time progresses when a base time
81 // has been set and the playback rate is > 0. If either condition changes, 56 // has been set and the playback rate is > 0. If either condition changes,
82 // |time_progressing| will be false. 57 // |time_progressing| will be false.
83 virtual void OnTimeStateChanged(bool time_progressing) = 0; 58 virtual void OnTimeStateChanged(bool time_progressing) = 0;
84 59
85 private: 60 private:
86 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); 61 DISALLOW_COPY_AND_ASSIGN(VideoRenderer);
87 }; 62 };
88 63
89 } // namespace media 64 } // namespace media
90 65
91 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ 66 #endif // MEDIA_BASE_VIDEO_RENDERER_H_
OLDNEW
« no previous file with comments | « media/base/renderer_client.h ('k') | media/mojo/services/mojo_renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698