add vlc backend

SVN revision: 36280
This commit is contained in:
Vincent Torri 2008-09-27 21:07:53 +00:00
parent 7d07153e8f
commit 0829e2e3bc
7 changed files with 1504 additions and 1 deletions

View File

@ -38,6 +38,16 @@ CPPFLAGS="$CPPFLAGS $ECORE_CFLAGS"
AC_CHECK_HEADERS(Ecore_X.h Ecore_Fb.h)
CPPFLAGS=$save_CPPFLAGS
AC_ARG_ENABLE(vlc,
AC_HELP_STRING([--disable-vlc],[disable vlc support @<:@default=auto@:>@]),
[enable_vlc=$enableval],[enable_vlc=auto])
if test "$enable_vlc" != "no" ; then
PKG_CHECK_MODULES(VLC, [libvlc >= 0.9], [HAVE_VLC="yes"], [HAVE_VLC="no"])
fi
if test "$enable_vlc$HAVE_VLC" = "yesno" ; then
AC_MSG_RESULT(vlc not found)
fi
AC_ARG_ENABLE(xine,
AC_HELP_STRING([--disable-xine],[disable xine support @<:@default=auto@:>@]),
[enable_xine=$enableval],[enable_xine=auto])
@ -115,6 +125,7 @@ if test "$HAVE_XINE$HAVE_GSTREAMER" = "nono" ; then
AC_MSG_ERROR([Xine or Gstreamer must be installed to build emotion])
fi
AM_CONDITIONAL([BUILD_VLC_MODULE], [test "$HAVE_VLC" = yes])
AM_CONDITIONAL([BUILD_XINE_MODULE], [test "$HAVE_XINE" = yes])
AM_CONDITIONAL([BUILD_GSTREAMER_MODULE], [test "$HAVE_GSTREAMER" = yes])
@ -127,6 +138,7 @@ src/lib/Makefile
src/modules/Makefile
src/modules/xine/Makefile
src/modules/gstreamer/Makefile
src/modules/vlc/Makefile
src/bin/Makefile
data/Makefile
debian/changelog
@ -147,6 +159,7 @@ echo "Configuration Options Summary:"
echo
echo " Modules:"
echo " Xine...............: $HAVE_XINE"
echo " Vlc................: $HAVE_VLC"
echo " Gstreamer..........: $HAVE_GSTREAMER"
echo " Gstreamer plugins..: $GSTPLUG_MSG"
echo " Gstreamer FFmpeg...: $HAVE_GSTFFMPEG"

View File

@ -1,4 +1,4 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = xine gstreamer
SUBDIRS = xine gstreamer vlc

View File

@ -0,0 +1,6 @@
.deps
.libs
Makefile
Makefile.in
*.la
*.lo

View File

@ -0,0 +1,29 @@
MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/modules \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
@EVAS_CFLAGS@ \
@ECORE_CFLAGS@ \
@VLC_CFLAGS@
if BUILD_VLC_MODULE
pkgdir = $(libdir)/emotion
pkg_LTLIBRARIES = vlc.la
vlc_la_SOURCES = \
emotion_vlc.c \
emotion_vlc.h
vlc_la_LIBADD = @EVAS_LIBS@ @ECORE_LIBS@ @VLC_LIBS@ $(top_builddir)/src/lib/libemotion.la -lpthread
vlc_la_LDFLAGS = -module -avoid-version
vlc_la_LIBTOOLFLAGS = --tag=disable-static
vlc_la_DEPENDENCIES = $(top_builddir)/config.h
endif

View File

