Skip to content

Commit ae55896

Browse files
author
wm4
committedFeb 15, 2016
player: remove old timeline/ordered chapters support
1 parent 65f9af1 commit ae55896

File tree

5 files changed

+51
-277
lines changed

5 files changed

+51
-277
lines changed
 

‎player/command.c

+18-18
Original file line numberDiff line numberDiff line change
@@ -390,14 +390,14 @@ static int mp_property_media_title(void *ctx, struct m_property *prop,
390390
name = mpctx->opts->media_title;
391391
if (name && name[0])
392392
return m_property_strdup_ro(action, arg, name);
393-
if (mpctx->master_demuxer) {
394-
name = mp_tags_get_str(mpctx->master_demuxer->metadata, "service_name");
393+
if (mpctx->demuxer) {
394+
name = mp_tags_get_str(mpctx->demuxer->metadata, "service_name");
395395
if (name && name[0])
396396
return m_property_strdup_ro(action, arg, name);
397-
name = mp_tags_get_str(mpctx->master_demuxer->metadata, "title");
397+
name = mp_tags_get_str(mpctx->demuxer->metadata, "title");
398398
if (name && name[0])
399399
return m_property_strdup_ro(action, arg, name);
400-
name = mp_tags_get_str(mpctx->master_demuxer->metadata, "icy-title");
400+
name = mp_tags_get_str(mpctx->demuxer->metadata, "icy-title");
401401
if (name && name[0])
402402
return m_property_strdup_ro(action, arg, name);
403403
}
@@ -439,7 +439,7 @@ static int mp_property_demuxer(void *ctx, struct m_property *prop,
439439
int action, void *arg)
440440
{
441441
MPContext *mpctx = ctx;
442-
struct demuxer *demuxer = mpctx->master_demuxer;
442+
struct demuxer *demuxer = mpctx->demuxer;
443443
if (!demuxer)
444444
return M_PROPERTY_UNAVAILABLE;
445445
return m_property_strdup_ro(action, arg, demuxer->desc->name);
@@ -449,7 +449,7 @@ static int mp_property_file_format(void *ctx, struct m_property *prop,
449449
int action, void *arg)
450450
{
451451
MPContext *mpctx = ctx;
452-
struct demuxer *demuxer = mpctx->master_demuxer;
452+
struct demuxer *demuxer = mpctx->demuxer;
453453
if (!demuxer)
454454
return M_PROPERTY_UNAVAILABLE;
455455
const char *name = demuxer->filetype ? demuxer->filetype : demuxer->desc->name;
@@ -734,7 +734,7 @@ static int mp_property_disc_title(void *ctx, struct m_property *prop,
734734
int action, void *arg)
735735
{
736736
MPContext *mpctx = ctx;
737-
struct demuxer *d = mpctx->master_demuxer;
737+
struct demuxer *d = mpctx->demuxer;
738738
if (!d)
739739
return M_PROPERTY_UNAVAILABLE;
740740
unsigned int title = -1;
@@ -887,7 +887,7 @@ static int mp_property_edition(void *ctx, struct m_property *prop,
887887
{
888888
MPContext *mpctx = ctx;
889889
struct MPOpts *opts = mpctx->opts;
890-
struct demuxer *demuxer = mpctx->master_demuxer;
890+
struct demuxer *demuxer = mpctx->demuxer;
891891
if (!demuxer)
892892
return M_PROPERTY_UNAVAILABLE;
893893
if (demuxer->num_editions <= 0)
@@ -926,7 +926,7 @@ static int get_edition_entry(int item, int action, void *arg, void *ctx)
926926
{
927927
struct MPContext *mpctx = ctx;
928928

929-
struct demuxer *demuxer = mpctx->master_demuxer;
929+
struct demuxer *demuxer = mpctx->demuxer;
930930
struct demux_edition *ed = &demuxer->editions[item];
931931

932932
char *title = mp_tags_get_str(ed->metadata, "title");
@@ -946,7 +946,7 @@ static int property_list_editions(void *ctx, struct m_property *prop,
946946
int action, void *arg)
947947
{
948948
MPContext *mpctx = ctx;
949-
struct demuxer *demuxer = mpctx->master_demuxer;
949+
struct demuxer *demuxer = mpctx->demuxer;
950950
if (!demuxer)
951951
return M_PROPERTY_UNAVAILABLE;
952952

@@ -987,7 +987,7 @@ static int mp_property_disc_titles(void *ctx, struct m_property *prop,
987987
int action, void *arg)
988988
{
989989
MPContext *mpctx = ctx;
990-
struct demuxer *demuxer = mpctx->master_demuxer;
990+
struct demuxer *demuxer = mpctx->demuxer;
991991
unsigned int num_titles;
992992
if (!demuxer || demux_stream_control(demuxer, STREAM_CTRL_GET_NUM_TITLES,
993993
&num_titles) < 1)
@@ -998,7 +998,7 @@ static int mp_property_disc_titles(void *ctx, struct m_property *prop,
998998
static int get_disc_title_entry(int item, int action, void *arg, void *ctx)
999999
{
10001000
struct MPContext *mpctx = ctx;
1001-
struct demuxer *demuxer = mpctx->master_demuxer;
1001+
struct demuxer *demuxer = mpctx->demuxer;
10021002

10031003
double len = item;
10041004
if (demux_stream_control(demuxer, STREAM_CTRL_GET_TITLE_LENGTH, &len) < 1)
@@ -1018,7 +1018,7 @@ static int mp_property_list_disc_titles(void *ctx, struct m_property *prop,
10181018
int action, void *arg)
10191019
{
10201020
MPContext *mpctx = ctx;
1021-
struct demuxer *demuxer = mpctx->master_demuxer;
1021+
struct demuxer *demuxer = mpctx->demuxer;
10221022
unsigned int num_titles;
10231023
if (!demuxer || demux_stream_control(demuxer, STREAM_CTRL_GET_NUM_TITLES,
10241024
&num_titles) < 1)
@@ -1042,7 +1042,7 @@ static int mp_property_editions(void *ctx, struct m_property *prop,
10421042
int action, void *arg)
10431043
{
10441044
MPContext *mpctx = ctx;
1045-
struct demuxer *demuxer = mpctx->master_demuxer;
1045+
struct demuxer *demuxer = mpctx->demuxer;
10461046
if (!demuxer)
10471047
return M_PROPERTY_UNAVAILABLE;
10481048
if (demuxer->num_editions <= 0)
@@ -1055,7 +1055,7 @@ static int mp_property_angle(void *ctx, struct m_property *prop,
10551055
int action, void *arg)
10561056
{
10571057
MPContext *mpctx = ctx;
1058-
struct demuxer *demuxer = mpctx->master_demuxer;
1058+
struct demuxer *demuxer = mpctx->demuxer;
10591059
if (!demuxer)
10601060
return M_PROPERTY_UNAVAILABLE;
10611061

@@ -1196,7 +1196,7 @@ static int mp_property_metadata(void *ctx, struct m_property *prop,
11961196
int action, void *arg)
11971197
{
11981198
MPContext *mpctx = ctx;
1199-
struct demuxer *demuxer = mpctx->master_demuxer;
1199+
struct demuxer *demuxer = mpctx->demuxer;
12001200
if (!demuxer)
12011201
return M_PROPERTY_UNAVAILABLE;
12021202

@@ -2016,7 +2016,7 @@ static int property_list_tracks(void *ctx, struct m_property *prop,
20162016
res = talloc_asprintf_append(res, "\n");
20172017
}
20182018

2019-
struct demuxer *demuxer = mpctx->master_demuxer;
2019+
struct demuxer *demuxer = mpctx->demuxer;
20202020
if (demuxer && demuxer->num_editions > 1)
20212021
res = talloc_asprintf_append(res, "\nEdition: %d of %d\n",
20222022
demuxer->edition + 1,
@@ -2061,7 +2061,7 @@ static int mp_property_program(void *ctx, struct m_property *prop,
20612061
MPContext *mpctx = ctx;
20622062
demux_program_t prog;
20632063

2064-
struct demuxer *demuxer = mpctx->master_demuxer;
2064+
struct demuxer *demuxer = mpctx->demuxer;
20652065
if (!demuxer)
20662066
return M_PROPERTY_UNAVAILABLE;
20672067

‎player/core.h

+1-20
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "common/common.h"
2727
#include "options/options.h"
2828
#include "sub/osd.h"
29-
#include "demux/timeline.h"
3029
#include "audio/audio.h"
3130
#include "video/mp_image.h"
3231
#include "video/out/vo.h"
@@ -133,13 +132,6 @@ struct track {
133132
char *external_filename;
134133
bool auto_loaded;
135134

136-
// If the track's stream changes with the timeline (ordered chapters).
137-
bool under_timeline;
138-
139-
// Does not change with under_timeline, but is useless for most purposes.
140-
struct sh_stream *original_stream;
141-
142-
// Value can change if under_timeline==true.
143135
struct demuxer *demuxer;
144136
// Invariant: !stream || stream->demuxer == demuxer
145137
struct sh_stream *stream;
@@ -285,14 +277,10 @@ typedef struct MPContext {
285277
struct demuxer **sources; // all open demuxers
286278
int num_sources;
287279

288-
struct timeline *tl;
289-
struct timeline_part *timeline;
290-
int num_timeline_parts;
291-
int timeline_part;
292280
struct demux_chapter *chapters;
293281
int num_chapters;
294282

295-
struct demuxer *demuxer; // can change with timeline
283+
struct demuxer *demuxer;
296284
struct mp_tags *filtered_tags;
297285

298286
struct track **tracks;
@@ -307,11 +295,6 @@ typedef struct MPContext {
307295

308296
struct lavfi *lavfi;
309297

310-
// Uses: accessing metadata (consider ordered chapters case, where the main
311-
// demuxer defines metadata), or special purpose demuxers like TV.
312-
struct demuxer *master_demuxer;
313-
struct demuxer *track_layout; // complication for ordered chapters
314-
315298
struct mixer *mixer;
316299
struct ao *ao;
317300
struct mp_audio *ao_decoder_fmt; // for weak gapless audio check
@@ -475,8 +458,6 @@ void mp_switch_track_n(struct MPContext *mpctx, int order,
475458
void mp_deselect_track(struct MPContext *mpctx, struct track *track);
476459
struct track *mp_track_by_tid(struct MPContext *mpctx, enum stream_type type,
477460
int tid);
478-
bool timeline_switch_to_time(struct MPContext *mpctx, double pts);
479-
int timeline_get_for_time(struct MPContext *mpctx, double pts);
480461
void add_demuxer_tracks(struct MPContext *mpctx, struct demuxer *demuxer);
481462
bool mp_remove_track(struct MPContext *mpctx, struct track *track);
482463
struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction,

‎player/loadfile.c

+17-187
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ static void uninit_demuxer(struct MPContext *mpctx)
6464
for (int t = 0; t < STREAM_TYPE_COUNT; t++)
6565
mpctx->current_track[r][t] = NULL;
6666
}
67-
mpctx->track_layout = NULL;
68-
mpctx->demuxer = NULL;
6967
talloc_free(mpctx->chapters);
7068
mpctx->chapters = NULL;
7169
mpctx->num_chapters = 0;
@@ -81,13 +79,8 @@ static void uninit_demuxer(struct MPContext *mpctx)
8179
}
8280
mpctx->num_tracks = 0;
8381

84-
mpctx->timeline = NULL;
85-
mpctx->num_timeline_parts = 0;
86-
timeline_destroy(mpctx->tl);
87-
mpctx->tl = NULL;
88-
89-
free_demuxer_and_stream(mpctx->master_demuxer);
90-
mpctx->master_demuxer = NULL;
82+
free_demuxer_and_stream(mpctx->demuxer);
83+
mpctx->demuxer = NULL;
9184

9285
talloc_free(mpctx->sources);
9386
mpctx->sources = NULL;
@@ -152,7 +145,7 @@ void print_track_list(struct MPContext *mpctx, const char *msg)
152145

153146
void update_demuxer_properties(struct MPContext *mpctx)
154147
{
155-
struct demuxer *demuxer = mpctx->master_demuxer;
148+
struct demuxer *demuxer = mpctx->demuxer;
156149
if (!demuxer)
157150
return;
158151
demux_update(demuxer);
@@ -171,7 +164,7 @@ void update_demuxer_properties(struct MPContext *mpctx)
171164
MP_INFO(mpctx, "%s\n", b);
172165
}
173166
}
174-
struct demuxer *tracks = mpctx->track_layout;
167+
struct demuxer *tracks = mpctx->demuxer;
175168
if (tracks->events & DEMUX_EVENT_STREAMS) {
176169
add_demuxer_tracks(mpctx, tracks);
177170
print_track_list(mpctx, NULL);
@@ -242,23 +235,6 @@ void reselect_demux_streams(struct MPContext *mpctx)
242235
}
243236
}
244237

245-
static struct sh_stream *select_fallback_stream(struct demuxer *d,
246-
enum stream_type type,
247-
int index)
248-
{
249-
struct sh_stream *best_stream = NULL;
250-
for (int n = 0; n < demux_get_num_stream(d); n++) {
251-
struct sh_stream *s = demux_get_stream(d, n);
252-
if (s->type == type) {
253-
best_stream = s;
254-
if (index == 0)
255-
break;
256-
index -= 1;
257-
}
258-
}
259-
return best_stream;
260-
}
261-
262238
// Called from the demuxer thread if a new packet is available.
263239
static void wakeup_demux(void *pctx)
264240
{
@@ -283,80 +259,6 @@ static void enable_demux_thread(struct MPContext *mpctx)
283259
}
284260
}
285261

286-
// Returns whether reinitialization is required (i.e. it switched to a new part)
287-
bool timeline_switch_to_time(struct MPContext *mpctx, double pts)
288-
{
289-
if (!mpctx->timeline)
290-
return false;
291-
292-
int new_part = mpctx->num_timeline_parts - 1;
293-
for (int i = 0; i < mpctx->num_timeline_parts; i++) {
294-
if (pts < mpctx->timeline[i + 1].start) {
295-
new_part = i;
296-
break;
297-
}
298-
}
299-
300-
if (mpctx->timeline_part == new_part)
301-
return false;
302-
mpctx->timeline_part = new_part;
303-
struct timeline_part *n = mpctx->timeline + mpctx->timeline_part;
304-
305-
uninit_audio_chain(mpctx);
306-
uninit_video_chain(mpctx);
307-
uninit_sub_all(mpctx);
308-
if (mpctx->ao && !mpctx->opts->gapless_audio) {
309-
ao_drain(mpctx->ao);
310-
uninit_audio_out(mpctx);
311-
}
312-
313-
if (mpctx->demuxer) {
314-
demux_stop_thread(mpctx->demuxer);
315-
for (int i = 0; i < demux_get_num_stream(mpctx->demuxer); i++) {
316-
struct sh_stream *sh = demux_get_stream(mpctx->demuxer, i);
317-
demuxer_select_track(mpctx->demuxer, sh, false);
318-
}
319-
}
320-
321-
mpctx->demuxer = n->source;
322-
demux_set_ts_offset(mpctx->demuxer, n->start - n->source_start);
323-
324-
// While another timeline was active, the selection of active tracks might
325-
// have been changed - possibly we need to update this source.
326-
for (int x = 0; x < mpctx->num_tracks; x++) {
327-
struct track *track = mpctx->tracks[x];
328-
if (track->under_timeline) {
329-
track->demuxer = mpctx->demuxer;
330-
track->stream = demuxer_stream_by_demuxer_id(track->demuxer,
331-
track->type,
332-
track->demuxer_id);
333-
// EDL can have mismatched files in the same timeline
334-
if (!track->stream) {
335-
track->stream = select_fallback_stream(track->demuxer,
336-
track->type,
337-
track->user_tid - 1);
338-
}
339-
340-
if (track->d_sub) {
341-
for (int order = 0; order < 2; order++) {
342-
struct track *cur = mpctx->current_track[order][STREAM_SUB];
343-
if (cur && cur->d_sub == track->d_sub)
344-
osd_set_sub(mpctx->osd, OSDTYPE_SUB + order, NULL);
345-
}
346-
sub_destroy(track->d_sub);
347-
track->d_sub = NULL;
348-
}
349-
}
350-
}
351-
352-
if (mpctx->playback_initialized) {
353-
reselect_demux_streams(mpctx);
354-
enable_demux_thread(mpctx);
355-
}
356-
357-
return true;
358-
}
359-
360262
static int find_new_tid(struct MPContext *mpctx, enum stream_type t)
361263
{
362264
int new_id = 0;
@@ -370,12 +272,11 @@ static int find_new_tid(struct MPContext *mpctx, enum stream_type t)
370272

371273
static struct track *add_stream_track(struct MPContext *mpctx,
372274
struct demuxer *demuxer,
373-
struct sh_stream *stream,
374-
bool under_timeline)
275+
struct sh_stream *stream)
375276
{
376277
for (int i = 0; i < mpctx->num_tracks; i++) {
377278
struct track *track = mpctx->tracks[i];
378-
if (track->original_stream == stream)
279+
if (track->stream == stream)
379280
return track;
380281
}
381282

@@ -390,10 +291,8 @@ static struct track *add_stream_track(struct MPContext *mpctx,
390291
.forced_track = stream->forced_track,
391292
.attached_picture = stream->attached_picture != NULL,
392293
.lang = stream->lang,
393-
.under_timeline = under_timeline,
394294
.demuxer = demuxer,
395295
.stream = stream,
396-
.original_stream = stream,
397296
};
398297
MP_TARRAY_APPEND(mpctx, mpctx->tracks, mpctx->num_tracks, track);
399298

@@ -406,10 +305,8 @@ static struct track *add_stream_track(struct MPContext *mpctx,
406305

407306
void add_demuxer_tracks(struct MPContext *mpctx, struct demuxer *demuxer)
408307
{
409-
for (int n = 0; n < demux_get_num_stream(demuxer); n++) {
410-
add_stream_track(mpctx, demuxer, demux_get_stream(demuxer, n),
411-
!!mpctx->timeline);
412-
}
308+
for (int n = 0; n < demux_get_num_stream(demuxer); n++)
309+
add_stream_track(mpctx, demuxer, demux_get_stream(demuxer, n));
413310
}
414311

415312
// Result numerically higher => better match. 0 == no match.
@@ -658,7 +555,6 @@ bool mp_remove_track(struct MPContext *mpctx, struct track *track)
658555
{
659556
if (!track->is_external)
660557
return false;
661-
assert(!track->under_timeline);
662558

663559
mp_deselect_track(mpctx, track);
664560
if (track->selected)
@@ -675,8 +571,7 @@ bool mp_remove_track(struct MPContext *mpctx, struct track *track)
675571
talloc_free(track);
676572

677573
// Close the demuxer, unless there is still a track using it. These are
678-
// all external tracks, so there are no complications due to the timeline
679-
// mechanism switching the track's demuxer dynamically.
574+
// all external tracks.
680575
bool in_use = false;
681576
for (int n = mpctx->num_tracks - 1; n >= 0 && !in_use; n--)
682577
in_use |= mpctx->tracks[n]->demuxer == d;
@@ -732,7 +627,7 @@ struct track *mp_add_external_file(struct MPContext *mpctx, char *filename,
732627
for (int n = 0; n < demux_get_num_stream(demuxer); n++) {
733628
struct sh_stream *sh = demux_get_stream(demuxer, n);
734629
if (filter == STREAM_TYPE_COUNT || sh->type == filter) {
735-
struct track *t = add_stream_track(mpctx, demuxer, sh, false);
630+
struct track *t = add_stream_track(mpctx, demuxer, sh);
736631
t->is_external = true;
737632
t->title = talloc_strdup(t, mp_basename(disp_filename));
738633
t->external_filename = talloc_strdup(t, filename);
@@ -892,32 +787,9 @@ static void process_unload_hooks(struct MPContext *mpctx)
892787
mp_idle(mpctx);
893788
}
894789

895-
static void print_timeline(struct MPContext *mpctx)
896-
{
897-
if (mpctx->timeline) {
898-
int part_count = mpctx->num_timeline_parts;
899-
MP_VERBOSE(mpctx, "Timeline contains %d parts from %d "
900-
"sources. Total length %.3f seconds.\n", part_count,
901-
mpctx->num_sources, mpctx->timeline[part_count].start);
902-
MP_VERBOSE(mpctx, "Source files:\n");
903-
for (int i = 0; i < mpctx->num_sources; i++)
904-
MP_VERBOSE(mpctx, "%d: %s\n", i,
905-
mpctx->sources[i]->filename);
906-
MP_VERBOSE(mpctx, "Timeline parts: (number, start, "
907-
"source_start, source):\n");
908-
for (int i = 0; i < part_count; i++) {
909-
struct timeline_part *p = mpctx->timeline + i;
910-
MP_VERBOSE(mpctx, "%3d %9.3f %9.3f %p/%s\n", i, p->start,
911-
p->source_start, p->source, p->source->filename);
912-
}
913-
MP_VERBOSE(mpctx, "END %9.3f\n",
914-
mpctx->timeline[part_count].start);
915-
}
916-
}
917-
918790
static void load_chapters(struct MPContext *mpctx)
919791
{
920-
struct demuxer *src = mpctx->master_demuxer;
792+
struct demuxer *src = mpctx->demuxer;
921793
bool free_src = false;
922794
char *chapter_file = mpctx->opts->chapter_file;
923795
if (chapter_file && chapter_file[0]) {
@@ -961,7 +833,6 @@ struct demux_open_args {
961833
struct mp_log *log;
962834
// results
963835
struct demuxer *demux;
964-
struct timeline *tl;
965836
int err;
966837
};
967838

@@ -982,11 +853,8 @@ static void open_demux_thread(void *pctx)
982853
args->err = MPV_ERROR_LOADING_FAILED;
983854
}
984855
}
985-
if (args->demux) {
986-
args->tl = timeline_load(global, args->log, args->demux);
987-
if (global->opts->rebase_start_time)
988-
demux_set_ts_offset(args->demux, -args->demux->start_time);
989-
}
856+
if (args->demux && global->opts->rebase_start_time)
857+
demux_set_ts_offset(args->demux, -args->demux->start_time);
990858
}
991859

992860
static void open_demux_reentrant(struct MPContext *mpctx)
@@ -1003,40 +871,14 @@ static void open_demux_reentrant(struct MPContext *mpctx)
1003871
mpctx_run_reentrant(mpctx, open_demux_thread, &args);
1004872
if (args.demux) {
1005873
talloc_steal(args.demux, args.global);
1006-
mpctx->master_demuxer = args.demux;
1007-
mpctx->tl = args.tl;
874+
mpctx->demuxer = args.demux;
1008875
} else {
1009876
mpctx->error_playing = args.err;
1010877
talloc_free(args.global);
1011878
}
1012879
talloc_free(args.url);
1013880
}
1014881

1015-
static void load_timeline(struct MPContext *mpctx)
1016-
{
1017-
mpctx->track_layout = mpctx->master_demuxer;
1018-
1019-
MP_TARRAY_APPEND(NULL, mpctx->sources, mpctx->num_sources,
1020-
mpctx->master_demuxer);
1021-
1022-
if (mpctx->tl) {
1023-
mpctx->timeline = mpctx->tl->parts;
1024-
mpctx->num_timeline_parts = mpctx->tl->num_parts;
1025-
mpctx->num_chapters = mpctx->tl->num_chapters;
1026-
mpctx->chapters = demux_copy_chapter_data(mpctx->tl->chapters,
1027-
mpctx->tl->num_chapters);
1028-
mpctx->track_layout = mpctx->tl->track_layout;
1029-
for (int n = 0; n < mpctx->tl->num_sources; n++) {
1030-
if (mpctx->tl->sources[n] != mpctx->master_demuxer) {
1031-
MP_TARRAY_APPEND(NULL, mpctx->sources, mpctx->num_sources,
1032-
mpctx->tl->sources[n]);
1033-
}
1034-
}
1035-
}
1036-
1037-
print_timeline(mpctx);
1038-
}
1039-
1040882
static bool init_complex_filters(struct MPContext *mpctx)
1041883
{
1042884
assert(!mpctx->lavfi);
@@ -1046,11 +888,6 @@ static bool init_complex_filters(struct MPContext *mpctx)
1046888
if (!graph || !graph[0])
1047889
return true;
1048890

1049-
if (mpctx->tl) {
1050-
MP_ERR(mpctx, "complex filters not supported with timeline\n");
1051-
return false;
1052-
}
1053-
1054891
mpctx->lavfi = lavfi_create(mpctx->log, graph);
1055892
if (!mpctx->lavfi)
1056893
return false;
@@ -1234,11 +1071,8 @@ static void play_current_file(struct MPContext *mpctx)
12341071
}
12351072

12361073
open_demux_reentrant(mpctx);
1237-
if (!mpctx->master_demuxer || mpctx->stop_play)
1074+
if (!mpctx->demuxer || mpctx->stop_play)
12381075
goto terminate_playback;
1239-
mpctx->demuxer = mpctx->master_demuxer;
1240-
1241-
load_timeline(mpctx);
12421076

12431077
if (mpctx->demuxer->playlist) {
12441078
struct playlist *pl = mpctx->demuxer->playlist;
@@ -1257,10 +1091,7 @@ static void play_current_file(struct MPContext *mpctx)
12571091
}
12581092

12591093
load_chapters(mpctx);
1260-
add_demuxer_tracks(mpctx, mpctx->track_layout);
1261-
1262-
mpctx->timeline_part = mpctx->num_timeline_parts;
1263-
timeline_switch_to_time(mpctx, 0);
1094+
add_demuxer_tracks(mpctx, mpctx->demuxer);
12641095

12651096
open_external_files(mpctx, opts->audio_files, STREAM_AUDIO);
12661097
open_external_files(mpctx, opts->sub_name, STREAM_SUB);
@@ -1352,14 +1183,13 @@ static void play_current_file(struct MPContext *mpctx)
13521183
goto terminate_playback;
13531184
}
13541185

1355-
// If there's a timeline force an absolute seek to initialize state
13561186
double startpos = rel_time_to_abs(mpctx, opts->play_start);
13571187
if (startpos == MP_NOPTS_VALUE && opts->chapterrange[0] > 0) {
13581188
double start = chapter_start_time(mpctx, opts->chapterrange[0] - 1);
13591189
if (start != MP_NOPTS_VALUE)
13601190
startpos = start;
13611191
}
1362-
if (startpos == MP_NOPTS_VALUE && mpctx->timeline)
1192+
if (startpos == MP_NOPTS_VALUE)
13631193
startpos = 0;
13641194
if (startpos != MP_NOPTS_VALUE) {
13651195
queue_seek(mpctx, MPSEEK_ABSOLUTE, startpos, 0, true);

‎player/osd.c

+3-5
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,11 @@ static void add_seek_osd_messages(struct MPContext *mpctx)
467467
"Chapter: %s", chapter);
468468
talloc_free(chapter);
469469
}
470-
if ((mpctx->add_osd_seek_info & OSD_SEEK_INFO_EDITION)
471-
&& mpctx->master_demuxer)
472-
{
470+
if ((mpctx->add_osd_seek_info & OSD_SEEK_INFO_EDITION) && mpctx->demuxer) {
473471
set_osd_msg(mpctx, 1, mpctx->opts->osd_duration,
474472
"Playing edition %d of %d.",
475-
mpctx->master_demuxer->edition + 1,
476-
mpctx->master_demuxer->num_editions);
473+
mpctx->demuxer->edition + 1,
474+
mpctx->demuxer->num_editions);
477475
}
478476
if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_CURRENT_FILE) {
479477
if (mpctx->filename) {

‎player/playloop.c

+12-47
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,9 @@ void reset_playback_state(struct MPContext *mpctx)
181181
}
182182

183183
// return -1 if seek failed (non-seekable stream?), 0 otherwise
184-
static int mp_seek(MPContext *mpctx, struct seek_params seek,
185-
bool timeline_fallthrough)
184+
static int mp_seek(MPContext *mpctx, struct seek_params seek)
186185
{
187186
struct MPOpts *opts = mpctx->opts;
188-
int prev_step = mpctx->step_frames;
189187

190188
if (!mpctx->demuxer)
191189
return -1;
@@ -254,11 +252,6 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek,
254252
hr_seek &= seek.type == MPSEEK_ABSOLUTE; // otherwise, no target PTS known
255253

256254
double demuxer_amount = seek.amount;
257-
if (timeline_switch_to_time(mpctx, seek.amount)) {
258-
reinit_video_chain(mpctx);
259-
reinit_audio_chain(mpctx);
260-
reinit_sub_all(mpctx);
261-
}
262255

263256
int demuxer_style = 0;
264257
switch (seek.type) {
@@ -292,30 +285,24 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek,
292285
}
293286
}
294287

295-
if (!timeline_fallthrough)
296-
clear_audio_output_buffers(mpctx);
288+
clear_audio_output_buffers(mpctx);
297289

298290
reset_playback_state(mpctx);
299291

300-
if (timeline_fallthrough)
301-
mpctx->step_frames = prev_step;
302-
303292
/* Use the target time as "current position" for further relative
304293
* seeks etc until a new video frame has been decoded */
305294
mpctx->last_seek_pts = target_time;
306295

307-
// The hr_seek==false case is for skipping frames with PTS before the
308-
// current timeline chapter start. It's not really known where the demuxer
296+
// It's not really known where the demuxer
309297
// level seek will end up, so the hrseek mechanism is abused to skip all
310298
// frames before chapter start by setting hrseek_pts to the chapter start.
311299
// It does nothing when the seek is inside of the current chapter, and
312300
// seeking past the chapter is handled elsewhere.
313-
if (hr_seek || mpctx->timeline) {
301+
if (hr_seek) {
314302
mpctx->hrseek_active = true;
315303
mpctx->hrseek_framedrop = !hr_seek_very_exact && opts->hr_seek_framedrop;
316304
mpctx->hrseek_backstep = backstep;
317-
mpctx->hrseek_pts = hr_seek ? seek.amount
318-
: mpctx->timeline[mpctx->timeline_part].start;
305+
mpctx->hrseek_pts = seek.amount;
319306

320307
MP_VERBOSE(mpctx, "hr-seek, skipping to %f%s%s\n", mpctx->hrseek_pts,
321308
mpctx->hrseek_framedrop ? "" : " (no framedrop)",
@@ -382,7 +369,7 @@ void execute_queued_seek(struct MPContext *mpctx)
382369
if (!mpctx->seek.immediate && mpctx->video_status < STATUS_READY &&
383370
mp_time_sec() - mpctx->start_timestamp < 0.3)
384371
return;
385-
mp_seek(mpctx, mpctx->seek, false);
372+
mp_seek(mpctx, mpctx->seek);
386373
mpctx->seek = (struct seek_params){0};
387374
}
388375
}
@@ -394,9 +381,6 @@ double get_time_length(struct MPContext *mpctx)
394381
if (!demuxer)
395382
return -1;
396383

397-
if (mpctx->timeline)
398-
return mpctx->timeline[mpctx->num_timeline_parts].start;
399-
400384
double len = demuxer_get_time_length(demuxer);
401385
if (len >= 0)
402386
return len;
@@ -739,7 +723,7 @@ void seek_to_last_frame(struct MPContext *mpctx)
739723
.type = MPSEEK_ABSOLUTE,
740724
.amount = end,
741725
.exact = MPSEEK_VERY_EXACT,
742-
}, false);
726+
});
743727
// Make it exact: stop seek only if last frame was reached.
744728
if (mpctx->hrseek_active) {
745729
mpctx->hrseek_pts = 1e99; // "infinite"
@@ -902,9 +886,7 @@ static void handle_playback_restart(struct MPContext *mpctx, double endpts)
902886
}
903887
}
904888

905-
// Determines whether the end of the current segment is reached, and switch to
906-
// the next one if required. Also handles regular playback end.
907-
static void handle_segment_switch(struct MPContext *mpctx, bool end_is_new_segment)
889+
static void handle_eof(struct MPContext *mpctx)
908890
{
909891
/* Don't quit while paused and we're displaying the last video frame. On the
910892
* other hand, if we don't have a video frame, then the user probably seeked
@@ -917,18 +899,10 @@ static void handle_segment_switch(struct MPContext *mpctx, bool end_is_new_segme
917899
*/
918900
if ((mpctx->ao_chain || mpctx->vo_chain) && !prevent_eof &&
919901
mpctx->audio_status == STATUS_EOF &&
920-
mpctx->video_status == STATUS_EOF)
902+
mpctx->video_status == STATUS_EOF &&
903+
!mpctx->stop_play)
921904
{
922-
int new_part = mpctx->timeline_part + 1;
923-
if (end_is_new_segment && new_part < mpctx->num_timeline_parts) {
924-
mp_seek(mpctx, (struct seek_params){
925-
.type = MPSEEK_ABSOLUTE,
926-
.amount = mpctx->timeline[new_part].start
927-
}, true);
928-
} else {
929-
if (!mpctx->stop_play)
930-
mpctx->stop_play = AT_END_OF_FILE;
931-
}
905+
mpctx->stop_play = AT_END_OF_FILE;
932906
}
933907
}
934908

@@ -969,7 +943,6 @@ static void handle_complex_filter_decoders(struct MPContext *mpctx)
969943
void run_playloop(struct MPContext *mpctx)
970944
{
971945
double endpts = get_play_end_pts(mpctx);
972-
bool end_is_new_segment = false;
973946

974947
#if HAVE_ENCODING
975948
if (encode_lavc_didfail(mpctx->encode_lavc_ctx)) {
@@ -980,14 +953,6 @@ void run_playloop(struct MPContext *mpctx)
980953

981954
update_demuxer_properties(mpctx);
982955

983-
if (mpctx->timeline) {
984-
double end = mpctx->timeline[mpctx->timeline_part + 1].start;
985-
if (endpts == MP_NOPTS_VALUE || end < endpts) {
986-
end_is_new_segment = true;
987-
endpts = end;
988-
}
989-
}
990-
991956
handle_complex_filter_decoders(mpctx);
992957

993958
handle_cursor_autohide(mpctx);
@@ -1021,7 +986,7 @@ void run_playloop(struct MPContext *mpctx)
1021986
if (!mpctx->video_out)
1022987
update_subtitles(mpctx, mpctx->playback_pts);
1023988

1024-
handle_segment_switch(mpctx, end_is_new_segment);
989+
handle_eof(mpctx);
1025990

1026991
handle_loop_file(mpctx);
1027992

0 commit comments

Comments
 (0)
Please sign in to comment.