ffserver.c File Reference

multiple format streaming server based on the FFmpeg libraries More...

#include "config.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "libavformat/avformat.h"
#include "libavformat/ffm.h"
#include "libavformat/network.h"
#include "libavformat/os_support.h"
#include "libavformat/rtpdec.h"
#include "libavformat/rtsp.h"
#include "libavformat/avio_internal.h"
#include "libavformat/internal.h"
#include "libavformat/url.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/lfg.h"
#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/random_seed.h"
#include "libavutil/parseutils.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <poll.h>
#include <errno.h>
#include <sys/wait.h>
#include <signal.h>
#include <dlfcn.h>
#include "cmdutils.h"
#include "cmdutils_common_opts.h"
Include dependency graph for ffserver.c:

Go to the source code of this file.

Data Structures

struct  RTSPActionServerSetup
 
struct  DataRateData
 
struct  HTTPContext
 
struct  IPAddressACL
 
struct  FFStream
 
struct  FeedData
 

Macros

#define closesocket   close
 
#define MAX_STREAMS   20
 
#define IOBUFFER_INIT_SIZE   8192
 
#define HTTP_REQUEST_TIMEOUT   (15 * 1000)
 
#define RTSP_REQUEST_TIMEOUT   (3600 * 24 * 1000)
 
#define SYNC_TIMEOUT   (10 * 1000)
 
#define CHECK_CODEC(x)   (ccf->x != ccs->x)
 
#define ERROR(...)   report_config_error(filename, line_num, &errors, __VA_ARGS__)
 

Typedefs

typedef struct RTSPActionServerSetup RTSPActionServerSetup
 
typedef struct HTTPContext HTTPContext
 
typedef struct IPAddressACL IPAddressACL
 
typedef struct FFStream FFStream
 
typedef struct FeedData FeedData
 

Enumerations

enum  HTTPState {
  HTTPSTATE_WAIT_REQUEST, HTTPSTATE_SEND_HEADER, HTTPSTATE_SEND_DATA_HEADER, HTTPSTATE_SEND_DATA,
  HTTPSTATE_SEND_DATA_TRAILER, HTTPSTATE_RECEIVE_DATA, HTTPSTATE_WAIT_FEED, HTTPSTATE_READY,
  RTSPSTATE_WAIT_REQUEST, RTSPSTATE_SEND_REPLY, RTSPSTATE_SEND_PACKET
}
 
enum  StreamType { STREAM_TYPE_LIVE, STREAM_TYPE_STATUS, STREAM_TYPE_REDIRECT }
 
enum  IPAddressAction { IP_ALLOW = 1, IP_DENY }
 
enum  RedirType {
  REDIR_NONE, REDIR_ASX, REDIR_RAM, REDIR_ASF,
  REDIR_RTSP, REDIR_SDP
}
 

Functions

static void new_connection (int server_fd, int is_rtsp)
 
static void close_connection (HTTPContext *c)
 
static int handle_connection (HTTPContext *c)
 
static int http_parse_request (HTTPContext *c)
 
static int http_send_data (HTTPContext *c)
 
static void compute_status (HTTPContext *c)
 
static int open_input_stream (HTTPContext *c, const char *info)
 
static int http_start_receive_data (HTTPContext *c)
 
static int http_receive_data (HTTPContext *c)
 
static int rtsp_parse_request (HTTPContext *c)
 
static void rtsp_cmd_describe (HTTPContext *c, const char *url)
 
static void rtsp_cmd_options (HTTPContext *c, const char *url)
 
static void rtsp_cmd_setup (HTTPContext *c, const char *url, RTSPMessageHeader *h)
 
static void rtsp_cmd_play (HTTPContext *c, const char *url, RTSPMessageHeader *h)
 
static void rtsp_cmd_pause (HTTPContext *c, const char *url, RTSPMessageHeader *h)
 
static void rtsp_cmd_teardown (HTTPContext *c, const char *url, RTSPMessageHeader *h)
 
static int prepare_sdp_description (FFStream *stream, uint8_t **pbuffer, struct in_addr my_ip)
 
