changeset 9749:58e5880f4788

Use new config headers Remove STREAMTYPE_PLAYLIST.
author albeu
date Sun, 30 Mar 2003 17:10:36 +0000
parents f74f8b809697
children 0d4904611455
files libmpdemux/asf_streaming.c libmpdemux/network.c playtreeparser.c
diffstat 3 files changed, 15 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/asf_streaming.c	Sun Mar 30 17:09:17 2003 +0000
+++ b/libmpdemux/asf_streaming.c	Sun Mar 30 17:10:36 2003 +0000
@@ -11,6 +11,7 @@
 #include "asf.h"
 
 #include "stream.h"
+#include "demuxer.h"
 
 #include "network.h"
 
@@ -24,7 +25,7 @@
 extern int verbose;
 
 
-int asf_http_streaming_start( stream_t *stream );
+int asf_http_streaming_start( stream_t *stream, int *demuxer_type );
 int asf_mmst_streaming_start( stream_t *stream );
 
 
@@ -47,7 +48,7 @@
 // 		In MPlayer case since HTTP support is more reliable,
 // 		we are doing HTTP first then we try MMST if HTTP fail.
 int
-asf_streaming_start( stream_t *stream ) {
+asf_streaming_start( stream_t *stream, int *demuxer_type) {
 	char proto_s[10];
 	int fd = -1;
 	
@@ -58,7 +59,7 @@
 		!strncasecmp( proto_s, "http_proxy", 10)
 		) {
 		mp_msg(MSGT_NETWORK,MSGL_V,"Trying ASF/HTTP...\n");
-		fd = asf_http_streaming_start( stream );
+		fd = asf_http_streaming_start( stream, demuxer_type );
 		if( fd>-1 ) return fd;
 		mp_msg(MSGT_NETWORK,MSGL_V,"  ===> ASF/HTTP failed\n");
 		if( fd==-2 ) return -1;
@@ -619,7 +620,7 @@
 }
 
 int
-asf_http_streaming_start( stream_t *stream ) {
+asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
 	HTTP_header_t *http_hdr=NULL;
 	URL_t *url = stream->streaming_ctrl->url;
 	asf_http_streaming_ctrl_t *asf_http_ctrl;
@@ -717,7 +718,7 @@
 						return -1;
 					}
 				}
-				stream->type = STREAMTYPE_PLAYLIST;
+				*demuxer_type = DEMUXER_TYPE_PLAYLIST;
 				done = 1;
 				break;
 			case ASF_Authenticate_e:
--- a/libmpdemux/network.c	Sun Mar 30 17:09:17 2003 +0000
+++ b/libmpdemux/network.c	Sun Mar 30 17:10:36 2003 +0000
@@ -18,7 +18,7 @@
 
 #include "stream.h"
 #include "demuxer.h"
-#include "../cfgparser.h"
+#include "../m_config.h"
 
 #include "network.h"
 #include "http.h"
@@ -36,7 +36,7 @@
 
 extern int mp_input_check_interrupt(int time);
 
-int asf_streaming_start( stream_t *stream );
+int asf_streaming_start( stream_t *stream, int *demuxer_type );
 int rtsp_streaming_start( stream_t *stream );
 
 /* Variables for the command line option -user, -passwd & -bandwidth */
@@ -1006,7 +1006,9 @@
 			// Send the appropriate HTTP request
 			// Need to filter the network stream.
 			// ASF raw stream is encapsulated.
-			ret = asf_streaming_start( stream );
+			// It can also be a playlist (redirector)
+			// so we need to pass demuxer_type too
+			ret = asf_streaming_start( stream, demuxer_type );
 			if( ret<0 ) {
 				mp_msg(MSGT_NETWORK,MSGL_ERR,"asf_streaming_start failed\n");
 			}
@@ -1040,8 +1042,6 @@
 			if( ret<0 ) {
 				mp_msg(MSGT_NETWORK,MSGL_ERR,"nop_streaming_start failed\n");
 			}
-			if((*demuxer_type) == DEMUXER_TYPE_PLAYLIST)
-			  stream->type = STREAMTYPE_PLAYLIST;
 			break;
 		default:
 			mp_msg(MSGT_NETWORK,MSGL_ERR,"Unable to detect the streaming type\n");
--- a/playtreeparser.c	Sun Mar 30 17:09:17 2003 +0000
+++ b/playtreeparser.c	Sun Mar 30 17:10:36 2003 +0000
@@ -11,7 +11,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include "cfgparser.h"
+#include "m_config.h"
 #include "playtree.h"
 #include "playtreeparser.h"
 #include "libmpdemux/stream.h"
@@ -456,7 +456,6 @@
 
 #ifdef MP_DEBUG
   assert(stream != NULL);
-//  assert(stream->type == STREAMTYPE_PLAYLIST);
 #endif
 
   p = play_tree_parser_new(stream,0);
@@ -517,24 +516,18 @@
 parse_playlist_file(char* file) {
   stream_t *stream;
   play_tree_t* ret;
-  int fd;
+  int f;
 
-  if(!strcmp(file,"-"))
-    fd = 0;
-  else
-    fd = open(file,O_RDONLY);
+  stream = open_stream(file,0,&f);
 
-  if(fd < 0) {
+  if(!stream) {
     mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Error while opening playlist file %s : %s\n",file,strerror(errno));
     return NULL;
   }
 
   mp_msg(MSGT_PLAYTREE,MSGL_V,"Parsing playlist file %s...\n",file);
 
-  stream = new_stream(fd,STREAMTYPE_PLAYLIST);
   ret = parse_playtree(stream,1);
-  if(close(fd) < 0)
-    mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Warning error while closing playlist file %s : %s\n",file,strerror(errno));
   free_stream(stream);
 
   play_tree_add_bpf(ret, file);