@ -0,0 +1,72 @@
#
# TODO for emotion/vlc plugin
#
# Known bug
When changing video size at begining, there is sometimes SEGV in evas.
The plugin first load the movie with default geometry, wait for it inputThread from VLC to be launched
and read the movie geometry. Then it stops vlc and start it again with known geometry and realloc frames.
Plugin warn emotion that size changed using API func "_emotion_frame_resize" thru fd_write/fd_read socket.
It seems that it tries to convert original picture from YUV to BGRA but it's already in RGBA format.
p im->cache_entry = {_list_data = {next = 0x818f860, prev = 0x0, last = 0x818f860}, cache = 0x80627f0, cache_key = 0x0, file = 0x0, key = 0x0,
timestamp = 0, laststat = 1221825297, references = 1, scale = 1 '\001', load_opts = {scale_down_by = 0, dpi = 0, w = 0, h = 0},
space = 1, w = 384, h = 288, allocated = {w = 384, h = 288}, info = {module = 0x0, loader = 0x0}, flags = {loaded = 0 '\0',
dirty = 1 '\001', activ = 0 '\0', need_data = 1 '\001', lru_nodata = 0 '\0', cached = 1 '\001', alpha = 0 '\0', alpha_sparse = 0 '\0'}}
We can see cache is 1 (=EVAS_COLORSPACE_YCBCR422P601_PL) instead of 0 (=EVAS_COLORSPACE_ARGB8888).
GDB TRACE =
evas_common_convert_yuv_420p_601_rgba (src=0xb40a6008, dst=0xb3e72008 "", w=720, h=400) at evas_convert_yuv.c:198
198 movd_m2r(*up, mm3);
(gdb) bt
0 evas_common_convert_yuv_420p_601_rgba (src=0xb40a6008, dst=0xb3e72008 "", w=720, h=400) at evas_convert_yuv.c:198
1 0xb7f3e087 in evas_common_image_colorspace_normalize (im=0x8090a88) at evas_image_main.c:388
2 0xb7e6486d in eng_image_draw (data=0x8063388, context=0x8061120, surface=0x8090808, image=0x8090a88, src_x=0, src_y=0, src_w=720, src_h=400, dst_x=0, dst_y=0, dst_w=800, dst_h=600, smooth=1) at evas_engine.c:566
3 0xb7ee027b in evas_object_image_render (obj=0x8061788, output=0x8063388, context=0x8061120, surface=0x8090808, x=0, y=0) at evas_object_image.c:1974
4 0xb7f09db1 in evas_render_updates_internal (e=0x8063c80, make_updates=1 '\001', do_draw=1 '\001') at evas_render.c:526
5 0xb7e7f3d6 in _ecore_evas_x_render (ee=0x8063a98) at ecore_evas_x.c:330
6 0xb7e82207 in _ecore_evas_x_idle_enter (data=0x0) at ecore_evas_x.c:1320
7 0xb7ea738b in _ecore_idle_enterer_call () at ecore_idle_enterer.c:101
8 0xb7eaaae5 in _ecore_main_loop_iterate_internal (once_only=0) at ecore_main.c:691
9 0xb7eaaccf in ecore_main_loop_begin () at ecore_main.c:87
10 0x08048bb2 in main ()
# Missing functions (empty bodies) int emotion_vlc.c
/* STUB */
static void em_event_feed(void *ef, int event)
--
/* STUB */
static void em_event_mouse_button_feed(void *ef, int button, int x, int y)
--
/* STUB */
static void em_event_mouse_move_feed(void *ef, int x, int y)
--
/* STUB */
static void em_video_channel_set(void *ef, int channel)
--
/* STUB */
static int em_video_channel_get(void *ef)
--
/* STUB */
static const char * em_video_channel_name_get(void *ef, int channel)
--
/* STUB */
static int em_audio_channel_count(void *ef)
--
/* STUB */
static const char * em_audio_channel_name_get(void *ef, int channel)
--
/* STUB */
static int em_spu_channel_count(void *ef)
--
/* STUB */
static const char * em_spu_channel_name_get(void *ef, int channel)
--
/* STUB */
static void em_spu_channel_mute_set(void *ef, int mute)
--
/* STUB */
static int em_spu_channel_mute_get(void *ef)
--
/* STUB */
static const char * em_chapter_name_get(void *ef, int chapter)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,182 @@
/*
* SICMA AERO SEAT
* code@ife-sit.info
*/
#ifndef EMOTION_VLC_H
#define EMOTION_VLC_H
#include <vlc/vlc.h>
#include <fcntl.h>
#include <pthread.h>
/* default values */
#define WIDTH 10
#define HEIGHT 10
/* internal values */
#define EVENT_BEG_ID 6
#define NB_EVENTS 14
/* checking macros */
#define ASSERT_EV(ev) if(!ev)
#define ASSERT_EV_M(ev) if(!ev->vlc_m)
#define ASSERT_EV_MP(ev) if(!ev->vlc_mp)
#define ASSERT_EV_VLC(ev) if(!ev->vlc_player)
#ifdef DEBUG
#define CATCH(ex) if(libvlc_exception_raised(ex)){ \
fprintf(stderr,"VLC EX [%s]::%s:%d %s\n", __FILE__,__func__,__LINE__, \
libvlc_exception_get_message(ex)); \
}libvlc_exception_clear(ex);
#else
#define CATCH(ex) libvlc_exception_clear(ex);
#endif
/* internal events */
#define VLC_NEW_FRAME 1
#define VLC_RESIZE 2
#define VLC_CHANGE_VOL 3
typedef struct _Emotion_Vlc_Video Emotion_Vlc_Video;
typedef struct _Emotion_Vlc_Video_Frame Emotion_Vlc_Video_Frame;
typedef struct _Emotion_Vlc_Event Emotion_Vlc_Event;
/* module api EMOTION --> VLC */
static unsigned char em_init (Evas_Object *obj, void **emotion_video, Emotion_Module_Options *opt);
static int em_shutdown (void *ef);
static unsigned char em_file_open (const char *file, Evas_Object *obj, void *ef);
static void em_file_close (void *ef);
static void em_play (void *ef, double pos);
static void em_stop (void *ef);
static void em_size_get (void *ef, int *w, int *h);
static void em_pos_set (void *ef, double pos);
static void em_vis_set (void *ef, Emotion_Vis vis);
static double em_len_get (void *ef);
static int em_fps_num_get (void *ef);
static int em_fps_den_get (void *ef);
static double em_fps_get (void *ef);
static double em_pos_get (void *ef);
static Emotion_Vis em_vis_get (void *ef);
static double em_ratio_get (void *ef);
static int em_seekable (void *ef);
static void em_frame_done (void *ef);
static Emotion_Format em_format_get (void *ef);
static void em_video_data_size_get (void *ef, int *w, int *h);
static int em_bgra_data_get (void *ef, unsigned char **bgra_data);
static void em_event_feed (void *ef, int event);
static void em_event_mouse_button_feed (void *ef, int button, int x, int y);
static void em_event_mouse_move_feed (void *ef, int x, int y);
static int em_video_channel_count (void *ef);
static void em_video_channel_set (void *ef, int channel);
static int em_video_channel_get (void *ef);
static const char *em_video_channel_name_get (void *ef, int channel);
static void em_video_channel_mute_set (void *ef, int mute);
static int em_video_channel_mute_get (void *ef);
static int em_audio_channel_count (void *ef);
static void em_audio_channel_set (void *ef, int channel);
static int em_audio_channel_get (void *ef);
static const char *em_audio_channel_name_get (void *ef, int channel);
static void em_audio_channel_mute_set (void *ef, int mute);
static int em_audio_channel_mute_get (void *ef);
static void em_audio_channel_volume_set(void *ef, double vol);
static double em_audio_channel_volume_get(void *ef);
static int em_spu_channel_count (void *ef);
static void em_spu_channel_set (void *ef, int channel);
static int em_spu_channel_get (void *ef);
static const char *em_spu_channel_name_get (void *ef, int channel);
static void em_spu_channel_mute_set (void *ef, int mute);
static int em_spu_channel_mute_get (void *ef);
static int em_chapter_count (void *ef);
static void em_chapter_set (void *ef, int chapter);
static int em_chapter_get (void *ef);
static const char *em_chapter_name_get (void *ef, int chapter);
static void em_speed_set (void *ef, double speed);
static double em_speed_get (void *ef);
static int em_eject (void *ef);
static const char *em_meta_get (void *ef, int meta);
/* entry points for module */
unsigned char module_open(Evas_Object *obj, const Emotion_Video_Module **module, void **video, Emotion_Module_Options *opt);
void module_close(Emotion_Video_Module *module, void *video);
typedef struct _vlc_event_t {
libvlc_event_type_t type;
int data_length;
void * data;
} vlc_event_t;
/* emotion/vlc main structure */
struct _Emotion_Vlc_Video
{
/* vlc objects */
libvlc_instance_t * vlc_player;
libvlc_media_player_t * vlc_mp;
libvlc_media_t * vlc_m;
libvlc_exception_t * vlc_ex;
libvlc_event_manager_t * vlc_evtmngr;
/* vlc datas */
char clock[64], cunlock[64], cdata[64];
char width[32], height[32], pitch[32];
int fd_read, fd_write;
int fd_slave_read, fd_slave_write;
Ecore_Fd_Handler *fd_handler;
char *filename;
volatile double len;
volatile double pos;
double fps;
double ratio;
int w, h;
Evas_Object *obj;
Emotion_Vlc_Video_Frame *cur_frame;
volatile int spu_channel;
volatile int audio_channel;
volatile int video_channel;
volatile int fq;
Emotion_Vis vis;
unsigned char play : 1;
unsigned char just_loaded : 1;
unsigned char video_mute : 1;
unsigned char audio_mute : 1;
unsigned char spu_mute : 1;
unsigned char opt_no_video : 1;
unsigned char opt_no_audio : 1;
volatile unsigned char delete_me : 1;
volatile unsigned char opening : 1;
volatile unsigned char closing : 1;
volatile unsigned char have_vo : 1;
volatile unsigned char play_ok : 1;
};
/* structure for frames 2 buffers to keep integrity */
struct _Emotion_Vlc_Video_Frame
{
unsigned char *frame;
unsigned char *frame_A;
unsigned char *frame_B;
pthread_mutex_t frame_copy_lock;
};
/* internal util calls */
static void *_em_lock (void *par);
static void _em_unlock (void *par);
static void _em_event (const libvlc_event_t *event, void* data);
static void _em_resize (Emotion_Vlc_Video *ev, int x, int y);
static int _em_fd_active (void *data, Ecore_Fd_Handler *fdh);
static int _em_reload_vlc (Emotion_Vlc_Video *ev);
void* _em_slave_thread (void * t);
/* internal event struct */
struct _Emotion_Vlc_Event
{
int type;
int mtype;
};
#endif