#undef exit
-static const char program_name[] = "FFserver";
+const char program_name[] = "FFserver";
static const int program_birth_year = 2000;
static const OptionDef options[];
char buf[128];
char input_filename[1024];
AVFormatContext *s;
- int buf_size, i;
+ int buf_size, i, ret;
int64_t stream_pos;
/* find file name */
#endif
/* open stream */
- if (av_open_input_file(&s, input_filename, c->stream->ifmt,
- buf_size, c->stream->ap_in) < 0) {
- http_log("%s not found", input_filename);
+ if ((ret = av_open_input_file(&s, input_filename, c->stream->ifmt,
+ buf_size, c->stream->ap_in)) < 0) {
+ http_log("could not open %s: %d\n", input_filename, ret);
return -1;
}
s->flags |= AVFMT_FLAG_GENPTS;
{
FFStream *stream, *stream_next;
AVFormatContext *infile;
- int i;
+ int i, ret;
/* gather all streams */
for(stream = first_stream; stream != NULL; stream = stream_next) {
stream->ap_in->mpeg2ts_compute_pcr = 1;
}
- if (av_open_input_file(&infile, stream->feed_filename,
- stream->ifmt, 0, stream->ap_in) < 0) {
- http_log("%s not found", stream->feed_filename);
+ if ((ret = av_open_input_file(&infile, stream->feed_filename,
+ stream->ifmt, 0, stream->ap_in)) < 0) {
+ http_log("could not open %s: %d\n", stream->feed_filename, ret);
/* remove stream (no need to spend more time on it) */
fail:
remove_stream(stream);
}
/* Bitrate tolerance is less for streaming */
if (av->bit_rate_tolerance == 0)
- av->bit_rate_tolerance = av->bit_rate / 4;
+ av->bit_rate_tolerance = FFMAX(av->bit_rate / 4,
+ (int64_t)av->bit_rate*av->time_base.num/av->time_base.den);
if (av->qmin == 0)
av->qmin = 3;
if (av->qmax == 0)
need_to_start_children = 1;
}
-static void opt_show_license(void)
-{
- show_license();
- exit(0);
-}
-
static void opt_debug()
{
ffserver_debug = 1;
"Hyper fast multi format Audio/Video streaming server\n");
printf("\n");
show_help_options(options, "Main options:\n", 0, 0);
- exit(0);
}
static const OptionDef options[] = {
- { "h", 0, {(void*)opt_show_help}, "show help" },
- { "L", 0, {(void*)opt_show_license}, "show license" },
+ { "h", OPT_EXIT, {(void*)opt_show_help}, "show help" },
+ { "version", OPT_EXIT, {(void*)show_version}, "show version" },
+ { "L", OPT_EXIT, {(void*)show_license}, "show license" },
+ { "formats", OPT_EXIT, {(void*)show_formats}, "show available formats, codecs, protocols, ..." },
{ "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" },
if (!strcmp(logfilename, "-"))
logfile = stdout;
else
- logfile = fopen(logfilename, "w");
+ logfile = fopen(logfilename, "a");
}
if (http_server() < 0) {