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

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

Issue 870693002: Require Renderer::Initialize() to return a status code via callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 11 matching lines...) Expand all
22 public: 22 public:
23 typedef base::Callback<void(const scoped_refptr<VideoFrame>&)> PaintCB; 23 typedef base::Callback<void(const scoped_refptr<VideoFrame>&)> PaintCB;
24 typedef base::Callback<base::TimeDelta()> TimeDeltaCB; 24 typedef base::Callback<base::TimeDelta()> TimeDeltaCB;
25 25
26 Renderer(); 26 Renderer();
27 27
28 // Stops rendering and fires any pending callbacks. 28 // Stops rendering and fires any pending callbacks.
29 virtual ~Renderer(); 29 virtual ~Renderer();
30 30
31 // Initializes the Renderer with |demuxer_stream_provider|, executing 31 // Initializes the Renderer with |demuxer_stream_provider|, executing
32 // |init_cb| upon completion. If initialization failed, fires |error_cb| 32 // |init_cb| upon completion. If initialization fails, only |init_cb| (not
33 // before |init_cb|. |demuxer_stream_provider| must be valid throughout the 33 // |error_cb|) should be called. |demuxer_stream_provider| must be valid for
34 // lifetime of the Renderer object. |init_cb| must only be run after this 34 // the lifetime of the Renderer object. |init_cb| must only be run after this
35 // method has returned. 35 // method has returned. Firing |init_cb| may result in the immediate
36 // destruction of the caller, so it must be run only prior to returning.
36 // 37 //
37 // Permanent callbacks: 38 // Permanent callbacks:
38 // - |statistics_cb|: Executed periodically with rendering statistics. 39 // - |statistics_cb|: Executed periodically with rendering statistics.
39 // - |buffering_state_cb|: Executed when buffering state is changed. 40 // - |buffering_state_cb|: Executed when buffering state is changed.
40 // - |paint_cb|: Executed when there is a VideoFrame ready to paint. Can be 41 // - |paint_cb|: Executed when there is a VideoFrame ready to paint. Can be
41 // ignored if the Renderer handles the painting by itself. Can 42 // ignored if the Renderer handles the painting by itself. Can
42 // be called from any thread. 43 // be called from any thread.
43 // - |ended_cb|: Executed when rendering has reached the end of stream. 44 // - |ended_cb|: Executed when rendering has reached the end of stream.
44 // - |error_cb|: Executed if any error was encountered during rendering. 45 // - |error_cb|: Executed if any error was encountered after initialization.
xhwang 2015/01/23 00:22:01 Can we also update the comments in AudioRenderer a
DaleCurtis 2015/01/23 20:31:21 Done.
45 virtual void Initialize(DemuxerStreamProvider* demuxer_stream_provider, 46 virtual void Initialize(DemuxerStreamProvider* demuxer_stream_provider,
46 const base::Closure& init_cb, 47 const PipelineStatusCB& init_cb,
47 const StatisticsCB& statistics_cb, 48 const StatisticsCB& statistics_cb,
48 const BufferingStateCB& buffering_state_cb, 49 const BufferingStateCB& buffering_state_cb,
49 const PaintCB& paint_cb, 50 const PaintCB& paint_cb,
50 const base::Closure& ended_cb, 51 const base::Closure& ended_cb,
51 const PipelineStatusCB& error_cb) = 0; 52 const PipelineStatusCB& error_cb) = 0;
52 53
53 // Associates the |cdm_context| with this Renderer for decryption (and 54 // Associates the |cdm_context| with this Renderer for decryption (and
54 // decoding) of media data, then fires |cdm_attached_cb| with the result. 55 // decoding) of media data, then fires |cdm_attached_cb| with the result.
55 virtual void SetCdm(CdmContext* cdm_context, 56 virtual void SetCdm(CdmContext* cdm_context,
56 const CdmAttachedCB& cdm_attached_cb) = 0; 57 const CdmAttachedCB& cdm_attached_cb) = 0;
(...skipping 21 matching lines...) Expand all
78 // Returns whether |this| renders video. 79 // Returns whether |this| renders video.
79 virtual bool HasVideo() = 0; 80 virtual bool HasVideo() = 0;
80 81
81 private: 82 private:
82 DISALLOW_COPY_AND_ASSIGN(Renderer); 83 DISALLOW_COPY_AND_ASSIGN(Renderer);
83 }; 84 };
84 85
85 } // namespace media 86 } // namespace media
86 87
87 #endif // MEDIA_BASE_RENDERER_H_ 88 #endif // MEDIA_BASE_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698