Past Perfect Continuous is used to show that something started in the past and continued up until another time in the past.
Here's a sample conversation:
Mandy: Hi Leigh. How are you. I'm sorry that I was late for this appointment. There was a road accident and the flow of traffic was so congested that the bus took longer than it is supposed to be.
Leigh: How long had you been waiting to get on the bus? (past perfect continuous)
Mandy: It took me about an hour to finally get on the bus. It's so exhausting.
Leigh: It's fine now. I had been listening to an audiobook before you got here. I actually love the story. (past perfect continuous)
Remember the format of PAST PERFECT CONTINUOUS:
had been + verb (in ING form); for example: had been waiting; had been listening
Improve your English proficiency by learning more about verb tenses at http://www.slideshare.net/stephlowe91/ielts-training-verb-tenses
The PAST PERFECT is used when we wish to say that some action had been completed before another was commenced. The verb expressing the previous action is put into PAST PERFECT TENSE and the subsequent action is put into SIMPLE PAST.
Previous action (Past perfect) Subsequent action (simple past)
1. The train had left before I arrived.
2. I had finished my work before you came.
3. The rain had stopped when she arrived.