static HTTPContextrtp_new_connection (struct sockaddr_in *from_addr, FFStream *stream, const char *session_id, enum RTSPLowerTransport rtp_protocol)
 
static int rtp_new_av_stream (HTTPContext *c, int stream_index, struct sockaddr_in *dest_addr, HTTPContext *rtsp_c)
 
static int64_t ffm_read_write_index (int fd)
 
static int ffm_write_write_index (int fd, int64_t pos)
 
static void ffm_set_write_index (AVFormatContext *s, int64_t pos, int64_t file_size)
 
static int resolve_host (struct in_addr *sin_addr, const char *hostname)
 
static char * ctime1 (char *buf2, int buf_size)
 
static void http_vlog (const char *fmt, va_list vargs)
 
static void http_log (const char *fmt,...)
 
static void http_av_log (void *ptr, int level, const char *fmt, va_list vargs)
 
static void log_connection (HTTPContext *c)
 
static void update_datarate (DataRateData *drd, int64_t count)
 
static int compute_datarate (DataRateData *drd, int64_t count)
 
static void start_children (FFStream *feed)
 
static int socket_open_listen (struct sockaddr_in *my_addr)
 
static void start_multicast (void)
 
static int http_server (void)
 
static void start_wait_request (HTTPContext *c, int is_rtsp)
 
static void http_send_too_busy_reply (int fd)
 
static int extract_rates (char *rates, int ratelen, const char *request)
 
static int find_stream_in_feed (FFStream *feed, AVCodecContext *codec, int bit_rate)
 
static int modify_current_stream (HTTPContext *c, char *rates)
 
static void skip_spaces (const char **pp)
 
static void get_word (char *buf, int buf_size, const char **pp)
 
static void get_arg (char *buf, int buf_size, const char **pp)
 
static void parse_acl_row (FFStream *stream, FFStream *feed, IPAddressACL *ext_acl, const char *p, const char *filename, int line_num)
 
static IPAddressACLparse_dynamic_acl (FFStream *stream, HTTPContext *c)
 
static void free_acl_list (IPAddressACL *in_acl)
 
static int validate_acl_list (IPAddressACL *in_acl, HTTPContext *c)
 
static int validate_acl (FFStream *stream, HTTPContext *c)
 
static void compute_real_filename (char *filename, int max_size)
 
static void fmt_bytecount (AVIOContext *pb, int64_t count)
 
static int64_t get_server_clock (HTTPContext *c)
 
static int64_t get_packet_send_clock (HTTPContext *c)
 
static int http_prepare_data (HTTPContext *c)
 
static void rtsp_reply_header (HTTPContext *c, enum RTSPStatusCode error_number)
 
static void rtsp_reply_error (HTTPContext *c, enum RTSPStatusCode error_number)
 
static HTTPContextfind_rtp_session (const char *session_id)
 
static RTSPTransportFieldfind_transport (RTSPMessageHeader *h, enum RTSPLowerTransport lower_transport)
 
static HTTPContextfind_rtp_session_with_url (const char *url, const char *session_id)
 
static AVStreamadd_av_stream1 (FFStream *stream, AVCodecContext *codec, int copy)
 
static int add_av_stream (FFStream *feed, AVStream *st)
 
static void remove_stream (FFStream *stream)
 
static void extract_mpeg4_header (AVFormatContext *infile)
 
static void build_file_streams (void)
 
static void build_feed_streams (void)
 
static void compute_bandwidth (void)
 
static void add_codec (FFStream *stream, AVCodecContext *av)
 
static enum AVCodecID opt_audio_codec (const char *arg)
 
static enum AVCodecID opt_video_codec (const char *arg)
 
static void load_module (const char *filename)
 
static int ffserver_opt_default (const char *opt, const char *arg, AVCodecContext *avctx, int type)
 
static int ffserver_opt_preset (const char *arg, AVCodecContext *avctx, int type, enum AVCodecID *audio_id, enum AVCodecID *video_id)
 
