2 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef FFSERVER_CONFIG_H
22 #define FFSERVER_CONFIG_H
24 #include "libavutil/dict.h"
25 #include "libavformat/avformat.h"
26 #include "libavformat/network.h"
28 #define FFSERVER_MAX_STREAMS 20
30 /* each generated stream is described here */
31 enum FFServerStreamType
{
37 enum FFServerIPAddressAction
{
42 typedef struct FFServerIPAddressACL
{
43 struct FFServerIPAddressACL
*next
;
44 enum FFServerIPAddressAction action
;
45 /* These are in host order */
48 } FFServerIPAddressACL
;
50 /* description of each stream of the ffserver.conf file */
51 typedef struct FFServerStream
{
52 enum FFServerStreamType stream_type
;
53 char filename
[1024]; /* stream filename */
54 struct FFServerStream
*feed
; /* feed we are using (can be null if coming from file) */
55 AVDictionary
*in_opts
; /* input parameters */
56 AVDictionary
*metadata
; /* metadata to set on the stream */
57 AVInputFormat
*ifmt
; /* if non NULL, force input format */
59 FFServerIPAddressACL
*acl
;
60 char dynamic_acl
[1024];
62 int prebuffer
; /* Number of milliseconds early to start */
63 int64_t max_time
; /* Number of milliseconds to run */
65 AVStream
*streams
[FFSERVER_MAX_STREAMS
];
66 int feed_streams
[FFSERVER_MAX_STREAMS
]; /* index of streams in the feed */
67 char feed_filename
[1024]; /* file name of the feed storage, or
68 input file name for a stream */
69 pid_t pid
; /* Of ffmpeg process */
70 time_t pid_start
; /* Of ffmpeg process */
72 struct FFServerStream
*next
;
73 unsigned bandwidth
; /* bandwidth, in kbits/s */
76 /* multicast specific */
78 struct in_addr multicast_ip
;
79 int multicast_port
; /* first port used for multicast */
81 int loop
; /* if true, send the stream in loops (only meaningful if file) */
84 int feed_opened
; /* true if someone is writing to the feed */
85 int is_feed
; /* true if it is a feed */
86 int readonly
; /* True if writing is prohibited to the file */
87 int truncate
; /* True if feeder connection truncate the feed file */
90 int64_t feed_max_size
; /* maximum storage size, zero means unlimited */
91 int64_t feed_write_index
; /* current write position in feed (it wraps around) */
92 int64_t feed_size
; /* current size of feed */
93 struct FFServerStream
*next_feed
;
96 typedef struct FFServerConfig
{
98 FFServerStream
*first_feed
; /* contains only feeds */
99 FFServerStream
*first_stream
; /* contains all streams, including feeds */
100 unsigned int nb_max_http_connections
;
101 unsigned int nb_max_connections
;
102 uint64_t max_bandwidth
;
104 char logfilename
[1024];
105 struct sockaddr_in http_addr
;
106 struct sockaddr_in rtsp_addr
;
110 // Following variables MUST NOT be used outside configuration parsing code.
111 enum AVCodecID guessed_audio_codec_id
;
112 enum AVCodecID guessed_video_codec_id
;
113 AVDictionary
*video_opts
; /* AVOptions for video encoder */
114 AVDictionary
*audio_opts
; /* AVOptions for audio encoder */
115 AVCodecContext
*dummy_actx
; /* Used internally to test audio AVOptions. */
116 AVCodecContext
*dummy_vctx
; /* Used internally to test video AVOptions. */
120 int stream_use_defaults
;
123 void ffserver_get_arg(char *buf
, int buf_size
, const char **pp
);
125 void ffserver_parse_acl_row(FFServerStream
*stream
, FFServerStream
* feed
,
126 FFServerIPAddressACL
*ext_acl
,
127 const char *p
, const char *filename
, int line_num
);
129 int ffserver_parse_ffconfig(const char *filename
, FFServerConfig
*config
);
131 void ffserver_free_child_args(void *argsp
);
133 #endif /* FFSERVER_CONFIG_H */