The dashcam will record into a, say, 5-minute buffer until the accelerometer registers a high value, at which point it starts writing into a new file (so the buffer becomes a permanent record of the 5 minutes prior to the incident).
That's one way to implement it, one can come up with many others.
Dunno how well this will work if you need to claim that the pedestrian or cyclist just darted in front of you. But then again, maybe you don't want that kind of thing recorded.
Shouldn't be any more illegal than recording something with your cellphone (when not in the car) that you are interested with. I'm not quite certain about the legal code in australia but private recordings should generally be exempt from a lot of things.
That's one way to implement it, one can come up with many others.