vlm.h 2.97 KB
Newer Older
1 2 3 4
/*****************************************************************************
 * .c: VLM interface plugin
 *****************************************************************************
 * Copyright (C) 2000, 2001 VideoLAN
5
 * $Id$
6 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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 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
 *
 * Authors: Simon Latapie <garf@videolan.org>
 *          Laurent Aimar <fenrir@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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

/* VLM specific - structures and functions */
enum
{
    VOD_TYPE = 0,
    BROADCAST_TYPE = 1,
};

typedef struct
{
    vlc_bool_t b_enabled;
    int      i_type;

    /* name "media" is reserved */
    char    *psz_name;

    int     i_input;
    char    **input;

    /* only for broadcast */
    vlc_bool_t b_loop;

    /* "playlist" index */
    int     i_index;

    char    *psz_output;

    int     i_option;
    char    **option;

    /* global options for all inputs */
    char    **input_option;
    int     i_input_option;
    input_thread_t  *p_input;

} vlm_media_t;


typedef struct
{
    /* names "schedule" is reserved */
    char    *psz_name;
    vlc_bool_t b_enabled;
    /* list of commands to execute on date */
    int i_command;
    char **command;

    /* the date of 1st execution */
    mtime_t i_date;

    /* if != 0 repeat schedule every (period) */
    mtime_t i_period;
    /* number of times you have to repeat
       i_repeat < 0 : endless repeat     */
    int i_repeat;

} vlm_schedule_t;

82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
/* ok, here is the structure of a vlm_message:
   The parent node is ( name_of_the_command , NULL ), or
   ( name_of_the_command , message_error ) on error.
   If a node has children, it should not have a value (=NULL).*/
typedef struct vlm_message
{
    char *psz_name;
    char *psz_value;

    int i_child;

    struct vlm_message **child;

} vlm_message_t;

97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123

typedef struct
{
    VLC_COMMON_MEMBERS

    vlc_mutex_t lock;

#if 0
    int         i_vod;
    vlm_media_t **vod;

    int         i_broadcast;
    vlm_media_t **broadcast;
#endif

    int            i_media;
    vlm_media_t    **media;

    int            i_schedule;
    vlm_schedule_t **schedule;
} vlm_t;


#define vlm_New( a ) __vlm_New( VLC_OBJECT(a) )
vlm_t *__vlm_New ( vlc_object_t * );
void   vlm_Delete( vlm_t * );

124 125
int vlm_ExecuteCommand( vlm_t *, char *, vlm_message_t **);
void vlm_MessageDelete( vlm_message_t* );