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

Side by Side Diff: media/base/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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_RENDERER_H_ 5 #ifndef MEDIA_BASE_RENDERER_H_
6 #define MEDIA_BASE_RENDERER_H_ 6 #define MEDIA_BASE_RENDERER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "media/base/buffering_state.h" 12 #include "media/base/buffering_state.h"
13 #include "media/base/cdm_context.h" 13 #include "media/base/cdm_context.h"
14 #include "media/base/media_export.h" 14 #include "media/base/media_export.h"
15 #include "media/base/pipeline_status.h" 15 #include "media/base/pipeline_status.h"
16 16
17 namespace media { 17 namespace media {
18 18
19 class DemuxerStreamProvider; 19 class DemuxerStreamProvider;
20 class RendererClient;
20 class VideoFrame; 21 class VideoFrame;
21 22
22 class MEDIA_EXPORT Renderer { 23 class MEDIA_EXPORT Renderer {
23 public: 24 public:
24 Renderer(); 25 Renderer();
25 26
26 // Stops rendering and fires any pending callbacks. 27 // Stops rendering and fires any pending callbacks.
27 virtual ~Renderer(); 28 virtual ~Renderer();
28 29
29 // Initializes the Renderer with |demuxer_stream_provider|, executing 30 // Initializes the Renderer with |demuxer_stream_provider|, executing
30 // |init_cb| upon completion. If initialization fails, only |init_cb| (not 31 // |init_cb| upon completion. |demuxer_stream_provider| must be valid for
31 // |error_cb|) should be called. |demuxer_stream_provider| must be valid for
32 // the lifetime of the Renderer object. |init_cb| must only be run after this 32 // the lifetime of the Renderer object. |init_cb| must only be run after this
33 // method has returned. Firing |init_cb| may result in the immediate 33 // method has returned. Firing |init_cb| may result in the immediate
34 // destruction of the caller, so it must be run only prior to returning. 34 // destruction of the caller, so it must be run only prior to returning.
35 // 35 virtual void Initialize(RendererClient* client,
36 // Permanent callbacks: 36 DemuxerStreamProvider* demuxer_stream_provider,
37 // - |statistics_cb|: Executed periodically with rendering statistics. 37 const PipelineStatusCB& init_cb) = 0;
xhwang 2016/05/09 18:13:22 Here and on AudioRenderer and VideoRenderer interf
alokp 2016/05/09 21:31:43 Done.
38 // - |buffering_state_cb|: Executed when buffering state is changed.
39 // - |ended_cb|: Executed when rendering has reached the end of stream.
40 // - |error_cb|: Executed if any error was encountered after initialization.
41 // - |waiting_for_decryption_key_cb|: Executed whenever the key needed to
42 // decrypt the stream is not available.
43 virtual void Initialize(
44 DemuxerStreamProvider* demuxer_stream_provider,
45 const PipelineStatusCB& init_cb,
46 const StatisticsCB& statistics_cb,
47 const BufferingStateCB& buffering_state_cb,
48 const base::Closure& ended_cb,
49 const PipelineStatusCB& error_cb,
50 const base::Closure& waiting_for_decryption_key_cb) = 0;
51 38
52 // Associates the |cdm_context| with this Renderer for decryption (and 39 // Associates the |cdm_context| with this Renderer for decryption (and
53 // decoding) of media data, then fires |cdm_attached_cb| with the result. 40 // decoding) of media data, then fires |cdm_attached_cb| with the result.
54 virtual void SetCdm(CdmContext* cdm_context, 41 virtual void SetCdm(CdmContext* cdm_context,
55 const CdmAttachedCB& cdm_attached_cb) = 0; 42 const CdmAttachedCB& cdm_attached_cb) = 0;
56 43
57 // The following functions must be called after Initialize(). 44 // The following functions must be called after Initialize().
58 45
59 // Discards any buffered data, executing |flush_cb| when completed. 46 // Discards any buffered data, executing |flush_cb| when completed.
60 virtual void Flush(const base::Closure& flush_cb) = 0; 47 virtual void Flush(const base::Closure& flush_cb) = 0;
(...skipping 16 matching lines...) Expand all
77 // Returns whether |this| renders video. 64 // Returns whether |this| renders video.
78 virtual bool HasVideo() = 0; 65 virtual bool HasVideo() = 0;
79 66
80 private: 67 private:
81 DISALLOW_COPY_AND_ASSIGN(Renderer); 68 DISALLOW_COPY_AND_ASSIGN(Renderer);
82 }; 69 };
83 70
84 } // namespace media 71 } // namespace media
85 72
86 #endif // MEDIA_BASE_RENDERER_H_ 73 #endif // MEDIA_BASE_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698