[FFmpeg-cvslog] HTTP playback is broken due to 59d96941f0285a501989d5f2c9b69be0a1393ed5
avcoder
ffmpeg at gmail.com
Wed Apr 20 16:08:31 CEST 2011
On Wed, Apr 20, 2011 at 9:55 PM, Nicolas George <
nicolas.george at normalesup.org> wrote:
> Le primidi 1er floréal, an CCXIX, avcoder a écrit :
> > The modification is wrong, it breaks the original logic,
>
> The original logic was flawed.
>
> > eg: it breaks
> HTTP
> > playback.
>
> Please elaborate.
>
>
HTTP need read+write even if you just open/read a HTTP url
but in : av_open_input_file()
/* Do not open file if the format does not need it. XXX: specific
hack needed to handle RTSP/TCP */
if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
/* if no file needed do not try to open one */
if ((err=avio_open(&pb, filename, AVIO_FLAG_READ)) < 0) {
goto fail;
}
if (buf_size > 0) {
ffio_set_buf_size(pb, buf_size);
}
url_ctx = pb->opaque;
if(ap){
url_ctx->control_opaque = ap->control_opaque;
avio_set_interrupt_cb2(ap->interrupt_cb);
}
if (!fmt && (err = av_probe_input_buffer(pb, &fmt, filename, logctx,
0, logctx ? (*ic_ptr)->probesize : 0)) < 0) {
goto fail;
}
}
set the IO flag to AVIO_FLAG_READ
but in http.c: static int http_open_cnx(URLContext *h)
err = ffurl_open(&hd, buf, AVIO_FLAG_READ_WRITE);
we need read+write
but when try to get a character in :
static int http_get_line(HTTPContext *s, char *line, int line_size)
{
int ch;
char *q;
q = line;
for(;;) {
ch = http_getc(s);
if (ch < 0)
return AVERROR(EIO);
if (ch == '\n') {
/* process line */
if (q > line && q[-1] == '\r')
q--;
*q = '\0';
return 0;
} else {
if ((q - line) < line_size - 1)
*q++ = ch;
}
}
}
static int http_getc(HTTPContext *s)
{
int len;
if (s->buf_ptr >= s->buf_end) {
len = ffurl_read(s->hd, s->buffer, BUFFER_SIZE);
if (len < 0) {
return AVERROR(EIO);
} else if (len == 0) {
return -1;
} else {
s->buf_ptr = s->buffer;
s->buf_end = s->buffer + len;
}
}
return *s->buf_ptr++;
}
int ffurl_read(URLContext *h, unsigned char *buf, int size)
{
if (h->flags & AVIO_FLAG_WRITE)
return AVERROR(EIO);
return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read);
}
the flags is 3
will return AVERROR(EIO);
I revert it by attachment
--
-----------------------------------------------------------------------------------------
My key fingerprint: d1:03:f5:32:26:ff:d7:3c:e4:42:e3:51:ec:92:78:b2
My key fingerprint: d1:03:f5:32:26:ff:d7:3c:e4:42:e3:51:ec:92:78:b2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avio_flag.diff
Type: application/octet-stream
Size: 4057 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20110420/b9e81592/attachment.obj>
More information about the ffmpeg-cvslog
mailing list