Suppress the "redirector hack" from libavformat/utils.c:av_open_input_stream(),
and implement the redirector format more properly. Originally committed as revision 11112 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
fe2b276c2e
commit
e8acf0edea
@ -1435,12 +1435,12 @@ static int redir_probe(AVProbeData *pd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called from utils.c */
|
static int redir_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||||
int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f)
|
|
||||||
{
|
{
|
||||||
char buf[4096], *q;
|
char buf[4096], *q;
|
||||||
int c;
|
int c;
|
||||||
AVFormatContext *ic = NULL;
|
AVFormatContext *ic = NULL;
|
||||||
|
ByteIOContext *f = s->pb;
|
||||||
|
|
||||||
/* parse each URL and try to open it */
|
/* parse each URL and try to open it */
|
||||||
c = url_fgetc(f);
|
c = url_fgetc(f);
|
||||||
@ -1468,11 +1468,13 @@ int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f)
|
|||||||
if (av_open_input_file(&ic, buf, NULL, 0, NULL) == 0)
|
if (av_open_input_file(&ic, buf, NULL, 0, NULL) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*ic_ptr = ic;
|
|
||||||
if (!ic)
|
if (!ic)
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
else
|
|
||||||
return 0;
|
*s = *ic;
|
||||||
|
url_fclose(f);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVInputFormat redir_demuxer = {
|
AVInputFormat redir_demuxer = {
|
||||||
@ -1480,7 +1482,7 @@ AVInputFormat redir_demuxer = {
|
|||||||
"Redirector format",
|
"Redirector format",
|
||||||
0,
|
0,
|
||||||
redir_probe,
|
redir_probe,
|
||||||
NULL,
|
redir_read_header,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
@ -464,16 +464,6 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: suppress this hack for redirectors */
|
|
||||||
#ifdef CONFIG_REDIR_DEMUXER
|
|
||||||
if (!strcmp(fmt->name, "redir")) {
|
|
||||||
int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f);
|
|
||||||
err = redir_open(ic_ptr, pb);
|
|
||||||
url_fclose(pb);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* check filename in case of an image number is expected */
|
/* check filename in case of an image number is expected */
|
||||||
if (fmt->flags & AVFMT_NEEDNUMBER) {
|
if (fmt->flags & AVFMT_NEEDNUMBER) {
|
||||||
if (!av_filename_number_test(filename)) {
|
if (!av_filename_number_test(filename)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user