summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-05-09 01:09:08 +0200
committerwm4 <wm4@nowhere>2013-05-09 01:16:04 +0200
commitc2657d5c9850b259ed13746ed099e3b9ddd0084b (patch)
treebc6cbab048e21d697460085146c4ef21412c69d7
parent729430387cfaf18e50ec22b8124e151a22110876 (diff)
downloadmpv-c2657d5c9850b259ed13746ed099e3b9ddd0084b.tar.bz2
mpv-c2657d5c9850b259ed13746ed099e3b9ddd0084b.tar.xz
demux: restructure chapter seeking code
Arrange the code such that commenting the first if will allow doing stream chapter seeks instead of time chapter seeks again, if both are possible.
-rw-r--r--demux/demux.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/demux/demux.c b/demux/demux.c
index 5f1af39d01..64c7c73b9f 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -1327,22 +1327,22 @@ static void add_stream_chapters(struct demuxer *demuxer)
int demuxer_seek_chapter(demuxer_t *demuxer, int chapter, double *seek_pts)
{
- int ris;
-
- if (!demuxer->num_chapters || !demuxer->chapters) {
- demux_flush(demuxer);
+ int ris = STREAM_UNSUPPORTED;
+ if (demuxer->num_chapters == 0)
ris = stream_control(demuxer->stream, STREAM_CTRL_SEEK_TO_CHAPTER,
&chapter);
- if (ris != STREAM_UNSUPPORTED)
- demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL);
+
+ if (ris != STREAM_UNSUPPORTED) {
+ demux_flush(demuxer);
+ demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL);
// exit status may be ok, but main() doesn't have to seek itself
// (because e.g. dvds depend on sectors, not on pts)
*seek_pts = -1.0;
- return ris != STREAM_UNSUPPORTED ? chapter : -1;
- } else { // chapters structure is set in the demuxer
+ return chapter;
+ } else {
if (chapter >= demuxer->num_chapters)
return -1;
if (chapter < 0)