movie player control

I have written a openGL program can play yuv file. But I do not know how to control the frame rate. I tried sleep(), and while loop, but in this time, the glutKeyboardFunc() function doesnt work, which means I can not control my program. Does anyone can help me out? Thank you so much!!!
And does glut provide buttons? I want to build a player interface like media player classic. Any open source code movie player using openGL?
Thanks!

And does glut provide buttons?
what does this mean?

i would not use a sleep or something like that. you could measure the fps and display the same image several times and update after a calculated time

I suppose you want to build a gui for your program. Glut is too minimalistic for this. The only thing it provides are popup menus. You could do the gui with GL itself or use a more powerful gui building tool.