changeset 4729:f51bd827ed1c

fixed MP3 ICY detection, return detected file format for open_stream
author alex
date Sat, 16 Feb 2002 21:48:59 +0000
parents dab19bd91cde
children 330462dd5569
files libmpdemux/network.c libmpdemux/network.h libmpdemux/open.c
diffstat 3 files changed, 18 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/network.c	Sat Feb 16 19:58:39 2002 +0000
+++ b/libmpdemux/network.c	Sat Feb 16 21:48:59 2002 +0000
@@ -34,7 +34,7 @@
 	int demuxer_type;
 } mime_type_table[] = {
 	// MP3 streaming, some MP3 streaming server answer with audio/mpeg
-	{ "audio/mpeg", DEMUXER_TYPE_MPEG_PS },
+	{ "audio/mpeg", DEMUXER_TYPE_AUDIO },
 	// MPEG streaming
 	{ "video/mpeg", DEMUXER_TYPE_MPEG_PS },
 	// AVI ??? => video/x-msvideo
@@ -68,6 +68,8 @@
 	{ "viv", DEMUXER_TYPE_VIVO },
 	{ "rm", DEMUXER_TYPE_REAL },
 	{ "y4m", DEMUXER_TYPE_Y4M },
+	{ "mp3", DEMUXER_TYPE_AUDIO },
+	{ "wav", DEMUXER_TYPE_AUDIO },
 };
 
 streaming_ctrl_t *
@@ -400,7 +402,7 @@
 			// Check if the response is an ICY status_code reason_phrase
 			if( !strcasecmp(http_hdr->protocol, "ICY") ) {
 				// Ok, we have detected an mp3 streaming
-				*file_format = DEMUXER_TYPE_MPEG_PS;
+				*file_format = DEMUXER_TYPE_AUDIO;
 				return 0;
 			}
 			
@@ -658,7 +660,7 @@
 }
 
 int
-streaming_start(stream_t *stream, int demuxer_type, URL_t *url) {
+streaming_start(stream_t *stream, int *demuxer_type, URL_t *url) {
 	int ret;
 	if( stream==NULL ) return -1;
 
@@ -667,7 +669,7 @@
 		return -1;
 	}
 	stream->streaming_ctrl->url = check4proxies( url );
-	ret = autodetectProtocol( stream->streaming_ctrl, &stream->fd, &demuxer_type );
+	ret = autodetectProtocol( stream->streaming_ctrl, &stream->fd, demuxer_type );
 	if( ret<0 ) {
 		return -1;
 	}
@@ -683,7 +685,7 @@
 		ret = rtp_streaming_start( stream );
 	} else
 	// For connection-oriented streams, we can usually determine the streaming type.
-	switch( demuxer_type ) {
+	switch( *demuxer_type ) {
 		case DEMUXER_TYPE_ASF:
 			// Send the appropriate HTTP request
 			// Need to filter the network stream.
@@ -693,10 +695,17 @@
 				printf("asf_streaming_start failed\n");
 			}
 			break;
+		case DEMUXER_TYPE_MPEG_ES:
+		case DEMUXER_TYPE_MPEG_PS:
 		case DEMUXER_TYPE_AVI:
 		case DEMUXER_TYPE_MOV:
-		case DEMUXER_TYPE_MPEG_ES:
-		case DEMUXER_TYPE_MPEG_PS:
+		case DEMUXER_TYPE_VIVO:
+		case DEMUXER_TYPE_FLI:
+		case DEMUXER_TYPE_REAL:
+		case DEMUXER_TYPE_Y4M:
+		case DEMUXER_TYPE_FILM:
+		case DEMUXER_TYPE_ROQ:
+		case DEMUXER_TYPE_AUDIO:
 		case DEMUXER_TYPE_UNKNOWN:
 			// Generic start, doesn't need to filter
 			// the network stream, it's a raw stream
--- a/libmpdemux/network.h	Sat Feb 16 19:58:39 2002 +0000
+++ b/libmpdemux/network.h	Sat Feb 16 21:48:59 2002 +0000
@@ -38,7 +38,7 @@
 	void *data;
 } streaming_ctrl_t;
 
-//int streaming_start( stream_t *stream, int demuxer_type, URL_t *url );
+//int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url );
 
 int streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size);
 
--- a/libmpdemux/open.c	Sat Feb 16 19:58:39 2002 +0000
+++ b/libmpdemux/open.c	Sat Feb 16 21:48:59 2002 +0000
@@ -410,7 +410,7 @@
   url = url_new(filename);
   if(url) {
         stream=new_stream(f,STREAMTYPE_STREAM);
-	if( streaming_start( stream, *file_format, url )<0){
+	if( streaming_start( stream, file_format, url )<0){
           mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_UnableOpenURL, filename);
 	  url_free(url);
 	  return NULL;