#include <string.h>
#include <stdlib.h>
#include "avformat.h"
+#include "rtsp.h"
+#include "rtp.h"
#include <stdarg.h>
#include <unistd.h>
#include "ffserver.h"
#include "random.h"
#include "avstring.h"
+#include "cmdutils.h"
#undef exit
+static const char program_name[] = "FFserver";
+static const int program_birth_year = 2000;
+
/* maximum number of simultaneous HTTP connections */
#define HTTP_MAX_CONNECTIONS 2000
strcpy(eosf - 4, ".asx");
else if (strcmp(eosf - 3, ".rm") == 0)
strcpy(eosf - 3, ".ram");
- else if (stream->fmt == &rtp_muxer) {
+ else if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
/* generate a sample RTSP director if
unicast. Generate an SDP redirector if
multicast */
buf_size = FFM_PACKET_SIZE;
/* compute position (absolute time) */
if (find_info_tag(buf, sizeof(buf), "date", info))
+ {
stream_pos = parse_date(buf, 0);
+ if (stream_pos == INT64_MIN)
+ return -1;
+ }
else if (find_info_tag(buf, sizeof(buf), "buffer", info)) {
int prebuffer = strtol(buf, 0, 10);
stream_pos = av_gettime() - prebuffer * (int64_t)1000000;
buf_size = 0;
/* compute position (relative time) */
if (find_info_tag(buf, sizeof(buf), "date", info))
+ {
stream_pos = parse_date(buf, 1);
+ if (stream_pos == INT64_MIN)
+ return -1;
+ }
else
stream_pos = 0;
}
http_log("%s not found", input_filename);
return -1;
}
+ s->flags |= AVFMT_FLAG_GENPTS;
c->fmt_in = s;
+ av_find_stream_info(c->fmt_in);
/* open each parser */
for(i=0;i<s->nb_streams;i++)
path++;
for(stream = first_stream; stream != NULL; stream = stream->next) {
- if (!stream->is_feed && stream->fmt == &rtp_muxer &&
+ if (!stream->is_feed &&
+ stream->fmt && !strcmp(stream->fmt->name, "rtp") &&
!strcmp(path, stream->filename)) {
goto found;
}
/* now check each stream */
for(stream = first_stream; stream != NULL; stream = stream->next) {
- if (!stream->is_feed && stream->fmt == &rtp_muxer) {
+ if (!stream->is_feed &&
+ stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
/* accept aggregate filenames only if single stream */
if (!strcmp(path, stream->filename)) {
if (stream->nb_streams != 1) {
ctx = av_alloc_format_context();
if (!ctx)
return -1;
- ctx->oformat = &rtp_muxer;
+ ctx->oformat = guess_format("rtp", NULL, NULL);
st = av_mallocz(sizeof(AVStream));
if (!st)
/* try to open the file */
/* open stream */
stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
- if (stream->fmt == &rtp_muxer) {
+ if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
/* specific case : if transport stream output to RTP,
we use a raw transport stream reader */
stream->ap_in->mpeg2ts_raw = 1;
return 0;
}
-static void show_banner(void)
-{
- printf("ffserver version " FFMPEG_VERSION ", Copyright (c) 2000-2006 Fabrice Bellard, et al.\n");
-}
-
static void show_help(void)
{
- show_banner();
printf("usage: ffserver [-L] [-h] [-f configfile]\n"
"Hyper fast multi format Audio/Video streaming server\n"
"\n"
);
}
-static void show_license(void)
-{
- show_banner();
- printf(
- "FFmpeg is free software; you can redistribute it and/or\n"
- "modify it under the terms of the GNU Lesser General Public\n"
- "License as published by the Free Software Foundation; either\n"
- "version 2.1 of the License, or (at your option) any later version.\n"
- "\n"
- "FFmpeg is distributed in the hope that it will be useful,\n"
- "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
- "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
- "Lesser General Public License for more details.\n"
- "\n"
- "You should have received a copy of the GNU Lesser General Public\n"
- "License along with FFmpeg; if not, write to the Free Software\n"
- "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
- );
-}
-
static void handle_child_exit(int sig)
{
pid_t pid;
av_register_all();
+ show_banner(program_name, program_birth_year);
+
config_filename = "/etc/ffserver.conf";
my_program_name = argv[0];