static AVOutputFormatffserver_guess_format (const char *short_name, const char *filename, const char *mime_type)
 
static void report_config_error (const char *filename, int line_num, int *errors, const char *fmt,...)
 
static int parse_ffconfig (const char *filename)
 
static void handle_child_exit (int sig)
 
static void opt_debug (void)
 
void show_help_default (const char *opt, const char *arg)
 Per-fftool specific help handler. More...
 
int main (int argc, char **argv)
 

Variables

const char program_name [] = "ffserver"
 program name, defined by the program for show_version(). More...
 
const int program_birth_year = 2000
 program birth year, defined by the program for show_banner() More...
 
static const OptionDef options []
 
static const char * http_state []
 
static struct sockaddr_in my_http_addr
 
static struct sockaddr_in my_rtsp_addr
 
static char logfilename [1024]
 
static HTTPContextfirst_http_ctx
 
static FFStreamfirst_feed
 
static FFStreamfirst_stream
 
static const char * my_program_name
 
static const char * config_filename
 
static int ffserver_debug
 
static int no_launch
 
static int need_to_start_children
 
static unsigned int nb_max_http_connections = 2000
 
static unsigned int nb_max_connections = 5
 
static unsigned int nb_connections
 
static uint64_t max_bandwidth = 1000
 
static uint64_t current_bandwidth
 
static int64_t cur_time
 
static AVLFG random_state
 
static FILE * logfile = NULL
 

Detailed Description

multiple format streaming server based on the FFmpeg libraries

Definition in file ffserver.c.

Macro Definition Documentation

#define CHECK_CODEC (   x)    (ccf->x != ccs->x)

Referenced by build_feed_streams().

#define ERROR (   ...)    report_config_error(filename, line_num, &errors, __VA_ARGS__)

Referenced by main(), and parse_ffconfig().

#define HTTP_REQUEST_TIMEOUT   (15 * 1000)

Definition at line 113 of file ffserver.c.

Referenced by start_wait_request().

#define IOBUFFER_INIT_SIZE   8192

Definition at line 110 of file ffserver.c.

Referenced by new_connection(), and rtp_new_connection().

#define MAX_STREAMS   20

Definition at line 108 of file ffserver.c.

#define RTSP_REQUEST_TIMEOUT   (3600 * 24 * 1000)

Definition at line 114 of file ffserver.c.

Referenced by start_wait_request().

#define SYNC_TIMEOUT   (10 * 1000)

Definition at line 116 of file ffserver.c.

Typedef Documentation

typedef struct FeedData FeedData
typedef struct FFStream FFStream
typedef struct HTTPContext HTTPContext
typedef struct IPAddressACL IPAddressACL

Enumeration Type Documentation

enum HTTPState
Enumerator
HTTPSTATE_WAIT_REQUEST 
HTTPSTATE_SEND_HEADER 
HTTPSTATE_SEND_DATA_HEADER 
HTTPSTATE_SEND_DATA 
HTTPSTATE_SEND_DATA_TRAILER 
HTTPSTATE_RECEIVE_DATA 
HTTPSTATE_WAIT_FEED 
HTTPSTATE_READY 
RTSPSTATE_WAIT_REQUEST 
RTSPSTATE_SEND_REPLY 
RTSPSTATE_SEND_PACKET 

Definition at line 77 of file ffserver.c.

Enumerator
IP_ALLOW 
IP_DENY 

Definition at line 200 of file ffserver.c.

enum RedirType
Enumerator
REDIR_NONE 
REDIR_ASX 
REDIR_RAM 
REDIR_ASF 
REDIR_RTSP 
REDIR_SDP 

Definition at line 1481 of file ffserver.c.

enum StreamType
Enumerator
STREAM_TYPE_LIVE 
STREAM_TYPE_STATUS 
STREAM_TYPE_REDIRECT 

Definition at line 194 of file ffserver.c.

Function Documentation

static int add_av_stream ( FFStream feed,
AVStream st 
)
static

Definition at line 3540 of file ffserver.c.

Referenced by build_feed_streams().

