The construction of the past perfect progressive tense:
The past perfect progressive tense denotes past activity which had been going on for some time before another past activity took place.
Examples
We had been running for one hour before we start to feel tired.
We had been living in Australia for 10 years, before I visited Sydney.
I had been waiting for an hour before the airplane took off.
What had you been doing before they arrived home ?
I hoped that they had not been waiting very long for us to come.