summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-23 15:29:51 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-23 15:29:51 +0000
commit51a7a444496f9376e762dd904abc5cfeefd12d43 (patch)
tree4897bcad5e52f7b9dcfa1f31a7e205a93dea0a9e /libmpdemux
parent8f64f240fe18674e6d30fddf006c2918b95b4529 (diff)
downloadmpv-51a7a444496f9376e762dd904abc5cfeefd12d43.tar.bz2
mpv-51a7a444496f9376e762dd904abc5cfeefd12d43.tar.xz
Multiple unsv/scast bug fixes.
* use recv instead of read for MinGW compatibility * detect EOF more reliably * use ultravox only for unsv:// instead of trying autodetection git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16071 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/http.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/libmpdemux/http.c b/libmpdemux/http.c
index 54c8fc90a3..89d6fda90b 100644
--- a/libmpdemux/http.c
+++ b/libmpdemux/http.c
@@ -57,7 +57,7 @@ static unsigned my_read(int fd, char *buffer, int len, streaming_ctrl_t *sc) {
sc->buffer_pos += cp_len;
pos += cp_len;
while (pos < len) {
- int ret = read(fd, &buffer[pos], len - pos);
+ int ret = recv(fd, &buffer[pos], len - pos, 0);
if (ret <= 0)
break;
pos += ret;
@@ -73,13 +73,16 @@ static unsigned my_read(int fd, char *buffer, int len, streaming_ctrl_t *sc) {
*/
static unsigned uvox_meta_read(int fd, streaming_ctrl_t *sc) {
unsigned metaint;
- unsigned char info[6];
+ unsigned char info[6] = {0, 0, 0, 0, 0, 0};
+ int info_read;
do {
- my_read(fd, info, 1, sc);
+ info_read = my_read(fd, info, 1, sc);
if (info[0] == 0x00)
- my_read(fd, info, 6, sc);
+ info_read = my_read(fd, info, 6, sc);
else
- my_read(fd, &info[1], 5, sc);
+ info_read += my_read(fd, &info[1], 5, sc);
+ if (info_read != 6) // read error or eof
+ return 0;
// sync byte and reserved flags
if (info[0] != 0x5a || (info[1] & 0xfc) != 0x00) {
mp_msg(MSGT_DEMUXER, MSGL_ERR, "Invalid or unknown uvox metadata\n");
@@ -141,7 +144,11 @@ static int scast_streaming_read(int fd, char *buffer, int size,
while (done < size) { // now comes the metadata
if (sd->is_ultravox)
+ {
sd->metaint = uvox_meta_read(fd, sc);
+ if (!sd->metaint)
+ size = done;
+ }
else
scast_meta_read(fd, sc); // read and display metadata
sd->metapos = 0;
@@ -162,7 +169,7 @@ static int scast_streaming_start(stream_t *stream) {
int fromhdr;
scast_data_t *scast_data;
HTTP_header_t *http_hdr = stream->streaming_ctrl->data;
- int is_ultravox = http_hdr && strcasecmp(http_hdr->protocol, "ICY") != 0;
+ int is_ultravox = strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0;
if (!stream || stream->fd < 0 || !http_hdr)
return -1;
if (is_ultravox)
@@ -836,8 +843,7 @@ static int fixup_open(stream_t *stream,int seekable) {
HTTP_header_t *http_hdr = stream->streaming_ctrl->data;
int is_icy = http_hdr && strcasecmp(http_hdr->protocol, "ICY") == 0;
char *content_type = http_get_field( http_hdr, "Content-Type" );
- int is_ultravox = http_hdr && content_type &&
- strcasecmp(content_type, "misc/ultravox") == 0;
+ int is_ultravox = strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0;
stream->type = STREAMTYPE_STREAM;
if(!is_icy && !is_ultravox && seekable)