static AVStream* add_av_stream1 ( FFStream stream,
AVCodecContext codec,
int  copy 
)
static

Definition at line 3507 of file ffserver.c.

Referenced by add_av_stream(), and build_file_streams().

static void add_codec ( FFStream stream,
AVCodecContext av 
)
static

Definition at line 3859 of file ffserver.c.

Referenced by parse_ffconfig().

static void build_feed_streams ( void  )
static

Definition at line 3691 of file ffserver.c.

Referenced by main().

static void build_file_streams ( void  )
static

Definition at line 3644 of file ffserver.c.

Referenced by main().

static void close_connection ( HTTPContext c)
static

Definition at line 854 of file ffserver.c.

Referenced by http_server(), and rtsp_cmd_teardown().

static void compute_bandwidth ( void  )
static

Definition at line 3835 of file ffserver.c.

Referenced by main().

static int compute_datarate ( DataRateData drd,
int64_t  count 
)
static

Definition at line 475 of file ffserver.c.

Referenced by compute_status().

static void compute_real_filename ( char *  filename,
int  max_size 
)
static

Definition at line 1457 of file ffserver.c.

Referenced by http_parse_request().

static void compute_status ( HTTPContext c)
static

Definition at line 1922 of file ffserver.c.

Referenced by http_parse_request().

static char* ctime1 ( char *  buf2,
int  buf_size 
)
static

Definition at line 399 of file ffserver.c.

Referenced by http_vlog().

static void extract_mpeg4_header ( AVFormatContext infile)
static

Definition at line 3593 of file ffserver.c.

Referenced by build_file_streams().

static int extract_rates ( char *  rates,
int  ratelen,
const char *  request 
)
static

Definition at line 1120 of file ffserver.c.

Referenced by http_parse_request().

static int64_t ffm_read_write_index ( int  fd)
static

Definition at line 331 of file ffserver.c.

Referenced by build_feed_streams(), and http_start_receive_data().

static void ffm_set_write_index ( AVFormatContext s,
int64_t  pos,
int64_t  file_size 
)
static

Definition at line 356 of file ffserver.c.

Referenced by http_prepare_data().

static int ffm_write_write_index ( int  fd,
int64_t  pos 
)
static

Definition at line 342 of file ffserver.c.

Referenced by http_receive_data(), and http_start_receive_data().

static AVOutputFormat* ffserver_guess_format ( const char *  short_name,
const char *  filename,
const char *  mime_type 
)
static

Definition at line 4036 of file ffserver.c.

Referenced by parse_ffconfig().

static int ffserver_opt_default ( const char *  opt,
const char *  arg,
AVCodecContext avctx,
int  type 
)
static

Definition at line 3983 of file ffserver.c.

Referenced by ffserver_opt_preset(), and parse_ffconfig().

static int ffserver_opt_preset ( const char *  arg,
AVCodecContext avctx,
int  type,
enum AVCodecID audio_id,
enum AVCodecID video_id 
)
static

Definition at line 3993 of file ffserver.c.

Referenced by parse_ffconfig().

static HTTPContext* find_rtp_session ( const char *  session_id)
static

Definition at line 3062 of file ffserver.c.

Referenced by find_rtp_session_with_url(), and rtsp_cmd_setup().

static HTTPContext* find_rtp_session_with_url ( const char *  url,
const char *  session_id 
)
static

Definition at line 3235 of file ffserver.c.

Referenced by rtsp_cmd_pause(), rtsp_cmd_play(), and rtsp_cmd_teardown().

static int find_stream_in_feed ( FFStream feed,
AVCodecContext codec,
int  bit_rate 
)
static

Definition at line 1167 of file ffserver.c.

Referenced by modify_current_stream().

static RTSPTransportField* find_transport ( RTSPMessageHeader h,
enum RTSPLowerTransport  lower_transport 
)
static

Definition at line 3076 of file ffserver.c.

Referenced by rtsp_cmd_setup().

static void fmt_bytecount ( AVIOContext pb,
int64_t  count 
)
static

Definition at line 1912 of file ffserver.c.

