Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: chromecast/media/base/cast_media_default.cc

Issue 2577743002: [chromecast] Deletes libcast_media_1.0_default_core. (Closed)
Patch Set: rebase + simplify libcast_media target Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromecast/media/base/cast_media_android.cc ('k') | chromecast/media/base/cast_media_dummy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <memory>
6
7 #include "base/single_thread_task_runner.h"
8 #include "base/threading/thread_task_runner_handle.h"
9 #include "build/build_config.h"
10 #include "chromecast/base/task_runner_impl.h"
11 #include "chromecast/media/cma/backend/media_pipeline_backend_default.h"
12 #include "chromecast/public/cast_media_shlib.h"
13 #include "chromecast/public/graphics_types.h"
14 #include "chromecast/public/media/media_capabilities_shlib.h"
15 #include "chromecast/public/media/media_pipeline_device_params.h"
16 #include "chromecast/public/media_codec_support_shlib.h"
17 #include "chromecast/public/video_plane.h"
18
19 namespace chromecast {
20 namespace media {
21 namespace {
22
23 class DefaultVideoPlane : public VideoPlane {
24 public:
25 ~DefaultVideoPlane() override {}
26
27 void SetGeometry(const RectF& display_rect,
28 Transform transform) override {}
29 };
30
31 DefaultVideoPlane* g_video_plane = nullptr;
32 base::ThreadTaskRunnerHandle* g_thread_task_runner_handle = nullptr;
33
34 } // namespace
35
36 void CastMediaShlib::Initialize(const std::vector<std::string>& argv) {
37 g_video_plane = new DefaultVideoPlane();
38 }
39
40 void CastMediaShlib::Finalize() {
41 delete g_video_plane;
42 g_video_plane = nullptr;
43 delete g_thread_task_runner_handle;
44 g_thread_task_runner_handle = nullptr;
45 }
46
47 VideoPlane* CastMediaShlib::GetVideoPlane() {
48 return g_video_plane;
49 }
50
51 MediaPipelineBackend* CastMediaShlib::CreateMediaPipelineBackend(
52 const MediaPipelineDeviceParams& params) {
53 // Set up the static reference in base::ThreadTaskRunnerHandle::Get
54 // for the media thread in this shared library. We can extract the
55 // SingleThreadTaskRunner passed in from cast_shell for this.
56 if (!base::ThreadTaskRunnerHandle::IsSet()) {
57 DCHECK(!g_thread_task_runner_handle);
58 const scoped_refptr<base::SingleThreadTaskRunner> task_runner =
59 static_cast<TaskRunnerImpl*>(params.task_runner)->runner();
60 DCHECK(task_runner->BelongsToCurrentThread());
61 g_thread_task_runner_handle = new base::ThreadTaskRunnerHandle(task_runner);
62 }
63
64 return new MediaPipelineBackendDefault();
65 }
66
67 MediaCodecSupportShlib::CodecSupport MediaCodecSupportShlib::IsSupported(
68 const std::string& codec) {
69 #if defined(OS_ANDROID)
70 // TODO(servolk): Find a way to reuse IsCodecSupportedOnAndroid.
71
72 // Theora is not supported
73 if (codec == "theora")
74 return kNotSupported;
75
76 // MPEG-2 variants of AAC are not supported on Android.
77 // MPEG2_AAC_MAIN / MPEG2_AAC_LC / MPEG2_AAC_SSR
78 if (codec == "mp4a.66" || codec == "mp4a.67" || codec == "mp4a.68")
79 return kNotSupported;
80
81 // VP9 is guaranteed supported but is often software-decode only.
82 // TODO(gunsch/servolk): look into querying for hardware decode support.
83 if (codec == "vp9" || codec == "vp9.0")
84 return kNotSupported;
85 #endif
86
87 return kDefault;
88 }
89
90 double CastMediaShlib::GetMediaClockRate() {
91 return 0.0;
92 }
93
94 double CastMediaShlib::MediaClockRatePrecision() {
95 return 0.0;
96 }
97
98 void CastMediaShlib::MediaClockRateRange(double* minimum_rate,
99 double* maximum_rate) {}
100
101 bool CastMediaShlib::SetMediaClockRate(double new_rate) {
102 return false;
103 }
104
105 bool CastMediaShlib::SupportsMediaClockRateChange() {
106 return false;
107 }
108
109 bool MediaCapabilitiesShlib::IsSupportedVideoConfig(VideoCodec codec,
110 VideoProfile profile,
111 int level) {
112 return (codec == kCodecH264 || codec == kCodecVP8);
113 }
114
115 } // namespace media
116 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/media/base/cast_media_android.cc ('k') | chromecast/media/base/cast_media_dummy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698