FFqlay Documentation
FFqlay is a media playback library based on FFmpeg. FFqlay is based on the FFplay which is the media player in FFmpeg project and intends to be used on Win32. FFqlay makes some minor modifications on FFplay to provide a set of API functions. By using FFqlay, you can develop your media player which supports all codecs in FFmpeg easily. A C# sample program is included in FFqlay project.
The API functions in FFqlay are written in C. The functions try to fullfill the needs of media playback. In this section, all functsion are briefly introduced.
int FFQLAY_start(int argc, char **argv, HWND hwndParent, int width, int height);
FFQLAY_start is used to start the playback of a media file. The arguments argc and argv are passed as the command line arguments of the original FFplay. You can specify the options supported by FFplay by passing proper values of the two arguments. In the simplest case, argc could be "2" ,argv[0] is the filename of your executable, and argv[1] is the path of the media file.
If you would like make the video window be the child window of another window, you can pass the window handle as hwndParent. Otherwise, you can pass NULL.
In addition, you can specify the width and height of the video window by passing width and height.
int FFQLAY_get_play_state(void);
After calling FFQLAY_start, a thread is created to exectue the internal
event_loop(). It does not block the execution of the caller thread.
How can the application to determine whether the playback is completed or not?
By using FFQLAY_get_play_state(), the state of playback can be returned.
FFQLAY_get_play_state() may return the following values,
Thus, while FFQLAY_get_play_state() returns FFQLAY_PLAY_STATE_STOPPED, the playback is completed.
int FFQLAY_pause(void);
While FFQLAY_pause is called, the playback is paused.
int FFQLAY_stop(void);
While FFQLAY_stop is called, the playback is stopped.
double FFQLAY_get_duration(void);
FFQLAY_get_duration returns the duration of the media file in seconds.
double FFQLAY_get_position(void);
FFQLAY_get_position returns the current position of the playback in seconds.
int FFQLAY_set_position(double position);
FFQLAY_set_position can be used to seek to any position of media file. The unit of FFQLAY_set_position is second.
int FFQLAY_resize(int width, int height);
FFQLAY_resize can be used to change the width/height of the video window after calling FFQLAY_start.
int FFQLAY_get_volume(void);
FFQLAY_get_volume returns the current volume setting. The valid value of volume is 0-127.
int FFQLAY_set_volume(int volume);
FFQLAY_set_volume sets the current volume setting. The valid value of volume is 0 ~ 127. It does not affect the real volume output of the audio device.