Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / media / cast / sender / video_encoder.cc
blob33c15c48912872a4c5fb9281033c20200c6c4804
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 #include "media/cast/sender/video_encoder.h"
7 #include "media/cast/sender/external_video_encoder.h"
8 #include "media/cast/sender/video_encoder_impl.h"
10 #if defined(OS_MACOSX)
11 #include "media/cast/sender/h264_vt_encoder.h"
12 #endif
14 namespace media {
15 namespace cast {
17 // static
18 scoped_ptr<VideoEncoder> VideoEncoder::Create(
19 const scoped_refptr<CastEnvironment>& cast_environment,
20 const VideoSenderConfig& video_config,
21 const StatusChangeCallback& status_change_cb,
22 const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
23 const CreateVideoEncodeMemoryCallback& create_video_encode_memory_cb) {
24 // On MacOS or IOS, attempt to use the system VideoToolbox library to
25 // perform optimized H.264 encoding.
26 #if defined(OS_MACOSX) || defined(OS_IOS)
27 if (!video_config.use_external_encoder &&
28 H264VideoToolboxEncoder::IsSupported(video_config)) {
29 return scoped_ptr<VideoEncoder>(new H264VideoToolboxEncoder(
30 cast_environment, video_config, status_change_cb));
32 #endif // defined(OS_MACOSX)
34 #if !defined(OS_IOS)
35 // If the system provides a hardware-accelerated encoder, use it.
36 if (ExternalVideoEncoder::IsSupported(video_config)) {
37 return scoped_ptr<VideoEncoder>(new SizeAdaptableExternalVideoEncoder(
38 cast_environment,
39 video_config,
40 status_change_cb,
41 create_vea_cb,
42 create_video_encode_memory_cb));
45 // Attempt to use the software encoder implementation.
46 if (VideoEncoderImpl::IsSupported(video_config)) {
47 return scoped_ptr<VideoEncoder>(new VideoEncoderImpl(
48 cast_environment,
49 video_config,
50 status_change_cb));
52 #endif // !defined(OS_IOS)
54 // No encoder implementation will suffice.
55 return nullptr;
58 scoped_ptr<VideoFrameFactory> VideoEncoder::CreateVideoFrameFactory() {
59 return nullptr;
62 void VideoEncoder::EmitFrames() {
65 } // namespace cast
66 } // namespace media