| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_RENDERER_PEPPER_VIDEO_ENCODER_SHIM_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_VIDEO_ENCODER_SHIM_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_VIDEO_ENCODER_SHIM_H_ | 6 #define CONTENT_RENDERER_PEPPER_VIDEO_ENCODER_SHIM_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <vector> | 11 #include <vector> |
| 9 | 12 |
| 13 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 12 #include "media/video/video_encode_accelerator.h" | 16 #include "media/video/video_encode_accelerator.h" |
| 13 | 17 |
| 14 namespace base { | 18 namespace base { |
| 15 class SingleThreadTaskRunner; | 19 class SingleThreadTaskRunner; |
| 16 } | 20 } |
| 17 | 21 |
| 18 namespace gfx { | 22 namespace gfx { |
| 19 class Size; | 23 class Size; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 31 public: | 35 public: |
| 32 explicit VideoEncoderShim(PepperVideoEncoderHost* host); | 36 explicit VideoEncoderShim(PepperVideoEncoderHost* host); |
| 33 ~VideoEncoderShim() override; | 37 ~VideoEncoderShim() override; |
| 34 | 38 |
| 35 // media::VideoEncodeAccelerator implementation. | 39 // media::VideoEncodeAccelerator implementation. |
| 36 media::VideoEncodeAccelerator::SupportedProfiles GetSupportedProfiles() | 40 media::VideoEncodeAccelerator::SupportedProfiles GetSupportedProfiles() |
| 37 override; | 41 override; |
| 38 bool Initialize(media::VideoPixelFormat input_format, | 42 bool Initialize(media::VideoPixelFormat input_format, |
| 39 const gfx::Size& input_visible_size, | 43 const gfx::Size& input_visible_size, |
| 40 media::VideoCodecProfile output_profile, | 44 media::VideoCodecProfile output_profile, |
| 41 uint32 initial_bitrate, | 45 uint32_t initial_bitrate, |
| 42 media::VideoEncodeAccelerator::Client* client) override; | 46 media::VideoEncodeAccelerator::Client* client) override; |
| 43 void Encode(const scoped_refptr<media::VideoFrame>& frame, | 47 void Encode(const scoped_refptr<media::VideoFrame>& frame, |
| 44 bool force_keyframe) override; | 48 bool force_keyframe) override; |
| 45 void UseOutputBitstreamBuffer(const media::BitstreamBuffer& buffer) override; | 49 void UseOutputBitstreamBuffer(const media::BitstreamBuffer& buffer) override; |
| 46 void RequestEncodingParametersChange(uint32 bitrate, | 50 void RequestEncodingParametersChange(uint32_t bitrate, |
| 47 uint32 framerate) override; | 51 uint32_t framerate) override; |
| 48 void Destroy() override; | 52 void Destroy() override; |
| 49 | 53 |
| 50 private: | 54 private: |
| 51 class EncoderImpl; | 55 class EncoderImpl; |
| 52 | 56 |
| 53 void OnRequireBitstreamBuffers(unsigned int input_count, | 57 void OnRequireBitstreamBuffers(unsigned int input_count, |
| 54 const gfx::Size& input_coded_size, | 58 const gfx::Size& input_coded_size, |
| 55 size_t output_buffer_size); | 59 size_t output_buffer_size); |
| 56 void OnBitstreamBufferReady(scoped_refptr<media::VideoFrame> frame, | 60 void OnBitstreamBufferReady(scoped_refptr<media::VideoFrame> frame, |
| 57 int32 bitstream_buffer_id, | 61 int32_t bitstream_buffer_id, |
| 58 size_t payload_size, | 62 size_t payload_size, |
| 59 bool key_frame); | 63 bool key_frame); |
| 60 void OnNotifyError(media::VideoEncodeAccelerator::Error error); | 64 void OnNotifyError(media::VideoEncodeAccelerator::Error error); |
| 61 | 65 |
| 62 scoped_ptr<EncoderImpl> encoder_impl_; | 66 scoped_ptr<EncoderImpl> encoder_impl_; |
| 63 | 67 |
| 64 PepperVideoEncoderHost* host_; | 68 PepperVideoEncoderHost* host_; |
| 65 | 69 |
| 66 // Task doing the encoding. | 70 // Task doing the encoding. |
| 67 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 71 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
| 68 | 72 |
| 69 base::WeakPtrFactory<VideoEncoderShim> weak_ptr_factory_; | 73 base::WeakPtrFactory<VideoEncoderShim> weak_ptr_factory_; |
| 70 | 74 |
| 71 DISALLOW_COPY_AND_ASSIGN(VideoEncoderShim); | 75 DISALLOW_COPY_AND_ASSIGN(VideoEncoderShim); |
| 72 }; | 76 }; |
| 73 | 77 |
| 74 } // namespace content | 78 } // namespace content |
| 75 | 79 |
| 76 #endif // CONTENT_RENDERER_PEPPER_VIDEO_ENCODER_SHIM_H_ | 80 #endif // CONTENT_RENDERER_PEPPER_VIDEO_ENCODER_SHIM_H_ |
| OLD | NEW |