#include "stdafx.h" #include "MagicPlayer.h" #include <vlc\vlc.h> libvlc_instance_t *inst = 0; libvlc_media_t *m = 0; libvlc_media_player_t *mp = 0; libvlc_time_t movie_time = 0; int VLC_load(void *handle) { inst = libvlc_new(0, NULL); /* Load the VLC engine */ if (inst == NULL) return 1; mp = libvlc_media_player_new(inst); libvlc_media_player_set_hwnd(mp, handle); /* Make the video played in the window */ return 0; } int VLC_pause() { if (inst == NULL) return 1; if (mp == 0) return 1; if (m == 0) return 1; if (libvlc_media_player_get_state(mp) == libvlc_Playing) { movie_time = libvlc_media_player_get_time(mp); libvlc_media_player_pause(mp); return 0; } else if (libvlc_media_player_get_state(mp) == libvlc_Paused) { libvlc_media_player_pause(mp); return 0; } return 0; } int VLC_play(char *file_name) { if (inst == NULL) return 1; if (mp == NULL) return 1; m = libvlc_media_new_path(inst, file_name); libvlc_media_player_set_media(mp, m); if (m == NULL) return 2; return libvlc_media_player_play(mp); } int VLC_go_back_to_last_stop() { if (mp == NULL) return 1; if (libvlc_media_player_get_state(mp) == libvlc_Playing){ libvlc_media_player_pause(mp); libvlc_media_player_set_time(mp, movie_time); return 0; } return 0; } int VLC_release() { if (mp != 0) libvlc_media_player_release(mp); if (m != 0) libvlc_media_release(m); if (inst != 0) libvlc_release(inst); return 0; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)