| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_BASE_VIDEO_RENDERER_SINK_H_ | |
| 6 #define MEDIA_BASE_VIDEO_RENDERER_SINK_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/logging.h" | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/time/time.h" | |
| 12 #include "media/base/media_export.h" | |
| 13 #include "media/base/video_frame.h" | |
| 14 | |
| 15 namespace media { | |
| 16 | |
| 17 // VideoRendererSink is an interface representing the end-point for rendered | |
| 18 // video frames. An implementation is expected to periodically call Render() on | |
| 19 // a callback object. | |
| 20 class MEDIA_EXPORT VideoRendererSink { | |
| 21 public: | |
| 22 class RenderCallback { | |
| 23 public: | |
| 24 // Returns a VideoFrame for rendering which should be displayed within the | |
| 25 // presentation interval [|deadline_min|, |deadline_max|]. Returns NULL if | |
| 26 // no frame or no new frame (since the last Render() call) is available for | |
| 27 // rendering within the requested interval. Intervals are expected to be | |
| 28 // regular, contiguous, and monotonically increasing. Irregular intervals | |
| 29 // may affect the rendering decisions made by the underlying callback. | |
| 30 virtual scoped_refptr<VideoFrame> Render(base::TimeTicks deadline_min, | |
| 31 base::TimeTicks deadline_max) = 0; | |
| 32 | |
| 33 // Called by the sink when a VideoFrame previously returned via Render() was | |
| 34 // not actually rendered. Must be called before the next Render() call. | |
| 35 virtual void OnFrameDropped() = 0; | |
| 36 | |
| 37 virtual ~RenderCallback() {} | |
| 38 }; | |
| 39 | |
| 40 // Starts video rendering. See RenderCallback for more details. Must be | |
| 41 // called to receive Render() callbacks. Callbacks may start immediately, so | |
| 42 // |callback| must be ready to receive callbacks before calling Start(). | |
| 43 virtual void Start(RenderCallback* callback) = 0; | |
| 44 | |
| 45 // Stops video rendering, waits for any outstanding calls to the |callback| | |
| 46 // given to Start() to complete before returning. No new calls to |callback| | |
| 47 // will be issued after this method returns. May be used as a means of power | |
| 48 // conservation by the sink implementation, so clients should call this | |
| 49 // liberally if no new frames are expected. | |
| 50 virtual void Stop() = 0; | |
| 51 | |
| 52 // Instead of using a callback driven rendering path, allow clients to paint | |
| 53 // frames as they see fit without regard for the compositor. | |
| 54 // TODO(dalecurtis): This should be nuked once experiments show the new path | |
| 55 // is amazing and the old path is not! http://crbug.com/439548 | |
| 56 virtual void PaintFrameUsingOldRenderingPath( | |
| 57 const scoped_refptr<VideoFrame>& frame) = 0; | |
| 58 | |
| 59 virtual ~VideoRendererSink() {} | |
| 60 }; | |
| 61 | |
| 62 } // namespace media | |
| 63 | |
| 64 #endif // MEDIA_BASE_VIDEO_RENDERER_SINK_H_ | |
| OLD | NEW |