[vlc-devel] [PATCH 03/12] input: add Angle Event

Steve Lhomme robux4 at ycbcr.xyz
Fri Apr 3 08:43:04 CEST 2020


On 2020-04-02 20:40, Francois Cartegnie wrote:
> ---
>   src/input/event.h          | 9 +++++++++
>   src/input/input.c          | 3 +++
>   src/input/input_internal.h | 9 +++++++++
>   3 files changed, 21 insertions(+)
> 
> diff --git a/src/input/event.h b/src/input/event.h
> index dd9aec4a87..1098227a49 100644
> --- a/src/input/event.h
> +++ b/src/input/event.h
> @@ -123,6 +123,15 @@ static inline void input_SendEventSeekpoint(input_thread_t *p_input,
>       });
>   }
>   
> +static inline void input_SendEventAngle(input_thread_t *p_input,
> +                                        unsigned char i_angle)
> +{
> +    input_SendEvent(p_input, &(struct vlc_input_event) {
> +        .type = INPUT_EVENT_ANGLE,
> +        .angle = { i_angle }
> +    });
> +}
> +
>   static inline void input_SendEventSignal(input_thread_t *p_input,
>                                            double f_quality, double f_strength)
>   {
> diff --git a/src/input/input.c b/src/input/input.c
> index 34f965ed19..74ea140d37 100644
> --- a/src/input/input.c
> +++ b/src/input/input.c
> @@ -562,6 +562,9 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed )
>               *pb_changed = true;
>           }
>   
> +        if( demux_TestAndClearFlags( p_demux, INPUT_UPDATE_ANGLE ) )
> +            input_SendEventAngle( p_input, demux_GetAngle( p_demux ) );

You're setting an int into a unsigned char. Doesn't it issue a warning ?

IMO the int should be good enough. -1 might mean no angle selected.


More information about the vlc-devel mailing list