When i set the var_SetBool( p_playlist, "fullscreen", ( b_fullscreen == TRUE ) );<br><div>although the variable does change, vlc doesn't actually fullscreen.  when i looked in other files it seems when you want to set fullscreen, you need to do it via p_vout.</div>
<div>unless there is another way, which i can't seem to find.</div><div><br></div><div>Kevin<br><br><div class="gmail_quote">On Thu, Feb 9, 2012 at 9:05 AM, mirsal <span dir="ltr"><<a href="mailto:mirsal@mirsal.fr">mirsal@mirsal.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Kevin, and thanks for the patch !<br>
Comments inline.<br>
<br>
On Wed, 2012-02-08 at 21:54 -0500, Kevin Anthony wrote:<br>
> Added Fullscreen and CanSetFullscreen properties,<br>
> including the underlying methods to set properties in dbus_root<br>
> ---<br>
>  modules/control/dbus/dbus.c            |   13 ++-<br>
>  modules/control/dbus/dbus_common.h     |    3 +-<br>
>  modules/control/dbus/dbus_introspect.h |    2 +<br>
>  modules/control/dbus/dbus_root.c       |  175 ++++++++++++++++++++++++++++++++<br>
>  modules/control/dbus/dbus_root.h       |    2 +<br>
>  5 files changed, 193 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c<br>
> index 21945e2..e238870 100644<br>
> --- a/modules/control/dbus/dbus.c<br>
> +++ b/modules/control/dbus/dbus.c<br>
> @@ -531,9 +531,10 @@ static void ProcessEvents( intf_thread_t *p_intf,<br>
>      playlist_t *p_playlist = p_intf->p_sys->p_playlist;<br>
>      bool        b_can_play = p_intf->p_sys->b_can_play;<br>
><br>
> -    vlc_dictionary_t player_properties, tracklist_properties;<br>
> +    vlc_dictionary_t player_properties, tracklist_properties, root_properties;<br>
>      vlc_dictionary_init( &player_properties,    0 );<br>
>      vlc_dictionary_init( &tracklist_properties, 0 );<br>
> +    vlc_dictionary_init( &root_properties,      0 );<br>
><br>
>      for( int i = 0; i < i_events; i++ )<br>
>      {<br>
> @@ -565,6 +566,9 @@ static void ProcessEvents( intf_thread_t *p_intf,<br>
>          case SIGNAL_RANDOM:<br>
>              vlc_dictionary_insert( &player_properties, "Shuffle", NULL );<br>
>              break;<br>
> +        case SIGNAL_FULLSCREEN:<br>
> +            vlc_dictionary_insert( &root_properties, "Fullscreen", NULL );<br>
> +            break;<br>
>          case SIGNAL_REPEAT:<br>
>          case SIGNAL_LOOP:<br>
>              vlc_dictionary_insert( &player_properties, "LoopStatus", NULL );<br>
> @@ -623,8 +627,12 @@ static void ProcessEvents( intf_thread_t *p_intf,<br>
>      if( vlc_dictionary_keys_count( &tracklist_properties ) )<br>
>          TrackListPropertiesChangedEmit( p_intf, &tracklist_properties );<br>
><br>
> +    if( vlc_dictionary_keys_count( &root_properties ) )<br>
> +        RootPropertiesChangedEmit( p_intf, &root_properties );<br>
> +<br>
>      vlc_dictionary_clear( &player_properties,    NULL, NULL );<br>
>      vlc_dictionary_clear( &tracklist_properties, NULL, NULL );<br>
> +    vlc_dictionary_clear( &root_properties,      NULL, NULL );<br>
>  }<br>
><br>
>  /**<br>
> @@ -1049,6 +1057,9 @@ static int AllCallback( vlc_object_t *p_this, const char *psz_var,<br>
>      else if( !strcmp( "random", psz_var ) )<br>
>          info->signal = SIGNAL_RANDOM;<br>
><br>
> +    else if( !strcmp( "fullscreen", psz_var ) )<br>
> +        info->signal = SIGNAL_FULLSCREEN;<br>
> +<br>
<br>
The AllCallback function is not connected to any variable change event<br>
with that name. This will never be executed unless you add a proper call<br>
to AddCallback when initializing the module, which should be done in<br>
dbus.c, in the Open() function.<br>
<br>
>      else if( !strcmp( "repeat", psz_var ) )<br>
>          info->signal = SIGNAL_REPEAT;<br>
><br>
> diff --git a/modules/control/dbus/dbus_common.h b/modules/control/dbus/dbus_common.h<br>
> index c977138..30d6e2c 100644<br>
> --- a/modules/control/dbus/dbus_common.h<br>
> +++ b/modules/control/dbus/dbus_common.h<br>
> @@ -121,7 +121,8 @@ enum<br>
>      SIGNAL_CAN_SEEK,<br>
>      SIGNAL_CAN_PAUSE,<br>
>      SIGNAL_VOLUME_CHANGE,<br>
> -    SIGNAL_VOLUME_MUTED<br>
> +    SIGNAL_VOLUME_MUTED,<br>
> +    SIGNAL_FULLSCREEN<br>
>  };<br>
><br>
>  enum<br>
> diff --git a/modules/control/dbus/dbus_introspect.h b/modules/control/dbus/dbus_introspect.h<br>
> index 5056c9b..cc53e45 100644<br>
> --- a/modules/control/dbus/dbus_introspect.h<br>
> +++ b/modules/control/dbus/dbus_introspect.h<br>
> @@ -63,6 +63,8 @@ static const char* psz_introspection_xml =<br>
>  "    <property name=\"SupportedUriSchemes\" type=\"as\" access=\"read\" />\n"<br>
>  "    <property name=\"HasTrackList\" type=\"b\" access=\"read\" />\n"<br>
>  "    <property name=\"CanQuit\" type=\"b\" access=\"read\" />\n"<br>
> +"    <property name=\"CanSetFullscreen\" type=\"b\" access=\"read\" />\n"<br>
> +"    <property name=\"Fullscreen\" type=\"b\" access=\"readwrite\" />\n"<br>
>  "    <property name=\"CanRaise\" type=\"b\" access=\"read\" />\n"<br>
>  "    <method name=\"Quit\" />\n"<br>
>  "    <method name=\"Raise\" />\n"<br>
> diff --git a/modules/control/dbus/dbus_root.c b/modules/control/dbus/dbus_root.c<br>
> index 5de8af6..1b92463 100644<br>
> --- a/modules/control/dbus/dbus_root.c<br>
> +++ b/modules/control/dbus/dbus_root.c<br>
> @@ -30,6 +30,10 @@<br>
><br>
>  #include <vlc_common.h><br>
>  #include <vlc_interface.h><br>
> +#include <vlc_input.h><br>
> +#include <vlc_vout.h><br>
> +#include <vlc_plugin.h><br>
> +#include <vlc_playlist.h><br>
><br>
>  #include <unistd.h><br>
>  #include <limits.h><br>
> @@ -95,6 +99,79 @@ DBUS_METHOD( Identity )<br>
>  }<br>
><br>
>  static int<br>
> +MarshalCanSetFullscreen( intf_thread_t *p_intf, DBusMessageIter *container )<br>
> +{<br>
> +    VLC_UNUSED( p_intf );<br>
> +    const dbus_bool_t b_ret = TRUE;<br>
<br>
I am not sure that VLC's fullscreen state can be changed at all time.<br>
<br>
> +<br>
> +    dbus_message_iter_append_basic( container, DBUS_TYPE_BOOLEAN, &b_ret );<br>
> +    return VLC_SUCCESS;<br>
> +}<br>
> +<br>
> +DBUS_METHOD( CanSetFullscreen )<br>
> +{<br>
> +    REPLY_INIT;<br>
> +    OUT_ARGUMENTS;<br>
> +<br>
> +    DBusMessageIter v;<br>
> +    dbus_message_iter_open_container( &args, DBUS_TYPE_VARIANT, "b", &v );<br>
> +<br>
> +    MarshalCanSetFullscreen( p_this, &v );<br>
> +<br>
> +    if( !dbus_message_iter_close_container( &args, &v ) )<br>
> +        return DBUS_HANDLER_RESULT_NEED_MEMORY;<br>
> +<br>
> +    REPLY_SEND;<br>
> +}<br>
> +<br>
> +static void<br>
> +MarshalFullscreen( intf_thread_t *p_intf, DBusMessageIter *container )<br>
> +{<br>
> +    vout_thread_t *p_vout = (vout_thread_t *)p_intf;<br>
> +    dbus_bool_t b_fullscreen;<br>
> +    if ( p_vout ) {<br>
> +        b_fullscreen = var_GetBool( p_vout , "fullscreen" );<br>
> +    } else {<br>
> +        b_fullscreen = FALSE;<br>
> +    }<br>
<br>
Coding style (have a look at: <a href="http://wiki.videolan.org/Code_Conventions" target="_blank">http://wiki.videolan.org/Code_Conventions</a>)<br>
<br>
> +    dbus_message_iter_append_basic( container, DBUS_TYPE_BOOLEAN, &b_fullscreen );<br>
> +}<br>
> +<br>
> +DBUS_METHOD( FullscreenGet )<br>
> +{<br>
> +    REPLY_INIT;<br>
> +    OUT_ARGUMENTS;<br>
> +<br>
> +    DBusMessageIter v;<br>
> +<br>
> +    if( !dbus_message_iter_open_container( &args, DBUS_TYPE_VARIANT, "b", &v ) )<br>
> +        return DBUS_HANDLER_RESULT_NEED_MEMORY;<br>
> +<br>
> +    MarshalFullscreen( p_this, &v );<br>
> +<br>
> +    if( !dbus_message_iter_close_container( &args, &v ) )<br>
> +        return DBUS_HANDLER_RESULT_NEED_MEMORY;<br>
> +<br>
> +    REPLY_SEND;<br>
> +}<br>
> +<br>
> +DBUS_METHOD( FullscreenSet )<br>
> +{<br>
> +    REPLY_INIT;<br>
> +    dbus_bool_t b_fullscreen;<br>
> +<br>
> +    if( VLC_SUCCESS != DemarshalSetPropertyValue( p_from, &b_fullscreen ) )<br>
> +        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;<br>
> +<br>
> +    vout_thread_t *p_vout = (vout_thread_t *)p_this;<br>
<br>
This is not the right way to access the vout thread (it is done by<br>
calling input_GetVout with an input thread as an argument) and anyway<br>
you should rather use the "fullscreen" variable provided by the playlist<br>
object, which nicely hides the details of manipulating the input and<br>
vout threads away.<br>
<br>
> +<br>
> +    if ( p_vout ){<br>
> +        var_SetBool( p_vout, "fullscreen", ( b_fullscreen == TRUE ) );<br>
> +    }<br>
<br>
Coding style, and see the comment above about using the wrong variable.<br>
<br>
> +    REPLY_SEND;<br>
> +}<br>
> +<br>
> +static int<br>
>  MarshalCanQuit( intf_thread_t *p_intf, DBusMessageIter *container )<br>
>  {<br>
>      VLC_UNUSED( p_intf );<br>
> @@ -343,10 +420,38 @@ DBUS_METHOD( GetProperty )<br>
>      PROPERTY_FUNC( DBUS_MPRIS_ROOT_INTERFACE, "SupportedUriSchemes", SupportedUriSchemes )<br>
>      PROPERTY_FUNC( DBUS_MPRIS_ROOT_INTERFACE, "HasTrackList",        HasTrackList )<br>
>      PROPERTY_FUNC( DBUS_MPRIS_ROOT_INTERFACE, "CanQuit",             CanQuit )<br>
> +    PROPERTY_FUNC( DBUS_MPRIS_ROOT_INTERFACE, "CanSetFullscreen",    CanSetFullscreen )<br>
> +    PROPERTY_FUNC( DBUS_MPRIS_ROOT_INTERFACE, "Fullscreen",          FullscreenGet )<br>
>      PROPERTY_FUNC( DBUS_MPRIS_ROOT_INTERFACE, "CanRaise",            CanRaise )<br>
>      PROPERTY_MAPPING_END<br>
>  }<br>
><br>
> +DBUS_METHOD( SetProperty )<br>
> +{<br>
> +    DBusError error;<br>
> +<br>
> +    char *psz_interface_name = NULL;<br>
> +    char *psz_property_name  = NULL;<br>
> +<br>
> +    dbus_error_init( &error );<br>
> +    dbus_message_get_args( p_from, &error,<br>
> +            DBUS_TYPE_STRING, &psz_interface_name,<br>
> +            DBUS_TYPE_STRING, &psz_property_name,<br>
> +            DBUS_TYPE_INVALID );<br>
> +<br>
> +    if( dbus_error_is_set( &error ) )<br>
> +    {<br>
> +        msg_Err( (vlc_object_t*) p_this, "D-Bus message reading : %s",<br>
> +                                        error.message );<br>
> +        dbus_error_free( &error );<br>
> +        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;<br>
> +    }<br>
> +<br>
> +    PROPERTY_MAPPING_BEGIN<br>
> +    PROPERTY_FUNC( DBUS_MPRIS_ROOT_INTERFACE, "Fullscreen",    FullscreenSet )<br>
> +    PROPERTY_MAPPING_END<br>
> +}<br>
> +<br>
>  #undef PROPERTY_MAPPING_BEGIN<br>
>  #undef PROPERTY_GET_FUNC<br>
>  #undef PROPERTY_MAPPING_END<br>
> @@ -425,6 +530,7 @@ DBUS_METHOD( GetAllProperties )<br>
>      ADD_PROPERTY( SupportedUriSchemes, "as" );<br>
>      ADD_PROPERTY( HasTrackList,        "b"  );<br>
>      ADD_PROPERTY( CanQuit,             "b"  );<br>
> +    ADD_PROPERTY( CanSetFullscreen,    "b"  );<br>
>      ADD_PROPERTY( CanRaise,            "b"  );<br>
><br>
>      dbus_message_iter_close_container( &args, &dict );<br>
> @@ -444,6 +550,7 @@ handle_root ( DBusConnection *p_conn, DBusMessage *p_from, void *p_this )<br>
>  {<br>
>      METHOD_MAPPING_BEGIN<br>
>      METHOD_FUNC( DBUS_INTERFACE_PROPERTIES, "Get",          GetProperty );<br>
> +    METHOD_FUNC( DBUS_INTERFACE_PROPERTIES, "Set",          SetProperty );<br>
>      METHOD_FUNC( DBUS_INTERFACE_PROPERTIES, "GetAll",       GetAllProperties );<br>
>      METHOD_FUNC( DBUS_MPRIS_ROOT_INTERFACE, "Quit",         Quit );<br>
>      METHOD_FUNC( DBUS_MPRIS_ROOT_INTERFACE, "Raise",        Raise );<br>
> @@ -453,3 +560,71 @@ handle_root ( DBusConnection *p_conn, DBusMessage *p_from, void *p_this )<br>
>  #undef METHOD_MAPPING_BEGIN<br>
>  #undef METHOD_FUNC<br>
>  #undef METHOD_MAPPING_END<br>
> +/**<br>
> + * PropertiesChangedSignal() synthetizes and sends the<br>
> + * org.freedesktop.DBus.Properties.PropertiesChanged signal<br>
> + */<br>
> +<br>
> +static DBusHandlerResult<br>
> +PropertiesChangedSignal( intf_thread_t    *p_intf,<br>
> +                         vlc_dictionary_t *p_changed_properties )<br>
> +{<br>
> +    DBusConnection  *p_conn = p_intf->p_sys->p_conn;<br>
> +    DBusMessageIter changed_properties, invalidated_properties, entry, variant;<br>
> +    const char *psz_interface_name = DBUS_MPRIS_ROOT_INTERFACE;<br>
> +    char **ppsz_properties = NULL;<br>
> +    int i_properties = 0;<br>
> +<br>
> +    SIGNAL_INIT( DBUS_INTERFACE_PROPERTIES,<br>
> +                 DBUS_MPRIS_OBJECT_PATH,<br>
> +                 "PropertiesChanged" );<br>
> +<br>
> +    OUT_ARGUMENTS;<br>
> +    ADD_STRING( &psz_interface_name );<br>
> +    dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "{sv}",<br>
> +                                      &changed_properties );<br>
> +<br>
> +    i_properties = vlc_dictionary_keys_count( p_changed_properties );<br>
> +    ppsz_properties = vlc_dictionary_all_keys( p_changed_properties );<br>
> +<br>
> +    for( int i = 0; i < i_properties; i++ )<br>
> +    {<br>
> +        dbus_message_iter_open_container( &changed_properties,<br>
> +                                          DBUS_TYPE_DICT_ENTRY, NULL,<br>
> +                                          &entry );<br>
> +<br>
> +        dbus_message_iter_append_basic( &entry, DBUS_TYPE_STRING,<br>
> +                                        &ppsz_properties[i] );<br>
> +<br>
> +        if( !strcmp( ppsz_properties[i], "Fullscreen" ) )<br>
> +        {<br>
> +            dbus_message_iter_open_container( &entry,<br>
> +                                              DBUS_TYPE_VARIANT, "b",<br>
> +                                              &variant );<br>
> +            MarshalFullscreen( p_intf, &variant );<br>
> +            dbus_message_iter_close_container( &entry, &variant );<br>
> +        }<br>
> +        dbus_message_iter_close_container( &changed_properties, &entry );<br>
> +        free( ppsz_properties[i] );<br>
> +    }<br>
> +    dbus_message_iter_close_container( &args, &changed_properties );<br>
> +    dbus_message_iter_open_container( &args, DBUS_TYPE_ARRAY, "s",<br>
> +                                      &invalidated_properties );<br>
> +    dbus_message_iter_close_container( &args, &invalidated_properties );<br>
> +    free( ppsz_properties );<br>
> +<br>
> +    SIGNAL_SEND;<br>
> +}<br>
> +<br>
> +/*****************************************************************************<br>
> + * PropertiesChangedEmitRoot: Emits the Seeked signal<br>
> + *****************************************************************************/<br>
<br>
Wrong function name ;)<br>
<br>
> +int RootPropertiesChangedEmit( intf_thread_t    * p_intf,<br>
> +                                 vlc_dictionary_t * p_changed_properties )<br>
> +{<br>
> +    if( p_intf->p_sys->b_dead )<br>
> +        return VLC_SUCCESS;<br>
> +<br>
> +    PropertiesChangedSignal( p_intf, p_changed_properties );<br>
> +    return VLC_SUCCESS;<br>
> +}<br>
> diff --git a/modules/control/dbus/dbus_root.h b/modules/control/dbus/dbus_root.h<br>
> index 38267ee..86adaed 100644<br>
> --- a/modules/control/dbus/dbus_root.h<br>
> +++ b/modules/control/dbus/dbus_root.h<br>
> @@ -36,5 +36,7 @@<br>
>  DBusHandlerResult handle_root ( DBusConnection *p_conn,<br>
>                                  DBusMessage *p_from,<br>
>                                  void *p_this );<br>
> +int RootPropertiesChangedEmit ( intf_thread_t *,<br>
<br>
Trailing whitespace<br>
<br>
> +                                vlc_dictionary_t * );<br>
><br>
>  #endif //dbus-root.h<br>
<br>
These are trivial changes, so I can just amend your patch myself if you want.<br>
<br>
Thanks !<br>
All the best,<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
mirsal<br>
<br>
</font></span><br>_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="http://mailman.videolan.org/listinfo/vlc-devel" target="_blank">http://mailman.videolan.org/listinfo/vlc-devel</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks<br>Kevin Anthony<br><a href="http://www.NoSideRacing.com" target="_blank">www.NoSideRacing.com</a><div><br><div>Do you use Banshee?</div></div><div>
Download the Community Extensions:</div><div><a href="http://banshee.fm/download/extensions/" target="_blank">http://banshee.fm/download/extensions/</a></div><br>
</div>