OSDN Git Service

avcodec/vorbisenc: Include bufqueue and afqueue
[android-x86/external-ffmpeg.git] / ffserver_config.h
1 /*
2  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
3  *
4  * This file is part of FFmpeg.
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef FFSERVER_CONFIG_H
22 #define FFSERVER_CONFIG_H
23
24 #define FFM_PACKET_SIZE 4096
25
26 #include "libavutil/dict.h"
27 #include "libavformat/avformat.h"
28 #include "libavformat/network.h"
29
30 #define FFSERVER_MAX_STREAMS 20
31
32 /* each generated stream is described here */
33 enum FFServerStreamType {
34     STREAM_TYPE_LIVE,
35     STREAM_TYPE_STATUS,
36     STREAM_TYPE_REDIRECT,
37 };
38
39 enum FFServerIPAddressAction {
40     IP_ALLOW = 1,
41     IP_DENY,
42 };
43
44 typedef struct FFServerIPAddressACL {
45     struct FFServerIPAddressACL *next;
46     enum FFServerIPAddressAction action;
47     /* These are in host order */
48     struct in_addr first;
49     struct in_addr last;
50 } FFServerIPAddressACL;
51
52 /**
53  * This holds the stream parameters for an AVStream, it cannot be a AVStream
54  * because AVStreams cannot be instanciated without a AVFormatContext, especially
55  * not outside libavformat.
56  *
57  * The fields of this struct have the same semantics as the fields of an AVStream.
58  */
59 typedef struct LayeredAVStream {
60     int index;
61     int id;
62     AVCodecParameters *codecpar;
63     AVCodecContext *codec;
64     AVRational time_base;
65     int pts_wrap_bits;
66     AVRational sample_aspect_ratio;
67     char *recommended_encoder_configuration;
68 } LayeredAVStream;
69
70 /* description of each stream of the ffserver.conf file */
71 typedef struct FFServerStream {
72     enum FFServerStreamType stream_type;
73     char filename[1024];          /* stream filename */
74     struct FFServerStream *feed;  /* feed we are using (can be null if coming from file) */
75     AVDictionary *in_opts;        /* input parameters */
76     AVDictionary *metadata;       /* metadata to set on the stream */
77     AVInputFormat *ifmt;          /* if non NULL, force input format */
78     AVOutputFormat *fmt;
79     FFServerIPAddressACL *acl;
80     char dynamic_acl[1024];
81     int nb_streams;
82     int prebuffer;                /* Number of milliseconds early to start */
83     int64_t max_time;             /* Number of milliseconds to run */
84     int send_on_key;
85     LayeredAVStream *streams[FFSERVER_MAX_STREAMS];
86     int feed_streams[FFSERVER_MAX_STREAMS]; /* index of streams in the feed */
87     char feed_filename[1024];     /* file name of the feed storage, or
88                                      input file name for a stream */
89     pid_t pid;                    /* Of ffmpeg process */
90     time_t pid_start;             /* Of ffmpeg process */
91     char **child_argv;
92     struct FFServerStream *next;
93     unsigned bandwidth;           /* bandwidth, in kbits/s */
94     /* RTSP options */
95     char *rtsp_option;
96     /* multicast specific */
97     int is_multicast;
98     struct in_addr multicast_ip;
99     int multicast_port;           /* first port used for multicast */
100     int multicast_ttl;
101     int loop;                     /* if true, send the stream in loops (only meaningful if file) */
102     char single_frame;            /* only single frame */
103
104     /* feed specific */
105     int feed_opened;              /* true if someone is writing to the feed */
106     int is_feed;                  /* true if it is a feed */
107     int readonly;                 /* True if writing is prohibited to the file */
108     int truncate;                 /* True if feeder connection truncate the feed file */
109     int conns_served;
110     int64_t bytes_served;
111     int64_t feed_max_size;        /* maximum storage size, zero means unlimited */
112     int64_t feed_write_index;     /* current write position in feed (it wraps around) */
113     int64_t feed_size;            /* current size of feed */
114     struct FFServerStream *next_feed;
115 } FFServerStream;
116
117 typedef struct FFServerConfig {
118     char *filename;
119     FFServerStream *first_feed;   /* contains only feeds */
120     FFServerStream *first_stream; /* contains all streams, including feeds */
121     unsigned int nb_max_http_connections;
122     unsigned int nb_max_connections;
123     uint64_t max_bandwidth;
124     int debug;
125     int bitexact;
126     char logfilename[1024];
127     struct sockaddr_in http_addr;
128     struct sockaddr_in rtsp_addr;
129     int errors;
130     int warnings;
131     int use_defaults;
132     // Following variables MUST NOT be used outside configuration parsing code.
133     enum AVCodecID guessed_audio_codec_id;
134     enum AVCodecID guessed_video_codec_id;
135     AVDictionary *video_opts;     /* AVOptions for video encoder */
136     AVDictionary *audio_opts;     /* AVOptions for audio encoder */
137     AVCodecContext *dummy_actx;   /* Used internally to test audio AVOptions. */
138     AVCodecContext *dummy_vctx;   /* Used internally to test video AVOptions. */
139     int no_audio;
140     int no_video;
141     int line_num;
142     int stream_use_defaults;
143 } FFServerConfig;
144
145 void ffserver_get_arg(char *buf, int buf_size, const char **pp);
146
147 void ffserver_parse_acl_row(FFServerStream *stream, FFServerStream* feed,
148                             FFServerIPAddressACL *ext_acl,
149                             const char *p, const char *filename, int line_num);
150
151 int ffserver_parse_ffconfig(const char *filename, FFServerConfig *config);
152
153 void ffserver_free_child_args(void *argsp);
154
155 #endif /* FFSERVER_CONFIG_H */