Referenced by compute_status().

static void free_acl_list ( IPAddressACL in_acl)
static

Definition at line 1406 of file ffserver.c.

Referenced by validate_acl().

static void get_arg ( char *  buf,
int  buf_size,
const char **  pp 
)
static

Definition at line 1271 of file ffserver.c.

Referenced by parse_acl_row(), parse_dynamic_acl(), and parse_ffconfig().

static int64_t get_packet_send_clock ( HTTPContext c)
static

Definition at line 2242 of file ffserver.c.

Referenced by http_send_data().

static int64_t get_server_clock ( HTTPContext c)
static

Definition at line 2234 of file ffserver.c.

Referenced by http_send_data().

static void get_word ( char *  buf,
int  buf_size,
const char **  pp 
)
static

Definition at line 1253 of file ffserver.c.

Referenced by http_parse_request(), and rtsp_parse_request().

static void handle_child_exit ( int  sig)
static

Definition at line 4658 of file ffserver.c.

Referenced by main().

static int handle_connection ( HTTPContext c)
static

Definition at line 943 of file ffserver.c.

Referenced by http_server().

static void http_av_log ( void ptr,
int  level,
const char *  fmt,
va_list  vargs 
)
static

Definition at line 439 of file ffserver.c.

Referenced by main().

static int http_parse_request ( HTTPContext c)
static

Definition at line 1491 of file ffserver.c.

Referenced by handle_connection().

static int http_prepare_data ( HTTPContext c)
static

Definition at line 2257 of file ffserver.c.

Referenced by http_send_data().

static int http_receive_data ( HTTPContext c)
static

Definition at line 2652 of file ffserver.c.

Referenced by handle_connection().

static int http_send_data ( HTTPContext c)
static

Definition at line 2487 of file ffserver.c.

Referenced by handle_connection().

static void http_send_too_busy_reply ( int  fd)
static

Definition at line 787 of file ffserver.c.

Referenced by new_connection().

static int http_server ( void  )
static

Definition at line 633 of file ffserver.c.

Referenced by main().

static int http_start_receive_data ( HTTPContext c)
static

Definition at line 2606 of file ffserver.c.

Referenced by http_parse_request().

static void http_vlog ( const char *  fmt,
va_list  vargs 
)
static

Definition at line 413 of file ffserver.c.

Referenced by http_av_log(), and http_log().

static void load_module ( const char *  filename)
static

Definition at line 3960 of file ffserver.c.

Referenced by parse_ffconfig().

static void log_connection ( HTTPContext c)
static

Definition at line 451 of file ffserver.c.

Referenced by http_server().

int main ( int  argc,
char **  argv 
)

Definition at line 4705 of file ffserver.c.

static int modify_current_stream ( HTTPContext c,
char *  rates 
)
static

Definition at line 1204 of file ffserver.c.

Referenced by http_parse_request().

static void new_connection ( int  server_fd,
int  is_rtsp 
)
static

Definition at line 804 of file ffserver.c.

Referenced by http_server().

static int open_input_stream ( HTTPContext c,
const char *  info 
)
static
static enum AVCodecID opt_audio_codec ( const char *  arg)
static

Definition at line 3937 of file ffserver.c.

Referenced by ffserver_opt_preset(), and parse_ffconfig().

static void opt_debug ( void  )
static

Definition at line 4683 of file ffserver.c.

static enum AVCodecID opt_video_codec ( const char *  arg)
static

Definition at line 3947 of file ffserver.c.

Referenced by ffserver_opt_preset(), and parse_ffconfig().

static void parse_acl_row ( FFStream stream,
FFStream feed,
IPAddressACL ext_acl,
const char *  p,
const char *  filename,
int  line_num 
)
static

Definition at line 1303 of file ffserver.c.

Referenced by parse_dynamic_acl(), and parse_ffconfig().

static IPAddressACL* parse_dynamic_acl ( FFStream stream,
HTTPContext c 
)
static

Definition at line 1369 of file ffserver.c.

Referenced by validate_acl().

