summaryrefslogtreecommitdiffstats
path: root/ffserver.c
diff options
context:
space:
mode:
Diffstat (limited to 'ffserver.c')
-rw-r--r--ffserver.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/ffserver.c b/ffserver.c
index db0cd12..50f050c 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -33,6 +33,8 @@
#include "libavformat/os_support.h"
#include "libavformat/rtpdec.h"
#include "libavformat/rtsp.h"
+// XXX for ffio_open_dyn_packet_buffer, to be removed
+#include "libavformat/avio_internal.h"
#include "libavutil/avstring.h"
#include "libavutil/lfg.h"
#include "libavutil/random_seed.h"
@@ -869,10 +871,10 @@ static void close_connection(HTTPContext *c)
if (!c->last_packet_sent && c->state == HTTPSTATE_SEND_DATA_TRAILER) {
if (ctx->oformat) {
/* prepare header */
- if (url_open_dyn_buf(&ctx->pb) >= 0) {
+ if (avio_open_dyn_buf(&ctx->pb) >= 0) {
av_write_trailer(ctx);
av_freep(&c->pb_buffer);
- url_close_dyn_buf(ctx->pb, &c->pb_buffer);
+ avio_close_dyn_buf(ctx->pb, &c->pb_buffer);
}
}
}
@@ -1873,7 +1875,7 @@ static void compute_status(HTTPContext *c)
int i, len;
AVIOContext *pb;
- if (url_open_dyn_buf(&pb) < 0) {
+ if (avio_open_dyn_buf(&pb) < 0) {
/* XXX: return an error ? */
c->buffer_ptr = c->buffer;
c->buffer_end = c->buffer;
@@ -2101,7 +2103,7 @@ static void compute_status(HTTPContext *c)
avio_printf(pb, "<hr size=1 noshade>Generated at %s", p);
avio_printf(pb, "</body>\n</html>\n");
- len = url_close_dyn_buf(pb, &c->pb_buffer);
+ len = avio_close_dyn_buf(pb, &c->pb_buffer);
c->buffer_ptr = c->pb_buffer;
c->buffer_end = c->pb_buffer + len;
}
@@ -2256,11 +2258,11 @@ static int http_prepare_data(HTTPContext *c)
c->got_key_frame = 0;
/* prepare header and save header data in a stream */
- if (url_open_dyn_buf(&c->fmt_ctx.pb) < 0) {
+ if (avio_open_dyn_buf(&c->fmt_ctx.pb) < 0) {
/* XXX: potential leak */
return -1;
}
- c->fmt_ctx.pb->is_streamed = 1;
+ c->fmt_ctx.pb->seekable = 0;
/*
* HACK to avoid mpeg ps muxer to spit many underflow errors
@@ -2277,7 +2279,7 @@ static int http_prepare_data(HTTPContext *c)
}
av_metadata_free(&c->fmt_ctx.metadata);
- len = url_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer);
+ len = avio_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer);
c->buffer_ptr = c->pb_buffer;
c->buffer_end = c->pb_buffer + len;
@@ -2389,9 +2391,9 @@ static int http_prepare_data(HTTPContext *c)
max_packet_size = RTSP_TCP_MAX_PACKET_SIZE;
else
max_packet_size = url_get_max_packet_size(c->rtp_handles[c->packet_stream_index]);
- ret = url_open_dyn_packet_buf(&ctx->pb, max_packet_size);
+ ret = ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size);
} else {
- ret = url_open_dyn_buf(&ctx->pb);
+ ret = avio_open_dyn_buf(&ctx->pb);
}
if (ret < 0) {
/* XXX: potential leak */
@@ -2399,7 +2401,7 @@ static int http_prepare_data(HTTPContext *c)
}
ost = ctx->streams[pkt.stream_index];
- ctx->pb->is_streamed = 1;
+ ctx->pb->seekable = 0;
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts = av_rescale_q(pkt.dts, ist->time_base, ost->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
@@ -2410,7 +2412,7 @@ static int http_prepare_data(HTTPContext *c)
c->state = HTTPSTATE_SEND_DATA_TRAILER;
}
- len = url_close_dyn_buf(ctx->pb, &c->pb_buffer);
+ len = avio_close_dyn_buf(ctx->pb, &c->pb_buffer);
c->cur_frame_bytes = len;
c->buffer_ptr = c->pb_buffer;
c->buffer_end = c->pb_buffer + len;
@@ -2432,13 +2434,13 @@ static int http_prepare_data(HTTPContext *c)
return -1;
ctx = &c->fmt_ctx;
/* prepare header */
- if (url_open_dyn_buf(&ctx->pb) < 0) {
+ if (avio_open_dyn_buf(&ctx->pb) < 0) {
/* XXX: potential leak */
return -1;
}
- c->fmt_ctx.pb->is_streamed = 1;
+ c->fmt_ctx.pb->seekable = 0;
av_write_trailer(ctx);
- len = url_close_dyn_buf(ctx->pb, &c->pb_buffer);
+ len = avio_close_dyn_buf(ctx->pb, &c->pb_buffer);
c->buffer_ptr = c->pb_buffer;
c->buffer_end = c->pb_buffer + len;
@@ -2503,7 +2505,7 @@ static int http_send_data(HTTPContext *c)
/* if already sending something, then wait. */
if (rtsp_c->state != RTSPSTATE_WAIT_REQUEST)
break;
- if (url_open_dyn_buf(&pb) < 0)
+ if (avio_open_dyn_buf(&pb) < 0)
goto fail1;
interleaved_index = c->packet_stream_index * 2;
/* RTCP packets are sent at odd indexes */
@@ -2518,7 +2520,7 @@ static int http_send_data(HTTPContext *c)
/* write RTP packet data */
c->buffer_ptr += 4;
avio_write(pb, c->buffer_ptr, len);
- size = url_close_dyn_buf(pb, &c->packet_buffer);
+ size = avio_close_dyn_buf(pb, &c->packet_buffer);
/* prepare asynchronous TCP sending */
rtsp_c->packet_buffer_ptr = c->packet_buffer;
rtsp_c->packet_buffer_end = c->packet_buffer + size;
@@ -2723,7 +2725,7 @@ static int http_receive_data(HTTPContext *c)
pb = avio_alloc_context(c->buffer, c->buffer_end - c->buffer,
0, NULL, NULL, NULL, NULL);
- pb->is_streamed = 1;
+ pb->seekable = 0;
if (av_open_input_stream(&s, pb, c->stream->feed_filename, fmt_in, NULL) < 0) {
av_free(pb);
@@ -2850,7 +2852,7 @@ static int rtsp_parse_request(HTTPContext *c)
av_strlcpy(c->url, url, sizeof(c->url));
av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
- if (url_open_dyn_buf(&c->pb) < 0) {
+ if (avio_open_dyn_buf(&c->pb) < 0) {
/* XXX: cannot do more */
c->pb = NULL; /* safety */
return -1;
@@ -2907,7 +2909,7 @@ static int rtsp_parse_request(HTTPContext *c)
rtsp_reply_error(c, RTSP_STATUS_METHOD);
the_end:
- len = url_close_dyn_buf(c->pb, &c->pb_buffer);
+ len = avio_close_dyn_buf(c->pb, &c->pb_buffer);
c->pb = NULL; /* safety */
if (len < 0) {
/* XXX: cannot do more */
@@ -3444,7 +3446,7 @@ static int rtp_new_av_stream(HTTPContext *c,
c->stream->filename, stream_index, c->protocol);
/* normally, no packets should be output here, but the packet size may be checked */
- if (url_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) {
+ if (ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) {
/* XXX: close stream */
goto fail;
}
@@ -3456,7 +3458,7 @@ static int rtp_new_av_stream(HTTPContext *c,
av_free(ctx);
return -1;
}
- url_close_dyn_buf(ctx->pb, &dummy_buf);
+ avio_close_dyn_buf(ctx->pb, &dummy_buf);
av_free(dummy_buf);
c->rtp_ctx[stream_index] = ctx;
OpenPOWER on IntegriCloud