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 #include "media/cast/sender/video_encoder.h" | 5 #include "media/cast/sender/video_encoder.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "media/cast/sender/external_video_encoder.h" | 8 #include "media/cast/sender/external_video_encoder.h" |
9 #include "media/cast/sender/video_encoder_impl.h" | 9 #include "media/cast/sender/video_encoder_impl.h" |
10 | 10 |
11 #if defined(OS_MACOSX) | 11 #if defined(OS_MACOSX) |
12 #include "media/cast/sender/h264_vt_encoder.h" | 12 #include "media/cast/sender/h264_vt_encoder.h" |
13 #endif | 13 #endif |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 namespace cast { | 16 namespace cast { |
17 | 17 |
18 // static | 18 // static |
19 scoped_ptr<VideoEncoder> VideoEncoder::Create( | 19 std::unique_ptr<VideoEncoder> VideoEncoder::Create( |
20 const scoped_refptr<CastEnvironment>& cast_environment, | 20 const scoped_refptr<CastEnvironment>& cast_environment, |
21 const VideoSenderConfig& video_config, | 21 const VideoSenderConfig& video_config, |
22 const StatusChangeCallback& status_change_cb, | 22 const StatusChangeCallback& status_change_cb, |
23 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, | 23 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, |
24 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb) { | 24 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb) { |
25 // On MacOS or IOS, attempt to use the system VideoToolbox library to | 25 // On MacOS or IOS, attempt to use the system VideoToolbox library to |
26 // perform optimized H.264 encoding. | 26 // perform optimized H.264 encoding. |
27 #if defined(OS_MACOSX) || defined(OS_IOS) | 27 #if defined(OS_MACOSX) || defined(OS_IOS) |
28 if (H264VideoToolboxEncoder::IsSupported(video_config)) { | 28 if (H264VideoToolboxEncoder::IsSupported(video_config)) { |
29 return scoped_ptr<VideoEncoder>(new H264VideoToolboxEncoder( | 29 return std::unique_ptr<VideoEncoder>(new H264VideoToolboxEncoder( |
30 cast_environment, video_config, status_change_cb)); | 30 cast_environment, video_config, status_change_cb)); |
31 } | 31 } |
32 #endif // defined(OS_MACOSX) | 32 #endif // defined(OS_MACOSX) |
33 | 33 |
34 #if !defined(OS_IOS) | 34 #if !defined(OS_IOS) |
35 // If the system provides a hardware-accelerated encoder, use it. | 35 // If the system provides a hardware-accelerated encoder, use it. |
36 if (ExternalVideoEncoder::IsSupported(video_config)) { | 36 if (ExternalVideoEncoder::IsSupported(video_config)) { |
37 return scoped_ptr<VideoEncoder>(new SizeAdaptableExternalVideoEncoder( | 37 return std::unique_ptr<VideoEncoder>(new SizeAdaptableExternalVideoEncoder( |
38 cast_environment, | 38 cast_environment, video_config, status_change_cb, create_vea_cb, |
39 video_config, | |
40 status_change_cb, | |
41 create_vea_cb, | |
42 create_video_encode_memory_cb)); | 39 create_video_encode_memory_cb)); |
43 } | 40 } |
44 | 41 |
45 // Attempt to use the software encoder implementation. | 42 // Attempt to use the software encoder implementation. |
46 if (VideoEncoderImpl::IsSupported(video_config)) { | 43 if (VideoEncoderImpl::IsSupported(video_config)) { |
47 return scoped_ptr<VideoEncoder>(new VideoEncoderImpl( | 44 return std::unique_ptr<VideoEncoder>( |
48 cast_environment, | 45 new VideoEncoderImpl(cast_environment, video_config, status_change_cb)); |
49 video_config, | |
50 status_change_cb)); | |
51 } | 46 } |
52 #endif // !defined(OS_IOS) | 47 #endif // !defined(OS_IOS) |
53 | 48 |
54 // No encoder implementation will suffice. | 49 // No encoder implementation will suffice. |
55 return nullptr; | 50 return nullptr; |
56 } | 51 } |
57 | 52 |
58 scoped_ptr<VideoFrameFactory> VideoEncoder::CreateVideoFrameFactory() { | 53 std::unique_ptr<VideoFrameFactory> VideoEncoder::CreateVideoFrameFactory() { |
59 return nullptr; | 54 return nullptr; |
60 } | 55 } |
61 | 56 |
62 void VideoEncoder::EmitFrames() { | 57 void VideoEncoder::EmitFrames() { |
63 } | 58 } |
64 | 59 |
65 } // namespace cast | 60 } // namespace cast |
66 } // namespace media | 61 } // namespace media |
OLD | NEW |