[Mplayer-cvslog] CVS: main asxparser.c,1.8,1.9 mencoder.c,1.198,1.199 mplayer.c,1.648,1.649 playtree.h,1.6,1.7 playtreeparser.c,1.16,1.17 playtreeparser.h,1.3,1.4
Arpi of Ize
arpi at mplayerhq.hu
Sun Jan 12 20:41:40 CET 2003
Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv25841
Modified Files:
asxparser.c mencoder.c mplayer.c playtree.h playtreeparser.c
playtreeparser.h
Log Message:
this patch adds an fallback to playlist (any but the plaintext-list format)
after all demuxers failed. so -playlist is not needed any more!
patch by Fabian Franz <FabianFranz at gmx.de>, with some small modifications
Index: asxparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/asxparser.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- asxparser.c 12 Nov 2002 14:19:53 -0000 1.8
+++ asxparser.c 12 Jan 2003 19:41:37 -0000 1.9
@@ -528,7 +528,7 @@
ptp = play_tree_parser_new(stream,parser->deep+1);
- pt = play_tree_parser_get_play_tree(ptp);
+ pt = play_tree_parser_get_play_tree(ptp, 1);
play_tree_parser_free(ptp);
free_stream(stream);
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -r1.198 -r1.199
--- mencoder.c 5 Jan 2003 14:35:35 -0000 1.198
+++ mencoder.c 12 Jan 2003 19:41:37 -0000 1.199
@@ -391,6 +391,7 @@
if(stream2){
demuxer2=demux_open(stream2,DEMUXER_TYPE_AVI,-1,-1,-2);
if(demuxer2) printf(MSGTR_UsingPass3ControllFile,frameno_filename);
+ else mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized);
}
// New config code
@@ -493,6 +494,7 @@
//demuxer=demux_open(stream,file_format,video_id,audio_id,dvdsub_id);
demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id);
if(!demuxer){
+ mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized);
printf(MSGTR_CannotOpenDemuxer);
mencoder_exit(1,NULL);
}
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.648
retrieving revision 1.649
diff -u -r1.648 -r1.649
--- mplayer.c 12 Jan 2003 15:32:38 -0000 1.648
+++ mplayer.c 12 Jan 2003 19:41:37 -0000 1.649
@@ -585,6 +585,31 @@
return eof;
}
+int playtree_add_playlist(play_tree_t* entry)
+{
+ if(!entry) {
+ entry = playtree_iter->tree;
+ if(play_tree_iter_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) {
+ return PT_NEXT_ENTRY;
+ }
+ if(playtree_iter->tree == entry ) { // Loop with a single file
+ if(play_tree_iter_up_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) {
+ return PT_NEXT_ENTRY;
+ }
+ }
+ play_tree_remove(entry,1,1);
+ return PT_NEXT_SRC;
+ }
+ play_tree_insert_entry(playtree_iter->tree,entry);
+ play_tree_set_params_from(entry,playtree_iter->tree);
+ entry = playtree_iter->tree;
+ if(play_tree_iter_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) {
+ return PT_NEXT_ENTRY;
+ }
+ play_tree_remove(entry,1,1);
+ return PT_NEXT_SRC;
+}
+
static int play_tree_step = 1;
/*
@@ -1125,32 +1150,8 @@
// Handle playlist
current_module="handle_playlist";
mp_msg(MSGT_CPLAYER,MSGL_V,"Parsing playlist %s...\n",filename);
- entry = parse_playtree(stream);
- if(!entry) {
- entry = playtree_iter->tree;
- if(play_tree_iter_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) {
- eof = PT_NEXT_ENTRY;
- goto goto_next_file;
- }
- if(playtree_iter->tree == entry ) { // Loop with a single file
- if(play_tree_iter_up_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) {
- eof = PT_NEXT_ENTRY;
- goto goto_next_file;
- }
- }
- play_tree_remove(entry,1,1);
- eof = PT_NEXT_SRC;
- goto goto_next_file;
- }
- play_tree_insert_entry(playtree_iter->tree,entry);
- play_tree_set_params_from(entry,playtree_iter->tree);
- entry = playtree_iter->tree;
- if(play_tree_iter_step(playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) {
- eof = PT_NEXT_ENTRY;
- goto goto_next_file;
- }
- play_tree_remove(entry,1,1);
- eof = PT_NEXT_SRC;
+ entry = parse_playtree(stream,0);
+ eof=playtree_add_playlist(entry);
goto goto_next_file;
}
stream->start_pos+=seek_to_byte;
@@ -1223,7 +1224,21 @@
current_module="demux_open";
demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id);
-if(!demuxer) goto goto_next_file; // exit_player(MSGTR_Exit_error); // ERROR
+if(!demuxer)
+{
+ play_tree_t* entry;
+ // Handle playlist
+ current_module="handle_playlist";
+ mp_msg(MSGT_CPLAYER,MSGL_INFO,"Falling back on trying to parse playlist %s...\n",filename);
+ stream_reset(stream);
+ stream_seek(stream,stream->start_pos);
+ entry = parse_playtree(stream,0);
+ if(!entry)
+ mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized);
+ else
+ eof=playtree_add_playlist(entry);
+ goto goto_next_file;
+}
inited_flags|=INITED_DEMUXER;
current_module="demux_open2";
Index: playtree.h
===================================================================
RCS file: /cvsroot/mplayer/main/playtree.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- playtree.h 12 Nov 2002 23:39:35 -0000 1.6
+++ playtree.h 12 Jan 2003 19:41:37 -0000 1.7
@@ -158,7 +158,7 @@
play_tree_iter_get_file(play_tree_iter_t* iter, int d);
play_tree_t*
-parse_playtree(struct stream_st *stream);
+parse_playtree(struct stream_st *stream, int forced);
play_tree_t*
play_tree_cleanup(play_tree_t* pt);
Index: playtreeparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/playtreeparser.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- playtreeparser.c 12 Jan 2003 11:45:49 -0000 1.16
+++ playtreeparser.c 12 Jan 2003 19:41:37 -0000 1.17
@@ -251,7 +251,8 @@
play_tree_t *list = NULL, *entry = NULL;
mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying winamp playlist...\n");
- line = play_tree_parser_get_line(p);
+ if (!(line = play_tree_parser_get_line(p)))
+ return NULL;
strstrip(line);
if(strcasecmp(line,"[playlist]"))
return NULL;
@@ -339,7 +340,8 @@
play_tree_t *list = NULL, *entry = NULL;
mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying reference-ini playlist...\n");
- line = play_tree_parser_get_line(p);
+ if (!(line = play_tree_parser_get_line(p)))
+ return NULL;
strstrip(line);
if(strcasecmp(line,"[Reference]"))
return NULL;
@@ -380,7 +382,8 @@
play_tree_t *list = NULL, *entry = NULL;
mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying extended m3u playlist...\n");
- line = play_tree_parser_get_line(p);
+ if (!(line = play_tree_parser_get_line(p)))
+ return NULL;
strstrip(line);
if(strcasecmp(line,"#EXTM3U"))
return NULL;
@@ -447,7 +450,7 @@
}
play_tree_t*
-parse_playtree(stream_t *stream) {
+parse_playtree(stream_t *stream, int forced) {
play_tree_parser_t* p;
play_tree_t* ret;
@@ -460,7 +463,7 @@
if(!p)
return NULL;
- ret = play_tree_parser_get_play_tree(p);
+ ret = play_tree_parser_get_play_tree(p, forced);
play_tree_parser_free(p);
return ret;
@@ -509,7 +512,7 @@
mp_msg(MSGT_PLAYTREE,MSGL_V,"Parsing playlist file %s...\n",file);
stream = new_stream(fd,STREAMTYPE_PLAYLIST);
- ret = parse_playtree(stream);
+ 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);
@@ -555,7 +558,7 @@
}
play_tree_t*
-play_tree_parser_get_play_tree(play_tree_parser_t* p) {
+play_tree_parser_get_play_tree(play_tree_parser_t* p, int forced) {
play_tree_t* tree = NULL;
#ifdef MP_DEBUG
@@ -583,19 +586,23 @@
play_tree_parser_reset(p);
// Here come the others formats ( textplain must stay the last one )
- tree = parse_textplain(p);
- if(tree) break;
+ if (forced)
+ {
+ tree = parse_textplain(p);
+ if(tree) break;
+ }
break;
}
if(tree)
mp_msg(MSGT_PLAYTREE,MSGL_V,"Playlist succefully parsed\n");
- else mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Error while parsing playlist\n");
+ else
+ mp_msg(MSGT_PLAYTREE,((forced==1)?MSGL_ERR:MSGL_V),"Error while parsing playlist\n");
if(tree)
tree = play_tree_cleanup(tree);
- if(!tree) mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Warning empty playlist\n");
+ if(!tree) mp_msg(MSGT_PLAYTREE,((forced==1)?MSGL_WARN:MSGL_V),"Warning empty playlist\n");
return tree;
}
Index: playtreeparser.h
===================================================================
RCS file: /cvsroot/mplayer/main/playtreeparser.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- playtreeparser.h 12 Nov 2002 01:56:21 -0000 1.3
+++ playtreeparser.h 12 Jan 2003 19:41:37 -0000 1.4
@@ -19,6 +19,6 @@
play_tree_parser_free(play_tree_parser_t* p);
play_tree_t*
-play_tree_parser_get_play_tree(play_tree_parser_t* p);
+play_tree_parser_get_play_tree(play_tree_parser_t* p, int forced);
#endif
More information about the MPlayer-cvslog
mailing list