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).
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 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).