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];