source.h 1.3 KB
Newer Older
Jack Moffitt's avatar
Jack Moffitt committed
1 2 3
#ifndef __SOURCE_H__
#define __SOURCE_H__

4
#include "cfgfile.h"
5
#include "yp.h"
6
#include "util.h"
7 8
#include "format.h"

Michael Smith's avatar
Michael Smith committed
9 10
#include <stdio.h>

Jack Moffitt's avatar
Jack Moffitt committed
11 12
typedef struct source_tag
{
13
    client_t *client;
14 15 16 17
    connection_t *con;
    http_parser_t *parser;
    
    char *mount;
Michael Smith's avatar
Michael Smith committed
18 19 20 21

    /* If this source drops, try to move all clients to this fallback */
    char *fallback_mount;

22 23 24 25
    /* set to zero to request the source to shutdown without causing a global
     * shutdown */
    int running;

26
    struct _format_plugin_tag *format;
Jack Moffitt's avatar
Jack Moffitt committed
27

28 29
    avl_tree *client_tree;
    avl_tree *pending_tree;
Jack Moffitt's avatar
Jack Moffitt committed
30

31 32
    rwlock_t *shutdown_rwlock;
    ypdata_t *ypdata[MAX_YP_DIRECTORIES];
33
    util_dict *audio_info;
Michael Smith's avatar
Michael Smith committed
34 35 36 37

    char *dumpfilename; /* Name of a file to dump incoming stream to */
    FILE *dumpfile;

38 39
    int    num_yp_directories;
    long listeners;
40
    long max_listeners;
41
    int yp_public;
42
    int send_return;
Jack Moffitt's avatar
Jack Moffitt committed
43 44
} source_t;

Michael Smith's avatar
Michael Smith committed
45 46 47
source_t *source_create(client_t *client, connection_t *con, 
        http_parser_t *parser, const char *mount, format_type_t type,
        mount_proxy *mountinfo);
Jack Moffitt's avatar
Jack Moffitt committed
48
source_t *source_find_mount(const char *mount);
49
client_t *source_find_client(source_t *source, int id);
Jack Moffitt's avatar
Jack Moffitt committed
50 51
int source_compare_sources(void *arg, void *a, void *b);
int source_free_source(void *key);
52
int source_remove_client(void *key);
Jack Moffitt's avatar
Jack Moffitt committed
53 54 55 56 57
void *source_main(void *arg);

#endif