static int parse_ffconfig ( const char *  filename)
static

Definition at line 4066 of file ffserver.c.

Referenced by main().

static int prepare_sdp_description ( FFStream stream,
uint8_t **  pbuffer,
struct in_addr  my_ip 
)
static

Definition at line 2959 of file ffserver.c.

Referenced by http_parse_request(), and rtsp_cmd_describe().

static void remove_stream ( FFStream stream)
static

Definition at line 3580 of file ffserver.c.

Referenced by build_file_streams().

static void report_config_error ( const char *  filename,
int  line_num,
int *  errors,
const char *  fmt,
  ... 
)
static

Definition at line 4055 of file ffserver.c.

static int resolve_host ( struct in_addr *  sin_addr,
const char *  hostname 
)
static

Definition at line 366 of file ffserver.c.

Referenced by parse_acl_row(), and parse_ffconfig().

static int rtp_new_av_stream ( HTTPContext c,
int  stream_index,
struct sockaddr_in *  dest_addr,
HTTPContext rtsp_c 
)
static

Definition at line 3410 of file ffserver.c.

Referenced by rtsp_cmd_setup(), and start_multicast().

static HTTPContext * rtp_new_connection ( struct sockaddr_in *  from_addr,
FFStream stream,
const char *  session_id,
enum RTSPLowerTransport  rtp_protocol 
)
static

Definition at line 3344 of file ffserver.c.

Referenced by rtsp_cmd_setup(), and start_multicast().

static void rtsp_cmd_describe ( HTTPContext c,
const char *  url 
)
static

Definition at line 3015 of file ffserver.c.

Referenced by rtsp_parse_request().

static void rtsp_cmd_options ( HTTPContext c,
const char *  url 
)
static

Definition at line 3006 of file ffserver.c.

Referenced by rtsp_parse_request().

static void rtsp_cmd_pause ( HTTPContext c,
const char *  url,
RTSPMessageHeader h 
)
static

Definition at line 3295 of file ffserver.c.

Referenced by rtsp_parse_request().

static void rtsp_cmd_play ( HTTPContext c,
const char *  url,
RTSPMessageHeader h 
)
static

Definition at line 3269 of file ffserver.c.

Referenced by rtsp_parse_request().

static void rtsp_cmd_setup ( HTTPContext c,
const char *  url,
RTSPMessageHeader h 
)
static

Definition at line 3089 of file ffserver.c.

Referenced by rtsp_parse_request().

static void rtsp_cmd_teardown ( HTTPContext c,
const char *  url,
RTSPMessageHeader h 
)
static

Definition at line 3320 of file ffserver.c.

Referenced by rtsp_parse_request().

static int rtsp_parse_request ( HTTPContext c)
static

Definition at line 2870 of file ffserver.c.

Referenced by handle_connection().

static void rtsp_reply_error ( HTTPContext c,
enum RTSPStatusCode  error_number 
)
static
static void rtsp_reply_header ( HTTPContext c,
enum RTSPStatusCode  error_number 
)
static
void show_help_default ( const char *  opt,
const char *  arg 
)

Per-fftool specific help handler.

Implemented in each fftool, called by show_help().

Definition at line 4689 of file ffserver.c.

Referenced by show_help().

static void skip_spaces ( const char **  pp)
static

Definition at line 1244 of file ffserver.c.

Referenced by get_word().

static int socket_open_listen ( struct sockaddr_in *  my_addr)
static

Definition at line 543 of file ffserver.c.

Referenced by http_server().

static void start_children ( FFStream feed)
static

Definition at line 484 of file ffserver.c.

Referenced by http_server().

static void start_multicast ( void  )
static

Definition at line 576 of file ffserver.c.

Referenced by http_server().

static void start_wait_request ( HTTPContext c,
int  is_rtsp 
)
static

Definition at line 773 of file ffserver.c.

Referenced by handle_connection(), and new_connection().

static void update_datarate ( DataRateData drd,
int64_t  count 
)
static

Definition at line 461 of file ffserver.c.

Referenced by http_receive_data(), and http_send_data().

