[MPlayer-dev-eng] SMIL support for MPlayer

Dave Lambley mplayer-dev-eng at dlambley.freeserve.co.uk
Thu Jul 3 23:50:05 CEST 2003


Hi,

On Tue, 2003-07-01 at 20:06, Ernesto Ferrari wrote:
> You could look at http://www.w3.org/AudioVideo/ at the "demos" voice, or
> http://www.realnetworks.com/resources/samples/smil.html
> http://www.oratrix.com/Demos?zone=Demos

I've just had a look at these. The first and last of these three will
never work with the way my code works. You can't do what they're trying
to do with a simple playlist.

The RealNetworks example scripts would probably work, except they want
to deliver the SMIL file to you by RTSP. Is there a good reason for
this? I don't have access to a PC with RealOne play on to sniff the
protocol, so I haven't tried.

If anyone would like to hack the protocol, I've attached parser. It's
not very useful until someone does, so I haven't tidied it up yet!

To do useful stuff with SMIL, you'd need to have control over the
layout, control over buffering and be able to show several streams at
once. G2 based SMIL player anyone?

The patch includes some code to detect the .ram playlists. We can't do
these properly with playlists either, so I just pretend it's a plain
text list.

IMHO MPlayer G2 should be renamed to MPlayerOne. G2's sounding old and
it's not even finished...

Cheers,
Dave

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smilparser.cpp
Type: text/x-c++
Size: 4678 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20030703/27886c1e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smilparser.h
Type: text/x-c-header
Size: 263 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20030703/27886c1e/attachment-0001.bin>
-------------- next part --------------
? cap1
? cap2
? cap3
? ffmpeg
? mplayer.core
? race_bb.ram
? smil.patch
? smildemohurl.ram
? smilparser.cpp
? smilparser.h
? ~configure
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/Makefile,v
retrieving revision 1.267
diff -u -r1.267 Makefile
--- Makefile	1 Jun 2003 13:39:49 -0000	1.267
+++ Makefile	3 Jul 2003 21:49:23 -0000
@@ -22,7 +22,7 @@
 DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
 endif
 
-SRCS_COMMON = cpudetect.c codec-cfg.c cfgparser.c my_profile.c spudec.c playtree.c playtreeparser.c asxparser.c vobsub.c subreader.c sub_cc.c find_sub.c m_config.c m_option.c parser-cfg.c m_struct.c
+SRCS_COMMON = cpudetect.c codec-cfg.c cfgparser.c my_profile.c spudec.c playtree.c playtreeparser.c asxparser.c vobsub.c subreader.c sub_cc.c find_sub.c m_config.c m_option.c parser-cfg.c m_struct.c smilparser.cpp
 SRCS_MENCODER = mencoder.c mp_msg-mencoder.c $(SRCS_COMMON) libao2/afmt.c divx4_vbr.c libvo/aclib.c libvo/osd.c libvo/sub.c libvo/font_load.c libvo/font_load_ft.c xvid_vbr.c parser-mecmd.c
 SRCS_MPLAYER = mplayer.c mp_msg.c $(SRCS_COMMON) mixer.c parser-mpcmd.c
 
@@ -36,7 +36,7 @@
 VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB) 
 AO_LIBS = $(ARTS_LIB) $(ESD_LIB) $(NAS_LIB) $(SGIAUDIO_LIB)
 CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(THEORA_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(DECORE_LIB) $(XVID_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB) $(MATROSKA_LIB) 
-COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a osdep/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(MPLAYER_NETWORK_LIB) $(WIN32_LIB) $(GIF_LIB) $(MACOSX_FRAMEWORKS) $(SMBSUPPORT_LIB) $(FRIBIDI_LIB)
+COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a osdep/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(MPLAYER_NETWORK_LIB) $(WIN32_LIB) $(GIF_LIB) $(MACOSX_FRAMEWORKS) $(SMBSUPPORT_LIB) $(FRIBIDI_LIB) $(EXPAT_LIB)
 
 CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) $(X11_INC) $(FRIBIDI_INC) # -Wall
 
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.734
diff -u -r1.734 configure
--- configure	3 Jul 2003 17:36:52 -0000	1.734
+++ configure	3 Jul 2003 21:49:50 -0000
@@ -5026,6 +5026,24 @@
 fi
 echores "$_gethostbyname2"
 
