| // Copyright 2023 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include <lib/async-loop/cpp/loop.h> |
| #include <lib/async-loop/default.h> |
| #include <lib/component/outgoing/cpp/outgoing_directory.h> |
| #include <lib/sys/cpp/component_context.h> |
| #include <lib/syslog/cpp/macros.h> |
| |
| #include "src/media/audio/consumer/consumer_creator.h" |
| |
| int main(int argc, const char** argv) { |
| async::Loop loop(&kAsyncLoopConfigAttachToCurrentThread); |
| async_dispatcher_t* dispatcher = loop.dispatcher(); |
| |
| component::OutgoingDirectory outgoing = component::OutgoingDirectory(dispatcher); |
| |
| zx::result result = outgoing.AddProtocol<fuchsia_media::SessionAudioConsumerFactory>( |
| std::make_unique<media::audio::ConsumerCreator>(dispatcher)); |
| if (result.is_error()) { |
| FX_LOGS(ERROR) << "Failed add protocol: " << result.status_string(); |
| return -1; |
| } |
| |
| result = outgoing.ServeFromStartupInfo(); |
| if (result.is_error()) { |
| FX_LOGS(ERROR) << "Failed to serve outgoing directory: " << result.status_string(); |
| return -1; |
| } |
| |
| loop.Run(); |
| |
| return 0; |
| } |