Remove the ffserver program
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
AVPROGS-$(CONFIG_FFMPEG) += ffmpeg
|
||||
AVPROGS-$(CONFIG_FFPLAY) += ffplay
|
||||
AVPROGS-$(CONFIG_FFPROBE) += ffprobe
|
||||
AVPROGS-$(CONFIG_FFSERVER) += ffserver
|
||||
|
||||
AVPROGS := $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF))
|
||||
PROGS += $(AVPROGS)
|
||||
|
||||
AVBASENAMES = ffmpeg ffplay ffprobe ffserver
|
||||
AVBASENAMES = ffmpeg ffplay ffprobe
|
||||
ALLAVPROGS = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF))
|
||||
ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
|
||||
|
||||
@@ -17,7 +16,6 @@ ifndef CONFIG_VIDEOTOOLBOX
|
||||
OBJS-ffmpeg-$(CONFIG_VDA) += fftools/ffmpeg_videotoolbox.o
|
||||
endif
|
||||
OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += fftools/ffmpeg_videotoolbox.o
|
||||
OBJS-ffserver += fftools/ffserver_config.o
|
||||
|
||||
define DOFFTOOL
|
||||
OBJS-$(1) += fftools/cmdutils.o fftools/$(1).o $(OBJS-$(1)-yes)
|
||||
|
||||
@@ -117,7 +117,6 @@ static int file_overwrite = 0;
|
||||
static int no_file_overwrite = 0;
|
||||
static int do_psnr = 0;
|
||||
static int input_sync;
|
||||
static int override_ffserver = 0;
|
||||
static int input_stream_potentially_available = 0;
|
||||
static int ignore_unknown_streams = 0;
|
||||
static int copy_unknown_streams = 0;
|
||||
@@ -1997,58 +1996,6 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename)
|
||||
{
|
||||
int i, err;
|
||||
AVFormatContext *ic = avformat_alloc_context();
|
||||
if (!ic)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ic->interrupt_callback = int_cb;
|
||||
err = avformat_open_input(&ic, filename, NULL, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
/* copy stream format */
|
||||
for(i=0;i<ic->nb_streams;i++) {
|
||||
AVStream *st;
|
||||
OutputStream *ost;
|
||||
AVCodec *codec;
|
||||
const char *enc_config;
|
||||
|
||||
codec = avcodec_find_encoder(ic->streams[i]->codecpar->codec_id);
|
||||
if (!codec) {
|
||||
av_log(s, AV_LOG_ERROR, "no encoder found for codec id %i\n", ic->streams[i]->codecpar->codec_id);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (codec->type == AVMEDIA_TYPE_AUDIO)
|
||||
opt_audio_codec(o, "c:a", codec->name);
|
||||
else if (codec->type == AVMEDIA_TYPE_VIDEO)
|
||||
opt_video_codec(o, "c:v", codec->name);
|
||||
ost = new_output_stream(o, s, codec->type, -1);
|
||||
st = ost->st;
|
||||
|
||||
avcodec_get_context_defaults3(st->codec, codec);
|
||||
enc_config = av_stream_get_recommended_encoder_configuration(ic->streams[i]);
|
||||
if (enc_config) {
|
||||
AVDictionary *opts = NULL;
|
||||
av_dict_parse_string(&opts, enc_config, "=", ",", 0);
|
||||
av_opt_set_dict2(st->codec, &opts, AV_OPT_SEARCH_CHILDREN);
|
||||
av_dict_free(&opts);
|
||||
}
|
||||
|
||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)
|
||||
choose_sample_fmt(st, codec);
|
||||
else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy)
|
||||
choose_pixel_fmt(st, st->codec, codec, st->codecpar->format);
|
||||
avcodec_copy_context(ost->enc_ctx, st->codec);
|
||||
if (enc_config)
|
||||
av_dict_parse_string(&ost->encoder_opts, enc_config, "=", ",", 0);
|
||||
}
|
||||
|
||||
avformat_close_input(&ic);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void init_output_filter(OutputFilter *ofilter, OptionsContext *o,
|
||||
AVFormatContext *oc)
|
||||
{
|
||||
@@ -2187,47 +2134,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
/* ffserver seeking with date=... needs a date reference */
|
||||
if (!strcmp(file_oformat->name, "ffm") &&
|
||||
!(format_flags & AVFMT_FLAG_BITEXACT) &&
|
||||
av_strstart(filename, "http:", NULL)) {
|
||||
int err = parse_option(o, "metadata", "creation_time=now", options);
|
||||
if (err < 0) {
|
||||
print_error(filename, err);
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(file_oformat->name, "ffm") && !override_ffserver &&
|
||||
av_strstart(filename, "http:", NULL)) {
|
||||
int j;
|
||||
/* special case for files sent to ffserver: we get the stream
|
||||
parameters from ffserver */
|
||||
int err = read_ffserver_streams(o, oc, filename);
|
||||
if (err < 0) {
|
||||
print_error(filename, err);
|
||||
exit_program(1);
|
||||
}
|
||||
for(j = nb_output_streams - oc->nb_streams; j < nb_output_streams; j++) {
|
||||
ost = output_streams[j];
|
||||
for (i = 0; i < nb_input_streams; i++) {
|
||||
ist = input_streams[i];
|
||||
if(ist->st->codecpar->codec_type == ost->st->codecpar->codec_type){
|
||||
ost->sync_ist= ist;
|
||||
ost->source_index= i;
|
||||
if(ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) ost->avfilter = av_strdup("anull");
|
||||
if(ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) ost->avfilter = av_strdup("null");
|
||||
ist->discard = 0;
|
||||
ist->st->discard = ist->user_set_discard;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!ost->sync_ist){
|
||||
av_log(NULL, AV_LOG_FATAL, "Missing %s stream which is required by this ffm\n", av_get_media_type_string(ost->st->codecpar->codec_type));
|
||||
exit_program(1);
|
||||
}
|
||||
}
|
||||
} else if (!o->nb_stream_maps) {
|
||||
if (!o->nb_stream_maps) {
|
||||
char *subtitle_codec_name = NULL;
|
||||
/* pick the "best" stream of each type */
|
||||
|
||||
@@ -3719,8 +3626,6 @@ const OptionDef options[] = {
|
||||
"set the maximum demux-decode delay", "seconds" },
|
||||
{ "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_preload) },
|
||||
"set the initial demux-decode delay", "seconds" },
|
||||
{ "override_ffserver", OPT_BOOL | OPT_EXPERT | OPT_OUTPUT, { &override_ffserver },
|
||||
"override the options from ffserver", "" },
|
||||
{ "sdp_file", HAS_ARG | OPT_EXPERT | OPT_OUTPUT, { .func_arg = opt_sdp_file },
|
||||
"specify a file in which to print sdp information", "file" },
|
||||
|
||||
|
||||
4022
fftools/ffserver.c
4022
fftools/ffserver.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,155 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef FFTOOLS_FFSERVER_CONFIG_H
|
||||
#define FFTOOLS_FFSERVER_CONFIG_H
|
||||
|
||||
#define FFM_PACKET_SIZE 4096
|
||||
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavformat/network.h"
|
||||
|
||||
#define FFSERVER_MAX_STREAMS 20
|
||||
|
||||
/* each generated stream is described here */
|
||||
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;
|
||||
/* These are in host order */
|
||||
struct in_addr first;
|
||||
struct in_addr last;
|
||||
} FFServerIPAddressACL;
|
||||
|
||||
/**
|
||||
* This holds the stream parameters for an AVStream, it cannot be a AVStream
|
||||
* because AVStreams cannot be instanciated without a AVFormatContext, especially
|
||||
* not outside libavformat.
|
||||
*
|
||||
* The fields of this struct have the same semantics as the fields of an AVStream.
|
||||
*/
|
||||
typedef struct LayeredAVStream {
|
||||
int index;
|
||||
int id;
|
||||
AVCodecParameters *codecpar;
|
||||
AVCodecContext *codec;
|
||||
AVRational time_base;
|
||||
int pts_wrap_bits;
|
||||
AVRational sample_aspect_ratio;
|
||||
char *recommended_encoder_configuration;
|
||||
} LayeredAVStream;
|
||||
|
||||
/* description of each stream of the ffserver.conf file */
|
||||
typedef struct FFServerStream {
|
||||
enum FFServerStreamType stream_type;
|
||||
char filename[1024]; /* stream filename */
|
||||
struct FFServerStream *feed; /* feed we are using (can be null if coming from file) */
|
||||
AVDictionary *in_opts; /* input parameters */
|
||||
AVDictionary *metadata; /* metadata to set on the stream */
|
||||
AVInputFormat *ifmt; /* if non NULL, force input format */
|
||||
AVOutputFormat *fmt;
|
||||
FFServerIPAddressACL *acl;
|
||||
char dynamic_acl[1024];
|
||||
int nb_streams;
|
||||
int prebuffer; /* Number of milliseconds early to start */
|
||||
int64_t max_time; /* Number of milliseconds to run */
|
||||
int send_on_key;
|
||||
LayeredAVStream *streams[FFSERVER_MAX_STREAMS];
|
||||
int feed_streams[FFSERVER_MAX_STREAMS]; /* index of streams in the feed */
|
||||
char feed_filename[1024]; /* file name of the feed storage, or
|
||||
input file name for a stream */
|
||||
pid_t pid; /* Of ffmpeg process */
|
||||
time_t pid_start; /* Of ffmpeg process */
|
||||
char **child_argv;
|
||||
struct FFServerStream *next;
|
||||
unsigned bandwidth; /* bandwidth, in kbits/s */
|
||||
/* RTSP options */
|
||||
char *rtsp_option;
|
||||
/* multicast specific */
|
||||
int is_multicast;
|
||||
struct in_addr multicast_ip;
|
||||
int multicast_port; /* first port used for multicast */
|
||||
int multicast_ttl;
|
||||
int loop; /* if true, send the stream in loops (only meaningful if file) */
|
||||
char single_frame; /* only single frame */
|
||||
|
||||
/* feed specific */
|
||||
int feed_opened; /* true if someone is writing to the feed */
|
||||
int is_feed; /* true if it is a feed */
|
||||
int readonly; /* True if writing is prohibited to the file */
|
||||
int truncate; /* True if feeder connection truncate the feed file */
|
||||
int conns_served;
|
||||
int64_t bytes_served;
|
||||
int64_t feed_max_size; /* maximum storage size, zero means unlimited */
|
||||
int64_t feed_write_index; /* current write position in feed (it wraps around) */
|
||||
int64_t feed_size; /* current size of feed */
|
||||
struct FFServerStream *next_feed;
|
||||
} FFServerStream;
|
||||
|
||||
typedef struct FFServerConfig {
|
||||
char *filename;
|
||||
FFServerStream *first_feed; /* contains only feeds */
|
||||
FFServerStream *first_stream; /* contains all streams, including feeds */
|
||||
unsigned int nb_max_http_connections;
|
||||
unsigned int nb_max_connections;
|
||||
uint64_t max_bandwidth;
|
||||
int debug;
|
||||
int bitexact;
|
||||
char logfilename[1024];
|
||||
struct sockaddr_in http_addr;
|
||||
struct sockaddr_in rtsp_addr;
|
||||
int errors;
|
||||
int warnings;
|
||||
int use_defaults;
|
||||
// Following variables MUST NOT be used outside configuration parsing code.
|
||||
enum AVCodecID guessed_audio_codec_id;
|
||||
enum AVCodecID guessed_video_codec_id;
|
||||
AVDictionary *video_opts; /* AVOptions for video encoder */
|
||||
AVDictionary *audio_opts; /* AVOptions for audio encoder */
|
||||
AVCodecContext *dummy_actx; /* Used internally to test audio AVOptions. */
|
||||
AVCodecContext *dummy_vctx; /* Used internally to test video AVOptions. */
|
||||
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 /* FFTOOLS_FFSERVER_CONFIG_H */
|
||||
Reference in New Issue
Block a user