[Mplayer-cvslog] CVS: main/libmpdemux asf.h,1.6,1.7 asf_streaming.c,1.6,1.7 http.c,1.3,1.4 http.h,1.2,1.3 network.c,1.7,1.8

Bertrand Baudet bertrand at mplayer.dev.hu
Fri Oct 26 20:26:27 CEST 2001


Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv24107/libmpdemux

Modified Files:
	asf.h asf_streaming.c http.c http.h network.c 
Log Message:
Added ASF http server streaming (Not mms streaming).
Fixed one bug in the ASF mms streaming.
Fixed a typo in http.


Index: asf.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- asf.h	11 Aug 2001 20:37:33 -0000	1.6
+++ asf.h	26 Oct 2001 18:26:05 -0000	1.7
@@ -113,7 +113,8 @@
 	ASF_Unknown_e,
 	ASF_Live_e,
 	ASF_Prerecorded_e,
-	ASF_Redirector_e
+	ASF_Redirector_e,
+	ASF_PlainText_e
 } ASF_StreamType_e;
 
 

Index: asf_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_streaming.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- asf_streaming.c	1 Aug 2001 09:14:02 -0000	1.6
+++ asf_streaming.c	26 Oct 2001 18:26:06 -0000	1.7
@@ -20,7 +20,7 @@
 	char *buffer;
 	int drop_packet;
 	int ret;
-printf("asf_streaming_read\n");
+printf("asf_http_streaming_read\n");
 	ret = asf_streaming( streaming_ctrl->buffer->buffer, streaming_ctrl->buffer->length, &drop_packet );
 printf("ret: %d\n", ret);
 	if( ret<0 ) return -1;
@@ -42,6 +42,25 @@
 	return ret;
 }
 
+int
+asf_http_read( streaming_ctrl_t *streaming_ctrl ) {
+	char *buffer;
+	unsigned int length = streaming_ctrl->buffer->length;
+
+	buffer = (char*)malloc(length);
+	if( buffer==NULL ) {
+		printf("Memory allocation failed\n");
+		return -1;
+	}
+	
+	net_fifo_pop( streaming_ctrl->buffer, buffer, length );
+
+	write( streaming_ctrl->fd_pipe_in, buffer, length );
+
+	free( buffer );
+	return length;
+}
+
 int 
 asf_streaming(char *data, int length, int *drop_packet ) {
 	ASF_stream_chunck_t *stream_chunck=(ASF_stream_chunck_t*)data;
@@ -115,6 +134,9 @@
 			(!strcasecmp(content_type, "video/x-ms-wma")) ) {
 			printf("=====> ASF Redirector\n");
 			return ASF_Redirector_e;
+		} else if( !strcasecmp(content_type, "text/plain") ) {
+			printf("=====> ASF Plain text\n");
+			return ASF_PlainText_e;
 		} else {
 			printf("=====> ASF unknown content-type: %s\n", content_type );
 			return ASF_Unknown_e;
@@ -239,11 +261,11 @@
 	}
 
 	streaming_type = asf_http_streaming_type( content_type, features );
-
+/*
 	if( http_hdr->body_size>0 ) {
 		asf_streaming( http_hdr->body, http_hdr->body_size, NULL);
 	}
-
+*/
 	return 0;
 }
 
@@ -289,7 +311,7 @@
 				return -1;
 			}
 			http_response_append( http_hdr, buffer, i );
-		} while( !http_is_header_entired( http_hdr ) );
+		} while( !http_is_header_entire( http_hdr ) );
 //http_hdr->buffer[http_hdr->buffer_len]='\0';
 //printf("[%s]\n", http_hdr->buffer );
 		if( asf_http_parse_response(http_hdr)<0 ) {
@@ -300,8 +322,8 @@
 		switch( streaming_type ) {
 			case ASF_Live_e:
 			case ASF_Prerecorded_e:
+			case ASF_PlainText_e:
 				if( http_hdr->body_size>0 ) {
-printf("--- 0x%02X\n", streaming_ctrl->buffer );
 					net_fifo_push( streaming_ctrl->buffer, http_hdr->body, http_hdr->body_size );
 				} else {
 					ASF_stream_chunck_t *ptr;
@@ -342,8 +364,12 @@
 	} while(!done);
 
 	streaming_ctrl->fd_net = fd;
-	streaming_ctrl->streaming_read = asf_http_streaming_read;
-        streaming_ctrl->prebuffer_size = 10000;
+	if( streaming_type==ASF_PlainText_e ) {
+		streaming_ctrl->streaming_read = asf_http_read;
+	} else {
+		streaming_ctrl->streaming_read = asf_http_streaming_read;
+	}
+        streaming_ctrl->prebuffer_size = 20000;
 	streaming_ctrl->buffering = 1;
 	streaming_ctrl->status = streaming_playing_e;
 

Index: http.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/http.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- http.c	5 Jun 2001 08:46:31 -0000	1.3
+++ http.c	26 Oct 2001 18:26:06 -0000	1.4
@@ -62,7 +62,7 @@
 }
 
 int
-http_is_header_entired( HTTP_header_t *http_hdr ) {
+http_is_header_entire( HTTP_header_t *http_hdr ) {
 	if( http_hdr==NULL ) return -1;
 
 	if( strstr(http_hdr->buffer, "\r\n\r\n")==NULL ) return 0;

Index: http.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/http.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- http.h	29 May 2001 16:57:48 -0000	1.2
+++ http.h	26 Oct 2001 18:26:06 -0000	1.3
@@ -31,7 +31,7 @@
 void		http_free( HTTP_header_t *http_hdr );
 int		http_response_append( HTTP_header_t *http_hdr, char *data, int length );
 int		http_response_parse( HTTP_header_t *http_hdr );
-int		http_is_header_entired( HTTP_header_t *http_hdr );
+int		http_is_header_entire( HTTP_header_t *http_hdr );
 char* 		http_build_request( HTTP_header_t *http_hdr );
 char* 		http_get_field( HTTP_header_t *http_hdr, const char *field_name );
 char*		http_get_next_field( HTTP_header_t *http_hdr );

Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- network.c	22 Aug 2001 19:40:46 -0000	1.7
+++ network.c	26 Oct 2001 18:26:06 -0000	1.8
@@ -256,7 +256,7 @@
 			printf("Read failed\n");
 		}
 		http_response_append( http_hdr, response, i );
-	} while( !http_is_header_entired( http_hdr ) ); 
+	} while( !http_is_header_entire( http_hdr ) ); 
 	http_response_parse( http_hdr );
 	return http_hdr;
 }




More information about the MPlayer-cvslog mailing list