static int validate_acl ( FFStream stream,
HTTPContext c 
)
static

Definition at line 1435 of file ffserver.c.

Referenced by http_parse_request().

static int validate_acl_list ( IPAddressACL in_acl,
HTTPContext c 
)
static

Definition at line 1418 of file ffserver.c.

Referenced by validate_acl().

Variable Documentation

const char* config_filename
static

Definition at line 311 of file ffserver.c.

Referenced by main().

uint64_t current_bandwidth
static
int ffserver_debug
static

Definition at line 313 of file ffserver.c.

Referenced by http_parse_request(), opt_debug(), parse_ffconfig(), and start_children().

FFStream* first_feed
static

Definition at line 273 of file ffserver.c.

Referenced by parse_ffconfig().

HTTPContext* first_http_ctx
static
FFStream* first_stream
static

Definition at line 274 of file ffserver.c.

Referenced by compute_status(), http_parse_request(), parse_ffconfig(), and remove_stream().

const char* http_state[]
static
Initial value:
= {
"HTTP_WAIT_REQUEST",
"HTTP_SEND_HEADER",
"SEND_DATA_HEADER",
"SEND_DATA",
"SEND_DATA_TRAILER",
"RECEIVE_DATA",
"WAIT_FEED",
"READY",
"RTSP_WAIT_REQUEST",
"RTSP_SEND_REPLY",
"RTSP_SEND_PACKET",
}

Definition at line 92 of file ffserver.c.

Referenced by compute_status().

FILE* logfile = NULL
static

Definition at line 329 of file ffserver.c.

Referenced by http_vlog(), and main().

char logfilename[1024]
static

Definition at line 271 of file ffserver.c.

Referenced by main(), opt_debug(), parse_ffconfig(), and transcode_init().

uint64_t max_bandwidth = 1000
static

Definition at line 322 of file ffserver.c.

Referenced by compute_status(), hls_open(), http_parse_request(), and parse_ffconfig().

struct sockaddr_in my_http_addr
static

Definition at line 268 of file ffserver.c.

Referenced by http_server(), and parse_ffconfig().

const char* my_program_name
static

Definition at line 309 of file ffserver.c.

Referenced by main(), and start_children().

struct sockaddr_in my_rtsp_addr
static

Definition at line 269 of file ffserver.c.

Referenced by http_parse_request(), http_server(), and parse_ffconfig().

unsigned int nb_connections
static
unsigned int nb_max_connections = 5
static
unsigned int nb_max_http_connections = 2000
static

Definition at line 318 of file ffserver.c.

Referenced by http_server(), and parse_ffconfig().

int need_to_start_children
static

Definition at line 315 of file ffserver.c.

Referenced by handle_child_exit(), and http_server().

int no_launch
static

Definition at line 314 of file ffserver.c.

Referenced by start_children().

