avmedia/source/vlc/vlcframegrabber.cxx | 10 +-------- avmedia/source/vlc/vlcmanager.cxx | 8 +------ avmedia/source/vlc/vlcplayer.cxx | 1 avmedia/source/vlc/wrapper/Player.cxx | 36 ++++++++++++++++++++++++++++++--- avmedia/source/vlc/wrapper/Types.hxx | 11 ++++++++-- 5 files changed, 46 insertions(+), 20 deletions(-)
New commits: commit 301b5a408d7b0e53f86b1aad0afb8b454fc71991 Author: Minh Ngo <nlmin...@gmail.com> Date: Sat Oct 19 15:34:03 2013 +0300 avmedia/vlc: fixing a hang when trying to get a frame Change-Id: I1fb35d0c62e77448d23eeb11f9de0ab72892336a diff --git a/avmedia/source/vlc/vlcframegrabber.cxx b/avmedia/source/vlc/vlcframegrabber.cxx index 7a742e9..a28cf8a 100644 --- a/avmedia/source/vlc/vlcframegrabber.cxx +++ b/avmedia/source/vlc/vlcframegrabber.cxx @@ -28,15 +28,12 @@ namespace const char * const VLC_ARGS[] = { "-Vdummy", - // "--ignore-config" "--demux", "ffmpeg", "--snapshot-format=png", "--ffmpeg-threads", /* Is deprecated in 2.1.0 */ - "--verbose=2", - "--no-audio"//, - //"--file-logging", - //"--logfile=C:/home/dev/log/vlc_log" + "--verbose=-1", + "--no-audio" }; } @@ -70,10 +67,7 @@ VLCFrameGrabber::VLCFrameGrabber( wrapper::EventHandler& eh, const rtl::OUString const TimeValue timeout = {2, 0}; - //TODO: Fix this hang on Windows -#ifndef WNT condition.wait(&timeout); -#endif if ( !mPlayer.hasVout() ) { diff --git a/avmedia/source/vlc/vlcmanager.cxx b/avmedia/source/vlc/vlcmanager.cxx index 370505d..9894b73 100644 --- a/avmedia/source/vlc/vlcmanager.cxx +++ b/avmedia/source/vlc/vlcmanager.cxx @@ -29,14 +29,10 @@ namespace const ::rtl::OUString VLC_SERVICENAME = "com.sun.star.media.Manager_VLC"; const char * const VLC_ARGS[] = { - "-Vdummy", -#ifdef WNT "--demux", "ffmpeg", -#endif - "--verbose=2"//, - //"--file-logging", - //"--logfile=C:/home/dev/log/vlc_log" + "--no-mouse-events", + "--verbose=-1" }; } diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx index 8d54672..64ad897 100644 --- a/avmedia/source/vlc/vlcplayer.cxx +++ b/avmedia/source/vlc/vlcplayer.cxx @@ -1,4 +1,3 @@ -#include <iostream> #include <boost/bind.hpp> #include <vcl/syschild.hxx> #include <vcl/sysdata.hxx> commit 5b24f86c1c2d64e99da1535c05139a1266dcbcc1 Author: Minh Ngo <nlmin...@gmail.com> Date: Sat Oct 19 15:33:02 2013 +0300 avmedia/vlc: setting a correct video/audio track Change-Id: I935e64f9df74193aba17d00cfe7f37ad3f4f9077 diff --git a/avmedia/source/vlc/wrapper/Player.cxx b/avmedia/source/vlc/wrapper/Player.cxx index d8608d8..cd57267 100644 --- a/avmedia/source/vlc/wrapper/Player.cxx +++ b/avmedia/source/vlc/wrapper/Player.cxx @@ -12,7 +12,7 @@ #include "Player.hxx" #include "Media.hxx" #include "SymbolLoader.hxx" - #include "Common.hxx" +#include "Common.hxx" struct libvlc_media_t; @@ -52,6 +52,12 @@ namespace int ( *libvlc_video_get_size ) ( libvlc_media_player_t *p_mi, unsigned num, unsigned *px, unsigned *py ); int ( *libvlc_video_get_track_count ) ( libvlc_media_player_t *p_mi ); + int ( *libvlc_video_set_track ) ( libvlc_media_player_t *p_mi, int i_track ); + libvlc_track_description_t* ( *libvlc_video_get_track_description ) ( libvlc_media_player_t *p_mi ); + + int ( *libvlc_audio_get_track ) ( libvlc_media_player_t *p_mi ); + libvlc_track_description_t * ( *libvlc_audio_get_track_description ) (libvlc_media_player_t *p_mi ); + int ( *libvlc_audio_set_track ) (libvlc_media_player_t *p_mi, int i_track); } namespace avmedia @@ -90,7 +96,12 @@ namespace wrapper SYM_MAP( libvlc_media_player_retain ), SYM_MAP( libvlc_video_set_scale ), SYM_MAP( libvlc_video_get_size ), - SYM_MAP( libvlc_video_get_track_count ) + SYM_MAP( libvlc_video_get_track_count ), + SYM_MAP( libvlc_video_set_track ), + SYM_MAP( libvlc_video_get_track_description ), + SYM_MAP( libvlc_audio_get_track ), + SYM_MAP( libvlc_audio_get_track_description ), + SYM_MAP( libvlc_audio_set_track ) }; return InitApiMap( VLC_PLAYER_API ); @@ -121,7 +132,26 @@ namespace wrapper bool Player::play() { - return libvlc_media_player_play( mPlayer ) == 0; + const bool status = ( libvlc_media_player_play( mPlayer ) == 0 ); + if ( libvlc_video_get_track_count( mPlayer ) > 0 ) + { + const libvlc_track_description_t *description = libvlc_video_get_track_description( mPlayer ); + + for ( ; description->p_next != NULL; description = description->p_next ); + + libvlc_video_set_track( mPlayer, description->i_id ); + } + + if ( libvlc_audio_get_track( mPlayer ) > 0 ) + { + const libvlc_track_description_t *description = libvlc_audio_get_track_description( mPlayer ); + + for ( ; description->p_next != NULL; description = description->p_next ); + + libvlc_audio_set_track( mPlayer, description->i_id ); + } + + return status; } void Player::pause() diff --git a/avmedia/source/vlc/wrapper/Types.hxx b/avmedia/source/vlc/wrapper/Types.hxx index 624ef13..06a0674 100644 --- a/avmedia/source/vlc/wrapper/Types.hxx +++ b/avmedia/source/vlc/wrapper/Types.hxx @@ -23,7 +23,7 @@ typedef void ( *libvlc_callback_t ) ( const struct libvlc_event_t *, void * ); #define libvlc_MediaPlayerEndReached 0x109 // event structure pieces we use -typedef struct libvlc_event_t +struct libvlc_event_t { int type; // event type void *p_obj; // object emitting that event @@ -35,7 +35,14 @@ typedef struct libvlc_event_t const char *dummy2; } padding; } u; -} libvlc_event_t; +}; + +struct libvlc_track_description_t +{ + int i_id; + char *psz_name; + libvlc_track_description_t *p_next; +}; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits