summaryrefslogtreecommitdiffstats
path: root/asxparser.c
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-22 22:47:17 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-01-22 22:47:17 +0000
commit88a6227cbb047d684034d459ad902bf2a7d400a7 (patch)
tree5fe225a3fdcc8ffe6a2491e5a0db5a1efd3cf8f0 /asxparser.c
parenteed7858a7405e8b3861b77dc77bde4aae359c8ac (diff)
downloadmpv-88a6227cbb047d684034d459ad902bf2a7d400a7.tar.bz2
mpv-88a6227cbb047d684034d459ad902bf2a7d400a7.tar.xz
Implementation of entryref
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4310 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'asxparser.c')
-rw-r--r--asxparser.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/asxparser.c b/asxparser.c
index a6c5196cd5..4571bc22e9 100644
--- a/asxparser.c
+++ b/asxparser.c
@@ -5,6 +5,7 @@
#include <string.h>
#include <unistd.h>
+#include "playtreeparser.h"
#include "asxparser.h"
#include "mp_msg.h"
@@ -436,7 +437,7 @@ asx_parse_ref(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) {
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 @@ asx_parse_ref(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) {
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 @@ asx_parse_repeat(ASX_Parser_t* parser,char* buffer,char** _attribs) {
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) {