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

Side by Side Diff: chromecast/media/cma/backend/alsa/post_processor_factory.cc

Issue 2958393002: Add a simple, safe gain PostProcessor. (Closed)
Patch Set: Unrelated cleanup Created 3 years, 5 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
(Empty)
1 // Copyright 2017 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 "chromecast/media/cma/backend/alsa/post_processor_factory.h"
6
7 #include "base/files/file_path.h"
8 #include "base/memory/ptr_util.h"
9 #include "base/scoped_native_library.h"
10 #include "chromecast/public/media/audio_post_processor_shlib.h"
11
12 namespace chromecast {
13 namespace media {
14
15 namespace {
16
17 const char kSoCreateFunction[] = "AudioPostProcessorShlib_Create";
18
19 } // namespace
20
21 using CreatePostProcessorFunction = AudioPostProcessor* (*)(const std::string&,
22 int);
23
24 PostProcessorFactory::PostProcessorFactory() = default;
25 PostProcessorFactory::~PostProcessorFactory() = default;
26
27 std::unique_ptr<AudioPostProcessor> PostProcessorFactory::CreatePostProcessor(
28 const std::string& library_path,
29 const std::string& config,
30 int channels) {
31 libraries_.push_back(base::MakeUnique<base::ScopedNativeLibrary>(
32 base::FilePath(library_path)));
33 CHECK(libraries_.back()->is_valid())
34 << "Could not open post processing library " << library_path;
35 auto create = reinterpret_cast<CreatePostProcessorFunction>(
36 libraries_.back()->GetFunctionPointer(kSoCreateFunction));
37
38 CHECK(create) << "Could not find " << kSoCreateFunction << "() in "
39 << library_path;
40 return base::WrapUnique(create(config, channels));
41 }
42
43 } // namespace media
44 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698