@@ -64,8 +64,6 @@ static void uninit_demuxer(struct MPContext *mpctx)
64
64
for (int t = 0 ; t < STREAM_TYPE_COUNT ; t ++ )
65
65
mpctx -> current_track [r ][t ] = NULL ;
66
66
}
67
- mpctx -> track_layout = NULL ;
68
- mpctx -> demuxer = NULL ;
69
67
talloc_free (mpctx -> chapters );
70
68
mpctx -> chapters = NULL ;
71
69
mpctx -> num_chapters = 0 ;
@@ -81,13 +79,8 @@ static void uninit_demuxer(struct MPContext *mpctx)
81
79
}
82
80
mpctx -> num_tracks = 0 ;
83
81
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 ;
91
84
92
85
talloc_free (mpctx -> sources );
93
86
mpctx -> sources = NULL ;
@@ -152,7 +145,7 @@ void print_track_list(struct MPContext *mpctx, const char *msg)
152
145
153
146
void update_demuxer_properties (struct MPContext * mpctx )
154
147
{
155
- struct demuxer * demuxer = mpctx -> master_demuxer ;
148
+ struct demuxer * demuxer = mpctx -> demuxer ;
156
149
if (!demuxer )
157
150
return ;
158
151
demux_update (demuxer );
@@ -171,7 +164,7 @@ void update_demuxer_properties(struct MPContext *mpctx)
171
164
MP_INFO (mpctx , "%s\n" , b );
172
165
}
173
166
}
174
- struct demuxer * tracks = mpctx -> track_layout ;
167
+ struct demuxer * tracks = mpctx -> demuxer ;
175
168
if (tracks -> events & DEMUX_EVENT_STREAMS ) {
176
169
add_demuxer_tracks (mpctx , tracks );
177
170
print_track_list (mpctx , NULL );
@@ -242,23 +235,6 @@ void reselect_demux_streams(struct MPContext *mpctx)
242
235
}
243
236
}
244
237
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
-
262
238
// Called from the demuxer thread if a new packet is available.
263
239
static void wakeup_demux (void * pctx )
264
240
{
@@ -283,80 +259,6 @@ static void enable_demux_thread(struct MPContext *mpctx)
283
259
}
284
260
}
285
261
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
-
360
262
static int find_new_tid (struct MPContext * mpctx , enum stream_type t )
361
263
{
362
264
int new_id = 0 ;
@@ -370,12 +272,11 @@ static int find_new_tid(struct MPContext *mpctx, enum stream_type t)
370
272
371
273
static struct track * add_stream_track (struct MPContext * mpctx ,
372
274
struct demuxer * demuxer ,
373
- struct sh_stream * stream ,
374
- bool under_timeline )
275
+ struct sh_stream * stream )
375
276
{
376
277
for (int i = 0 ; i < mpctx -> num_tracks ; i ++ ) {
377
278
struct track * track = mpctx -> tracks [i ];
378
- if (track -> original_stream == stream )
279
+ if (track -> stream == stream )
379
280
return track ;
380
281
}
381
282
@@ -390,10 +291,8 @@ static struct track *add_stream_track(struct MPContext *mpctx,
390
291
.forced_track = stream -> forced_track ,
391
292
.attached_picture = stream -> attached_picture != NULL ,
392
293
.lang = stream -> lang ,
393
- .under_timeline = under_timeline ,
394
294
.demuxer = demuxer ,
395
295
.stream = stream ,
396
- .original_stream = stream ,
397
296
};
398
297
MP_TARRAY_APPEND (mpctx , mpctx -> tracks , mpctx -> num_tracks , track );
399
298
@@ -406,10 +305,8 @@ static struct track *add_stream_track(struct MPContext *mpctx,
406
305
407
306
void add_demuxer_tracks (struct MPContext * mpctx , struct demuxer * demuxer )
408
307
{
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 ));
413
310
}
414
311
415
312
// Result numerically higher => better match. 0 == no match.
@@ -658,7 +555,6 @@ bool mp_remove_track(struct MPContext *mpctx, struct track *track)
658
555
{
659
556
if (!track -> is_external )
660
557
return false;
661
- assert (!track -> under_timeline );
662
558
663
559
mp_deselect_track (mpctx , track );
664
560
if (track -> selected )
@@ -675,8 +571,7 @@ bool mp_remove_track(struct MPContext *mpctx, struct track *track)
675
571
talloc_free (track );
676
572
677
573
// 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.
680
575
bool in_use = false;
681
576
for (int n = mpctx -> num_tracks - 1 ; n >= 0 && !in_use ; n -- )
682
577
in_use |= mpctx -> tracks [n ]-> demuxer == d ;
@@ -732,7 +627,7 @@ struct track *mp_add_external_file(struct MPContext *mpctx, char *filename,
732
627
for (int n = 0 ; n < demux_get_num_stream (demuxer ); n ++ ) {
733
628
struct sh_stream * sh = demux_get_stream (demuxer , n );
734
629
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 );
736
631
t -> is_external = true;
737
632
t -> title = talloc_strdup (t , mp_basename (disp_filename ));
738
633
t -> external_filename = talloc_strdup (t , filename );
@@ -892,32 +787,9 @@ static void process_unload_hooks(struct MPContext *mpctx)
892
787
mp_idle (mpctx );
893
788
}
894
789
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
-
918
790
static void load_chapters (struct MPContext * mpctx )
919
791
{
920
- struct demuxer * src = mpctx -> master_demuxer ;
792
+ struct demuxer * src = mpctx -> demuxer ;
921
793
bool free_src = false;
922
794
char * chapter_file = mpctx -> opts -> chapter_file ;
923
795
if (chapter_file && chapter_file [0 ]) {
@@ -961,7 +833,6 @@ struct demux_open_args {
961
833
struct mp_log * log ;
962
834
// results
963
835
struct demuxer * demux ;
964
- struct timeline * tl ;
965
836
int err ;
966
837
};
967
838
@@ -982,11 +853,8 @@ static void open_demux_thread(void *pctx)
982
853
args -> err = MPV_ERROR_LOADING_FAILED ;
983
854
}
984
855
}
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 );
990
858
}
991
859
992
860
static void open_demux_reentrant (struct MPContext * mpctx )
@@ -1003,40 +871,14 @@ static void open_demux_reentrant(struct MPContext *mpctx)
1003
871
mpctx_run_reentrant (mpctx , open_demux_thread , & args );
1004
872
if (args .demux ) {
1005
873
talloc_steal (args .demux , args .global );
1006
- mpctx -> master_demuxer = args .demux ;
1007
- mpctx -> tl = args .tl ;
874
+ mpctx -> demuxer = args .demux ;
1008
875
} else {
1009
876
mpctx -> error_playing = args .err ;
1010
877
talloc_free (args .global );
1011
878
}
1012
879
talloc_free (args .url );
1013
880
}
1014
881
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
-
1040
882
static bool init_complex_filters (struct MPContext * mpctx )
1041
883
{
1042
884
assert (!mpctx -> lavfi );
@@ -1046,11 +888,6 @@ static bool init_complex_filters(struct MPContext *mpctx)
1046
888
if (!graph || !graph [0 ])
1047
889
return true;
1048
890
1049
- if (mpctx -> tl ) {
1050
- MP_ERR (mpctx , "complex filters not supported with timeline\n" );
1051
- return false;
1052
- }
1053
-
1054
891
mpctx -> lavfi = lavfi_create (mpctx -> log , graph );
1055
892
if (!mpctx -> lavfi )
1056
893
return false;
@@ -1234,11 +1071,8 @@ static void play_current_file(struct MPContext *mpctx)
1234
1071
}
1235
1072
1236
1073
open_demux_reentrant (mpctx );
1237
- if (!mpctx -> master_demuxer || mpctx -> stop_play )
1074
+ if (!mpctx -> demuxer || mpctx -> stop_play )
1238
1075
goto terminate_playback ;
1239
- mpctx -> demuxer = mpctx -> master_demuxer ;
1240
-
1241
- load_timeline (mpctx );
1242
1076
1243
1077
if (mpctx -> demuxer -> playlist ) {
1244
1078
struct playlist * pl = mpctx -> demuxer -> playlist ;
@@ -1257,10 +1091,7 @@ static void play_current_file(struct MPContext *mpctx)
1257
1091
}
1258
1092
1259
1093
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 );
1264
1095
1265
1096
open_external_files (mpctx , opts -> audio_files , STREAM_AUDIO );
1266
1097
open_external_files (mpctx , opts -> sub_name , STREAM_SUB );
@@ -1352,14 +1183,13 @@ static void play_current_file(struct MPContext *mpctx)
1352
1183
goto terminate_playback ;
1353
1184
}
1354
1185
1355
- // If there's a timeline force an absolute seek to initialize state
1356
1186
double startpos = rel_time_to_abs (mpctx , opts -> play_start );
1357
1187
if (startpos == MP_NOPTS_VALUE && opts -> chapterrange [0 ] > 0 ) {
1358
1188
double start = chapter_start_time (mpctx , opts -> chapterrange [0 ] - 1 );
1359
1189
if (start != MP_NOPTS_VALUE )
1360
1190
startpos = start ;
1361
1191
}
1362
- if (startpos == MP_NOPTS_VALUE && mpctx -> timeline )
1192
+ if (startpos == MP_NOPTS_VALUE )
1363
1193
startpos = 0 ;
1364
1194
if (startpos != MP_NOPTS_VALUE ) {
1365
1195
queue_seek (mpctx , MPSEEK_ABSOLUTE , startpos , 0 , true);
0 commit comments