OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_PARSER_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_PARSER_H_ |
6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_PARSER_H_ | 6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_PARSER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <unordered_set> | |
11 #include <vector> | |
10 | 12 |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 | 14 |
13 namespace base { | 15 namespace base { |
14 class DictionaryValue; | 16 class DictionaryValue; |
15 class ListValue; | 17 class ListValue; |
16 } // namespace base | 18 } // namespace base |
17 | 19 |
18 namespace chromecast { | 20 namespace chromecast { |
19 namespace media { | 21 namespace media { |
20 | 22 |
23 // Helper class to hold information about a stream pipeline. | |
24 struct StreamPipelineDescriptor { | |
25 // The format for pipeline is: | |
26 // [ {"processor": "PATH_TO_SHARED_OBJECT", | |
27 // "config": "CONFIGURATION_STRING"}, | |
28 // {"processor": "PATH_TO_SHARED_OBJECT", | |
29 // "config": "CONFIGURATION_STRING"}, | |
30 // ... ] | |
31 base::ListValue* pipeline; | |
32 std::unordered_set<std::string> stream_types; | |
33 | |
34 StreamPipelineDescriptor( | |
35 base::ListValue* pipeline_in, | |
36 const std::unordered_set<std::string>& stream_types_in); | |
37 ~StreamPipelineDescriptor(); | |
38 StreamPipelineDescriptor(const StreamPipelineDescriptor& other); | |
39 StreamPipelineDescriptor operator=(const StreamPipelineDescriptor& other) = | |
40 delete; | |
41 }; | |
42 | |
21 // Helper class to parse post-processing pipeline descriptor file. | 43 // Helper class to parse post-processing pipeline descriptor file. |
22 class PostProcessingPipelineParser { | 44 class PostProcessingPipelineParser { |
23 public: | 45 public: |
24 PostProcessingPipelineParser(); | 46 PostProcessingPipelineParser(); |
47 | |
48 // Use json string instead of reading from file. For test only. | |
49 explicit PostProcessingPipelineParser(const std::string& json); | |
25 ~PostProcessingPipelineParser(); | 50 ~PostProcessingPipelineParser(); |
26 | 51 |
27 // Reads the pipeline descriptor file and does preliminary parsing. | 52 std::vector<StreamPipelineDescriptor> GetStreamPipelines(); |
28 // Crashes with fatal log if parsing fails. | |
29 void Initialize(); | |
30 | 53 |
31 // Gets the list of processors for a given stream type. | 54 // Gets the list of processors for the mix/linearize stages. |
32 // The format will be: | 55 // Same format as StreamPipelineDescriptor.pipeline |
33 // [ | 56 base::ListValue* GetMixPipeline(); |
34 // {"processor": "PATH_TO_SHARED_OBJECT", | 57 base::ListValue* GetLinearizePipeline(); |
35 // "config": "CONFIGURATION_STRING"}, | 58 |
36 // {"processor": "PATH_TO_SHARED_OBJECT", | 59 static std::string file_path(); |
kmackay
2017/04/28 00:31:42
GetFilePath()
bshaya
2017/04/28 01:37:37
Done.
| |
37 // "config": "CONFIGURATION_STRING"}, | |
38 // ... | |
39 // ] | |
40 base::ListValue* GetPipelineByDeviceId(const std::string& device_id); | |
41 | 60 |
42 private: | 61 private: |
62 base::ListValue* GetPipelineByKey(const std::string& key); | |
63 | |
43 std::unique_ptr<base::DictionaryValue> config_dict_; | 64 std::unique_ptr<base::DictionaryValue> config_dict_; |
44 base::DictionaryValue* pipeline_dict_ = nullptr; | |
45 | 65 |
46 DISALLOW_COPY_AND_ASSIGN(PostProcessingPipelineParser); | 66 DISALLOW_COPY_AND_ASSIGN(PostProcessingPipelineParser); |
47 }; | 67 }; |
48 | 68 |
49 } // namepsace media | 69 } // namepsace media |
50 } // namespace chromecast | 70 } // namespace chromecast |
51 | 71 |
52 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_PARSER_H_ | 72 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_PARSER_H_ |
OLD | NEW |