/*1* Copyright (c) 2000, 2001, 2002 Fabrice Bellard2*3* This file is part of FFmpeg.4*5* FFmpeg is free software; you can redistribute it and/or6* modify it under the terms of the GNU Lesser General Public7* License as published by the Free Software Foundation; either8* version 2.1 of the License, or (at your option) any later version.9*10* FFmpeg is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13* Lesser General Public License for more details.14*15* You should have received a copy of the GNU Lesser General Public16* License along with FFmpeg; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/1920#ifndef FFSERVER_CONFIG_H21#define FFSERVER_CONFIG_H2223#include "libavutil/dict.h"24#include "libavformat/avformat.h"25#include "libavformat/network.h"2627#define FFSERVER_MAX_STREAMS 202829/* each generated stream is described here */30enum FFServerStreamType {31STREAM_TYPE_LIVE,32STREAM_TYPE_STATUS,33STREAM_TYPE_REDIRECT,34};3536enum FFServerIPAddressAction {37IP_ALLOW = 1,38IP_DENY,39};4041typedef struct FFServerIPAddressACL {42struct FFServerIPAddressACL *next;43enum FFServerIPAddressAction action;44/* These are in host order */45struct in_addr first;46struct in_addr last;47} FFServerIPAddressACL;4849/* description of each stream of the ffserver.conf file */50typedef struct FFServerStream {51enum FFServerStreamType stream_type;52char filename[1024]; /* stream filename */53struct FFServerStream *feed; /* feed we are using (can be null if coming from file) */54AVDictionary *in_opts; /* input parameters */55AVDictionary *metadata; /* metadata to set on the stream */56AVInputFormat *ifmt; /* if non NULL, force input format */57AVOutputFormat *fmt;58FFServerIPAddressACL *acl;59char dynamic_acl[1024];60int nb_streams;61int prebuffer; /* Number of milliseconds early to start */62int64_t max_time; /* Number of milliseconds to run */63int send_on_key;64AVStream *streams[FFSERVER_MAX_STREAMS];65int feed_streams[FFSERVER_MAX_STREAMS]; /* index of streams in the feed */66char feed_filename[1024]; /* file name of the feed storage, or67input file name for a stream */68pid_t pid; /* Of ffmpeg process */69time_t pid_start; /* Of ffmpeg process */70char **child_argv;71struct FFServerStream *next;72unsigned bandwidth; /* bandwidth, in kbits/s */73/* RTSP options */74char *rtsp_option;75/* multicast specific */76int is_multicast;77struct in_addr multicast_ip;78int multicast_port; /* first port used for multicast */79int multicast_ttl;80int loop; /* if true, send the stream in loops (only meaningful if file) */81char single_frame; /* only single frame */8283/* feed specific */84int feed_opened; /* true if someone is writing to the feed */85int is_feed; /* true if it is a feed */86int readonly; /* True if writing is prohibited to the file */87int truncate; /* True if feeder connection truncate the feed file */88int conns_served;89int64_t bytes_served;90int64_t feed_max_size; /* maximum storage size, zero means unlimited */91int64_t feed_write_index; /* current write position in feed (it wraps around) */92int64_t feed_size; /* current size of feed */93struct FFServerStream *next_feed;94} FFServerStream;9596typedef struct FFServerConfig {97char *filename;98FFServerStream *first_feed; /* contains only feeds */99FFServerStream *first_stream; /* contains all streams, including feeds */100unsigned int nb_max_http_connections;101unsigned int nb_max_connections;102uint64_t max_bandwidth;103int debug;104char logfilename[1024];105struct sockaddr_in http_addr;106struct sockaddr_in rtsp_addr;107int errors;108int warnings;109int use_defaults;110// Following variables MUST NOT be used outside configuration parsing code.111enum AVCodecID guessed_audio_codec_id;112enum AVCodecID guessed_video_codec_id;113AVDictionary *video_opts; /* AVOptions for video encoder */114AVDictionary *audio_opts; /* AVOptions for audio encoder */115AVCodecContext *dummy_actx; /* Used internally to test audio AVOptions. */116AVCodecContext *dummy_vctx; /* Used internally to test video AVOptions. */117int no_audio;118int no_video;119int line_num;120int stream_use_defaults;121} FFServerConfig;122123void ffserver_get_arg(char *buf, int buf_size, const char **pp);124125void ffserver_parse_acl_row(FFServerStream *stream, FFServerStream* feed,126FFServerIPAddressACL *ext_acl,127const char *p, const char *filename, int line_num);128129int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config);130131void ffserver_free_child_args(void *argsp);132133#endif /* FFSERVER_CONFIG_H */134135136