summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-02 03:05:39 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-02 04:18:38 +0200
commit2be10f22b24712b959fa2883a4dcfa7caf72ab79 (patch)
tree964202918d699144b86b181ec7f40d498603383d
parent4aa55a7725647357cf8a6b15f9283cc9c1a4fd86 (diff)
downloadmpv-2be10f22b24712b959fa2883a4dcfa7caf72ab79.tar.bz2
mpv-2be10f22b24712b959fa2883a4dcfa7caf72ab79.tar.xz
options: move -dumpfile to option struct
-rw-r--r--cfg-mplayer.h2
-rw-r--r--defaultopts.c1
-rw-r--r--mplayer.c9
-rw-r--r--options.h1
4 files changed, 7 insertions, 6 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index c32de2e427..2c368ff54c 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -283,7 +283,7 @@ const m_option_t mplayer_opts[]={
// dump some stream out instead of playing the file
// this really should be in MEncoder instead of MPlayer... -> TODO
- {"dumpfile", &stream_dump_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
+ OPT_STRING("dumpfile", stream_dump_name, 0),
{"dumpaudio", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"dumpvideo", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 2, NULL},
{"dumpsub", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 3, NULL},
diff --git a/defaultopts.c b/defaultopts.c
index f263437d74..225b06746e 100644
--- a/defaultopts.c
+++ b/defaultopts.c
@@ -19,6 +19,7 @@ void set_default_mplayer_options(struct MPOpts *opts)
.vo_gamma_hue = 1000,
.osd_level = 1,
.osd_duration = 1000,
+ .stream_dump_name = "stream.dump",
.loop_times = -1,
.ordered_chapters = 1,
.chapterrange = {-1, -1},
diff --git a/mplayer.c b/mplayer.c
index ebcd76620d..ae4671114a 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -325,7 +325,6 @@ float stream_cache_seek_min_percent=50.0;
#endif
// dump:
-static char *stream_dump_name="stream.dump";
int stream_dump_type=0;
// A-V sync:
@@ -3653,7 +3652,7 @@ if(stream_dump_type==5){
current_module="dumpstream";
stream_reset(mpctx->stream);
stream_seek(mpctx->stream,mpctx->stream->start_pos);
- f=fopen(stream_dump_name,"wb");
+ f=fopen(opts->stream_dump_name,"wb");
if(!f){
mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Cannot open dump file.\n");
exit_player(mpctx, EXIT_ERROR);
@@ -3666,7 +3665,7 @@ if(stream_dump_type==5){
len=stream_read(mpctx->stream,buf,4096);
if(len>0) {
if(fwrite(buf,len,1,f) != 1) {
- mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"%s: Error writing file.\n",stream_dump_name);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"%s: Error writing file.\n",opts->stream_dump_name);
exit_player(mpctx, EXIT_ERROR);
}
}
@@ -3679,7 +3678,7 @@ if(stream_dump_type==5){
}
}
if(fclose(f)) {
- mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"%s: Error writing file.\n",stream_dump_name);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"%s: Error writing file.\n",opts->stream_dump_name);
exit_player(mpctx, EXIT_ERROR);
}
mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"Core dumped ;)\n");
@@ -3854,7 +3853,7 @@ if((stream_dump_type)&&(stream_dump_type<4)){
if(mpctx->d_video && mpctx->d_video!=ds) {ds_free_packs(mpctx->d_video); mpctx->d_video->id=-2; }
if(mpctx->d_sub && mpctx->d_sub!=ds) {ds_free_packs(mpctx->d_sub); mpctx->d_sub->id=-2; }
// let's dump it!
- f=fopen(stream_dump_name,"wb");
+ f=fopen(opts->stream_dump_name,"wb");
if(!f){
mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Cannot open dump file.\n");
exit_player(mpctx, EXIT_ERROR);
diff --git a/options.h b/options.h
index 9995dc395b..84f843552b 100644
--- a/options.h
+++ b/options.h
@@ -27,6 +27,7 @@ typedef struct MPOpts {
int osd_level;
int osd_duration;
+ char *stream_dump_name;
int loop_times;
int ordered_chapters;
int chapterrange[2];