Commit 86928096 authored by Thomas Guillem's avatar Thomas Guillem

vout: remove evas output

Not built and tested since a long time. The good way to go is to use the
openGLES2 vout.
parent e5a3e37f
......@@ -319,7 +319,6 @@ libVLC:
* Deprecate libvlc_video_get_title_description, libvlc_video_get_chapter_description,
libvlc_media_player_get_agl, libvlc_media_player_set_agl
* Add libvlc_media_player_set_android_context to integrate in an Android surface
* Add libvlc_media_player_set_evas_object to draw on an EFL/Evas Object
* Add a new libvlc dialog API to forward dialogs requests to the applications:
libvlc_dialog_set_context, libvlc_dialog_get_context, libvlc_dialog_set_callbacks,
libvlc_dialog_dismiss, libvlc_dialog_post_action, libvlc_dialog_post_login
......
......@@ -3419,25 +3419,6 @@ if test "${enable_mmal}" != "no"; then
fi
AM_CONDITIONAL([HAVE_MMAL], [test "${have_mmal}" = "yes"])
dnl
dnl evas plugin
dnl
AC_ARG_ENABLE(evas,
[AS_HELP_STRING([--enable-evas],
[use evas output module (default disabled)])])
have_evas="no"
AS_IF([test "${enable_evas}" = "yes"], [
PKG_CHECK_MODULES(EVAS, [evas >= 1.15.99 ecore >= 1.15.99], [
have_evas="yes"
AC_DEFINE([HAVE_EVAS], [1], [Define to 1 if evas is enabled.])
],[
AS_IF([test "x${enable_evas}" != "x"], [
AC_MSG_ERROR([$EVAS_PKG_ERRORS. libevas and libecore 1.15.99 or later required.])
])
])
])
AM_CONDITIONAL([HAVE_EVAS], [test "${have_evas}" = "yes"])
dnl
dnl Audio plugins
dnl
......
......@@ -586,19 +586,6 @@ LIBVLC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
LIBVLC_API void libvlc_media_player_set_android_context( libvlc_media_player_t *p_mi,
void *p_awindow_handler );
/**
* Set the EFL Evas Object.
*
* \version LibVLC 3.0.0 and later.
*
* \param p_mi the media player
* \param p_evas_object a valid EFL Evas Object (Evas_Object)
* \return -1 if an error was detected, 0 otherwise.
*/
LIBVLC_API int libvlc_media_player_set_evas_object( libvlc_media_player_t *p_mi,
void *p_evas_object );
/**
* Callback prototype for audio playback.
*
......
......@@ -190,7 +190,6 @@ libvlc_media_player_set_agl
libvlc_media_player_set_android_context
libvlc_media_player_set_chapter
libvlc_media_player_set_equalizer
libvlc_media_player_set_evas_object
libvlc_media_player_set_hwnd
libvlc_media_player_set_media
libvlc_media_player_set_nsobject
......
......@@ -646,9 +646,6 @@ libvlc_media_player_new( libvlc_instance_t *instance )
#ifdef __ANDROID__
var_Create (mp, "drawable-androidwindow", VLC_VAR_ADDRESS);
#endif
#ifdef HAVE_EVAS
var_Create (mp, "drawable-evasobject", VLC_VAR_ADDRESS);
#endif
var_Create (mp, "keyboard-events", VLC_VAR_BOOL);
var_SetBool (mp, "keyboard-events", true);
......@@ -1269,24 +1266,6 @@ void libvlc_media_player_set_android_context( libvlc_media_player_t *p_mi,
#endif
}
/**************************************************************************
* set_evas_object
**************************************************************************/
int libvlc_media_player_set_evas_object( libvlc_media_player_t *p_mi,
void *p_evas_object )
{
assert (p_mi != NULL);
#ifdef HAVE_EVAS
var_SetString (p_mi, "vout", "evas");
var_SetString (p_mi, "window", "none");
var_SetAddress (p_mi, "drawable-evasobject", p_evas_object);
return 0;
#else
(void) p_mi; (void) p_evas_object;
return -1;
#endif
}
void libvlc_audio_set_callbacks( libvlc_media_player_t *mp,
libvlc_audio_play_cb play_cb,
libvlc_audio_pause_cb pause_cb,
......
......@@ -137,7 +137,6 @@ $Id$
* equalizer: a equalizer audio filter
* erase: Logo erase video filter
* es: input module for MPEG ES decapsulation
* evas: EFL Evas video output with Tizen TBM Surface support
* export: playlist export module
* extract: Extract RGB components video filter
* faad: AAC decoder using libfaad2
......
......@@ -427,17 +427,6 @@ libcaca_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
EXTRA_LTLIBRARIES += libcaca_plugin.la
vout_LTLIBRARIES += $(LTLIBcaca)
### EFL Evas video output ###
libevas_plugin_la_SOURCES = video_output/evas.c
libevas_plugin_la_CFLAGS = $(AM_CFLAGS) $(EVAS_CFLAGS)
libevas_plugin_la_LIBADD = $(EVAS_LIBS)
libevas_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
if HAVE_EVAS
vout_LTLIBRARIES += libevas_plugin.la
endif
### Common ###
libflaschen_plugin_la_SOURCES = video_output/flaschen.c
......
/*****************************************************************************
* evas.c: EFL Evas video output
*****************************************************************************
* Copyright (C) 2015 VLC authors, VideoLAN, and VideoLabs
*
* Authors: Thomas Guillem <thomas@gllm.fr>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_vout_display.h>
#include <vlc_picture_pool.h>
#include <vlc_filter.h>
#include <Evas.h>
#include <Ecore.h>
/* Deactivate TBM surface for now: it's impossible to specify a crop (visible
* lines/pitch) and to avoid green borders. */
#undef HAVE_TIZEN_SDK
#ifdef HAVE_TIZEN_SDK
# include <tbm_surface.h>
#endif
#if defined(EVAS_VERSION_MAJOR) && defined(EVAS_VERSION_MINOR)
# if EVAS_VERSION_MAJOR > 1 || ( EVAS_VERSION_MAJOR == 1 && EVAS_VERSION_MINOR >= 10 )
# define HAVE_EVAS_CALLBACK_KEY_UP
# endif
#endif
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define CHROMA_TEXT "Chroma used"
#define CHROMA_LONGTEXT "Force use of a specific chroma for evas image"
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
vlc_module_begin()
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_VOUT )
set_shortname( "evas" )
set_description( "evas video output" )
set_capability( "vout display", 220 )
add_shortcut( "evas" )
add_string( "evas-image-chroma", NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true )
set_callbacks( Open, Close )
vlc_module_end()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int EvasImageSetup( vout_display_t * );
#ifdef HAVE_TIZEN_SDK
static bool EvasIsOpenGLSupported( vout_display_t * );
static int TbmSurfaceSetup( vout_display_t * );
#endif
/* Buffer and Event Fifo */
struct fifo_item
{
struct fifo_item *p_next;
};
struct fifo
{
vlc_mutex_t lock;
struct fifo_item *p_first;
struct fifo_item *p_last;
};
struct buffer
{
struct fifo_item fifo_item;
uint8_t *p[PICTURE_PLANE_MAX];
bool b_locked;
#ifdef HAVE_TIZEN_SDK
tbm_surface_h p_tbm_surface;
#endif
};
struct event
{
struct fifo_item fifo_item;
int i_type;
union {
int i_key;
int i_button;
struct {
int i_x, i_y;
} point;
} u;
};
struct vout_display_sys_t
{
picture_pool_t *p_pool;
int i_width, i_height;
/* Planes */
plane_t p_planes[PICTURE_PLANE_MAX];
int i_planes_order[PICTURE_PLANE_MAX];
unsigned int i_nb_planes;
/* Array of video buffers */
struct buffer *p_buffers;
unsigned int i_nb_buffers;
/* FIFO of unlocked video buffers */
struct fifo buffer_fifo;
/* New buffer to display */
struct buffer *p_new_buffer;
/* Buffer being displayed */
struct buffer *p_current_buffer;
/* Evas */
Evas_Object *p_evas;
Ecore_Animator *p_anim;
/* If true: this module doesn't own the Evas_Object anymore */
bool b_evas_changed;
/* If true: apply rotation to vd->fmt */
bool b_apply_rotation;
/* FIFO of events */
struct fifo event_fifo;
/* lock and cond used by EcoreMainLoopCallSync */
vlc_mutex_t cb_lock;
vlc_cond_t cb_wait;
union {
struct evas
{
Evas_Colorspace i_colorspace;
bool b_yuv;
} evas;
#ifdef HAVE_TIZEN_SDK
struct {
tbm_format i_format;
int i_angle;
} tbm;
#endif
} u;
/* Specific callbacks for EvasImage or TBMSurface */
int (*pf_set_data)( vout_display_t * );
int (*pf_buffers_alloc)( vout_display_t *, video_format_t * );
void (*pf_buffers_free)( vout_display_t * );
};
struct picture_sys_t
{
vout_display_sys_t *p_vd_sys;
struct buffer *p_buffer;
};
static void
fifo_push( struct fifo *p_fifo, struct fifo_item *p_new )
{
struct fifo_item *p_last;
vlc_mutex_lock( &p_fifo->lock );
p_new->p_next = NULL;
p_last = p_fifo->p_last;
if( p_last )
p_last->p_next = p_new;
else
p_fifo->p_first = p_new;
p_fifo->p_last = p_new;
vlc_mutex_unlock( &p_fifo->lock );
}
static struct fifo_item *
fifo_pop( struct fifo *p_fifo )
{
struct fifo_item *p_new;
vlc_mutex_lock( &p_fifo->lock );
p_new = p_fifo->p_first;
if( p_new )
{
if( p_fifo->p_last == p_fifo->p_first )
p_fifo->p_first = p_fifo->p_last = NULL;
else
p_fifo->p_first = p_new->p_next;
}
vlc_mutex_unlock( &p_fifo->lock );
return p_new;
}
static void
fifo_init( struct fifo *p_fifo )
{
vlc_mutex_init( &p_fifo->lock );
p_fifo->p_first = p_fifo->p_last = NULL;
}
static void
fifo_deinit( struct fifo *p_fifo )
{
vlc_mutex_destroy( &p_fifo->lock );
}
#define BUFFER_FIFO_PUSH( buffer ) fifo_push( &sys->buffer_fifo, (struct fifo_item *)(buffer) )
#define BUFFER_FIFO_POP() (struct buffer *) fifo_pop( &sys->buffer_fifo )
#define EVENT_FIFO_PUSH( event ) fifo_push( &sys->event_fifo, (struct fifo_item *)(event) )
#define EVENT_FIFO_POP() (struct event *) fifo_pop( &sys->event_fifo )
typedef int (*mainloop_cb)( vout_display_t *vd );
struct mainloop_cb_args
{
vout_display_t *vd;
mainloop_cb p_cb;
int i_ret;
bool b_signal;
};
static void
EcoreMainLoopCb( void *p_opaque )
{
struct mainloop_cb_args *p_args = p_opaque;
vout_display_sys_t *sys = p_args->vd->sys;
p_args->i_ret = p_args->p_cb( p_args->vd );
vlc_mutex_lock( &sys->cb_lock );
p_args->b_signal = true;
vlc_cond_signal( &sys->cb_wait );
vlc_mutex_unlock( &sys->cb_lock );
}
static int
EcoreMainLoopCallSync( vout_display_t *vd, mainloop_cb p_cb )
{
vout_display_sys_t *sys = vd->sys;
struct mainloop_cb_args args = { .vd = vd, .p_cb = p_cb, .b_signal = false };
ecore_main_loop_thread_safe_call_async( EcoreMainLoopCb, &args );
vlc_mutex_lock( &sys->cb_lock );
while( !args.b_signal )
vlc_cond_wait( &sys->cb_wait, &sys->cb_lock );
vlc_mutex_unlock( &sys->cb_lock );
return args.i_ret;
}
#ifdef HAVE_EVAS_CALLBACK_KEY_UP
static void
EventSendKey( vout_display_t *vd, int i_key )
{
vout_display_sys_t *sys = vd->sys;
struct event *p_event = malloc( sizeof(struct event) );
if( !p_event )
return;
p_event->i_type = VOUT_DISPLAY_EVENT_KEY;
p_event->u.i_key = i_key;
EVENT_FIFO_PUSH( p_event );
}
static void
EvasKeyUpCb( void *data, Evas *e, Evas_Object *obj, void *event )
{
(void) e; (void) obj;
Evas_Event_Key_Up *p_key_up = (Evas_Event_Key_Up *) event;
EventSendKey( data, p_key_up->keycode );
}
#endif
static void
EventSendMouseMoved( vout_display_t *vd, int i_x, int i_y )
{
vout_display_sys_t *sys = vd->sys;
Evas_Coord i_ox, i_oy, i_ow, i_oh;
struct event *p_event = malloc( sizeof(struct event) );
if( !p_event )
return;
evas_object_geometry_get( sys->p_evas, &i_ox, &i_oy, &i_ow, &i_oh );
p_event->i_type = VOUT_DISPLAY_EVENT_MOUSE_MOVED;
p_event->u.point.i_x = ( ( i_x - i_ox ) * sys->i_width ) / i_ow;
p_event->u.point.i_y = ( ( i_y - i_oy ) * sys->i_height ) / i_oh;
EVENT_FIFO_PUSH( p_event );
}
static void
EventSendMouseButton( vout_display_t *vd, int i_type, int i_button )
{
vout_display_sys_t *sys = vd->sys;
struct event *p_event = malloc( sizeof(struct event) );
if( !p_event )
return;
p_event->i_type = i_type;
p_event->u.i_button = i_button;
EVENT_FIFO_PUSH( p_event );
}
static void
EventMouseDownCb( void *data, Evas *e, Evas_Object *obj, void *event )
{
(void) e; (void) obj;
Evas_Event_Mouse_Down *p_mouse_down = (Evas_Event_Mouse_Down *) event;
EventSendMouseButton( data, VOUT_DISPLAY_EVENT_MOUSE_PRESSED,
p_mouse_down->button - 1 );
}
static void
EvasMouseUpCb( void *data, Evas *e, Evas_Object *obj, void *event )
{
(void) e; (void) obj;
Evas_Event_Mouse_Up *p_mouse_up = (Evas_Event_Mouse_Up *) event;
EventSendMouseButton( data, VOUT_DISPLAY_EVENT_MOUSE_RELEASED,
p_mouse_up->button - 1 );
}
static void
EvasMouseMoveCb( void *data, Evas *e, Evas_Object *obj, void *event )
{
(void) e; (void) obj;
Evas_Event_Mouse_Move *p_mouse_move = (Evas_Event_Mouse_Move *) event;
EventSendMouseMoved( data, p_mouse_move->cur.canvas.x,
p_mouse_move->cur.canvas.y );
}
static void
EvasMultiDownCb( void *data, Evas *e, Evas_Object *obj, void *event )
{
(void) e; (void) obj; (void) event;
EventSendMouseButton( data, VOUT_DISPLAY_EVENT_MOUSE_PRESSED, 1 );
}
static void
EvasMultiUpCb( void *data, Evas *e, Evas_Object *obj, void *event )
{
(void) e; (void) obj; (void) event;
EventSendMouseButton( data, VOUT_DISPLAY_EVENT_MOUSE_RELEASED, 1 );
}
static void
EvasMultiMoveCb( void *data, Evas *e, Evas_Object *obj, void *event )
{
(void) e; (void) obj;
Evas_Event_Multi_Move *p_multi_move = (Evas_Event_Multi_Move *) event;
EventSendMouseMoved( data, p_multi_move->cur.canvas.x,
p_multi_move->cur.canvas.y );
}
static void
FmtUpdate( vout_display_t *vd )
{
vout_display_sys_t *sys = vd->sys;
vout_display_place_t place;
video_format_t src;
vout_display_PlacePicture( &place, &vd->source, vd->cfg, false );
if( sys->b_apply_rotation )
{
video_format_ApplyRotation( &src, &vd->source );
vd->fmt.orientation = 0;
}
else
src = vd->source;
vd->fmt.i_width = src.i_width * place.width / src.i_visible_width;
vd->fmt.i_height = src.i_height * place.height / src.i_visible_height;
vd->fmt.i_visible_width = place.width;
vd->fmt.i_visible_height = place.height;
vd->fmt.i_x_offset = src.i_x_offset * place.width / src.i_visible_width;
vd->fmt.i_y_offset = src.i_y_offset * place.height / src.i_visible_height;
sys->i_width = vd->fmt.i_visible_width;
sys->i_height = vd->fmt.i_visible_height;
}
static Eina_Bool
mainloop_evas_anim_cb( void *p_opaque )
{
vout_display_t *vd = p_opaque;
vout_display_sys_t *sys = vd->sys;
evas_object_image_pixels_dirty_set( sys->p_evas, 1 );
sys->p_anim = NULL;
return false;
}
static void
EvasResizeCb( void *data, Evas *e, Evas_Object *obj, void *event )
{
(void) e; (void) obj; (void) event;
vout_display_t *vd = data;
vout_display_sys_t *sys = vd->sys;
sys->b_evas_changed = true;
}
static int
EvasDisplayMainloopCb( vout_display_t *vd )
{
vout_display_sys_t *sys = vd->sys;
if( sys->b_evas_changed || sys->pf_set_data( vd ) )
return -1;
evas_object_image_data_update_add( sys->p_evas, 0, 0,
sys->i_width, sys->i_height );
evas_object_image_pixels_dirty_set( sys->p_evas, 0 );
if( !sys->p_anim )
sys->p_anim = ecore_animator_add( mainloop_evas_anim_cb, vd );
if( sys->p_current_buffer )
BUFFER_FIFO_PUSH( sys->p_current_buffer );
sys->p_current_buffer = sys->p_new_buffer;
sys->p_new_buffer = NULL;
return 0;
}
static int
EvasInitMainloopCb( vout_display_t *vd )
{
vout_display_sys_t *sys = vd->sys;
#ifdef HAVE_TIZEN_SDK
if( !EvasIsOpenGLSupported( vd ) || TbmSurfaceSetup( vd ) )
#endif
if( EvasImageSetup( vd ) )
return -1;
evas_object_image_alpha_set( sys->p_evas, 0 );
evas_object_image_size_set( sys->p_evas, sys->i_width, sys->i_height );
evas_object_event_callback_add( sys->p_evas, EVAS_CALLBACK_MOUSE_DOWN,
EventMouseDownCb, vd );
evas_object_event_callback_add( sys->p_evas, EVAS_CALLBACK_MOUSE_UP,
EvasMouseUpCb, vd );
evas_object_event_callback_add( sys->p_evas, EVAS_CALLBACK_MOUSE_MOVE,
EvasMouseMoveCb, vd );
evas_object_event_callback_add( sys->p_evas, EVAS_CALLBACK_MULTI_DOWN,
EvasMultiDownCb, vd );
evas_object_event_callback_add( sys->p_evas, EVAS_CALLBACK_MULTI_UP,
EvasMultiUpCb, vd );
evas_object_event_callback_add( sys->p_evas, EVAS_CALLBACK_MULTI_MOVE,
EvasMultiMoveCb, vd );
#ifdef HAVE_EVAS_CALLBACK_KEY_UP
evas_object_event_callback_add( sys->p_evas, EVAS_CALLBACK_KEY_UP,
EvasKeyUpCb, sys );
#endif
evas_object_event_callback_add( sys->p_evas, EVAS_CALLBACK_IMAGE_RESIZE,
EvasResizeCb, vd );
return 0;
}
static int
EvasDeinitMainloopCb( vout_display_t *vd )
{
vout_display_sys_t *sys = vd->sys;
if( sys->p_anim )
{
ecore_animator_del( sys->p_anim );
sys->p_anim = NULL;
}
evas_object_event_callback_del_full( sys->p_evas, EVAS_CALLBACK_IMAGE_RESIZE,
EvasResizeCb, vd );
evas_object_event_callback_del_full( sys->p_evas, EVAS_CALLBACK_MOUSE_DOWN,
EventMouseDownCb, vd );
evas_object_event_callback_del_full( sys->p_evas, EVAS_CALLBACK_MOUSE_UP,
EvasMouseUpCb, vd );
evas_object_event_callback_del_full( sys->p_evas, EVAS_CALLBACK_MOUSE_MOVE,
EvasMouseMoveCb, vd );
evas_object_event_callback_del_full( sys->p_evas, EVAS_CALLBACK_MULTI_DOWN,
EvasMultiDownCb, vd );
evas_object_event_callback_del_full( sys->p_evas, EVAS_CALLBACK_MULTI_UP,
EvasMultiUpCb, vd );
evas_object_event_callback_del_full( sys->p_evas, EVAS_CALLBACK_MULTI_MOVE,
EvasMultiMoveCb, vd );
#ifdef HAVE_EVAS_CALLBACK_KEY_UP
evas_object_event_callback_del_full( sys->p_evas, EVAS_CALLBACK_KEY_UP,
EvasKeyUpCb, vd );
#endif
if( !sys->b_evas_changed )
{
evas_object_image_data_set( sys->p_evas, NULL );
evas_object_image_pixels_dirty_set( sys->p_evas, 0 );
}
return 0;
}
static int
EvasResetMainloopCb( vout_display_t *vd )
{
vout_display_sys_t *sys = vd->sys;
if( sys->b_evas_changed )
return -1;
if( sys->p_anim )
{
ecore_animator_del( sys->p_anim );
sys->p_anim = NULL;
}
evas_object_event_callback_del_full( sys->p_evas, EVAS_CALLBACK_IMAGE_RESIZE,
EvasResizeCb, vd );
FmtUpdate( vd );
evas_object_image_data_set( sys->p_evas, NULL );
evas_object_image_size_set( sys->p_evas, sys->i_width, sys->i_height );
evas_object_event_callback_add( sys->p_evas, EVAS_CALLBACK_IMAGE_RESIZE,
EvasResizeCb, vd );
return 0;
}
static int
BuffersSetup( vout_display_t *vd, video_format_t *p_fmt,
unsigned int *p_requested_count )
{
vout_display_sys_t *sys = vd->sys;
sys->i_nb_buffers = *p_requested_count;
if( sys->pf_buffers_alloc( vd, p_fmt ) )
{
sys->i_nb_planes = 0;
return VLC_EGENERIC;
}
*p_requested_count = sys->i_nb_buffers;
for( unsigned int i = 0; i < sys->i_nb_buffers; ++i )
BUFFER_FIFO_PUSH( &sys->p_buffers[i] );
return VLC_SUCCESS;
}
static void
BuffersClean( vout_display_t *vd )
{
vout_display_sys_t *sys = vd->sys;
if( sys->p_buffers )
sys->pf_buffers_free( vd );
sys->buffer_fifo.p_first = sys->buffer_fifo.p_last = NULL;
}
static picture_t *
PictureAlloc( vout_display_t *vd )
{
vout_display_sys_t *sys = vd->sys;
picture_resource_t rsc;
picture_t *p_pic = NULL;
picture_sys_t *p_picsys = calloc(1, sizeof(*p_picsys));
if( !p_picsys )
return NULL;
p_picsys->p_vd_sys = vd->sys;
memset(&rsc, 0, sizeof(picture_resource_t));
rsc.p_sys = p_picsys;
for( unsigned int i = 0; i < sys->i_nb_planes; ++i )
{
rsc.p[i].i_lines = sys->p_planes[i].i_lines;
rsc.p[i].i_pitch = sys->p_planes[i].i_pitch;
}