This library is designed to simplify ffmpeg for use in media player applications written in pure C. It is thread safe, very fast, and has a pluggable architecture for output renderers for both audio
... [More]
and video streams.
This library does NOT remote control mplayer, or other engines, it is stand alone with libavcodec and libavformat making it very easy to tightly implement a media player into your application.
Usage is very simple:
mp_t *mp;
mp = mp_new();
mp_load(mp, "filename.avi");
if (mp_num_streams(mp, CODEC_TYPE_AUDIO) > 0) mp_setup_stream(mp, 0, PLAYER_AUDIO_ALSA, NULL);
if (mp_num_streams(mp, CODEC_TYPE_VIDEO) > 0) mp_setup_stream(mp, 0, PLAYER_VIDEO_XV , NULL);
mp_open(mp);
mp_play(mp);
mp_wait(mp);
mp_close(mp);
mp_free(mp);Currently four renderers are supported, ALSA, XV, DirectFB and OpenGL via GTK+, though it is not hard to implement your own renderer.
Renderers are very simple to implement, for audio all you have to do is define the functions: new, free, open, close, getdelay, write, pause, resume and call the macro: DEFINE_AUDIO_RENDERER(PLAYER_AUDIO_FOOBAR, new, free, open, close, getdelay, write, pause, resume)
It is very similar for Video.
Example console output
I: Found card: HDA NVidia
I: Opened codec "mp2" for stream 1
I: Using renderer "PLAYER_AUDIO_ALSA" for stream 1
I: Found 24bit TrueColor
I: Opened codec "mpeg2video" for stream 0
I: Using renderer "PLAYER_VIDEO_XV" for stream 0
I: Waiting for streams to be primed
I: Waiting for stream 0 to become ready
I: Aspect Ratio: 1.333333
I: Frame Size: 720x480
I: Display Size: 640x480
I: Telling the renderer to initialize it's buffers
W: Hardware can not pause
I: Opened audio device (rate = 48000, channels = 2)
I: Signal stream 1 primed
I: Signal stream 0 primed
I: Stream 0 is primed
I: Syncing clock to audio stream 1
I: Waiting for stream 1 to become ready
I: Stream 1 is primed
I: All streams primed and ready to go
I: Stream 0 started
I: Stream 1 started
I: Finished demuxing
I: Waiting for the video queue to be emptied
I: Telling the renderer to free it's buffers
I: Demuxer finished
I: Joining stream 0
I: Joining stream 1 [Less]