gstreamer
Loading...
Searching...
No Matches
gstreamerROOTConnection.cc
Go to the documentation of this file.
1// gstreamer
4
5// root
6#include <TFile.h>
7
8// Implementation summary:
9// Manage the lifetime of the ROOT file that owns all trees created by the plugin.
10
11bool GstreamerRootFactory::openConnection() {
12 log->debug(NORMAL, "GstreamerRootFactory::openConnection -> opening file " + filename());
13
14 rootfile = std::make_unique<TFile>(filename().c_str(), "RECREATE");
15
16 if (rootfile->IsZombie()) {
17 log->error(
18 ERR_CANTOPENOUTPUT, "GstreamerRootFactory: could not create file " + filename() + " (file is a zombie)");
19 }
20
21 log->info(1, SFUNCTION_NAME, "GstreamerRootFactory: opened file " + filename());
22
23 return true;
24}
25
26bool GstreamerRootFactory::closeConnectionImpl() {
27 // The public closeConnection() wrapper already flushes buffered events before this method runs.
28
29 // Persist all tree content, then destroy tree wrappers before closing the file so ROOT
30 // object ownership is torn down in a controlled order.
31 rootfile->Write();
32 gRootTrees.clear();
33 rootfile->Close();
34
35 log->info(1, SFUNCTION_NAME, "GstreamerRootFactory: closed file " + filename());
36
37 return true;
38}
std::shared_ptr< GLogger > log
void debug(debug_type type, Args &&... args) const
void info(int level, Args &&... args) const
void error(int exit_code, Args &&... args) const
Shared constants and error codes for the gstreamer module.
#define ERR_CANTOPENOUTPUT
Output medium could not be opened successfully.
ROOT streamer plugin declarations.