[MPlayer-users] Don't quit at EOF patch
Michael Heydon
heydonms at tpg.com.au
Fri Jul 11 23:52:03 CEST 2003
In the course of playing around with time shifting I have been looking for a program that will happily seek past the end of a file and keep going, I know that description doesn't appear to make much sense but if you don't know what I'm talking about you probably don't need it. :)
This patch is a quick hack that will cause mplayer when started with the option -k, (just a random letter that wasn't in use (edit cfg-mplayer.h to change it)) to sit there when it reaches the end of a file and play the same frame over and over again (if new data is appended to the file the eof is cleared and playing resumes).
I'm not quite sure why the patch works, mplayer is a bit too complex for me to understand as well as I probably should before I start making changes to it. ATM I'm just happy that it does work.
It produces lots off errors at run time if you seek past the end of the file (seems to be related to the mp3 audio stream, I looked at fixing this but I only succeeded in muting everything, the errors don't really bother me so I probably won't continue trying)
It's unlikely that this patch will do what you want it to but I'm posting it here as a starting point after seeing several requests for something like this (and several replies that afai can tell try to solve the wrong problem).
If you make any cool modifications to this patch that you think I might be interested in pls mail them to me (I will likely unsubscribe from the list) heydonms[at]tpg[dot]com[dot]au
--
Michael Heydon
Coolest line in MPlayer code: "if( 1 ) { // Let the compiler optimize this out"
-------------- next part --------------
diff -c ./MPlayer-0.90/cfg-mplayer.h ./MPlayer-0.90-eof/cfg-mplayer.h
*** ./MPlayer-0.90/cfg-mplayer.h Sun Feb 9 04:52:25 2003
--- ./MPlayer-0.90-eof/cfg-mplayer.h Sat Jul 12 05:21:19 2003
***************
*** 422,427 ****
--- 422,428 ----
{"really-quiet", &verbose, CONF_TYPE_FLAG, CONF_GLOBAL, 0, -10, NULL},
{"verbose", &verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, NULL},
{"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL},
+ {"k", wait_on_eof, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL},
{"-help", help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL},
{"help", help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL},
{"h", help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL},
diff -c ./MPlayer-0.90/mplayer.c ./MPlayer-0.90-eof/mplayer.c
*** ./MPlayer-0.90/mplayer.c Mon Mar 10 22:02:18 2003
--- ./MPlayer-0.90-eof/mplayer.c Sat Jul 12 05:21:07 2003
***************
*** 79,84 ****
--- 79,85 ----
int verbose=0;
int identify=0;
static int quiet=0;
+ char waitOnEof=0;
#define ABS(x) (((x)>=0)?(x):(-(x)))
#define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5))
***************
*** 128,133 ****
--- 129,136 ----
static int cfg_inc_verbose(struct config *conf){ ++verbose; return 0;}
+ static int wait_on_eof(){ ++waitOnEof; return 0;}
+
static int cfg_include(struct config *conf, char *filename){
return m_config_parse_config_file(mconfig, filename);
}
***************
*** 2312,2319 ****
rel_seek_secs = v/100.0;
}
else {
! rel_seek_secs+= v;
! osd_function= (v > 0) ? OSD_FFW : OSD_REW;
}
} break;
#ifdef USE_EDL
--- 2315,2324 ----
rel_seek_secs = v/100.0;
}
else {
! if(!eof || v<0) {
! rel_seek_secs+=v;
! osd_function= (v > 0) ? OSD_FFW : OSD_REW;
! }
}
} break;
#ifdef USE_EDL
***************
*** 3026,3031 ****
--- 3031,3041 ----
loop_seek = 1;
}
+ if(eof && waitOnEof) {
+ demux_seek(demuxer,-.1,0);
+ eof = 0;
+ }
+
if(rel_seek_secs || abs_seek_pos){
current_module="seek";
if(demux_seek(demuxer,rel_seek_secs,abs_seek_pos)){
More information about the MPlayer-users
mailing list