Home | History | Annotate | Download | only in media
      1 // Copyright 2013 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 CONTENT_RENDERER_MEDIA_VIDEO_FRAME_PROVIDER_H_
      6 #define CONTENT_RENDERER_MEDIA_VIDEO_FRAME_PROVIDER_H_
      7 
      8 #include "base/callback.h"
      9 #include "base/memory/ref_counted.h"
     10 #include "content/common/content_export.h"
     11 
     12 namespace media {
     13 class VideoFrame;
     14 }
     15 
     16 namespace content {
     17 
     18 // Define an interface to provide a sequence of video frames to clients.
     19 // TODO(wjia): remove ref count.
     20 // TODO(wjia): rename interface so it doesn't clash with cc::VideoFrameProvider.
     21 class CONTENT_EXPORT VideoFrameProvider
     22     : public base::RefCountedThreadSafe<VideoFrameProvider> {
     23  public:
     24   typedef base::Callback<void(const scoped_refptr<media::VideoFrame>&)>
     25       RepaintCB;
     26 
     27   // Start to provide video frames to the caller.
     28   virtual void Start() = 0;
     29 
     30   // Stop to provide video frames to the caller.
     31   virtual void Stop() = 0;
     32 
     33   // Resume to provide video frames to the caller after being paused.
     34   virtual void Play() = 0;
     35 
     36   // Put the provider in pause state and the caller will not receive video
     37   // frames, but the provider might still generate video frames which are
     38   // thrown away.
     39   virtual void Pause() = 0;
     40 
     41  protected:
     42   friend class base::RefCountedThreadSafe<VideoFrameProvider>;
     43 
     44   VideoFrameProvider();
     45   virtual ~VideoFrameProvider();
     46 
     47  private:
     48   DISALLOW_COPY_AND_ASSIGN(VideoFrameProvider);
     49 };
     50 
     51 }  // namespace content
     52 
     53 #endif  // CONTENT_RENDERER_MEDIA_VIDEO_FRAME_PROVIDER_H_
     54