blob: 194ebd1c30ef88794e830cbc77cf024f08534f61 [file] [log] [blame]
// Copyright 2011 Google Inc. All Rights Reserved.
// Author: qianzhang@google.com (ken Zhang)
#ifndef _CHANNEL_BUFFER_H_
#define _CHANNEL_BUFFER_H_
#ifndef MAX
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#endif
#ifndef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#endif
struct channel_entry_t {
int ch;
int state;
int ctrl_bits; // 0x01 fix multicast IP/port
char ch_name[20];
char ch_desc[32];
char src_ip[16];
int src_port;
char epg_id[8];
char dev_name[32];
char dev_tuning[16];
char av_inf[1024];
int frq;
};
struct channel_list_t {
int num;
int channel_num;
struct channel_entry_t *ce;
};
char *join_alloc_string(char *str1, char *str2);
int get_string(char *p, const char *name, char *string, int max_len,
char **next);
int get_string_with_quote(char *p, const char *name, char *string, int max_len,
char **next);
int get_string_token(char *p, int num, char *string, int max_len, char **next);
int get_int_val(char *p, const char *name, int *val, char **next);
struct channel_list_t *create_channel_list(int num);
void release_channel_list(struct channel_list_t *cl);
struct channel_list_t *join_channel_list(struct channel_list_t *cl1,
struct channel_list_t *cl2);
int make_channel_entry_buffer(struct channel_entry_t *ce, char *buf, int size);
int parse_channel_entry_buffer(struct channel_entry_t *ce, char *buf);
struct channel_list_t *load_channel_entry(char *file_name);
int save_channel_entry(char *file_name, struct channel_list_t *cl);
#endif