const OptionDef options[]
static
Initial value:
= {
{ "L" , OPT_EXIT, {.func_arg = show_license}, "show license" },
{ "h" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
{ "?" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
{ "help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
{ "-help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
{ "version" , OPT_EXIT, {.func_arg = show_version}, "show version" },
{ "formats" , OPT_EXIT, {.func_arg = show_formats }, "show available formats" },
{ "codecs" , OPT_EXIT, {.func_arg = show_codecs }, "show available codecs" },
{ "decoders" , OPT_EXIT, {.func_arg = show_decoders }, "show available decoders" },
{ "encoders" , OPT_EXIT, {.func_arg = show_encoders }, "show available encoders" },
{ "bsfs" , OPT_EXIT, {.func_arg = show_bsfs }, "show available bit stream filters" },
{ "protocols" , OPT_EXIT, {.func_arg = show_protocols}, "show available protocols" },
{ "filters" , OPT_EXIT, {.func_arg = show_filters }, "show available filters" },
{ "pix_fmts" , OPT_EXIT, {.func_arg = show_pix_fmts }, "show available pixel formats" },
{ "layouts" , OPT_EXIT, {.func_arg = show_layouts }, "show standard channel layouts" },
{ "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },
{ "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" },
{ "v", HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" },
{ "report" , 0, {(void*)opt_report}, "generate a report" },
{ "max_alloc" , HAS_ARG, {.func_arg = opt_max_alloc}, "set maximum size of a single allocated block", "bytes" },
{ "cpuflags" , HAS_ARG | OPT_EXPERT, {.func_arg = opt_cpuflags}, "force specific cpu flags", "flags" },
{ "n", OPT_BOOL, {(void *)&no_launch }, "enable no-launch mode" },
{ "d", 0, {(void*)opt_debug}, "enable debug mode" },
{ "f", HAS_ARG | OPT_STRING, {(void*)&config_filename }, "use configfile instead of /etc/ffserver.conf", "configfile" },
{ NULL },
}
static const char * config_filename
Definition: ffserver.c:311
#define OPT_EXPERT
Definition: cmdutils.h:149
int show_decoders(void *optctx, const char *opt, const char *arg)
Print a listing containing all the decoders supported by the program.
Definition: cmdutils.c:1411
int show_license(void *optctx, const char *opt, const char *arg)
Print the license of the program to stdout.
Definition: cmdutils.c:1075
int opt_loglevel(void *optctx, const char *opt, const char *arg)
Set the libav* libraries log level.
Definition: cmdutils.c:784
int show_protocols(void *optctx, const char *opt, const char *arg)
Print a listing containing all the protocols supported by the program.
Definition: cmdutils.c:1434
int show_formats(void *optctx, const char *opt, const char *arg)
Print a listing containing all the formats supported by the program.
Definition: cmdutils.c:1149
int show_pix_fmts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the pixel formats supported by the program.
Definition: cmdutils.c:1486
int show_codecs(void *optctx, const char *opt, const char *arg)
Print a listing containing all the codecs supported by the program.
Definition: cmdutils.c:1321
static void opt_debug(void)
Definition: ffserver.c:4683
#define HAS_ARG
Definition: cmdutils.h:147
int opt_max_alloc(void *optctx, const char *opt, const char *arg)
Definition: cmdutils.c:923
int show_help(void *optctx, const char *opt, const char *arg)
Generic -h handler common to all fftools.
Definition: cmdutils.c:1693
int show_sample_fmts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the sample formats supported by the program.
Definition: cmdutils.c:1548
int show_filters(void *optctx, const char *opt, const char *arg)
Print a listing containing all the filters supported by the program.
Definition: cmdutils.c:1449
int opt_report(const char *opt)
Definition: cmdutils.c:918
int show_bsfs(void *optctx, const char *opt, const char *arg)
Print a listing containing all the bit stream filters supported by the program.
Definition: cmdutils.c:1423
#define OPT_EXIT
Definition: cmdutils.h:157
NULL
Definition: eval.c:55
#define OPT_STRING
Definition: cmdutils.h:150
#define OPT_BOOL
Definition: cmdutils.h:148
int show_layouts(void *optctx, const char *opt, const char *arg)
Print a listing containing all the standard channel layouts supported by the program.
Definition: cmdutils.c:1519
int opt_cpuflags(void *optctx, const char *opt, const char *arg)
Definition: cmdutils.c:937
int show_version(void *optctx, const char *opt, const char *arg)
Print the version of the program to stdout.
Definition: cmdutils.c:1066
int show_encoders(void *optctx, const char *opt, const char *arg)
Print a listing containing all the encoders supported by the program.
Definition: cmdutils.c:1417
static int no_launch
Definition: ffserver.c:314

Definition at line 75 of file ffserver.c.

const int program_birth_year = 2000

program birth year, defined by the program for show_banner()

Definition at line 73 of file ffserver.c.

Referenced by print_program_info().

const char program_name[] = "ffserver"

program name, defined by the program for show_version().

Definition at line 72 of file ffserver.c.

Referenced by compute_status(), expand_filename_template(), init_report(), print_program_info(), show_help_default(), show_license(), and show_usage().

AVLFG random_state
static

Definition at line 327 of file ffserver.c.