Coverage Report

Created: 2025-12-27 07:18

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/mpv/demux/timeline.c
Line
Count
Source
1
#include "common/common.h"
2
#include "stream/stream.h"
3
#include "demux.h"
4
5
#include "timeline.h"
6
7
struct timeline *timeline_load(struct mpv_global *global, struct mp_log *log,
8
                               struct demuxer *demuxer)
9
147k
{
10
147k
    if (!demuxer->desc->load_timeline)
11
110k
        return NULL;
12
13
36.7k
    struct timeline *tl = talloc_ptrtype(NULL, tl);
14
36.7k
    *tl = (struct timeline){
15
36.7k
        .global = global,
16
36.7k
        .log = log,
17
36.7k
        .cancel = demuxer->cancel,
18
36.7k
        .demuxer = demuxer,
19
36.7k
        .format = "unknown",
20
36.7k
        .stream_origin = demuxer->stream_origin,
21
36.7k
    };
22
23
36.7k
    demuxer->desc->load_timeline(tl);
24
25
36.7k
    if (tl->num_pars)
26
15.3k
        return tl;
27
21.4k
    timeline_destroy(tl);
28
21.4k
    return NULL;
29
36.7k
}
30
31
void timeline_destroy(struct timeline *tl)
32
36.7k
{
33
36.7k
    if (!tl)
34
0
        return;
35
54.6k
    for (int n = 0; n < tl->num_sources; n++) {
36
17.9k
        struct demuxer *d = tl->sources[n];
37
17.9k
        if (d != tl->demuxer)
38
17.7k
            demux_free(d);
39
17.9k
    }
40
36.7k
    talloc_free(tl);
41
36.7k
}