summaryrefslogtreecommitdiff
path: root/ffserver.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-06-18 04:40:18 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-06-18 05:10:38 +0200
commit2905e3ff6462431d55f89614b24e2a407707c82a (patch)
treed482d458a449228c8475942117c7eb81ec8934c6 /ffserver.c
parent44d1b4088f2959912a27ffbffc5884db1b35a645 (diff)
parent78440c007cd310bb27ac2af5fb7ea5b7555efc84 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: lavc: add opt_find to AVCodecContext class. h264: Complexify frame num gap shortening code intreadwrite.h: fix AV_RL32/AV_RB32 signedness. Fix decoding of mpegts streams with h264 video that does *NOT* have b frames Add minor bumps and APIChanges entries for lavf private options. ffmpeg: deprecate -vc and -tvstd ffmpeg: use new avformat_open_* API. ffserver: use new avformat_open_* API. ffprobe: use new avformat_open_* API. ffplay: use new avformat_open_* API. cmdutils: add opt_default2(). dict: add AV_DICT_APPEND flag. lavf: add avformat_write_header() as a replacement for av_write_header(). Deprecate av_open_input_* and remove their uses. lavf: add avformat_open_input() as a replacement for av_open_input_* AVOptions: add av_opt_find() as a replacement for av_find_opt. AVOptions: add av_opt_set_dict() mapping a dictionary struct to a context. ffmpeg: don't abuse a global for passing frame size from input to output ffmpeg: don't abuse a global for passing pixel format from input to output ffmpeg: initialise encoders earlier. Conflicts: cmdutils.c doc/APIchanges ffmpeg.c ffplay.c ffprobe.c libavcodec/h264.c libavformat/avformat.h libavformat/utils.c libavformat/version.h libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffserver.c')
-rw-r--r--ffserver.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/ffserver.c b/ffserver.c
index e222887c65..15ea00f4f8 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -205,7 +205,7 @@ typedef struct FFStream {
char filename[1024]; /* stream filename */
struct FFStream *feed; /* feed we are using (can be null if
coming from file) */
- AVFormatParameters *ap_in; /* input parameters */
+ AVDictionary *in_opts; /* input parameters */
AVInputFormat *ifmt; /* if non NULL, force input format */
AVOutputFormat *fmt;
IPAddressACL *acl;
@@ -2126,7 +2126,7 @@ static int open_input_stream(HTTPContext *c, const char *info)
{
char buf[128];
char input_filename[1024];
- AVFormatContext *s;
+ AVFormatContext *s = NULL;
int buf_size, i, ret;
int64_t stream_pos;
@@ -2157,8 +2157,7 @@ static int open_input_stream(HTTPContext *c, const char *info)
return -1;
/* open stream */
- if ((ret = av_open_input_file(&s, input_filename, c->stream->ifmt,
- buf_size, c->stream->ap_in)) < 0) {
+ if ((ret = avformat_open_input(&s, input_filename, c->stream->ifmt, &c->stream->in_opts)) < 0) {
http_log("could not open %s: %d\n", input_filename, ret);
return -1;
}
@@ -2268,8 +2267,7 @@ static int http_prepare_data(HTTPContext *c)
c->fmt_ctx.preload = (int)(0.5*AV_TIME_BASE);
c->fmt_ctx.max_delay = (int)(0.7*AV_TIME_BASE);
- av_set_parameters(&c->fmt_ctx, NULL);
- if (av_write_header(&c->fmt_ctx) < 0) {
+ if (avformat_write_header(&c->fmt_ctx, NULL) < 0) {
http_log("Error writing output header\n");
return -1;
}
@@ -2709,11 +2707,14 @@ static int http_receive_data(HTTPContext *c)
}
} else {
/* We have a header in our hands that contains useful data */
- AVFormatContext *s = NULL;
+ AVFormatContext *s = avformat_alloc_context();
AVIOContext *pb;
AVInputFormat *fmt_in;
int i;
+ if (!s)
+ goto fail;
+
/* use feed output format name to find corresponding input format */
fmt_in = av_find_input_format(feed->fmt->name);
if (!fmt_in)
@@ -2723,7 +2724,8 @@ static int http_receive_data(HTTPContext *c)
0, NULL, NULL, NULL, NULL);
pb->seekable = 0;
- if (av_open_input_stream(&s, pb, c->stream->feed_filename, fmt_in, NULL) < 0) {
+ s->pb = pb;
+ if (avformat_open_input(&s, c->stream->feed_filename, fmt_in, NULL) < 0) {
av_free(pb);
goto fail;
}
@@ -3442,8 +3444,7 @@ static int rtp_new_av_stream(HTTPContext *c,
/* XXX: close stream */
goto fail;
}
- av_set_parameters(ctx, NULL);
- if (av_write_header(ctx) < 0) {
+ if (avformat_write_header(ctx, NULL) < 0) {
fail:
if (h)
url_close(h);
@@ -3597,28 +3598,25 @@ static void extract_mpeg4_header(AVFormatContext *infile)
static void build_file_streams(void)
{
FFStream *stream, *stream_next;
- AVFormatContext *infile;
int i, ret;
/* gather all streams */
for(stream = first_stream; stream != NULL; stream = stream_next) {
+ AVFormatContext *infile = NULL;
stream_next = stream->next;
if (stream->stream_type == STREAM_TYPE_LIVE &&
!stream->feed) {
/* the stream comes from a file */
/* try to open the file */
/* open stream */
- stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
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;
- stream->ap_in->mpeg2ts_compute_pcr = 1;
+ av_dict_set(&stream->in_opts, "mpeg2ts_compute_pcr", "1", 0);
}
http_log("Opening file '%s'\n", stream->feed_filename);
- if ((ret = av_open_input_file(&infile, stream->feed_filename,
- stream->ifmt, 0, stream->ap_in)) < 0) {
+ if ((ret = avformat_open_input(&infile, stream->feed_filename, stream->ifmt, &stream->in_opts)) < 0) {
http_log("Could not open '%s': %d\n", stream->feed_filename, ret);
/* remove stream (no need to spend more time on it) */
fail:
@@ -3678,10 +3676,10 @@ static void build_feed_streams(void)
if (avio_check(feed->feed_filename, AVIO_FLAG_READ) > 0) {
/* See if it matches */
- AVFormatContext *s;
+ AVFormatContext *s = NULL;
int matches = 0;
- if (av_open_input_file(&s, feed->feed_filename, NULL, FFM_PACKET_SIZE, NULL) >= 0) {
+ if (avformat_open_input(&s, feed->feed_filename, NULL, NULL) >= 0) {
/* Now see if it matches */
if (s->nb_streams == feed->nb_streams) {
matches = 1;
@@ -3767,8 +3765,7 @@ static void build_feed_streams(void)
s->oformat = feed->fmt;
s->nb_streams = feed->nb_streams;
s->streams = feed->streams;
- av_set_parameters(s, NULL);
- if (av_write_header(s) < 0) {
+ if (avformat_write_header(s, NULL) < 0) {
http_log("Container doesn't supports the required parameters\n");
exit(1);
}
@@ -3944,7 +3941,7 @@ static int ffserver_opt_default(const char *opt, const char *arg,
AVCodecContext *avctx, int type)
{
int ret = 0;
- const AVOption *o = av_find_opt(avctx, opt, NULL, type, type);
+ const AVOption *o = av_opt_find(avctx, opt, NULL, type, 0);
if(o)
ret = av_set_string3(avctx, opt, arg, 1, NULL);
return ret;