OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C++ API referencev12.0

optris::sdk::rec::RecordingOptions

Everything a recording can be asked for at the moment it starts.

A struct rather than more overloads: duration, segment duration and segment size are independent, and three booleans' worth of combinations is not a signature anybody should have to read.

Public attributes

duration

std::chrono::milliseconds duration {0}

Stop by yourself after this long. Zero means run until stopped. The clock starts once the recording is live, after any pre-roll has been flushed.

Ignored on an alarm's RecordingAction, deliberately: Ignored on an alarm's RecordingAction, deliberately A RecordingAction carries its own stop -- RecordingAction::mode and RecordingAction::duration -- and the ActionRunner is the only thing that knows which rule owns the open recorder. A recording that stopped itself on this field would not tell the runner, so the runner would go on believing it owned a recorder that had closed, and a kWhileActive rule's recording would end early with nothing in the action-error channel saying why. The runner therefore zeroes this one field and carries every other through.

max_segment_duration

std::chrono::milliseconds max_segment_duration {0}

Roll over into the next file after this much recorded time. Zero disables duration segmentation.

max_segment_bytes

uint64_t max_segment_bytes = 0

Roll over into the next file before it would pass this size. Zero disables size segmentation.

Any number you like -- this is not tied to a file system. If the destination caps a single file, pass that cap (less whatever you intend to attach afterwards; see the note below). If it does not, pass whatever size is convenient to move around, or leave it at zero for one continuous file.

A ceiling for the finished file, trailer included: A ceiling for the finished file, trailer included A part that has been rolled over is never larger than this. The recorder projects what the part will hold -- the open Matroska Cluster, libavformat's interleaving queue, the frame about to be written and the Cues that the trailer puts down -- and rolls over while all of that still fits, rather than comparing the position it has reached against the limit.

It did the latter until v12, and a part therefore ended past the limit by everything written after the last check: measured, 1.6 MB past a 4 GiB limit on a PI 640i, and 31 % past a 1 MiB limit on 160x120 noise. You no longer need a margin of your own for the recording itself, and no fixed margin would have been enough: the Cues grow with the part's frame count at about 24 B a frame, so they consume 4 MiB on their own at about 172,800 frames.

One margin is still yours, and it is for attachments: One margin is still yours, and it is for attachments Recorder::AttachFile() and SessionRecorder::AttachFiles() rewrite a finished part to add an attachment, and that growth is outside anything the recorder can project. Optris Connect's dashboard is 8,729 B and grew the part it was attached to by 9,159 B. If you intend to attach to a part and the destination caps a file, leave room for it here.

A part can finish somewhat under the limit, because the projection is an upper bound -- about one frame plus a few kilobytes, and more on a stream whose Clusters are large.

all_intra

bool all_intra = false

Make every frame a seek anchor. See StreamConfig::all_intra for what it buys and what it costs.

Here as well as on StreamConfig because a recording started through a camera never builds its own StreamConfig -- the controller sizes that from the sensor -- so without this there was no way for an application holding an Imager to ask for either of these at all. A caller driving rec::Recorder directly sets them on the stream instead.

quantize_counts

uint32_t quantize_counts = 0

Round each temperature sample to a multiple of this many counts. Lossy. Opt-in. See StreamConfig::quantize_counts, which this sets, for the bounded error it introduces, the table of what each step costs, and why a power of two is worth tens of percent.

visual_jpeg_quality

int visual_jpeg_quality = 0

Encode a visual track as MJPEG at this quality rather than losslessly. See StreamConfig::visual_jpeg_quality. Ignored on a thermal track, with a warning: a 16-bit temperature cannot go through an 8-bit codec and still be a temperature.

min_free_bytes

uint64_t min_free_bytes = 0

Refuse to start at all if the destination has less than this many bytes free. Zero -- the default -- does not check.

