emotion can use gstreamer, now

SVN revision: 17103
This commit is contained in:
doursse 2005-10-02 07:34:36 +00:00 committed by doursse
parent dc5e3e07af
commit bad4d6e848
10 changed files with 1625 additions and 30 deletions

View File

@ -1,2 +1,3 @@
The Rasterman (Carsten Haitzler) <raster@rasterman.com>
doursse (Vincent Torri) <torri@maths.univ-evry.fr>
captainigloo

View File

@ -1,2 +1,17 @@
Emotion smart object
--------------------
Xine module
-----------
* Fix seek and get_pos threads delete bugs (infinite loop)
* Add support of visualizations for audio files (Goom...)
Gstreamer module
----------------
* Add gststreamselector to support multiple video and audio streams.
* Add support of visualizations for audio files (Goom...)

View File

@ -130,17 +130,40 @@ AC_PATH_GENERIC(embryo, 0.9.1,
)
AC_PATH_GENERIC(xine, 1.0.0,
[ ],
[ AC_MSG_ERROR(Xine isn't installed)]
[HAVE_XINE="yes"],
[HAVE_XINE="no"]
)
xine_plugins=`$XINE_CONFIG --plugindir`
AC_SUBST(xine_plugins)
dnl gstreamer
gstreamer_cflags=
gstreamer_libs=
dnl Gstreamer version requirement
GST_REQS=0.8.10
GSTPLUG_REQS=0.8.10
GST_MAJORMINOR=0.8
PKG_CHECK_MODULES(GST, \
gstreamer-$GST_MAJORMINOR >= $GST_REQS,
HAVE_GSTREAMER="yes", HAVE_GSTREAMER="no")
AC_SUBST(GST_CFLAGS)
AC_SUBST(GST_LIBS)
if test "${HAVE_XINE}" = "no" && test "${HAVE_GSTREAMER}" = "no" ; then
AC_MSG_ERROR([Xine or Gstreamer must be installed to build emotion])
fi
AM_CONDITIONAL([BUILD_XINE_MODULE], [test "$HAVE_XINE" = yes])
AM_CONDITIONAL([BUILD_GSTREAMER_MODULE], [test "$HAVE_GSTREAMER" = yes])
AC_CHECK_LIB(dl, dlopen, dlopen_libs=-ldl)
AC_SUBST(dlopen_libs)
requirements="eet evas ecore edje libxine"
requirements="eet evas ecore edje libxine gstreamer"
AC_SUBST(requirements)
AC_OUTPUT([
@ -156,3 +179,31 @@ emotion-config
],[
chmod +x emotion-config
])
#####################################################################
## Info
echo
echo
echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo "Configuration Options Summary:"
echo
echo " Modules:"
echo " Xine...............: $HAVE_XINE"
echo " Gstreamer..........: $HAVE_GSTREAMER"
echo
echo " Compilation..........: make"
echo
echo " Installation.........: make install"
echo
echo " prefix.........: $prefix"
echo " binaries.......: $bindir"
echo " libraries......: $libdir"
echo " headers........: $includedir"
echo

View File

@ -9,7 +9,7 @@ These routines are used for Emotion.
@mainpage Emotion Library Documentation
@image html emotion.png
@version 0.0.1
@version @VERSION@
@author Carsten Haitzler <raster@rasterman.com>
@date 2003-2004

View File

@ -715,7 +715,7 @@ video_obj_signal_frame_move_cb(void *data, Evas_Object *o, const char *emission,
static void
init_video_object(char *file)
init_video_object(char *module_filename, char *filename)
{
Evas_Object *o, *oe;
int iw, ih;
@ -724,8 +724,10 @@ init_video_object(char *file)
/* basic video object setup */
o = emotion_object_add(evas);
emotion_object_file_set(o, file);
o = emotion_object_add(evas);
if (!emotion_object_init(o, module_filename))
return;
emotion_object_file_set(o, filename);
emotion_object_play_set(o, 1);
evas_object_move(o, 0, 0);
evas_object_resize(o, 320, 240);
@ -806,11 +808,14 @@ enter_idle(void *data)
int
main(int argc, char **argv)
{
char *module_filename;
int i;
if (main_start(argc, argv) < 1) return -1;
bg_setup();
module_filename = "emotion_decoder_xine.so";
for (i = 1; i < argc; i++)
{
if (((!strcmp(argv[i], "-g")) ||
@ -822,7 +827,7 @@ main(int argc, char **argv)
(!strcmp(argv[i], "--help"))))
{
printf("Usage:\n");
printf(" %s [-gl] [-g WxH] \n", argv[0]);
printf(" %s [-gl] [-g WxH] [-xine] [-gstreamer] filename\n", argv[0]);
exit(-1);
}
else if (!strcmp(argv[i], "-gl"))
@ -831,9 +836,18 @@ main(int argc, char **argv)
else if (!strcmp(argv[i], "-fb"))
{
}
else
else if (!strcmp(argv[i], "-xine"))
{
init_video_object(argv[i]);
module_filename = "emotion_decoder_xine.so";
}
else if (!strcmp(argv[i], "-gstreamer"))
{
module_filename = "emotion_decoder_gstreamer.so";
}
else
{
printf ("module : %s\n", module_filename);
init_video_object(module_filename, argv[i]);
}
}

View File

@ -3,6 +3,12 @@
#include <Evas.h>
enum _Emotion_Module
{
EMOTION_MODULE_XINE,
EMOTION_MODULE_GSTREAMER
};
enum _Emotion_Event
{
EMOTION_EVENT_MENU1, // Escape Menu
@ -46,6 +52,7 @@ enum _Emotion_Meta_Info
EMOTION_META_INFO_TRACK_DISC_ID
};
typedef enum _Emotion_Module Emotion_Module;
typedef enum _Emotion_Event Emotion_Event;
typedef enum _Emotion_Meta_Info Emotion_Meta_Info;
@ -58,8 +65,8 @@ extern "C" {
/* api calls available */
Evas_Object *emotion_object_add (Evas *evas);
Evas_Bool emotion_object_init (Evas_Object *obj);
void emotion_object_file_set (Evas_Object *obj, const char *file);
Evas_Bool emotion_object_init (Evas_Object *obj, const char *module_filename);
void emotion_object_file_set (Evas_Object *obj, const char *filename);
const char *emotion_object_file_get (Evas_Object *obj);
void emotion_object_play_set (Evas_Object *obj, Evas_Bool play);
Evas_Bool emotion_object_play_get (Evas_Object *obj);

View File

@ -35,6 +35,8 @@ struct _Smart_Data
Emotion_Video_Module *module;
void *video;
char *module_name;
char *file;
Evas_Object *obj;
double ratio;
@ -94,12 +96,15 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
void *handle;
char buf[4096];
snprintf(buf, sizeof(buf), "%s/%s", PACKAGE_LIB_DIR"/emotion/", name);
snprintf(buf, sizeof(buf), "%s%s", PACKAGE_LIB_DIR"/emotion/",
name);
printf ("module : %s\n", buf);
handle = dlopen(buf, RTLD_NOW | RTLD_GLOBAL);
if (handle)
{
unsigned char (*func_module_open)(Evas_Object *, Emotion_Video_Module **, void **);
printf ("module opened\n");
func_module_open = dlsym(handle, "module_open");
if (func_module_open)
{
@ -111,6 +116,12 @@ _emotion_module_open(const char *name, Evas_Object *obj, Emotion_Video_Module **
}
dlclose(handle);
}
else
{
char *err;
err = dlerror();
printf ("pas de module : %s\n", err);
}
return 0;
}
@ -129,6 +140,9 @@ _emotion_module_close(Emotion_Video_Module *mod, void *video)
/*******************************/
/* Externally accessible calls */
/*******************************/
Evas_Object *
emotion_object_add(Evas *evas)
{
@ -137,7 +151,7 @@ emotion_object_add(Evas *evas)
}
Evas_Bool
emotion_object_init(Evas_Object *obj)
emotion_object_init(Evas_Object *obj, const char *module_filename)
{
Smart_Data *sd;
@ -162,10 +176,14 @@ emotion_object_init(Evas_Object *obj)
if (!sd->module || !sd->video)
{
if (!_emotion_module_open("emotion_decoder_xine.so", obj, &sd->module, &sd->video))
if (!_emotion_module_open(module_filename, obj, &sd->module, &sd->video))
return 0;
}
if (!sd->module || !sd->video)
if (!_emotion_module_open(module_filename, obj, &sd->module, &sd->video))
return 0;
return 1;
}
@ -177,27 +195,22 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
if ((file) && (sd->file) && (!strcmp(file, sd->file))) return;
if ((file) && (strlen(file) > 0))
{
int w, h;
if (!emotion_object_init(obj))
return;
sd->file = strdup(file);
if (sd->module)
{
sd->module->file_close(sd->video);
evas_object_image_size_set(sd->obj, 0, 0);
sd->module->file_close(sd->video);
evas_object_image_size_set(sd->obj, 0, 0);
}
if (!sd->module->file_open(sd->file, obj, sd->video))
return;
return;
sd->module->size_get(sd->video, &w, &h);
evas_object_image_size_set(sd->obj, w, h);
sd->ratio = sd->module->ratio_get(sd->video);
sd->pos = 0.0;
if (sd->play)
sd->module->play(sd->video, 0.0);
if (sd->play) sd->module->play(sd->video, 0.0);
}
else
{
@ -238,8 +251,11 @@ emotion_object_play_get(Evas_Object *obj)
{
Smart_Data *sd;
printf ("play get\n");
E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
printf ("play get1\n");
if (!sd->video) return 0;
printf ("play get2\n");
return sd->play;
}
@ -810,7 +826,7 @@ _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio)
Smart_Data *sd;
int iw, ih;
int changed = 0;
printf ("frame resize %d %d\n", w, h);
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
evas_object_image_size_get(sd->obj, &iw, &ih);
if ((w != iw) || (h != ih))

View File

@ -1,6 +1,13 @@
## Process this file with automake to produce Makefile.in
if BUILD_XINE_MODULE
SUBDIRS = xine
XINE_LIB_NAME=emotion_decoder_xine.la
endif
if BUILD_GSTREAMER_MODULE
GSTREAMER_LIB_NAME = emotion_decoder_gstreamer.la
endif
#AUTOMAKE_OPTIONS = 1.4 foreign
@ -9,15 +16,28 @@ MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I$(top_srcdir) \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/modules \
@EVAS_CFLAGS@ @ECORE_CFLAGS@ @XINE_CFLAGS@
@EVAS_CFLAGS@ @ECORE_CFLAGS@ @XINE_CFLAGS@ @GST_CFLAGS@
pkgdir = $(libdir)/emotion
pkgdir = $(libdir)/emotion
pkg_LTLIBRARIES = emotion_decoder_xine.la
emotion_decoder_xine_la_SOURCES = \
pkg_LTLIBRARIES = $(XINE_LIB_NAME) $(GSTREAMER_LIB_NAME)
if BUILD_XINE_MODULE
emotion_decoder_xine_la_SOURCES = \
emotion_xine.c \
emotion_xine.h
emotion_decoder_xine_la_LIBADD = @EVAS_LIBS@ @ECORE_LIBS@ @XINE_LIBS@
emotion_decoder_xine_la_LDFLAGS = -module -avoid-version \
-L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
emotion_decoder_xine_la_DEPENDENCIES = $(top_builddir)/config.h
endif
if BUILD_GSTREAMER_MODULE
emotion_decoder_gstreamer_la_SOURCES = \
emotion_gstreamer.c \
emotion_gstreamer.h
emotion_decoder_gstreamer_la_LIBADD = @EVAS_LIBS@ @ECORE_LIBS@ @GST_LIBS@
emotion_decoder_gstreamer_la_LDFLAGS = -module -avoid-version \
-L$(top_builddir)/src/lib -L$(top_builddir)/src/lib/.libs
emotion_decoder_gstreamer_la_DEPENDENCIES = $(top_builddir)/config.h
endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,76 @@
#ifndef __EMOTION_GSTREAMER_H__
#define __EMOTION_GSTREAMER_H__
#include <Ecore_Data.h>
#include <gst/gst.h>
typedef struct _Emotion_Video_Sink Emotion_Video_Sink;
struct _Emotion_Video_Sink
{
GstElement *sink;
unsigned long long length_time;
unsigned long long length_frames;
unsigned int width;
unsigned int height;
unsigned int par_num;
unsigned int par_den;
double framerate;
};
typedef struct _Emotion_Audio_Sink Emotion_Audio_Sink;
struct _Emotion_Audio_Sink
{
GstElement *sink;
unsigned long long length_time;
unsigned long long length_samples;
unsigned int channels;
unsigned int samplerate;
};
typedef struct _Emotion_Gstreamer_Video Emotion_Gstreamer_Video;
struct _Emotion_Gstreamer_Video
{
/* Gstreamer elements */
GstElement *pipeline;
/* Sinks */
Ecore_List *video_sinks;
Ecore_List *audio_sinks;
/* Evas object */
Evas_Object *obj;
unsigned char *obj_data;
/* Characteristics */
int position;
int width;
int height;
double ratio;
volatile int seek_to;
volatile int get_poslen;
volatile double seek_to_pos;
int fd_ev_read;
int fd_ev_write;
Ecore_Fd_Handler *fd_ev_handler;
unsigned char play : 1;
unsigned char video_mute : 1;
unsigned char audio_mute : 1;
};
unsigned char module_open (Evas_Object *obj,
Emotion_Video_Module **module,
void **video);
void module_close (Emotion_Video_Module *module,
void *video);
#endif /* __EMOTION_GSTREAMER_H__ */