[Mplayer-cvslog] CVS: main asxparser.c,1.2,1.3 asxparser.h,1.1,1.2

Alban Bedel CVS albeu at mplayer.dev.hu
Tue Jan 22 23:47:20 CET 2002


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

Modified Files:
	asxparser.c asxparser.h 
Log Message:
Implementation of entryref


Index: asxparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/asxparser.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- asxparser.c	8 Jan 2002 12:10:33 -0000	1.2
+++ asxparser.c	22 Jan 2002 22:47:17 -0000	1.3
@@ -5,6 +5,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "playtreeparser.h"
 #include "asxparser.h"
 #include "mp_msg.h"
 
@@ -436,7 +437,7 @@
 
   href = asx_get_attrib("HREF",attribs);
   if(href == NULL) {
-    asx_warning_attrib_required(parser,"ENTRYREF" ,"HREF" );
+    asx_warning_attrib_required(parser,"REF" ,"HREF" );
     return;
   }
 
@@ -450,8 +451,43 @@
 
 static play_tree_t*
 asx_parse_entryref(ASX_Parser_t* parser,char* buffer,char** _attribs) {
-  mp_msg(MSGT_PLAYTREE,MSGL_INFO,"Need to implement entryref\n");
-  return NULL;
+  play_tree_t* pt;
+  char *href;
+  stream_t* stream;
+  play_tree_parser_t* ptp;
+  int f;
+
+  if(parser->deep > 0)
+    return NULL;
+
+  href = asx_get_attrib("HREF",_attribs);
+  if(href == NULL) {
+    asx_warning_attrib_required(parser,"ENTRYREF" ,"HREF" );
+    return NULL;
+  }
+  stream=open_stream(href,0,&f);
+  if(!stream) {
+    mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Can't open playlist %s\n",href);
+    return NULL;
+  }
+  if(stream->type != STREAMTYPE_PLAYLIST) {
+    mp_msg(MSGT_PLAYTREE,MSGL_WARN,"URL %s dont point to a playlist\n",href);
+    free_stream(stream);
+    return NULL;
+  }
+
+  mp_msg(MSGT_PLAYTREE,MSGL_V,"Adding playlist %s to element entryref\n",href);
+
+  ptp = play_tree_parser_new(stream,parser->deep+1);
+
+  pt = play_tree_parser_get_play_tree(ptp);
+
+  play_tree_parser_free(ptp);
+  free_stream(stream);
+
+  //mp_msg(MSGT_PLAYTREE,MSGL_INFO,"Need to implement entryref\n");
+    
+  return pt;
 }
 
 static play_tree_t*
@@ -557,13 +593,14 @@
 
 
 play_tree_t*
-asx_parser_build_tree(char* buffer) {
+asx_parser_build_tree(char* buffer,int deep) {
   char *element,*asx_body,**asx_attribs,*body, **attribs;
   int r;
   play_tree_t *asx,*entry,*list = NULL;
   ASX_Parser_t* parser = asx_parser_new();
 
   parser->line = 1;
+  parser->deep = deep;
 
    r = asx_get_element(parser,&buffer,&element,&asx_body,&asx_attribs);
   if(r < 0) {

Index: asxparser.h
===================================================================
RCS file: /cvsroot/mplayer/main/asxparser.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- asxparser.h	8 Jan 2002 01:24:25 -0000	1.1
+++ asxparser.h	22 Jan 2002 22:47:17 -0000	1.2
@@ -13,5 +13,6 @@
   ASX_LineSave_t *ret_stack;
   int ret_stack_size;
   char* last_body;
+  int deep;
 };
   




More information about the MPlayer-cvslog mailing list