changeset 9708:a37708f0b574

on now set the demuxer type some we can use rawvideo with -audiofile Add the pts, it was always 0 :( Switch to the new config header
author albeu
date Thu, 27 Mar 2003 20:30:44 +0000
parents 53e738a54064
children 1b1e33d1688a
files libmpdemux/demux_rawvideo.c
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_rawvideo.c	Thu Mar 27 20:27:50 2003 +0000
+++ b/libmpdemux/demux_rawvideo.c	Thu Mar 27 20:30:44 2003 +0000
@@ -6,7 +6,8 @@
 #include <unistd.h>
 #include <string.h>
 
-#include "../cfgparser.h"
+#include "../m_option.h"
+#include "../m_config.h"
 
 #include "stream.h"
 #include "demuxer.h"
@@ -14,7 +15,7 @@
 
 #include "../libmpcodecs/img_format.h"
 
-int use_rawvideo = 0;
+extern int demuxer_type;
 static int format = IMGFMT_I420;
 static int size_id = 0;
 static int width = 0;
@@ -23,7 +24,7 @@
 static int imgsize=0;
 
 config_t demux_rawvideo_opts[] = {
-  { "on", &use_rawvideo, CONF_TYPE_FLAG, 0,0, 1, NULL },
+  { "on", &demuxer_type, CONF_TYPE_FLAG, 0,0, DEMUXER_TYPE_RAWVIDEO, NULL },
   // size:
   { "w", &width, CONF_TYPE_INT,CONF_RANGE,1,8192, NULL },
   { "h", &height, CONF_TYPE_INT,CONF_RANGE,1,8192, NULL },
@@ -99,12 +100,12 @@
 }
 
 int demux_rawvideo_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) {
-
+  sh_video_t* sh = demuxer->video->sh;
+  off_t pos;
   if(demuxer->stream->eof) return 0;
   if(ds!=demuxer->video) return 0;
-
-  ds_read_packet(ds,demuxer->stream,imgsize,0,stream_tell(demuxer->stream),0x10);
-
+  pos = stream_tell(demuxer->stream);
+  ds_read_packet(ds,demuxer->stream,imgsize,(pos/imgsize)*sh->frametime,pos,0x10);
   return 1;
 }
 
@@ -118,9 +119,11 @@
     pos += ((demuxer->movi_end - demuxer->movi_start)*rel_seek_secs);
   else
     pos += (rel_seek_secs*sh_video->i_bps);
-
+  if(pos < 0) pos = 0;
+  if(demuxer->movi_end && pos > demuxer->movi_end) pos = (demuxer->movi_end-imgsize);
   pos/=imgsize;
   stream_seek(s,pos*imgsize);
-  sh_video->timer=pos * sh_video->frametime;
+  //sh_video->timer=pos * sh_video->frametime;
+  demuxer->video->pts = pos * sh_video->frametime;
 //  printf("demux_rawvideo: streamtell=%d\n",(int)stream_tell(demuxer->stream));
 }