/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <math.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#include <math.h>
+
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_interface.h>
/*****************************************************************************
* Module descriptor
*****************************************************************************/
-vlc_module_begin();
- set_shortname( N_("motion"));
- set_category( CAT_INTERFACE );
- set_description( N_("motion control interface") );
+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_bool( "motion-use-rotate", 0, NULL,
- USE_ROTATE_TEXT, USE_ROTATE_TEXT, false );
+ add_bool( "motion-use-rotate", false, NULL,
+ USE_ROTATE_TEXT, USE_ROTATE_TEXT, false )
- set_capability( "interface", 0 );
- set_callbacks( Open, Close );
-vlc_module_end();
+ set_capability( "interface", 0 )
+ set_callbacks( Open, Close )
+vlc_module_end ()
/*****************************************************************************
* OpenIntf: initialise interface
}
}
#ifdef __APPLE__
- else if( p_intf->p_sys->unimotion_hw = detect_sms() )
+ else if((p_intf->p_sys->unimotion_hw = detect_sms()))
p_intf->p_sys->sensor = UNIMOTION_SENSOR;
#endif
else
p_intf->pf_run = RunIntf;
- p_intf->p_sys->b_use_rotate = config_GetInt( p_intf, "motion-use-rotate" );
+ p_intf->p_sys->b_use_rotate =
+ var_InheritBool( p_intf, "motion-use-rotate" );
return VLC_SUCCESS;
}
int p_oldx[FILTER_LENGTH];
memset( p_oldx, 0, FILTER_LENGTH * sizeof( int ) );
- while( !intf_ShouldDie( p_intf ) )
+ for( ;; )
{
vout_thread_t *p_vout;
const char *psz_filter, *psz_type;
/* Wait a bit, get orientation, change filter if necessary */
msleep( INTF_IDLE_SLEEP );
+ int canc = vlc_savecancel();
i_x = GetOrientation( p_intf );
i_sum += i_x - p_oldx[i];
p_oldx[i++] = i_x;
vlc_object_release( p_obj );
}
}
- continue;
+ goto loop;
}
if( i_x < -HIGH_THRESHOLD && i_oldx > -LOW_THRESHOLD )
psz_type = "90";
}
- if( !b_change )
+ if( b_change )
{
- continue;
- }
+ p_vout = (vout_thread_t *)
+ vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
+ if( p_vout )
+ {
+ config_PutPsz( p_vout, "transform-type", psz_type );
+ var_SetString( p_vout, "vout-filter", psz_filter );
+ vlc_object_release( p_vout );
- p_vout = (vout_thread_t *)
- vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
- if( !p_vout )
- {
- continue;
+ i_oldx = i_x;
+ }
}
-
- config_PutPsz( p_vout, "transform-type", psz_type );
- var_SetString( p_vout, "vout-filter", psz_filter );
- vlc_object_release( p_vout );
-
- i_oldx = i_x;
+loop:
+ vlc_restorecancel( canc );
}
}
#undef FILTER_LENGTH