| 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 CHROMECAST_MEDIA_CMA_BACKEND_VIDEO_PIPELINE_DEVICE_H_ | 5 #ifndef CHROMECAST_PUBLIC_MEDIA_VIDEO_PIPELINE_DEVICE_H_ |
| 6 #define CHROMECAST_MEDIA_CMA_BACKEND_VIDEO_PIPELINE_DEVICE_H_ | 6 #define CHROMECAST_PUBLIC_MEDIA_VIDEO_PIPELINE_DEVICE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "media_component_device.h" |
| 9 #include "base/macros.h" | |
| 10 #include "chromecast/media/cma/backend/media_component_device.h" | |
| 11 | |
| 12 namespace gfx { | |
| 13 class Size; | |
| 14 } | |
| 15 | 9 |
| 16 namespace chromecast { | 10 namespace chromecast { |
| 11 struct Size; |
| 12 |
| 17 namespace media { | 13 namespace media { |
| 18 class DecoderBufferBase; | |
| 19 struct VideoConfig; | 14 struct VideoConfig; |
| 20 | 15 |
| 21 // VideoPipelineDevice - | 16 // VideoPipelineDevice - |
| 22 // | 17 // |
| 23 // Notes: | 18 // Notes: |
| 24 // - Like a regular MediaComponentDevice, frames are possibly rendered only | 19 // - Like a regular MediaComponentDevice, frames are possibly rendered only |
| 25 // in the kRunning state. | 20 // in the kRunning state. |
| 26 // However, the first frame must be rendered regardless of the clock state: | 21 // However, the first frame must be rendered regardless of the clock state: |
| 27 // - no synchronization needed to display the first frame, | 22 // - no synchronization needed to display the first frame, |
| 28 // - the clock rate has no impact on the presentation of the first frame. | 23 // - the clock rate has no impact on the presentation of the first frame. |
| 29 // | 24 // |
| 30 class VideoPipelineDevice : public MediaComponentDevice { | 25 class VideoPipelineDevice : public MediaComponentDevice { |
| 31 public: | 26 public: |
| 32 struct VideoClient { | 27 // Callback interface for natural size of video changing. |
| 33 VideoClient(); | 28 class VideoClient { |
| 34 ~VideoClient(); | 29 public: |
| 35 | 30 virtual ~VideoClient() {} |
| 36 // Invoked each time the natural size is updated. | 31 virtual void OnNaturalSizeChanged(const Size& size) = 0; |
| 37 base::Callback<void(const gfx::Size& natural_size)> | |
| 38 natural_size_changed_cb; | |
| 39 }; | 32 }; |
| 40 | 33 |
| 41 VideoPipelineDevice(); | 34 ~VideoPipelineDevice() override {} |
| 42 ~VideoPipelineDevice() override; | |
| 43 | 35 |
| 44 // Registers |client| as the video specific event handler. | 36 // Registers |client| as the video specific event handler. |
| 45 virtual void SetVideoClient(const VideoClient& client) = 0; | 37 // Pipeline ensures client object lifetime is longer than VideoPipelineDevice. |
| 38 virtual void SetVideoClient(VideoClient* client) = 0; |
| 46 | 39 |
| 47 // Provide the video configuration. | 40 // Provide the video configuration. |
| 48 // Must be called before switching from |kStateUninitialized| to |kStateIdle|. | 41 // Must be called before switching from |kStateUninitialized| to |kStateIdle|. |
| 49 // Afterwards, this can be invoked any time the configuration changes. | 42 // Afterwards, this can be invoked any time the configuration changes. |
| 50 // Returns true if the configuration is a supported configuration. | 43 // Returns true if the configuration is a supported configuration. |
| 51 virtual bool SetConfig(const VideoConfig& config) = 0; | 44 virtual bool SetConfig(const VideoConfig& config) = 0; |
| 52 | |
| 53 private: | |
| 54 DISALLOW_COPY_AND_ASSIGN(VideoPipelineDevice); | |
| 55 }; | 45 }; |
| 56 | 46 |
| 57 } // namespace media | 47 } // namespace media |
| 58 } // namespace chromecast | 48 } // namespace chromecast |
| 59 | 49 |
| 60 #endif // CHROMECAST_MEDIA_CMA_BACKEND_VIDEO_PIPELINE_DEVICE_H_ | 50 #endif // CHROMECAST_MEDIA_CMA_BACKEND_VIDEO_PIPELINE_DEVICE_H_ |
| OLD | NEW |