hwaccel: Deinitialize hardware acceleration early enough

The application will destroy the underlying hardware handles when
get_format() gets called again. Also this ensures the
deinitialization takes place if the get_format callback returns an
error.

Regression from 1c80c9d7ef809180042257200c7b5f6b81d0b0e2.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>