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

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: rebase 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
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.
xhwang 2016/05/09 18:13:22 I think the dropped line still has some value. Peo
alokp 2016/05/09 21:31:43 Done.
36 // be called.
37 // 29 //
38 // |cdm_context| can be used to handle encrypted streams. May be null if the 30 // |cdm_context| can be used to handle encrypted streams. May be null if the
39 // stream is not encrypted. 31 // stream is not encrypted.
40 // 32 //
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 33 // |wall_clock_time_cb| is used to convert media timestamps into wallclock
52 // timestamps. 34 // timestamps.
53 // 35 virtual void Initialize(RendererClient* client,
xhwang 2016/05/09 18:13:22 ditto about parameter order
alokp 2016/05/09 21:31:43 Done.
54 // |waiting_for_decryption_key_cb| is executed whenever the key needed to 36 DemuxerStream* stream,
55 // decrypt the stream is not available. 37 CdmContext* cdm_context,
56 virtual void Initialize( 38 const TimeSource::WallClockTimeCB& wall_clock_time_cb,
57 DemuxerStream* stream, 39 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 40
67 // Discards any video data and stops reading from |stream|, executing 41 // Discards any video data and stops reading from |stream|, executing
68 // |callback| when completed. 42 // |callback| when completed.
69 // 43 //
70 // Clients should expect |buffering_state_cb| to be called with 44 // Clients should expect |buffering_state_cb| to be called with
71 // BUFFERING_HAVE_NOTHING while flushing is in progress. 45 // BUFFERING_HAVE_NOTHING while flushing is in progress.
72 virtual void Flush(const base::Closure& callback) = 0; 46 virtual void Flush(const base::Closure& callback) = 0;
73 47
74 // Starts playback at |timestamp| by reading from |stream| and decoding and 48 // Starts playback at |timestamp| by reading from |stream| and decoding and
75 // rendering video. 49 // rendering video.
76 // 50 //
77 // Only valid to call after a successful Initialize() or Flush(). 51 // Only valid to call after a successful Initialize() or Flush().
78 virtual void StartPlayingFrom(base::TimeDelta timestamp) = 0; 52 virtual void StartPlayingFrom(base::TimeDelta timestamp) = 0;
79 53
80 // Called when time starts or stops moving. Time progresses when a base time 54 // 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, 55 // has been set and the playback rate is > 0. If either condition changes,
82 // |time_progressing| will be false. 56 // |time_progressing| will be false.
83 virtual void OnTimeStateChanged(bool time_progressing) = 0; 57 virtual void OnTimeStateChanged(bool time_progressing) = 0;
84 58
85 private: 59 private:
86 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); 60 DISALLOW_COPY_AND_ASSIGN(VideoRenderer);
87 }; 61 };
88 62
89 } // namespace media 63 } // namespace media
90 64
91 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ 65 #endif // MEDIA_BASE_VIDEO_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698