]> git.sesse.net Git - vlc/commitdiff
Remove interaction core
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 8 Mar 2009 20:49:50 +0000 (22:49 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 8 Mar 2009 20:55:10 +0000 (22:55 +0200)
One useless thread gone (the new subsystem does not need a thread).

include/vlc_common.h
include/vlc_interface.h
src/Makefile.am
src/interface/interaction.c [deleted file]
src/interface/interface.h [deleted file]
src/libvlc.c
src/libvlc.h
src/libvlccore.sym

index 931c3ac0b747a0ff47dd1b570b3b5c1ec97b76bb..e5fdd7f1d7ce7087858824197375a8db8e47b539 100644 (file)
@@ -180,8 +180,6 @@ typedef struct config_category_t config_category_t;
 typedef struct intf_thread_t intf_thread_t;
 typedef struct intf_sys_t intf_sys_t;
 typedef struct intf_msg_t intf_msg_t;
-typedef struct interaction_t interaction_t;
-typedef struct interaction_dialog_t interaction_dialog_t;
 typedef struct user_widget_t user_widget_t;
 
 /* Input */
index c6856c9e78dcf0983a8c77e56af53c7bb524a405..8bf1fa246a8f7d5a1b34b926f4437ed530c1e87a 100644 (file)
@@ -92,7 +92,7 @@ struct intf_dialog_args_t
     bool b_multiple;
 
     /* Specific to INTF_DIALOG_INTERACTION */
-    interaction_dialog_t *p_dialog;
+    struct interaction_dialog_t *p_dialog;
 };
 
 /*****************************************************************************
@@ -108,9 +108,6 @@ VLC_EXPORT( int, __intf_Eject, ( vlc_object_t *, const char * ) );
 
 VLC_EXPORT( void, libvlc_Quit, ( libvlc_int_t * ) );
 
-VLC_EXPORT( int, interaction_Register, ( intf_thread_t * ) );
-VLC_EXPORT( int, interaction_Unregister, ( intf_thread_t * ) );
-
 /*@}*/
 
 /*****************************************************************************
@@ -198,7 +195,7 @@ typedef enum vlc_dialog {
 /**
  * This structure describes a piece of interaction with the user
  */
