Mercurial > libavformat.hg
comparison rtsp.c @ 2785:d3b3cfb538d8 libavformat
Suppress the "redirector hack" from libavformat/utils.c:av_open_input_stream(),
and implement the redirector format more properly.
author | lucabe |
---|---|
date | Thu, 29 Nov 2007 08:35:05 +0000 |
parents | 1301147d9450 |
children | 254eb8cf1c27 |
comparison
equal
deleted
inserted
replaced
2784:7046ab98056e | 2785:d3b3cfb538d8 |
---|---|
1433 av_strstart(p, "rtsp://", NULL)) | 1433 av_strstart(p, "rtsp://", NULL)) |
1434 return AVPROBE_SCORE_MAX; | 1434 return AVPROBE_SCORE_MAX; |
1435 return 0; | 1435 return 0; |
1436 } | 1436 } |
1437 | 1437 |
1438 /* called from utils.c */ | 1438 static int redir_read_header(AVFormatContext *s, AVFormatParameters *ap) |
1439 int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f) | |
1440 { | 1439 { |
1441 char buf[4096], *q; | 1440 char buf[4096], *q; |
1442 int c; | 1441 int c; |
1443 AVFormatContext *ic = NULL; | 1442 AVFormatContext *ic = NULL; |
1443 ByteIOContext *f = s->pb; | |
1444 | 1444 |
1445 /* parse each URL and try to open it */ | 1445 /* parse each URL and try to open it */ |
1446 c = url_fgetc(f); | 1446 c = url_fgetc(f); |
1447 while (c != URL_EOF) { | 1447 while (c != URL_EOF) { |
1448 /* skip spaces */ | 1448 /* skip spaces */ |
1466 //printf("URL='%s'\n", buf); | 1466 //printf("URL='%s'\n", buf); |
1467 /* try to open the media file */ | 1467 /* try to open the media file */ |
1468 if (av_open_input_file(&ic, buf, NULL, 0, NULL) == 0) | 1468 if (av_open_input_file(&ic, buf, NULL, 0, NULL) == 0) |
1469 break; | 1469 break; |
1470 } | 1470 } |
1471 *ic_ptr = ic; | |
1472 if (!ic) | 1471 if (!ic) |
1473 return AVERROR(EIO); | 1472 return AVERROR(EIO); |
1474 else | 1473 |
1475 return 0; | 1474 *s = *ic; |
1475 url_fclose(f); | |
1476 | |
1477 return 0; | |
1476 } | 1478 } |
1477 | 1479 |
1478 AVInputFormat redir_demuxer = { | 1480 AVInputFormat redir_demuxer = { |
1479 "redir", | 1481 "redir", |
1480 "Redirector format", | 1482 "Redirector format", |
1481 0, | 1483 0, |
1482 redir_probe, | 1484 redir_probe, |
1483 NULL, | 1485 redir_read_header, |
1484 NULL, | 1486 NULL, |
1485 NULL, | 1487 NULL, |
1486 }; | 1488 }; |
1487 #endif | 1489 #endif |