Handle nretries in timer code

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Add capture timeout callback

Signed-off-by: Olaf Hering <olaf@aepfle.de>