Emotion:fix compilation on Windows

Note1: disable generic plugin on Windows as shm_open like
function note implemented on that platform yet.

Note2: want_module stuff must be fixed in the m4 macro

Note3: abstract semaphore code in Eina ?

SVN revision: 66686
This commit is contained in:
Vincent Torri 2011-12-30 11:46:29 +00:00
parent f981adaaac
commit 1fb8ee18d9
13 changed files with 173 additions and 63 deletions

View File

@ -55,9 +55,10 @@ AC_SUBST(VMAJ)
want_generic="yes"
case "$host_os" in
mingw* | cegcc*)
mingw*)
want_xine="no"
want_gstreamer="yes"
want_generic="no"
want_generic_vlc="no"
;;
*)
@ -146,6 +147,8 @@ fi
### Checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS([unistd.h])
### Checks for types

View File

@ -1,4 +1,7 @@
#include "config.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

View File

@ -1,10 +1,13 @@
#include "emotion_private.h"
#include "Emotion.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#ifdef EMOTION_HAVE_EEZE
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
# include <sys/ioctl.h>
# ifdef HAVE_V4L2
# include <linux/videodev2.h>
@ -16,6 +19,9 @@
#include <Eet.h>
#include "Emotion.h"
#include "emotion_private.h"
EAPI int EMOTION_WEBCAM_UPDATE = 0;
struct ext_match_s

View File

@ -1,18 +1,6 @@
#ifndef EMOTION_PRIVATE_H
#define EMOTION_PRIVATE_H
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <Evas.h>
#include <Ecore.h>
#include <Emotion.h>
#define META_TRACK_TITLE 1
#define META_TRACK_ARTIST 2
#define META_TRACK_GENRE 3

View File

@ -1,11 +1,24 @@
#include "emotion_private.h"
#include "Emotion.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Evas.h>
#include <Ecore.h>
#ifdef HAVE_EIO
# include <math.h>
# include <Eio.h>
#endif
#include "Emotion.h"
#include "emotion_private.h"
#ifdef _WIN32
# define FMT_UCHAR "%c"
#else
# define FMT_UCHAR "%hhu"
#endif
#define E_SMART_OBJ_GET(smart, o, type) \
{ \
char *_e_smart_str; \
@ -515,7 +528,7 @@ _emotion_object_aspect_border_apply(Evas_Object *obj, Smart_Data *sd, int w, int
double ir;
double r;
int aspect_opt;
int aspect_opt = 0;
iw = sd->video.w;
ih = sd->video.h;
@ -681,7 +694,7 @@ emotion_object_play_set(Evas_Object *obj, Eina_Bool play)
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("play=%hhu, was=%hhu", play, sd->play);
DBG("play=" FMT_UCHAR ", was=" FMT_UCHAR, play, sd->play);
if (play == sd->play) return;
if (!sd->module) return;
if (!sd->video_data) return;
@ -872,7 +885,7 @@ emotion_object_audio_mute_set(Evas_Object *obj, Eina_Bool mute)
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("mute=%hhu", mute);
DBG("mute=" FMT_UCHAR, mute);
if (!sd->module) return;
if (!sd->video_data) return;
sd->module->audio_channel_mute_set(sd->video_data, mute);
@ -940,7 +953,7 @@ emotion_object_video_mute_set(Evas_Object *obj, Eina_Bool mute)
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("mute=%hhu", mute);
DBG("mute=" FMT_UCHAR, mute);
if (!sd->module) return;
if (!sd->video_data) return;
sd->module->video_channel_mute_set(sd->video_data, mute);
@ -1008,7 +1021,7 @@ emotion_object_spu_mute_set(Evas_Object *obj, Eina_Bool mute)
Smart_Data *sd;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
DBG("mute=%hhu", mute);
DBG("mute=" FMT_UCHAR, mute);
if (!sd->module) return;
if (!sd->video_data) return;
sd->module->spu_channel_mute_set(sd->video_data, mute);

View File

@ -1,13 +1,18 @@
#ifndef EMOTION_GENERIC_PLUGIN_H
#define EMOTION_GENERIC_PLUGIN_H
#include <semaphore.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef _WIN32
# include <windows.h>
#else
#include <semaphore.h>
#endif
#define DEFAULTWIDTH 320
#define DEFAULTHEIGHT 240
#define DEFAULTPITCH 4
@ -88,7 +93,12 @@ struct _Emotion_Generic_Video_Shared
int last;
int next;
} frame;
/* FIXME: maybe abstracting that in Eina ? */
#ifdef _WIN32
HANDLE lock;
#else
sem_t lock;
#endif
int frame_drop;
};

View File

