avcodec: unbreak libav hardware acceleration (fixes #18170)