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

Side by Side Diff: media/mojo/services/mojo_media_application.cc

Issue 840473002: media: Support creation and SetCdm() for mojo based CDM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only; compiles but needs more polish... Created 5 years, 6 months 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
OLDNEW
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 "base/command_line.h"
5 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "media/mojo/interfaces/content_decryption_module_factory.mojom.h"
9 #include "media/mojo/interfaces/media_renderer.mojom.h"
10 #include "media/mojo/services/mojo_cdm_factory_service.h"
11 #include "media/mojo/services/mojo_cdm_service_context.h"
6 #include "media/mojo/services/mojo_renderer_service.h" 12 #include "media/mojo/services/mojo_renderer_service.h"
7 #include "mojo/application/public/cpp/application_connection.h" 13 #include "mojo/application/public/cpp/application_connection.h"
8 #include "mojo/application/public/cpp/application_delegate.h" 14 #include "mojo/application/public/cpp/application_delegate.h"
9 #include "mojo/application/public/cpp/application_impl.h"
10 #include "mojo/application/public/cpp/application_runner.h" 15 #include "mojo/application/public/cpp/application_runner.h"
11 #include "mojo/application/public/cpp/interface_factory_impl.h" 16 #include "mojo/application/public/cpp/interface_factory.h"
12 #include "third_party/mojo/src/mojo/public/c/system/main.h" 17 #include "third_party/mojo/src/mojo/public/c/system/main.h"
13 18
14 namespace media { 19 namespace media {
15 20
16 class MojoMediaApplication 21 class MojoMediaApplication
17 : public mojo::ApplicationDelegate, 22 : public mojo::ApplicationDelegate,
18 public mojo::InterfaceFactory<mojo::MediaRenderer> { 23 public mojo::InterfaceFactory<mojo::MediaRenderer>,
24 public mojo::InterfaceFactory<mojo::ContentDecryptionModuleFactory> {
19 public: 25 public:
20 // mojo::ApplicationDelegate implementation. 26 // mojo::ApplicationDelegate implementation.
21 void Initialize(mojo::ApplicationImpl* app) override { 27 void Initialize(mojo::ApplicationImpl* app) override {
22 logging::LoggingSettings settings; 28 logging::LoggingSettings settings;
23 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 29 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
24 logging::InitLogging(settings); 30 logging::InitLogging(settings);
25 // Display process ID, thread ID and timestamp in logs. 31 // Display process ID, thread ID and timestamp in logs.
26 logging::SetLogItems(true, true, true, false); 32 logging::SetLogItems(true, true, true, false);
27 } 33 }
28 34
29 bool ConfigureIncomingConnection( 35 bool ConfigureIncomingConnection(
30 mojo::ApplicationConnection* connection) override { 36 mojo::ApplicationConnection* connection) final {
31 connection->AddService(this); 37 connection->AddService<mojo::ContentDecryptionModuleFactory>(this);
38 connection->AddService<mojo::MediaRenderer>(this);
32 return true; 39 return true;
33 } 40 }
34 41
42 // mojo::InterfaceFactory<mojo::ContentDecryptionModuleFactory>
43 // implementation.
44 void Create(mojo::ApplicationConnection* connection,
45 mojo::InterfaceRequest<mojo::ContentDecryptionModuleFactory>
46 request) final {
47 new MojoCdmFactoryService(&cdm_service_context_, request.Pass());
48 }
49
35 // mojo::InterfaceFactory<mojo::MediaRenderer> implementation. 50 // mojo::InterfaceFactory<mojo::MediaRenderer> implementation.
36 void Create(mojo::ApplicationConnection* connection, 51 void Create(mojo::ApplicationConnection* connection,
37 mojo::InterfaceRequest<mojo::MediaRenderer> request) override { 52 mojo::InterfaceRequest<mojo::MediaRenderer> request) override {
38 // The created object is owned by the pipe. 53 // The created object is owned by the pipe.
39 new MojoRendererService(request.Pass()); 54 new MojoRendererService(&cdm_service_context_, request.Pass());
40 } 55 }
56
57 private:
58 MojoCdmServiceContext cdm_service_context_;
41 }; 59 };
42 60
43 } // namespace media 61 } // namespace media
44 62
45 MojoResult MojoMain(MojoHandle mojo_handle) { 63 MojoResult MojoMain(MojoHandle mojo_handle) {
46 mojo::ApplicationRunner runner(new media::MojoMediaApplication()); 64 mojo::ApplicationRunner runner(new media::MojoMediaApplication());
47 return runner.Run(mojo_handle); 65 return runner.Run(mojo_handle);
48 } 66 }
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_cdm_service_context.cc ('k') | media/mojo/services/mojo_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698