@ -1,14 +1,18 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <Eina.h>
#include <Evas.h>
#include <Ecore.h>
#include "Emotion.h"
#include "emotion_private.h"
@ -161,7 +165,7 @@ _create_shm_data(Emotion_Generic_Video *ev, const char *shmname)
vs = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, shmfd, 0);
if (vs == MAP_FAILED)
{
ERR("error when mapping shared memory.\n");
ERR("error when mapping shared memory");
return EINA_FALSE;
}
@ -174,7 +178,17 @@ _create_shm_data(Emotion_Generic_Video *ev, const char *shmname)
vs->frame.last = 2;
vs->frame.next = 2;
vs->frame_drop = 0;
#ifdef _WIN32
/* FIXME: maximum count for the semaphore: 10. Is it sufficient ? */
vs->lock = CreateSemaphore(NULL, 1, 10, NULL);
if (!vs->lock)
{
ERR("can not create semaphore");
return EINA_FALSE;
}
#else
sem_init(&vs->lock, 1, 1);
#endif
ev->frame.frames[0] = (unsigned char *)vs + sizeof(*vs);
ev->frame.frames[1] = (unsigned char *)vs + sizeof(*vs) + vs->height * vs->width * vs->pitch;
ev->frame.frames[2] = (unsigned char *)vs + sizeof(*vs) + 2 * vs->height * vs->width * vs->pitch;
@ -469,7 +483,11 @@ static void
_player_file_closed(Emotion_Generic_Video *ev)
{
INF("Closed previous file.");
#ifdef _WIN32
CloseHandle(ev->shared->lock);
#else
sem_destroy(&ev->shared->lock);
#endif
ev->closing = EINA_FALSE;
@ -899,8 +917,8 @@ _player_exec(Emotion_Generic_Video *ev)
ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_NOT_LEADER,
ev);
INF("created pipe emotion -> player: %d -> %d\n", pipe_out[1], pipe_out[0]);
INF("created pipe player -> emotion: %d -> %d\n", pipe_in[1], pipe_in[0]);
INF("created pipe emotion -> player: %d -> %d", pipe_out[1], pipe_out[0]);
INF("created pipe player -> emotion: %d -> %d", pipe_in[1], pipe_in[0]);
close(pipe_in[1]);
close(pipe_out[0]);
@ -1239,12 +1257,21 @@ static int
em_bgra_data_get(void *data, unsigned char **bgra_data)
{
Emotion_Generic_Video *ev = data;
#ifdef _WIN32
DWORD res;
#endif
if (!ev || !ev->file_ready)
return 0;
// lock frame here
#ifdef _WIN32
res = WaitForSingleObject(ev->shared->lock, 0L);
if (res != WAIT_OBJECT_0)
return 0;
#else
sem_wait(&ev->shared->lock);
#endif
// send current frame to emotion
if (ev->shared->frame.emotion != ev->shared->frame.last)
@ -1259,7 +1286,11 @@ em_bgra_data_get(void *data, unsigned char **bgra_data)
ev->shared->frame_drop = 0;
// unlock frame here
#ifdef _WIN32
ReleaseSemaphore(ev->shared->lock, 1, NULL);
#else
sem_post(&ev->shared->lock);
#endif
ev->drop = 0;
return 1;

View File

@ -1,10 +1,17 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Eina.h>
#include <Evas.h>
#include <Ecore.h>
#include <glib.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideosink.h>
#include <Ecore.h>
#include "Emotion.h"
#include "emotion_gstreamer.h"
Emotion_Gstreamer_Buffer *

View File

@ -1,3 +1,16 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Eina.h>
#include <Evas.h>
#include <glib.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideosink.h>
#include "Emotion.h"
#include "emotion_gstreamer.h"
static inline void

View File

@ -1,3 +1,16 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Eina.h>
#include <Evas.h>
#include <glib.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideosink.h>
#include "Emotion.h"
#include "emotion_gstreamer.h"
typedef struct _FakeEOSBin

View File

@ -1,11 +1,35 @@
#include <unistd.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <fcntl.h>
#include <Eina.h>
#include <Evas.h>
#include <Ecore.h>
#define HTTP_STREAM 0
#define RTSP_STREAM 1
#include <glib.h>
#include <gst/gst.h>
#include <glib-object.h>
#include <gst/video/gstvideosink.h>
#include <gst/video/video.h>
#ifdef HAVE_ECORE_X
# include <Ecore_X.h>
# include <Ecore_Evas.h>
# ifdef HAVE_XOVERLAY_H
# include <gst/interfaces/xoverlay.h>
# endif
#endif
#include "Emotion.h"
#include "emotion_private.h"
#include "emotion_gstreamer.h"
#include "Emotion.h"
Eina_Bool window_manager_video = EINA_FALSE;
int _emotion_gstreamer_log_domain = -1;
@ -400,9 +424,11 @@ em_cleanup(Emotion_Gstreamer_Video *ev)
if (ev->xvpad) gst_object_unref(ev->xvpad);
ev->xvpad = NULL;
#ifdef HAVE_ECORE_X
fprintf(stderr, "destroying window: %i\n", ev->win);
if (ev->win) ecore_x_window_free(ev->win);
ev->win = 0;
#endif
}
EINA_LIST_FREE(ev->audio_streams, astream)
@ -1231,6 +1257,7 @@ em_priority_get(void *video)
return ev->stream;
}
#ifdef HAVE_ECORE_X
static Eina_Bool
_ecore_event_x_destroy(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
@ -1240,6 +1267,7 @@ _ecore_event_x_destroy(void *data __UNUSED__, int type __UNUSED__, void *event _
return EINA_TRUE;
}
#endif
static Eina_Bool
module_open(Evas_Object *obj,
@ -1271,7 +1299,9 @@ module_open(Evas_Object *obj,
if (!em_module.init(obj, video, opt))
return EINA_FALSE;
#ifdef HAVE_ECORE_X
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _ecore_event_x_destroy, NULL);
#endif
if (getenv("EMOTION_FPS_DEBUG")) debug_fps = EINA_TRUE;

View File

@ -1,31 +1,6 @@
#ifndef __EMOTION_GSTREAMER_H__
#define __EMOTION_GSTREAMER_H__
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Evas.h>
#include <Ecore.h>
#ifdef HAVE_ECORE_X
# include <Ecore_X.h>
# include <Ecore_Evas.h>
# ifdef HAVE_XOVERLAY_H
# include <gst/interfaces/xoverlay.h>
# endif
#endif
#define HTTP_STREAM 0
#define RTSP_STREAM 1
#include <glib.h>
#include <gst/gst.h>
#include <glib-object.h>
#include <gst/video/gstvideosink.h>
#include <gst/video/video.h>
#include "emotion_private.h"
typedef void (*Evas_Video_Convert_Cb)(unsigned char *evas_data,
const unsigned char *gst_data,
unsigned int w,

View File

@ -1,3 +1,21 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Eina.h>
#include <Evas.h>
#include <Ecore.h>
#define HTTP_STREAM 0
#define RTSP_STREAM 1
#include <glib.h>
#include <gst/gst.h>
#include <glib-object.h>
#include <gst/video/gstvideosink.h>
#include <gst/video/video.h>
#include "Emotion.h"
#include "emotion_private.h"
#include "emotion_gstreamer.h"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE("sink",
@ -831,9 +849,9 @@ static void
_video_resize(void *data, Evas_Object *obj __UNUSED__, const Evas_Video_Surface *surface __UNUSED__,
Evas_Coord w, Evas_Coord h)
{
#ifdef HAVE_ECORE_X
Emotion_Gstreamer_Video *ev = data;
#ifdef HAVE_ECORE_X
ecore_x_window_resize(ev->win, w, h);
#endif
fprintf(stderr, "resize: %i, %i\n", w, h);
@ -843,8 +861,8 @@ static void
_video_move(void *data, Evas_Object *obj __UNUSED__, const Evas_Video_Surface *surface __UNUSED__,
Evas_Coord x, Evas_Coord y)
{
Emotion_Gstreamer_Video *ev = data;
#ifdef HAVE_ECORE_X
Emotion_Gstreamer_Video *ev = data;
unsigned int pos[2];
fprintf(stderr, "move: %i, %i\n", x, y);
@ -890,10 +908,10 @@ _block_pad_link_cb(GstPad *pad, gboolean blocked, gpointer user_data)
static void
_video_show(void *data, Evas_Object *obj __UNUSED__, const Evas_Video_Surface *surface __UNUSED__)
{
#ifdef HAVE_ECORE_X
Emotion_Gstreamer_Video *ev = data;
fprintf(stderr, "show xv\n");
#ifdef HAVE_ECORE_X
ecore_x_window_show(ev->win);
#endif
/* gst_pad_set_blocked_async(ev->teepad, TRUE, _block_pad_link_cb, ev); */
@ -902,10 +920,10 @@ _video_show(void *data, Evas_Object *obj __UNUSED__, const Evas_Video_Surface *s
static void
_video_hide(void *data, Evas_Object *obj __UNUSED__, const Evas_Video_Surface *surface __UNUSED__)
{
#ifdef HAVE_ECORE_X
Emotion_Gstreamer_Video *ev = data;
fprintf(stderr, "hide xv\n");
#ifdef HAVE_ECORE_X
ecore_x_window_hide(ev->win);
#endif
/* gst_pad_set_blocked_async(ev->teepad, TRUE, _block_pad_unlink_cb, ev); */