intf_dummy.c 4.39 KB
Newer Older
1 2 3
/*****************************************************************************
 * intf_dummy.c: dummy interface plugin
 *****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
4
 * Copyright (C) 2000, 2001 VideoLAN
5
 *
Sam Hocevar's avatar
 
Sam Hocevar committed
6
 * Authors: Samuel Hocevar <sam@zoy.org>
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
 *
 * 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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/
#include "defs.h"

#include <stdlib.h>                                      /* malloc(), free() */

#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
Sam Hocevar's avatar
 
Sam Hocevar committed
34 35
#include "tests.h"
#include "modules.h"
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

#include "intf_msg.h"
#include "interface.h"

#include "main.h"

/*****************************************************************************
 * intf_sys_t: description and status of FB interface
 *****************************************************************************/
typedef struct intf_sys_s
{

} intf_sys_t;

/*****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
 * Local prototypes.
 *****************************************************************************/
static int  intf_Probe     ( probedata_t *p_data );
static int  intf_Open      ( intf_thread_t *p_intf );
static void intf_Close     ( intf_thread_t *p_intf );
static void intf_Run       ( intf_thread_t *p_intf );

/*****************************************************************************
 * Functions exported as capabilities. They are declared as static so that
 * we don't pollute the namespace too much.
 *****************************************************************************/
void intf_getfunctions( function_list_t * p_function_list )
{
    p_function_list->pf_probe = intf_Probe;
    p_function_list->functions.intf.pf_open  = intf_Open;
    p_function_list->functions.intf.pf_close = intf_Close;
    p_function_list->functions.intf.pf_run   = intf_Run;
}

/*****************************************************************************
 * intf_Probe: probe the interface and return a score
 *****************************************************************************
 * This function tries to initialize Gnome and returns a score to the
 * plugin manager so that it can select the best plugin.
 *****************************************************************************/
static int intf_Probe( probedata_t *p_data )
{
    if( TestMethod( INTF_METHOD_VAR, "dummy" ) )
    {
        return( 999 );
    }

    return( 1 );
}

/*****************************************************************************
 * intf_Open: initialize dummy interface
88
 *****************************************************************************/
Sam Hocevar's avatar
 
Sam Hocevar committed
89
static int intf_Open( intf_thread_t *p_intf )
90 91 92 93 94 95 96 97 98 99 100 101
{
    /* Allocate instance and initialize some members */
    p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
    if( p_intf->p_sys == NULL )
    {
        return( 1 );
    };

    return( 0 );
}

/*****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
102
 * intf_Close: destroy dummy interface
103
 *****************************************************************************/
Sam Hocevar's avatar
 
Sam Hocevar committed
104
static void intf_Close( intf_thread_t *p_intf )
105 106 107 108 109 110 111
{
    /* Destroy structure */
    free( p_intf->p_sys );
}


/*****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
112
 * intf_Run: main loop
113
 *****************************************************************************/
Sam Hocevar's avatar
 
Sam Hocevar committed
114
static void intf_Run( intf_thread_t *p_intf )
115
{
Sam Hocevar's avatar
 
Sam Hocevar committed
116 117 118 119 120 121 122 123
    while( !p_intf->b_die )
    {
        /* Manage core vlc functions through the callback */
        p_intf->pf_manage( p_intf );

        /* Wait a bit */
        msleep( INTF_IDLE_SLEEP );
    }
124 125
}