[vlc-devel] [PATCH] libvlc: libvlc_ScrambledChanged event type added
Rémi Denis-Courmont
remi at remlab.net
Thu Feb 6 18:57:44 CET 2014
Please check your compiler output, before you post a patch.
Just from looking at the patch, I smell a missing prototype.
Le jeudi 6 février 2014, 15:31:18 Julian Scheel a écrit :
> Expose an event to libvlc users which allows them to get notified about the
> current program scrambling status.
>
> Signed-off-by: Julian Scheel <julian at jusst.de>
> ---
> include/vlc/libvlc_events.h | 5 +++++
> lib/media_player.c | 41 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 46 insertions(+)
>
> diff --git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h
> index dab6b51..f03c29f 100644
> --- a/include/vlc/libvlc_events.h
> +++ b/include/vlc/libvlc_events.h
> @@ -74,6 +74,7 @@ enum libvlc_event_e {
> libvlc_MediaPlayerLengthChanged,
> libvlc_MediaPlayerVout,
> libvlc_MediaPlayerTeletextChanged,
> + libvlc_MediaPlayerScrambledChanged,
>
> libvlc_MediaListItemAdded=0x200,
> libvlc_MediaListWillAddItem,
> @@ -171,6 +172,10 @@ typedef struct libvlc_event_t
> } media_player_pausable_changed;
> struct
> {
> + int new_scrambled;
> + } media_player_scrambled_changed;
> + struct
> + {
> int new_count;
> } media_player_vout;
>
> diff --git a/lib/media_player.c b/lib/media_player.c
> index 7494e35..a5c5d65 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -49,6 +49,10 @@ input_pausable_changed( vlc_object_t * p_this, char const
> * psz_cmd, vlc_value_t oldval, vlc_value_t newval,
> void * p_userdata );
> static int
> +input_scrambled_changed( vlc_object_t * p_this, char const * psz_cmd,
> + vlc_value_t oldval, vlc_value_t newval,
> + void * p_userdata );
> +static int
> input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
> vlc_value_t oldval, vlc_value_t newval,
> void * p_userdata );
> @@ -117,6 +121,8 @@ static void release_input_thread( libvlc_media_player_t
> *p_mi, bool b_input_abor input_seekable_changed, p_mi );
> var_DelCallback( p_input_thread, "can-pause",
> input_pausable_changed, p_mi );
> + var_DelCallback( p_input_thread, "program-scrambled",
> + input_scrambled_changed, p_mi );
> var_DelCallback( p_input_thread, "intf-event",
> input_event_changed, p_mi );
>
> @@ -212,6 +218,24 @@ input_pausable_changed( vlc_object_t * p_this, char
> const * psz_cmd, }
>
> static int
> +input_scrambled_changed( vlc_object_t * p_this, char const * psz_cmd,
> + vlc_value_t oldval, vlc_value_t newval,
> + void * p_userdata )
> +{
> + VLC_UNUSED(oldval);
> + VLC_UNUSED(p_this);
> + VLC_UNUSED(psz_cmd);
> + libvlc_media_player_t * p_mi = p_userdata;
> + libvlc_event_t event;
> +
> + event.type = libvlc_MediaPlayerScrambledChanged;
> + event.u.media_player_scrambled_changed.new_scrambled = newval.b_bool;
> +
> + libvlc_event_send( p_mi->p_event_manager, &event );
> + return VLC_SUCCESS;
> +}
> +
> +static int
> input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
> vlc_value_t oldval, vlc_value_t newval,
> void * p_userdata )
> @@ -516,6 +540,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
>
> register_event(mp, Vout);
> register_event(mp, TeletextChanged);
> + register_event(mp, ScrambledChanged);
>
> /* Snapshot initialization */
> register_event(mp, SnapshotTaken);
> @@ -726,6 +751,7 @@ int libvlc_media_player_play( libvlc_media_player_t
> *p_mi )
>
> var_AddCallback( p_input_thread, "can-seek", input_seekable_changed,
> p_mi ); var_AddCallback( p_input_thread, "can-pause",
> input_pausable_changed, p_mi ); + var_AddCallback( p_input_thread,
> "program-scrambled", input_scrambled_changed, p_mi ); var_AddCallback(
> p_input_thread, "intf-event", input_event_changed, p_mi );
>
> if( input_Start( p_input_thread ) )
> @@ -733,6 +759,7 @@ int libvlc_media_player_play( libvlc_media_player_t
> *p_mi ) unlock_input(p_mi);
> var_DelCallback( p_input_thread, "intf-event", input_event_changed,
> p_mi ); var_DelCallback( p_input_thread, "can-pause",
> input_pausable_changed, p_mi ); + var_DelCallback( p_input_thread,
> "program-scrambled", input_scrambled_changed, p_mi ); var_DelCallback(
> p_input_thread, "can-seek", input_seekable_changed, p_mi );
> vlc_object_release( p_input_thread );
> libvlc_printerr( "Input initialization failure" );
> @@ -1389,6 +1416,20 @@ int libvlc_media_player_can_pause(
> libvlc_media_player_t *p_mi ) return b_can_pause;
> }
>
> +int libvlc_media_player_program_scrambled( libvlc_media_player_t *p_mi )
> +{
> + input_thread_t *p_input_thread;
> + bool b_program_scrambled;
> +
> + p_input_thread = libvlc_get_input_thread ( p_mi );
> + if ( !p_input_thread )
> + return false;
> + b_program_scrambled = var_GetBool( p_input_thread, "program-scrambled"
> ); + vlc_object_release( p_input_thread );
> +
> + return b_program_scrambled;
> +}
> +
> void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi )
> {
> input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list