| OLD | NEW |
| 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/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "media/base/buffering_state.h" | 10 #include "media/base/buffering_state.h" |
| 11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
| 12 #include "media/base/pipeline_status.h" | 12 #include "media/base/pipeline_status.h" |
| 13 | 13 |
| 14 namespace media { | 14 namespace media { |
| 15 | 15 |
| 16 class MediaKeys; | 16 class MediaKeys; |
| 17 class DemuxerStreamProvider; |
| 17 | 18 |
| 18 class MEDIA_EXPORT Renderer { | 19 class MEDIA_EXPORT Renderer { |
| 19 public: | 20 public: |
| 20 typedef base::Callback<base::TimeDelta()> TimeDeltaCB; | 21 typedef base::Callback<base::TimeDelta()> TimeDeltaCB; |
| 21 | 22 |
| 22 Renderer(); | 23 Renderer(); |
| 23 | 24 |
| 24 // Stops rendering and fires any pending callbacks. | 25 // Stops rendering and fires any pending callbacks. |
| 25 virtual ~Renderer(); | 26 virtual ~Renderer(); |
| 26 | 27 |
| 27 // Initializes the Renderer, executing |init_cb| upon completion. | 28 // Initializes the Renderer with |demuxer_stream_provider|, executing |
| 28 // If initialization failed, fires |error_cb| before |init_cb|. | 29 // |init_cb| upon completion. If initialization failed, fires |error_cb| |
| 30 // before |init_cb|. |demuxer_stream_provider| must be valid throughout the |
| 31 // lifetime of the Renderer object. |
| 29 // | 32 // |
| 30 // Permanent callbacks: | 33 // Permanent callbacks: |
| 31 // - |statistics_cb|: Executed periodically with rendering statistics. | 34 // - |statistics_cb|: Executed periodically with rendering statistics. |
| 32 // - |time_cb|: Executed whenever time has advanced through rendering. | 35 // - |time_cb|: Executed whenever time has advanced through rendering. |
| 33 // - |ended_cb|: Executed when rendering has reached the end of stream. | 36 // - |ended_cb|: Executed when rendering has reached the end of stream. |
| 34 // - |error_cb|: Executed if any error was encountered during rendering. | 37 // - |error_cb|: Executed if any error was encountered during rendering. |
| 35 virtual void Initialize(const base::Closure& init_cb, | 38 virtual void Initialize(DemuxerStreamProvider* demuxer_stream_provider, |
| 39 const base::Closure& init_cb, |
| 36 const StatisticsCB& statistics_cb, | 40 const StatisticsCB& statistics_cb, |
| 37 const base::Closure& ended_cb, | 41 const base::Closure& ended_cb, |
| 38 const PipelineStatusCB& error_cb, | 42 const PipelineStatusCB& error_cb, |
| 39 const BufferingStateCB& buffering_state_cb) = 0; | 43 const BufferingStateCB& buffering_state_cb) = 0; |
| 40 | 44 |
| 41 // The following functions must be called after Initialize(). | 45 // The following functions must be called after Initialize(). |
| 42 | 46 |
| 43 // Discards any buffered data, executing |flush_cb| when completed. | 47 // Discards any buffered data, executing |flush_cb| when completed. |
| 44 virtual void Flush(const base::Closure& flush_cb) = 0; | 48 virtual void Flush(const base::Closure& flush_cb) = 0; |
| 45 | 49 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 64 // Associates the |cdm| with this Renderer. | 68 // Associates the |cdm| with this Renderer. |
| 65 virtual void SetCdm(MediaKeys* cdm) = 0; | 69 virtual void SetCdm(MediaKeys* cdm) = 0; |
| 66 | 70 |
| 67 private: | 71 private: |
| 68 DISALLOW_COPY_AND_ASSIGN(Renderer); | 72 DISALLOW_COPY_AND_ASSIGN(Renderer); |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 } // namespace media | 75 } // namespace media |
| 72 | 76 |
| 73 #endif // MEDIA_BASE_RENDERER_H_ | 77 #endif // MEDIA_BASE_RENDERER_H_ |
| OLD | NEW |