Add an option to set the index of the GPU to be used for HW decoding

Fixes issue 376.