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// thread local
9// Non-Doxygen implementation file: behavior is documented in the header.
10bool GstreamerRootFactory::openConnection() {
11 log->debug(NORMAL, "GstreamerRootFactory::openConnection -> opening file " + filename());
12
13 rootfile = std::make_unique<TFile>(filename().c_str(), "RECREATE");
14
15 if (rootfile->IsZombie()) {
16 log->error(
17 ERR_CANTOPENOUTPUT, "GstreamerRootFactory: could not create file " + filename() + " (file is a zombie)");
18 }
19 else { log->info(0, "GstreamerRootFactory: opened file " + filename()); }
20
21 return true;
22}
23
24bool GstreamerRootFactory::closeConnectionImpl() {
25 // Persist file content and detach trees before closing.
26 rootfile->Write();
27 gRootTrees.clear(); // clear all trees to detach from the file. W/o this we have crash on exit
28 rootfile->Close();
29
30 return true;
31}
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 (file/device not accessible).