Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cpp ForceClose api #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bmf/engine/connector/include/builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ class RealGraph : public std::enable_shared_from_this<RealGraph> {
bool dumpGraph, bool needMerge);

int Run(bool dumpGraph, bool needMerge);
int ForceClose();
Packet Generate(std::string streamName, bool block = true);
int FillPacket(std::string stream_name, Packet packet, bool block = false);
std::shared_ptr<RealStream> InputStream(std::string streamName, std::string notify, std::string alias);
Expand Down Expand Up @@ -637,6 +638,8 @@ class BMF_ENGINE_API Graph {

void Start(std::vector<Stream>& generateStreams, bool dumpGraph = true, bool needMerge = true);

int ForceClose();

std::string Dump();

Node
Expand Down
8 changes: 8 additions & 0 deletions bmf/engine/connector/src/builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ void RealGraph::Start(
Start(dumpGraph, needMerge);
}

int RealGraph::ForceClose() {
return graphInstance_->force_close();
}

bmf::BMFGraph RealGraph::Instantiate(bool dumpGraph, bool needMerge) {
auto graph_config = Dump().dump(4);
if (dumpGraph || (graphOption_.json_value_.count("dump_graph") &&
Expand Down Expand Up @@ -796,6 +800,10 @@ void Graph::Start(std::vector<Stream> &generateStreams, bool dumpGraph,
graph_->Start(generateRealStreams, dumpGraph, needMerge);
}

int Graph::ForceClose() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test for this interface?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, i'll add the test case later.

return graph_->ForceClose();
}

Packet Graph::Generate(std::string streamName, bool block) {
return graph_->Generate(streamName, block);
}
Expand Down