Skip to content

Instantly share code, notes, and snippets.

@lu-zero
Created June 26, 2013 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lu-zero/5868996 to your computer and use it in GitHub Desktop.
Save lu-zero/5868996 to your computer and use it in GitHub Desktop.
High level api, missing player reconfiguration on the fly. It is _really_ simple and easy to use, Ideally you create a playlist or load a playlist, with the default playlist being NULL. The items abstraction let you put in the playlist items and possibly add offsets within the file (later) the player abstraction let you seek and play within the …
typedef struct MPVPlayer;
MPVPlayer *mpv_alloc();
int mpv_parse(MPVPlayer *m, int argc, char *argv, char *envp);
int mpv_play(MPVPlayer *m);
int mpv_pause(MPVPlayer *m);
int mpv_seek(MPVPlayer *m, pos);
int mpv_next(MPVPlayer *m, int index);
void mpv_free(MPVPlayer *m);
typedef struct MPVPlaylist;
int mpv_playlist_load(MPVPlayer *m, MPVPlaylist *p);
int mpv_playlist_from_url(MPVPlaylist **p, char *url);
int mpv_playlist_store(MPVPlaylist *p);
int mpv_playlist_to_file(MPVPlaylist *p, char *url);
int mpv_get_current_playlist(MPVPlayer *m, MPVPlaylist **p);
void mpv_playlist_free(MPVPlaylist *p);
typedef struct MPVItem;
int mpv_item_load(MPVItem **i, char *url);
int mpv_playlist_add(MPVPlaylist *p, MPVItem *i, int pos);
int mpv_playlist_pop(MPVPlaylist *p, int pos);
int mpv_playlist_iter(MPVPlaylist *p, callback);
int mpv_get_current_item(MPVPlayer *m, MPVItem **i);
void mpv_item_free(MPVItem *i);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment