This looks simple enough to be included in main builds. To me, it looks like a pretty useful feature, so I think it's time to give it a little more testing (otherwise it may end up buried deep in the commit history).
@Mathew Kelly requested a slightly different version - record a few seconds before AND after a trigger signal, then pause the recording. Maybe somebody has an idea how to implement it easily?
there is a merge conflict with mlv_lite (easy to fix)
if you want it in mlv_rec, you are welcome to port the implementation
Yeah, this works perfectly fine, it does what I need it to do that's for sure. And I was able to link it with bolt_rec to make it do what I wanted, but its ruff coding Im sure, so doubt it would be of any use here. Thank you for creating this update alex!
If I do these changes it does what I want with halfshutter press, replace get_halfshutter_pressed() with bolt_rec_recording and !get_halfshutter_pressed() with !bolt_rec_recording and add an external int for bolt_rec_recording; it works with bolt trigger, and will record post frames according to what is set in bolt trigger post frame setting.
This setup lets you press record to start recording, it gets to pre_record state for the number frames you set for.
Then it waits for trigger from halfshutter or bolt trigger if you set it up that way.
Then it records pre, current and post and resets to pre record state awaiting next trigger.
You can press Record key anytime to stop to Idle state.
Very ruff coding, but it works the way I hoped it would.
I'd merge this after mlv_lite, because I see no reason to force users go back to the old raw format to try this feature.
I tested it merged with mlv_lite, which will need a little more work than a simple merge conflict fix. Frame number is wrong in the 'pre' frames. All 'pre' frames had the same number. Will need some code added to go back and fixup the frame number metadata once recording starts (raw format doesn't require this).
Ah, right, I should probably update the frame counters in vidf_hdr as well. I already decrement frame_number for all frames at every iteration.
Been unable to compile for some time: Merge status? Testing needed?
I'd say it's best to merge after mlv_lite. On that branch, I want to benchmark the latest changes and check file integrity when spanning.