#include <string.h>
#include <vlc/vlc.h>
-#include <vlc/intf.h>
-#include <vlc/vout.h>
+#include <vlc_interface.h>
+#include <vlc_vout.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
{
enum { NO_SENSOR, HDAPS_SENSOR, AMS_SENSOR } sensor;
- int i_last_x, i_calibrate;
- int i_threshold;
+ int i_calibrate;
+
+ vlc_bool_t b_use_rotate;
};
/*****************************************************************************
static void RunIntf( intf_thread_t *p_intf );
static int GetOrientation( intf_thread_t *p_intf );
+#define USE_ROTATE_TEXT N_("Use the rotate video filter instead of transform")
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
set_category( CAT_INTERFACE );
set_description( _("motion control interface") );
+ add_bool( "motion-use-rotate", 0, NULL,
+ USE_ROTATE_TEXT, USE_ROTATE_TEXT, VLC_FALSE );
+
set_capability( "interface", 0 );
set_callbacks( Open, Close );
vlc_module_end();
p_intf->pf_run = RunIntf;
+ p_intf->p_sys->b_use_rotate = config_GetInt( p_intf, "motion-use-rotate" );
+
+ if( p_intf->p_sys->b_use_rotate )
+ {
+ var_Create( p_intf->p_libvlc, "rotate_angle", VLC_VAR_INTEGER );
+ }
+
return VLC_SUCCESS;
}
{
int i_x, i_oldx = 0;
- while( !p_intf->b_die )
+ while( !intf_ShouldDie( p_intf ) )
{
#define LOW_THRESHOLD 80
#define HIGH_THRESHOLD 100
vout_thread_t *p_vout;
- char *psz_filter, *psz_type;
+ const char *psz_filter, *psz_type;
vlc_bool_t b_change = VLC_FALSE;
/* Wait a bit, get orientation, change filter if necessary */
i_x = GetOrientation( p_intf );
+ if( p_intf->p_sys->b_use_rotate )
+ {
+ if( i_oldx != i_x )
+ {
+ var_SetInteger( p_intf->p_libvlc, "rotate_angle",
+ ((360+i_x/2)%360) );
+ i_oldx = i_x;
+ }
+ continue;
+ }
+
if( i_x < -HIGH_THRESHOLD && i_oldx > -LOW_THRESHOLD )
{
b_change = VLC_TRUE;