summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-04-24 20:09:31 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-04-25 22:48:10 +0300
commita2133d76847dd4c7a19d6826cd9a6562bedfdbc4 (patch)
tree84d45683615f51b73c624f51ad62f46247ccedfc /mplayer.c
parent9c63c084ff589de88ddf26c64a074cdac0eca046 (diff)
downloadmpv-a2133d76847dd4c7a19d6826cd9a6562bedfdbc4.tar.bz2
mpv-a2133d76847dd4c7a19d6826cd9a6562bedfdbc4.tar.xz
options: move -chapter values to option struct
-chapter can optionally take a range with a start and an end. Add a new option type which supports such values and use that instead of a custom per-option function. This commit also fixes a build configuration bug: before the availability of the -chapter option depended on DVD functionality being enabled in the binary, even though the option works with other sources too.
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/mplayer.c b/mplayer.c
index b8505aafb4..0432670a99 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -3571,8 +3571,8 @@ if(stream_dump_type==5){
mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Cannot open dump file.\n");
exit_player(mpctx, EXIT_ERROR);
}
- if (dvd_chapter > 1) {
- int chapter = dvd_chapter - 1;
+ if (opts->chapterrange[0] > 1) {
+ int chapter = opts->chapterrange[0] - 1;
stream_control(mpctx->stream, STREAM_CTRL_SEEK_TO_CHAPTER, &chapter);
}
while(!mpctx->stream->eof && !async_quit_request){
@@ -3583,10 +3583,11 @@ if(stream_dump_type==5){
exit_player(mpctx, EXIT_ERROR);
}
}
- if(dvd_last_chapter > 0) {
+ if (opts->chapterrange[1] > 0) {
int chapter = -1;
if (stream_control(mpctx->stream, STREAM_CTRL_GET_CURRENT_CHAPTER,
- &chapter) == STREAM_OK && chapter + 1 > dvd_last_chapter)
+ &chapter) == STREAM_OK
+ && chapter + 1 > opts->chapterrange[1])
break;
}
}
@@ -3715,9 +3716,9 @@ if(!mpctx->demuxer)
mpctx->num_sources = 1;
}
-if(dvd_chapter>1) {
+if(opts->chapterrange[0]>1) {
double pts;
- if (seek_chapter(mpctx, dvd_chapter-1, &pts, NULL) >= 0 && pts > -1.0)
+ if (seek_chapter(mpctx, opts->chapterrange[0]-1, &pts, NULL) >= 0 && pts > -1.0)
seek(mpctx, pts, SEEK_ABSOLUTE);
}
@@ -3799,9 +3800,9 @@ if((stream_dump_type)&&(stream_dump_type<4)){
if( (mpctx->demuxer->file_format==DEMUXER_TYPE_AVI || mpctx->demuxer->file_format==DEMUXER_TYPE_ASF || mpctx->demuxer->file_format==DEMUXER_TYPE_MOV)
&& stream_dump_type==2) fwrite(&in_size,1,4,f);
if(in_size>0) fwrite(start,in_size,1,f);
- if(dvd_last_chapter>0) {
+ if (opts->chapterrange[1] > 0) {
int cur_chapter = demuxer_get_current_chapter(mpctx->demuxer);
- if(cur_chapter!=-1 && cur_chapter+1>dvd_last_chapter)
+ if(cur_chapter!=-1 && cur_chapter+1 > opts->chapterrange[1])
break;
}
}
@@ -4090,9 +4091,9 @@ if (mpctx->stream->type == STREAMTYPE_DVDNAV) {
while(!mpctx->stop_play){
float aq_sleep_time=0;
-if(dvd_last_chapter>0) {
+if (opts->chapterrange[1] > 0) {
int cur_chapter = get_current_chapter(mpctx);
- if(cur_chapter!=-1 && cur_chapter+1>dvd_last_chapter)
+ if(cur_chapter!=-1 && cur_chapter+1 > opts->chapterrange[1])
goto goto_next_file;
}