Need to use simgear::HTTP::FileRequestRef shared pointer, otherwise
HTTPFileRequest will delete it after the transfer.
Also changed callback to a lambda to match reinstated simgear API.
The fgfs executable is the unit within which it makes sense to check
preconditions with assert. We are not in control of aircraft code in the same
way.
This allows debug build of test-suite to check handling of out-of-range view
numbers.
E.g. for --load-tape=http[s]://foo.com/foo/bar/wibble.fgtape, we download in
the background to a file called foo.com_[MD5]_wibble.fgtape, where [MD5] is an
8-character hash of /foo/bar.
We assume any existing file contains valid data and only download any remaining
data (by specifying an http Range header).
Also, when loading/downloading and replaying continuous recordings at startup,
we set the aircraft and airport from the recording.
src/Aircraft/replay.cxx
src/Aircraft/replay.hxx
FGReplay::loadContinuousHeader()
Loads properties from Continuous recording's header, distinguishing
between failure due to incorrect header, or due to a truncated file.
FGReplay::indexContinuousRecording()
Contains Continuous recording indexing code, in a form that can be used
in background while we are downloading.
Added a mutex to protect m_continuous_in_time_to_frameinfo, which can now
be modified in background as Continuous recording is downloaded.
src/Main/fg_init.cxx
src/Main/options.cxx
fgOptLoadTape():
Modified to handle --load-tape=<url>. We start download, and read
the header before returning, so that we can force the FDM to use the
recording's aircraft instead of the user's default. Limit recording
download rate if /sim/replay/download-max-bytes-per-sec is set, by
calling new filerequest->setMaxBytesPerSec().
Recording of extra properties is only supported in Continuous recordings.
Modified Continuous recording format to allow future forwards
compatibility. See docs-mini/README-recordings.md for details. This breaks
compatibility with previously-generated Continuous recordings, but this only
affects next.
To reduce overhead we record all extra property values in the first frame and
then later frames contain only extra property changes. When replaying, if the
user jumps backwards we replay all extra property changes since the start of
the recording. Similarly if the user jumps forwards, we replay any intervening
extra property changes.
Recording extra properties:
This is enabled by:
/sim/replay/record-extra-properties
The extra properties that are recorded are identified by the property
paths in the values of /sim/replay/record-extra-properties-paths/path[]
properties. We record the entire tree for each specified path.
Recording of main window position size:
We have specific support for record and replay of main window position/size.
This is enabled by:
/sim/replay/record-main-window
Recording of main window view:
We have specific support for recording the view type and direction/zoom
settings.
This is enabled by:
/sim/replay/record-main-view
We record the /sim/current-view/ property tree, excluding some subtrees
that continuously vary but are not required for replaying of the view.
When replaying, we allow separate control of what extra property changes are
replayed, with:
/sim/replay/replay-extra-property-changes
/sim/replay/replay-extra-property-removal
/sim/replay/replay-main-window-position
/sim/replay/replay-main-window-size
/sim/replay/replay-main-view
We work around some problems caused by the use of tied properties when
replaying changes to view-number.
Window position issue:
When replaying window position and size changes, things get a little tricky
because osgViewer::GraphicsWindow::setWindowRectangle() takes a position
for the entire window, but osgGA::GUIEventAdapter::RESIZE events contain
the position of the interior of the window; for example the y values will
differ by the height of the window's titlebar. This can cause windows to
move progressively further down each time they are positioned or resized.
There doesn't seem to be a way of finding the size of a window's
furniture directly. So instead this commit adds a new method
osgGA::GUIEventAdapter::setWindowRectangleInteriorWithCorrection() which
wraps osgViewer::GraphicsWindow::setWindowRectangle(). We listen for the
following osgGA::GUIEventAdapter::RESIZE event and calculate corrections
for x and y position that are used for subsequent calls.
docs-mini/README-recordings.md:
Updated to document new Continuous format.
scripts/python/recordreplay.py:
New script to test various aspects of record/replay.
Other:
We now create convenience softlink to most recent continuous recording, using
SGPath::makeLink(). Note that SGPath::makeLink() currently does nothing on
Windows.
Changed format of Continuous recordings to contain a single property tree
in header. This is much simpler than having separate Config and Meta trees.
It was supposed to be in ft/min, but everything except AIAircraft was
using it as ft/sec. Change the name to AIBase::vs_fps and ensure the
same unit is used everywhere.