The same name, the same unit and the same "0 is off" convention as RetentionPolicy::min_free_bytes, deliberately: continuous recording has had a free-space floor since it existed, and a second spelling of one concept is how a mapping drifts into four copies. One concept, one name.

Honoured on an alarm's RecordingAction as well, and that is: Honoured on an alarm's RecordingAction as well, and that is the point A rule's RecordingAction starts the camera's recording on the SDK's own action thread, with no application call in front of it to check anything. So an application that refuses its own starts on a nearly full disk still had an alarm start one behind its back, which its low-water watch then stopped seconds later, and the next activation started another. Both paths funnel through one check, so setting this on RecordingAction::options covers the rule and setting it on a manual StartRecording() covers the call.

The two paths differ only in how the refusal arrives, because they differ in who is listening: a manual start throws InsufficientSpaceException, with the free space and the floor both in the message, and a rule's start reports an ActionError on the action-error channel -- the one place a rule's refusal has a reader.

A floor, with no headroom added: A floor, with no headroom added -- unlike continuous's Create() ContinuousRecorder::Create() refuses below min_free_bytes plus room for one segment, because it writes continuously and prunes against that floor for the life of the recording. This is a plain comparison against free space at the moment of the start, which is what an application's own "refuse to start under N" setting means. Do not add headroom here to make the two look alike: it would refuse starts the caller's own threshold allows, and the caller is the one who picked the number.

It is a floor at the start and nothing else: It is a floor at the start and nothing else Nothing stops a recording that has already begun. A volume that fills up while recording is a different question with a different answer -- see RetentionPolicy::min_free_bytes and DiskFullAction for the continuous case, which has a retention window to trade against and so has something to decide. A plain recording has neither, and a running stop on a timer is a policy the SDK deliberately does not own.

hold_open_across_reconnect

bool hold_open_across_reconnect = false

Hold this recording open across a camera outage, instead of stopping it when the SDK re-opens the camera.

False by default, which is what every recording has always done: a reconnect is a re-open, so the file is finalized before the teardown and RecordingPhase::kStopped arrives carrying RecordingStopReason::kReconnect. An application that wants a second file opens one when it sees ReconnectPhase::kRecovered.

Set it true to keep the recording running. The file stays open, IsRecording() stays true, and the frames from after the re-open go into the same file as the frames from before it -- with a marker of the gap written into the file on the first frame that arrives afterwards, so a reader is told about the outage rather than left to infer it from a jump in the timestamps.

Why the question is spelled "hold open" and not "stop": Why the question is spelled "hold open" and not "stop" So that the default is the zero. optris_sdk_recording_options mirrors this field and that struct's rule -- stated on min_free_bytes beside it -- is that a caller which zeroes the struct gets the behaviour the SDK had before the field existed. Spelled the other way round, stop_on_reconnect, the historic behaviour would have been the non-zero value, so a C caller that zeroed its options would silently have started getting held-open files. One spelling and one polarity on both surfaces was cheaper than an inverted mirror.

Which to choose, stated plainly because neither is free: Which to choose, stated plainly because neither is free Stop is the honest default. An outage has no known length -- the SDK waits for an absent camera indefinitely rather than exhausting its budget -- so a held-open file can be a recording that looks live for hours and contains minutes, and a bounded recording's duration keeps running through an outage it cannot capture, so the requested duration is not honoured either way. A stopped recording is a finished file an application can read, attach to and name.

Hold open is right when one file per shift matters more than each file being contiguous -- a plant run where a reader of the recording would rather have one timeline with a marked hole in it than fourteen files to stitch. The hole is in the file either way; this decides whether the file boundary is in it too.

What it does not change: What it does not change Nothing about the outage itself. Frames do not arrive during one whichever this is set to, the pre-roll ring is not cleared either way, and interval capture is unaffected. It also has no effect on a recording the application stops itself, on a bounded recording reaching its duration, or on an alarm rule's stop -- see RecordingStopReason, which tells those four apart.