- few updates to video player
This commit is contained in:
parent
895428a954
commit
66af241154
|
@ -28,7 +28,7 @@ elif [ -f /etc/fedora-release ]; then
|
||||||
sudo yum install SDL-devel xerces-c-devel mesa-libGL-devel mesa-libGLU-devel libvorbis-devel wxBase wxGTK-devel lua-devel libjpeg-devel libpng-devel libcurl-devel openal-soft-devel libX11-devel libxml2-dev libircclient-dev glew-devel ftgl-devel
|
sudo yum install SDL-devel xerces-c-devel mesa-libGL-devel mesa-libGLU-devel libvorbis-devel wxBase wxGTK-devel lua-devel libjpeg-devel libpng-devel libcurl-devel openal-soft-devel libX11-devel libxml2-dev libircclient-dev glew-devel ftgl-devel
|
||||||
elif [ "$OSTYPE" = "i686" ] && [ "$version" = "Ubuntu" ]; then
|
elif [ "$OSTYPE" = "i686" ] && [ "$version" = "Ubuntu" ]; then
|
||||||
echo "=====> Using build deps for old Ubuntu 8.04..."
|
echo "=====> Using build deps for old Ubuntu 8.04..."
|
||||||
sudo apt-get install libsdl1.2-dev libxerces28-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libluajit-5.1-dev libvlc-dev
|
sudo apt-get install libsdl1.2-dev libxerces28-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libluajit-5.1-dev libvlc-dev libftgl-dev libvlc-dev
|
||||||
elif [ "$OSTYPE" = "x86_64" ]; then
|
elif [ "$OSTYPE" = "x86_64" ]; then
|
||||||
echo "=====> Using build deps for debian based 64 bit linux..."
|
echo "=====> Using build deps for debian based 64 bit linux..."
|
||||||
sudo apt-get install libsdl1.2-dev libxerces-c2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev cmake-curses-gui libgtk2.0-dev libxml2-dev libircclient-dev libftgl-dev libglew-dev libluajit-5.1-dev libvlc-dev
|
sudo apt-get install libsdl1.2-dev libxerces-c2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev cmake-curses-gui libgtk2.0-dev libxml2-dev libircclient-dev libftgl-dev libglew-dev libluajit-5.1-dev libvlc-dev
|
||||||
|
|
|
@ -73,10 +73,13 @@ struct ctx {
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
void *rawData;
|
void *rawData;
|
||||||
|
bool verboseEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load a texture
|
// Load a texture
|
||||||
static void loadTexture(struct ctx *ctx) {
|
static void loadTexture(struct ctx *ctx) {
|
||||||
|
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
void *rawData = ctx->rawData;
|
void *rawData = ctx->rawData;
|
||||||
Uint8 * pixelSource = 0;
|
Uint8 * pixelSource = 0;
|
||||||
Uint8 * pixelDestination = (Uint8 *) rawData;
|
Uint8 * pixelDestination = (Uint8 *) rawData;
|
||||||
|
@ -99,6 +102,7 @@ static void loadTexture(struct ctx *ctx) {
|
||||||
|
|
||||||
static void *lock(void *data, void **p_pixels) {
|
static void *lock(void *data, void **p_pixels) {
|
||||||
struct ctx *ctx = (struct ctx *)data;
|
struct ctx *ctx = (struct ctx *)data;
|
||||||
|
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
SDL_LockMutex(ctx->mutex);
|
SDL_LockMutex(ctx->mutex);
|
||||||
SDL_LockSurface(ctx->surf);
|
SDL_LockSurface(ctx->surf);
|
||||||
|
@ -109,6 +113,7 @@ static void *lock(void *data, void **p_pixels) {
|
||||||
|
|
||||||
static void unlock(void *data, void *id, void *const *p_pixels) {
|
static void unlock(void *data, void *id, void *const *p_pixels) {
|
||||||
struct ctx *ctx = (struct ctx *)data;
|
struct ctx *ctx = (struct ctx *)data;
|
||||||
|
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
/* VLC just rendered the video, but we can also render stuff */
|
/* VLC just rendered the video, but we can also render stuff */
|
||||||
SDL_UnlockSurface(ctx->surf);
|
SDL_UnlockSurface(ctx->surf);
|
||||||
|
@ -117,7 +122,8 @@ static void unlock(void *data, void *id, void *const *p_pixels) {
|
||||||
|
|
||||||
static void display(void *data, void *id) {
|
static void display(void *data, void *id) {
|
||||||
/* VLC wants to display the video */
|
/* VLC wants to display the video */
|
||||||
(void) data;
|
struct ctx *ctx = (struct ctx *)data;
|
||||||
|
if(ctx->verboseEnabled) printf("In [%s] Line: %d\n",__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAS_LIBVLC) && defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
#if defined(HAS_LIBVLC) && defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||||
|
@ -160,6 +166,7 @@ void VideoPlayer::PlayVideo() {
|
||||||
ctx.width = width;
|
ctx.width = width;
|
||||||
ctx.height = height;
|
ctx.height = height;
|
||||||
ctx.rawData = (void *) malloc(width * height * 4);
|
ctx.rawData = (void *) malloc(width * height * 4);
|
||||||
|
ctx.verboseEnabled = verboseEnabled;
|
||||||
|
|
||||||
#ifdef HAS_LIBVLC
|
#ifdef HAS_LIBVLC
|
||||||
libvlc_instance_t *libvlc = NULL;
|
libvlc_instance_t *libvlc = NULL;
|
||||||
|
@ -172,7 +179,11 @@ void VideoPlayer::PlayVideo() {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
std::vector<const char *> vlc_argv;
|
std::vector<const char *> vlc_argv;
|
||||||
vlc_argv.push_back("--no-xlib" /* tell VLC to not use Xlib */);
|
vlc_argv.push_back("-I");
|
||||||
|
vlc_argv.push_back("dummy"); /* Don't use any interface */
|
||||||
|
vlc_argv.push_back("--no-media-library");
|
||||||
|
vlc_argv.push_back("--ignore-config"); /* Don't use VLC's config */
|
||||||
|
vlc_argv.push_back("--no-xlib"); /* tell VLC to not use Xlib */
|
||||||
vlc_argv.push_back("--no-video-title-show");
|
vlc_argv.push_back("--no-video-title-show");
|
||||||
#if defined(LIBVLC_VERSION_PRE_2)
|
#if defined(LIBVLC_VERSION_PRE_2)
|
||||||
string fullPluginsParam = "--plugin-path=" + pluginsPath;
|
string fullPluginsParam = "--plugin-path=" + pluginsPath;
|
||||||
|
@ -212,6 +223,7 @@ void VideoPlayer::PlayVideo() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(verboseEnabled) vlc_argv.push_back("--verbose=2");
|
if(verboseEnabled) vlc_argv.push_back("--verbose=2");
|
||||||
|
if(verboseEnabled) vlc_argv.push_back("--extraintf=logger"); //log anything
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
if(verboseEnabled) _putenv("VLC_VERBOSE=2");
|
if(verboseEnabled) _putenv("VLC_VERBOSE=2");
|
||||||
#endif
|
#endif
|
||||||
|
@ -263,6 +275,9 @@ void VideoPlayer::PlayVideo() {
|
||||||
#else
|
#else
|
||||||
libvlc = libvlc_new(vlc_argc, &vlc_argv[0]);
|
libvlc = libvlc_new(vlc_argc, &vlc_argv[0]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(verboseEnabled) printf("In [%s] Line: %d, libvlc [%p]\n",__FUNCTION__,__LINE__,libvlc);
|
||||||
|
|
||||||
/* It is meaningless to try all this because we have to restart mg to pickup new env vars
|
/* It is meaningless to try all this because we have to restart mg to pickup new env vars
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
if(libvlc == NULL) {
|
if(libvlc == NULL) {
|
||||||
|
@ -315,12 +330,18 @@ void VideoPlayer::PlayVideo() {
|
||||||
if(libvlc != NULL) {
|
if(libvlc != NULL) {
|
||||||
#if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
#if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||||
m = libvlc_media_new(libvlc, filename.c_str(), &ex);
|
m = libvlc_media_new(libvlc, filename.c_str(), &ex);
|
||||||
|
if(verboseEnabled) printf("In [%s] Line: %d, m [%p]\n",__FUNCTION__,__LINE__,m);
|
||||||
|
|
||||||
catchError(&ex);
|
catchError(&ex);
|
||||||
mp = libvlc_media_player_new_from_media(m);
|
mp = libvlc_media_player_new_from_media(m);
|
||||||
|
if(verboseEnabled) printf("In [%s] Line: %d, mp [%p]\n",__FUNCTION__,__LINE__,mp);
|
||||||
#else
|
#else
|
||||||
/* Create a new item */
|
/* Create a new item */
|
||||||
m = libvlc_media_new_path(libvlc, filename.c_str());
|
m = libvlc_media_new_path(libvlc, filename.c_str());
|
||||||
|
if(verboseEnabled) printf("In [%s] Line: %d, m [%p]\n",__FUNCTION__,__LINE__,m);
|
||||||
|
|
||||||
mp = libvlc_media_player_new_from_media(m);
|
mp = libvlc_media_player_new_from_media(m);
|
||||||
|
if(verboseEnabled) printf("In [%s] Line: %d, mp [%p]\n",__FUNCTION__,__LINE__,mp);
|
||||||
#endif
|
#endif
|
||||||
libvlc_media_release(m);
|
libvlc_media_release(m);
|
||||||
|
|
||||||
|
@ -330,11 +351,13 @@ void VideoPlayer::PlayVideo() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
#if defined(LIBVLC_VERSION_PRE_2) && defined(LIBVLC_VERSION_PRE_1_1_13)
|
||||||
libvlc_media_player_play(mp,&ex);
|
int play_result = libvlc_media_player_play(mp,&ex);
|
||||||
#else
|
#else
|
||||||
libvlc_media_player_play(mp);
|
int play_result = libvlc_media_player_play(mp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(verboseEnabled) printf("In [%s] Line: %d, play_result [%d]\n",__FUNCTION__,__LINE__,play_result);
|
||||||
|
|
||||||
successLoadingVLC = true;
|
successLoadingVLC = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user