[Mplayer-cvslog] CVS: main/libmpdemux demux_roq.c,1.3,1.4

Mike Melanson melanson at mplayer.dev.hu
Mon Feb 18 17:50:25 CET 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv7504/libmpdemux

Modified Files:
	demux_roq.c 
Log Message:
fixed RoQ file detection and FPS determination (maybe)


Index: demux_roq.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_roq.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- demux_roq.c	5 Feb 2002 03:54:08 -0000	1.3
+++ demux_roq.c	18 Feb 2002 16:50:16 -0000	1.4
@@ -26,8 +26,6 @@
 #define CHUNK_TYPE_AUDIO 0
 #define CHUNK_TYPE_VIDEO 1
 
-#define RoQ_FPS 30
-
 typedef struct roq_chunk_t
 {
   int chunk_type;
@@ -49,14 +47,14 @@
 
 // Check if a stream qualifies as a RoQ file based on the magic numbers
 // at the start of the file:
-//  84 10 FF FF FF FF 1E 00
+//  84 10 FF FF FF FF xx xx
 int roq_check_file(demuxer_t *demuxer)
 {
   stream_reset(demuxer->stream);
   stream_seek(demuxer->stream, 0);
 
   if ((stream_read_dword(demuxer->stream) == 0x8410FFFF) &&
-      (stream_read_dword(demuxer->stream) == 0xFFFF1E00))
+      ((stream_read_dword(demuxer->stream) & 0xFFFF0000) == 0xFFFF0000))
     return 1;
   else
     return 0;
@@ -103,6 +101,7 @@
   int chunk_arg;
   int last_chunk_id = 0;
   int largest_audio_chunk = 0;
+  int fps;
 
   roq_data->total_chunks = 0;
   roq_data->current_chunk = 0;
@@ -110,7 +109,8 @@
   roq_data->chunks = NULL;
 
   // position the stream and start traversing
-  stream_seek(demuxer->stream, 8);
+  stream_seek(demuxer->stream, 6);
+  fps = stream_read_word_le(demuxer->stream);
   while (!stream_eof(demuxer->stream))
   {
     chunk_id = stream_read_word_le(demuxer->stream);
@@ -144,7 +144,7 @@
         sh_video->format = mmioFOURCC('R', 'o', 'Q', 'V');
 
         // constant frame rate
-        sh_video->fps = 1000 / RoQ_FPS;
+        sh_video->fps = fps;
         sh_video->frametime = 1 / sh_video->fps;
       }
     }
@@ -239,8 +239,6 @@
   demuxer->priv = roq_data;
 
   stream_reset(demuxer->stream);
-
-sh_audio = NULL;
 
   return demuxer;
 }




More information about the MPlayer-cvslog mailing list