| 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 MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ | 5 #ifndef MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ |
| 6 #define MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ | 6 #define MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ |
| 7 | 7 |
| 8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
| 9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
| 10 #include "media/base/mac/videotoolbox_glue.h" | 10 #include "media/base/mac/videotoolbox_glue.h" |
| 11 #include "media/cast/sender/video_encoder.h" | 11 #include "media/cast/sender/video_encoder.h" |
| 12 | 12 |
| 13 namespace media { | 13 namespace media { |
| 14 namespace cast { | 14 namespace cast { |
| 15 | 15 |
| 16 // VideoToolbox implementation of the media::cast::VideoEncoder interface. | 16 // VideoToolbox implementation of the media::cast::VideoEncoder interface. |
| 17 // VideoToolbox makes no guarantees that it is thread safe, so this object is | 17 // VideoToolbox makes no guarantees that it is thread safe, so this object is |
| 18 // pinned to the thread on which it is constructed. | 18 // pinned to the thread on which it is constructed. |
| 19 class H264VideoToolboxEncoder : public VideoEncoder { | 19 class H264VideoToolboxEncoder : public VideoEncoder { |
| 20 typedef CoreMediaGlue::CMSampleBufferRef CMSampleBufferRef; | 20 typedef CoreMediaGlue::CMSampleBufferRef CMSampleBufferRef; |
| 21 typedef VideoToolboxGlue::VTCompressionSessionRef VTCompressionSessionRef; | 21 typedef VideoToolboxGlue::VTCompressionSessionRef VTCompressionSessionRef; |
| 22 typedef VideoToolboxGlue::VTEncodeInfoFlags VTEncodeInfoFlags; | 22 typedef VideoToolboxGlue::VTEncodeInfoFlags VTEncodeInfoFlags; |
| 23 | 23 |
| 24 public: | 24 public: |
| 25 H264VideoToolboxEncoder( | 25 H264VideoToolboxEncoder( |
| 26 const scoped_refptr<CastEnvironment>& cast_environment, | 26 const scoped_refptr<CastEnvironment>& cast_environment, |
| 27 const VideoSenderConfig& video_config, | 27 const VideoSenderConfig& video_config, |
| 28 const gfx::Size& frame_size, | 28 const gfx::Size& frame_size, |
| 29 const CastInitializationCallback& initialization_cb); | 29 const StatusChangeCallback& status_change_cb); |
| 30 ~H264VideoToolboxEncoder() override; | 30 ~H264VideoToolboxEncoder() override; |
| 31 | 31 |
| 32 // media::cast::VideoEncoder implementation | 32 // media::cast::VideoEncoder implementation |
| 33 bool CanEncodeVariedFrameSizes() const override; | 33 bool CanEncodeVariedFrameSizes() const override; |
| 34 bool EncodeVideoFrame( | 34 bool EncodeVideoFrame( |
| 35 const scoped_refptr<media::VideoFrame>& video_frame, | 35 const scoped_refptr<media::VideoFrame>& video_frame, |
| 36 const base::TimeTicks& reference_time, | 36 const base::TimeTicks& reference_time, |
| 37 const FrameEncodedCallback& frame_encoded_callback) override; | 37 const FrameEncodedCallback& frame_encoded_callback) override; |
| 38 void SetBitRate(int new_bit_rate) override; | 38 void SetBitRate(int new_bit_rate) override; |
| 39 void GenerateKeyFrame() override; | 39 void GenerateKeyFrame() override; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Force next frame to be a keyframe. | 82 // Force next frame to be a keyframe. |
| 83 bool encode_next_frame_as_keyframe_; | 83 bool encode_next_frame_as_keyframe_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(H264VideoToolboxEncoder); | 85 DISALLOW_COPY_AND_ASSIGN(H264VideoToolboxEncoder); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace cast | 88 } // namespace cast |
| 89 } // namespace media | 89 } // namespace media |
| 90 | 90 |
| 91 #endif // MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ | 91 #endif // MEDIA_CAST_SENDER_H264_VT_ENCODER_H_ |
| OLD | NEW |