[MPlayer-dev-eng] [PATCH] enable seeking in RM files by default

Moritz Bunkus moritz at bunkus.org
Sun May 2 20:57:17 CEST 2004


Hi,

by default RM files are not seekable unless the user specifies
-idx. This sucks. Here's my take on enabling it by default, just like
all the other demuxers...

Mosu

-- 
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds
-------------- next part --------------
Index: demux_real.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_real.c,v
retrieving revision 1.59
diff -u -r1.59 demux_real.c
--- demux_real.c	1 May 2004 01:28:31 -0000	1.59
+++ demux_real.c	2 May 2004 18:55:48 -0000
@@ -221,7 +221,7 @@
 
 static void add_index_item(demuxer_t *demuxer, int stream_id, int timestamp, int offset)
 {
-  if (index_mode > 0 && (unsigned)stream_id < MAX_STREAMS)
+  if ((unsigned)stream_id < MAX_STREAMS)
   {
     real_priv_t *priv = demuxer->priv;
     real_index_table_t *index;
@@ -1469,7 +1469,7 @@
 
     if (index_mode == 2)
 	generate_index(demuxer);
-    else if (priv->index_chunk_offset && (index_mode == 1))
+    else if (priv->index_chunk_offset && demuxer->seekable && (priv->index_chunk_offset < demuxer->movi_end))
 	parse_index_chunk(demuxer);
 
     // detect streams:
@@ -1521,9 +1521,6 @@
     int streams = 0;
     int retried = 0;
 
-    if ((index_mode != 1) && (index_mode != 2))
-	return 0;
-
     if (sh_video && (unsigned)vid < MAX_STREAMS && priv->index_table_size[vid])
 	streams |= 1;
     if (sh_audio && (unsigned)aid < MAX_STREAMS && priv->index_table_size[aid])


More information about the MPlayer-dev-eng mailing list