Last active
August 29, 2015 14:11
-
-
Save tlhc/5365980396bf449ef79f to your computer and use it in GitHub Desktop.
libvlc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <vlc/vlc.h> | |
#include <time.h> | |
#include <signal.h> | |
#define UNUSED(x) (void)(x) | |
static const char* vlcArguments[] = { | |
"--intf=dummy", | |
"--ignore-config", | |
"--no-media-library", | |
"--no-one-instance", | |
"--no-osd", | |
"--no-snapshot-preview", | |
"--no-stats", | |
"--no-audio", | |
"--no-video-title-show", | |
"-vvv" | |
}; | |
static libvlc_instance_t *instance = NULL; | |
static libvlc_media_t *media = NULL; | |
static libvlc_media_player_t *player = NULL; | |
void sig_handler(int signo) { | |
UNUSED(signo); | |
if(player != NULL && media != NULL && instance != NULL) { | |
libvlc_media_player_release(player); | |
libvlc_media_release(media); | |
libvlc_release(instance); | |
printf("%s\n", "relased!"); | |
} | |
exit(0); | |
} | |
int main(int argc, char *argv[]) { | |
UNUSED(argc); | |
UNUSED(argv); | |
signal(SIGINT, sig_handler); | |
instance = libvlc_new(sizeof(vlcArguments) / sizeof(vlcArguments[0]), vlcArguments); | |
media = libvlc_media_new_path(instance, "/home/mars/low_work/siptest/onlyv.264"); | |
player = libvlc_media_player_new_from_media(media); | |
libvlc_media_player_play(player); | |
while(1) { | |
usleep(1000); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment