[vlc-devel] [PATCH] motion: remove control interface

Rémi Denis-Courmont remi at remlab.net
Sun Mar 3 19:40:25 CET 2019


The fun part has been supported by the rotation filter for 7 years.

The serious part should be handled by the GUI and/or the video window,
under control of the operating system or windowing system.
---
 modules/MODULES_LIST        |   1 -
 modules/control/Makefile.am |  10 --
 modules/control/motion.c    | 194 ------------------------------------
 po/POTFILES.in              |   1 -
 4 files changed, 206 deletions(-)
 delete mode 100644 modules/control/motion.c

diff --git a/modules/MODULES_LIST b/modules/MODULES_LIST
index 7ec47e71d1..0de973a9cc 100644
--- a/modules/MODULES_LIST
+++ b/modules/MODULES_LIST
@@ -244,7 +244,6 @@ $Id$
  * mod: MOD demuxer
  * mono: stereo-to-mono downmix simple channel mixer
  * mosaic: Module used to display a mosaic
- * motion: Motion control interface
  * motionblur: Motion blur filter
  * motiondetect: Motion detection filter
  * mp4: MP4 file input module
diff --git a/modules/control/Makefile.am b/modules/control/Makefile.am
index 2469a86190..eb734d05ce 100644
--- a/modules/control/Makefile.am
+++ b/modules/control/Makefile.am
@@ -30,16 +30,6 @@ endif
 libvlc_motion_la_LDFLAGS = -static
 noinst_LTLIBRARIES += libvlc_motion.la
 
-libmotion_plugin_la_SOURCES = control/motion.c
-libmotion_plugin_la_LIBADD = libvlc_motion.la
-libmotion_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(controldir)'
-if HAVE_DARWIN
-libmotion_plugin_la_LDFLAGS += -Wl,-framework,IOKit,-framework,CoreFoundation
-endif
-if !HAVE_WIN32
-control_LTLIBRARIES += libmotion_plugin.la
-endif
-
 libdbus_plugin_la_SOURCES = \
 	control/dbus/dbus_introspect.h control/dbus/dbus_common.h \
 	control/dbus/dbus_root.c control/dbus/dbus_root.h \
diff --git a/modules/control/motion.c b/modules/control/motion.c
deleted file mode 100644
index 086936c82c..0000000000
--- a/modules/control/motion.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*****************************************************************************
- * motion.c: control VLC with laptop built-in motion sensors
- *****************************************************************************
- * Copyright (C) 2006 - 2007 the VideoLAN team
- *
- * Author: Sam Hocevar <sam at zoy.org>
- *         Jérôme Decoodt <djc at videolan.org> (unimotion integration)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU 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.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <assert.h>
-#include <unistd.h>
-
-#define VLC_MODULE_LICENSE VLC_LICENSE_GPL_2_PLUS
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-#include <vlc_interface.h>
-#include <vlc_playlist_legacy.h>
-#include <vlc_input.h>
-#include <vlc_vout.h>
-
-#include "motionlib.h"
-
-/*****************************************************************************
- * intf_sys_t: description and status of interface
- *****************************************************************************/
-struct intf_sys_t
-{
-    motion_sensors_t *p_motion;
-    vlc_thread_t thread;
-};
-
-/*****************************************************************************
- * Local prototypes.
- *****************************************************************************/
-static int  Open   ( vlc_object_t * );
-static void Close  ( vlc_object_t * );
-
-static void *RunIntf( void * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin ()
-    set_shortname( N_("motion"))
-    set_category( CAT_INTERFACE )
-    set_subcategory( SUBCAT_INTERFACE_CONTROL )
-    set_description( N_("motion control interface") )
-    set_help( N_("Use HDAPS, AMS, APPLESMC or UNIMOTION motion sensors " \
-                 "to rotate the video") )
-
-    add_obsolete_bool( "motion-use-rotate" ) /* since 2.1.0 */
-
-    set_capability( "interface", 0 )
-    set_callbacks( Open, Close )
-vlc_module_end ()
-
-/*****************************************************************************
- * OpenIntf: initialise interface
- *****************************************************************************/
-static int Open ( vlc_object_t *p_this )
-{
-    intf_thread_t *p_intf = (intf_thread_t *)p_this;
-    intf_sys_t *p_sys = malloc( sizeof( *p_sys ) );
-    if( unlikely(p_sys == NULL) )
-        return VLC_ENOMEM;
-
-    p_sys->p_motion = motion_create( VLC_OBJECT( p_intf ) );
-    if( p_sys->p_motion == NULL )
-    {
-error:
-        free( p_sys );
-        return VLC_EGENERIC;
-    }
-
-    p_intf->p_sys = p_sys;
-
-    if( vlc_clone( &p_sys->thread, RunIntf, p_intf, VLC_THREAD_PRIORITY_LOW ) )
-    {
-        motion_destroy( p_sys->p_motion );
-        goto error;
-    }
-
-    return VLC_SUCCESS;
-}
-
-/*****************************************************************************
- * CloseIntf: destroy interface
- *****************************************************************************/
-static void Close ( vlc_object_t *p_this )
-{
-    intf_thread_t *p_intf = (intf_thread_t *)p_this;
-    intf_sys_t *p_sys = p_intf->p_sys;
-
-    vlc_cancel( p_sys->thread );
-    vlc_join( p_sys->thread, NULL );
-    motion_destroy( p_sys->p_motion );
-    free( p_sys );
-}
-
-/*****************************************************************************
- * RunIntf: main loop
- *****************************************************************************/
-#define LOW_THRESHOLD 800
-#define HIGH_THRESHOLD 1000
-static void *RunIntf( void *data )
-{
-    intf_thread_t *p_intf = data;
-    int i_oldx = 0;
-
-    for( ;; )
-    {
-        const char *psz_type;
-        bool b_change = false;
-
-        /* Wait a bit, get orientation, change filter if necessary */
-#warning FIXME: check once (or less) per picture, not once per interval
-        vlc_tick_sleep( INTF_IDLE_SLEEP );
-
-        int canc = vlc_savecancel();
-        int i_x = motion_get_angle( p_intf->p_sys->p_motion );
-
-        if( i_x < -HIGH_THRESHOLD && i_oldx > -LOW_THRESHOLD )
-        {
-            b_change = true;
-            psz_type = "90";
-        }
-        else if( ( i_x > -LOW_THRESHOLD && i_oldx < -HIGH_THRESHOLD )
-                 || ( i_x < LOW_THRESHOLD && i_oldx > HIGH_THRESHOLD ) )
-        {
-            b_change = true;
-            psz_type = NULL;
-        }
-        else if( i_x > HIGH_THRESHOLD && i_oldx < LOW_THRESHOLD )
-        {
-            b_change = true;
-            psz_type = "270";
-        }
-
-        if( b_change )
-        {
-#warning FIXME: refactor this plugin as a video filter!
-            input_thread_t *p_input = pl_CurrentInput( p_intf );
-            if( p_input )
-            {
-                vout_thread_t *p_vout;
-
-                p_vout = input_GetVout( p_input );
-                if( p_vout )
-                {
-                    if( psz_type != NULL )
-                    {
-                        var_Create( p_vout, "transform-type", VLC_VAR_STRING );
-                        var_SetString( p_vout, "transform-type", psz_type );
-                    }
-                    else
-                        var_Destroy( p_vout, "transform-type" );
-
-                    var_SetString( p_vout, "video-filter",
-                                   psz_type != NULL ? "transform" : "" );
-                    vlc_object_release( p_vout );
-                }
-                vlc_object_release( p_input );
-                i_oldx = i_x;
-            }
-        }
-
-        vlc_restorecancel( canc );
-    }
-    vlc_assert_unreachable();
-}
-#undef LOW_THRESHOLD
-#undef HIGH_THRESHOLD
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a45e6a1d2e..746aa430b3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -375,7 +375,6 @@ modules/control/globalhotkeys/xcb.c
 modules/control/hotkeys.c
 modules/control/intromsg.h
 modules/control/lirc.c
-modules/control/motion.c
 modules/control/netsync.c
 modules/control/ntservice.c
 modules/control/oldrc.c
-- 
2.20.1



More information about the vlc-devel mailing list