Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chromecast / renderer / media / video_pipeline_proxy.h
blobe30be8cf24865fdffad9dbecf05e1662b3e4fb05
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
3 // found in the LICENSE file.
5 #ifndef CHROMECAST_RENDERER_MEDIA_VIDEO_PIPELINE_PROXY_H_
6 #define CHROMECAST_RENDERER_MEDIA_VIDEO_PIPELINE_PROXY_H_
8 #include <vector>
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread_checker.h"
15 #include "chromecast/media/cma/pipeline/video_pipeline.h"
16 #include "media/base/pipeline_status.h"
18 namespace base {
19 class SingleThreadTaskRunner;
20 class SharedMemory;
23 namespace media {
24 class VideoDecoderConfig;
27 namespace chromecast {
28 namespace media {
29 struct AvPipelineClient;
30 class AvStreamerProxy;
31 class CodedFrameProvider;
32 class VideoPipelineProxyInternal;
33 class MediaChannelProxy;
35 class VideoPipelineProxy : public VideoPipeline {
36 public:
37 VideoPipelineProxy(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
38 scoped_refptr<MediaChannelProxy> media_channel_proxy);
39 ~VideoPipelineProxy() override;
41 void Initialize(const std::vector<::media::VideoDecoderConfig>& configs,
42 scoped_ptr<CodedFrameProvider> frame_provider,
43 const ::media::PipelineStatusCB& status_cb);
44 void StartFeeding();
45 void Flush(const base::Closure& done_cb);
46 void Stop();
48 // VideoPipeline implementation.
49 void SetClient(const VideoPipelineClient& video_client) override;
51 private:
52 base::ThreadChecker thread_checker_;
54 void OnAvPipeCreated(
55 const std::vector<::media::VideoDecoderConfig>& configs,
56 const ::media::PipelineStatusCB& status_cb,
57 scoped_ptr<base::SharedMemory> shared_memory);
58 void OnPipeWrite();
59 void OnPipeRead();
61 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
63 // |proxy_| main goal is to convert function calls to IPC messages.
64 scoped_ptr<VideoPipelineProxyInternal> proxy_;
66 scoped_ptr<AvStreamerProxy> video_streamer_;
68 base::WeakPtr<VideoPipelineProxy> weak_this_;
69 base::WeakPtrFactory<VideoPipelineProxy> weak_factory_;
71 DISALLOW_COPY_AND_ASSIGN(VideoPipelineProxy);
74 } // namespace media
75 } // namespace chromecast
77 #endif // CHROMECAST_RENDERER_MEDIA_VIDEO_PIPELINE_PROXY_H_