avcodec/agm: Check that there is available input in read_code()