+
+echocheck "expat"
+_expat=no
+cat > $TMPC <<EOF
+#include <expat.h>
+int main(void) { XML_Parser p; p=XML_ParserCreate(NULL); XML_ParserFree(p); return 0; }
+EOF
+cc_check -x c++ -lexpat && _expat=yes
+# expat 1.95.6 is broken in c++. Use 1.95.5 or a later (CVS ATM) version
+if test "$_expat" = yes ; then
+  _def_expat="#define HAVE_EXPAT `$TMPO`"
+  _ld_expat="-lexpat -lstdc++"
+else
+  _def_expat='#undef HAVE_EXPAT'
+fi
+echores "$_expat"
+
+
 # --------------- GUI specific tests begin -------------------
 echocheck "GUI"
 echo "$_gui"
@@ -5416,6 +5434,7 @@
 XMMS_LIB = $_xmms_lib
 MACOSX = $_macosx
 MACOSX_FRAMEWORKS = $_macosx_frameworks
+EXPAT_LIB = $_ld_expat
 
 # --- Some stuff for autoconfigure ----
 $_target_arch
@@ -5741,6 +5760,9 @@
 
 /* Enable *BSD BrookTree TV interface support */
 $_def_tv_bsdbt848
+
+/* Use Expat XML parser */
+$_def_expat
 
 /* Define if your processor stores words with the most significant
    byte first (like Motorola and SPARC, unlike Intel and VAX).  */
Index: playtreeparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/playtreeparser.c,v
retrieving revision 1.21
diff -u -r1.21 playtreeparser.c
--- playtreeparser.c	2 Apr 2003 15:32:12 -0000	1.21
+++ playtreeparser.c	3 Jul 2003 21:49:52 -0000
@@ -17,6 +17,7 @@
 #include "libmpdemux/stream.h"
 #include "mp_msg.h"
 
+#include "smilparser.h"
 
 #if defined(__CYGWIN__) || defined(__OS2__)
 #define PATH_SEP '\\'
@@ -454,6 +455,35 @@
 }
 
 play_tree_t*
+parse_ramplaylist(play_tree_parser_t *p) {
+  char *ptr;
+  
+  mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying .ram playlist...\n");  
+  
+  if (p->stream->url) {
+     ptr = strlen(p->stream->url) + p->stream->url - 1;
+     while (ptr>=p->stream->url && ptr[0]!='.') ptr--;
+     
+     /* Checking for extension is probably the safest test for a RAM playlist */
+     if (strncmp(ptr, ".ram", 4)) return NULL; 
+	  	
+  }
+  
+  while ((ptr = play_tree_parser_get_line(p))!=NULL) {
+    if (!strncmp(ptr, "rtsp://", 7)) {
+      /* A plaintext parser will play the average .ram okay, but not clever ones.
+         see http://service.real.com/help/library/guides/realone/ProductionGuide/HTML/htmfiles/server.htm#94919
+      */
+      mp_msg(MSGT_PLAYTREE, MSGL_STATUS, "File looks like a .ram playlist, parsing as plaintext.\n");
+      play_tree_parser_reset(p);
+      return parse_textplain(p);
+    }
+  }
+  
+  return NULL;
+}
+
+play_tree_t*
 parse_playtree(stream_t *stream, int forced) {
   play_tree_parser_t* p;
   play_tree_t* ret;
@@ -596,6 +626,14 @@
     if(tree) break;
     play_tree_parser_reset(p);
 
+    tree = parse_smil(p);
+    if(tree) break;
+    play_tree_parser_reset(p);
+    
+    tree = parse_ramplaylist(p);
+    if(tree) break;
+    play_tree_parser_reset(p);
+    
     // Here come the others formats ( textplain must stay the last one )
     if (forced)
     {


More information about the MPlayer-dev-eng mailing list