// Copyright 2019 The MediaPipe Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef MEDIAPIPE_FRAMEWORK_TOOL_OPTIONS_UTIL_H_ #define MEDIAPIPE_FRAMEWORK_TOOL_OPTIONS_UTIL_H_ #include "mediapipe/framework/calculator.pb.h" #include "mediapipe/framework/input_stream_shard.h" #include "mediapipe/framework/packet.h" #include "mediapipe/framework/packet_set.h" #include "mediapipe/framework/port/any_proto.h" #include "mediapipe/framework/tool/options_map.h" namespace mediapipe { namespace tool { // Combine a base options with an overriding options. template <typename T> inline T MergeOptions(const T& base, const T& options) { … } // Combine a base options message with an optional side packet. The specified // packet can hold either the specified options type T or CalculatorOptions. // Fields are either replaced or merged depending on field merge_fields. template <typename T> inline T RetrieveOptions(const T& base, const Packet& options_packet) { … } // Combine a base options message with an optional side packet from // a PacketSet such as a calculator's input-side-packets. template <typename T> inline T RetrieveOptions(const T& base, const PacketSet& packet_set, const std::string& tag_name = "OPTIONS") { … } // Combine a base options message with an optional input packet from // an InputStreamShardSet such as a calculator's input streams. template <typename T> inline T RetrieveOptions(const T& base, const InputStreamShardSet& stream_set, const std::string& tag_name = "OPTIONS") { … } // Copy literal options from enclosing graphs. absl::Status DefineGraphOptions(const CalculatorGraphConfig::Node& parent_node, CalculatorGraphConfig* config); } // namespace tool } // namespace mediapipe #endif // MEDIAPIPE_FRAMEWORK_TOOL_OPTIONS_UTIL_H_