[MPlayer-dev-eng] Playlists & MPlayer

Fabian Franz FabianFranz at gmx.de
Sat Jan 11 18:55:51 CET 2003


Hi,

from my favorite movie player, I would expect to detect playlists and play 
them without me having to do sth ...

Hmm, it turned out that it was not so easy ...

"mplayer -playlist playlistfile.pls" - worked!
"mplayer -playlist somemovie.avi" - worked not!
"mplayer playlistfile.pls" - worked not!
"mplayer somemovie.avi" - of course worked!

While this could be expected with -playlist switch it gives certain problems 
to for example browser plugins, which cannot know about files passed to 
mplayer ...

I would expect mplayer to try the playlist-format after all other demuxers 
failed:

A quick hack turned out to solve the problem:

demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id);

if(!demuxer) 
{
  if (1)
  {
    play_tree_t* entry;
    // Handle playlist
    current_module="handle_playlist";
    mp_msg(MSGT_CPLAYER,MSGL_V,"Falling back on trying to parse playlist 
%s...\n",filename);
    stream_reset(stream);
    stream_seek(stream,stream->start_pos);
    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;
    goto goto_next_file;
  }
  goto goto_next_file; // exit_player(MSGTR_Exit_error); // ERROR
}

(sorry for the if (1), it was a placeholder for example some option)

This works with streamed and local files ... (Why didn't anyone try this 
before ?)

Btw. before I forget plaintext-parsing is not broken, but somewhat too 
error-tolerant (Tries to include file with not allowed characters for example 
...)

Ok, this works, but is imho not nice, as it duplicates code ... (Can Streaming 
layer ever detect the format right in all cases ?)

And for example for mov-referencing this has to be duplicated once more ...

I therefor vote for a function, that does this:

e.g.: playtree_add_playlist(playtree_t entry)

And I think it would be even more nice to have this playlist-parsing in an own 
demuxer ... (It is some kind of demuxing, isn't it ?)

It would be even more nice, to have that "Sorry, this file format is not 
recognized/supported" gone away, which of course now appears ...

Alas, there remain some questions open:

- Is such a function wished and should it be included in demuxer-level ?
  - If so, how can it pass entry to mplayer.c (using some of the 
demuxer->audio/video pointers as a hack ??? :-( )

I just want to ask, before I start coding this, as I want this damn playlists 
to always work ...

Perhaps the solution, which is now satisfies developers already ? :-))

If so, I can cleanup and make a patch and we can make an option: 
-disable-playlist-fallback or so ...

Tell me your opinions!

cu

Fabian



More information about the MPlayer-dev-eng mailing list