#ifndef FFSERVER_CONFIG_H
#define FFSERVER_CONFIG_H
#include "libavutil/dict.h"
#include "libavformat/avformat.h"
#include "libavformat/network.h"
#define FFSERVER_MAX_STREAMS 20
enum FFServerStreamType {
STREAM_TYPE_LIVE,
STREAM_TYPE_STATUS,
STREAM_TYPE_REDIRECT,
};
enum FFServerIPAddressAction {
IP_ALLOW = 1,
IP_DENY,
};
typedef struct FFServerIPAddressACL {
struct FFServerIPAddressACL *next;
enum FFServerIPAddressAction action;
struct in_addr first;
struct in_addr last;
} FFServerIPAddressACL;
typedef struct FFServerStream {
enum FFServerStreamType stream_type;
char filename[1024];
struct FFServerStream *feed;
AVDictionary *in_opts;
AVDictionary *metadata;
AVInputFormat *ifmt;
AVOutputFormat *fmt;
FFServerIPAddressACL *acl;
char dynamic_acl[1024];
int nb_streams;
int prebuffer;
int64_t max_time;
int send_on_key;
AVStream *streams[FFSERVER_MAX_STREAMS];
int feed_streams[FFSERVER_MAX_STREAMS];
char feed_filename[1024];
pid_t pid;
time_t pid_start;
char **child_argv;
struct FFServerStream *next;
unsigned bandwidth;
char *rtsp_option;
int is_multicast;
struct in_addr multicast_ip;
int multicast_port;
int multicast_ttl;
int loop;
int feed_opened;
int is_feed;
int readonly;
int truncate;
int conns_served;
int64_t bytes_served;
int64_t feed_max_size;
int64_t feed_write_index;
int64_t feed_size;
struct FFServerStream *next_feed;
} FFServerStream;
typedef struct FFServerConfig {
char *filename;
FFServerStream *first_feed;
FFServerStream *first_stream;
unsigned int nb_max_http_connections;
unsigned int nb_max_connections;
uint64_t max_bandwidth;
int debug;
char logfilename[1024];
struct sockaddr_in http_addr;
struct sockaddr_in rtsp_addr;
int errors;
int warnings;
int use_defaults;
enum AVCodecID guessed_audio_codec_id;
enum AVCodecID guessed_video_codec_id;
AVDictionary *video_opts;
AVDictionary *audio_opts;
AVCodecContext *dummy_actx;
AVCodecContext *dummy_vctx;
int no_audio;
int no_video;
int line_num;
int stream_use_defaults;
} FFServerConfig;
void ffserver_get_arg(char *buf, int buf_size, const char **pp);
void ffserver_parse_acl_row(FFServerStream *stream, FFServerStream* feed,
FFServerIPAddressACL *ext_acl,
const char *p, const char *filename, int line_num);
int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config);
void ffserver_free_child_args(void *argsp);
#endif