-struct interaction_dialog_t
+typedef struct interaction_dialog_t
 {
     int             i_type;             ///< Type identifier
     char           *psz_title;          ///< Title
@@ -225,7 +222,7 @@ struct interaction_dialog_t
                                         //for interaction
     intf_thread_t  *p_interface;
     vlc_mutex_t    *p_lock;
-};
+} interaction_dialog_t;
 
 /**
  * Possible flags . Dialog types
@@ -242,7 +239,6 @@ struct interaction_dialog_t
 /** Possible return codes */
 enum
 {
-    DIALOG_DEFAULT,
     DIALOG_OK_YES,
     DIALOG_NO,
     DIALOG_CANCELLED
@@ -251,21 +247,10 @@ enum
 /** Possible status  */
 enum
 {
-    SENT_DIALOG=1,                ///< Sent to interface
-    UPDATED_DIALOG,             ///< Update to send
     ANSWERED_DIALOG,            ///< Got "answer"
-    HIDING_DIALOG,              ///< Hiding requested
-    HIDDEN_DIALOG,              ///< Now hidden. Requesting destruction
     DESTROYED_DIALOG,           ///< Interface has destroyed it
 };
 
-/** Possible interaction types */
-enum
-{
-    INTERACT_DIALOG_ONEWAY,     ///< Dialog box without feedback
-    INTERACT_DIALOG_TWOWAY,     ///< Dialog box with feedback
-};
-
 /** Possible actions */
 enum
 {
@@ -275,11 +260,10 @@ enum
     INTERACT_DESTROY
 };
 
-/***************************************************************************
- * Exported symbols
- ***************************************************************************/
-
 #define intf_UserStringInput( a, b, c, d ) (VLC_OBJECT(a),b,c,d, VLC_EGENERIC)
+#define interaction_Register( t ) (t, VLC_EGNERIC)
+#define interaction_Unregister( t ) (t, VLC_EGENERIC)
+
 
 /** @} */
 /** @} */
index 32206ec26391874fc76c8675eefa2b2a4b5b1134..ef2f3e36b9aaa6c82bf93263fd5bd80a5657ae69 100644 (file)
@@ -266,10 +266,8 @@ SOURCES_libvlc_common = \
        missing.c \
        version.c \
        interface/dialog.c \
-       interface/interface.h \
        interface/interface.c \
        interface/intf_eject.c \
-       interface/interaction.c \
        playlist/playlist_internal.h \
        playlist/art.c \
        playlist/art.h \
diff --git a/src/interface/interaction.c b/src/interface/interaction.c
deleted file mode 100644 (file)
index 9057569..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/*****************************************************************************
- * interaction.c: User interaction functions
- *****************************************************************************
- * Copyright © 2005-2008 the VideoLAN team
- * $Id$
- *
- * Authors: Clément Stenac <zorglub@videolan.org>
- *          Felix Kühne <fkuehne@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/**
- *   \file
- *   This file contains functions related to user interaction management
- */
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-
-#include <vlc_interface.h>
-#include "interface.h"
-#include "libvlc.h"
-
-#include <assert.h>
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-
-/**
- * This structure contains the active interaction dialogs, and is
- * used by the manager
- */
-struct interaction_t
-{
-    VLC_COMMON_MEMBERS
-
-    vlc_thread_t thread;
-    vlc_mutex_t lock;
-    vlc_cond_t wait;
-
-    int                         i_dialogs;      ///< Number of dialogs
-    interaction_dialog_t      **pp_dialogs;     ///< Dialogs
-    intf_thread_t              *p_intf;         ///< Interface to use
-};
-
-static void*                    InteractionLoop( void * );
-static void                     InteractionManage( interaction_t * );
-
-static void                     DialogDestroy( interaction_dialog_t * );
-
-#define DIALOG_INIT( type, err ) \
-        interaction_dialog_t* p_new = calloc( 1, sizeof( interaction_dialog_t ) ); \
-        if( !p_new ) return err;                        \
-        p_new->p_parent = vlc_object_hold( p_this );    \
-        p_new->b_cancelled = false;                     \
-        p_new->i_status = SENT_DIALOG;                  \
-        p_new->i_flags = 0;                             \
-        p_new->i_type = INTERACT_DIALOG_##type;         \
-        p_new->psz_returned[0] = NULL;                  \
-        p_new->psz_returned[1] = NULL
-
-/**
- * Create the initial interaction object
- * (should only be used in libvlc_InternalInit, LibVLC private)
- *
- * \return a vlc_object_t that should be freed when done.
- */
-interaction_t * interaction_Init( libvlc_int_t *p_libvlc )
-{
-    interaction_t *p_interaction;
-
-    /* Make sure we haven't yet created an interaction object */
-    assert( libvlc_priv(p_libvlc)->p_interaction == NULL );
-
-    p_interaction = vlc_custom_create( VLC_OBJECT(p_libvlc),
-                                       sizeof( *p_interaction ),
-                                       VLC_OBJECT_GENERIC, "interaction" );
-    if( !p_interaction )
-        return NULL;
-
-    vlc_object_attach( p_interaction, p_libvlc );
-    p_interaction->i_dialogs = 0;
-    p_interaction->pp_dialogs = NULL;
-    p_interaction->p_intf = NULL;
-
-    vlc_mutex_init( &p_interaction->lock );
-    vlc_cond_init( &p_interaction->wait );
-
-    if( vlc_clone( &p_interaction->thread, InteractionLoop, p_interaction,
-                   VLC_THREAD_PRIORITY_LOW ) )
-    {
-        msg_Err( p_interaction, "Interaction control thread creation failed, "
-                 "interaction will not be displayed" );
-        vlc_object_detach( p_interaction );
-        vlc_object_release( p_interaction );
-        return NULL;
-    }
-
-    return p_interaction;
-}
-
-void interaction_Destroy( interaction_t *p_interaction )
-{
-    if( !p_interaction )
-        return;
-
-    vlc_cancel( p_interaction->thread );
-    vlc_join( p_interaction->thread, NULL );
-    vlc_cond_destroy( &p_interaction->wait );
-    vlc_mutex_destroy( &p_interaction->lock );
-
-    /* Remove all dialogs - Interfaces must be able to clean up their data */
-    for( int i = p_interaction->i_dialogs -1 ; i >= 0; i-- )
-    {
-        interaction_dialog_t * p_dialog = p_interaction->pp_dialogs[i];
-        DialogDestroy( p_dialog );
-        REMOVE_ELEM( p_interaction->pp_dialogs, p_interaction->i_dialogs, i );
-    }
-    vlc_object_release( p_interaction );
-}
-
-static vlc_mutex_t intf_lock = VLC_STATIC_MUTEX;
-
-int interaction_Register( intf_thread_t *intf )
-{
-    libvlc_priv_t *priv = libvlc_priv( intf->p_libvlc );
-    int ret = VLC_EGENERIC;
-
-    vlc_mutex_lock( &intf_lock );
-    if( priv->p_interaction_intf == NULL )
-    {   /* Since the interface is responsible for unregistering itself before
-         * it terminates, an object reference is not needed. */
-        priv->p_interaction_intf = intf;
-        ret = VLC_SUCCESS;
-    }
-    vlc_mutex_unlock( &intf_lock );
-    return ret;
-}
-
-int interaction_Unregister( intf_thread_t *intf )
-{
-    libvlc_priv_t *priv = libvlc_priv( intf->p_libvlc );
-    int ret = VLC_EGENERIC;
-
-    vlc_mutex_lock( &intf_lock );
-    if( priv->p_interaction_intf == intf )
-    {
-        priv->p_interaction_intf = NULL;
-        ret = VLC_SUCCESS;
-    }
-    vlc_mutex_unlock( &intf_lock );
-    return ret;
-}
-
-/**********************************************************************
- * The following functions are local
- **********************************************************************/
-
-/* Destroy a dialog */
-static void DialogDestroy( interaction_dialog_t *p_dialog )
-{
-    free( p_dialog->psz_title );
-    free( p_dialog->psz_description );
-    free( p_dialog->psz_alternate_button );
-    vlc_object_release( p_dialog->p_parent );
-    free( p_dialog );
-}
-
-static void* InteractionLoop( void *p_this )
-{
-    interaction_t *p_interaction = p_this;
-
-    vlc_mutex_lock( &p_interaction->lock );
-    mutex_cleanup_push( &p_interaction->lock );
-    for( ;; )
-    {
-        int canc = vlc_savecancel();
-        InteractionManage( p_interaction );
-        vlc_restorecancel( canc );
-
-        vlc_cond_wait( &p_interaction->wait, &p_interaction->lock );
-    }
-    vlc_cleanup_pop( );
-    assert( 0 );
-}
-
-/**
- * The main interaction processing loop
- *
- * \param p_interaction the interaction object
- * \return nothing
- */
-
-static void InteractionManage( interaction_t *p_interaction )
-{
-    vlc_value_t val;
-    int i_index;
-
-    for( i_index = 0 ; i_index < p_interaction->i_dialogs; i_index ++ )
-    {
-        interaction_dialog_t *p_dialog = p_interaction->pp_dialogs[i_index];
-        switch( p_dialog->i_status )
-        {
-        case ANSWERED_DIALOG:
-            /* Ask interface to hide it */
-            p_dialog->i_action = INTERACT_HIDE;
-            val.p_address = p_dialog;
-            var_Set( p_dialog->p_interface, "interaction", val );
-            p_dialog->i_status = HIDING_DIALOG;
-            break;
-        case UPDATED_DIALOG:
-            p_dialog->i_action = INTERACT_UPDATE;
-            val.p_address = p_dialog;
-            var_Set( p_dialog->p_interface, "interaction", val );
-            p_dialog->i_status = SENT_DIALOG;
-            break;
-        case HIDDEN_DIALOG:
-            if( !(p_dialog->i_flags & DIALOG_GOT_ANSWER) ) break;
-            p_dialog->i_action = INTERACT_DESTROY;
-            val.p_address = p_dialog;
-            var_Set( p_dialog->p_interface, "interaction", val );
-            break;
-        case DESTROYED_DIALOG:
-            /* Interface has now destroyed it, remove it */
-            REMOVE_ELEM( p_interaction->pp_dialogs, p_interaction->i_dialogs,
-                         i_index);
-            i_index--;
-            DialogDestroy( p_dialog );
-            break;
-        }
-    }
-}
diff --git a/src/interface/interface.h b/src/interface/interface.h
deleted file mode 100644 (file)
index 6401ccd..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*****************************************************************************
- * interface.h: Internal interface prototypes and structures
- *****************************************************************************
- * Copyright (C) 1998-2006 the VideoLAN team
- * $Id$
- *
- * Authors: Vincent Seguin <seguin@via.ecp.fr>
- *          Clément Stenac <zorglub@videolan.org>
- *          Felix Kühne <fkuehne@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#if defined(__PLUGIN__) || defined(__BUILTIN__) || !defined(__LIBVLC__)
-# error This header file can only be included from LibVLC.
-#endif
-
-#ifndef __LIBVLC_INTERFACE_H
-# define __LIBVLC_INTERFACE_H 1
-
-/**********************************************************************
- * Interaction
- **********************************************************************/
-
-interaction_t * interaction_Init( libvlc_int_t *p_libvlc );
-void interaction_Destroy( interaction_t * );
-
-#endif
index f90994d435b3372c63eceff3fb83fb83053b94aa..2f1e641102d16bb6473c24e469b1194ac8670213 100644 (file)
@@ -42,7 +42,6 @@
 
 #include "modules/modules.h"
 #include "config/configuration.h"
-#include "interface/interface.h"
 
 #include <errno.h>                                                 /* ENOMEM */
 #include <stdio.h>                                              /* sprintf() */
@@ -258,7 +257,6 @@ libvlc_int_t * libvlc_InternalCreate( void )
 
     priv = libvlc_priv (p_libvlc);
     priv->p_playlist = NULL;
-    priv->p_interaction = NULL;
     priv->p_dialog_provider = NULL;
     priv->p_vlm = NULL;
     p_libvlc->psz_object_name = strdup( "libvlc" );
@@ -805,9 +803,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     var_AddCallback( p_libvlc, "key-pressed", vlc_key_to_action,
                      p_libvlc->p_hotkeys );
 
-    /* Initialize interaction */
-    priv->p_interaction = interaction_Init( p_libvlc );
-
     /* Initialize playlist and get commandline files */
     p_playlist = playlist_Create( VLC_OBJECT(p_libvlc) );
     if( !p_playlist )
@@ -1063,10 +1058,6 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
 
     vlc_object_release( p_playlist );
 
-    /* Free interaction */
-    msg_Dbg( p_libvlc, "removing interaction" );
-    interaction_Destroy( priv->p_interaction );
-
     stats_TimersDumpAll( p_libvlc );
     stats_TimersCleanAll( p_libvlc );
 
index bb010f6d65540732b9bded61454de1abc94873de..4e434121f777e3b131e1909385dc7f6a26664b9d 100644 (file)
@@ -220,8 +220,6 @@ typedef struct libvlc_priv_t
     module_t          *p_memcpy_module;  ///< Fast memcpy plugin used
     playlist_t        *p_playlist; //< the playlist singleton
     vlm_t             *p_vlm;  ///< the VLM singleton (or NULL)
-    interaction_t     *p_interaction;    ///< old interaction object
-    intf_thread_t     *p_interaction_intf; ///< old interface for interaction
     vlc_object_t      *p_dialog_provider; ///< dialog provider
     httpd_t           *p_httpd; ///< HTTP daemon (src/network/httpd.c)
 #ifdef ENABLE_SOUT
index 9ae4f7933138185c051b6a1f7f1ee585a9f4db06..49be4e6c0b1f42e627bd65bb56f9eb16cfdcc9a3 100644 (file)
@@ -195,8 +195,6 @@ __input_Read
 input_SplitMRL
 input_StopThread
 input_vaControl
-interaction_Register
-interaction_Unregister
 __intf_Create
 __intf_Eject
 intf_RunThread