mp_chmap_is_valid:
  126|  6.78k|{
  127|  6.78k|    bool mapped[MP_SPEAKER_ID_COUNT] = {0};
  128|  61.9k|    for (int n = 0; n < src->num; n++) {
  ------------------
  |  Branch (128:21): [True: 55.1k, False: 6.78k]
  ------------------
  129|  55.1k|        int sp = src->speaker[n];
  130|  55.1k|        if (sp >= MP_SPEAKER_ID_COUNT || mapped[sp])
  ------------------
  |  Branch (130:13): [True: 0, False: 55.1k]
  |  Branch (130:42): [True: 5, False: 55.1k]
  ------------------
  131|      5|            return false;
  132|  55.1k|        if (sp != MP_SPEAKER_ID_NA)
  ------------------
  |  Branch (132:13): [True: 25.6k, False: 29.4k]
  ------------------
  133|  25.6k|            mapped[sp] = true;
  134|  55.1k|    }
  135|  6.78k|    return src->num > 0;
  136|  6.78k|}
mp_chmap_is_unknown:
  146|     55|{
  147|     55|    for (int n = 0; n < src->num; n++) {
  ------------------
  |  Branch (147:21): [True: 55, False: 0]
  ------------------
  148|     55|        if (src->speaker[n] != MP_SPEAKER_ID_NA)
  ------------------
  |  Branch (148:13): [True: 55, False: 0]
  ------------------
  149|     55|            return false;
  150|     55|    }
  151|      0|    return mp_chmap_is_valid(src);
  152|     55|}
mp_chmap_equals:
  156|  1.14k|{
  157|  1.14k|    if (a->num != b->num)
  ------------------
  |  Branch (157:9): [True: 320, False: 822]
  ------------------
  158|    320|        return false;
  159|  5.31k|    for (int n = 0; n < a->num; n++) {
  ------------------
  |  Branch (159:21): [True: 4.55k, False: 756]
  ------------------
  160|  4.55k|        if (a->speaker[n] != b->speaker[n])
  ------------------
  |  Branch (160:13): [True: 66, False: 4.49k]
  ------------------
  161|     66|            return false;
  162|  4.55k|    }
  163|    756|    return true;
  164|    822|}
mp_chmap_from_channels:
  218|  2.82k|{
  219|  2.82k|    *dst = (struct mp_chmap) {0};
  220|  2.82k|    if (num_channels >= 0 && num_channels < MP_ARRAY_SIZE(default_layouts))
  ------------------
  |  |   49|  2.79k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (220:9): [True: 2.79k, False: 36]
  |  Branch (220:30): [True: 2.41k, False: 381]
  ------------------
  221|  2.41k|        *dst = default_layouts[num_channels];
  222|  2.82k|    if (!dst->num)
  ------------------
  |  Branch (222:9): [True: 418, False: 2.41k]
  ------------------
  223|    418|        mp_chmap_set_unknown(dst, num_channels);
  224|  2.82k|}
mp_chmap_set_unknown:
  232|    539|{
  233|    539|    if (num_channels < 0 || num_channels > MP_NUM_CHANNELS) {
  ------------------
  |  |   25|    476|#define MP_NUM_CHANNELS 64
  ------------------
  |  Branch (233:9): [True: 63, False: 476]
  |  Branch (233:29): [True: 44, False: 432]
  ------------------
  234|    107|        *dst = (struct mp_chmap) {0};
  235|    432|    } else {
  236|    432|        dst->num = num_channels;
  237|  15.1k|        for (int n = 0; n < dst->num; n++)
  ------------------
  |  Branch (237:25): [True: 14.7k, False: 432]
  ------------------
  238|  14.7k|            dst->speaker[n] = MP_SPEAKER_ID_NA;
  239|    432|    }
  240|    539|}
mp_chmap_to_str_buf:
  368|     55|{
  369|     55|    buf[0] = '\0';
  370|       |
  371|     55|    if (mp_chmap_is_unknown(src)) {
  ------------------
  |  Branch (371:9): [True: 0, False: 55]
  ------------------
  372|      0|        snprintf(buf, buf_size, "unknown%d", src->num);
  373|      0|        return buf;
  374|      0|    }
  375|       |
  376|    165|    for (int n = 0; n < src->num; n++) {
  ------------------
  |  Branch (376:21): [True: 110, False: 55]
  ------------------
  377|    110|        int sp = src->speaker[n];
  378|    110|        const char *s = sp < MP_SPEAKER_ID_COUNT ? speaker_names[sp][0] : NULL;
  ------------------
  |  Branch (378:25): [True: 110, False: 0]
  ------------------
  379|    110|        char sp_buf[10];
  380|    110|        if (!s) {
  ------------------
  |  Branch (380:13): [True: 0, False: 110]
  ------------------
  381|      0|            snprintf(sp_buf, sizeof(sp_buf), "sp%d", sp);
  382|      0|            s = sp_buf;
  383|      0|        }
  384|    110|        mp_snprintf_cat(buf, buf_size, "%s%s", n > 0 ? "-" : "", s);
  ------------------
  |  Branch (384:48): [True: 55, False: 55]
  ------------------
  385|    110|    }
  386|       |
  387|       |    // To standard layout name
  388|    220|    for (int n = 0; std_layout_names[n][0]; n++) {
  ------------------
  |  Branch (388:21): [True: 220, False: 0]
  ------------------
  389|    220|        if (strcmp(buf, std_layout_names[n][1]) == 0) {
  ------------------
  |  Branch (389:13): [True: 55, False: 165]
  ------------------
  390|     55|            snprintf(buf, buf_size, "%s", std_layout_names[n][0]);
  391|     55|            break;
  392|     55|        }
  393|    220|    }
  394|       |
  395|     55|    return buf;
  396|     55|}
mp_chmap_from_str:
  403|  4.09k|{
  404|       |    // Single number corresponds to mp_chmap_from_channels()
  405|  4.09k|    if (src.len > 0) {
  ------------------
  |  Branch (405:9): [True: 4.09k, False: 1]
  ------------------
  406|  4.09k|        bstr t = src;
  407|  4.09k|        bool unknown = bstr_eatstart0(&t, "unknown");
  408|  4.09k|        bstr rest;
  409|  4.09k|        long long count = bstrtoll(t, &rest, 10);
  410|  4.09k|        if (rest.len == 0) {
  ------------------
  |  Branch (410:13): [True: 2.94k, False: 1.14k]
  ------------------
  411|  2.94k|            struct mp_chmap res;
  412|  2.94k|            if (unknown) {
  ------------------
  |  Branch (412:17): [True: 121, False: 2.82k]
  ------------------
  413|    121|                mp_chmap_set_unknown(&res, count);
  414|  2.82k|            } else {
  415|  2.82k|                mp_chmap_from_channels(&res, count);
  416|  2.82k|            }
  417|  2.94k|            if (mp_chmap_is_valid(&res)) {
  ------------------
  |  Branch (417:17): [True: 2.84k, False: 109]
  ------------------
  418|  2.84k|                *dst = res;
  419|  2.84k|                return true;
  420|  2.84k|            }
  421|  2.94k|        }
  422|  4.09k|    }
  423|       |
  424|       |    // From standard layout name
  425|  47.3k|    for (int n = 0; std_layout_names[n][0]; n++) {
  ------------------
  |  Branch (425:21): [True: 46.3k, False: 1.02k]
  ------------------
  426|  46.3k|        if (bstr_equals0(src, std_layout_names[n][0])) {
  ------------------
  |  Branch (426:13): [True: 228, False: 46.1k]
  ------------------
  427|    228|            src = bstr0(std_layout_names[n][1]);
  428|    228|            break;
  429|    228|        }
  430|  46.3k|    }
  431|       |
  432|       |    // Explicit speaker list (separated by "-")
  433|  1.25k|    struct mp_chmap res = {0};
  434|  3.06k|    while (src.len) {
  ------------------
  |  Branch (434:12): [True: 2.06k, False: 999]
  ------------------
  435|  2.06k|        bstr s;
  436|  2.06k|        bstr_split_tok(src, "-", &s, &src);
  437|  2.06k|        int speaker = -1;
  438|  63.0k|        for (int n = 0; n < MP_SPEAKER_ID_COUNT; n++) {
  ------------------
  |  Branch (438:25): [True: 62.4k, False: 564]
  ------------------
  439|  62.4k|            const char *name = speaker_names[n][0];
  440|  62.4k|            if (name && bstr_equals0(s, name)) {
  ------------------
  |  Branch (440:17): [True: 36.0k, False: 26.3k]
  |  Branch (440:25): [True: 1.49k, False: 34.5k]
  ------------------
  441|  1.49k|                speaker = n;
  442|  1.49k|                break;
  443|  1.49k|            }
  444|  62.4k|        }
  445|  2.06k|        if (speaker < 0) {
  ------------------
  |  Branch (445:13): [True: 564, False: 1.49k]
  ------------------
  446|    564|            if (bstr_eatstart0(&s, "sp")) {
  ------------------
  |  Branch (446:17): [True: 392, False: 172]
  ------------------
  447|    392|                long long sp = bstrtoll(s, &s, 0);
  448|    392|                if (s.len == 0 && sp >= 0 && sp < MP_SPEAKER_ID_COUNT)
  ------------------
  |  Branch (448:21): [True: 376, False: 16]
  |  Branch (448:35): [True: 376, False: 0]
  |  Branch (448:46): [True: 310, False: 66]
  ------------------
  449|    310|                    speaker = sp;
  450|    392|            }
  451|    564|            if (speaker < 0)
  ------------------
  |  Branch (451:17): [True: 254, False: 310]
  ------------------
  452|    254|                return false;
  453|    564|        }
  454|  1.80k|        if (res.num >= MP_NUM_CHANNELS)
  ------------------
  |  |   25|  1.80k|#define MP_NUM_CHANNELS 64
  ------------------
  |  Branch (454:13): [True: 1, False: 1.80k]
  ------------------
  455|      1|            return false;
  456|  1.80k|        res.speaker[res.num] = speaker;
  457|  1.80k|        res.num++;
  458|  1.80k|    }
  459|       |
  460|    999|    *dst = res;
  461|       |    return true;
  462|  1.25k|}
mp_chmap_print_help:
  501|      2|{
  502|      2|    mp_info(log, "Speakers:\n");
  ------------------
  |  |   78|      2|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  503|    132|    for (int n = 0; n < MP_SPEAKER_ID_COUNT; n++) {
  ------------------
  |  Branch (503:21): [True: 130, False: 2]
  ------------------
  504|    130|        if (speaker_names[n][0])
  ------------------
  |  Branch (504:13): [True: 62, False: 68]
  ------------------
  505|     62|            mp_info(log, "    %-16s (%s)\n",
  ------------------
  |  |   78|     62|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  506|    130|                    speaker_names[n][0], speaker_names[n][1]);
  507|    130|    }
  508|      2|    mp_info(log, "Standard layouts:\n");
  ------------------
  |  |   78|      2|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  509|     88|    for (int n = 0; std_layout_names[n][0]; n++) {
  ------------------
  |  Branch (509:21): [True: 86, False: 2]
  ------------------
  510|     86|        mp_info(log, "    %-16s (%s)\n",
  ------------------
  |  |   78|     86|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  511|     86|                 std_layout_names[n][0], std_layout_names[n][1]);
  512|     86|    }
  513|    130|    for (int n = 0; n < MP_NUM_CHANNELS; n++)
  ------------------
  |  |   25|    130|#define MP_NUM_CHANNELS 64
  ------------------
  |  Branch (513:21): [True: 128, False: 2]
  ------------------
  514|    128|        mp_info(log, "    unknown%d\n", n + 1);
  ------------------
  |  |   78|    128|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  515|      2|}

ad_lavc.c:add_decoders:
  329|    779|{
  330|    779|    mp_add_lavc_decoders(list, AVMEDIA_TYPE_AUDIO);
  331|    779|}

af_fmt_to_str:
  124|  9.78k|{
  125|  9.78k|    switch (format) {
  ------------------
  |  Branch (125:13): [True: 9.78k, False: 0]
  ------------------
  126|    466|    case AF_FORMAT_U8:          return "u8";
  ------------------
  |  Branch (126:5): [True: 466, False: 9.32k]
  ------------------
  127|    466|    case AF_FORMAT_S16:         return "s16";
  ------------------
  |  Branch (127:5): [True: 466, False: 9.32k]
  ------------------
  128|    466|    case AF_FORMAT_S32:         return "s32";
  ------------------
  |  Branch (128:5): [True: 466, False: 9.32k]
  ------------------
  129|    466|    case AF_FORMAT_S64:         return "s64";
  ------------------
  |  Branch (129:5): [True: 466, False: 9.32k]
  ------------------
  130|    466|    case AF_FORMAT_FLOAT:       return "float";
  ------------------
  |  Branch (130:5): [True: 466, False: 9.32k]
  ------------------
  131|    466|    case AF_FORMAT_DOUBLE:      return "double";
  ------------------
  |  Branch (131:5): [True: 466, False: 9.32k]
  ------------------
  132|    466|    case AF_FORMAT_U8P:         return "u8p";
  ------------------
  |  Branch (132:5): [True: 466, False: 9.32k]
  ------------------
  133|    466|    case AF_FORMAT_S16P:        return "s16p";
  ------------------
  |  Branch (133:5): [True: 466, False: 9.32k]
  ------------------
  134|    466|    case AF_FORMAT_S32P:        return "s32p";
  ------------------
  |  Branch (134:5): [True: 466, False: 9.32k]
  ------------------
  135|    466|    case AF_FORMAT_S64P:        return "s64p";
  ------------------
  |  Branch (135:5): [True: 466, False: 9.32k]
  ------------------
  136|    466|    case AF_FORMAT_FLOATP:      return "floatp";
  ------------------
  |  Branch (136:5): [True: 466, False: 9.32k]
  ------------------
  137|    466|    case AF_FORMAT_DOUBLEP:     return "doublep";
  ------------------
  |  Branch (137:5): [True: 466, False: 9.32k]
  ------------------
  138|    466|    case AF_FORMAT_S_AAC:       return "spdif-aac";
  ------------------
  |  Branch (138:5): [True: 466, False: 9.32k]
  ------------------
  139|    466|    case AF_FORMAT_S_AC3:       return "spdif-ac3";
  ------------------
  |  Branch (139:5): [True: 466, False: 9.32k]
  ------------------
  140|    466|    case AF_FORMAT_S_DTS:       return "spdif-dts";
  ------------------
  |  Branch (140:5): [True: 466, False: 9.32k]
  ------------------
  141|    466|    case AF_FORMAT_S_DTSHD:     return "spdif-dtshd";
  ------------------
  |  Branch (141:5): [True: 466, False: 9.32k]
  ------------------
  142|    466|    case AF_FORMAT_S_EAC3:      return "spdif-eac3";
  ------------------
  |  Branch (142:5): [True: 466, False: 9.32k]
  ------------------
  143|    466|    case AF_FORMAT_S_MP3:       return "spdif-mp3";
  ------------------
  |  Branch (143:5): [True: 466, False: 9.32k]
  ------------------
  144|    466|    case AF_FORMAT_S_TRUEHD:    return "spdif-truehd";
  ------------------
  |  Branch (144:5): [True: 466, False: 9.32k]
  ------------------
  145|    466|    case AF_FORMAT_S_DOP:       return "dop";
  ------------------
  |  Branch (145:5): [True: 466, False: 9.32k]
  ------------------
  146|    466|    case AF_FORMAT_DSD:         return "dsd";
  ------------------
  |  Branch (146:5): [True: 466, False: 9.32k]
  ------------------
  147|  9.78k|    }
  148|      0|    return "??";
  149|  9.78k|}

ao_hotplug_create:
  478|     27|{
  479|     27|    struct ao_hotplug *hp = talloc_ptrtype(NULL, hp);
  ------------------
  |  |   34|     27|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|     27|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|     27|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  480|     27|    *hp = (struct ao_hotplug){
  481|     27|        .global = global,
  482|     27|        .wakeup_cb = wakeup_cb,
  483|     27|        .wakeup_ctx = wakeup_ctx,
  484|       |        .needs_update = true,
  485|     27|    };
  486|     27|    return hp;
  487|     27|}
ao_hotplug_check_update:
  499|     10|{
  500|     10|    if (hp->ao && ao_query_and_reset_events(hp->ao, AO_EVENT_HOTPLUG)) {
  ------------------
  |  Branch (500:9): [True: 0, False: 10]
  |  Branch (500:19): [True: 0, False: 0]
  ------------------
  501|      0|        hp->needs_update = true;
  502|      0|        return true;
  503|      0|    }
  504|     10|    return false;
  505|     10|}
ao_hotplug_get_device_list:
  510|    104|{
  511|    104|    if (hp->list && !hp->needs_update)
  ------------------
  |  Branch (511:9): [True: 77, False: 27]
  |  Branch (511:21): [True: 77, False: 0]
  ------------------
  512|     77|        return hp->list;
  513|       |
  514|     27|    talloc_free(hp->list);
  ------------------
  |  |   47|     27|#define talloc_free                     ta_free
  ------------------
  515|     27|    struct ao_device_list *list = talloc_zero(hp, struct ao_device_list);
  ------------------
  |  |   27|     27|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|     27|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|     27|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  516|     27|    hp->list = list;
  517|       |
  518|     27|    MP_TARRAY_APPEND(list, list->devices, list->num_devices,
  ------------------
  |  |  105|     27|    do {                                            \
  |  |  106|     27|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|     27|    do {                                            \
  |  |  |  |   97|     27|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|     27|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|     27|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|     27|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 27, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|     27|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|     27|    do {                                                        \
  |  |  |  |  |  |   89|     27|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|     27|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|     27|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|     27|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|     27|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|     27|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|     27|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 27]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|     27|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 27]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|     27|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|     27|        (idxvar)++;                                 \
  |  |  109|     27|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 27]
  |  |  ------------------
  ------------------
  519|     27|        (struct ao_device_desc){"auto", "Autoselect device"});
  520|       |
  521|       |    // Try to use the same AO for hotplug handling as for playback.
  522|       |    // Different AOs may not agree and the playback one is the only one the
  523|       |    // user knows about and may even have configured explicitly.
  524|     27|    if (!hp->ao && playback_ao && playback_ao->driver->hotplug_init) {
  ------------------
  |  Branch (524:9): [True: 27, False: 0]
  |  Branch (524:20): [True: 0, False: 27]
  |  Branch (524:35): [True: 0, False: 0]
  ------------------
  525|      0|        struct ao *ao = ao_alloc(true, hp->global, hp->wakeup_cb, hp->wakeup_ctx,
  526|      0|                                 (char *)playback_ao->driver->name);
  527|      0|        if (playback_ao->driver->hotplug_init(ao) >= 0) {
  ------------------
  |  Branch (527:13): [True: 0, False: 0]
  ------------------
  528|      0|            hp->ao = ao;
  529|      0|        } else {
  530|      0|            talloc_free(ao);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  531|      0|        }
  532|      0|    }
  533|       |
  534|     27|    for (int n = 0; n < MP_ARRAY_SIZE(audio_out_drivers); n++) {
  ------------------
  |  |   49|     27|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (534:21): [True: 27, False: 0]
  ------------------
  535|     27|        const struct ao_driver *d = audio_out_drivers[n];
  536|     27|        if (d == &audio_out_null)
  ------------------
  |  Branch (536:13): [True: 27, False: 0]
  ------------------
  537|     27|            break; // don't add unsafe/special entries
  538|       |
  539|      0|        struct ao *ao = ao_alloc(true, hp->global, hp->wakeup_cb, hp->wakeup_ctx,
  540|      0|                                 (char *)d->name);
  541|      0|        if (!ao)
  ------------------
  |  Branch (541:13): [True: 0, False: 0]
  ------------------
  542|      0|            continue;
  543|       |
  544|      0|        if (ao->driver->hotplug_init) {
  ------------------
  |  Branch (544:13): [True: 0, False: 0]
  ------------------
  545|      0|            if (ao->driver->hotplug_init(ao) >= 0) {
  ------------------
  |  Branch (545:17): [True: 0, False: 0]
  ------------------
  546|      0|                get_devices(ao, list);
  547|      0|                if (hp->ao)
  ------------------
  |  Branch (547:21): [True: 0, False: 0]
  ------------------
  548|      0|                    ao->driver->hotplug_uninit(ao);
  549|      0|                else
  550|      0|                    hp->ao = ao; // keep this one
  551|      0|            }
  552|      0|        } else {
  553|      0|            get_devices(ao, list);
  554|      0|        }
  555|      0|        if (ao != hp->ao)
  ------------------
  |  Branch (555:13): [True: 0, False: 0]
  ------------------
  556|      0|            talloc_free(ao);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  557|      0|    }
  558|       |    hp->needs_update = false;
  559|     27|    return list;
  560|    104|}
ao_hotplug_destroy:
  587|  16.4k|{
  588|  16.4k|    if (!hp)
  ------------------
  |  Branch (588:9): [True: 16.3k, False: 27]
  ------------------
  589|  16.3k|        return;
  590|     27|    if (hp->ao && hp->ao->driver->hotplug_uninit)
  ------------------
  |  Branch (590:9): [True: 0, False: 27]
  |  Branch (590:19): [True: 0, False: 0]
  ------------------
  591|      0|        hp->ao->driver->hotplug_uninit(hp->ao);
  592|     27|    talloc_free(hp->ao);
  ------------------
  |  |   47|     27|#define talloc_free                     ta_free
  ------------------
  593|     27|    talloc_free(hp);
  ------------------
  |  |   47|     27|#define talloc_free                     ta_free
  ------------------
  594|     27|}
ao.c:get_desc:
  116|   121k|{
  117|   121k|    if (index >= MP_ARRAY_SIZE(audio_out_drivers))
  ------------------
  |  |   49|   121k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (117:9): [True: 17.7k, False: 103k]
  ------------------
  118|  17.7k|        return false;
  119|   103k|    const struct ao_driver *ao = audio_out_drivers[index];
  120|   103k|    *dst = (struct m_obj_desc) {
  121|   103k|        .name = ao->name,
  122|   103k|        .description = ao->description,
  123|   103k|        .priv_size = ao->priv_size,
  124|   103k|        .priv_defaults = ao->priv_defaults,
  125|   103k|        .options = ao->options,
  126|   103k|        .options_prefix = ao->options_prefix,
  127|   103k|        .global_opts = ao->global_opts,
  128|   103k|        .hidden = ao->encode,
  129|   103k|        .p = ao,
  130|   103k|    };
  131|       |    return true;
  132|   121k|}

mp_add_lavc_decoders:
  243|  1.53k|{
  244|       |    add_codecs(list, type, true);
  245|  1.53k|}
mp_add_lavc_encoders:
  249|     46|{
  250|       |    add_codecs(list, AVMEDIA_TYPE_UNKNOWN, false);
  251|     46|}
mp_get_lavf_demuxers:
  254|  9.36k|{
  255|  9.36k|    char **list = NULL;
  256|  9.36k|    void *iter = NULL;
  257|  9.36k|    int num = 0;
  258|  3.42M|    for (;;) {
  259|  3.42M|        const AVInputFormat *cur = av_demuxer_iterate(&iter);
  260|  3.42M|        if (!cur)
  ------------------
  |  Branch (260:13): [True: 9.36k, False: 3.41M]
  ------------------
  261|  9.36k|            break;
  262|  3.41M|        MP_TARRAY_APPEND(NULL, list, num, talloc_strdup(list, cur->name));
  ------------------
  |  |  105|  3.41M|    do {                                            \
  |  |  106|  3.41M|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  3.41M|    do {                                            \
  |  |  |  |   97|  3.41M|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  3.41M|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  3.41M|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  3.41M|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 74.9k, False: 3.34M]
  |  |  |  |  ------------------
  |  |  |  |   99|  3.41M|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  74.9k|    do {                                                        \
  |  |  |  |  |  |   89|  74.9k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  74.9k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  74.9k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  74.9k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  74.9k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  74.9k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  74.9k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 74.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  3.41M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 3.41M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  3.41M|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  3.41M|        (idxvar)++;                                 \
  |  |  109|  3.41M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 3.41M]
  |  |  ------------------
  ------------------
  263|  3.41M|    }
  264|  9.36k|    MP_TARRAY_APPEND(NULL, list, num, NULL);
  ------------------
  |  |  105|  9.36k|    do {                                            \
  |  |  106|  9.36k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  9.36k|    do {                                            \
  |  |  |  |   97|  9.36k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  9.36k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  9.36k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  9.36k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 9.36k]
  |  |  |  |  ------------------
  |  |  |  |   99|  9.36k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  9.36k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 9.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  9.36k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  9.36k|        (idxvar)++;                                 \
  |  |  109|  9.36k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 9.36k]
  |  |  ------------------
  ------------------
  265|  9.36k|    return list;
  266|  9.36k|}
mp_get_lavf_protocols:
  269|  13.9k|{
  270|  13.9k|    char **list = NULL;
  271|  13.9k|    int num = 0;
  272|  13.9k|    void *opaque = NULL;
  273|  13.9k|    const char *name;
  274|   166k|    while ((name = avio_enum_protocols(&opaque, 0)))
  ------------------
  |  Branch (274:12): [True: 152k, False: 13.9k]
  ------------------
  275|   152k|        MP_TARRAY_APPEND(NULL, list, num, talloc_strdup(list, name));
  ------------------
  |  |  105|   152k|    do {                                            \
  |  |  106|   152k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|   152k|    do {                                            \
  |  |  |  |   97|   152k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|   152k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|   152k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|   152k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 41.7k, False: 111k]
  |  |  |  |  ------------------
  |  |  |  |   99|   152k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  41.7k|    do {                                                        \
  |  |  |  |  |  |   89|  41.7k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  41.7k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  41.7k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  41.7k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  41.7k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  41.7k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  41.7k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 41.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|   152k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 152k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|   152k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|   152k|        (idxvar)++;                                 \
  |  |  109|   152k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 152k]
  |  |  ------------------
  ------------------
  276|  13.9k|    MP_TARRAY_APPEND(NULL, list, num, NULL);
  ------------------
  |  |  105|  13.9k|    do {                                            \
  |  |  106|  13.9k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  13.9k|    do {                                            \
  |  |  |  |   97|  13.9k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  13.9k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  13.9k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  13.9k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 13.9k]
  |  |  |  |  ------------------
  |  |  |  |   99|  13.9k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  13.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 13.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  13.9k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  13.9k|        (idxvar)++;                                 \
  |  |  109|  13.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 13.9k]
  |  |  ------------------
  ------------------
  277|  13.9k|    return list;
  278|  13.9k|}
mp_codec_from_av_codec_id:
  297|   366k|{
  298|   366k|    const char *name = NULL;
  299|   366k|    const AVCodecDescriptor *desc = avcodec_descriptor_get(codec_id);
  300|   366k|    if (desc)
  ------------------
  |  Branch (300:9): [True: 366k, False: 0]
  ------------------
  301|   366k|        name = desc->name;
  302|   366k|    if (!name) {
  ------------------
  |  Branch (302:9): [True: 0, False: 366k]
  ------------------
  303|      0|        const AVCodec *avcodec = avcodec_find_decoder(codec_id);
  304|      0|        if (avcodec)
  ------------------
  |  Branch (304:13): [True: 0, False: 0]
  ------------------
  305|      0|            name = avcodec->name;
  306|      0|    }
  307|   366k|    return name;
  308|   366k|}
mp_set_avdict:
  320|  2.04k|{
  321|  2.04k|    for (int n = 0; kv && kv[n * 2]; n++)
  ------------------
  |  Branch (321:21): [True: 0, False: 2.04k]
  |  Branch (321:27): [True: 0, False: 0]
  ------------------
  322|      0|        av_dict_set(dict, kv[n * 2 + 0], kv[n * 2 + 1], 0);
  323|  2.04k|}
mp_avdict_print_unset:
  328|    526|{
  329|    526|    AVDictionaryEntry *t = NULL;
  330|  3.68k|    while ((t = av_dict_get(dict, "", t, AV_DICT_IGNORE_SUFFIX)))
  ------------------
  |  Branch (330:12): [True: 3.16k, False: 526]
  ------------------
  331|  3.16k|        mp_msg(log, msgl, "Could not set AVOption %s='%s'\n", t->key, t->value);
  332|    526|}
av_common.c:add_codecs:
  227|  1.58k|{
  228|  1.58k|    void *iter = NULL;
  229|   793k|    for (;;) {
  230|   793k|        const AVCodec *cur = av_codec_iterate(&iter);
  231|   793k|        if (!cur)
  ------------------
  |  Branch (231:13): [True: 1.58k, False: 791k]
  ------------------
  232|  1.58k|            break;
  233|   791k|        if (av_codec_is_decoder(cur) == decoders &&
  ------------------
  |  Branch (233:13): [True: 768k, False: 23.0k]
  ------------------
  234|   768k|            (type == AVMEDIA_TYPE_UNKNOWN || cur->type == type))
  ------------------
  |  Branch (234:14): [True: 0, False: 768k]
  |  Branch (234:46): [True: 366k, False: 401k]
  ------------------
  235|   366k|        {
  236|   366k|            mp_add_decoder(list, mp_codec_from_av_codec_id(cur->id),
  237|   366k|                           cur->name, cur->long_name);
  238|   366k|        }
  239|   791k|    }
  240|  1.58k|}

init_libav:
  154|  16.4k|{
  155|  16.4k|    mp_mutex_lock(&log_lock);
  ------------------
  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  156|  16.4k|    if (!log_mpv_instance) {
  ------------------
  |  Branch (156:9): [True: 16.4k, False: 0]
  ------------------
  157|  16.4k|        log_mpv_instance = global;
  158|  16.4k|        log_root = mp_log_new(NULL, global->log, "ffmpeg");
  159|  16.4k|        log_decaudio = mp_log_new(log_root, log_root, "audio");
  160|  16.4k|        log_decvideo = mp_log_new(log_root, log_root, "video");
  161|  16.4k|        log_demuxer = mp_log_new(log_root, log_root, "demuxer");
  162|  16.4k|        log_buffer = (bstr){0};
  163|  16.4k|        av_log_set_callback(mp_msg_av_log_callback);
  164|  16.4k|    }
  165|  16.4k|    mp_mutex_unlock(&log_lock);
  ------------------
  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  166|       |
  167|  16.4k|    avformat_network_init();
  168|       |
  169|  16.4k|#if HAVE_LIBAVDEVICE
  170|  16.4k|    avdevice_register_all();
  171|  16.4k|#endif
  172|  16.4k|}
uninit_libav:
  175|  16.4k|{
  176|  16.4k|    mp_mutex_lock(&log_lock);
  ------------------
  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  177|  16.4k|    if (log_mpv_instance == global) {
  ------------------
  |  Branch (177:9): [True: 16.4k, False: 0]
  ------------------
  178|  16.4k|        av_log_set_callback(av_log_default_callback);
  179|  16.4k|        log_mpv_instance = NULL;
  180|  16.4k|        talloc_free(log_root);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  181|  16.4k|    }
  182|  16.4k|    mp_mutex_unlock(&log_lock);
  ------------------
  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  183|  16.4k|}
check_library_versions:
  196|  28.6k|{
  197|  28.6k|    const struct lib libs[] = {
  198|  28.6k|        {"libavcodec",    LIBAVCODEC_VERSION_INT,    avcodec_version()},
  199|  28.6k|#if HAVE_LIBAVDEVICE
  200|  28.6k|        {"libavdevice",   LIBAVDEVICE_VERSION_INT,   avdevice_version()},
  201|  28.6k|#endif
  202|  28.6k|        {"libavfilter",   LIBAVFILTER_VERSION_INT,   avfilter_version()},
  203|  28.6k|        {"libavformat",   LIBAVFORMAT_VERSION_INT,   avformat_version()},
  204|  28.6k|        {"libavutil",     LIBAVUTIL_VERSION_INT,     avutil_version()},
  205|  28.6k|        {"libswresample", LIBSWRESAMPLE_VERSION_INT, swresample_version()},
  206|  28.6k|        {"libswscale",    LIBSWSCALE_VERSION_INT,    swscale_version()},
  207|  28.6k|    };
  208|       |
  209|  28.6k|    const char *runtime_version = av_version_info();
  210|  28.6k|    mp_msg(log, v, "FFmpeg version: %s", FFMPEG_VERSION);
  211|  28.6k|    if (strcmp(runtime_version, FFMPEG_VERSION))
  ------------------
  |  Branch (211:9): [True: 0, False: 28.6k]
  ------------------
  212|      0|        mp_msg(log, v, " (runtime %s)", runtime_version);
  213|  28.6k|    mp_msg(log, v, "\n");
  214|  28.6k|    mp_msg(log, v, "FFmpeg library versions:\n");
  215|       |
  216|   228k|    for (int n = 0; n < MP_ARRAY_SIZE(libs); n++) {
  ------------------
  |  |   49|   228k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (216:21): [True: 200k, False: 28.6k]
  ------------------
  217|   200k|        const struct lib *l = &libs[n];
  218|   200k|        mp_msg(log, v, "   %-15s %d.%d.%d", l->name, V(l->buildv));
  ------------------
  |  |  185|   200k|#define V(x) AV_VERSION_MAJOR(x), \
  |  |  186|   200k|             AV_VERSION_MINOR(x), \
  |  |  187|   200k|             AV_VERSION_MICRO(x)
  ------------------
  219|   200k|        if (l->buildv != l->runv)
  ------------------
  |  Branch (219:13): [True: 0, False: 200k]
  ------------------
  220|      0|            mp_msg(log, v, " (runtime %d.%d.%d)", V(l->runv));
  ------------------
  |  |  185|      0|#define V(x) AV_VERSION_MAJOR(x), \
  |  |  186|      0|             AV_VERSION_MINOR(x), \
  |  |  187|      0|             AV_VERSION_MICRO(x)
  ------------------
  221|   200k|        mp_msg(log, v, "\n");
  222|   200k|        if (l->buildv > l->runv ||
  ------------------
  |  Branch (222:13): [True: 0, False: 200k]
  ------------------
  223|   200k|            AV_VERSION_MAJOR(l->buildv) != AV_VERSION_MAJOR(l->runv))
  ------------------
  |  Branch (223:13): [True: 0, False: 200k]
  ------------------
  224|      0|        {
  225|      0|            mp_fatal(log, "%s: build version %d.%d.%d incompatible with runtime version %d.%d.%d\n",
  ------------------
  |  |   75|      0|#define mp_fatal(log, ...)      mp_msg(log, MSGL_FATAL, __VA_ARGS__)
  ------------------
  226|      0|                     l->name, V(l->buildv), V(l->runv));
  227|      0|            exit(1);
  228|      0|        }
  229|   200k|    }
  230|  28.6k|}
av_log.c:mp_msg_av_log_callback:
  119|  7.28k|{
  120|  7.28k|    AVClass *avc = ptr ? *(AVClass **)ptr : NULL;
  ------------------
  |  Branch (120:20): [True: 7.28k, False: 5]
  ------------------
  121|  7.28k|    int mp_level = av_log_level_to_mp_level(level);
  122|       |
  123|       |    // Note: mp_log is thread-safe, but destruction of the log instances is not.
  124|  7.28k|    mp_mutex_lock(&log_lock);
  ------------------
  |  |  134|  7.28k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  125|       |
  126|  7.28k|    if (!log_mpv_instance) {
  ------------------
  |  Branch (126:9): [True: 0, False: 7.28k]
  ------------------
  127|      0|        mp_mutex_unlock(&log_lock);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  128|       |        // Fallback to stderr
  129|      0|        vfprintf(stderr, fmt, vl);
  130|      0|        return;
  131|      0|    }
  132|       |
  133|  7.28k|    struct mp_log *log = get_av_log(ptr);
  134|       |
  135|  7.28k|    if (mp_msg_test(log, mp_level)) {
  ------------------
  |  Branch (135:9): [True: 5.34k, False: 1.94k]
  ------------------
  136|  5.34k|        log_buffer.len = 0;
  137|  5.34k|        bstr_xappend_vasprintf(log_root, &log_buffer, fmt, vl);
  138|  5.34k|        if (!log_buffer.len)
  ------------------
  |  Branch (138:13): [True: 0, False: 5.34k]
  ------------------
  139|      0|            goto done;
  140|  5.34k|        const char *prefix = avc ? avclass_item_name(ptr, avc) : NULL;
  ------------------
  |  Branch (140:30): [True: 5.33k, False: 5]
  ------------------
  141|  5.34k|        if (log_print_prefix && prefix) {
  ------------------
  |  Branch (141:13): [True: 5.34k, False: 0]
  |  Branch (141:33): [True: 5.33k, False: 5]
  ------------------
  142|  5.33k|            mp_msg(log, mp_level, "%s: %.*s", prefix, BSTR_P(log_buffer));
  ------------------
  |  |  307|  5.33k|#define BSTR_P(bstr) (int)((bstr).len), ((bstr).start ? (char*)(bstr).start : "")
  |  |  ------------------
  |  |  |  Branch (307:42): [True: 5.33k, False: 0]
  |  |  ------------------
  ------------------
  143|  5.33k|        } else {
  144|      5|            mp_msg(log, mp_level, "%.*s", BSTR_P(log_buffer));
  ------------------
  |  |  307|      5|#define BSTR_P(bstr) (int)((bstr).len), ((bstr).start ? (char*)(bstr).start : "")
  |  |  ------------------
  |  |  |  Branch (307:42): [True: 5, False: 0]
  |  |  ------------------
  ------------------
  145|      5|        }
  146|  5.34k|        log_print_prefix = log_buffer.start[log_buffer.len - 1] == '\n';
  147|  5.34k|    }
  148|       |
  149|  7.28k|done:
  150|  7.28k|    mp_mutex_unlock(&log_lock);
  ------------------
  |  |  136|  7.28k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  151|  7.28k|}
av_log.c:av_log_level_to_mp_level:
   63|  7.28k|{
   64|  7.28k|    if (av_level > AV_LOG_VERBOSE)
  ------------------
  |  Branch (64:9): [True: 1.95k, False: 5.33k]
  ------------------
   65|  1.95k|        return MSGL_TRACE;
   66|  5.33k|    if (av_level > AV_LOG_INFO)
  ------------------
  |  Branch (66:9): [True: 2.39k, False: 2.93k]
  ------------------
   67|  2.39k|        return MSGL_DEBUG;
   68|  2.93k|    if (av_level > AV_LOG_WARNING)
  ------------------
  |  Branch (68:9): [True: 1, False: 2.93k]
  ------------------
   69|      1|        return MSGL_V;
   70|  2.93k|    if (av_level > AV_LOG_ERROR)
  ------------------
  |  Branch (70:9): [True: 4, False: 2.93k]
  ------------------
   71|      4|        return MSGL_WARN;
   72|  2.93k|    if (av_level > AV_LOG_FATAL)
  ------------------
  |  Branch (72:9): [True: 2.93k, False: 0]
  ------------------
   73|  2.93k|        return MSGL_ERR;
   74|      0|    return MSGL_FATAL;
   75|  2.93k|}
av_log.c:get_av_log:
   78|  7.28k|{
   79|  7.28k|    if (!ptr)
  ------------------
  |  Branch (79:9): [True: 5, False: 7.28k]
  ------------------
   80|      5|        return log_root;
   81|       |
   82|  7.28k|    AVClass *avc = *(AVClass **)ptr;
   83|  7.28k|    if (!avc) {
  ------------------
  |  Branch (83:9): [True: 0, False: 7.28k]
  ------------------
   84|      0|        mp_warn(log_root,
  ------------------
  |  |   77|      0|#define mp_warn(log, ...)       mp_msg(log, MSGL_WARN, __VA_ARGS__)
  ------------------
   85|      0|               "av_log callback called with bad parameters (NULL AVClass).\n"
   86|      0|               "This is a bug in one of FFmpeg libraries used.\n");
   87|      0|        return log_root;
   88|      0|    }
   89|       |
   90|  7.28k|    if (!strcmp(avc->class_name, "AVCodecContext")) {
  ------------------
  |  Branch (90:9): [True: 0, False: 7.28k]
  ------------------
   91|      0|        AVCodecContext *s = ptr;
   92|      0|        if (s->codec) {
  ------------------
  |  Branch (92:13): [True: 0, False: 0]
  ------------------
   93|      0|            if (s->codec->type == AVMEDIA_TYPE_AUDIO) {
  ------------------
  |  Branch (93:17): [True: 0, False: 0]
  ------------------
   94|      0|                if (av_codec_is_decoder(s->codec))
  ------------------
  |  Branch (94:21): [True: 0, False: 0]
  ------------------
   95|      0|                    return log_decaudio;
   96|      0|            } else if (s->codec->type == AVMEDIA_TYPE_VIDEO) {
  ------------------
  |  Branch (96:24): [True: 0, False: 0]
  ------------------
   97|      0|                if (av_codec_is_decoder(s->codec))
  ------------------
  |  Branch (97:21): [True: 0, False: 0]
  ------------------
   98|      0|                    return log_decvideo;
   99|      0|            }
  100|      0|        }
  101|      0|    }
  102|       |
  103|  7.28k|    if (!strcmp(avc->class_name, "AVFormatContext")) {
  ------------------
  |  Branch (103:9): [True: 0, False: 7.28k]
  ------------------
  104|      0|        AVFormatContext *s = ptr;
  105|      0|        if (s->iformat)
  ------------------
  |  Branch (105:13): [True: 0, False: 0]
  ------------------
  106|      0|            return log_demuxer;
  107|      0|    }
  108|       |
  109|  7.28k|    return log_root;
  110|  7.28k|}
av_log.c:avclass_item_name:
  113|  5.33k|{
  114|  5.33k|    return (avc->item_name ? avc->item_name : av_default_item_name)(obj);
  ------------------
  |  Branch (114:13): [True: 5.33k, False: 0]
  ------------------
  115|  5.33k|}

mp_add_decoder:
   26|   728k|{
   27|   728k|    struct mp_decoder_entry entry = {
   28|   728k|        .codec = talloc_strdup(list, codec),
  ------------------
  |  |   50|   728k|#define talloc_strdup                   ta_xstrdup
  ------------------
   29|   728k|        .decoder = talloc_strdup(list, decoder),
  ------------------
  |  |   50|   728k|#define talloc_strdup                   ta_xstrdup
  ------------------
   30|   728k|        .desc = talloc_strdup(list, desc),
  ------------------
  |  |   50|   728k|#define talloc_strdup                   ta_xstrdup
  ------------------
   31|   728k|    };
   32|   728k|    MP_TARRAY_APPEND(list, list->entries, list->num_entries, entry);
  ------------------
  |  |  105|   728k|    do {                                            \
  |  |  106|   728k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|   728k|    do {                                            \
  |  |  |  |   97|   728k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|   728k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|   728k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|   728k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 17.5k, False: 710k]
  |  |  |  |  ------------------
  |  |  |  |   99|   728k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  17.5k|    do {                                                        \
  |  |  |  |  |  |   89|  17.5k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  17.5k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  17.5k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  17.5k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  17.5k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  17.5k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  17.5k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 17.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|   728k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 728k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|   728k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|   728k|        (idxvar)++;                                 \
  |  |  109|   728k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 728k]
  |  |  ------------------
  ------------------
   33|   728k|}
mp_append_decoders:
   89|  1.50k|{
   90|   362k|    for (int n = 0; n < a->num_entries; n++)
  ------------------
  |  Branch (90:21): [True: 361k, False: 1.50k]
  ------------------
   91|   361k|        add_new(list, &a->entries[n], NULL);
   92|  1.50k|}
mp_print_decoders:
   96|     26|{
   97|     26|    mp_msg(log, msgl, "%s\n", header);
   98|  5.85k|    for (int n = 0; n < list->num_entries; n++) {
  ------------------
  |  Branch (98:21): [True: 5.83k, False: 26]
  ------------------
   99|  5.83k|        struct mp_decoder_entry *entry = &list->entries[n];
  100|  5.83k|        mp_msg(log, msgl, "    %s", entry->decoder);
  101|  5.83k|        if (strcmp(entry->decoder, entry->codec) != 0)
  ------------------
  |  Branch (101:13): [True: 625, False: 5.20k]
  ------------------
  102|    625|            mp_msg(log, msgl, " (%s)", entry->codec);
  103|  5.83k|        mp_msg(log, msgl, " - %s\n", entry->desc);
  104|  5.83k|    }
  105|     26|    if (list->num_entries == 0)
  ------------------
  |  Branch (105:9): [True: 0, False: 26]
  ------------------
  106|      0|        mp_msg(log, msgl, "    (no decoders)\n");
  107|     26|}
codecs.c:add_new:
   39|   361k|{
   40|   361k|    if (!entry || (codec && strcmp(entry->codec, codec) != 0))
  ------------------
  |  Branch (40:9): [True: 0, False: 361k]
  |  Branch (40:20): [True: 0, False: 361k]
  |  Branch (40:29): [True: 0, False: 0]
  ------------------
   41|      0|        return;
   42|   361k|    mp_add_decoder(to, entry->codec, entry->decoder, entry->desc);
   43|   361k|}

mp_format_time_fmt:
   46|     54|{
   47|     54|    if (time == MP_NOPTS_VALUE || !(fabs(time) < 0x1p63))
  ------------------
  |  |   39|    108|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (47:9): [True: 3, False: 51]
  |  Branch (47:35): [True: 10, False: 41]
  ------------------
   48|     13|        return talloc_strdup(NULL, "unknown");
  ------------------
  |  |   50|     13|#define talloc_strdup                   ta_xstrdup
  ------------------
   49|     41|    char *sign = time < 0 ? "-" : "";
  ------------------
  |  Branch (49:18): [True: 20, False: 21]
  ------------------
   50|     41|    time = time < 0 ? -time : time;
  ------------------
  |  Branch (50:12): [True: 20, False: 21]
  ------------------
   51|     41|    long long int itime = time;
   52|     41|    long long int h, m, tm, s;
   53|     41|    int ms = lrint((time - itime) * 1000);
   54|     41|    if (ms >= 1000) {
  ------------------
  |  Branch (54:9): [True: 0, False: 41]
  ------------------
   55|      0|        ms -= 1000;
   56|      0|        itime += 1;
   57|      0|    }
   58|     41|    s = itime;
   59|     41|    tm = s / 60;
   60|     41|    h = s / 3600;
   61|     41|    s -= h * 3600;
   62|     41|    m = s / 60;
   63|     41|    s -= m * 60;
   64|     41|    char *res = talloc_strdup(NULL, "");
  ------------------
  |  |   50|     41|#define talloc_strdup                   ta_xstrdup
  ------------------
   65|    248|    while (*fmt) {
  ------------------
  |  Branch (65:12): [True: 207, False: 41]
  ------------------
   66|    207|        if (fmt[0] == '%') {
  ------------------
  |  Branch (66:13): [True: 124, False: 83]
  ------------------
   67|    124|            fmt++;
   68|    124|            switch (fmt[0]) {
   69|      0|            case 'h': appendf(&res, "%s%lld", sign, h); break;
  ------------------
  |  |   33|      0|    do {(*(ptr)) = talloc_asprintf_append_buffer(*(ptr), __VA_ARGS__);} while(0)
  |  |  ------------------
  |  |  |  |   64|      0|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  |  |  ------------------
  |  |  |  Branch (33:79): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (69:13): [True: 0, False: 124]
  ------------------
   70|     41|            case 'H': appendf(&res, "%s%02lld", sign, h); break;
  ------------------
  |  |   33|     41|    do {(*(ptr)) = talloc_asprintf_append_buffer(*(ptr), __VA_ARGS__);} while(0)
  |  |  ------------------
  |  |  |  |   64|     41|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  |  |  ------------------
  |  |  |  Branch (33:79): [Folded, False: 41]
  |  |  ------------------
  ------------------
  |  Branch (70:13): [True: 41, False: 83]
  ------------------
   71|      0|            case 'm': appendf(&res, "%s%lld", sign, tm); break;
  ------------------
  |  |   33|      0|    do {(*(ptr)) = talloc_asprintf_append_buffer(*(ptr), __VA_ARGS__);} while(0)
  |  |  ------------------
  |  |  |  |   64|      0|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  |  |  ------------------
  |  |  |  Branch (33:79): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (71:13): [True: 0, False: 124]
  ------------------
   72|     41|            case 'M': appendf(&res, "%02lld", m); break;
  ------------------
  |  |   33|     41|    do {(*(ptr)) = talloc_asprintf_append_buffer(*(ptr), __VA_ARGS__);} while(0)
  |  |  ------------------
  |  |  |  |   64|     41|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  |  |  ------------------
  |  |  |  Branch (33:79): [Folded, False: 41]
  |  |  ------------------
  ------------------
  |  Branch (72:13): [True: 41, False: 83]
  ------------------
   73|      0|            case 's': appendf(&res, "%s%lld", sign, itime); break;
  ------------------
  |  |   33|      0|    do {(*(ptr)) = talloc_asprintf_append_buffer(*(ptr), __VA_ARGS__);} while(0)
  |  |  ------------------
  |  |  |  |   64|      0|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  |  |  ------------------
  |  |  |  Branch (33:79): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (73:13): [True: 0, False: 124]
  ------------------
   74|     41|            case 'S': appendf(&res, "%02lld", s); break;
  ------------------
  |  |   33|     41|    do {(*(ptr)) = talloc_asprintf_append_buffer(*(ptr), __VA_ARGS__);} while(0)
  |  |  ------------------
  |  |  |  |   64|     41|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  |  |  ------------------
  |  |  |  Branch (33:79): [Folded, False: 41]
  |  |  ------------------
  ------------------
  |  Branch (74:13): [True: 41, False: 83]
  ------------------
   75|      1|            case 'T': appendf(&res, "%03d", ms); break;
  ------------------
  |  |   33|      1|    do {(*(ptr)) = talloc_asprintf_append_buffer(*(ptr), __VA_ARGS__);} while(0)
  |  |  ------------------
  |  |  |  |   64|      1|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  |  |  ------------------
  |  |  |  Branch (33:79): [Folded, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (75:13): [True: 1, False: 123]
  ------------------
   76|      0|            case 'f': appendf(&res, "%f", time); break;
  ------------------
  |  |   33|      0|    do {(*(ptr)) = talloc_asprintf_append_buffer(*(ptr), __VA_ARGS__);} while(0)
  |  |  ------------------
  |  |  |  |   64|      0|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  |  |  ------------------
  |  |  |  Branch (33:79): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (76:13): [True: 0, False: 124]
  ------------------
   77|      0|            case '%': appendf(&res, "%s", "%"); break;
  ------------------
  |  |   33|      0|    do {(*(ptr)) = talloc_asprintf_append_buffer(*(ptr), __VA_ARGS__);} while(0)
  |  |  ------------------
  |  |  |  |   64|      0|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  |  |  ------------------
  |  |  |  Branch (33:79): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (77:13): [True: 0, False: 124]
  ------------------
   78|      0|            default: goto error;
  ------------------
  |  Branch (78:13): [True: 0, False: 124]
  ------------------
   79|    124|            }
   80|    124|            fmt++;
   81|    124|        } else {
   82|     83|            appendf(&res, "%c", *fmt);
  ------------------
  |  |   33|     83|    do {(*(ptr)) = talloc_asprintf_append_buffer(*(ptr), __VA_ARGS__);} while(0)
  |  |  ------------------
  |  |  |  |   64|     83|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  |  |  ------------------
  |  |  |  Branch (33:79): [Folded, False: 83]
  |  |  ------------------
  ------------------
   83|     83|            fmt++;
   84|     83|        }
   85|    207|    }
   86|     41|    return res;
   87|      0|error:
   88|      0|    talloc_free(res);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
   89|       |    return NULL;
   90|     41|}
mp_format_time:
   93|     54|{
   94|     54|    return mp_format_time_fmt(fractions ? "%H:%M:%S.%T" : "%H:%M:%S", time);
  ------------------
  |  Branch (94:31): [True: 1, False: 53]
  ------------------
   95|     54|}
mp_format_double:
   99|  6.32k|{
  100|  6.32k|    bstr str = {0};
  101|  6.32k|    const char *fmt = plus_sign ? "%+.*f" : "%.*f";
  ------------------
  |  Branch (101:23): [True: 0, False: 6.32k]
  ------------------
  102|  6.32k|    bstr_xappend_asprintf(talloc_ctx, &str, fmt, precision, val);
  103|  6.32k|    size_t pos = str.len;
  104|  6.32k|    if (trim) {
  ------------------
  |  Branch (104:9): [True: 6.19k, False: 129]
  ------------------
  105|  29.2k|        while (--pos && str.start[pos] == '0')
  ------------------
  |  Branch (105:16): [True: 29.2k, False: 0]
  |  Branch (105:25): [True: 23.0k, False: 6.19k]
  ------------------
  106|  23.0k|            str.len--;
  107|  6.19k|        if (str.start[pos] == '.')
  ------------------
  |  Branch (107:13): [True: 4.95k, False: 1.23k]
  ------------------
  108|  4.95k|            str.len--;
  109|  6.19k|    }
  110|  6.32k|    if (percent_sign)
  ------------------
  |  Branch (110:9): [True: 29, False: 6.29k]
  ------------------
  111|     29|        bstr_xappend(talloc_ctx, &str, bstr0("%"));
  112|  6.32k|    str.start[str.len] = '\0';
  113|  6.32k|    return str.start;
  114|  6.32k|}
mp_snprintf_cat:
  214|  5.30k|{
  215|  5.30k|    size_t len = strnlen(str, size);
  216|  5.30k|    mp_assert(!size || len < size); // str with no 0-termination is not allowed
  ------------------
  |  |   41|  5.30k|#define mp_assert assert
  ------------------
  |  Branch (216:5): [True: 0, False: 5.30k]
  |  Branch (216:5): [True: 5.30k, False: 0]
  ------------------
  217|  5.30k|    int r;
  218|  5.30k|    va_list ap;
  219|  5.30k|    va_start(ap, format);
  220|  5.30k|    r = vsnprintf(str + len, size - len, format, ap);
  221|       |    va_end(ap);
  222|  5.30k|    return r;
  223|  5.30k|}
mp_append_utf8_bstr:
  229|  18.9k|{
  230|  18.9k|    char data[8];
  231|  18.9k|    uint8_t tmp;
  232|  18.9k|    char *output = data;
  233|       |    PUT_UTF8(codepoint, tmp, *output++ = tmp;);
  ------------------
  |  Branch (233:5): [True: 970, False: 498]
  |  Branch (233:5): [True: 18.4k, False: 498]
  ------------------
  234|  18.9k|    bstr_xappend(talloc_ctx, buf, (bstr){data, output - data});
  235|  18.9k|}
mp_append_escaped_string_noalloc:
  300|  3.83k|{
  301|  3.83k|    bstr t = *src;
  302|  3.83k|    int cur = 0;
  303|   169k|    while (1) {
  ------------------
  |  Branch (303:12): [True: 169k, Folded]
  ------------------
  304|   169k|        if (cur >= t.len || t.start[cur] == '"') {
  ------------------
  |  Branch (304:13): [True: 2.62k, False: 166k]
  |  Branch (304:29): [True: 949, False: 165k]
  ------------------
  305|  3.57k|            *src = bstr_cut(t, cur);
  306|  3.57k|            t = bstr_splice(t, 0, cur);
  307|  3.57k|            if (dst->start == NULL) {
  ------------------
  |  Branch (307:17): [True: 3.05k, False: 522]
  ------------------
  308|  3.05k|                *dst = t;
  309|  3.05k|            } else {
  310|    522|                bstr_xappend(talloc_ctx, dst, t);
  311|    522|            }
  312|  3.57k|            return true;
  313|   165k|        } else if (t.start[cur] == '\\') {
  ------------------
  |  Branch (313:20): [True: 3.03k, False: 162k]
  ------------------
  314|  3.03k|            bstr_xappend(talloc_ctx, dst, bstr_splice(t, 0, cur));
  315|  3.03k|            t = bstr_cut(t, cur + 1);
  316|  3.03k|            cur = 0;
  317|  3.03k|            if (!mp_parse_escape(talloc_ctx, dst, &t))
  ------------------
  |  Branch (317:17): [True: 256, False: 2.77k]
  ------------------
  318|    256|                goto error;
  319|   162k|        } else {
  320|   162k|            cur++;
  321|   162k|        }
  322|   169k|    }
  323|    256|error:
  324|       |    return false;
  325|  3.83k|}
mp_append_escaped_string:
  338|  3.00k|{
  339|  3.00k|    if (mp_append_escaped_string_noalloc(talloc_ctx, dst, src)) {
  ------------------
  |  Branch (339:9): [True: 2.90k, False: 101]
  ------------------
  340|       |        // Guarantee copy (or allocation).
  341|  2.90k|        if (!dst->start || dst->start == src->start) {
  ------------------
  |  Branch (341:13): [True: 0, False: 2.90k]
  |  Branch (341:28): [True: 87, False: 2.81k]
  ------------------
  342|     87|            bstr res = *dst;
  343|     87|            *dst = (bstr){0};
  344|     87|            bstr_xappend(talloc_ctx, dst, res);
  345|     87|        }
  346|  2.90k|        return true;
  347|  2.90k|    }
  348|    101|    return false;
  349|  3.00k|}
mp_strerror_buf:
  353|    256|{
  354|       |    // This handles the nasty details of calling the right function for us.
  355|       |    av_strerror(AVERROR(errnum), buf, buf_size);
  356|    256|    return buf;
  357|    256|}
mp_tprintf_buf:
  376|  4.61k|{
  377|  4.61k|    va_list ap;
  378|  4.61k|    va_start(ap, format);
  379|  4.61k|    vsnprintf(buf, buf_size, format, ap);
  380|       |    va_end(ap);
  381|  4.61k|    return buf;
  382|  4.61k|}
mp_log2:
  401|   559k|{
  402|   559k|#if (defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__)
  403|   559k|    return v ? 31 - __builtin_clz(v) : 0;
  ------------------
  |  Branch (403:12): [True: 370k, False: 189k]
  ------------------
  404|       |#else
  405|       |    for (int x = 31; x >= 0; x--) {
  406|       |        if (v & (((uint32_t)1) << x))
  407|       |            return x;
  408|       |    }
  409|       |    return 0;
  410|       |#endif
  411|   559k|}
mp_round_next_power_of_2:
  419|  5.56k|{
  420|  5.56k|    if (!v)
  ------------------
  |  Branch (420:9): [True: 0, False: 5.56k]
  ------------------
  421|      0|        return 1;
  422|  5.56k|    if (!(v & (v - 1)))
  ------------------
  |  Branch (422:9): [True: 3.81k, False: 1.75k]
  ------------------
  423|  3.81k|        return v;
  424|  1.75k|    int l = mp_log2(v) + 1;
  425|  1.75k|    return l == 32 ? 0 : (uint32_t)1 << l;
  ------------------
  |  Branch (425:12): [True: 0, False: 1.75k]
  ------------------
  426|  5.56k|}
common.c:mp_parse_escape:
  243|  3.03k|{
  244|  3.03k|    if (code->len < 1)
  ------------------
  |  Branch (244:9): [True: 101, False: 2.93k]
  ------------------
  245|    101|        return false;
  246|  2.93k|    char replace = 0;
  247|  2.93k|    switch (code->start[0]) {
  ------------------
  |  Branch (247:13): [True: 1.91k, False: 1.02k]
  ------------------
  248|    195|    case '"':  replace = '"';  break;
  ------------------
  |  Branch (248:5): [True: 195, False: 2.73k]
  ------------------
  249|    257|    case '\\': replace = '\\'; break;
  ------------------
  |  Branch (249:5): [True: 257, False: 2.67k]
  ------------------
  250|    195|    case '/':  replace = '/'; break;
  ------------------
  |  Branch (250:5): [True: 195, False: 2.73k]
  ------------------
  251|    195|    case 'b':  replace = '\b'; break;
  ------------------
  |  Branch (251:5): [True: 195, False: 2.73k]
  ------------------
  252|    194|    case 'f':  replace = '\f'; break;
  ------------------
  |  Branch (252:5): [True: 194, False: 2.73k]
  ------------------
  253|     87|    case 'n':  replace = '\n'; break;
  ------------------
  |  Branch (253:5): [True: 87, False: 2.84k]
  ------------------
  254|    197|    case 'r':  replace = '\r'; break;
  ------------------
  |  Branch (254:5): [True: 197, False: 2.73k]
  ------------------
  255|    196|    case 't':  replace = '\t'; break;
  ------------------
  |  Branch (255:5): [True: 196, False: 2.73k]
  ------------------
  256|    197|    case 'e':  replace = '\x1b'; break;
  ------------------
  |  Branch (256:5): [True: 197, False: 2.73k]
  ------------------
  257|    198|    case '\'': replace = '\''; break;
  ------------------
  |  Branch (257:5): [True: 198, False: 2.73k]
  ------------------
  258|  2.93k|    }
  259|  2.93k|    if (replace) {
  ------------------
  |  Branch (259:9): [True: 1.91k, False: 1.02k]
  ------------------
  260|  1.91k|        bstr_xappend(talloc_ctx, dst, (bstr){&replace, 1});
  261|  1.91k|        *code = bstr_cut(*code, 1);
  262|  1.91k|        return true;
  263|  1.91k|    }
  264|  1.02k|    if (code->start[0] == 'x' && code->len >= 3) {
  ------------------
  |  Branch (264:9): [True: 288, False: 733]
  |  Branch (264:34): [True: 285, False: 3]
  ------------------
  265|    285|        bstr num = bstr_splice(*code, 1, 3);
  266|    285|        char c = bstrtoll(num, &num, 16);
  267|    285|        if (num.len)
  ------------------
  |  Branch (267:13): [True: 7, False: 278]
  ------------------
  268|      7|            return false;
  269|    278|        bstr_xappend(talloc_ctx, dst, (bstr){&c, 1});
  270|    278|        *code = bstr_cut(*code, 3);
  271|    278|        return true;
  272|    285|    }
  273|    736|    if (code->start[0] == 'u' && code->len >= 5) {
  ------------------
  |  Branch (273:9): [True: 647, False: 89]
  |  Branch (273:34): [True: 646, False: 1]
  ------------------
  274|    646|        bstr num = bstr_splice(*code, 1, 5);
  275|    646|        uint32_t c = bstrtoll(num, &num, 16);
  276|    646|        if (num.len || c > 0x10FFFF)
  ------------------
  |  Branch (276:13): [True: 5, False: 641]
  |  Branch (276:24): [True: 6, False: 635]
  ------------------
  277|     11|            return false;
  278|    635|        if (c >= 0xd800 && c <= 0xdbff) {
  ------------------
  |  Branch (278:13): [True: 223, False: 412]
  |  Branch (278:28): [True: 126, False: 97]
  ------------------
  279|    126|            if (code->len < 5 + 6 // udddd + \udddd
  ------------------
  |  Branch (279:17): [True: 9, False: 117]
  ------------------
  280|    117|                || code->start[5] != '\\' || code->start[6] != 'u')
  ------------------
  |  Branch (280:20): [True: 13, False: 104]
  |  Branch (280:46): [True: 2, False: 102]
  ------------------
  281|     24|                return false;
  282|    102|            *code = bstr_cut(*code, 5 + 1);
  283|    102|            bstr num2 = bstr_splice(*code, 1, 5);
  284|    102|            uint32_t c2 = bstrtoll(num2, &num2, 16);
  285|    102|            if (num2.len || c2 < 0xdc00 || c2 > 0xdfff)
  ------------------
  |  Branch (285:17): [True: 1, False: 101]
  |  Branch (285:29): [True: 11, False: 90]
  |  Branch (285:44): [True: 11, False: 79]
  ------------------
  286|     23|                return false;
  287|     79|            c = ((c - 0xd800) << 10) + 0x10000 + (c2 - 0xdc00);
  288|     79|        }
  289|    588|        mp_append_utf8_bstr(talloc_ctx, dst, c);
  290|    588|        *code = bstr_cut(*code, 5);
  291|    588|        return true;
  292|    635|    }
  293|     90|    return false;
  294|    736|}

encode_lavc_init:
   98|    279|{
   99|    279|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  100|    279|    return NULL;
  101|      0|#endif
  102|      0|    struct encode_lavc_context *ctx = talloc_ptrtype(NULL, ctx);
  ------------------
  |  |   34|      0|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|      0|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      0|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  103|      0|    *ctx = (struct encode_lavc_context){
  104|      0|        .global = global,
  105|      0|        .options = mp_get_config_group(ctx, global, &encode_config),
  106|      0|        .priv = talloc_zero(ctx, struct encode_priv),
  ------------------
  |  |   27|      0|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|      0|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      0|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  107|      0|        .log = mp_log_new(ctx, global->log, "encode"),
  108|      0|    };
  109|      0|    mp_mutex_init(&ctx->lock);
  110|       |
  111|      0|    struct encode_priv *p = ctx->priv;
  112|      0|    p->log = ctx->log;
  113|       |
  114|      0|    const char *filename = ctx->options->file;
  115|       |
  116|       |    // STUPID STUPID STUPID STUPID avio
  117|       |    // does not support "-" as file name to mean stdin/stdout
  118|       |    // ffmpeg.c works around this too, the same way
  119|      0|    if (!strcmp(filename, "-"))
  ------------------
  |  Branch (119:9): [True: 0, False: 0]
  ------------------
  120|      0|        filename = "pipe:1";
  121|       |
  122|      0|    encode_lavc_discontinuity(ctx);
  123|       |
  124|      0|    p->muxer = avformat_alloc_context();
  125|      0|    MP_HANDLE_OOM(p->muxer);
  ------------------
  |  |  206|      0|#define MP_HANDLE_OOM(x) do {   \
  |  |  207|      0|        void *oom_p_ = (x);     \
  |  |  208|      0|        if (!oom_p_)            \
  |  |  ------------------
  |  |  |  Branch (208:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  209|      0|            abort();            \
  |  |  210|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (210:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  126|       |
  127|      0|    if (ctx->options->format && ctx->options->format[0]) {
  ------------------
  |  Branch (127:9): [True: 0, False: 0]
  |  Branch (127:33): [True: 0, False: 0]
  ------------------
  128|      0|        ctx->oformat = av_guess_format(ctx->options->format, filename, NULL);
  129|      0|    } else {
  130|      0|        ctx->oformat = av_guess_format(NULL, filename, NULL);
  131|      0|    }
  132|       |
  133|      0|    if (!ctx->oformat) {
  ------------------
  |  Branch (133:9): [True: 0, False: 0]
  ------------------
  134|      0|        MP_FATAL(ctx, "format not found\n");
  ------------------
  |  |   88|      0|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  135|      0|        goto fail;
  136|      0|    }
  137|       |
  138|      0|    p->muxer->oformat = ctx->oformat;
  139|       |
  140|      0|    char *path = mp_get_user_path(NULL, global, filename);
  141|      0|    p->muxer->url = av_strdup(path);
  142|      0|    talloc_free(path);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  143|      0|    MP_HANDLE_OOM(p->muxer->url);
  ------------------
  |  |  206|      0|#define MP_HANDLE_OOM(x) do {   \
  |  |  207|      0|        void *oom_p_ = (x);     \
  |  |  208|      0|        if (!oom_p_)            \
  |  |  ------------------
  |  |  |  Branch (208:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  209|      0|            abort();            \
  |  |  210|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (210:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  144|       |
  145|      0|    return ctx;
  146|       |
  147|      0|fail:
  148|      0|    p->failed = true;
  149|      0|    encode_lavc_free(ctx);
  150|       |    return NULL;
  151|      0|}
encode_lavc_free:
  189|  16.4k|{
  190|  16.4k|    bool res = true;
  191|  16.4k|    if (!ctx)
  ------------------
  |  Branch (191:9): [True: 16.4k, False: 0]
  ------------------
  192|  16.4k|        return res;
  193|       |
  194|      0|    struct encode_priv *p = ctx->priv;
  195|       |
  196|      0|    if (!p->failed && !p->header_written) {
  ------------------
  |  Branch (196:9): [True: 0, False: 0]
  |  Branch (196:23): [True: 0, False: 0]
  ------------------
  197|      0|        MP_FATAL(p, "no data written to target file\n");
  ------------------
  |  |   88|      0|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  198|      0|        p->failed = true;
  199|      0|    }
  200|       |
  201|      0|    if (!p->failed && p->header_written) {
  ------------------
  |  Branch (201:9): [True: 0, False: 0]
  |  Branch (201:23): [True: 0, False: 0]
  ------------------
  202|      0|        if (av_write_trailer(p->muxer) < 0)
  ------------------
  |  Branch (202:13): [True: 0, False: 0]
  ------------------
  203|      0|            MP_ERR(p, "error writing trailer\n");
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  204|       |
  205|      0|        MP_INFO(p, "video: encoded %lld bytes\n", p->vbytes);
  ------------------
  |  |   91|      0|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  206|      0|        MP_INFO(p, "audio: encoded %lld bytes\n", p->abytes);
  ------------------
  |  |   91|      0|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  207|       |
  208|      0|        MP_INFO(p, "muxing overhead %lld bytes\n",
  ------------------
  |  |   91|      0|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  209|      0|                (long long)(avio_size(p->muxer->pb) - p->vbytes - p->abytes));
  210|      0|    }
  211|       |
  212|      0|    if (avio_closep(&p->muxer->pb) < 0 && !p->failed) {
  ------------------
  |  Branch (212:9): [True: 0, False: 0]
  |  Branch (212:43): [True: 0, False: 0]
  ------------------
  213|      0|        MP_ERR(p, "Closing file failed\n");
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  214|      0|        p->failed = true;
  215|      0|    }
  216|       |
  217|      0|    avformat_free_context(p->muxer);
  218|       |
  219|      0|    res = !p->failed;
  220|       |
  221|      0|    mp_mutex_destroy(&ctx->lock);
  ------------------
  |  |  133|      0|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
  222|      0|    talloc_free(ctx);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  223|       |
  224|      0|    return res;
  225|  16.4k|}
encode_lavc_showhelp:
  520|  11.3k|{
  521|  11.3k|    bool help_output = false;
  522|  11.3k|#define CHECKS(str) ((str) && \
  523|  11.3k|                     strcmp((str), "help") == 0 ? (help_output |= 1) : 0)
  524|  11.3k|#define CHECKV(strv) ((strv) && (strv)[0] && \
  525|  11.3k|                      strcmp((strv)[0], "help") == 0 ? (help_output |= 1) : 0)
  526|  11.3k|    if (CHECKS(opts->format)) {
  ------------------
  |  |  522|  11.3k|#define CHECKS(str) ((str) && \
  |  |  ------------------
  |  |  |  Branch (522:21): [True: 19, False: 11.3k]
  |  |  |  Branch (522:22): [True: 58, False: 11.3k]
  |  |  ------------------
  |  |  523|  11.3k|                     strcmp((str), "help") == 0 ? (help_output |= 1) : 0)
  |  |  ------------------
  |  |  |  Branch (523:22): [True: 19, False: 39]
  |  |  ------------------
  ------------------
  527|     19|        const AVOutputFormat *c = NULL;
  528|     19|        void *iter = NULL;
  529|     19|        mp_info(log, "Available output formats:\n");
  ------------------
  |  |   78|     19|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  530|     76|        while ((c = av_muxer_iterate(&iter))) {
  ------------------
  |  Branch (530:16): [True: 57, False: 19]
  ------------------
  531|     57|            mp_info(log, "  --of=%-13s %s\n", c->name,
  ------------------
  |  |   78|    114|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (78:56): [True: 57, False: 0]
  |  |  ------------------
  ------------------
  532|     57|                   c->long_name ? c->long_name : "");
  533|     57|        }
  534|     19|    }
  535|  11.3k|    if (CHECKV(opts->fopts)) {
  ------------------
  |  |  524|  11.3k|#define CHECKV(strv) ((strv) && (strv)[0] && \
  |  |  ------------------
  |  |  |  Branch (524:22): [True: 16, False: 11.3k]
  |  |  |  Branch (524:23): [True: 155, False: 11.2k]
  |  |  |  Branch (524:33): [True: 145, False: 10]
  |  |  ------------------
  |  |  525|  11.3k|                      strcmp((strv)[0], "help") == 0 ? (help_output |= 1) : 0)
  |  |  ------------------
  |  |  |  Branch (525:23): [True: 16, False: 129]
  |  |  ------------------
  ------------------
  536|     16|        AVFormatContext *c = avformat_alloc_context();
  537|     16|        const AVOutputFormat *format = NULL;
  538|     16|        mp_info(log, "Available output format ctx->options:\n");
  ------------------
  |  |   78|     16|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  539|     16|        encode_lavc_printoptions(log, c, "  --ofopts=", "           ", NULL,
  540|     16|                                 AV_OPT_FLAG_ENCODING_PARAM,
  541|     16|                                 AV_OPT_FLAG_ENCODING_PARAM);
  542|     16|        avformat_free_context(c);
  543|     16|        void *iter = NULL;
  544|     64|        while ((format = av_muxer_iterate(&iter))) {
  ------------------
  |  Branch (544:16): [True: 48, False: 16]
  ------------------
  545|     48|            if (format->priv_class) {
  ------------------
  |  Branch (545:17): [True: 48, False: 0]
  ------------------
  546|     48|                mp_info(log, "Additionally, for --of=%s:\n",
  ------------------
  |  |   78|     48|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  547|     48|                       format->name);
  548|     48|                encode_lavc_printoptions(log, &format->priv_class, "  --ofopts=",
  549|     48|                                         "           ", NULL,
  550|     48|                                         AV_OPT_FLAG_ENCODING_PARAM,
  551|     48|                                         AV_OPT_FLAG_ENCODING_PARAM);
  552|     48|            }
  553|     48|        }
  554|     16|    }
  555|  11.3k|    if (CHECKV(opts->vopts)) {
  ------------------
  |  |  524|  11.3k|#define CHECKV(strv) ((strv) && (strv)[0] && \
  |  |  ------------------
  |  |  |  Branch (524:22): [True: 8, False: 11.3k]
  |  |  |  Branch (524:23): [True: 26, False: 11.3k]
  |  |  |  Branch (524:33): [True: 26, False: 0]
  |  |  ------------------
  |  |  525|  11.3k|                      strcmp((strv)[0], "help") == 0 ? (help_output |= 1) : 0)
  |  |  ------------------
  |  |  |  Branch (525:23): [True: 8, False: 18]
  |  |  ------------------
  ------------------
  556|      8|        AVCodecContext *c = avcodec_alloc_context3(NULL);
  557|      8|        const AVCodec *codec = NULL;
  558|      8|        mp_info(log, "Available output video codec ctx->options:\n");
  ------------------
  |  |   78|      8|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  559|      8|        encode_lavc_printoptions(log,
  560|      8|            c, "  --ovcopts=", "            ", NULL,
  561|      8|            AV_OPT_FLAG_ENCODING_PARAM |
  562|      8|            AV_OPT_FLAG_VIDEO_PARAM,
  563|      8|            AV_OPT_FLAG_ENCODING_PARAM |
  564|      8|            AV_OPT_FLAG_VIDEO_PARAM);
  565|      8|        av_free(c);
  566|      8|        void *iter = NULL;
  567|  4.01k|        while ((codec = av_codec_iterate(&iter))) {
  ------------------
  |  Branch (567:16): [True: 4.00k, False: 8]
  ------------------
  568|  4.00k|            if (!av_codec_is_encoder(codec))
  ------------------
  |  Branch (568:17): [True: 4.00k, False: 0]
  ------------------
  569|  4.00k|                continue;
  570|      0|            if (codec->type != AVMEDIA_TYPE_VIDEO)
  ------------------
  |  Branch (570:17): [True: 0, False: 0]
  ------------------
  571|      0|                continue;
  572|      0|            if (opts->vcodec && opts->vcodec[0] &&
  ------------------
  |  Branch (572:17): [True: 0, False: 0]
  |  Branch (572:33): [True: 0, False: 0]
  ------------------
  573|      0|                strcmp(opts->vcodec, codec->name) != 0)
  ------------------
  |  Branch (573:17): [True: 0, False: 0]
  ------------------
  574|      0|                continue;
  575|      0|            if (codec->priv_class) {
  ------------------
  |  Branch (575:17): [True: 0, False: 0]
  ------------------
  576|      0|                mp_info(log, "Additionally, for --ovc=%s:\n",
  ------------------
  |  |   78|      0|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  577|      0|                       codec->name);
  578|      0|                encode_lavc_printoptions(log,
  579|      0|                    &codec->priv_class, "  --ovcopts=",
  580|      0|                    "            ", NULL,
  581|      0|                    AV_OPT_FLAG_ENCODING_PARAM |
  582|      0|                    AV_OPT_FLAG_VIDEO_PARAM,
  583|      0|                    AV_OPT_FLAG_ENCODING_PARAM |
  584|      0|                    AV_OPT_FLAG_VIDEO_PARAM);
  585|      0|            }
  586|      0|        }
  587|      8|    }
  588|  11.3k|    if (CHECKV(opts->aopts)) {
  ------------------
  |  |  524|  11.3k|#define CHECKV(strv) ((strv) && (strv)[0] && \
  |  |  ------------------
  |  |  |  Branch (524:22): [True: 29, False: 11.3k]
  |  |  |  Branch (524:23): [True: 70, False: 11.3k]
  |  |  |  Branch (524:33): [True: 69, False: 1]
  |  |  ------------------
  |  |  525|  11.3k|                      strcmp((strv)[0], "help") == 0 ? (help_output |= 1) : 0)
  |  |  ------------------
  |  |  |  Branch (525:23): [True: 29, False: 40]
  |  |  ------------------
  ------------------
  589|     29|        AVCodecContext *c = avcodec_alloc_context3(NULL);
  590|     29|        const AVCodec *codec = NULL;
  591|     29|        mp_info(log, "Available output audio codec ctx->options:\n");
  ------------------
  |  |   78|     29|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  592|     29|        encode_lavc_printoptions(log,
  593|     29|            c, "  --oacopts=", "            ", NULL,
  594|     29|            AV_OPT_FLAG_ENCODING_PARAM |
  595|     29|            AV_OPT_FLAG_AUDIO_PARAM,
  596|     29|            AV_OPT_FLAG_ENCODING_PARAM |
  597|     29|            AV_OPT_FLAG_AUDIO_PARAM);
  598|     29|        av_free(c);
  599|     29|        void *iter = NULL;
  600|  14.5k|        while ((codec = av_codec_iterate(&iter))) {
  ------------------
  |  Branch (600:16): [True: 14.5k, False: 29]
  ------------------
  601|  14.5k|            if (!av_codec_is_encoder(codec))
  ------------------
  |  Branch (601:17): [True: 14.5k, False: 0]
  ------------------
  602|  14.5k|                continue;
  603|      0|            if (codec->type != AVMEDIA_TYPE_AUDIO)
  ------------------
  |  Branch (603:17): [True: 0, False: 0]
  ------------------
  604|      0|                continue;
  605|      0|            if (opts->acodec && opts->acodec[0] &&
  ------------------
  |  Branch (605:17): [True: 0, False: 0]
  |  Branch (605:33): [True: 0, False: 0]
  ------------------
  606|      0|                strcmp(opts->acodec, codec->name) != 0)
  ------------------
  |  Branch (606:17): [True: 0, False: 0]
  ------------------
  607|      0|                continue;
  608|      0|            if (codec->priv_class) {
  ------------------
  |  Branch (608:17): [True: 0, False: 0]
  ------------------
  609|      0|                mp_info(log, "Additionally, for --oac=%s:\n",
  ------------------
  |  |   78|      0|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  610|      0|                       codec->name);
  611|      0|                encode_lavc_printoptions(log,
  612|      0|                    &codec->priv_class, "  --oacopts=",
  613|      0|                    "           ", NULL,
  614|      0|                    AV_OPT_FLAG_ENCODING_PARAM |
  615|      0|                    AV_OPT_FLAG_AUDIO_PARAM,
  616|      0|                    AV_OPT_FLAG_ENCODING_PARAM |
  617|      0|                    AV_OPT_FLAG_AUDIO_PARAM);
  618|      0|            }
  619|      0|        }
  620|     29|    }
  621|  11.3k|    if (CHECKS(opts->vcodec)) {
  ------------------
  |  |  522|  11.3k|#define CHECKS(str) ((str) && \
  |  |  ------------------
  |  |  |  Branch (522:21): [True: 2, False: 11.3k]
  |  |  |  Branch (522:22): [True: 36, False: 11.3k]
  |  |  ------------------
  |  |  523|  11.3k|                     strcmp((str), "help") == 0 ? (help_output |= 1) : 0)
  |  |  ------------------
  |  |  |  Branch (523:22): [True: 2, False: 34]
  |  |  ------------------
  ------------------
  622|      2|        const AVCodec *c = NULL;
  623|      2|        void *iter = NULL;
  624|      2|        mp_info(log, "Available output video codecs:\n");
  ------------------
  |  |   78|      2|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  625|  1.00k|        while ((c = av_codec_iterate(&iter))) {
  ------------------
  |  Branch (625:16): [True: 1.00k, False: 2]
  ------------------
  626|  1.00k|            if (!av_codec_is_encoder(c))
  ------------------
  |  Branch (626:17): [True: 1.00k, False: 0]
  ------------------
  627|  1.00k|                continue;
  628|      0|            if (c->type != AVMEDIA_TYPE_VIDEO)
  ------------------
  |  Branch (628:17): [True: 0, False: 0]
  ------------------
  629|      0|                continue;
  630|      0|            mp_info(log, "  --ovc=%-12s %s\n", c->name,
  ------------------
  |  |   78|      0|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (78:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  631|      0|                   c->long_name ? c->long_name : "");
  632|      0|        }
  633|      2|    }
  634|  11.3k|    if (CHECKS(opts->acodec)) {
  ------------------
  |  |  522|  11.3k|#define CHECKS(str) ((str) && \
  |  |  ------------------
  |  |  |  Branch (522:21): [True: 1, False: 11.3k]
  |  |  |  Branch (522:22): [True: 35, False: 11.3k]
  |  |  ------------------
  |  |  523|  11.3k|                     strcmp((str), "help") == 0 ? (help_output |= 1) : 0)
  |  |  ------------------
  |  |  |  Branch (523:22): [True: 1, False: 34]
  |  |  ------------------
  ------------------
  635|      1|        const AVCodec *c = NULL;
  636|      1|        void *iter = NULL;
  637|      1|        mp_info(log, "Available output audio codecs:\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  638|    502|        while ((c = av_codec_iterate(&iter))) {
  ------------------
  |  Branch (638:16): [True: 501, False: 1]
  ------------------
  639|    501|            if (!av_codec_is_encoder(c))
  ------------------
  |  Branch (639:17): [True: 501, False: 0]
  ------------------
  640|    501|                continue;
  641|      0|            if (c->type != AVMEDIA_TYPE_AUDIO)
  ------------------
  |  Branch (641:17): [True: 0, False: 0]
  ------------------
  642|      0|                continue;
  643|      0|            mp_info(log, "  --oac=%-12s %s\n", c->name,
  ------------------
  |  |   78|      0|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (78:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  644|      0|                   c->long_name ? c->long_name : "");
  645|      0|        }
  646|      1|    }
  647|  11.3k|    return help_output;
  648|  11.3k|}
mp_encoder_update_log:
  936|  1.00k|{
  937|  1.00k|    struct encode_opts *options = mp_get_config_group(NULL, global, &encode_config);
  938|  1.00k|    if (options->file && (!strcmp(options->file, "-") ||
  ------------------
  |  Branch (938:9): [True: 293, False: 709]
  |  Branch (938:27): [True: 23, False: 270]
  ------------------
  939|    270|                          !strcmp(options->file, "/dev/stdout") ||
  ------------------
  |  Branch (939:27): [True: 3, False: 267]
  ------------------
  940|    267|                          !strcmp(options->file, "pipe:") ||
  ------------------
  |  Branch (940:27): [True: 3, False: 264]
  ------------------
  941|    264|                          !strcmp(options->file, "pipe:1")))
  ------------------
  |  Branch (941:27): [True: 3, False: 261]
  ------------------
  942|     32|    {
  943|     32|        mp_msg_force_stderr(global, true);
  944|     32|    }
  945|  1.00k|    talloc_free(options);
  ------------------
  |  |   47|  1.00k|#define talloc_free                     ta_free
  ------------------
  946|  1.00k|}
encode_lavc.c:encode_lavc_printoptions:
  449|    745|{
  450|    745|    const AVOption *opt = NULL;
  451|    745|    char optbuf[32];
  452|   240k|    while ((opt = av_opt_next(obj, opt))) {
  ------------------
  |  Branch (452:12): [True: 240k, False: 745]
  ------------------
  453|       |        // if flags are 0, it simply hasn't been filled in yet and may be
  454|       |        // potentially useful
  455|   240k|        if (opt->flags)
  ------------------
  |  Branch (455:13): [True: 229k, False: 11.1k]
  ------------------
  456|   229k|            if ((opt->flags & filter_and) != filter_eq)
  ------------------
  |  Branch (456:17): [True: 156k, False: 73.0k]
  ------------------
  457|   156k|                continue;
  458|       |        /* Don't print CONST's on level one.
  459|       |         * Don't print anything but CONST's on level two.
  460|       |         * Only print items from the requested unit.
  461|       |         */
  462|  84.1k|        if (!unit && opt->type == AV_OPT_TYPE_CONST) {
  ------------------
  |  Branch (462:13): [True: 4.71k, False: 79.4k]
  |  Branch (462:22): [True: 2.58k, False: 2.12k]
  ------------------
  463|  2.58k|            continue;
  464|  81.5k|        } else if (unit && opt->type != AV_OPT_TYPE_CONST) {
  ------------------
  |  Branch (464:20): [True: 79.4k, False: 2.12k]
  |  Branch (464:28): [True: 32.1k, False: 47.2k]
  ------------------
  465|  32.1k|            continue;
  466|  49.4k|        } else if (unit && opt->type == AV_OPT_TYPE_CONST
  ------------------
  |  Branch (466:20): [True: 47.2k, False: 2.12k]
  |  Branch (466:28): [True: 47.2k, False: 0]
  ------------------
  467|  47.2k|                 && strcmp(unit, opt->unit))
  ------------------
  |  Branch (467:21): [True: 44.1k, False: 3.11k]
  ------------------
  468|  44.1k|        {
  469|  44.1k|            continue;
  470|  44.1k|        } else if (unit && opt->type == AV_OPT_TYPE_CONST) {
  ------------------
  |  Branch (470:20): [True: 3.11k, False: 2.12k]
  |  Branch (470:28): [True: 3.11k, False: 0]
  ------------------
  471|  3.11k|            mp_info(log, "%s", subindent);
  ------------------
  |  |   78|  3.11k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  472|  3.11k|        } else {
  473|  2.12k|            mp_info(log, "%s", indent);
  ------------------
  |  |   78|  2.12k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  474|  2.12k|        }
  475|       |
  476|  5.24k|        switch (opt->type) {
  477|    270|        case AV_OPT_TYPE_FLAGS:
  ------------------
  |  Branch (477:9): [True: 270, False: 4.97k]
  ------------------
  478|    270|            snprintf(optbuf, sizeof(optbuf), "%s=<flags>", opt->name);
  479|    270|            break;
  480|  1.21k|        case AV_OPT_TYPE_INT:
  ------------------
  |  Branch (480:9): [True: 1.21k, False: 4.02k]
  ------------------
  481|  1.21k|            snprintf(optbuf, sizeof(optbuf), "%s=<int>", opt->name);
  482|  1.21k|            break;
  483|    275|        case AV_OPT_TYPE_INT64:
  ------------------
  |  Branch (483:9): [True: 275, False: 4.96k]
  ------------------
  484|    275|            snprintf(optbuf, sizeof(optbuf), "%s=<int64>", opt->name);
  485|    275|            break;
  486|      0|        case AV_OPT_TYPE_DOUBLE:
  ------------------
  |  Branch (486:9): [True: 0, False: 5.24k]
  ------------------
  487|      0|            snprintf(optbuf, sizeof(optbuf), "%s=<double>", opt->name);
  488|      0|            break;
  489|    104|        case AV_OPT_TYPE_FLOAT:
  ------------------
  |  Branch (489:9): [True: 104, False: 5.13k]
  ------------------
  490|    104|            snprintf(optbuf, sizeof(optbuf), "%s=<float>", opt->name);
  491|    104|            break;
  492|     53|        case AV_OPT_TYPE_STRING:
  ------------------
  |  Branch (492:9): [True: 53, False: 5.18k]
  ------------------
  493|     53|            snprintf(optbuf, sizeof(optbuf), "%s=<string>", opt->name);
  494|     53|            break;
  495|     90|        case AV_OPT_TYPE_RATIONAL:
  ------------------
  |  Branch (495:9): [True: 90, False: 5.15k]
  ------------------
  496|     90|            snprintf(optbuf, sizeof(optbuf), "%s=<rational>", opt->name);
  497|     90|            break;
  498|      0|        case AV_OPT_TYPE_BINARY:
  ------------------
  |  Branch (498:9): [True: 0, False: 5.24k]
  ------------------
  499|      0|            snprintf(optbuf, sizeof(optbuf), "%s=<binary>", opt->name);
  500|      0|            break;
  501|  3.11k|        case AV_OPT_TYPE_CONST:
  ------------------
  |  Branch (501:9): [True: 3.11k, False: 2.12k]
  ------------------
  502|  3.11k|            snprintf(optbuf, sizeof(optbuf), "  [+-]%s", opt->name);
  503|  3.11k|            break;
  504|    119|        default:
  ------------------
  |  Branch (504:9): [True: 119, False: 5.12k]
  ------------------
  505|    119|            snprintf(optbuf, sizeof(optbuf), "%s", opt->name);
  506|    119|            break;
  507|  5.24k|        }
  508|  5.24k|        optbuf[sizeof(optbuf) - 1] = 0;
  509|  5.24k|        mp_info(log, "%-32s ", optbuf);
  ------------------
  |  |   78|  5.24k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  510|  5.24k|        if (opt->help)
  ------------------
  |  Branch (510:13): [True: 4.12k, False: 1.11k]
  ------------------
  511|  4.12k|            mp_info(log, " %s", opt->help);
  ------------------
  |  |   78|  4.12k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  512|  5.24k|        mp_info(log, "\n");
  ------------------
  |  |   78|  5.24k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  513|  5.24k|        if (opt->unit && opt->type != AV_OPT_TYPE_CONST)
  ------------------
  |  Branch (513:13): [True: 3.75k, False: 1.48k]
  |  Branch (513:26): [True: 644, False: 3.11k]
  ------------------
  514|    644|            encode_lavc_printoptions(log, obj, indent, subindent, opt->unit,
  515|    644|                                     filter_and, filter_eq);
  516|  5.24k|    }
  517|    745|}

mp_msg_level:
  184|  2.38M|{
  185|  2.38M|    struct mp_log_root *root = log->root;
  186|  2.38M|    if (!root)
  ------------------
  |  Branch (186:9): [True: 192k, False: 2.18M]
  ------------------
  187|   192k|        return -1;
  188|  2.18M|    if (atomic_load_explicit(&log->reload_counter, memory_order_relaxed) !=
  ------------------
  |  Branch (188:9): [True: 151k, False: 2.03M]
  ------------------
  189|  2.18M|        atomic_load_explicit(&root->reload_counter, memory_order_relaxed))
  190|   151k|    {
  191|   151k|        update_loglevel(log);
  192|   151k|    }
  193|       |    return atomic_load_explicit(&log->level, memory_order_relaxed);
  194|  2.38M|}
mp_msg_flush_status_line:
  295|  16.4k|{
  296|  16.4k|    if (!log->root)
  ------------------
  |  Branch (296:9): [True: 0, False: 16.4k]
  ------------------
  297|      0|        return;
  298|       |
  299|  16.4k|    mp_mutex_lock(&log->root->lock);
  ------------------
  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  300|  16.4k|    msg_flush_status_line(log->root, clear);
  301|  16.4k|    mp_mutex_unlock(&log->root->lock);
  ------------------
  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  302|  16.4k|}
mp_msg_set_term_title:
  305|     44|{
  306|     44|    if (log->root && title) {
  ------------------
  |  Branch (306:9): [True: 44, False: 0]
  |  Branch (306:22): [True: 44, False: 0]
  ------------------
  307|       |        // Lock because printf to terminal is not necessarily atomic.
  308|     44|        mp_mutex_lock(&log->root->lock);
  ------------------
  |  |  134|     44|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  309|     44|        terminal_lock_output();
  310|     44|        fprintf(term_msg_fp(log->root, MSGL_STATUS), "\033]0;%s\007", title);
  311|     44|        terminal_unlock_output();
  312|     44|        mp_mutex_unlock(&log->root->lock);
  ------------------
  |  |  136|     44|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  313|     44|    }
  314|     44|}
mp_msg_has_status_line:
  317|    638|{
  318|    638|    struct mp_log_root *root = global->log->root;
  319|    638|    mp_mutex_lock(&root->lock);
  ------------------
  |  |  134|    638|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  320|    638|    bool r = root->status_lines > 0;
  321|    638|    mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|    638|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  322|    638|    return r;
  323|    638|}
mp_msg_sanitize:
  576|  1.76M|{
  577|   114M|    for (size_t i = 0; i < text->len; i++) {
  ------------------
  |  Branch (577:24): [True: 112M, False: 1.76M]
  ------------------
  578|   112M|        unsigned char ch = text->start[i];
  579|       |
  580|       |        // Allow SGR escape sequences only, filter anything else.
  581|   112M|        if (allow_sgr && ch == 0x1B && i + 2 < text->len && text->start[i + 1] == '[') {
  ------------------
  |  Branch (581:13): [True: 109M, False: 2.70M]
  |  Branch (581:26): [True: 5.98k, False: 109M]
  |  Branch (581:40): [True: 5.66k, False: 326]
  |  Branch (581:61): [True: 2.33k, False: 3.32k]
  ------------------
  582|  2.33k|            size_t j = i + 2;
  583|  2.33k|            bool sgr = false;
  584|       |
  585|  3.47k|            while (j < text->len) {
  ------------------
  |  Branch (585:20): [True: 3.47k, False: 0]
  ------------------
  586|  3.47k|                unsigned char c = text->start[j];
  587|  3.47k|                if (c == 'm') {
  ------------------
  |  Branch (587:21): [True: 1.79k, False: 1.67k]
  ------------------
  588|  1.79k|                    sgr = true;
  589|  1.79k|                    i = j;
  590|  1.79k|                    break;
  591|  1.79k|                } else if ((c >= '0' && c <= '9') || c == ';' || c == ':') {
  ------------------
  |  Branch (591:29): [True: 1.23k, False: 440]
  |  Branch (591:41): [True: 720, False: 512]
  |  Branch (591:54): [True: 205, False: 747]
  |  Branch (591:66): [True: 210, False: 537]
  ------------------
  592|  1.13k|                    j++;
  593|  1.13k|                } else {
  594|    537|                    break;
  595|    537|                }
  596|  3.47k|            }
  597|       |
  598|       |            // Nuke everything that is not an SGR sequence
  599|  2.33k|            if (!sgr)
  ------------------
  |  Branch (599:17): [True: 537, False: 1.79k]
  ------------------
  600|    537|                text->start[i] = '?';
  601|  2.33k|            continue;
  602|  2.33k|        }
  603|       |
  604|   112M|        int len = bstr_parse_utf8_code_length(ch);
  605|       |
  606|       |        // ASCII: allow only printable plus HT, LF, CR.
  607|   112M|        if (len == 1) {
  ------------------
  |  Branch (607:13): [True: 112M, False: 534k]
  ------------------
  608|   112M|            if (ch == 0x7F || (ch < 0x20 && ch != '\t' && ch != '\n' && ch != '\r'))
  ------------------
  |  Branch (608:17): [True: 3.98k, False: 112M]
  |  Branch (608:32): [True: 1.39M, False: 110M]
  |  Branch (608:45): [True: 1.38M, False: 387]
  |  Branch (608:59): [True: 89.5k, False: 1.30M]
  |  Branch (608:73): [True: 89.0k, False: 529]
  ------------------
  609|  93.0k|                text->start[i] = '?';
  610|   112M|            continue;
  611|   112M|        }
  612|       |
  613|       |        // Block UTF-8 C1 controls (C2 80..C2 9F), except PU1/PU2 used internally.
  614|   534k|        if (ch == 0xC2 && i + 1 < text->len && (text->start[i + 1] & 0xC0) == 0x80) {
  ------------------
  |  Branch (614:13): [True: 22.7k, False: 511k]
  |  Branch (614:27): [True: 22.7k, False: 1]
  |  Branch (614:48): [True: 20.2k, False: 2.45k]
  ------------------
  615|  20.2k|            unsigned char c1 = text->start[i + 1];
  616|  20.2k|            if (c1 >= 0x80 && c1 <= 0x9F && c1 != 0x91 && c1 != 0x92) {
  ------------------
  |  Branch (616:17): [True: 20.2k, False: 0]
  |  Branch (616:31): [True: 1.16k, False: 19.1k]
  |  Branch (616:45): [True: 703, False: 462]
  |  Branch (616:59): [True: 320, False: 383]
  ------------------
  617|    320|                text->start[i] = '?';
  618|    320|                text->start[i + 1] = '?';
  619|    320|            }
  620|  20.2k|            i++;
  621|  20.2k|            continue;
  622|  20.2k|        }
  623|       |
  624|       |        // Skip valid multi-byte sequences so continuation bytes aren't seen as
  625|       |        // raw C1. Reject overlong 0xC0/0xC1 and verify the bytes before skipping.
  626|   514k|        if (len >= 2 && ch >= 0xC2 && i + len <= text->len) {
  ------------------
  |  Branch (626:13): [True: 101k, False: 413k]
  |  Branch (626:25): [True: 98.3k, False: 2.76k]
  |  Branch (626:39): [True: 97.1k, False: 1.17k]
  ------------------
  627|  97.1k|            bool valid = true;
  628|   258k|            for (int n = 1; n < len; n++)
  ------------------
  |  Branch (628:29): [True: 161k, False: 97.1k]
  ------------------
  629|   161k|                valid &= (text->start[i + n] & 0xC0) == 0x80;
  630|  97.1k|            if (valid) {
  ------------------
  |  Branch (630:17): [True: 7.87k, False: 89.2k]
  ------------------
  631|  7.87k|                i += len - 1;
  632|  7.87k|                continue;
  633|  7.87k|            }
  634|  97.1k|        }
  635|       |
  636|       |        // Block raw 8-bit C1 (0x80-0x9F); leave other invalid bytes alone.
  637|   506k|        if (ch <= 0x9F)
  ------------------
  |  Branch (637:13): [True: 143k, False: 362k]
  ------------------
  638|   143k|            text->start[i] = '?';
  639|   506k|    }
  640|  1.76M|}
mp_msg_va:
  654|  2.32M|{
  655|  2.32M|    if (!mp_msg_test(log, lev))
  ------------------
  |  Branch (655:9): [True: 563k, False: 1.76M]
  ------------------
  656|   563k|        return; // do not display
  657|       |
  658|  1.76M|    struct mp_log_root *root = log->root;
  659|       |
  660|  1.76M|    mp_mutex_lock(&root->lock);
  ------------------
  |  |  134|  1.76M|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  661|       |
  662|  1.76M|    root->buffer.len = 0;
  663|       |
  664|       |    // The partial line is sanitized already, except for a UTF-8 sequence at
  665|       |    // its end that the new text may complete.
  666|  1.76M|    size_t sanitized = utf8_tail_start(log->partial[lev]);
  667|  1.76M|    if (log->partial[lev].len)
  ------------------
  |  Branch (667:9): [True: 615k, False: 1.14M]
  ------------------
  668|   615k|        bstr_xappend(root, &root->buffer, log->partial[lev]);
  669|  1.76M|    log->partial[lev].len = 0;
  670|       |
  671|  1.76M|    if (bstr_xappend_vasprintf(root, &root->buffer, format, va) < 0) {
  ------------------
  |  Branch (671:9): [True: 0, False: 1.76M]
  ------------------
  672|      0|        bstr_xappend(root, &root->buffer, bstr0("format error: "));
  673|      0|        bstr_xappend(root, &root->buffer, bstr0(format));
  674|      0|    }
  675|       |
  676|  1.76M|    bstr text = {root->buffer.start + sanitized, root->buffer.len - sanitized};
  677|  1.76M|    mp_msg_sanitize(&text, true);
  678|       |
  679|       |    // Remember last status message and restore it to ensure that it is
  680|       |    // always displayed
  681|  1.76M|    if (lev == MSGL_STATUS) {
  ------------------
  |  Branch (681:9): [True: 638, False: 1.76M]
  ------------------
  682|    638|        root->status_log = log;
  683|    638|        root->status_line.len = 0;
  684|       |        // Use bstr_xappend instead bstrdup to reuse allocated memory
  685|    638|        if (root->buffer.len)
  ------------------
  |  Branch (685:13): [True: 0, False: 638]
  ------------------
  686|      0|            bstr_xappend(root, &root->status_line, root->buffer);
  687|    638|    }
  688|       |
  689|  1.76M|    if (lev == MSGL_STATS) {
  ------------------
  |  Branch (689:9): [True: 501, False: 1.76M]
  ------------------
  690|    501|        dump_stats(log, lev, root->buffer);
  691|  1.76M|    } else if (lev == MSGL_STATUS && !test_terminal_level(log, lev)) {
  ------------------
  |  Branch (691:16): [True: 638, False: 1.75M]
  |  Branch (691:38): [True: 8, False: 630]
  ------------------
  692|       |        /* discard */
  693|  1.76M|    } else {
  694|  1.76M|        write_term_msg(log, lev, root->buffer, &root->term_msg);
  695|       |
  696|  1.76M|        FILE *stream = term_msg_fp(root, lev);
  697|  1.76M|        if (root->term_msg.len) {
  ------------------
  |  Branch (697:13): [True: 33.3k, False: 1.72M]
  ------------------
  698|  33.3k|            root->term_status_msg.len = 0;
  699|  33.3k|            if (lev != MSGL_STATUS && root->status_line.len && root->status_log &&
  ------------------
  |  Branch (699:17): [True: 33.3k, False: 0]
  |  Branch (699:39): [True: 0, False: 33.3k]
  |  Branch (699:64): [True: 0, False: 0]
  ------------------
  700|      0|                is_status_output(root, lev) && test_terminal_level(root->status_log, MSGL_STATUS))
  ------------------
  |  Branch (700:17): [True: 0, False: 0]
  |  Branch (700:48): [True: 0, False: 0]
  ------------------
  701|      0|            {
  702|      0|                write_term_msg(root->status_log, MSGL_STATUS, root->status_line,
  703|      0|                               &root->term_status_msg);
  704|      0|            }
  705|  33.3k|            terminal_lock_output();
  706|  33.3k|            fwrite(root->term_msg.start, root->term_msg.len, 1, stream);
  707|  33.3k|            if (root->term_status_msg.len)
  ------------------
  |  Branch (707:17): [True: 0, False: 33.3k]
  ------------------
  708|      0|                fwrite(root->term_status_msg.start, root->term_status_msg.len, 1, stream);
  709|  33.3k|            fflush(stream);
  710|  33.3k|            terminal_unlock_output();
  711|  33.3k|        }
  712|  1.76M|    }
  713|       |
  714|  1.76M|    mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|  1.76M|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  715|  1.76M|}
mp_log_new:
  737|   243k|{
  738|   243k|    mp_assert(parent);
  ------------------
  |  |   41|   243k|#define mp_assert assert
  ------------------
  |  Branch (738:5): [True: 243k, False: 0]
  ------------------
  739|   243k|    struct mp_log *log = talloc_zero(talloc_ctx, struct mp_log);
  ------------------
  |  |   27|   243k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|   243k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|   243k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  740|   243k|    if (!parent->root)
  ------------------
  |  Branch (740:9): [True: 0, False: 243k]
  ------------------
  741|      0|        return log; // same as null_log
  742|   243k|    talloc_set_destructor(log, destroy_log);
  ------------------
  |  |   41|   243k|#define talloc_set_destructor           ta_set_destructor
  ------------------
  743|   243k|    log->root = parent->root;
  744|   243k|    log->max_level = MSGL_MAX;
  745|   243k|    if (name) {
  ------------------
  |  Branch (745:9): [True: 242k, False: 1.95k]
  ------------------
  746|   242k|        if (name[0] == '!') {
  ------------------
  |  Branch (746:13): [True: 34.7k, False: 207k]
  ------------------
  747|  34.7k|            name = &name[1];
  748|   207k|        } else if (name[0] == '/') {
  ------------------
  |  Branch (748:20): [True: 0, False: 207k]
  ------------------
  749|      0|            name = &name[1];
  750|      0|            log->prefix = talloc_strdup(log, name);
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  751|   207k|        } else {
  752|   207k|            log->prefix = parent->prefix
  ------------------
  |  Branch (752:27): [True: 60.5k, False: 146k]
  ------------------
  753|   207k|                    ? talloc_asprintf(log, "%s/%s", parent->prefix, name)
  ------------------
  |  |   52|  60.5k|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|  60.5k|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  754|   207k|                    : talloc_strdup(log, name);
  ------------------
  |  |   50|   146k|#define talloc_strdup                   ta_xstrdup
  ------------------
  755|   207k|        }
  756|   242k|        log->verbose_prefix = parent->prefix
  ------------------
  |  Branch (756:31): [True: 60.5k, False: 181k]
  ------------------
  757|   242k|                ? talloc_asprintf(log, "%s/%s", parent->prefix, name)
  ------------------
  |  |   52|  60.5k|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|  60.5k|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  758|   242k|                : talloc_strdup(log, name);
  ------------------
  |  |   50|   181k|#define talloc_strdup                   ta_xstrdup
  ------------------
  759|   242k|        if (log->prefix && !log->prefix[0])
  ------------------
  |  Branch (759:13): [True: 207k, False: 34.7k]
  |  Branch (759:28): [True: 16.4k, False: 190k]
  ------------------
  760|  16.4k|            log->prefix = NULL;
  761|   242k|        if (!log->verbose_prefix[0])
  ------------------
  |  Branch (761:13): [True: 16.4k, False: 225k]
  ------------------
  762|  16.4k|            log->verbose_prefix = "global";
  763|   242k|    } else {
  764|  1.95k|        log->prefix = talloc_strdup(log, parent->prefix);
  ------------------
  |  |   50|  1.95k|#define talloc_strdup                   ta_xstrdup
  ------------------
  765|  1.95k|        log->verbose_prefix = talloc_strdup(log, parent->verbose_prefix);
  ------------------
  |  |   50|  1.95k|#define talloc_strdup                   ta_xstrdup
  ------------------
  766|  1.95k|    }
  767|   243k|    return log;
  768|   243k|}
mp_msg_init:
  771|  16.4k|{
  772|  16.4k|    mp_assert(!global->log);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (772:5): [True: 16.4k, False: 0]
  ------------------
  773|       |
  774|  16.4k|    struct mp_log_root *root = talloc_zero(NULL, struct mp_log_root);
  ------------------
  |  |   27|  16.4k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  16.4k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  775|  16.4k|    *root = (struct mp_log_root){
  776|  16.4k|        .global = global,
  777|  16.4k|        .reload_counter = 1,
  778|  16.4k|    };
  779|       |
  780|  16.4k|    mp_mutex_init(&root->lock);
  781|  16.4k|    mp_mutex_init(&root->log_file_lock);
  782|  16.4k|    mp_cond_init(&root->log_file_wakeup);
  783|       |
  784|  16.4k|    struct mp_log dummy = { .root = root };
  785|  16.4k|    struct mp_log *log = mp_log_new(root, &dummy, "");
  786|       |
  787|  16.4k|    global->log = log;
  788|  16.4k|}
mp_msg_update_msglevels:
  881|  27.7k|{
  882|  27.7k|    struct mp_log_root *root = global->log->root;
  883|       |
  884|  27.7k|    mp_mutex_lock(&root->lock);
  ------------------
  |  |  134|  27.7k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  885|       |
  886|  27.7k|    root->verbose = opts->verbose;
  887|  27.7k|    root->really_quiet = opts->msg_really_quiet;
  888|  27.7k|    root->module = opts->msg_module;
  889|  27.7k|    root->use_terminal = opts->use_terminal;
  890|  27.7k|    root->show_time = opts->msg_time;
  891|       |
  892|  27.7k|    if (root->really_quiet)
  ------------------
  |  Branch (892:9): [True: 13, False: 27.7k]
  ------------------
  893|     13|        root->status_lines = 0;
  894|       |
  895|  29.7k|    for (int i = STDOUT_FILENO; i <= STDERR_FILENO && root->use_terminal; ++i) {
  ------------------
  |  Branch (895:33): [True: 28.7k, False: 1.00k]
  |  Branch (895:55): [True: 2.00k, False: 26.7k]
  ------------------
  896|  2.00k|        root->isatty[i] = isatty(i);
  897|  2.00k|        root->color[i] = opts->msg_color && root->isatty[i];
  ------------------
  |  Branch (897:26): [True: 2.00k, False: 0]
  |  Branch (897:45): [True: 0, False: 2.00k]
  ------------------
  898|  2.00k|    }
  899|       |
  900|  27.7k|    m_option_type_msglevels.free(&root->msg_levels);
  901|  27.7k|    m_option_type_msglevels.copy(NULL, &root->msg_levels, &opts->msg_levels);
  902|       |
  903|  27.7k|    atomic_fetch_add(&root->reload_counter, 1);
  904|  27.7k|    mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|  27.7k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  905|       |
  906|  27.7k|    if (check_new_path(global, opts->log_file, &root->log_path)) {
  ------------------
  |  Branch (906:9): [True: 0, False: 27.7k]
  ------------------
  907|      0|        terminate_log_file_thread(root);
  908|      0|        if (root->log_path) {
  ------------------
  |  Branch (908:13): [True: 0, False: 0]
  ------------------
  909|      0|            root->log_file = fopen(root->log_path, "wb");
  ------------------
  |  |   84|      0|#define fopen(...) mp_fopen(__VA_ARGS__)
  ------------------
  910|      0|            if (root->log_file) {
  ------------------
  |  Branch (910:17): [True: 0, False: 0]
  ------------------
  911|       |
  912|       |                // if a logfile is created and the early filebuf still exists,
  913|       |                // flush and destroy the early buffer
  914|      0|                mp_mutex_lock(&root->lock);
  ------------------
  |  |  134|      0|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  915|      0|                struct mp_log_buffer *earlybuf = root->early_filebuffer;
  916|      0|                if (earlybuf)
  ------------------
  |  Branch (916:21): [True: 0, False: 0]
  ------------------
  917|      0|                    root->early_filebuffer = NULL;  // but it still logs msgs
  918|      0|                mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  919|       |
  920|      0|                if (earlybuf) {
  ------------------
  |  Branch (920:21): [True: 0, False: 0]
  ------------------
  921|       |                    // flush, destroy before creating the normal logfile buf,
  922|       |                    // as once the new one is created (specifically, its write
  923|       |                    // thread), then MSGL_LOGFILE messages become blocking, but
  924|       |                    // the early logfile buf is without dequeue - can deadlock.
  925|       |                    // note: timestamp is unknown, we use 0.000 as indication.
  926|       |                    // note: new messages while iterating are still flushed.
  927|      0|                    struct mp_log_buffer_entry *e;
  928|      0|                    while ((e = mp_msg_log_buffer_read(earlybuf))) {
  ------------------
  |  Branch (928:28): [True: 0, False: 0]
  ------------------
  929|      0|                        fprintf(root->log_file, "[%8.3f][%c][%s] %s", 0.0,
  930|      0|                                mp_log_levels[e->level][0], e->prefix, e->text);
  931|      0|                        talloc_free(e);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  932|      0|                    }
  933|      0|                    mp_msg_log_buffer_destroy(earlybuf);  // + remove from root
  934|      0|                }
  935|       |
  936|      0|                root->log_file_buffer =
  937|      0|                    mp_msg_log_buffer_new(global, FILE_BUF, MP_LOG_BUFFER_MSGL_LOGFILE,
  ------------------
  |  |   45|      0|#define FILE_BUF 100
  ------------------
                                  mp_msg_log_buffer_new(global, FILE_BUF, MP_LOG_BUFFER_MSGL_LOGFILE,
  ------------------
  |  |   29|      0|#define MP_LOG_BUFFER_MSGL_LOGFILE (MSGL_MAX + 2)
  ------------------
  938|      0|                                          wakeup_log_file, root);
  939|      0|                root->log_file_thread_active = true;
  940|      0|                if (mp_thread_create(&root->log_file_thread, log_file_thread,
  ------------------
  |  |  214|      0|#define mp_thread_create(t, f, a) pthread_create(t, NULL, f, a)
  |  |  ------------------
  |  |  |  Branch (214:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  941|      0|                                   root))
  942|      0|                {
  943|      0|                    root->log_file_thread_active = false;
  944|      0|                    terminate_log_file_thread(root);
  945|      0|                }
  946|      0|            } else {
  947|      0|                mp_err(global->log, "Failed to open log file '%s'\n",
  ------------------
  |  |   76|      0|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
  948|      0|                       root->log_path);
  949|      0|            }
  950|      0|        }
  951|      0|    }
  952|       |
  953|  27.7k|    if (check_new_path(global, opts->dump_stats, &root->stats_path)) {
  ------------------
  |  Branch (953:9): [True: 27, False: 27.7k]
  ------------------
  954|     27|        bool open_error = false;
  955|       |
  956|     27|        mp_mutex_lock(&root->lock);
  ------------------
  |  |  134|     27|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  957|     27|        if (root->stats_file)
  ------------------
  |  Branch (957:13): [True: 0, False: 27]
  ------------------
  958|      0|            fclose(root->stats_file);
  959|     27|        root->stats_file = NULL;
  960|     27|        if (root->stats_path) {
  ------------------
  |  Branch (960:13): [True: 27, False: 0]
  ------------------
  961|     27|            root->stats_file = fopen(root->stats_path, "wb");
  ------------------
  |  |   84|     27|#define fopen(...) mp_fopen(__VA_ARGS__)
  ------------------
  962|     27|            open_error = !root->stats_file;
  963|     27|        }
  964|     27|        mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|     27|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  965|       |
  966|     27|        if (open_error) {
  ------------------
  |  Branch (966:13): [True: 0, False: 27]
  ------------------
  967|      0|            mp_err(global->log, "Failed to open stats file '%s'\n",
  ------------------
  |  |   76|      0|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
  968|      0|                   root->stats_path);
  969|      0|        }
  970|     27|    }
  971|  27.7k|}
mp_msg_force_stderr:
  974|     32|{
  975|     32|    struct mp_log_root *root = global->log->root;
  976|       |
  977|     32|    mp_mutex_lock(&root->lock);
  ------------------
  |  |  134|     32|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  978|     32|    root->force_stderr = force_stderr;
  979|     32|    mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|     32|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  980|     32|}
mp_msg_has_log_file:
  984|  55.5k|{
  985|  55.5k|    struct mp_log_root *root = global->log->root;
  986|       |
  987|  55.5k|    return !!root->log_file;
  988|  55.5k|}
mp_msg_uninit:
  991|  16.4k|{
  992|  16.4k|    struct mp_log_root *root = global->log->root;
  993|  16.4k|    mp_msg_flush_status_line(global->log, true);
  994|  16.4k|    if (root->really_quiet && root->isatty[term_msg_fileno(root, MSGL_STATUS)]) {
  ------------------
  |  Branch (994:9): [True: 7, False: 16.3k]
  |  Branch (994:31): [True: 0, False: 7]
  ------------------
  995|      0|        terminal_lock_output();
  996|      0|        fprintf(term_msg_fp(root, MSGL_STATUS), TERM_ESC_RESTORE_CURSOR);
  ------------------
  |  |   30|      0|#define TERM_ESC_RESTORE_CURSOR     "\033[?25h"
  ------------------
  997|      0|        terminal_unlock_output();
  998|      0|    }
  999|  16.4k|    terminate_log_file_thread(root);
 1000|  16.4k|    mp_msg_log_buffer_destroy(root->early_buffer);
 1001|  16.4k|    mp_msg_log_buffer_destroy(root->early_filebuffer);
 1002|  16.4k|    mp_assert(root->num_buffers == 0);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (1002:5): [True: 16.4k, False: 0]
  ------------------
 1003|  16.4k|    if (root->stats_file)
  ------------------
  |  Branch (1003:9): [True: 27, False: 16.3k]
  ------------------
 1004|     27|        fclose(root->stats_file);
 1005|  16.4k|    talloc_free(root->stats_path);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
 1006|  16.4k|    talloc_free(root->log_path);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
 1007|  16.4k|    m_option_type_msglevels.free(&root->msg_levels);
 1008|  16.4k|    mp_mutex_destroy(&root->lock);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
 1009|  16.4k|    mp_mutex_destroy(&root->log_file_lock);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
 1010|  16.4k|    mp_cond_destroy(&root->log_file_wakeup);
 1011|  16.4k|    talloc_free(root);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
 1012|       |    global->log = NULL;
 1013|  16.4k|}
mp_msg_set_early_logging:
 1061|  27.7k|{
 1062|  27.7k|    struct mp_log_root *root = global->log->root;
 1063|       |
 1064|  27.7k|    mp_msg_set_early_logging_raw(global, enable, &root->early_buffer,
 1065|  27.7k|                                 EARLY_TERM_BUF, MP_LOG_BUFFER_MSGL_TERM);
  ------------------
  |  |   48|  27.7k|#define EARLY_TERM_BUF 100
  ------------------
                                               EARLY_TERM_BUF, MP_LOG_BUFFER_MSGL_TERM);
  ------------------
  |  |   27|  27.7k|#define MP_LOG_BUFFER_MSGL_TERM (MSGL_MAX + 1)
  ------------------
 1066|       |
 1067|       |    // normally MSGL_LOGFILE buffer gets a write thread, but not the early buf
 1068|  27.7k|    mp_msg_set_early_logging_raw(global, enable, &root->early_filebuffer,
 1069|  27.7k|                                 EARLY_FILE_BUF, MP_LOG_BUFFER_MSGL_LOGFILE);
  ------------------
  |  |   54|  27.7k|#define EARLY_FILE_BUF 5000
  ------------------
                                               EARLY_FILE_BUF, MP_LOG_BUFFER_MSGL_LOGFILE);
  ------------------
  |  |   29|  27.7k|#define MP_LOG_BUFFER_MSGL_LOGFILE (MSGL_MAX + 2)
  ------------------
 1070|  27.7k|}
mp_msg_log_buffer_new:
 1076|  32.8k|{
 1077|  32.8k|    struct mp_log_root *root = global->log->root;
 1078|       |
 1079|  32.8k|    mp_mutex_lock(&root->lock);
  ------------------
  |  |  134|  32.8k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
 1080|       |
 1081|  32.8k|    if (level == MP_LOG_BUFFER_MSGL_TERM) {
  ------------------
  |  |   27|  32.8k|#define MP_LOG_BUFFER_MSGL_TERM (MSGL_MAX + 1)
  ------------------
  |  Branch (1081:9): [True: 16.4k, False: 16.4k]
  ------------------
 1082|       |        // The first thing which creates a terminal-level log buffer gets the
 1083|       |        // early log buffer, if it exists. This is supposed to enable a script
 1084|       |        // to grab log messages from before it was initialized. It's OK that
 1085|       |        // this works only for 1 script and only once.
 1086|  16.4k|        if (root->early_buffer) {
  ------------------
  |  Branch (1086:13): [True: 0, False: 16.4k]
  ------------------
 1087|      0|            struct mp_log_buffer *buffer = root->early_buffer;
 1088|      0|            root->early_buffer = NULL;
 1089|      0|            mp_msg_log_buffer_resize(buffer, size);
 1090|      0|            buffer->wakeup_cb = wakeup_cb;
 1091|      0|            buffer->wakeup_cb_ctx = wakeup_cb_ctx;
 1092|      0|            mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 1093|      0|            return buffer;
 1094|      0|        }
 1095|  16.4k|    }
 1096|       |
 1097|  32.8k|    mp_assert(size > 0);
  ------------------
  |  |   41|  32.8k|#define mp_assert assert
  ------------------
  |  Branch (1097:5): [True: 32.8k, False: 0]
  ------------------
 1098|       |
 1099|  32.8k|    struct mp_log_buffer *buffer = talloc_ptrtype(NULL, buffer);
  ------------------
  |  |   34|  32.8k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  32.8k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  32.8k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1100|  32.8k|    *buffer = (struct mp_log_buffer) {
 1101|  32.8k|        .root = root,
 1102|  32.8k|        .level = level,
 1103|  32.8k|        .entries = talloc_array(buffer, struct mp_log_buffer_entry *, size),
  ------------------
  |  |   29|  32.8k|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|  32.8k|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  32.8k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1104|  32.8k|        .capacity = size,
 1105|  32.8k|        .wakeup_cb = wakeup_cb,
 1106|  32.8k|        .wakeup_cb_ctx = wakeup_cb_ctx,
 1107|  32.8k|    };
 1108|       |
 1109|  32.8k|    mp_mutex_init(&buffer->lock);
 1110|       |
 1111|  32.8k|    MP_TARRAY_APPEND(root, root->buffers, root->num_buffers, buffer);
  ------------------
  |  |  105|  32.8k|    do {                                            \
  |  |  106|  32.8k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  32.8k|    do {                                            \
  |  |  |  |   97|  32.8k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  32.8k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  32.8k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  32.8k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 16.4k, False: 16.4k]
  |  |  |  |  ------------------
  |  |  |  |   99|  32.8k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  16.4k|    do {                                                        \
  |  |  |  |  |  |   89|  16.4k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  16.4k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  16.4k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  16.4k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  16.4k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  16.4k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  16.4k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 16.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  32.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 32.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  32.8k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  32.8k|        (idxvar)++;                                 \
  |  |  109|  32.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 32.8k]
  |  |  ------------------
  ------------------
 1112|       |
 1113|  32.8k|    atomic_fetch_add(&root->reload_counter, 1);
 1114|  32.8k|    mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|  32.8k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 1115|       |
 1116|  32.8k|    return buffer;
 1117|  32.8k|}
mp_msg_log_buffer_destroy:
 1161|   103k|{
 1162|   103k|    if (!buffer)
  ------------------
  |  Branch (1162:9): [True: 70.7k, False: 32.8k]
  ------------------
 1163|  70.7k|        return;
 1164|       |
 1165|  32.8k|    struct mp_log_root *root = buffer->root;
 1166|       |
 1167|  32.8k|    mp_mutex_lock(&root->lock);
  ------------------
  |  |  134|  32.8k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
 1168|       |
 1169|  32.8k|    for (int n = 0; n < root->num_buffers; n++) {
  ------------------
  |  Branch (1169:21): [True: 32.8k, False: 0]
  ------------------
 1170|  32.8k|        if (root->buffers[n] == buffer) {
  ------------------
  |  Branch (1170:13): [True: 32.8k, False: 0]
  ------------------
 1171|  32.8k|            MP_TARRAY_REMOVE_AT(root->buffers, root->num_buffers, n);
  ------------------
  |  |  143|  32.8k|    do {                                            \
  |  |  144|  32.8k|        size_t at_ = (at);                          \
  |  |  145|  32.8k|        assert(at_ < (idxvar));                     \
  |  |  146|  32.8k|        memmove((p) + at_, (p) + at_ + 1,           \
  |  |  147|  32.8k|                ((idxvar) - at_ - 1) * sizeof((p)[0])); \
  |  |  148|  32.8k|        (idxvar)--;                                 \
  |  |  149|  32.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (149:14): [Folded, False: 32.8k]
  |  |  ------------------
  ------------------
  |  Branch (1171:13): [True: 32.8k, False: 0]
  ------------------
 1172|  32.8k|            goto found;
 1173|  32.8k|        }
 1174|  32.8k|    }
 1175|       |
 1176|      0|    MP_ASSERT_UNREACHABLE();
  ------------------
  |  |   46|      0|#define MP_ASSERT_UNREACHABLE() (assert(!"unreachable"), abort())
  ------------------
  |  Branch (1176:5): [Folded, False: 0]
  ------------------
 1177|       |
 1178|  32.8k|found:
 1179|       |
 1180|   870k|    while (buffer->num_entries)
  ------------------
  |  Branch (1180:12): [True: 838k, False: 32.8k]
  ------------------
 1181|   838k|        talloc_free(log_buffer_read(buffer));
  ------------------
  |  |   47|   838k|#define talloc_free                     ta_free
  ------------------
 1182|       |
 1183|  32.8k|    mp_mutex_destroy(&buffer->lock);
  ------------------
  |  |  133|  32.8k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
 1184|  32.8k|    talloc_free(buffer);
  ------------------
  |  |   47|  32.8k|#define talloc_free                     ta_free
  ------------------
 1185|       |
 1186|  32.8k|    atomic_fetch_add(&root->reload_counter, 1);
 1187|  32.8k|    mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|  32.8k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 1188|  32.8k|}
mp_msg:
 1223|  2.32M|{
 1224|  2.32M|    va_list va;
 1225|  2.32M|    va_start(va, format);
 1226|  2.32M|    mp_msg_va(log, lev, format, va);
 1227|       |    va_end(va);
 1228|  2.32M|}
mp_msg_find_level:
 1255|  2.68k|{
 1256|  24.2k|    for (int n = 0; n < MP_ARRAY_SIZE(mp_log_levels); n++) {
  ------------------
  |  |   49|  24.2k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (1256:21): [True: 22.1k, False: 2.10k]
  ------------------
 1257|  22.1k|        if (mp_log_levels[n] && !strcasecmp(s, mp_log_levels[n]))
  ------------------
  |  Branch (1257:13): [True: 22.1k, False: 0]
  |  Branch (1257:33): [True: 579, False: 21.5k]
  ------------------
 1258|    579|            return n;
 1259|  22.1k|    }
 1260|  2.10k|    return -1;
 1261|  2.68k|}
msg.c:update_loglevel:
  141|   151k|{
  142|   151k|    struct mp_log_root *root = log->root;
  143|   151k|    mp_mutex_lock(&root->lock);
  ------------------
  |  |  134|   151k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  144|   151k|    int level = MSGL_STATUS + root->verbose; // default log level
  145|   151k|    if (root->really_quiet)
  ------------------
  |  Branch (145:9): [True: 178, False: 150k]
  ------------------
  146|    178|        level = -1;
  147|   152k|    for (int n = 0; root->msg_levels && root->msg_levels[n * 2 + 0]; n++) {
  ------------------
  |  Branch (147:21): [True: 2.61k, False: 149k]
  |  Branch (147:41): [True: 1.41k, False: 1.20k]
  ------------------
  148|  1.41k|        if (match_mod(log->verbose_prefix, root->msg_levels[n * 2 + 0]))
  ------------------
  |  Branch (148:13): [True: 325, False: 1.09k]
  ------------------
  149|    325|            level = mp_msg_find_level(root->msg_levels[n * 2 + 1]);
  150|  1.41k|    }
  151|   151k|    log->terminal_level = level;
  152|   334k|    for (int n = 0; n < log->root->num_buffers; n++) {
  ------------------
  |  Branch (152:21): [True: 183k, False: 151k]
  ------------------
  153|   183k|        int buffer_level = log->root->buffers[n]->level;
  154|   183k|        if (buffer_level == MP_LOG_BUFFER_MSGL_LOGFILE)
  ------------------
  |  |   29|   183k|#define MP_LOG_BUFFER_MSGL_LOGFILE (MSGL_MAX + 2)
  ------------------
  |  Branch (154:13): [True: 91.8k, False: 91.8k]
  ------------------
  155|  91.8k|            buffer_level = MSGL_DEBUG;
  156|   183k|        if (buffer_level != MP_LOG_BUFFER_MSGL_TERM)
  ------------------
  |  |   27|   183k|#define MP_LOG_BUFFER_MSGL_TERM (MSGL_MAX + 1)
  ------------------
  |  Branch (156:13): [True: 91.8k, False: 91.8k]
  ------------------
  157|  91.8k|            level = MPMAX(level, buffer_level);
  ------------------
  |  |   44|  91.8k|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 1.95k, False: 89.8k]
  |  |  ------------------
  ------------------
  158|   183k|    }
  159|   151k|    if (log->root->log_file)
  ------------------
  |  Branch (159:9): [True: 0, False: 151k]
  ------------------
  160|      0|        level = MPMAX(level, MSGL_DEBUG);
  ------------------
  |  |   44|      0|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  161|   151k|    if (log->root->stats_file)
  ------------------
  |  Branch (161:9): [True: 509, False: 150k]
  ------------------
  162|    509|        level = MPMAX(level, MSGL_STATS);
  ------------------
  |  |   44|    509|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 207, False: 302]
  |  |  ------------------
  ------------------
  163|   151k|    level = MPMIN(level, log->max_level);
  ------------------
  |  |   45|   151k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 906, False: 150k]
  |  |  ------------------
  ------------------
  164|   151k|    atomic_store_explicit(&log->level, level, memory_order_relaxed);
  165|   151k|    atomic_store(&log->reload_counter, atomic_load(&log->root->reload_counter));
  166|   151k|    mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|   151k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  167|   151k|}
msg.c:match_mod:
  132|  1.41k|{
  133|  1.41k|    if (!strcmp(mod, "all"))
  ------------------
  |  Branch (133:9): [True: 311, False: 1.10k]
  ------------------
  134|    311|        return true;
  135|       |    // Path prefix matches
  136|  1.10k|    bstr b = bstr0(name);
  137|  1.10k|    return bstr_eatstart0(&b, mod) && (bstr_eatstart0(&b, "/") || !b.len);
  ------------------
  |  Branch (137:12): [True: 504, False: 602]
  |  Branch (137:40): [True: 0, False: 504]
  |  Branch (137:67): [True: 14, False: 490]
  ------------------
  138|  1.41k|}
msg.c:msg_flush_status_line:
  265|  16.4k|{
  266|  16.4k|    if (!root->status_lines)
  ------------------
  |  Branch (266:9): [True: 16.4k, False: 0]
  ------------------
  267|  16.4k|        goto done;
  268|       |
  269|      0|    FILE *fp = term_msg_fp(root, MSGL_STATUS);
  270|      0|    if (!clear) {
  ------------------
  |  Branch (270:9): [True: 0, False: 0]
  ------------------
  271|      0|        terminal_lock_output();
  272|      0|        if (root->isatty[term_msg_fileno(root, MSGL_STATUS)])
  ------------------
  |  Branch (272:13): [True: 0, False: 0]
  ------------------
  273|      0|            fprintf(fp, TERM_ESC_RESTORE_CURSOR);
  ------------------
  |  |   30|      0|#define TERM_ESC_RESTORE_CURSOR     "\033[?25h"
  ------------------
  274|      0|        fprintf(fp, "\n");
  275|      0|        terminal_unlock_output();
  276|      0|        root->blank_lines = 0;
  277|      0|        root->status_lines = 0;
  278|      0|        goto done;
  279|      0|    }
  280|       |
  281|      0|    bstr term_msg = {0};
  282|      0|    prepare_prefix(root, &term_msg, MSGL_STATUS, 0);
  283|      0|    if (term_msg.len) {
  ------------------
  |  Branch (283:9): [True: 0, False: 0]
  ------------------
  284|      0|        terminal_lock_output();
  285|      0|        fprintf(fp, "%.*s", BSTR_P(term_msg));
  ------------------
  |  |  307|      0|#define BSTR_P(bstr) (int)((bstr).len), ((bstr).start ? (char*)(bstr).start : "")
  |  |  ------------------
  |  |  |  Branch (307:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  286|      0|        terminal_unlock_output();
  287|      0|        talloc_free(term_msg.start);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  288|      0|    }
  289|       |
  290|  16.4k|done:
  291|  16.4k|    root->status_line.len = 0;
  292|  16.4k|}
msg.c:prepare_prefix:
  221|  33.9k|{
  222|  33.9k|    int new_lines = lev == MSGL_STATUS ? term_lines : 0;
  ------------------
  |  Branch (222:21): [True: 630, False: 33.3k]
  ------------------
  223|  33.9k|    out->len = 0;
  224|       |
  225|  33.9k|    if (!is_status_output(root, lev))
  ------------------
  |  Branch (225:9): [True: 0, False: 33.9k]
  ------------------
  226|      0|        return;
  227|       |
  228|  33.9k|    if (!root->isatty[term_msg_fileno(root, lev)]) {
  ------------------
  |  Branch (228:9): [True: 33.9k, False: 0]
  ------------------
  229|  33.9k|        if (root->status_lines)
  ------------------
  |  Branch (229:13): [True: 0, False: 33.9k]
  ------------------
  230|      0|            bstr_xappend(root, out, bstr0("\n"));
  231|  33.9k|        root->status_lines = new_lines;
  232|  33.9k|        return;
  233|  33.9k|    }
  234|       |
  235|       |    // Set cursor state
  236|      0|    if (new_lines && !root->status_lines) {
  ------------------
  |  Branch (236:9): [True: 0, False: 0]
  |  Branch (236:22): [True: 0, False: 0]
  ------------------
  237|      0|        bstr_xappend(root, out, bstr0(TERM_ESC_HIDE_CURSOR));
  ------------------
  |  |   29|      0|#define TERM_ESC_HIDE_CURSOR        "\033[?25l"
  ------------------
  238|      0|    } else if (!new_lines && root->status_lines) {
  ------------------
  |  Branch (238:16): [True: 0, False: 0]
  |  Branch (238:30): [True: 0, False: 0]
  ------------------
  239|      0|        bstr_xappend(root, out, bstr0(TERM_ESC_RESTORE_CURSOR));
  ------------------
  |  |   30|      0|#define TERM_ESC_RESTORE_CURSOR     "\033[?25h"
  ------------------
  240|      0|    }
  241|       |
  242|      0|    int line_skip = 0;
  243|      0|    if (root->status_lines) {
  ------------------
  |  Branch (243:9): [True: 0, False: 0]
  ------------------
  244|       |        // Clear previous status line
  245|      0|        bstr_xappend(root, out, bstr0("\033[1K\r"));
  246|      0|        bstr up_clear = bstr0("\033[A\033[K");
  247|      0|        for (int i = 1; i < root->status_lines; ++i)
  ------------------
  |  Branch (247:25): [True: 0, False: 0]
  ------------------
  248|      0|            bstr_xappend(root, out, up_clear);
  249|      0|        mp_assert(root->status_lines > 0 && root->blank_lines >= root->status_lines);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (249:9): [True: 0, False: 0]
  |  Branch (249:9): [True: 0, False: 0]
  ------------------
  250|      0|        line_skip = root->blank_lines - root->status_lines;
  251|      0|    }
  252|       |
  253|      0|    if (new_lines)
  ------------------
  |  Branch (253:9): [True: 0, False: 0]
  ------------------
  254|      0|        line_skip -= MPMAX(0, root->blank_lines - new_lines);
  ------------------
  |  |   44|      0|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  255|       |
  256|      0|    if (line_skip)
  ------------------
  |  Branch (256:9): [True: 0, False: 0]
  ------------------
  257|      0|        bstr_xappend_asprintf(root, out, line_skip > 0 ? "\033[%dA" : "\033[%dB", abs(line_skip));
  ------------------
  |  Branch (257:42): [True: 0, False: 0]
  ------------------
  258|       |
  259|      0|    root->blank_lines = MPMAX(0, root->blank_lines - term_lines);
  ------------------
  |  |   44|      0|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  260|      0|    root->status_lines = new_lines;
  261|      0|    root->blank_lines += root->status_lines;
  262|      0|}
msg.c:term_msg_fp:
  202|  1.76M|{
  203|  1.76M|    return term_msg_fileno(root, lev) == STDERR_FILENO ? stderr : stdout;
  ------------------
  |  Branch (203:12): [True: 6.12k, False: 1.75M]
  ------------------
  204|  1.76M|}
msg.c:utf8_tail_start:
  644|  1.76M|{
  645|  1.76M|    for (size_t n = 1; n <= 4 && n <= str.len; n++) {
  ------------------
  |  Branch (645:24): [True: 1.76M, False: 0]
  |  Branch (645:34): [True: 615k, False: 1.14M]
  ------------------
  646|   615k|        unsigned char ch = str.start[str.len - n];
  647|   615k|        if ((ch & 0xC0) != 0x80)
  ------------------
  |  Branch (647:13): [True: 615k, False: 0]
  ------------------
  648|   615k|            return ch >= 0xC0 ? str.len - n : str.len;
  ------------------
  |  Branch (648:20): [True: 0, False: 615k]
  ------------------
  649|   615k|    }
  650|  1.14M|    return str.len;
  651|  1.76M|}
msg.c:dump_stats:
  511|    501|{
  512|    501|    struct mp_log_root *root = log->root;
  513|    501|    if (lev == MSGL_STATS && root->stats_file)
  ------------------
  |  Branch (513:9): [True: 501, False: 0]
  |  Branch (513:30): [True: 108, False: 393]
  ------------------
  514|    108|        fprintf(root->stats_file, "%"PRId64" %.*s\n", mp_time_ns(), BSTR_P(text));
  ------------------
  |  |  307|    108|#define BSTR_P(bstr) (int)((bstr).len), ((bstr).start ? (char*)(bstr).start : "")
  |  |  ------------------
  |  |  |  Branch (307:42): [True: 108, False: 0]
  |  |  ------------------
  ------------------
  515|    501|}
msg.c:test_terminal_level:
  379|  1.76M|{
  380|  1.76M|    return lev <= log->terminal_level && log->root->use_terminal &&
  ------------------
  |  Branch (380:12): [True: 902k, False: 859k]
  |  Branch (380:42): [True: 76.7k, False: 825k]
  ------------------
  381|  76.7k|           !(lev == MSGL_STATUS && terminal_in_background());
  ------------------
  |  Branch (381:14): [True: 1.26k, False: 75.5k]
  |  Branch (381:36): [True: 0, False: 1.26k]
  ------------------
  382|  1.76M|}
msg.c:write_term_msg:
  518|  1.76M|{
  519|  1.76M|    struct mp_log_root *root = log->root;
  520|  1.76M|    bool print_term = test_terminal_level(log, lev);
  521|  1.76M|    int fileno = term_msg_fileno(root, lev);
  522|  1.76M|    int term_w = 0, term_h = 0;
  523|  1.76M|    if (print_term && root->isatty[fileno])
  ------------------
  |  Branch (523:9): [True: 76.1k, False: 1.68M]
  |  Branch (523:23): [True: 0, False: 76.1k]
  ------------------
  524|      0|        terminal_get_size(&term_w, &term_h);
  525|       |
  526|  1.76M|    out->len = 0;
  527|       |
  528|       |    // Split away each line. Normally we require full lines; buffer partial
  529|       |    // lines if they happen.
  530|  1.76M|    root->term_msg_tmp.len = 0;
  531|  1.76M|    int term_msg_lines = 0;
  532|       |
  533|  1.76M|    bstr str = text;
  534|  2.91M|    while (str.len) {
  ------------------
  |  Branch (534:12): [True: 1.76M, False: 1.14M]
  ------------------
  535|  1.76M|        bstr line = bstr_getline(str, &str);
  536|  1.76M|        if (line.start[line.len - 1] != '\n') {
  ------------------
  |  Branch (536:13): [True: 615k, False: 1.15M]
  ------------------
  537|   615k|            mp_assert(str.len == 0);
  ------------------
  |  |   41|   615k|#define mp_assert assert
  ------------------
  |  Branch (537:13): [True: 615k, False: 0]
  ------------------
  538|   615k|            str = line;
  539|   615k|            break;
  540|   615k|        }
  541|       |
  542|  1.76M|        bool clip = bstr_eatstart0(&line, TERM_MSG_0);
  ------------------
  |  |   30|  1.15M|#define TERM_MSG_0 TERM_MSG_ESCAPE "0"
  |  |  ------------------
  |  |  |  |   29|  1.15M|#define TERM_MSG_ESCAPE "\xC2\x92" "t"
  |  |  ------------------
  ------------------
  543|  1.15M|        if (print_term) {
  ------------------
  |  Branch (543:13): [True: 33.5k, False: 1.11M]
  ------------------
  544|  33.5k|            int line_w;
  545|  33.5k|            append_terminal_line(log, lev, line, &root->term_msg_tmp, &line_w,
  546|  33.5k|                                 clip && term_w ? term_w : INT_MAX);
  ------------------
  |  Branch (546:34): [True: 0, False: 33.5k]
  |  Branch (546:42): [True: 0, False: 0]
  ------------------
  547|  33.5k|            term_msg_lines += (!line_w || !term_w)
  ------------------
  |  Branch (547:32): [True: 33.5k, False: 0]
  |  Branch (547:43): [True: 0, False: 0]
  ------------------
  548|  33.5k|                                ? 1 : (line_w + term_w - 1) / term_w;
  549|  33.5k|        }
  550|  1.15M|        write_msg_to_buffers(log, lev, line);
  551|  1.15M|    }
  552|       |
  553|  1.76M|    if (lev == MSGL_STATUS) {
  ------------------
  |  Branch (553:9): [True: 630, False: 1.75M]
  ------------------
  554|    630|        int line_w = 0;
  555|    630|        bool clip = bstr_eatstart0(&str, TERM_MSG_0);
  ------------------
  |  |   30|    630|#define TERM_MSG_0 TERM_MSG_ESCAPE "0"
  |  |  ------------------
  |  |  |  |   29|    630|#define TERM_MSG_ESCAPE "\xC2\x92" "t"
  |  |  ------------------
  ------------------
  556|    630|        if (str.len && print_term)
  ------------------
  |  Branch (556:13): [True: 0, False: 630]
  |  Branch (556:24): [True: 0, False: 0]
  ------------------
  557|      0|            append_terminal_line(log, lev, str, &root->term_msg_tmp, &line_w,
  558|      0|                                 clip && term_w ? term_w : INT_MAX);
  ------------------
  |  Branch (558:34): [True: 0, False: 0]
  |  Branch (558:42): [True: 0, False: 0]
  ------------------
  559|    630|        term_msg_lines += !term_w ? (str.len ? 1 : 0)
  ------------------
  |  Branch (559:27): [True: 630, False: 0]
  |  Branch (559:38): [True: 0, False: 630]
  ------------------
  560|    630|                                  : (line_w + term_w - 1) / term_w;
  561|  1.75M|    } else if (str.len) {
  ------------------
  |  Branch (561:16): [True: 615k, False: 1.14M]
  ------------------
  562|   615k|        bstr_xappend(NULL, &log->partial[lev], str);
  563|   615k|    }
  564|       |
  565|  1.76M|    if (print_term && (root->term_msg_tmp.len || lev == MSGL_STATUS)) {
  ------------------
  |  Branch (565:9): [True: 76.1k, False: 1.68M]
  |  Branch (565:24): [True: 33.3k, False: 42.8k]
  |  Branch (565:50): [True: 630, False: 42.1k]
  ------------------
  566|  33.9k|        prepare_prefix(root, out, lev, term_msg_lines);
  567|  33.9k|        if (root->color[fileno] && root->term_msg_tmp.len) {
  ------------------
  |  Branch (567:13): [True: 0, False: 33.9k]
  |  Branch (567:36): [True: 0, False: 0]
  ------------------
  568|      0|            set_msg_color(root, out, lev);
  569|      0|            set_term_color(root, &root->term_msg_tmp, -1);
  570|      0|        }
  571|  33.9k|        bstr_xappend(root, out, root->term_msg_tmp);
  572|  33.9k|    }
  573|  1.76M|}
msg.c:append_terminal_line:
  386|  33.5k|{
  387|  33.5k|    struct mp_log_root *root = log->root;
  388|       |
  389|  33.5k|    size_t start = term_msg->len;
  390|       |
  391|  33.5k|    if (root->show_time)
  ------------------
  |  Branch (391:9): [True: 2.29k, False: 31.2k]
  ------------------
  392|  2.29k|        bstr_xappend_asprintf(root, term_msg, "[%10.6f] ", mp_time_sec());
  393|       |
  394|  33.5k|    const char *log_prefix = (lev >= MSGL_V) || root->verbose || root->module
  ------------------
  |  Branch (394:30): [True: 19.1k, False: 14.4k]
  |  Branch (394:49): [True: 6.94k, False: 7.47k]
  |  Branch (394:66): [True: 479, False: 6.99k]
  ------------------
  395|  33.5k|                                ? log->verbose_prefix : log->prefix;
  396|  33.5k|    if (log_prefix) {
  ------------------
  |  Branch (396:9): [True: 26.7k, False: 6.80k]
  ------------------
  397|  26.7k|        if (root->module) {
  ------------------
  |  Branch (397:13): [True: 941, False: 25.8k]
  ------------------
  398|    941|            pretty_print_module(root, term_msg, log_prefix, lev);
  399|  25.8k|        } else {
  400|  25.8k|            bstr_xappend_asprintf(root, term_msg, "[%s] ", log_prefix);
  401|  25.8k|        }
  402|  26.7k|    }
  403|       |
  404|  33.5k|    bstr_xappend(root, term_msg, text);
  405|       |
  406|  33.5k|    const unsigned char *cut_pos = NULL;
  407|  33.5k|    int ellipsis_width = 2;
  408|  33.5k|    int width = term_disp_width(bstr_splice(*term_msg, start, term_msg->len),
  409|  33.5k|                                term_w - ellipsis_width, &cut_pos);
  410|  33.5k|    if (cut_pos) {
  ------------------
  |  Branch (410:9): [True: 0, False: 33.5k]
  ------------------
  411|      0|        int new_len = cut_pos - term_msg->start;
  412|      0|        bstr rem = bstrdup(NULL, (bstr){(unsigned char *)cut_pos, term_msg->len - new_len});
  413|      0|        void *ptr = rem.start;
  414|      0|        term_msg->len = new_len;
  415|       |
  416|      0|        bstr_xappend(root, term_msg, bstr0(".."));
  417|       |
  418|      0|        while (rem.len) {
  ------------------
  |  Branch (418:16): [True: 0, False: 0]
  ------------------
  419|      0|            if (bstr_eatstart0(&rem, "\n")) {
  ------------------
  |  Branch (419:17): [True: 0, False: 0]
  ------------------
  420|      0|                bstr_xappend(root, term_msg, bstr0("\n"));
  421|      0|                continue;
  422|      0|            }
  423|      0|            if (bstr_eatstart0(&rem, "\033[")) {
  ------------------
  |  Branch (423:17): [True: 0, False: 0]
  ------------------
  424|      0|                bstr_xappend(root, term_msg, bstr0("\033["));
  425|       |
  426|      0|                while (rem.len && !((*rem.start >= '@' && *rem.start <= '~') || *rem.start == 'm')) {
  ------------------
  |  Branch (426:24): [True: 0, False: 0]
  |  Branch (426:38): [True: 0, False: 0]
  |  Branch (426:59): [True: 0, False: 0]
  |  Branch (426:81): [True: 0, False: 0]
  ------------------
  427|      0|                    bstr_xappend(root, term_msg, bstr_splice(rem, 0, 1));
  428|      0|                    rem = bstr_cut(rem, 1);
  429|      0|                }
  430|      0|                bstr_xappend(root, term_msg, bstr_splice(rem, 0, 1));
  431|      0|            }
  432|      0|            rem = bstr_cut(rem, 1);
  433|      0|        }
  434|      0|        talloc_free(ptr);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  435|       |
  436|      0|        width += ellipsis_width;
  437|      0|    }
  438|  33.5k|    *line_w = root->isatty[term_msg_fileno(root, lev)] ? width : 0;
  ------------------
  |  Branch (438:15): [True: 0, False: 33.5k]
  ------------------
  439|  33.5k|}
msg.c:pretty_print_module:
  357|    941|{
  358|    941|    size_t prefix_len = strlen(prefix);
  359|    941|    root->module_indent = MPMAX(10, MPMAX(root->module_indent, prefix_len));
  ------------------
  |  |   44|  1.88k|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 24, False: 917]
  |  |  |  Branch (44:29): [True: 827, False: 114]
  |  |  |  Branch (44:41): [True: 827, False: 90]
  |  |  ------------------
  ------------------
  360|    941|    bool color = root->color[term_msg_fileno(root, lev)];
  361|       |
  362|       |    // Use random color based on the name of the module
  363|    941|    if (color) {
  ------------------
  |  Branch (363:9): [True: 0, False: 941]
  ------------------
  364|      0|        unsigned int mod = 0;
  365|      0|        for (int i = 0; i < prefix_len; ++i)
  ------------------
  |  Branch (365:25): [True: 0, False: 0]
  ------------------
  366|      0|            mod = mod * 33 + prefix[i];
  367|      0|        set_term_color(root, text, (mod + 1) % 15 + 1);
  368|      0|    }
  369|       |
  370|    941|    bstr_xappend_asprintf(root, text, "%*s", root->module_indent, prefix);
  371|    941|    if (color)
  ------------------
  |  Branch (371:9): [True: 0, False: 941]
  ------------------
  372|      0|        set_term_color(root, text, -1);
  373|    941|    bstr_xappend(root, text, bstr0(": "));
  374|    941|    if (color)
  ------------------
  |  Branch (374:9): [True: 0, False: 941]
  ------------------
  375|      0|        set_msg_color(root, text, lev);
  376|    941|}
msg.c:write_msg_to_buffers:
  459|  1.15M|{
  460|  1.15M|    struct mp_log_root *root = log->root;
  461|  2.65M|    for (int n = 0; n < root->num_buffers; n++) {
  ------------------
  |  Branch (461:21): [True: 1.50M, False: 1.15M]
  ------------------
  462|  1.50M|        struct mp_log_buffer *buffer = root->buffers[n];
  463|  1.50M|        bool wakeup = false;
  464|  1.50M|        mp_mutex_lock(&buffer->lock);
  ------------------
  |  |  134|  1.50M|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  465|  1.50M|        int buffer_level = buffer->level;
  466|  1.50M|        if (buffer_level == MP_LOG_BUFFER_MSGL_TERM)
  ------------------
  |  |   27|  1.50M|#define MP_LOG_BUFFER_MSGL_TERM (MSGL_MAX + 1)
  ------------------
  |  Branch (466:13): [True: 750k, False: 750k]
  ------------------
  467|   750k|            buffer_level = log->terminal_level;
  468|  1.50M|        if (buffer_level == MP_LOG_BUFFER_MSGL_LOGFILE)
  ------------------
  |  |   29|  1.50M|#define MP_LOG_BUFFER_MSGL_LOGFILE (MSGL_MAX + 2)
  ------------------
  |  Branch (468:13): [True: 752k, False: 749k]
  ------------------
  469|   752k|            buffer_level = MPMAX(log->terminal_level, MSGL_DEBUG);
  ------------------
  |  |   44|   752k|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 16.0k, False: 735k]
  |  |  ------------------
  ------------------
  470|  1.50M|        if (lev <= buffer_level && lev != MSGL_STATUS) {
  ------------------
  |  Branch (470:13): [True: 952k, False: 548k]
  |  Branch (470:36): [True: 952k, False: 0]
  ------------------
  471|   952k|            if (buffer->level == MP_LOG_BUFFER_MSGL_LOGFILE) {
  ------------------
  |  |   29|   952k|#define MP_LOG_BUFFER_MSGL_LOGFILE (MSGL_MAX + 2)
  ------------------
  |  Branch (471:17): [True: 750k, False: 201k]
  ------------------
  472|       |                // If the buffer is full, block until we can write again,
  473|       |                // unless there's no write thread (died, or early filebuffer)
  474|   750k|                if (buffer->num_entries == buffer->capacity) {
  ------------------
  |  Branch (474:21): [True: 13.8k, False: 736k]
  ------------------
  475|       |                    // Temporary unlock is OK; buffer->level is immutable, and
  476|       |                    // buffer can't go away because the global log lock is held.
  477|  13.8k|                    mp_mutex_unlock(&buffer->lock);
  ------------------
  |  |  136|  13.8k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  478|  13.8k|                    mp_mutex_lock(&root->log_file_lock);
  ------------------
  |  |  134|  13.8k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  479|  13.8k|                    while (root->log_file_thread_active && log_buffer_full(buffer)) {
  ------------------
  |  Branch (479:28): [True: 0, False: 13.8k]
  |  Branch (479:60): [True: 0, False: 0]
  ------------------
  480|      0|                        mp_cond_wait(&root->log_file_wakeup,
  481|      0|                                          &root->log_file_lock);
  482|      0|                    }
  483|  13.8k|                    mp_mutex_unlock(&root->log_file_lock);
  ------------------
  |  |  136|  13.8k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  484|  13.8k|                    mp_mutex_lock(&buffer->lock);
  ------------------
  |  |  134|  13.8k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  485|  13.8k|                }
  486|   750k|            }
  487|   952k|            if (buffer->num_entries == buffer->capacity) {
  ------------------
  |  Branch (487:17): [True: 114k, False: 838k]
  ------------------
  488|   114k|                struct mp_log_buffer_entry *skip = log_buffer_read(buffer);
  489|   114k|                talloc_free(skip);
  ------------------
  |  |   47|   114k|#define talloc_free                     ta_free
  ------------------
  490|   114k|                buffer->dropped += 1;
  491|   114k|            }
  492|   952k|            struct mp_log_buffer_entry *entry = talloc_ptrtype(NULL, entry);
  ------------------
  |  |   34|   952k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|   952k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|   952k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  493|   952k|            *entry = (struct mp_log_buffer_entry) {
  494|   952k|                .prefix = talloc_strdup(entry, log->verbose_prefix),
  ------------------
  |  |   50|   952k|#define talloc_strdup                   ta_xstrdup
  ------------------
  495|   952k|                .level = lev,
  496|   952k|                .text = bstrdup0(entry, text),
  497|   952k|            };
  498|   952k|            int pos = (buffer->entry0 + buffer->num_entries) % buffer->capacity;
  499|   952k|            buffer->entries[pos] = entry;
  500|   952k|            buffer->num_entries += 1;
  501|   952k|            if (buffer->wakeup_cb && !buffer->silent)
  ------------------
  |  Branch (501:17): [True: 0, False: 952k]
  |  Branch (501:38): [True: 0, False: 0]
  ------------------
  502|      0|                wakeup = true;
  503|   952k|        }
  504|  1.50M|        mp_mutex_unlock(&buffer->lock);
  ------------------
  |  |  136|  1.50M|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  505|  1.50M|        if (wakeup)
  ------------------
  |  Branch (505:13): [True: 0, False: 1.50M]
  ------------------
  506|      0|            buffer->wakeup_cb(buffer->wakeup_cb_ctx);
  507|  1.50M|    }
  508|  1.15M|}
msg.c:is_status_output:
  207|  33.9k|{
  208|  33.9k|    if (lev == MSGL_STATUS)
  ------------------
  |  Branch (208:9): [True: 630, False: 33.3k]
  ------------------
  209|    630|        return true;
  210|  33.3k|    int msg_out = term_msg_fileno(root, lev);
  211|  33.3k|    int status_out = term_msg_fileno(root, MSGL_STATUS);
  212|  33.3k|    if (msg_out != status_out && root->isatty[msg_out] != root->isatty[status_out])
  ------------------
  |  Branch (212:9): [True: 0, False: 33.3k]
  |  Branch (212:34): [True: 0, False: 0]
  ------------------
  213|      0|        return false;
  214|  33.3k|    return true;
  215|  33.3k|}
msg.c:destroy_log:
  718|   243k|{
  719|   243k|    struct mp_log *log = ptr;
  720|       |    // This is not managed via talloc itself, because mp_msg calls must be
  721|       |    // thread-safe, while talloc is not thread-safe.
  722|  2.43M|    for (int lvl = 0; lvl <= MSGL_MAX; ++lvl)
  ------------------
  |  Branch (722:23): [True: 2.19M, False: 243k]
  ------------------
  723|  2.19M|        talloc_free(log->partial[lvl].start);
  ------------------
  |  |   47|  2.19M|#define talloc_free                     ta_free
  ------------------
  724|   243k|}
msg.c:check_new_path:
  858|  55.5k|{
  859|  55.5k|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  55.5k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  55.5k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  860|  55.5k|    bool res = false;
  861|       |
  862|  55.5k|    char *new_path = mp_get_user_path(tmp, global, opt);
  863|  55.5k|    if (!new_path)
  ------------------
  |  Branch (863:9): [True: 55.5k, False: 48]
  ------------------
  864|  55.5k|        new_path = "";
  865|       |
  866|  55.5k|    char *old_path = *current_path ? *current_path : "";
  ------------------
  |  Branch (866:22): [True: 17, False: 55.5k]
  ------------------
  867|  55.5k|    if (strcmp(old_path, new_path) != 0) {
  ------------------
  |  Branch (867:9): [True: 27, False: 55.5k]
  ------------------
  868|     27|        talloc_free(*current_path);
  ------------------
  |  |   47|     27|#define talloc_free                     ta_free
  ------------------
  869|     27|        *current_path = NULL;
  870|     27|        if (new_path[0])
  ------------------
  |  Branch (870:13): [True: 27, False: 0]
  ------------------
  871|     27|            *current_path = talloc_strdup(NULL, new_path);
  ------------------
  |  |   50|     27|#define talloc_strdup                   ta_xstrdup
  ------------------
  872|     27|        res = true;
  873|     27|    }
  874|       |
  875|  55.5k|    talloc_free(tmp);
  ------------------
  |  |   47|  55.5k|#define talloc_free                     ta_free
  ------------------
  876|       |
  877|  55.5k|    return res;
  878|  55.5k|}
msg.c:terminate_log_file_thread:
  832|  16.4k|{
  833|  16.4k|    bool wait_terminate = false;
  834|       |
  835|  16.4k|    mp_mutex_lock(&root->log_file_lock);
  ------------------
  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  836|  16.4k|    if (root->log_file_thread_active) {
  ------------------
  |  Branch (836:9): [True: 0, False: 16.4k]
  ------------------
  837|      0|        root->log_file_thread_active = false;
  838|      0|        mp_cond_broadcast(&root->log_file_wakeup);
  839|      0|        wait_terminate = true;
  840|      0|    }
  841|  16.4k|    mp_mutex_unlock(&root->log_file_lock);
  ------------------
  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  842|       |
  843|  16.4k|    if (wait_terminate)
  ------------------
  |  Branch (843:9): [True: 0, False: 16.4k]
  ------------------
  844|      0|        mp_thread_join(root->log_file_thread);
  ------------------
  |  |  215|      0|#define mp_thread_join(t)         pthread_join(t, NULL)
  ------------------
  845|       |
  846|  16.4k|    mp_msg_log_buffer_destroy(root->log_file_buffer);
  847|  16.4k|    root->log_file_buffer = NULL;
  848|       |
  849|  16.4k|    if (root->log_file)
  ------------------
  |  Branch (849:9): [True: 0, False: 16.4k]
  ------------------
  850|      0|        fclose(root->log_file);
  851|       |    root->log_file = NULL;
  852|  16.4k|}
msg.c:term_msg_fileno:
  197|  3.65M|{
  198|  3.65M|    return root->force_stderr ? STDERR_FILENO : STDOUT_FILENO;
  ------------------
  |  Branch (198:12): [True: 23.4k, False: 3.63M]
  ------------------
  199|  3.65M|}
msg.c:mp_msg_set_early_logging_raw:
 1036|  55.5k|{
 1037|  55.5k|    struct mp_log_root *root = global->log->root;
 1038|  55.5k|    mp_mutex_lock(&root->lock);
  ------------------
  |  |  134|  55.5k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
 1039|       |
 1040|  55.5k|    if (enable != !!*root_logbuf) {
  ------------------
  |  Branch (1040:9): [True: 55.5k, False: 0]
  ------------------
 1041|  55.5k|        if (enable) {
  ------------------
  |  Branch (1041:13): [True: 32.8k, False: 22.7k]
  ------------------
 1042|  32.8k|            mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|  32.8k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 1043|  32.8k|            struct mp_log_buffer *buf =
 1044|  32.8k|                mp_msg_log_buffer_new(global, size, level, NULL, NULL);
 1045|  32.8k|            mp_mutex_lock(&root->lock);
  ------------------
  |  |  134|  32.8k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
 1046|  32.8k|            mp_assert(!*root_logbuf); // no concurrent calls to this function
  ------------------
  |  |   41|  32.8k|#define mp_assert assert
  ------------------
  |  Branch (1046:13): [True: 32.8k, False: 0]
  ------------------
 1047|  32.8k|            *root_logbuf = buf;
 1048|  32.8k|        } else {
 1049|  22.7k|            struct mp_log_buffer *buf = *root_logbuf;
 1050|  22.7k|            *root_logbuf = NULL;
 1051|  22.7k|            mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|  22.7k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 1052|  22.7k|            mp_msg_log_buffer_destroy(buf);
 1053|  22.7k|            return;
 1054|  22.7k|        }
 1055|  55.5k|    }
 1056|       |
 1057|  32.8k|    mp_mutex_unlock(&root->lock);
  ------------------
  |  |  136|  32.8k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 1058|  32.8k|}
msg.c:log_buffer_read:
  442|   952k|{
  443|   952k|    mp_assert(buffer->num_entries);
  ------------------
  |  |   41|   952k|#define mp_assert assert
  ------------------
  |  Branch (443:5): [True: 952k, False: 0]
  ------------------
  444|   952k|    struct mp_log_buffer_entry *res = buffer->entries[buffer->entry0];
  445|   952k|    buffer->entry0 = (buffer->entry0 + 1) % buffer->capacity;
  446|   952k|    buffer->num_entries -= 1;
  447|   952k|    return res;
  448|   952k|}

av_log.c:mp_msg_test:
   64|  7.28k|{
   65|  7.28k|    return lev <= mp_msg_level(log);
   66|  7.28k|}
msg.c:mp_msg_test:
   64|  2.32M|{
   65|  2.32M|    return lev <= mp_msg_level(log);
   66|  2.32M|}
cmd.c:mp_msg_test:
   64|  11.3k|{
   65|  11.3k|    return lev <= mp_msg_level(log);
   66|  11.3k|}
input.c:mp_msg_test:
   64|  20.4k|{
   65|  20.4k|    return lev <= mp_msg_level(log);
   66|  20.4k|}
m_config_frontend.c:mp_msg_test:
   64|  16.4k|{
   65|  16.4k|    return lev <= mp_msg_level(log);
   66|  16.4k|}
command.c:mp_msg_test:
   64|    912|{
   65|    912|    return lev <= mp_msg_level(log);
   66|    912|}

playlist_entry_new:
   31|  55.0k|{
   32|  55.0k|    struct playlist_entry *e = talloc_zero(NULL, struct playlist_entry);
  ------------------
  |  |   27|  55.0k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  55.0k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  55.0k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   33|  55.0k|    char *local_filename = mp_file_url_to_filename(e, bstr0(filename));
   34|  55.0k|    e->filename = mp_normalize_path(e, local_filename ? local_filename : filename);
  ------------------
  |  Branch (34:40): [True: 630, False: 54.3k]
  ------------------
   35|  55.0k|    talloc_free(local_filename);
  ------------------
  |  |   47|  55.0k|#define talloc_free                     ta_free
  ------------------
   36|  55.0k|    e->stream_flags = STREAM_ORIGIN_DIRECT;
  ------------------
  |  |   47|  55.0k|#define STREAM_ORIGIN_DIRECT      (1 << 2) // passed from cmdline or loadfile
  ------------------
   37|  55.0k|    e->original_index = -1;
   38|  55.0k|    return e;
   39|  55.0k|}
playlist_entry_add_param:
   42|  13.3k|{
   43|  13.3k|    struct playlist_param p = {bstrdup(e, name), bstrdup(e, value)};
   44|  13.3k|    MP_TARRAY_APPEND(e, e->params, e->num_params, p);
  ------------------
  |  |  105|  13.3k|    do {                                            \
  |  |  106|  13.3k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  13.3k|    do {                                            \
  |  |  |  |   97|  13.3k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  13.3k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  13.3k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  13.3k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 2.74k, False: 10.5k]
  |  |  |  |  ------------------
  |  |  |  |   99|  13.3k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  2.74k|    do {                                                        \
  |  |  |  |  |  |   89|  2.74k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  2.74k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  2.74k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  2.74k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  2.74k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  2.74k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  2.74k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 2.74k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  13.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 13.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  13.3k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  13.3k|        (idxvar)++;                                 \
  |  |  109|  13.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 13.3k]
  |  |  ------------------
  ------------------
   45|  13.3k|}
playlist_entry_add_params:
   50|  1.65k|{
   51|  14.9k|    for (int n = 0; n < num_params; n++)
  ------------------
  |  Branch (51:21): [True: 13.3k, False: 1.65k]
  ------------------
   52|  13.3k|        playlist_entry_add_param(e, params[n].name, params[n].value);
   53|  1.65k|}
playlist_insert_at:
   77|  55.0k|{
   78|  55.0k|    mp_assert(add->filename);
  ------------------
  |  |   41|  55.0k|#define mp_assert assert
  ------------------
  |  Branch (78:5): [True: 55.0k, False: 0]
  ------------------
   79|  55.0k|    mp_assert(!at || at->pl == pl);
  ------------------
  |  |   41|  55.0k|#define mp_assert assert
  ------------------
  |  Branch (79:5): [True: 55.0k, False: 0]
  |  Branch (79:5): [True: 0, False: 0]
  ------------------
   80|       |
   81|  55.0k|    int index = at ? at->pl_index : pl->num_entries;
  ------------------
  |  Branch (81:17): [True: 0, False: 55.0k]
  ------------------
   82|  55.0k|    MP_TARRAY_INSERT_AT(pl, pl->entries, pl->num_entries, index, add);
  ------------------
  |  |  115|  55.0k|    do {                                            \
  |  |  116|  55.0k|        size_t at_ = (at);                          \
  |  |  117|  55.0k|        assert(at_ <= (idxvar));                    \
  |  |  118|  55.0k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  55.0k|    do {                                            \
  |  |  |  |   97|  55.0k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  55.0k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  55.0k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  55.0k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 8.19k, False: 46.8k]
  |  |  |  |  ------------------
  |  |  |  |   99|  55.0k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  8.19k|    do {                                                        \
  |  |  |  |  |  |   89|  8.19k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  8.19k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  8.19k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  8.19k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  8.19k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  8.19k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  8.19k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 8.19k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  55.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 55.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|  55.0k|        memmove((p) + at_ + 1, (p) + at_,           \
  |  |  120|  55.0k|                ((idxvar) - at_) * sizeof((p)[0])); \
  |  |  121|  55.0k|        (idxvar)++;                                 \
  |  |  122|  55.0k|        (p)[at_] = (__VA_ARGS__);                   \
  |  |  123|  55.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 55.0k]
  |  |  ------------------
  ------------------
  |  Branch (82:5): [True: 55.0k, False: 0]
  ------------------
   83|       |
   84|  55.0k|    add->pl = pl;
   85|  55.0k|    add->pl_index = index;
   86|  55.0k|    add->id = ++pl->id_alloc;
   87|       |
   88|  55.0k|    playlist_update_indexes(pl, index, pl->num_entries);
   89|       |
   90|  55.0k|    talloc_steal(pl, add);
  ------------------
  |  |   38|  55.0k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  55.0k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
   91|  55.0k|}
playlist_entry_unref:
   94|  11.1k|{
   95|  11.1k|    e->reserved--;
   96|  11.1k|    if (e->reserved < 0) {
  ------------------
  |  Branch (96:9): [True: 11.1k, False: 0]
  ------------------
   97|  11.1k|        mp_assert(!e->pl);
  ------------------
  |  |   41|  11.1k|#define mp_assert assert
  ------------------
  |  Branch (97:9): [True: 11.1k, False: 0]
  ------------------
   98|  11.1k|        talloc_free(e);
  ------------------
  |  |   47|  11.1k|#define talloc_free                     ta_free
  ------------------
   99|  11.1k|    }
  100|  11.1k|}
playlist_remove:
  103|  11.1k|{
  104|  11.1k|    mp_assert(pl && entry->pl == pl);
  ------------------
  |  |   41|  11.1k|#define mp_assert assert
  ------------------
  |  Branch (104:5): [True: 11.1k, False: 0]
  |  Branch (104:5): [True: 11.1k, False: 0]
  ------------------
  105|       |
  106|  11.1k|    if (pl->current == entry) {
  ------------------
  |  Branch (106:9): [True: 1, False: 11.1k]
  ------------------
  107|      1|        pl->current = playlist_entry_get_rel(entry, 1);
  108|      1|        pl->current_was_replaced = true;
  109|      1|    }
  110|       |
  111|  11.1k|    MP_TARRAY_REMOVE_AT(pl->entries, pl->num_entries, entry->pl_index);
  ------------------
  |  |  143|  11.1k|    do {                                            \
  |  |  144|  11.1k|        size_t at_ = (at);                          \
  |  |  145|  11.1k|        assert(at_ < (idxvar));                     \
  |  |  146|  11.1k|        memmove((p) + at_, (p) + at_ + 1,           \
  |  |  147|  11.1k|                ((idxvar) - at_ - 1) * sizeof((p)[0])); \
  |  |  148|  11.1k|        (idxvar)--;                                 \
  |  |  149|  11.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (149:14): [Folded, False: 11.1k]
  |  |  ------------------
  ------------------
  |  Branch (111:5): [True: 11.1k, False: 0]
  ------------------
  112|  11.1k|    playlist_update_indexes(pl, entry->pl_index, -1);
  113|       |
  114|  11.1k|    entry->pl = NULL;
  115|  11.1k|    entry->pl_index = -1;
  116|  11.1k|    ta_set_parent(entry, NULL);
  117|       |
  118|       |    entry->removed = true;
  119|  11.1k|    playlist_entry_unref(entry);
  120|  11.1k|}
playlist_clear:
  123|     97|{
  124|  11.2k|    for (int n = pl->num_entries - 1; n >= 0; n--)
  ------------------
  |  Branch (124:39): [True: 11.1k, False: 97]
  ------------------
  125|  11.1k|        playlist_remove(pl, pl->entries[n]);
  126|     97|    mp_assert(!pl->current);
  ------------------
  |  |   41|     97|#define mp_assert assert
  ------------------
  |  Branch (126:5): [True: 97, False: 0]
  ------------------
  127|     97|    pl->current_was_replaced = false;
  128|     97|    pl->playlist_completed = false;
  129|     97|    pl->playlist_started = false;
  130|       |    TA_FREEP(&pl->playlist_dir);
  ------------------
  |  |   81|     97|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|     97|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 97]
  |  |  ------------------
  ------------------
  131|     97|}
playlist_append_file:
  166|  55.0k|{
  167|       |    playlist_insert_at(pl, playlist_entry_new(filename), NULL);
  168|  55.0k|}
playlist_shuffle:
  180|     29|{
  181|  1.93k|    for (int n = 0; n < pl->num_entries; n++)
  ------------------
  |  Branch (181:21): [True: 1.90k, False: 29]
  ------------------
  182|  1.90k|        pl->entries[n]->original_index = n;
  183|     29|    mp_rand_state s = mp_rand_seed(0);
  184|  1.90k|    for (int n = 0; n < pl->num_entries - 1; n++) {
  ------------------
  |  Branch (184:21): [True: 1.87k, False: 29]
  ------------------
  185|  1.87k|        size_t j = mp_rand_in_range32(&s, n, pl->num_entries);
  186|  1.87k|        MPSWAP(struct playlist_entry *, pl->entries[n], pl->entries[j]);
  ------------------
  |  |   48|  1.87k|    do { type SWAP_tmp = b; b = a; a = SWAP_tmp; } while (0)
  |  |  ------------------
  |  |  |  Branch (48:59): [Folded, False: 1.87k]
  |  |  ------------------
  ------------------
  187|  1.87k|    }
  188|     29|    playlist_update_indexes(pl, 0, -1);
  189|     29|}
playlist_get_first:
  212|  11.6k|{
  213|  11.6k|    return pl->num_entries ? pl->entries[0] : NULL;
  ------------------
  |  Branch (213:12): [True: 3.60k, False: 8.08k]
  ------------------
  214|  11.6k|}
playlist_get_last:
  218|  1.22k|{
  219|  1.22k|    return pl->num_entries ? pl->entries[pl->num_entries - 1] : NULL;
  ------------------
  |  Branch (219:12): [True: 468, False: 758]
  ------------------
  220|  1.22k|}
playlist_entry_get_rel:
  242|  1.91k|{
  243|  1.91k|    mp_assert(direction == -1 || direction == +1);
  ------------------
  |  |   41|  1.91k|#define mp_assert assert
  ------------------
  |  Branch (243:5): [True: 0, False: 1.91k]
  |  Branch (243:5): [True: 1.91k, False: 0]
  ------------------
  244|  1.91k|    if (!e->pl)
  ------------------
  |  Branch (244:9): [True: 0, False: 1.91k]
  ------------------
  245|      0|        return NULL;
  246|  1.91k|    return playlist_entry_from_index(e->pl, e->pl_index + direction);
  247|  1.91k|}
playlist_entry_to_index:
  379|    287|{
  380|    287|    if (!e || e->pl != pl)
  ------------------
  |  Branch (380:9): [True: 287, False: 0]
  |  Branch (380:15): [True: 0, False: 0]
  ------------------
  381|    287|        return -1;
  382|      0|    return e->pl_index;
  383|    287|}
playlist_entry_count:
  386|  2.12k|{
  387|  2.12k|    return pl->num_entries;
  388|  2.12k|}
playlist_entry_from_index:
  393|  11.5k|{
  394|  11.5k|    return index >= 0 && index < pl->num_entries ? pl->entries[index] : NULL;
  ------------------
  |  Branch (394:12): [True: 11.5k, False: 0]
  |  Branch (394:26): [True: 11.2k, False: 341]
  ------------------
  395|  11.5k|}
playlist.c:playlist_update_indexes:
   65|  66.2k|{
   66|  66.2k|    start = MPMAX(start, 0);
  ------------------
  |  |   44|  66.2k|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 61.5k, False: 4.65k]
  |  |  ------------------
  ------------------
   67|  66.2k|    end = end < 0 ? pl->num_entries : MPMIN(end, pl->num_entries);
  ------------------
  |  |   45|   121k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 55.0k]
  |  |  ------------------
  ------------------
  |  Branch (67:11): [True: 11.1k, False: 55.0k]
  ------------------
   68|       |
   69|   123k|    for (int n = start; n < end; n++)
  ------------------
  |  Branch (69:25): [True: 56.9k, False: 66.2k]
  ------------------
   70|  56.9k|        pl->entries[n]->pl_index = n;
   71|  66.2k|}

stats_global_init:
   81|  16.4k|{
   82|  16.4k|    mp_assert(!global->stats);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (82:5): [True: 16.4k, False: 0]
  ------------------
   83|  16.4k|    struct stats_base *stats = talloc_zero(global, struct stats_base);
  ------------------
  |  |   27|  16.4k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  16.4k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   84|  16.4k|    ta_set_destructor(stats, stats_destroy);
   85|  16.4k|    mp_mutex_init(&stats->lock);
   86|       |
   87|  16.4k|    global->stats = stats;
   88|  16.4k|    stats->global = global;
   89|  16.4k|}
stats_global_query:
  111|     61|{
  112|     61|    struct stats_base *stats = global->stats;
  113|     61|    mp_assert(stats);
  ------------------
  |  |   41|     61|#define mp_assert assert
  ------------------
  |  Branch (113:5): [True: 61, False: 0]
  ------------------
  114|       |
  115|     61|    mp_mutex_lock(&stats->lock);
  ------------------
  |  |  134|     61|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  116|       |
  117|     61|    atomic_store(&stats->active, true);
  118|       |
  119|     61|    if (!stats->num_entries) {
  ------------------
  |  Branch (119:9): [True: 61, False: 0]
  ------------------
  120|    183|        for (struct stats_ctx *ctx = stats->list.head; ctx; ctx = ctx->list.next)
  ------------------
  |  Branch (120:56): [True: 122, False: 61]
  ------------------
  121|    122|        {
  122|    122|            for (int n = 0; n < ctx->num_entries; n++) {
  ------------------
  |  Branch (122:29): [True: 0, False: 122]
  ------------------
  123|      0|                MP_TARRAY_APPEND(stats, stats->entries, stats->num_entries,
  ------------------
  |  |  105|      0|    do {                                            \
  |  |  106|      0|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      0|    do {                                            \
  |  |  |  |   97|      0|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      0|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      0|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|      0|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      0|        (idxvar)++;                                 \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  124|      0|                                 ctx->entries[n]);
  125|      0|            }
  126|    122|        }
  127|     61|        if (stats->num_entries) {
  ------------------
  |  Branch (127:13): [True: 0, False: 61]
  ------------------
  128|      0|            qsort(stats->entries, stats->num_entries, sizeof(stats->entries[0]),
  129|      0|                  cmp_entry);
  130|      0|        }
  131|     61|    }
  132|       |
  133|     61|    node_init(out, MPV_FORMAT_NODE_ARRAY, NULL);
  134|       |
  135|     61|#define FMT_T(e, t) ((t) > 0 ? mp_tprintf(80, "%.3f ms (%.2f%%)", (e), ((e) / (t)) * 100) \
  136|     61|                             : mp_tprintf(80, "%.3f ms", (e)))
  137|       |
  138|     61|    int64_t now = mp_time_ns();
  139|     61|    double t_ms = 0;
  140|     61|    if (stats->last_time) {
  ------------------
  |  Branch (140:9): [True: 40, False: 21]
  ------------------
  141|     40|        t_ms = MP_TIME_NS_TO_MS(now - stats->last_time);
  ------------------
  |  |   77|     40|#define MP_TIME_NS_TO_MS(ns) ((ns) / (double)1000000)
  ------------------
  142|     40|        struct mpv_node *ne = node_array_add(out, MPV_FORMAT_NODE_MAP);
  143|     40|        node_map_add_string(ne, "name", "poll-time");
  144|     40|        node_map_add_double(ne, "value", t_ms);
  145|     40|        node_map_add_string(ne, "text", FMT_T(t_ms, 0));
  ------------------
  |  |  135|     40|#define FMT_T(e, t) ((t) > 0 ? mp_tprintf(80, "%.3f ms (%.2f%%)", (e), ((e) / (t)) * 100) \
  |  |  ------------------
  |  |  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (135:22): [Folded, False: 40]
  |  |  ------------------
  |  |  136|     40|                             : mp_tprintf(80, "%.3f ms", (e)))
  |  |  ------------------
  |  |  |  |  195|     40|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  ------------------
  146|       |
  147|       |        // Very dirty way to reset everything if the stats.lua page was probably
  148|       |        // closed. Not enough energy left for clean solution. Fuck it.
  149|     40|        if (t_ms > 2000) {
  ------------------
  |  Branch (149:13): [True: 0, False: 40]
  ------------------
  150|      0|            for (int n = 0; n < stats->num_entries; n++) {
  ------------------
  |  Branch (150:29): [True: 0, False: 0]
  ------------------
  151|      0|                struct stat_entry *e = stats->entries[n];
  152|       |
  153|      0|                e->cpu_start_ns = e->time_start_ns = 0;
  154|      0|                e->val_rt = e->val_th = 0;
  155|      0|                if (e->type != VAL_THREAD_CPU_TIME)
  ------------------
  |  Branch (155:21): [True: 0, False: 0]
  ------------------
  156|      0|                    e->type = 0;
  157|      0|            }
  158|      0|        }
  159|     40|    }
  160|     61|    stats->last_time = now;
  161|       |
  162|     61|    for (int n = 0; n < stats->num_entries; n++) {
  ------------------
  |  Branch (162:21): [True: 0, False: 61]
  ------------------
  163|      0|        struct stat_entry *e = stats->entries[n];
  164|       |
  165|      0|        switch (e->type) {
  166|      0|        case VAL_STATIC:
  ------------------
  |  Branch (166:9): [True: 0, False: 0]
  ------------------
  167|      0|            add_stat(out, e, NULL, e->val_d, NULL);
  168|      0|            break;
  169|      0|        case VAL_STATIC_SIZE: {
  ------------------
  |  Branch (169:9): [True: 0, False: 0]
  ------------------
  170|      0|            char *s = format_file_size(e->val_d);
  171|      0|            add_stat(out, e, NULL, e->val_d, s);
  172|      0|            talloc_free(s);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  173|      0|            break;
  174|      0|        }
  175|      0|        case VAL_INC:
  ------------------
  |  Branch (175:9): [True: 0, False: 0]
  ------------------
  176|      0|            add_stat(out, e, NULL, e->val_d, NULL);
  177|      0|            e->val_d = 0;
  178|      0|            break;
  179|      0|        case VAL_TIME: {
  ------------------
  |  Branch (179:9): [True: 0, False: 0]
  ------------------
  180|      0|            if (e->time_start_ns) {  // ongoing. effectively do end+start
  ------------------
  |  Branch (180:17): [True: 0, False: 0]
  ------------------
  181|      0|                e->val_rt += now - e->time_start_ns;
  182|      0|                e->time_start_ns = now;
  183|      0|                int64_t t = mp_thread_cpu_time_ns(e->thread_id);
  184|      0|                e->val_th += t - e->cpu_start_ns;
  185|      0|                e->cpu_start_ns = t;
  186|      0|            }
  187|      0|            double t_cpu = MP_TIME_NS_TO_MS(e->val_th);
  ------------------
  |  |   77|      0|#define MP_TIME_NS_TO_MS(ns) ((ns) / (double)1000000)
  ------------------
  188|      0|            if (e->cpu_start_ns >= 0)
  ------------------
  |  Branch (188:17): [True: 0, False: 0]
  ------------------
  189|      0|                add_stat(out, e, "cpu", t_cpu, FMT_T(t_cpu, t_ms));
  ------------------
  |  |  135|      0|#define FMT_T(e, t) ((t) > 0 ? mp_tprintf(80, "%.3f ms (%.2f%%)", (e), ((e) / (t)) * 100) \
  |  |  ------------------
  |  |  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (135:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  136|      0|                             : mp_tprintf(80, "%.3f ms", (e)))
  |  |  ------------------
  |  |  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  ------------------
  190|      0|            double t_rt = MP_TIME_NS_TO_MS(e->val_rt);
  ------------------
  |  |   77|      0|#define MP_TIME_NS_TO_MS(ns) ((ns) / (double)1000000)
  ------------------
  191|      0|            add_stat(out, e, "time", t_rt, FMT_T(t_rt, t_ms));
  ------------------
  |  |  135|      0|#define FMT_T(e, t) ((t) > 0 ? mp_tprintf(80, "%.3f ms (%.2f%%)", (e), ((e) / (t)) * 100) \
  |  |  ------------------
  |  |  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (135:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  136|      0|                             : mp_tprintf(80, "%.3f ms", (e)))
  |  |  ------------------
  |  |  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  ------------------
  192|      0|            e->val_rt = e->val_th = 0;
  193|      0|            break;
  194|      0|        }
  195|      0|        case VAL_THREAD_CPU_TIME: {
  ------------------
  |  Branch (195:9): [True: 0, False: 0]
  ------------------
  196|      0|            int64_t t = mp_thread_cpu_time_ns(e->thread_id);
  197|      0|            if (!e->cpu_start_ns)
  ------------------
  |  Branch (197:17): [True: 0, False: 0]
  ------------------
  198|      0|                e->cpu_start_ns = t;
  199|      0|            double t_msec = MP_TIME_NS_TO_MS(t - e->cpu_start_ns);
  ------------------
  |  |   77|      0|#define MP_TIME_NS_TO_MS(ns) ((ns) / (double)1000000)
  ------------------
  200|      0|            if (e->cpu_start_ns >= 0)
  ------------------
  |  Branch (200:17): [True: 0, False: 0]
  ------------------
  201|      0|                add_stat(out, e, NULL, t_msec, FMT_T(t_msec, t_ms));
  ------------------
  |  |  135|      0|#define FMT_T(e, t) ((t) > 0 ? mp_tprintf(80, "%.3f ms (%.2f%%)", (e), ((e) / (t)) * 100) \
  |  |  ------------------
  |  |  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (135:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  136|      0|                             : mp_tprintf(80, "%.3f ms", (e)))
  |  |  ------------------
  |  |  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  ------------------
  202|      0|            e->cpu_start_ns = t;
  203|      0|            break;
  204|      0|        }
  205|      0|        default: ;
  ------------------
  |  Branch (205:9): [True: 0, False: 0]
  ------------------
  206|      0|        }
  207|      0|    }
  208|       |
  209|     61|    mp_mutex_unlock(&stats->lock);
  ------------------
  |  |  136|     61|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  210|     61|}
stats_ctx_create:
  224|  32.8k|{
  225|  32.8k|    struct stats_base *base = global->stats;
  226|  32.8k|    mp_assert(base);
  ------------------
  |  |   41|  32.8k|#define mp_assert assert
  ------------------
  |  Branch (226:5): [True: 32.8k, False: 0]
  ------------------
  227|       |
  228|  32.8k|    struct stats_ctx *ctx = talloc_zero(ta_parent, struct stats_ctx);
  ------------------
  |  |   27|  32.8k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  32.8k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  32.8k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  229|  32.8k|    ctx->base = base;
  230|  32.8k|    ctx->prefix = talloc_strdup(ctx, prefix);
  ------------------
  |  |   50|  32.8k|#define talloc_strdup                   ta_xstrdup
  ------------------
  231|  32.8k|    ta_set_destructor(ctx, stats_ctx_destroy);
  232|       |
  233|  32.8k|    mp_mutex_lock(&base->lock);
  ------------------
  |  |  134|  32.8k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  234|  32.8k|    LL_APPEND(list, &base->list, ctx);
  ------------------
  |  |   44|  32.8k|#define LL_APPEND(field, list, item)  do {                              \
  |  |   45|  32.8k|    (item)->field.prev = (list)->tail;                                  \
  |  |   46|  32.8k|    (item)->field.next = NULL;                                          \
  |  |   47|  32.8k|    LL_RELINK_(field, list, item)                                       \
  |  |  ------------------
  |  |  |  |   98|  32.8k|    if ((item)->field.prev) {                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:9): [True: 16.4k, False: 16.4k]
  |  |  |  |  ------------------
  |  |  |  |   99|  16.4k|        (item)->field.prev->field.next = (item);                        \
  |  |  |  |  100|  16.4k|    } else {                                                            \
  |  |  |  |  101|  16.4k|        (list)->head = (item);                                          \
  |  |  |  |  102|  16.4k|    }                                                                   \
  |  |  |  |  103|  32.8k|    if ((item)->field.next) {                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:9): [True: 0, False: 32.8k]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        (item)->field.next->field.prev = (item);                        \
  |  |  |  |  105|  32.8k|    } else {                                                            \
  |  |  |  |  106|  32.8k|        (list)->tail = (item);                                          \
  |  |  |  |  107|  32.8k|    }
  |  |  ------------------
  |  |   48|  32.8k|} while (0)
  |  |  ------------------
  |  |  |  Branch (48:10): [Folded, False: 32.8k]
  |  |  ------------------
  ------------------
  235|  32.8k|    base->num_entries = 0; // invalidate
  236|  32.8k|    mp_mutex_unlock(&base->lock);
  ------------------
  |  |  136|  32.8k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  237|       |
  238|  32.8k|    return ctx;
  239|  32.8k|}
stats_event:
  312|  33.9k|{
  313|  33.9k|    if (!IS_ACTIVE(ctx))
  ------------------
  |  |   68|  33.9k|    (atomic_load_explicit(&(ctx)->base->active, memory_order_relaxed))
  ------------------
  |  Branch (313:9): [True: 33.9k, False: 33]
  ------------------
  314|  33.9k|        return;
  315|     33|    mp_mutex_lock(&ctx->base->lock);
  ------------------
  |  |  134|     33|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  316|     33|    struct stat_entry *e = find_entry(ctx, name);
  317|     33|    e->val_d += 1;
  318|     33|    e->type = VAL_INC;
  319|     33|    mp_mutex_unlock(&ctx->base->lock);
  ------------------
  |  |  136|     33|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  320|     33|}
stats_register_thread_cputime:
  333|  11.3k|{
  334|  11.3k|    register_thread(ctx, name, VAL_THREAD_CPU_TIME);
  335|  11.3k|}
stats.c:stats_destroy:
   71|  16.4k|{
   72|  16.4k|    struct stats_base *stats = p;
   73|       |
   74|       |    // All entries must have been destroyed before this.
   75|  16.4k|    mp_assert(!stats->list.head);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (75:5): [True: 16.4k, False: 0]
  ------------------
   76|       |
   77|  16.4k|    mp_mutex_destroy(&stats->lock);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
   78|  16.4k|}
stats.c:stats_ctx_destroy:
  213|  32.8k|{
  214|  32.8k|    struct stats_ctx *ctx = p;
  215|       |
  216|  32.8k|    mp_mutex_lock(&ctx->base->lock);
  ------------------
  |  |  134|  32.8k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  217|  32.8k|    LL_REMOVE(list, &ctx->base->list, ctx);
  ------------------
  |  |   78|  32.8k|#define LL_REMOVE(field, list, item) do {                               \
  |  |   79|  32.8k|    if ((item)->field.prev) {                                           \
  |  |  ------------------
  |  |  |  Branch (79:9): [True: 16.4k, False: 16.4k]
  |  |  ------------------
  |  |   80|  16.4k|        (item)->field.prev->field.next = (item)->field.next;            \
  |  |   81|  16.4k|    } else {                                                            \
  |  |   82|  16.4k|        (list)->head = (item)->field.next;                              \
  |  |   83|  16.4k|    }                                                                   \
  |  |   84|  32.8k|    if ((item)->field.next) {                                           \
  |  |  ------------------
  |  |  |  Branch (84:9): [True: 0, False: 32.8k]
  |  |  ------------------
  |  |   85|      0|        (item)->field.next->field.prev = (item)->field.prev;            \
  |  |   86|  32.8k|    } else {                                                            \
  |  |   87|  32.8k|        (list)->tail = (item)->field.prev;                              \
  |  |   88|  32.8k|    }                                                                   \
  |  |   89|  32.8k|} while (0)
  |  |  ------------------
  |  |  |  Branch (89:10): [Folded, False: 32.8k]
  |  |  ------------------
  ------------------
  218|  32.8k|    ctx->base->num_entries = 0; // invalidate
  219|  32.8k|    mp_mutex_unlock(&ctx->base->lock);
  ------------------
  |  |  136|  32.8k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  220|  32.8k|}
stats.c:find_entry:
  242|  11.4k|{
  243|  11.4k|    for (int n = 0; n < ctx->num_entries; n++) {
  ------------------
  |  Branch (243:21): [True: 45, False: 11.4k]
  ------------------
  244|     45|        if (strcmp(ctx->entries[n]->name, name) == 0)
  ------------------
  |  Branch (244:13): [True: 12, False: 33]
  ------------------
  245|     12|            return ctx->entries[n];
  246|     45|    }
  247|       |
  248|  11.4k|    struct stat_entry *e = talloc_zero(ctx, struct stat_entry);
  ------------------
  |  |   27|  11.4k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  11.4k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  11.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  249|  11.4k|    snprintf(e->name, sizeof(e->name), "%s", name);
  250|  11.4k|    mp_assert(strcmp(e->name, name) == 0); // make e->name larger and don't complain
  ------------------
  |  |   41|  11.4k|#define mp_assert assert
  ------------------
  |  Branch (250:5): [True: 11.4k, False: 0]
  ------------------
  251|       |
  252|  11.4k|    e->full_name = talloc_asprintf(e, "%s/%s", ctx->prefix, e->name);
  ------------------
  |  |   52|  11.4k|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|  11.4k|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  253|       |
  254|  11.4k|    MP_TARRAY_APPEND(ctx, ctx->entries, ctx->num_entries, e);
  ------------------
  |  |  105|  11.4k|    do {                                            \
  |  |  106|  11.4k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  11.4k|    do {                                            \
  |  |  |  |   97|  11.4k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  11.4k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  11.4k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  11.4k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 11.3k, False: 21]
  |  |  |  |  ------------------
  |  |  |  |   99|  11.4k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  11.3k|    do {                                                        \
  |  |  |  |  |  |   89|  11.3k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  11.3k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  11.3k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  11.3k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  11.3k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  11.3k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  11.3k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 11.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  11.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 11.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  11.4k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  11.4k|        (idxvar)++;                                 \
  |  |  109|  11.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 11.4k]
  |  |  ------------------
  ------------------
  255|  11.4k|    ctx->base->num_entries = 0; // invalidate
  256|       |
  257|  11.4k|    return e;
  258|  11.4k|}
stats.c:register_thread:
  324|  11.3k|{
  325|  11.3k|    mp_mutex_lock(&ctx->base->lock);
  ------------------
  |  |  134|  11.3k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  326|  11.3k|    struct stat_entry *e = find_entry(ctx, name);
  327|  11.3k|    e->type = type;
  328|  11.3k|    e->thread_id = mp_thread_current_id();
  ------------------
  |  |  217|  11.3k|#define mp_thread_current_id      pthread_self
  ------------------
  329|  11.3k|    mp_mutex_unlock(&ctx->base->lock);
  ------------------
  |  |  136|  11.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  330|  11.3k|}

stream_type_name:
 1314|     36|{
 1315|     36|    switch (type) {
 1316|     36|    case STREAM_VIDEO:  return "video";
  ------------------
  |  Branch (1316:5): [True: 36, False: 0]
  ------------------
 1317|      0|    case STREAM_AUDIO:  return "audio";
  ------------------
  |  Branch (1317:5): [True: 0, False: 36]
  ------------------
 1318|      0|    case STREAM_SUB:    return "sub";
  ------------------
  |  Branch (1318:5): [True: 0, False: 36]
  ------------------
 1319|      0|    default:            return "unknown";
  ------------------
  |  Branch (1319:5): [True: 0, False: 36]
  ------------------
 1320|     36|    }
 1321|     36|}
demuxer_help:
 3039|      1|{
 3040|      1|    int i;
 3041|       |
 3042|      1|    mp_info(log, "Available demuxers:\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 3043|      1|    mp_info(log, " demuxer:   info:\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 3044|     13|    for (i = 0; demuxer_list[i]; i++) {
  ------------------
  |  Branch (3044:17): [True: 12, False: 1]
  ------------------
 3045|     12|        mp_info(log, "%10s  %s\n",
  ------------------
  |  |   78|     12|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 3046|     12|                demuxer_list[i]->name, demuxer_list[i]->desc);
 3047|     12|    }
 3048|      1|    mp_info(log, "\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 3049|       |
 3050|      1|    return M_OPT_EXIT;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
 3051|      1|}
demux.c:get_demux_sub_opts:
 5061|   213k|{
 5062|   213k|    if (!demuxer_list[index])
  ------------------
  |  Branch (5062:9): [True: 16.4k, False: 196k]
  ------------------
 5063|  16.4k|        return false;
 5064|   196k|    *sub = demuxer_list[index]->options;
 5065|       |    return true;
 5066|   213k|}

demux_packet_pool_init:
   50|  16.4k|{
   51|  16.4k|    struct demux_packet_pool *pool = talloc(global, struct demux_packet_pool);
  ------------------
  |  |   26|  16.4k|#define talloc                          ta_xnew
  |  |  ------------------
  |  |  |  |  133|  16.4k|#define ta_xnew(...)                    ta_oom_g(ta_new(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   52|  16.4k|    talloc_set_destructor(pool, uninit);
  ------------------
  |  |   41|  16.4k|#define talloc_set_destructor           ta_set_destructor
  ------------------
   53|  16.4k|    mp_mutex_init(&pool->lock);
   54|  16.4k|    pool->packets = NULL;
   55|       |
   56|  16.4k|    mp_assert(!global->packet_pool);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (56:5): [True: 16.4k, False: 0]
  ------------------
   57|  16.4k|    global->packet_pool = pool;
   58|  16.4k|}
demux_packet_pool_clear:
   68|  16.4k|{
   69|  16.4k|    mp_mutex_lock(&pool->lock);
  ------------------
  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
   70|  16.4k|    struct demux_packet *dp = pool->packets;
   71|  16.4k|    pool->packets = NULL;
   72|  16.4k|    mp_mutex_unlock(&pool->lock);
  ------------------
  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
   73|  16.4k|    free_demux_packets(dp);
   74|  16.4k|}
packet_pool.c:uninit:
   34|  16.4k|{
   35|  16.4k|    struct demux_packet_pool *pool = p;
   36|  16.4k|    demux_packet_pool_clear(pool);
   37|  16.4k|    mp_mutex_destroy(&pool->lock);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
   38|  16.4k|}
packet_pool.c:free_demux_packets:
   41|  16.4k|{
   42|  16.4k|    while (dp) {
  ------------------
  |  Branch (42:12): [True: 0, False: 16.4k]
  ------------------
   43|      0|        struct demux_packet *next = dp->next;
   44|      0|        free_demux_packet(dp);
   45|      0|        dp = next;
   46|      0|    }
   47|  16.4k|}

video_decoder_list:
  411|    755|{
  412|    755|    struct mp_decoder_list *list = talloc_zero(NULL, struct mp_decoder_list);
  ------------------
  |  |   27|    755|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|    755|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|    755|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  413|    755|    vd_lavc.add_decoders(list);
  414|    755|    return list;
  415|    755|}
audio_decoder_list:
  418|    779|{
  419|    779|    struct mp_decoder_list *list = talloc_zero(NULL, struct mp_decoder_list);
  ------------------
  |  |   27|    779|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|    779|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|    779|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  420|    779|    ad_lavc.add_decoders(list);
  421|    779|    return list;
  422|    779|}
f_decoder_wrapper.c:decoder_list_help:
  252|     27|{
  253|     27|    if (strcmp(opt->name, "ad") == 0) {
  ------------------
  |  Branch (253:9): [True: 25, False: 2]
  ------------------
  254|     25|        struct mp_decoder_list *list = audio_decoder_list();
  255|     25|        mp_print_decoders(log, MSGL_INFO, "Audio decoders:", list);
  256|     25|        talloc_free(list);
  ------------------
  |  |   47|     25|#define talloc_free                     ta_free
  ------------------
  257|     25|        return M_OPT_EXIT;
  ------------------
  |  |  545|     25|#define M_OPT_EXIT              -6
  ------------------
  258|     25|    }
  259|      2|    if (strcmp(opt->name, "vd") == 0) {
  ------------------
  |  Branch (259:9): [True: 1, False: 1]
  ------------------
  260|      1|        struct mp_decoder_list *list = video_decoder_list();
  261|      1|        mp_print_decoders(log, MSGL_INFO, "Video decoders:", list);
  262|      1|        talloc_free(list);
  ------------------
  |  |   47|      1|#define talloc_free                     ta_free
  ------------------
  263|      1|        return M_OPT_EXIT;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
  264|      1|    }
  265|      1|    if (strcmp(opt->name, "audio-spdif") == 0) {
  ------------------
  |  Branch (265:9): [True: 1, False: 0]
  ------------------
  266|      1|        mp_info(log, "Choices: ac3,dts-hd,dts,dsd (and possibly more)\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  267|      1|        return M_OPT_EXIT;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
  268|      1|    }
  269|      0|    return 1;
  270|      1|}

mp_lavfi_is_usable:
 1011|    204|{
 1012|    204|    const AVFilter *f = avfilter_get_by_name(name);
 1013|    204|    return f && is_usable(f, media_type);
  ------------------
  |  Branch (1013:12): [True: 7, False: 197]
  |  Branch (1013:17): [True: 0, False: 7]
  ------------------
 1014|    204|}
print_lavfi_help_list:
 1101|      2|{
 1102|      2|    dump_list(log, media_type);
 1103|      2|    mp_info(log, "\nIf libavfilter filters clash with builtin mpv filters,\n"
  ------------------
  |  |   78|      2|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 1104|      2|            "prefix them with lavfi- to select the libavfilter one.\n\n");
 1105|      2|}
f_lavfi.c:is_usable:
  996|     31|{
  997|     31|    int nb_inputs  = avfilter_filter_pad_count(filter, 0),
  998|     31|        nb_outputs = avfilter_filter_pad_count(filter, 1);
  999|     31|    if (nb_inputs > 1 || nb_outputs > 1)
  ------------------
  |  Branch (999:9): [True: 0, False: 31]
  |  Branch (999:26): [True: 0, False: 31]
  ------------------
 1000|      0|        return false;
 1001|     31|    bool input_ok = filter->flags & AVFILTER_FLAG_DYNAMIC_INPUTS;
 1002|     31|    bool output_ok = filter->flags & AVFILTER_FLAG_DYNAMIC_OUTPUTS;
 1003|     31|    if (nb_inputs == 1)
  ------------------
  |  Branch (1003:9): [True: 11, False: 20]
  ------------------
 1004|     11|        input_ok = avfilter_pad_get_type(filter->inputs, 0) == media_type;
 1005|     31|    if (nb_outputs == 1)
  ------------------
  |  Branch (1005:9): [True: 20, False: 11]
  ------------------
 1006|     20|        output_ok = avfilter_pad_get_type(filter->outputs, 0) == media_type;
 1007|     31|    return input_ok && output_ok;
  ------------------
  |  Branch (1007:12): [True: 5, False: 26]
  |  Branch (1007:24): [True: 0, False: 5]
  ------------------
 1008|     31|}
f_lavfi.c:dump_list:
 1017|      4|{
 1018|      4|    mp_info(log, "Available libavfilter filters:\n");
  ------------------
  |  |   78|      4|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 1019|      4|    void *iter = NULL;
 1020|     28|    for (;;) {
 1021|     28|        const AVFilter *filter = av_filter_iterate(&iter);
 1022|     28|        if (!filter)
  ------------------
  |  Branch (1022:13): [True: 4, False: 24]
  ------------------
 1023|      4|            break;
 1024|     24|        if (is_usable(filter, media_type))
  ------------------
  |  Branch (1024:13): [True: 0, False: 24]
  ------------------
 1025|      0|            mp_info(log, "  %-16s %s\n", filter->name, filter->description);
  ------------------
  |  |   78|      0|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 1026|     24|    }
 1027|      4|}
f_lavfi.c:print_help_a:
 1130|      1|{
 1131|      1|    print_help(log, AVMEDIA_TYPE_AUDIO, "audio", "--af=lavfi=[volume=0.5]");
 1132|      1|}
f_lavfi.c:print_help:
 1108|      2|{
 1109|      2|    dump_list(log, mediatype);
 1110|      2|    mp_info(log, "\n"
  ------------------
  |  |   78|      2|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 1111|      2|        "This lists %s->%s filters only. Refer to\n"
 1112|      2|        "\n"
 1113|      2|        " https://ffmpeg.org/ffmpeg-filters.html\n"
 1114|      2|        "\n"
 1115|      2|        "to see how to use each filter and what arguments each filter takes.\n"
 1116|      2|        "Also, be sure to quote the FFmpeg filter string properly, e.g.:\n"
 1117|      2|        "\n"
 1118|      2|        " \"%s\"\n"
 1119|      2|        "\n"
 1120|      2|        "Otherwise, mpv and libavfilter syntax will conflict.\n"
 1121|      2|        "\n", name, name, ex);
 1122|      2|}
f_lavfi.c:print_help_v:
 1125|      1|{
 1126|      1|    print_help(log, AVMEDIA_TYPE_VIDEO, "video", "--vf=lavfi=[gradfun=20:30]");
 1127|      1|}

user_filters.c:get_af_desc:
   48|   158k|{
   49|   158k|    return get_desc_from(af_list, MP_ARRAY_SIZE(af_list), dst, index);
  ------------------
  |  |   49|   158k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
   50|   158k|}
user_filters.c:get_desc_from:
   14|   249k|{
   15|   249k|    if (index >= num)
  ------------------
  |  Branch (15:9): [True: 33.0k, False: 216k]
  ------------------
   16|  33.0k|        return false;
   17|   216k|    const struct mp_user_filter_entry *entry = list[index];
   18|   216k|    *dst = entry->desc;
   19|   216k|    dst->p = entry;
   20|       |    return true;
   21|   249k|}
user_filters.c:check_af_lavfi:
   63|     92|{
   64|     92|    return check_unknown_entry(name, AVMEDIA_TYPE_AUDIO);
   65|     92|}
user_filters.c:check_unknown_entry:
   24|    204|{
   25|       |    // Generic lavfi bridge: skip the lavfi- prefix, if present.
   26|    204|    if (strncmp(name, "lavfi-", 6) == 0)
  ------------------
  |  Branch (26:9): [True: 3, False: 201]
  ------------------
   27|      3|        name += 6;
   28|    204|    return mp_lavfi_is_usable(name, media_type);
   29|    204|}
user_filters.c:print_af_help_list:
   53|      1|{
   54|      1|    print_lavfi_help_list(log, AVMEDIA_TYPE_AUDIO);
   55|      1|}
user_filters.c:get_vf_desc:
  113|  90.3k|{
  114|  90.3k|    return get_desc_from(vf_list, MP_ARRAY_SIZE(vf_list), dst, index);
  ------------------
  |  |   49|  90.3k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  115|  90.3k|}
user_filters.c:check_vf_lavfi:
  128|    112|{
  129|    112|    return check_unknown_entry(name, AVMEDIA_TYPE_VIDEO);
  130|    112|}
user_filters.c:print_vf_help_list:
  118|      1|{
  119|      1|    print_lavfi_help_list(log, AVMEDIA_TYPE_VIDEO);
  120|      1|}

fuzzer_options_parser.c:set_fontconfig_sysroot:
   54|  16.4k|{
   55|  16.4k|#ifdef MPV_FONTCONFIG_SYSROOT
   56|  16.4k|    const char *sysroot = MPV_STRINGIFY(MPV_FONTCONFIG_SYSROOT);
  ------------------
  |  |   35|  16.4k|#define MPV_STRINGIFY(X) MPV_STRINGIFY_(X)
  |  |  ------------------
  |  |  |  |   34|  16.4k|#define MPV_STRINGIFY_(X) #X
  |  |  ------------------
  ------------------
   57|  16.4k|    char path[PATH_MAX];
   58|  16.4k|    if (sysroot[0] != '/') {
  ------------------
  |  Branch (58:9): [True: 16.4k, False: 0]
  ------------------
   59|  16.4k|        ssize_t len = readlink("/proc/self/exe", path, sizeof(path) - 1);
   60|  16.4k|        if (len < 0)
  ------------------
  |  Branch (60:13): [True: 0, False: 16.4k]
  ------------------
   61|      0|            exit(1);
   62|  16.4k|        path[len] = '\0';
   63|  16.4k|        char *name = strrchr(path, '/') + 1;
   64|  16.4k|        snprintf(name, path + sizeof(path) - name, "%s", sysroot);
   65|  16.4k|        sysroot = path;
   66|  16.4k|    }
   67|  16.4k|    setenv("FONTCONFIG_SYSROOT", sysroot, 1);
   68|  16.4k|#endif
   69|  16.4k|}
fuzzer_options_parser.c:check_error:
   38|  16.4k|{
   39|  16.4k|    if (status < 0) {
  ------------------
  |  Branch (39:9): [True: 0, False: 16.4k]
  ------------------
   40|       |        fprintf(stderr, "mpv API error: %s\n", mpv_error_string(status));
   41|      0|        exit(1);
   42|      0|    }
   43|  16.4k|}
fuzzer_options_parser.c:wait_event:
   72|  16.4k|{
   73|  16.4k|    while (1) {
  ------------------
  |  Branch (73:12): [True: 16.4k, Folded]
  ------------------
   74|  16.4k|        mpv_event *event = mpv_wait_event(ctx, -1);
   75|  16.4k|        if (event->event_id == id)
  ------------------
  |  Branch (75:13): [True: 16.4k, False: 0]
  ------------------
   76|  16.4k|            return true;
   77|      0|        if (event->event_id == MPV_EVENT_SHUTDOWN)
  ------------------
  |  Branch (77:13): [True: 0, False: 0]
  ------------------
   78|      0|            return false;
   79|      0|    }
   80|  16.4k|}

LLVMFuzzerTestOneInput:
   30|  16.4k|{
   31|  16.4k|    char buff[MAX_INPUT_SIZE + 2];
   32|       |
   33|  16.4k|    if (!size || size > MAX_INPUT_SIZE)
  ------------------
  |  |   26|  16.4k|#define MAX_INPUT_SIZE 2048
  ------------------
  |  Branch (33:9): [True: 0, False: 16.4k]
  |  Branch (33:18): [True: 14, False: 16.4k]
  ------------------
   34|     14|        return 0;
   35|       |
   36|  16.4k|    memcpy(buff, data, size);
   37|  16.4k|    buff[size] = '\0';
   38|  16.4k|    buff[size + 1] = '\0';
   39|       |
   40|  16.4k|    char *opts[MAX_OPTS_NUM + 1];
   41|  16.4k|    char *opt = buff;
   42|  16.4k|    int count = 0;
   43|   207k|    while (*opt && count < MAX_OPTS_NUM) {
  ------------------
  |  |   27|   191k|#define MAX_OPTS_NUM 10000
  ------------------
  |  Branch (43:12): [True: 191k, False: 16.4k]
  |  Branch (43:20): [True: 191k, False: 0]
  ------------------
   44|   191k|        opts[count] = opt;
   45|       |
   46|  2.07M|        while (*opt && !isspace(*opt))
  ------------------
  |  Branch (46:16): [True: 2.01M, False: 58.6k]
  |  Branch (46:24): [True: 1.88M, False: 132k]
  ------------------
   47|  1.88M|            opt++;
   48|       |
   49|   191k|        *opt = '\0';
   50|   191k|        opt++;
   51|       |
   52|   195k|        while (*opt && isspace(*opt))
  ------------------
  |  Branch (52:16): [True: 179k, False: 16.4k]
  |  Branch (52:24): [True: 4.40k, False: 175k]
  ------------------
   53|  4.40k|            opt++;
   54|       |
   55|   191k|        count++;
   56|   191k|    }
   57|  16.4k|    opts[count] = NULL;
   58|       |
   59|  16.4k|    set_fontconfig_sysroot();
   60|       |
   61|  16.4k|    mpv_handle *ctx = mpv_create();
   62|  16.4k|    if (!ctx)
  ------------------
  |  Branch (62:9): [True: 0, False: 16.4k]
  ------------------
   63|      0|        exit(1);
   64|       |
   65|  16.4k|    check_error(mpv_set_option_string(ctx, "input-builtin-bindings", "no"));
   66|       |
   67|  16.4k|    mpv_initialize_opts(ctx, opts);
   68|       |
   69|       |    // The player quits on its own after the options, see mpv_initialize_opts().
   70|  16.4k|    wait_event(ctx, MPV_EVENT_SHUTDOWN);
   71|  16.4k|    mpv_terminate_destroy(ctx);
   72|       |
   73|  16.4k|    return 0;
   74|  16.4k|}

mp_input_parse_cmd_node:
  293|  16.4k|{
  294|  16.4k|    struct mp_cmd *cmd = talloc_ptrtype(NULL, cmd);
  ------------------
  |  |   34|  16.4k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  16.4k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  295|  16.4k|    talloc_set_destructor(cmd, destroy_cmd);
  ------------------
  |  |   41|  16.4k|#define talloc_set_destructor           ta_set_destructor
  ------------------
  296|  16.4k|    *cmd = (struct mp_cmd) { .scale = 1, .scale_units = 1 };
  297|       |
  298|  16.4k|    bool res = false;
  299|  16.4k|    if (node->format == MPV_FORMAT_NODE_ARRAY) {
  ------------------
  |  Branch (299:9): [True: 16.4k, False: 0]
  ------------------
  300|  16.4k|        res = cmd_node_array(log, cmd, node);
  301|  16.4k|    } else if (node->format == MPV_FORMAT_NODE_MAP) {
  ------------------
  |  Branch (301:16): [True: 0, False: 0]
  ------------------
  302|      0|        res = cmd_node_map(log, cmd, node);
  303|      0|    }
  304|       |
  305|  16.4k|    res = res && finish_cmd(log, cmd);
  ------------------
  |  Branch (305:11): [True: 16.4k, False: 0]
  |  Branch (305:18): [True: 16.4k, False: 0]
  ------------------
  306|       |
  307|  16.4k|    if (!res)
  ------------------
  |  Branch (307:9): [True: 0, False: 16.4k]
  ------------------
  308|      0|        TA_FREEP(&cmd);
  ------------------
  |  |   81|      0|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|      0|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 0]
  |  |  ------------------
  ------------------
  309|       |
  310|  16.4k|    return cmd;
  311|  16.4k|}
mp_input_parse_cmd_str:
  455|  20.4k|{
  456|  20.4k|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  20.4k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  20.4k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  457|  20.4k|    bstr original = str;
  458|  20.4k|    struct mp_cmd *cmd = parse_cmd_str(log, tmp, &str, loc);
  459|  20.4k|    if (!cmd)
  ------------------
  |  Branch (459:9): [True: 6.70k, False: 13.7k]
  ------------------
  460|  6.70k|        goto done;
  461|       |
  462|       |    // Handle "multi" commands
  463|  13.7k|    struct mp_cmd **p_prev = NULL;
  464|  15.1k|    while (1) {
  ------------------
  |  Branch (464:12): [True: 15.1k, Folded]
  ------------------
  465|  15.1k|        str = bstr_lstrip(str);
  466|       |        // read_token just to check whether it's trailing whitespace only
  467|  15.1k|        bstr u1, u2;
  468|  15.1k|        if (!bstr_eatstart0(&str, ";") || !read_token(str, &u1, &u2))
  ------------------
  |  Branch (468:13): [True: 13.5k, False: 1.57k]
  |  Branch (468:43): [True: 77, False: 1.49k]
  ------------------
  469|  13.6k|            break;
  470|       |        // Multi-command. Since other input.c code uses queue_next for its
  471|       |        // own purposes, a pseudo-command is used to wrap the command list.
  472|  1.49k|        if (!p_prev) {
  ------------------
  |  Branch (472:13): [True: 1.01k, False: 482]
  ------------------
  473|  1.01k|            struct mp_cmd *list = talloc_ptrtype(NULL, list);
  ------------------
  |  |   34|  1.01k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  1.01k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  1.01k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  474|  1.01k|            talloc_set_destructor(list, destroy_cmd);
  ------------------
  |  |   41|  1.01k|#define talloc_set_destructor           ta_set_destructor
  ------------------
  475|  1.01k|            *list = (struct mp_cmd) {
  476|  1.01k|                .name = (char *)mp_cmd_list.name,
  477|  1.01k|                .def = &mp_cmd_list,
  478|  1.01k|            };
  479|  1.01k|            talloc_steal(list, cmd);
  ------------------
  |  |   38|  1.01k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  1.01k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
  480|  1.01k|            struct mp_cmd_arg arg = {0};
  481|  1.01k|            arg.v.p = cmd;
  482|  1.01k|            list->args = talloc_dup(list, &arg);
  ------------------
  |  |   48|  1.01k|#define talloc_dup                      ta_xdup
  |  |  ------------------
  |  |  |  |  141|  1.01k|#define ta_xdup(...)                    ta_oom_g(ta_dup(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  1.01k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  483|  1.01k|            p_prev = &cmd->queue_next;
  484|  1.01k|            cmd = list;
  485|  1.01k|        }
  486|  1.49k|        struct mp_cmd *sub = parse_cmd_str(log, tmp, &str, loc);
  487|  1.49k|        if (!sub) {
  ------------------
  |  Branch (487:13): [True: 92, False: 1.40k]
  ------------------
  488|     92|            talloc_free(cmd);
  ------------------
  |  |   47|     92|#define talloc_free                     ta_free
  ------------------
  489|     92|            cmd = NULL;
  490|     92|            goto done;
  491|     92|        }
  492|  1.40k|        talloc_steal(cmd, sub);
  ------------------
  |  |   38|  1.40k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  1.40k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
  493|  1.40k|        *p_prev = sub;
  494|  1.40k|        p_prev = &sub->queue_next;
  495|  1.40k|    }
  496|       |
  497|  13.6k|    cmd->original = bstrto0(cmd, bstr_strip(
  498|  13.6k|                        bstr_splice(original, 0, str.start - original.start)));
  499|       |
  500|  13.6k|    str = bstr_strip(str);
  501|  13.6k|    if (bstr_eatstart0(&str, "#") && !bstr_startswith0(str, "#")) {
  ------------------
  |  Branch (501:9): [True: 9.77k, False: 3.86k]
  |  Branch (501:38): [True: 9.70k, False: 65]
  ------------------
  502|  9.70k|        str = bstr_strip(str);
  503|  9.70k|        if (str.len)
  ------------------
  |  Branch (503:13): [True: 9.64k, False: 66]
  ------------------
  504|  9.64k|            cmd->desc = bstrto0(cmd, str);
  505|  9.70k|    }
  506|       |
  507|  20.4k|done:
  508|  20.4k|    talloc_free(tmp);
  ------------------
  |  |   47|  20.4k|#define talloc_free                     ta_free
  ------------------
  509|  20.4k|    return cmd;
  510|  13.6k|}
mp_input_parse_cmd_strv:
  513|  16.4k|{
  514|  16.4k|    int count = 0;
  515|  32.8k|    while (argv[count])
  ------------------
  |  Branch (515:12): [True: 16.4k, False: 16.4k]
  ------------------
  516|  16.4k|        count++;
  517|  16.4k|    mpv_node *items = talloc_zero_array(NULL, mpv_node, count);
  ------------------
  |  |   30|  16.4k|#define talloc_zero_array               ta_xznew_array
  |  |  ------------------
  |  |  |  |  136|  16.4k|#define ta_xznew_array(...)             ta_oom_g(ta_znew_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  518|  16.4k|    mpv_node_list list = {.values = items, .num = count};
  519|  16.4k|    mpv_node node = {.format = MPV_FORMAT_NODE_ARRAY, .u = {.list = &list}};
  520|  32.8k|    for (int n = 0; n < count; n++) {
  ------------------
  |  Branch (520:21): [True: 16.4k, False: 16.4k]
  ------------------
  521|  16.4k|        items[n] = (mpv_node){.format = MPV_FORMAT_STRING,
  522|  16.4k|                              .u = {.string = (char *)argv[n]}};
  523|  16.4k|    }
  524|  16.4k|    struct mp_cmd *res = mp_input_parse_cmd_node(log, &node);
  525|  16.4k|    talloc_free(items);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  526|  16.4k|    return res;
  527|  16.4k|}
mp_cmd_dump:
  582|  11.3k|{
  583|  11.3k|    if (!mp_msg_test(log, msgl))
  ------------------
  |  Branch (583:9): [True: 11.2k, False: 155]
  ------------------
  584|  11.2k|        return;
  585|    155|    if (header)
  ------------------
  |  Branch (585:9): [True: 155, False: 0]
  ------------------
  586|    155|        mp_msg(log, msgl, "%s ", header);
  587|    155|    if (!cmd) {
  ------------------
  |  Branch (587:9): [True: 0, False: 155]
  ------------------
  588|      0|        mp_msg(log, msgl, "(NULL)\n");
  589|      0|        return;
  590|      0|    }
  591|    155|    mp_msg(log, msgl, "%s, flags=%d, args=[", cmd->name, cmd->flags);
  592|    155|    int argc = get_arg_count(cmd->def);
  593|    310|    for (int n = 0; n < cmd->nargs; n++) {
  ------------------
  |  Branch (593:21): [True: 155, False: 155]
  ------------------
  594|    155|        const char *argname = cmd->def->args[MPMIN(n, argc - 1)].name;
  ------------------
  |  |   45|    155|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 155]
  |  |  ------------------
  ------------------
  595|    155|        char *s = m_option_print(cmd->args[n].type, &cmd->args[n].v);
  596|    155|        if (n)
  ------------------
  |  Branch (596:13): [True: 0, False: 155]
  ------------------
  597|      0|            mp_msg(log, msgl, ", ");
  598|    155|        struct mpv_node node = {
  599|    155|            .format = MPV_FORMAT_STRING,
  600|    155|            .u.string = s ? s : "(NULL)",
  ------------------
  |  Branch (600:25): [True: 155, False: 0]
  ------------------
  601|    155|        };
  602|    155|        char *esc = NULL;
  603|    155|        json_write(&esc, &node);
  604|    155|        mp_msg(log, msgl, "%s=%s", argname, esc ? esc : "<error>");
  ------------------
  |  Branch (604:45): [True: 155, False: 0]
  ------------------
  605|    155|        talloc_free(esc);
  ------------------
  |  |   47|    155|#define talloc_free                     ta_free
  ------------------
  606|    155|        talloc_free(s);
  ------------------
  |  |   47|    155|#define talloc_free                     ta_free
  ------------------
  607|    155|    }
  608|    155|    mp_msg(log, msgl, "]\n");
  609|    155|}
mp_print_cmd_list:
  626|    478|{
  627|  42.0k|    for (int i = 0; mp_cmds[i].name; i++) {
  ------------------
  |  Branch (627:21): [True: 41.5k, False: 478]
  ------------------
  628|  41.5k|        const struct mp_cmd_def *def = &mp_cmds[i];
  629|  41.5k|        mp_info(out, "%-25s", def->name);
  ------------------
  |  |   78|  41.5k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  630|   119k|        for (int j = 0; j < MP_CMD_DEF_MAX_ARGS && def->args[j].type; j++) {
  ------------------
  |  |   26|   238k|#define MP_CMD_DEF_MAX_ARGS 15
  ------------------
  |  Branch (630:25): [True: 118k, False: 478]
  |  Branch (630:52): [True: 77.4k, False: 41.1k]
  ------------------
  631|  77.4k|            const struct m_option *arg = &def->args[j];
  632|  77.4k|            bool is_opt = arg->defval || (arg->flags & MP_CMD_OPT_ARG);
  ------------------
  |  |   27|  58.3k|#define MP_CMD_OPT_ARG M_OPT_OPTIONAL_PARAM
  |  |  ------------------
  |  |  |  |  497|  58.3k|#define M_OPT_OPTIONAL_PARAM    (UINT64_C(1) << 54)
  |  |  ------------------
  ------------------
  |  Branch (632:27): [True: 19.1k, False: 58.3k]
  |  Branch (632:42): [True: 18.1k, False: 40.1k]
  ------------------
  633|  77.4k|            mp_info(out, " %s%s=%s%s", is_opt ? "[" : "", arg->name,
  ------------------
  |  |   78|   309k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (78:56): [True: 37.2k, False: 40.1k]
  |  |  |  Branch (78:56): [True: 37.2k, False: 40.1k]
  |  |  ------------------
  ------------------
  634|  77.4k|                    arg->type->name, is_opt ? "]" : "");
  635|  77.4k|        }
  636|  41.5k|        if (def->vararg)
  ------------------
  |  Branch (636:13): [True: 1.91k, False: 39.6k]
  ------------------
  637|  1.91k|            mp_info(out, "..."); // essentially append to last argument
  ------------------
  |  |   78|  1.91k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  638|  41.5k|        mp_info(out, "\n");
  ------------------
  |  |   78|  41.5k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  639|  41.5k|    }
  640|    478|}
cmd.c:destroy_cmd:
   33|  39.3k|{
   34|  39.3k|    struct mp_cmd *cmd = ptr;
   35|  86.9k|    for (int n = 0; n < cmd->nargs; n++) {
  ------------------
  |  Branch (35:21): [True: 47.6k, False: 39.3k]
  ------------------
   36|  47.6k|        if (cmd->args[n].type)
  ------------------
  |  Branch (36:13): [True: 47.6k, False: 0]
  ------------------
   37|  47.6k|            m_option_free(cmd->args[n].type, &cmd->args[n].v);
   38|  47.6k|    }
   39|  39.3k|}
cmd.c:cmd_node_array:
  200|  16.4k|{
  201|  16.4k|    mp_assert(node->format == MPV_FORMAT_NODE_ARRAY);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (201:5): [True: 16.4k, False: 0]
  ------------------
  202|  16.4k|    mpv_node_list *args = node->u.list;
  203|  16.4k|    int cur = 0;
  204|       |
  205|  16.4k|    while (cur < args->num) {
  ------------------
  |  Branch (205:12): [True: 16.4k, False: 0]
  ------------------
  206|  16.4k|        if (args->values[cur].format != MPV_FORMAT_STRING)
  ------------------
  |  Branch (206:13): [True: 0, False: 16.4k]
  ------------------
  207|      0|            break;
  208|  16.4k|        if (!apply_flag(cmd, bstr0(args->values[cur].u.string)))
  ------------------
  |  Branch (208:13): [True: 16.4k, False: 0]
  ------------------
  209|  16.4k|            break;
  210|      0|        cur++;
  211|      0|    }
  212|       |
  213|  16.4k|    bstr cmd_name = {0};
  214|  16.4k|    if (cur < args->num && args->values[cur].format == MPV_FORMAT_STRING)
  ------------------
  |  Branch (214:9): [True: 16.4k, False: 0]
  |  Branch (214:28): [True: 16.4k, False: 0]
  ------------------
  215|  16.4k|        cmd_name = bstr0(args->values[cur++].u.string);
  216|  16.4k|    if (!find_cmd(log, cmd, cmd_name))
  ------------------
  |  Branch (216:9): [True: 0, False: 16.4k]
  ------------------
  217|      0|        return false;
  218|       |
  219|  16.4k|    int first = cur;
  220|  16.4k|    for (int i = 0; i < args->num - first; i++) {
  ------------------
  |  Branch (220:21): [True: 0, False: 16.4k]
  ------------------
  221|      0|        if (!set_node_arg(log, cmd, cmd->nargs, &args->values[cur++]))
  ------------------
  |  Branch (221:13): [True: 0, False: 0]
  ------------------
  222|      0|            return false;
  223|      0|    }
  224|       |
  225|  16.4k|    return true;
  226|  16.4k|}
cmd.c:apply_flag:
   63|  38.7k|{
   64|   492k|    for (int n = 0; cmd_flags[n].name; n++) {
  ------------------
  |  Branch (64:21): [True: 454k, False: 37.7k]
  ------------------
   65|   454k|        if (bstr_equals0(str, cmd_flags[n].name)) {
  ------------------
  |  Branch (65:13): [True: 1.02k, False: 453k]
  ------------------
   66|  1.02k|            cmd->flags = (cmd->flags & ~cmd_flags[n].remove) | cmd_flags[n].add;
   67|  1.02k|            return true;
   68|  1.02k|        }
   69|   454k|    }
   70|  37.7k|    return false;
   71|  38.7k|}
cmd.c:find_cmd:
   74|  37.7k|{
   75|  37.7k|    if (name.len == 0) {
  ------------------
  |  Branch (75:9): [True: 3.44k, False: 34.2k]
  ------------------
   76|  3.44k|        mp_err(log, "Command name missing.\n");
  ------------------
  |  |   76|  3.44k|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
   77|  3.44k|        return false;
   78|  3.44k|    }
   79|       |
   80|  34.2k|    char nname[80];
   81|  34.2k|    snprintf(nname, sizeof(nname), "%.*s", BSTR_P(name));
  ------------------
  |  |  307|  34.2k|#define BSTR_P(bstr) (int)((bstr).len), ((bstr).start ? (char*)(bstr).start : "")
  |  |  ------------------
  |  |  |  Branch (307:42): [True: 34.2k, False: 0]
  |  |  ------------------
  ------------------
   82|   199k|    for (int n = 0; nname[n]; n++) {
  ------------------
  |  Branch (82:21): [True: 165k, False: 34.2k]
  ------------------
   83|   165k|        if (nname[n] == '_')
  ------------------
  |  Branch (83:13): [True: 70, False: 165k]
  ------------------
   84|     70|            nname[n] = '-';
   85|   165k|    }
   86|       |
   87|   950k|    for (int n = 0; mp_cmds[n].name; n++) {
  ------------------
  |  Branch (87:21): [True: 948k, False: 2.39k]
  ------------------
   88|   948k|        if (strcmp(nname, mp_cmds[n].name) == 0) {
  ------------------
  |  Branch (88:13): [True: 31.9k, False: 916k]
  ------------------
   89|  31.9k|            cmd->def = &mp_cmds[n];
   90|  31.9k|            cmd->name = (char *)cmd->def->name;
   91|  31.9k|            return true;
   92|  31.9k|        }
   93|   948k|    }
   94|  2.39k|    mp_err(log, "Command '%.*s' not found.\n", BSTR_P(name));
  ------------------
  |  |   76|  4.78k|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 2.39k, False: 0]
  |  |  ------------------
  ------------------
   95|       |    return false;
   96|  34.2k|}
cmd.c:get_arg_type:
  104|  95.0k|{
  105|  95.0k|    const struct m_option *opt = NULL;
  106|  95.0k|    if (is_vararg(cmd, i)) {
  ------------------
  |  Branch (106:9): [True: 1.08k, False: 93.9k]
  ------------------
  107|       |        // The last arg in a vararg command sets all vararg types.
  108|  2.17k|        for (int n = MPMIN(i, MP_CMD_DEF_MAX_ARGS - 1); n >= 0; n--) {
  ------------------
  |  |   45|  1.08k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 1.08k]
  |  |  ------------------
  ------------------
  |  Branch (108:57): [True: 2.17k, False: 0]
  ------------------
  109|  2.17k|            if (cmd->args[n].type) {
  ------------------
  |  Branch (109:17): [True: 1.08k, False: 1.08k]
  ------------------
  110|  1.08k|                opt = &cmd->args[n];
  111|  1.08k|                break;
  112|  1.08k|            }
  113|  2.17k|        }
  114|  93.9k|    } else if (i < MP_CMD_DEF_MAX_ARGS) {
  ------------------
  |  |   26|  93.9k|#define MP_CMD_DEF_MAX_ARGS 15
  ------------------
  |  Branch (114:16): [True: 93.9k, False: 0]
  ------------------
  115|  93.9k|        opt = &cmd->args[i];
  116|  93.9k|    }
  117|  95.0k|    return opt && opt->type ? opt : NULL;
  ------------------
  |  Branch (117:12): [True: 95.0k, False: 0]
  |  Branch (117:19): [True: 55.1k, False: 39.8k]
  ------------------
  118|  95.0k|}
cmd.c:is_vararg:
   99|   120k|{
  100|   120k|    return m->vararg && (i + 1 >= MP_CMD_DEF_MAX_ARGS || !m->args[i + 1].type);
  ------------------
  |  |   26|  4.09k|#define MP_CMD_DEF_MAX_ARGS 15
  ------------------
  |  Branch (100:12): [True: 2.04k, False: 118k]
  |  Branch (100:26): [True: 0, False: 2.04k]
  |  Branch (100:58): [True: 1.40k, False: 640]
  ------------------
  101|   120k|}
cmd.c:finish_cmd:
  129|  31.8k|{
  130|  79.4k|    for (int i = 0; i < MP_CMD_DEF_MAX_ARGS; i++) {
  ------------------
  |  |   26|  79.4k|#define MP_CMD_DEF_MAX_ARGS 15
  ------------------
  |  Branch (130:21): [True: 79.4k, False: 0]
  ------------------
  131|       |        // (type==NULL is used for yet unset arguments)
  132|  79.4k|        if (i < cmd->nargs && cmd->args[i].type)
  ------------------
  |  Branch (132:13): [True: 23.0k, False: 56.4k]
  |  Branch (132:31): [True: 23.0k, False: 0]
  ------------------
  133|  23.0k|            continue;
  134|  56.4k|        const struct m_option *opt = get_arg_type(cmd->def, i);
  135|  56.4k|        if (i >= cmd->nargs && (!opt || is_vararg(cmd->def, i)))
  ------------------
  |  Branch (135:13): [True: 56.4k, False: 0]
  |  Branch (135:33): [True: 31.3k, False: 25.1k]
  |  Branch (135:41): [True: 320, False: 24.8k]
  ------------------
  136|  31.6k|            break;
  137|  24.8k|        if (!opt->defval && !(opt->flags & MP_CMD_OPT_ARG)) {
  ------------------
  |  |   27|  19.1k|#define MP_CMD_OPT_ARG M_OPT_OPTIONAL_PARAM
  |  |  ------------------
  |  |  |  |  497|  19.1k|#define M_OPT_OPTIONAL_PARAM    (UINT64_C(1) << 54)
  |  |  ------------------
  ------------------
  |  Branch (137:13): [True: 19.1k, False: 5.69k]
  |  Branch (137:29): [True: 264, False: 18.8k]
  ------------------
  138|    264|            mp_err(log, "Command %s: required argument %s not set.\n",
  ------------------
  |  |   76|  1.58k|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 264, False: 0]
  |  |  |  Branch (76:55): [True: 264, False: 0]
  |  |  |  Branch (76:55): [True: 264, False: 0]
  |  |  ------------------
  ------------------
  139|    264|                   cmd->name, get_arg_name(cmd->def, i));
  140|    264|            return false;
  141|    264|        }
  142|  24.5k|        struct mp_cmd_arg arg = {.type = opt};
  143|  24.5k|        if (opt->defval)
  ------------------
  |  Branch (143:13): [True: 5.69k, False: 18.8k]
  ------------------
  144|  5.69k|            m_option_copy(opt, &arg.v, opt->defval);
  145|  24.5k|        mp_assert(i <= cmd->nargs);
  ------------------
  |  |   41|  24.5k|#define mp_assert assert
  ------------------
  |  Branch (145:9): [True: 24.5k, False: 0]
  ------------------
  146|  24.5k|        if (i == cmd->nargs) {
  ------------------
  |  Branch (146:13): [True: 24.5k, False: 0]
  ------------------
  147|  24.5k|            MP_TARRAY_APPEND(cmd, cmd->args, cmd->nargs, arg);
  ------------------
  |  |  105|  24.5k|    do {                                            \
  |  |  106|  24.5k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  24.5k|    do {                                            \
  |  |  |  |   97|  24.5k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  24.5k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  24.5k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  24.5k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 19.4k, False: 5.18k]
  |  |  |  |  ------------------
  |  |  |  |   99|  24.5k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  19.4k|    do {                                                        \
  |  |  |  |  |  |   89|  19.4k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  19.4k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  19.4k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  19.4k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  19.4k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  19.4k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  19.4k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 19.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  24.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 24.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  24.5k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  24.5k|        (idxvar)++;                                 \
  |  |  109|  24.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 24.5k]
  |  |  ------------------
  ------------------
  148|  24.5k|        } else {
  149|      0|            cmd->args[i] = arg;
  150|      0|        }
  151|  24.5k|    }
  152|       |
  153|  31.6k|    if (!(cmd->flags & (MP_ASYNC_CMD | MP_SYNC_CMD)))
  ------------------
  |  Branch (153:9): [True: 31.6k, False: 0]
  ------------------
  154|  31.6k|        cmd->flags |= cmd->def->default_async ? MP_ASYNC_CMD : MP_SYNC_CMD;
  ------------------
  |  Branch (154:23): [True: 0, False: 31.6k]
  ------------------
  155|       |
  156|       |    return true;
  157|  31.8k|}
cmd.c:parse_cmd_str:
  374|  21.9k|{
  375|  21.9k|    struct parse_ctx *ctx = &(struct parse_ctx){
  376|  21.9k|        .log = log,
  377|  21.9k|        .tmp = tmp,
  378|  21.9k|        .str = *str,
  379|  21.9k|        .start = *str,
  380|  21.9k|    };
  381|       |
  382|  21.9k|    struct mp_cmd *cmd = talloc_ptrtype(NULL, cmd);
  ------------------
  |  |   34|  21.9k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  21.9k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  21.9k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  383|  21.9k|    talloc_set_destructor(cmd, destroy_cmd);
  ------------------
  |  |   41|  21.9k|#define talloc_set_destructor           ta_set_destructor
  ------------------
  384|  21.9k|    *cmd = (struct mp_cmd) {
  385|  21.9k|        .flags = MP_ON_OSD_AUTO | MP_EXPAND_PROPERTIES,
  386|  21.9k|        .scale = 1,
  387|  21.9k|        .scale_units = 1,
  388|  21.9k|    };
  389|       |
  390|  21.9k|    ctx->str = bstr_lstrip(ctx->str);
  391|       |
  392|  21.9k|    bstr cur_token;
  393|  21.9k|    if (pctx_read_token(ctx, &cur_token) < 0)
  ------------------
  |  Branch (393:9): [True: 587, False: 21.3k]
  ------------------
  394|    587|        goto error;
  395|       |
  396|  22.3k|    while (1) {
  ------------------
  |  Branch (396:12): [True: 22.3k, Folded]
  ------------------
  397|  22.3k|        if (!apply_flag(cmd, cur_token))
  ------------------
  |  Branch (397:13): [True: 21.3k, False: 1.02k]
  ------------------
  398|  21.3k|            break;
  399|  1.02k|        if (pctx_read_token(ctx, &cur_token) < 0)
  ------------------
  |  Branch (399:13): [True: 0, False: 1.02k]
  ------------------
  400|      0|            goto error;
  401|  1.02k|    }
  402|       |
  403|  21.3k|    if (!find_cmd(ctx->log, cmd, cur_token))
  ------------------
  |  Branch (403:9): [True: 5.83k, False: 15.5k]
  ------------------
  404|  5.83k|        goto error;
  405|       |
  406|  38.5k|    for (int i = 0; i < MP_CMD_MAX_ARGS; i++) {
  ------------------
  |  |   86|  38.5k|#define MP_CMD_MAX_ARGS 100
  ------------------
  |  Branch (406:21): [True: 38.5k, False: 0]
  ------------------
  407|  38.5k|        const struct m_option *opt = get_arg_type(cmd->def, i);
  408|  38.5k|        if (!opt)
  ------------------
  |  Branch (408:13): [True: 8.50k, False: 30.0k]
  ------------------
  409|  8.50k|            break;
  410|       |
  411|  30.0k|        int r = pctx_read_token(ctx, &cur_token);
  412|  30.0k|        if (r < 0) {
  ------------------
  |  Branch (412:13): [True: 19, False: 29.9k]
  ------------------
  413|     19|            MP_ERR(ctx, "Command %s: error in argument %d.\n", cmd->name, i + 1);
  ------------------
  |  |   89|     19|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     19|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  414|     19|            goto error;
  415|     19|        }
  416|  29.9k|        if (r < 1)
  ------------------
  |  Branch (416:13): [True: 6.98k, False: 23.0k]
  ------------------
  417|  6.98k|            break;
  418|       |
  419|  23.0k|        struct mp_cmd_arg arg = {.type = opt};
  420|  23.0k|        r = m_option_parse(ctx->log, opt, bstr0(cmd->name), cur_token, &arg.v);
  421|  23.0k|        if (r < 0) {
  ------------------
  |  Branch (421:13): [True: 0, False: 23.0k]
  ------------------
  422|      0|            MP_ERR(ctx, "Command %s: argument %d can't be parsed: %s.\n",
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  423|      0|                   cmd->name, i + 1, m_option_strerror(r));
  424|      0|            goto error;
  425|      0|        }
  426|       |
  427|  23.0k|        MP_TARRAY_APPEND(cmd, cmd->args, cmd->nargs, arg);
  ------------------
  |  |  105|  23.0k|    do {                                            \
  |  |  106|  23.0k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  23.0k|    do {                                            \
  |  |  |  |   97|  23.0k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  23.0k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  23.0k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  23.0k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 14.3k, False: 8.63k]
  |  |  |  |  ------------------
  |  |  |  |   99|  23.0k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  14.3k|    do {                                                        \
  |  |  |  |  |  |   89|  14.3k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  14.3k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  14.3k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  14.3k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  14.3k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  14.3k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  14.3k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 14.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  23.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 23.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  23.0k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  23.0k|        (idxvar)++;                                 \
  |  |  109|  23.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 23.0k]
  |  |  ------------------
  ------------------
  428|  23.0k|    }
  429|       |
  430|  15.4k|    if (!finish_cmd(ctx->log, cmd))
  ------------------
  |  Branch (430:9): [True: 264, False: 15.2k]
  ------------------
  431|    264|        goto error;
  432|       |
  433|  15.2k|    bstr dummy;
  434|  15.2k|    if (read_token(ctx->str, &dummy, &dummy) && ctx->str.len) {
  ------------------
  |  Branch (434:9): [True: 94, False: 15.1k]
  |  Branch (434:49): [True: 94, False: 0]
  ------------------
  435|     94|        MP_ERR(ctx, "Command %s has trailing unused arguments: '%.*s'.\n",
  ------------------
  |  |   89|     94|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    188|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 94, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  436|     94|               cmd->name, BSTR_P(ctx->str));
  437|       |        // Better make it fatal to make it clear something is wrong.
  438|     94|        goto error;
  439|     94|    }
  440|       |
  441|  15.1k|    bstr orig = {ctx->start.start, ctx->str.start - ctx->start.start};
  442|  15.1k|    cmd->original = bstrto0(cmd, bstr_strip(orig));
  443|       |
  444|  15.1k|    *str = ctx->str;
  445|  15.1k|    return cmd;
  446|       |
  447|  6.79k|error:
  448|  6.79k|    MP_ERR(ctx, "Command was defined at %s.\n", loc);
  ------------------
  |  |   89|  6.79k|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  6.79k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  449|  6.79k|    talloc_free(cmd);
  ------------------
  |  |   47|  6.79k|#define talloc_free                     ta_free
  ------------------
  450|  6.79k|    *str = ctx->str;
  451|       |    return NULL;
  452|  15.2k|}
cmd.c:pctx_read_token:
  331|  52.9k|{
  332|  52.9k|    *out = (bstr){0};
  333|  52.9k|    ctx->str = bstr_lstrip(ctx->str);
  334|  52.9k|    bstr start = ctx->str;
  335|  52.9k|    if (bstr_eatstart0(&ctx->str, "\"")) {
  ------------------
  |  Branch (335:9): [True: 825, False: 52.1k]
  ------------------
  336|    825|        if (!mp_append_escaped_string_noalloc(ctx->tmp, out, &ctx->str)) {
  ------------------
  |  Branch (336:13): [True: 155, False: 670]
  ------------------
  337|    155|            MP_ERR(ctx, "Broken string escapes: ...>%.*s<.\n", BSTR_P(start));
  ------------------
  |  |   89|    155|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    310|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 155, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  338|    155|            return -1;
  339|    155|        }
  340|    670|        if (!bstr_eatstart0(&ctx->str, "\"")) {
  ------------------
  |  Branch (340:13): [True: 111, False: 559]
  ------------------
  341|    111|            MP_ERR(ctx, "Unterminated double quote: ...>%.*s<.\n", BSTR_P(start));
  ------------------
  |  |   89|    111|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    222|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 111, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  342|    111|            return -1;
  343|    111|        }
  344|    559|        return 1;
  345|    670|    }
  346|  52.1k|    if (bstr_eatstart0(&ctx->str, "'")) {
  ------------------
  |  Branch (346:9): [True: 389, False: 51.7k]
  ------------------
  347|    389|        int next = bstrchr(ctx->str, '\'');
  348|    389|        if (next < 0) {
  ------------------
  |  Branch (348:13): [True: 212, False: 177]
  ------------------
  349|    212|            MP_ERR(ctx, "Unterminated single quote: ...>%.*s<.\n", BSTR_P(start));
  ------------------
  |  |   89|    212|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    424|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 212, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  350|    212|            return -1;
  351|    212|        }
  352|    177|        *out = bstr_splice(ctx->str, 0, next);
  353|    177|        ctx->str = bstr_cut(ctx->str, next+1);
  354|    177|        return 1;
  355|    389|    }
  356|  51.7k|    if (ctx->start.len > 1 && bstr_eatstart0(&ctx->str, "`")) {
  ------------------
  |  Branch (356:9): [True: 48.3k, False: 3.36k]
  |  Branch (356:31): [True: 195, False: 48.1k]
  ------------------
  357|    195|        char endquote[2] = {ctx->str.start[0], '`'};
  358|    195|        ctx->str = bstr_cut(ctx->str, 1);
  359|    195|        int next = bstr_find(ctx->str, (bstr){endquote, 2});
  360|    195|        if (next < 0) {
  ------------------
  |  Branch (360:13): [True: 128, False: 67]
  ------------------
  361|    128|            MP_ERR(ctx, "Unterminated custom quote: ...>%.*s<.\n", BSTR_P(start));
  ------------------
  |  |   89|    128|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    256|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 128, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  362|    128|            return -1;
  363|    128|        }
  364|     67|        *out = bstr_splice(ctx->str, 0, next);
  365|     67|        ctx->str = bstr_cut(ctx->str, next+2);
  366|     67|        return 1;
  367|    195|    }
  368|       |
  369|  51.5k|    return read_token(ctx->str, &ctx->str, out) ? 1 : 0;
  ------------------
  |  Branch (369:12): [True: 41.2k, False: 10.3k]
  ------------------
  370|  51.7k|}
cmd.c:read_token:
  314|  68.3k|{
  315|  68.3k|    bstr t = bstr_lstrip(str);
  316|  68.3k|    int next = bstrcspn(t, WHITESPACE "#;");
  ------------------
  |  |  309|  68.3k|#define WHITESPACE " \f\n\r\t\v"
  ------------------
  317|  68.3k|    if (!next)
  ------------------
  |  Branch (317:9): [True: 25.5k, False: 42.8k]
  ------------------
  318|  25.5k|        return false;
  319|  42.8k|    *out_token = bstr_splice(t, 0, next);
  320|  42.8k|    *out_rest = bstr_cut(t, next);
  321|       |    return true;
  322|  68.3k|}
cmd.c:get_arg_count:
  573|    155|{
  574|  2.32k|    for (int i = MP_CMD_DEF_MAX_ARGS - 1; i >= 0; i--) {
  ------------------
  |  |   26|    155|#define MP_CMD_DEF_MAX_ARGS 15
  ------------------
  |  Branch (574:43): [True: 2.32k, False: 0]
  ------------------
  575|  2.32k|        if (cmd->args[i].type)
  ------------------
  |  Branch (575:13): [True: 155, False: 2.17k]
  ------------------
  576|    155|            return i + 1;
  577|  2.32k|    }
  578|      0|    return 0;
  579|    155|}

mp_dnd_init:
  148|  11.3k|{
  149|  11.3k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  150|       |    // Nothing drops files here, the thread only makes coverage timing dependent.
  151|  11.3k|    mpv_destroy(mpv);
  152|  11.3k|    return;
  153|      0|#endif
  154|      0|    mp_thread mpv_event_loop;
  155|      0|    if (!mp_thread_create(&mpv_event_loop, mpv_event_loop_fn, mpv))
  ------------------
  |  |  214|      0|#define mp_thread_create(t, f, a) pthread_create(t, NULL, f, a)
  ------------------
  |  Branch (155:9): [True: 0, False: 0]
  ------------------
  156|      0|        mp_thread_detach(mpv_event_loop);
  ------------------
  |  |  216|      0|#define mp_thread_detach          pthread_detach
  ------------------
  157|      0|    else
  158|      0|        mpv_destroy(mpv);
  159|      0|}

mp_input_get_touch_pos:
 1079|     50|{
 1080|     50|    input_lock(ictx);
  ------------------
  |  |   58|     50|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|     50|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1081|     50|    int num_touch_points = ictx->num_touch_points;
 1082|     50|    for (int i = 0; i < MPMIN(num_touch_points, count); i++) {
  ------------------
  |  |   45|     50|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 50]
  |  |  ------------------
  ------------------
  |  Branch (1082:21): [True: 0, False: 50]
  ------------------
 1083|      0|        x[i] = ictx->touch_points[i].x;
 1084|      0|        y[i] = ictx->touch_points[i].y;
 1085|      0|        id[i] = ictx->touch_points[i].id;
 1086|      0|    }
 1087|     50|    input_unlock(ictx);
  ------------------
  |  |   59|     50|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|     50|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1088|     50|    return num_touch_points;
 1089|     50|}
mp_input_get_tablet_pos:
 1233|     30|{
 1234|     30|    input_lock(ictx);
  ------------------
  |  |   58|     30|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|     30|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1235|     30|    *x = ictx->tablet_x;
 1236|     30|    *y = ictx->tablet_y;
 1237|     30|    *tool_in_proximity = ictx->tablet_tool_in_proximity;
 1238|     30|    *tool_down = ictx->tablet_tool_down;
 1239|     30|    *tool_stylus_btn1_pressed = ictx->tablet_tool_stylus_btn1_pressed;
 1240|     30|    *tool_stylus_btn2_pressed = ictx->tablet_tool_stylus_btn2_pressed;
 1241|     30|    *tool_stylus_btn3_pressed = ictx->tablet_tool_stylus_btn3_pressed;
 1242|     30|    *pad_focus = ictx->tablet_pad_focus;
 1243|     30|    for (int i = 0; i < ictx->tablet_pad_buttons; i++)
  ------------------
  |  Branch (1243:21): [True: 0, False: 30]
  ------------------
 1244|      0|        pad_buttons_pressed[i] = ictx->tablet_pad_buttons_pressed[i];
 1245|     30|    *pad_buttons = ictx->tablet_pad_buttons;
 1246|     30|    input_unlock(ictx);
  ------------------
  |  |   59|     30|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|     30|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1247|     30|}
mp_input_get_dropped_files:
 1307|     38|{
 1308|     38|    input_lock(ictx);
  ------------------
  |  |   58|     38|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|     38|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1309|     38|    *dnd_ts = ictx->dnd_ts;
 1310|     38|    *dnd_action = ictx->dnd_action;
 1311|     38|    *dropped_files = NULL;
 1312|     38|    int num = 0;
 1313|     38|    for (int i = 0; i < ictx->num_dropped_files; i++)
  ------------------
  |  Branch (1313:21): [True: 0, False: 38]
  ------------------
 1314|      0|        MP_TARRAY_APPEND(talloc_ctx, *dropped_files, num,
  ------------------
  |  |  105|      0|    do {                                            \
  |  |  106|      0|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      0|    do {                                            \
  |  |  |  |   97|      0|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      0|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      0|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|      0|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      0|        (idxvar)++;                                 \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1315|     38|                         bstrto0(talloc_ctx, ictx->dropped_files[i]));
 1316|     38|    MP_TARRAY_APPEND(talloc_ctx, *dropped_files, num, NULL);
  ------------------
  |  |  105|     38|    do {                                            \
  |  |  106|     38|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|     38|    do {                                            \
  |  |  |  |   97|     38|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|     38|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|     38|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|     38|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 38, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|     38|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|     38|    do {                                                        \
  |  |  |  |  |  |   89|     38|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|     38|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|     38|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|     38|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|     38|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|     38|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|     38|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 38]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|     38|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 38]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|     38|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|     38|        (idxvar)++;                                 \
  |  |  109|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
 1317|     38|    input_unlock(ictx);
  ------------------
  |  |   59|     38|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|     38|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1318|     38|}
mp_input_get_delay:
 1387|  16.8k|{
 1388|  16.8k|    input_lock(ictx);
  ------------------
  |  |   58|  16.8k|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|  16.8k|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1389|  16.8k|    double seconds = INFINITY;
 1390|  16.8k|    adjust_max_wait_time(ictx, &seconds);
 1391|  16.8k|    input_unlock(ictx);
  ------------------
  |  |   59|  16.8k|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|  16.8k|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1392|  16.8k|    return seconds;
 1393|  16.8k|}
mp_input_read_cmd:
 1401|  16.8k|{
 1402|  16.8k|    input_lock(ictx);
  ------------------
  |  |   58|  16.8k|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|  16.8k|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1403|  16.8k|    struct mp_cmd *ret = queue_remove_head(&ictx->cmd_queue);
 1404|  16.8k|    if (!ret)
  ------------------
  |  Branch (1404:9): [True: 16.8k, False: 0]
  ------------------
 1405|  16.8k|        ret = check_autorepeat(ictx);
 1406|  16.8k|    if (ret && ret->mouse_move) {
  ------------------
  |  Branch (1406:9): [True: 0, False: 16.8k]
  |  Branch (1406:16): [True: 0, False: 0]
  ------------------
 1407|      0|        ictx->mouse_x = ret->mouse_x;
 1408|      0|        ictx->mouse_y = ret->mouse_y;
 1409|      0|    }
 1410|  16.8k|    input_unlock(ictx);
  ------------------
  |  |   59|  16.8k|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|  16.8k|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1411|  16.8k|    return ret;
 1412|  16.8k|}
mp_input_get_mouse_pos:
 1415|     79|{
 1416|     79|    input_lock(ictx);
  ------------------
  |  |   58|     79|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|     79|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1417|     79|    *x = ictx->mouse_x;
 1418|     79|    *y = ictx->mouse_y;
 1419|     79|    *hover = ictx->mouse_hover;
 1420|     79|    input_unlock(ictx);
  ------------------
  |  |   59|     79|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|     79|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1421|     79|}
mp_input_enable_section:
 1453|  16.7k|{
 1454|  16.7k|    bstr bname = bstr0(name);
 1455|  16.7k|    input_lock(ictx);
  ------------------
  |  |   58|  16.7k|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|  16.7k|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1456|  16.7k|    bname = normalize_section(ictx, bname);
 1457|       |
 1458|  16.7k|    disable_section(ictx, bname);
 1459|       |
 1460|  16.7k|    MP_TRACE(ictx, "enable section '%.*s'\n", BSTR_P(bname));
  ------------------
  |  |   94|  16.7k|#define MP_TRACE(obj, ...)      MP_MSG(obj, MSGL_TRACE, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  33.5k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 16.7k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1461|       |
 1462|  16.7k|    int top = ictx->num_active_sections;
 1463|  16.7k|    if (!(flags & MP_INPUT_ON_TOP)) {
  ------------------
  |  Branch (1463:9): [True: 16.7k, False: 0]
  ------------------
 1464|       |        // insert before the first top entry
 1465|  17.1k|        for (top = 0; top < ictx->num_active_sections; top++) {
  ------------------
  |  Branch (1465:23): [True: 395, False: 16.7k]
  ------------------
 1466|    395|            if (ictx->active_sections[top].flags & MP_INPUT_ON_TOP)
  ------------------
  |  Branch (1466:17): [True: 0, False: 395]
  ------------------
 1467|      0|                break;
 1468|    395|        }
 1469|  16.7k|    }
 1470|  16.7k|    MP_TARRAY_INSERT_AT(ictx, ictx->active_sections, ictx->num_active_sections,
  ------------------
  |  |  115|  16.7k|    do {                                            \
  |  |  116|  16.7k|        size_t at_ = (at);                          \
  |  |  117|  16.7k|        assert(at_ <= (idxvar));                    \
  |  |  118|  16.7k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  16.7k|    do {                                            \
  |  |  |  |   97|  16.7k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  16.7k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  16.7k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  16.7k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 16.4k, False: 395]
  |  |  |  |  ------------------
  |  |  |  |   99|  16.7k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  16.4k|    do {                                                        \
  |  |  |  |  |  |   89|  16.4k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  16.4k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  16.4k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  16.4k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  16.4k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  16.4k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  16.4k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 16.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  16.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 16.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|  16.7k|        memmove((p) + at_ + 1, (p) + at_,           \
  |  |  120|  16.7k|                ((idxvar) - at_) * sizeof((p)[0])); \
  |  |  121|  16.7k|        (idxvar)++;                                 \
  |  |  122|  16.7k|        (p)[at_] = (__VA_ARGS__);                   \
  |  |  123|  16.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 16.7k]
  |  |  ------------------
  ------------------
  |  Branch (1470:5): [True: 16.7k, False: 0]
  ------------------
 1471|  16.7k|                        top, (struct active_section){bname, flags});
 1472|       |
 1473|  16.7k|    MP_TRACE(ictx, "active section stack:\n");
  ------------------
  |  |   94|  16.7k|#define MP_TRACE(obj, ...)      MP_MSG(obj, MSGL_TRACE, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  16.7k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
 1474|  33.9k|    for (int n = 0; n < ictx->num_active_sections; n++) {
  ------------------
  |  Branch (1474:21): [True: 17.1k, False: 16.7k]
  ------------------
 1475|  17.1k|        MP_TRACE(ictx, " %.*s %d\n", BSTR_P(ictx->active_sections[n].name),
  ------------------
  |  |   94|  17.1k|#define MP_TRACE(obj, ...)      MP_MSG(obj, MSGL_TRACE, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  34.3k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 17.1k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1476|  17.1k|                 ictx->active_sections[n].flags);
 1477|  17.1k|    }
 1478|       |
 1479|  16.7k|    input_unlock(ictx);
  ------------------
  |  |   59|  16.7k|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|  16.7k|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1480|  16.7k|}
mp_input_remove_sections_by_owner:
 1545|  31.5k|{
 1546|  31.5k|    input_lock(ictx);
  ------------------
  |  |   58|  31.5k|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|  31.5k|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1547|  64.8k|    for (int n = 0; n < ictx->num_sections; n++) {
  ------------------
  |  Branch (1547:21): [True: 33.3k, False: 31.5k]
  ------------------
 1548|  33.3k|        struct cmd_bind_section *bs = ictx->sections[n];
 1549|  33.3k|        if (bs->owner && owner && strcmp(bs->owner, owner) == 0) {
  ------------------
  |  Branch (1549:13): [True: 0, False: 33.3k]
  |  Branch (1549:26): [True: 0, False: 0]
  |  Branch (1549:35): [True: 0, False: 0]
  ------------------
 1550|      0|            disable_section(ictx, bs->section);
 1551|      0|            remove_binds(bs, false);
 1552|      0|            remove_binds(bs, true);
 1553|      0|        }
 1554|  33.3k|    }
 1555|  31.5k|    input_unlock(ictx);
  ------------------
  |  |   59|  31.5k|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|  31.5k|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1556|  31.5k|}
mp_input_init:
 1717|  16.4k|{
 1718|       |
 1719|  16.4k|    struct input_ctx *ictx = talloc_ptrtype(NULL, ictx);
  ------------------
  |  |   34|  16.4k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  16.4k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1720|  16.4k|    *ictx = (struct input_ctx){
 1721|  16.4k|        .global = global,
 1722|  16.4k|        .ar_state = -1,
 1723|  16.4k|        .log = mp_log_new(ictx, global->log, "input"),
 1724|  16.4k|        .mouse_section = bstr0("default"),
 1725|  16.4k|        .opts_cache = m_config_cache_alloc(ictx, global, &input_config),
 1726|  16.4k|        .wakeup_cb = wakeup_cb,
 1727|  16.4k|        .wakeup_ctx = wakeup_ctx,
 1728|  16.4k|        .active_sections = talloc_array(ictx, struct active_section, 0),
  ------------------
  |  |   29|  16.4k|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|  16.4k|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1729|  16.4k|        .touch_points = talloc_array(ictx, struct touch_point, 0),
  ------------------
  |  |   29|  16.4k|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|  16.4k|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1730|  16.4k|        .dnd_action = DND_NONE,
 1731|  16.4k|    };
 1732|       |
 1733|  16.4k|    ictx->opts = ictx->opts_cache->opts;
 1734|       |
 1735|  16.4k|    mp_mutex_init(&ictx->mutex);
 1736|       |
 1737|       |    // Setup default section, so that it does nothing.
 1738|  16.4k|    mp_input_enable_section(ictx, NULL, MP_INPUT_ALLOW_VO_DRAGGING |
 1739|  16.4k|                                        MP_INPUT_ALLOW_HIDE_CURSOR);
 1740|       |
 1741|  16.4k|    return ictx;
 1742|  16.4k|}
mp_input_update_opts:
 1763|  11.3k|{
 1764|  11.3k|    input_lock(ictx);
  ------------------
  |  |   58|  11.3k|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|  11.3k|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1765|  11.3k|    reload_opts(ictx, false);
 1766|  11.3k|    input_unlock(ictx);
  ------------------
  |  |   59|  11.3k|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|  11.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1767|  11.3k|}
mp_input_load_config:
 1770|  11.3k|{
 1771|  11.3k|    input_lock(ictx);
  ------------------
  |  |   58|  11.3k|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|  11.3k|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1772|       |
 1773|  11.3k|    reload_opts(ictx, false);
 1774|       |
 1775|       |    // "Uncomment" the default key bindings in etc/input.conf and add them.
 1776|       |    // All lines that do not start with '# ' are parsed.
 1777|  11.3k|    bstr builtin = bstr0(builtin_input_conf);
 1778|  28.3k|    while (ictx->opts->builtin_bindings && builtin.len) {
  ------------------
  |  Branch (1778:12): [True: 17.0k, False: 11.3k]
  |  Branch (1778:44): [True: 16.9k, False: 64]
  ------------------
 1779|  16.9k|        bstr line = bstr_getline(builtin, &builtin);
 1780|  16.9k|        bstr_eatstart0(&line, "#");
 1781|  16.9k|        if (!bstr_startswith0(line, " "))
  ------------------
  |  Branch (1781:13): [True: 14.9k, False: 1.98k]
  ------------------
 1782|  14.9k|            parse_config(ictx, true, line, "<builtin>", (bstr){0});
 1783|  16.9k|    }
 1784|       |
 1785|  11.3k|    bool config_ok = false;
 1786|  11.3k|    if (ictx->opts->config_file && ictx->opts->config_file[0])
  ------------------
  |  Branch (1786:9): [True: 3.33k, False: 8.05k]
  |  Branch (1786:36): [True: 3.33k, False: 0]
  ------------------
 1787|  3.33k|        config_ok = parse_config_file(ictx, ictx->opts->config_file);
 1788|  11.3k|    if (!config_ok) {
  ------------------
  |  Branch (1788:9): [True: 10.1k, False: 1.26k]
  ------------------
 1789|       |        // Try global conf dir
 1790|  10.1k|        void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  10.1k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  10.1k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
 1791|  10.1k|        char **files = mp_find_all_config_files(tmp, ictx->global, "input.conf");
 1792|  10.1k|        for (int n = 0; files && files[n]; n++)
  ------------------
  |  Branch (1792:25): [True: 10.1k, False: 0]
  |  Branch (1792:34): [True: 0, False: 10.1k]
  ------------------
 1793|      0|            parse_config_file(ictx, files[n]);
 1794|  10.1k|        talloc_free(tmp);
  ------------------
  |  |   47|  10.1k|#define talloc_free                     ta_free
  ------------------
 1795|  10.1k|    }
 1796|       |
 1797|  11.3k|    bool use_gamepad = ictx->opts->use_gamepad;
 1798|  11.3k|    input_unlock(ictx);
  ------------------
  |  |   59|  11.3k|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|  11.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1799|       |
 1800|       |#if HAVE_SDL2_GAMEPAD
 1801|       |    if (use_gamepad)
 1802|       |        mp_input_sdl_gamepad_add(ictx);
 1803|       |#else
 1804|  11.3k|    (void)use_gamepad;
 1805|  11.3k|#endif
 1806|  11.3k|}
mp_input_uninit:
 1826|  16.4k|{
 1827|  16.4k|    if (!ictx)
  ------------------
  |  Branch (1827:9): [True: 0, False: 16.4k]
  ------------------
 1828|      0|        return;
 1829|       |
 1830|  16.4k|    input_lock(ictx);
  ------------------
  |  |   58|  16.4k|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1831|  16.4k|    reload_opts(ictx, true);
 1832|  16.4k|    input_unlock(ictx);
  ------------------
  |  |   59|  16.4k|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1833|       |
 1834|  16.4k|    close_input_sources(ictx);
 1835|  16.4k|    clear_queue(&ictx->cmd_queue);
 1836|  16.4k|    talloc_free(ictx->current_down_cmd);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
 1837|  16.4k|    mp_mutex_destroy(&ictx->mutex);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
 1838|  16.4k|    talloc_free(ictx);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
 1839|  16.4k|}
mp_input_parse_cmd:
 1859|  20.4k|{
 1860|  20.4k|    return mp_input_parse_cmd_str(ictx->log, str, location);
 1861|  20.4k|}
mp_input_get_bindings:
 1890|    167|{
 1891|    167|    input_lock(ictx);
  ------------------
  |  |   58|    167|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|    167|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1892|    167|    struct mpv_node root;
 1893|    167|    node_init(&root, MPV_FORMAT_NODE_ARRAY, NULL);
 1894|       |
 1895|    619|    for (int x = 0; x < ictx->num_sections; x++) {
  ------------------
  |  Branch (1895:21): [True: 452, False: 167]
  ------------------
 1896|    452|        struct cmd_bind_section *s = ictx->sections[x];
 1897|    452|        int priority = -1;
 1898|       |
 1899|    779|        for (int i = 0; i < ictx->num_active_sections; i++) {
  ------------------
  |  Branch (1899:25): [True: 518, False: 261]
  ------------------
 1900|    518|            struct active_section *as = &ictx->active_sections[i];
 1901|    518|            if (bstr_equals(as->name, s->section)) {
  ------------------
  |  Branch (1901:17): [True: 191, False: 327]
  ------------------
 1902|    191|                priority = i;
 1903|    191|                break;
 1904|    191|            }
 1905|    518|        }
 1906|       |
 1907|  12.7k|        for (int n = 0; n < s->num_binds; n++) {
  ------------------
  |  Branch (1907:25): [True: 12.2k, False: 452]
  ------------------
 1908|  12.2k|            struct cmd_bind *b = &s->binds[n];
 1909|  12.2k|            struct mpv_node *entry = node_array_add(&root, MPV_FORMAT_NODE_MAP);
 1910|       |
 1911|  12.2k|            int b_priority = priority;
 1912|  12.2k|            if (b->is_builtin && !ictx->opts->default_bindings)
  ------------------
  |  Branch (1912:17): [True: 11.9k, False: 337]
  |  Branch (1912:34): [True: 11.9k, False: 0]
  ------------------
 1913|  11.9k|                b_priority = -1;
 1914|       |
 1915|       |            // Try to fixup the weird logic so consumer of this bindings list
 1916|       |            // does not get too confused.
 1917|  12.2k|            if (b_priority >= 0 && !b->is_builtin)
  ------------------
  |  Branch (1917:17): [True: 188, False: 12.0k]
  |  Branch (1917:36): [True: 188, False: 0]
  ------------------
 1918|    188|                b_priority += ictx->num_active_sections;
 1919|       |
 1920|  12.2k|            node_map_add_bstr(entry, "section", s->section);
 1921|  12.2k|            if (s->owner)
  ------------------
  |  Branch (1921:17): [True: 0, False: 12.2k]
  ------------------
 1922|      0|                node_map_add_string(entry, "owner", s->owner);
 1923|  12.2k|            node_map_add_string(entry, "cmd", b->cmd);
 1924|  12.2k|            node_map_add_flag(entry, "is_weak", b->is_builtin);
 1925|  12.2k|            node_map_add_int64(entry, "priority", b_priority);
 1926|  12.2k|            if (b->desc)
  ------------------
  |  Branch (1926:17): [True: 8.71k, False: 3.56k]
  ------------------
 1927|  8.71k|                node_map_add_string(entry, "comment", b->desc);
 1928|       |
 1929|  12.2k|            char *key = mp_input_get_key_combo_name(b->keys, b->num_keys);
 1930|  12.2k|            node_map_add_string(entry, "key", key);
 1931|  12.2k|            talloc_free(key);
  ------------------
  |  |   47|  12.2k|#define talloc_free                     ta_free
  ------------------
 1932|  12.2k|        }
 1933|    452|    }
 1934|       |
 1935|    167|    input_unlock(ictx);
  ------------------
  |  |   59|    167|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|    167|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1936|    167|    return root;
 1937|    167|}
input.c:adjust_max_wait_time:
 1334|  16.8k|{
 1335|  16.8k|    struct input_opts *opts = ictx->opts;
 1336|  16.8k|    if (ictx->last_key_down && opts->ar_rate > 0 && ictx->ar_state >= 0) {
  ------------------
  |  Branch (1336:9): [True: 0, False: 16.8k]
  |  Branch (1336:32): [True: 0, False: 0]
  |  Branch (1336:53): [True: 0, False: 0]
  ------------------
 1337|      0|        *time = MPMIN(*time, 1.0 / opts->ar_rate);
  ------------------
  |  |   45|      0|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1338|      0|        *time = MPMIN(*time, opts->ar_delay / 1000.0);
  ------------------
  |  |   45|      0|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1339|      0|    }
 1340|  16.8k|}
input.c:queue_remove_head:
  301|  16.8k|{
  302|  16.8k|    struct mp_cmd *ret = queue->first;
  303|  16.8k|    if (ret)
  ------------------
  |  Branch (303:9): [True: 0, False: 16.8k]
  ------------------
  304|      0|        queue_remove(queue, ret);
  305|  16.8k|    return ret;
  306|  16.8k|}
input.c:check_autorepeat:
 1353|  16.8k|{
 1354|  16.8k|    struct input_opts *opts = ictx->opts;
 1355|       |
 1356|       |    // No input : autorepeat ?
 1357|  16.8k|    if (opts->ar_rate <= 0 || !ictx->current_down_cmd || !ictx->last_key_down ||
  ------------------
  |  Branch (1357:9): [True: 122, False: 16.7k]
  |  Branch (1357:31): [True: 16.7k, False: 0]
  |  Branch (1357:58): [True: 0, False: 0]
  ------------------
 1358|      0|        (ictx->last_key_down & MP_NO_REPEAT_KEY) ||
  ------------------
  |  |  242|      0|#define MP_NO_REPEAT_KEY       (1u<<23)
  ------------------
  |  Branch (1358:9): [True: 0, False: 0]
  ------------------
 1359|      0|        !mp_input_is_repeatable_cmd(ictx->current_down_cmd))
  ------------------
  |  Branch (1359:9): [True: 0, False: 0]
  ------------------
 1360|  16.8k|        ictx->ar_state = -1; // disable
 1361|       |
 1362|  16.8k|    if (ictx->ar_state >= 0) {
  ------------------
  |  Branch (1362:9): [True: 0, False: 16.8k]
  ------------------
 1363|      0|        int64_t t = mp_time_ns();
 1364|      0|        if (ictx->last_ar + MP_TIME_S_TO_NS(2) < t)
  ------------------
  |  |   71|      0|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
  |  Branch (1364:13): [True: 0, False: 0]
  ------------------
 1365|      0|            ictx->last_ar = t;
 1366|       |        // First time : wait delay
 1367|      0|        if (ictx->ar_state == 0
  ------------------
  |  Branch (1367:13): [True: 0, False: 0]
  ------------------
 1368|      0|            && (t - ictx->last_key_down_time) >= MP_TIME_MS_TO_NS(opts->ar_delay))
  ------------------
  |  |   72|      0|#define MP_TIME_MS_TO_NS(ms) ((ms) * INT64_C(1000000))
  ------------------
  |  Branch (1368:16): [True: 0, False: 0]
  ------------------
 1369|      0|        {
 1370|      0|            ictx->ar_state = 1;
 1371|      0|            ictx->last_ar = ictx->last_key_down_time + MP_TIME_MS_TO_NS(opts->ar_delay);
  ------------------
  |  |   72|      0|#define MP_TIME_MS_TO_NS(ms) ((ms) * INT64_C(1000000))
  ------------------
 1372|       |            // Then send rate / sec event
 1373|      0|        } else if (ictx->ar_state == 1
  ------------------
  |  Branch (1373:20): [True: 0, False: 0]
  ------------------
 1374|      0|                   && (t - ictx->last_ar) >= 1e9 / opts->ar_rate) {
  ------------------
  |  Branch (1374:23): [True: 0, False: 0]
  ------------------
 1375|      0|            ictx->last_ar += 1e9 / opts->ar_rate;
 1376|      0|        } else {
 1377|      0|            return NULL;
 1378|      0|        }
 1379|      0|        struct mp_cmd *ret = mp_cmd_clone(ictx->current_down_cmd);
 1380|      0|        ret->repeated = true;
 1381|      0|        return ret;
 1382|      0|    }
 1383|  16.8k|    return NULL;
 1384|  16.8k|}
input.c:disable_section:
 1432|  16.7k|{
 1433|  16.7k|    name = normalize_section(ictx, name);
 1434|       |
 1435|       |    // Remove old section, or make sure it's on top if re-enabled
 1436|  17.1k|    for (int i = ictx->num_active_sections - 1; i >= 0; i--) {
  ------------------
  |  Branch (1436:49): [True: 395, False: 16.7k]
  ------------------
 1437|    395|        struct active_section *as = &ictx->active_sections[i];
 1438|    395|        if (bstr_equals(as->name, name)) {
  ------------------
  |  Branch (1438:13): [True: 0, False: 395]
  ------------------
 1439|       |            MP_TARRAY_REMOVE_AT(ictx->active_sections,
  ------------------
  |  |  143|      0|    do {                                            \
  |  |  144|      0|        size_t at_ = (at);                          \
  |  |  145|      0|        assert(at_ < (idxvar));                     \
  |  |  146|      0|        memmove((p) + at_, (p) + at_ + 1,           \
  |  |  147|      0|                ((idxvar) - at_ - 1) * sizeof((p)[0])); \
  |  |  148|      0|        (idxvar)--;                                 \
  |  |  149|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (149:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1439:13): [True: 0, False: 0]
  ------------------
 1440|      0|                                ictx->num_active_sections, i);
 1441|      0|        }
 1442|    395|    }
 1443|  16.7k|}
input.c:normalize_section:
 1427|  33.5k|{
 1428|  33.5k|    return get_bind_section(ictx, name)->section;
 1429|  33.5k|}
input.c:get_bind_section:
  406|  54.0k|{
  407|  54.0k|    if (section.len == 0)
  ------------------
  |  Branch (407:9): [True: 35.6k, False: 18.3k]
  ------------------
  408|  35.6k|        section = bstr0("default");
  409|  54.0k|    struct cmd_bind_section *bind_section = find_section(ictx, section);
  410|  54.0k|    if (bind_section)
  ------------------
  |  Branch (410:9): [True: 36.7k, False: 17.2k]
  ------------------
  411|  36.7k|        return bind_section;
  412|  17.2k|    bind_section = talloc_ptrtype(ictx, bind_section);
  ------------------
  |  |   34|  17.2k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  17.2k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  17.2k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  413|  17.2k|    *bind_section = (struct cmd_bind_section) {
  414|  17.2k|        .section = bstrdup(bind_section, section),
  415|  17.2k|        .mouse_area = {INT_MIN, INT_MIN, INT_MAX, INT_MAX},
  416|  17.2k|        .mouse_area_set = true,
  417|  17.2k|    };
  418|  17.2k|    MP_TARRAY_APPEND(ictx, ictx->sections, ictx->num_sections, bind_section);
  ------------------
  |  |  105|  17.2k|    do {                                            \
  |  |  106|  17.2k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  17.2k|    do {                                            \
  |  |  |  |   97|  17.2k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  17.2k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  17.2k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  17.2k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 16.5k, False: 704]
  |  |  |  |  ------------------
  |  |  |  |   99|  17.2k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  16.5k|    do {                                                        \
  |  |  |  |  |  |   89|  16.5k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  16.5k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  16.5k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  16.5k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  16.5k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  16.5k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  16.5k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 16.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  17.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 17.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  17.2k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  17.2k|        (idxvar)++;                                 \
  |  |  109|  17.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 17.2k]
  |  |  ------------------
  ------------------
  419|  17.2k|    return bind_section;
  420|  54.0k|}
input.c:find_section:
  395|  54.0k|{
  396|  58.1k|    for (int n = 0; n < ictx->num_sections; n++) {
  ------------------
  |  Branch (396:21): [True: 40.9k, False: 17.2k]
  ------------------
  397|  40.9k|        struct cmd_bind_section *bs = ictx->sections[n];
  398|  40.9k|        if (bstr_equals(section, bs->section))
  ------------------
  |  Branch (398:13): [True: 36.7k, False: 4.15k]
  ------------------
  399|  36.7k|            return bs;
  400|  40.9k|    }
  401|  17.2k|    return NULL;
  402|  54.0k|}
input.c:bind_dealloc:
 1500|  20.4k|{
 1501|  20.4k|    talloc_free(bind->cmd);
  ------------------
  |  |   47|  20.4k|#define talloc_free                     ta_free
  ------------------
 1502|  20.4k|    talloc_free(bind->location);
  ------------------
  |  |   47|  20.4k|#define talloc_free                     ta_free
  ------------------
 1503|  20.4k|    talloc_free(bind->desc);
  ------------------
  |  |   47|  20.4k|#define talloc_free                     ta_free
  ------------------
 1504|  20.4k|}
input.c:parse_config:
 1616|  16.2k|{
 1617|  16.2k|    int n_binds = 0;
 1618|  16.2k|    int line_no = 0;
 1619|  16.2k|    char *cur_loc = NULL;
 1620|       |
 1621|  75.6k|    while (data.len) {
  ------------------
  |  Branch (1621:12): [True: 59.3k, False: 16.2k]
  ------------------
 1622|  59.3k|        line_no++;
 1623|  59.3k|        if (cur_loc)
  ------------------
  |  Branch (1623:13): [True: 43.4k, False: 15.9k]
  ------------------
 1624|  43.4k|            talloc_free(cur_loc);
  ------------------
  |  |   47|  43.4k|#define talloc_free                     ta_free
  ------------------
 1625|  59.3k|        cur_loc = talloc_asprintf(NULL, "%s:%d", location, line_no);
  ------------------
  |  |   52|  59.3k|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|  59.3k|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 1626|       |
 1627|  59.3k|        bstr line = bstr_strip_linebreaks(bstr_getline(data, &data));
 1628|  59.3k|        line = bstr_lstrip(line);
 1629|  59.3k|        if (line.len == 0 || bstr_startswith0(line, "#"))
  ------------------
  |  Branch (1629:13): [True: 6.84k, False: 52.5k]
  |  Branch (1629:30): [True: 169, False: 52.3k]
  ------------------
 1630|  7.01k|            continue;
 1631|  52.3k|        if (bstr_eatstart0(&line, "default-bindings ")) {
  ------------------
  |  Branch (1631:13): [True: 64, False: 52.3k]
  ------------------
 1632|     64|            bstr orig = line;
 1633|     64|            bstr_split_tok(line, "#", &line, &(bstr){0});
 1634|     64|            line = bstr_strip(line);
 1635|     64|            if (bstr_equals0(line, "start")) {
  ------------------
  |  Branch (1635:17): [True: 64, False: 0]
  ------------------
 1636|     64|                builtin = true;
 1637|     64|            } else {
 1638|      0|                MP_ERR(ictx, "Broken line: %.*s at %s\n", BSTR_P(orig), cur_loc);
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1639|      0|            }
 1640|     64|            continue;
 1641|     64|        }
 1642|  52.3k|        struct bstr command;
 1643|       |        // Find the key name starting a line
 1644|  52.3k|        struct bstr keyname = bstr_split(line, WHITESPACE, &command);
  ------------------
  |  |  309|  52.3k|#define WHITESPACE " \f\n\r\t\v"
  ------------------
 1645|  52.3k|        command = bstr_strip(command);
 1646|  52.3k|        if (command.len == 0) {
  ------------------
  |  Branch (1646:13): [True: 6.79k, False: 45.5k]
  ------------------
 1647|  6.79k|            MP_ERR(ictx, "Unfinished key binding: %.*s at %s\n", BSTR_P(line),
  ------------------
  |  |   89|  6.79k|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  13.5k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 6.79k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1648|  6.79k|                   cur_loc);
 1649|  6.79k|            continue;
 1650|  6.79k|        }
 1651|  45.5k|        char *name = bstrdup0(NULL, keyname);
 1652|  45.5k|        int keys[MP_MAX_KEY_DOWN];
 1653|  45.5k|        int num_keys = 0;
 1654|  45.5k|        if (!mp_input_get_keys_from_string(name, MP_MAX_KEY_DOWN, &num_keys, keys)) {
  ------------------
  |  |   61|  45.5k|#define MP_MAX_KEY_DOWN 16
  ------------------
  |  Branch (1654:13): [True: 25.0k, False: 20.4k]
  ------------------
 1655|  25.0k|            talloc_free(name);
  ------------------
  |  |   47|  25.0k|#define talloc_free                     ta_free
  ------------------
 1656|  25.0k|            MP_ERR(ictx, "Unknown key '%.*s' at %s\n", BSTR_P(keyname), cur_loc);
  ------------------
  |  |   89|  25.0k|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  50.1k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 25.0k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1657|  25.0k|            continue;
 1658|  25.0k|        }
 1659|  20.4k|        talloc_free(name);
  ------------------
  |  |   47|  20.4k|#define talloc_free                     ta_free
  ------------------
 1660|       |
 1661|  20.4k|        bstr section = restrict_section;
 1662|  20.4k|        if (!section.len) {
  ------------------
  |  Branch (1662:13): [True: 20.4k, False: 0]
  ------------------
 1663|  20.4k|            if (bstr_startswith0(command, "{")) {
  ------------------
  |  Branch (1663:17): [True: 2.31k, False: 18.1k]
  ------------------
 1664|  2.31k|                int p = bstrchr(command, '}');
 1665|  2.31k|                if (p != -1) {
  ------------------
  |  Branch (1665:21): [True: 1.20k, False: 1.10k]
  ------------------
 1666|  1.20k|                    section = bstr_strip(bstr_splice(command, 1, p));
 1667|  1.20k|                    command = bstr_lstrip(bstr_cut(command, p + 1));
 1668|  1.20k|                }
 1669|  2.31k|            }
 1670|  20.4k|        }
 1671|       |
 1672|       |        // Print warnings if invalid commands are encountered.
 1673|  20.4k|        struct mp_cmd *cmd = mp_input_parse_cmd(ictx, command, cur_loc);
 1674|  20.4k|        const char *desc = NULL;
 1675|  20.4k|        if (cmd) {
  ------------------
  |  Branch (1675:13): [True: 13.6k, False: 6.79k]
  ------------------
 1676|  13.6k|            desc = cmd->desc;
 1677|  13.6k|            command = bstr0(cmd->original);
 1678|  13.6k|        }
 1679|       |
 1680|  20.4k|        bind_keys(ictx, builtin, section, keys, num_keys, command, cur_loc, desc);
 1681|  20.4k|        n_binds++;
 1682|       |
 1683|  20.4k|        talloc_free(cmd);
  ------------------
  |  |   47|  20.4k|#define talloc_free                     ta_free
  ------------------
 1684|  20.4k|    }
 1685|       |
 1686|  16.2k|    talloc_free(cur_loc);
  ------------------
  |  |   47|  16.2k|#define talloc_free                     ta_free
  ------------------
 1687|       |
 1688|  16.2k|    return n_binds;
 1689|  16.2k|}
input.c:reload_opts:
 1745|  39.1k|{
 1746|  39.1k|    m_config_cache_update(ictx->opts_cache);
 1747|       |
 1748|       |#if HAVE_COCOA
 1749|       |    struct input_opts *opts = ictx->opts;
 1750|       |
 1751|       |    if (ictx->using_cocoa_media_keys != (opts->use_media_keys && !shutdown)) {
 1752|       |        ictx->using_cocoa_media_keys = !ictx->using_cocoa_media_keys;
 1753|       |        if (ictx->using_cocoa_media_keys) {
 1754|       |            cocoa_init_media_keys();
 1755|       |        } else {
 1756|       |            cocoa_uninit_media_keys();
 1757|       |        }
 1758|       |    }
 1759|       |#endif
 1760|  39.1k|}
input.c:parse_config_file:
 1692|  3.33k|{
 1693|  3.33k|    bool r = false;
 1694|  3.33k|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  3.33k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  3.33k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
 1695|       |
 1696|  3.33k|    file = mp_get_user_path(tmp, ictx->global, file);
 1697|       |
 1698|  3.33k|    bstr data = stream_read_file2(file, tmp, STREAM_ORIGIN_DIRECT | STREAM_READ,
  ------------------
  |  |   47|  3.33k|#define STREAM_ORIGIN_DIRECT      (1 << 2) // passed from cmdline or loadfile
  ------------------
                  bstr data = stream_read_file2(file, tmp, STREAM_ORIGIN_DIRECT | STREAM_READ,
  ------------------
  |  |   41|  3.33k|#define STREAM_READ               0
  ------------------
 1699|  3.33k|                                  ictx->global, 1000000);
 1700|  3.33k|    if (data.start) {
  ------------------
  |  Branch (1700:9): [True: 1.26k, False: 2.07k]
  ------------------
 1701|  1.26k|        MP_VERBOSE(ictx, "Parsing input config file %s\n", file);
  ------------------
  |  |   92|  1.26k|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  1.26k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
 1702|  1.26k|        bstr_eatstart0(&data, "\xEF\xBB\xBF"); // skip BOM
 1703|  1.26k|        int num = parse_config(ictx, false, data, file, (bstr){0});
 1704|  1.26k|        MP_VERBOSE(ictx, "Input config file %s parsed: %d binds\n", file, num);
  ------------------
  |  |   92|  1.26k|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  1.26k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
 1705|  1.26k|        r = true;
 1706|  2.07k|    } else {
 1707|  2.07k|        MP_ERR(ictx, "Error reading input config file %s\n", file);
  ------------------
  |  |   89|  2.07k|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  2.07k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
 1708|  2.07k|    }
 1709|       |
 1710|  3.33k|    talloc_free(tmp);
  ------------------
  |  |   47|  3.33k|#define talloc_free                     ta_free
  ------------------
 1711|  3.33k|    return r;
 1712|  3.33k|}
input.c:clear_queue:
 1817|  16.4k|{
 1818|  16.4k|    while (queue->first) {
  ------------------
  |  Branch (1818:12): [True: 0, False: 16.4k]
  ------------------
 1819|      0|        struct mp_cmd *item = queue->first;
 1820|      0|        queue_remove(queue, item);
 1821|      0|        talloc_free(item);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 1822|      0|    }
 1823|  16.4k|}
input.c:bind_keys:
 1572|  20.4k|{
 1573|  20.4k|    struct cmd_bind_section *bs = get_bind_section(ictx, section);
 1574|  20.4k|    struct cmd_bind *bind = NULL;
 1575|       |
 1576|  20.4k|    mp_assert(num_keys <= MP_MAX_KEY_DOWN);
  ------------------
  |  |   41|  20.4k|#define mp_assert assert
  ------------------
  |  Branch (1576:5): [True: 20.4k, False: 0]
  ------------------
 1577|       |
 1578|  1.31M|    for (int n = 0; n < bs->num_binds; n++) {
  ------------------
  |  Branch (1578:21): [True: 1.30M, False: 14.6k]
  ------------------
 1579|  1.30M|        struct cmd_bind *b = &bs->binds[n];
 1580|  1.30M|        if (bind_matches_key(b, num_keys, keys) && b->is_builtin == builtin) {
  ------------------
  |  Branch (1580:13): [True: 5.95k, False: 1.29M]
  |  Branch (1580:52): [True: 5.81k, False: 140]
  ------------------
 1581|  5.81k|            bind = b;
 1582|  5.81k|            break;
 1583|  5.81k|        }
 1584|  1.30M|    }
 1585|       |
 1586|  20.4k|    if (!bind) {
  ------------------
  |  Branch (1586:9): [True: 14.6k, False: 5.81k]
  ------------------
 1587|  14.6k|        struct cmd_bind empty = {{0}};
 1588|  14.6k|        MP_TARRAY_APPEND(bs, bs->binds, bs->num_binds, empty);
  ------------------
  |  |  105|  14.6k|    do {                                            \
  |  |  106|  14.6k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  14.6k|    do {                                            \
  |  |  |  |   97|  14.6k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  14.6k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  14.6k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  14.6k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 1.77k, False: 12.8k]
  |  |  |  |  ------------------
  |  |  |  |   99|  14.6k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  1.77k|    do {                                                        \
  |  |  |  |  |  |   89|  1.77k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  1.77k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  1.77k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.77k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.77k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  1.77k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  1.77k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 1.77k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  14.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 14.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  14.6k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  14.6k|        (idxvar)++;                                 \
  |  |  109|  14.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 14.6k]
  |  |  ------------------
  ------------------
 1589|  14.6k|        bind = &bs->binds[bs->num_binds - 1];
 1590|  14.6k|    }
 1591|       |
 1592|  20.4k|    bind_dealloc(bind);
 1593|       |
 1594|  20.4k|    *bind = (struct cmd_bind) {
 1595|  20.4k|        .cmd = bstrdup0(bs->binds, command),
 1596|  20.4k|        .location = talloc_strdup(bs->binds, loc),
  ------------------
  |  |   50|  20.4k|#define talloc_strdup                   ta_xstrdup
  ------------------
 1597|  20.4k|        .desc = talloc_strdup(bs->binds, desc),
  ------------------
  |  |   50|  20.4k|#define talloc_strdup                   ta_xstrdup
  ------------------
 1598|  20.4k|        .owner = bs,
 1599|  20.4k|        .is_builtin = builtin,
 1600|  20.4k|        .num_keys = num_keys,
 1601|  20.4k|    };
 1602|  20.4k|    memcpy(bind->keys, keys, num_keys * sizeof(bind->keys[0]));
 1603|  20.4k|    if (mp_msg_test(ictx->log, MSGL_DEBUG)) {
  ------------------
  |  Branch (1603:9): [True: 20.4k, False: 0]
  ------------------
 1604|  20.4k|        char *s = mp_input_get_key_combo_name(keys, num_keys);
 1605|  20.4k|        MP_TRACE(ictx, "add: section='%.*s' key='%s'%s cmd='%s' location='%s'\n",
  ------------------
  |  |   94|  20.4k|#define MP_TRACE(obj, ...)      MP_MSG(obj, MSGL_TRACE, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  81.7k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 20.4k, False: 0]
  |  |  |  |  |  Branch (86:57): [True: 13.1k, False: 7.24k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1606|  20.4k|                 BSTR_P(bind->owner->section), s, bind->is_builtin ? " builtin" : "",
 1607|  20.4k|                 bind->cmd, bind->location);
 1608|  20.4k|        talloc_free(s);
  ------------------
  |  |   47|  20.4k|#define talloc_free                     ta_free
  ------------------
 1609|  20.4k|    }
 1610|  20.4k|}
input.c:bind_matches_key:
 1559|  1.30M|{
 1560|  1.30M|    if (bind->num_keys != num_keys)
  ------------------
  |  Branch (1560:9): [True: 191k, False: 1.10M]
  ------------------
 1561|   191k|        return false;
 1562|  1.12M|    for (int i = 0; i < num_keys; i++) {
  ------------------
  |  Branch (1562:21): [True: 1.11M, False: 5.95k]
  ------------------
 1563|  1.11M|        if (bind->keys[i] != keys[i])
  ------------------
  |  Branch (1563:13): [True: 1.10M, False: 14.6k]
  ------------------
 1564|  1.10M|            return false;
 1565|  1.11M|    }
 1566|  5.95k|    return true;
 1567|  1.10M|}
input.c:close_input_sources:
 1976|  16.4k|{
 1977|       |    // To avoid lock-order issues, we first remove each source from the context,
 1978|       |    // and then destroy it.
 1979|  16.4k|    while (1) {
  ------------------
  |  Branch (1979:12): [True: 16.4k, Folded]
  ------------------
 1980|  16.4k|        input_lock(ictx);
  ------------------
  |  |   58|  16.4k|#define input_lock(ictx)    mp_mutex_lock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  |  |  ------------------
  ------------------
 1981|  16.4k|        struct mp_input_src *src = ictx->num_sources ? ictx->sources[0] : NULL;
  ------------------
  |  Branch (1981:36): [True: 0, False: 16.4k]
  ------------------
 1982|  16.4k|        input_unlock(ictx);
  ------------------
  |  |   59|  16.4k|#define input_unlock(ictx)  mp_mutex_unlock(&ictx->mutex)
  |  |  ------------------
  |  |  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  |  |  ------------------
  ------------------
 1983|  16.4k|        if (!src)
  ------------------
  |  Branch (1983:13): [True: 16.4k, False: 0]
  ------------------
 1984|  16.4k|            break;
 1985|      0|        input_src_kill(src);
 1986|      0|    }
 1987|  16.4k|}

mp_ipc_start_anon_client:
  269|  1.95k|{
  270|  1.95k|    int pair[2];
  271|  1.95k|#ifdef SOCK_CLOEXEC
  272|  1.95k|    if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, pair))
  ------------------
  |  Branch (272:9): [True: 0, False: 1.95k]
  ------------------
  273|      0|        return false;
  274|       |#else
  275|       |    if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair))
  276|       |        return false;
  277|       |    mp_set_cloexec(pair[0]);
  278|       |    mp_set_cloexec(pair[1]);
  279|       |#endif
  280|       |
  281|  1.95k|    struct client_arg *client = talloc_ptrtype(NULL, client);
  ------------------
  |  |   34|  1.95k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  1.95k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  1.95k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  282|  1.95k|    *client = (struct client_arg){
  283|  1.95k|        .client = h,
  284|  1.95k|        .client_name = mpv_client_name(h),
  285|  1.95k|        .client_fd   = pair[1],
  286|  1.95k|        .close_client_fd = true,
  287|  1.95k|        .writable = true,
  288|  1.95k|    };
  289|       |
  290|  1.95k|    if (!ipc_start_client(ctx, client, false)) {
  ------------------
  |  Branch (290:9): [True: 0, False: 1.95k]
  ------------------
  291|      0|        close(pair[0]);
  292|      0|        close(pair[1]);
  293|      0|        return false;
  294|      0|    }
  295|       |
  296|  1.95k|    out_fd[0] = pair[0];
  297|  1.95k|    out_fd[1] = -1;
  298|       |    return true;
  299|  1.95k|}
mp_init_ipc:
  408|  11.3k|{
  409|  11.3k|    struct MPOpts *opts = mp_get_config_group(NULL, global, &mp_opt_root);
  410|       |
  411|  11.3k|    struct mp_ipc_ctx *arg = talloc_ptrtype(NULL, arg);
  ------------------
  |  |   34|  11.3k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  11.3k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  11.3k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  412|  11.3k|    *arg = (struct mp_ipc_ctx){
  413|  11.3k|        .log        = mp_log_new(arg, global->log, "ipc"),
  414|  11.3k|        .client_api = client_api,
  415|  11.3k|        .path       = mp_get_user_path(arg, global, opts->ipc_path),
  416|  11.3k|        .death_pipe = {-1, -1},
  417|  11.3k|    };
  418|       |
  419|  11.3k|    if (opts->ipc_client && opts->ipc_client[0]) {
  ------------------
  |  Branch (419:9): [True: 0, False: 11.3k]
  |  Branch (419:29): [True: 0, False: 0]
  ------------------
  420|      0|        int fd = -1;
  421|      0|        bstr str = bstr0(opts->ipc_client);
  422|      0|        if (bstr_eatstart0(&str, "fd://") && str.len) {
  ------------------
  |  Branch (422:13): [True: 0, False: 0]
  |  Branch (422:46): [True: 0, False: 0]
  ------------------
  423|      0|            long long ll = bstrtoll(str, &str, 0);
  424|      0|            if (!str.len && ll >= 0 && ll <= INT_MAX)
  ------------------
  |  Branch (424:17): [True: 0, False: 0]
  |  Branch (424:29): [True: 0, False: 0]
  |  Branch (424:40): [True: 0, False: 0]
  ------------------
  425|      0|                fd = ll;
  426|      0|        }
  427|      0|        if (fd < 0) {
  ------------------
  |  Branch (427:13): [True: 0, False: 0]
  ------------------
  428|      0|            MP_ERR(arg, "Invalid IPC client argument: '%s'\n", opts->ipc_client);
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  429|      0|        } else {
  430|      0|            mp_set_cloexec(fd);
  431|      0|            ipc_start_client_json(arg, -1, fd);
  432|      0|        }
  433|      0|    }
  434|       |
  435|  11.3k|    talloc_free(opts);
  ------------------
  |  |   47|  11.3k|#define talloc_free                     ta_free
  ------------------
  436|       |
  437|  11.3k|    if (!arg->path || !arg->path[0])
  ------------------
  |  Branch (437:9): [True: 11.3k, False: 0]
  |  Branch (437:23): [True: 0, False: 0]
  ------------------
  438|  11.3k|        goto out;
  439|       |
  440|      0|    if (mp_make_wakeup_pipe(arg->death_pipe) < 0)
  ------------------
  |  Branch (440:9): [True: 0, False: 0]
  ------------------
  441|      0|        goto out;
  442|       |
  443|      0|    if (mp_thread_create(&arg->thread, ipc_thread, arg))
  ------------------
  |  |  214|      0|#define mp_thread_create(t, f, a) pthread_create(t, NULL, f, a)
  |  |  ------------------
  |  |  |  Branch (214:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  444|      0|        goto out;
  445|       |
  446|      0|    return arg;
  447|       |
  448|  11.3k|out:
  449|  11.3k|    if (arg->death_pipe[0] >= 0) {
  ------------------
  |  Branch (449:9): [True: 0, False: 11.3k]
  ------------------
  450|      0|        close(arg->death_pipe[0]);
  451|      0|        close(arg->death_pipe[1]);
  452|      0|    }
  453|  11.3k|    talloc_free(arg);
  ------------------
  |  |   47|  11.3k|#define talloc_free                     ta_free
  ------------------
  454|       |    return NULL;
  455|      0|}
mp_uninit_ipc:
  458|  16.4k|{
  459|  16.4k|    if (!arg)
  ------------------
  |  Branch (459:9): [True: 16.4k, False: 0]
  ------------------
  460|  16.4k|        return;
  461|       |
  462|      0|    (void)write(arg->death_pipe[1], &(char){0}, 1);
  463|      0|    mp_thread_join(arg->thread);
  ------------------
  |  |  215|      0|#define mp_thread_join(t)         pthread_join(t, NULL)
  ------------------
  464|       |
  465|      0|    close(arg->death_pipe[0]);
  466|      0|    close(arg->death_pipe[1]);
  467|      0|    talloc_free(arg);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  468|      0|}
ipc-unix.c:ipc_start_client:
  224|  1.95k|{
  225|  1.95k|    if (!client->client)
  ------------------
  |  Branch (225:9): [True: 0, False: 1.95k]
  ------------------
  226|      0|        client->client = mp_new_client(ctx->client_api, client->client_name);
  227|  1.95k|    if (!client->client)
  ------------------
  |  Branch (227:9): [True: 0, False: 1.95k]
  ------------------
  228|      0|        goto err;
  229|       |
  230|  1.95k|    client->log = mp_client_get_log(client->client);
  231|       |
  232|  1.95k|    mp_thread client_thr;
  233|  1.95k|    if (mp_thread_create(&client_thr, client_thread, client))
  ------------------
  |  |  214|  1.95k|#define mp_thread_create(t, f, a) pthread_create(t, NULL, f, a)
  |  |  ------------------
  |  |  |  Branch (214:35): [True: 0, False: 1.95k]
  |  |  ------------------
  ------------------
  234|      0|        goto err;
  235|  1.95k|    mp_thread_detach(client_thr);
  ------------------
  |  |  216|  1.95k|#define mp_thread_detach          pthread_detach
  ------------------
  236|       |
  237|  1.95k|    return true;
  238|       |
  239|      0|err:
  240|      0|    if (free_on_init_fail) {
  ------------------
  |  Branch (240:9): [True: 0, False: 0]
  ------------------
  241|      0|        if (client->client)
  ------------------
  |  Branch (241:13): [True: 0, False: 0]
  ------------------
  242|      0|            mpv_destroy(client->client);
  243|       |
  244|      0|        if (client->close_client_fd)
  ------------------
  |  Branch (244:13): [True: 0, False: 0]
  ------------------
  245|      0|            close(client->client_fd);
  246|      0|    }
  247|       |
  248|      0|    talloc_free(client);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  249|       |    return false;
  250|  1.95k|}
ipc-unix.c:client_thread:
   94|  1.95k|{
   95|       |    // We don't use MSG_NOSIGNAL because the moldy fruit OS doesn't support it.
   96|  1.95k|    struct sigaction sa = { .sa_handler = SIG_IGN, .sa_flags = SA_RESTART };
   97|  1.95k|    sigfillset(&sa.sa_mask);
   98|  1.95k|    sigaction(SIGPIPE, &sa, NULL);
   99|       |
  100|  1.95k|    int rc;
  101|       |
  102|  1.95k|    struct client_arg *arg = p;
  103|  1.95k|    bstr client_msg = { talloc_strdup(NULL, ""), 0 };
  ------------------
  |  |   50|  1.95k|#define talloc_strdup                   ta_xstrdup
  ------------------
  104|       |
  105|  1.95k|    char *tname = talloc_asprintf(NULL, "ipc/%s", arg->client_name);
  ------------------
  |  |   52|  1.95k|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|  1.95k|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  106|  1.95k|    mp_thread_set_name(tname);
  107|  1.95k|    talloc_free(tname);
  ------------------
  |  |   47|  1.95k|#define talloc_free                     ta_free
  ------------------
  108|       |
  109|  1.95k|    int pipe_fd = mpv_get_wakeup_pipe(arg->client);
  110|  1.95k|    if (pipe_fd < 0) {
  ------------------
  |  Branch (110:9): [True: 0, False: 1.95k]
  ------------------
  111|      0|        MP_ERR(arg, "Could not get wakeup pipe\n");
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  112|      0|        goto done;
  113|      0|    }
  114|       |
  115|  1.95k|    MP_VERBOSE(arg, "Client connected\n");
  ------------------
  |  |   92|  1.95k|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  1.95k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  116|       |
  117|  1.95k|    struct pollfd fds[2] = {
  118|  1.95k|        {.events = POLLIN, .fd = pipe_fd},
  119|  1.95k|        {.events = POLLIN, .fd = arg->client_fd},
  120|  1.95k|    };
  121|       |
  122|  1.95k|    fcntl(arg->client_fd, F_SETFL, fcntl(arg->client_fd, F_GETFL, 0) | O_NONBLOCK);
  123|       |
  124|  2.05k|    while (1) {
  ------------------
  |  Branch (124:12): [True: 2.05k, Folded]
  ------------------
  125|  2.05k|        rc = poll(fds, 2, 0);
  126|  2.05k|        if (rc == 0)
  ------------------
  |  Branch (126:13): [True: 20, False: 2.03k]
  ------------------
  127|     20|            rc = poll(fds, 2, -1);
  128|  2.05k|        if (rc < 0) {
  ------------------
  |  Branch (128:13): [True: 0, False: 2.05k]
  ------------------
  129|      0|            MP_ERR(arg, "Poll error\n");
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  130|      0|            continue;
  131|      0|        }
  132|       |
  133|  2.05k|        if (fds[0].revents & POLLIN) {
  ------------------
  |  Branch (133:13): [True: 1.95k, False: 106]
  ------------------
  134|  1.95k|            mp_flush_wakeup_pipe(pipe_fd);
  135|       |
  136|  1.95k|            while (1) {
  ------------------
  |  Branch (136:20): [True: 1.95k, Folded]
  ------------------
  137|  1.95k|                mpv_event *event = mpv_wait_event(arg->client, 0);
  138|       |
  139|  1.95k|                if (event->event_id == MPV_EVENT_NONE)
  ------------------
  |  Branch (139:21): [True: 1.90k, False: 48]
  ------------------
  140|  1.90k|                    break;
  141|       |
  142|     48|                if (event->event_id == MPV_EVENT_SHUTDOWN)
  ------------------
  |  Branch (142:21): [True: 48, False: 0]
  ------------------
  143|     48|                    goto done;
  144|       |
  145|      0|                if (!arg->writable)
  ------------------
  |  Branch (145:21): [True: 0, False: 0]
  ------------------
  146|      0|                    continue;
  147|       |
  148|      0|                char *event_msg = mp_json_encode_event(event);
  149|      0|                if (!event_msg) {
  ------------------
  |  Branch (149:21): [True: 0, False: 0]
  ------------------
  150|      0|                    MP_ERR(arg, "Encoding error\n");
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  151|      0|                    goto done;
  152|      0|                }
  153|       |
  154|      0|                rc = ipc_write_str(arg, event_msg);
  155|      0|                talloc_free(event_msg);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  156|      0|                if (rc < 0) {
  ------------------
  |  Branch (156:21): [True: 0, False: 0]
  ------------------
  157|      0|                    MP_ERR(arg, "Write error (%s)\n", mp_strerror(errno));
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  158|      0|                    goto done;
  159|      0|                }
  160|      0|            }
  161|  1.95k|        }
  162|       |
  163|  2.01k|        if (fds[1].revents & (POLLIN | POLLHUP | POLLNVAL)) {
  ------------------
  |  Branch (163:13): [True: 1.90k, False: 106]
  ------------------
  164|  1.90k|            while (1) {
  ------------------
  |  Branch (164:20): [True: 1.90k, Folded]
  ------------------
  165|  1.90k|                char buf[128];
  166|  1.90k|                bstr append = { buf, 0 };
  167|       |
  168|  1.90k|                ssize_t bytes = read(arg->client_fd, buf, sizeof(buf));
  169|  1.90k|                if (bytes < 0) {
  ------------------
  |  Branch (169:21): [True: 0, False: 1.90k]
  ------------------
  170|      0|                    if (errno == EAGAIN)
  ------------------
  |  Branch (170:25): [True: 0, False: 0]
  ------------------
  171|      0|                        break;
  172|       |
  173|      0|                    MP_ERR(arg, "Read error (%s)\n", mp_strerror(errno));
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  174|      0|                    goto done;
  175|      0|                }
  176|       |
  177|  1.90k|                if (bytes == 0) {
  ------------------
  |  Branch (177:21): [True: 1.90k, False: 0]
  ------------------
  178|  1.90k|                    MP_VERBOSE(arg, "Client disconnected\n");
  ------------------
  |  |   92|  1.90k|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  1.90k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  179|  1.90k|                    goto done;
  180|  1.90k|                }
  181|       |
  182|      0|                append.len = bytes;
  183|       |
  184|      0|                bstr_xappend(NULL, &client_msg, append);
  185|       |
  186|      0|                while (bstrchr(client_msg, '\n') != -1) {
  ------------------
  |  Branch (186:24): [True: 0, False: 0]
  ------------------
  187|      0|                    char *reply_msg = mp_ipc_consume_next_command(arg->client,
  188|      0|                        NULL, &client_msg);
  189|       |
  190|      0|                    if (reply_msg && arg->writable) {
  ------------------
  |  Branch (190:25): [True: 0, False: 0]
  |  Branch (190:38): [True: 0, False: 0]
  ------------------
  191|      0|                        rc = ipc_write_str(arg, reply_msg);
  192|      0|                        if (rc < 0) {
  ------------------
  |  Branch (192:29): [True: 0, False: 0]
  ------------------
  193|      0|                            MP_ERR(arg, "Write error (%s)\n", mp_strerror(errno));
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  194|      0|                            talloc_free(reply_msg);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  195|      0|                            goto done;
  196|      0|                        }
  197|      0|                    }
  198|       |
  199|      0|                    talloc_free(reply_msg);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  200|      0|                }
  201|      0|            }
  202|  1.90k|        }
  203|  2.01k|    }
  204|       |
  205|  1.95k|done:
  206|  1.95k|    if (client_msg.len > 0)
  ------------------
  |  Branch (206:9): [True: 0, False: 1.95k]
  ------------------
  207|  1.95k|        MP_WARN(arg, "Ignoring unterminated command on disconnect.\n");
  ------------------
  |  |   90|      0|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  208|  1.95k|    talloc_free(client_msg.start);
  ------------------
  |  |   47|  1.95k|#define talloc_free                     ta_free
  ------------------
  209|  1.95k|    if (arg->close_client_fd)
  ------------------
  |  Branch (209:9): [True: 1.95k, False: 0]
  ------------------
  210|  1.95k|        close(arg->client_fd);
  211|  1.95k|    struct mpv_handle *h = arg->client;
  212|  1.95k|    bool quit = arg->quit_on_close;
  213|  1.95k|    talloc_free(arg);
  ------------------
  |  |   47|  1.95k|#define talloc_free                     ta_free
  ------------------
  214|  1.95k|    if (quit) {
  ------------------
  |  Branch (214:9): [True: 0, False: 1.95k]
  ------------------
  215|      0|        mpv_terminate_destroy(h);
  216|  1.95k|    } else {
  217|  1.95k|        mpv_destroy(h);
  218|  1.95k|    }
  219|       |    MP_THREAD_RETURN();
  ------------------
  |  |  212|  1.95k|#define MP_THREAD_RETURN() return NULL
  ------------------
  220|  1.95k|}

mp_input_get_key_from_name:
  247|  58.8k|{
  248|  58.8k|    int modifiers = 0;
  249|  58.8k|    const char *p;
  250|  63.2k|    while ((p = strchr(name, '+'))) {
  ------------------
  |  Branch (250:12): [True: 5.79k, False: 57.4k]
  ------------------
  251|  15.9k|        for (const struct key_name *m = modifier_names; m->name; m++)
  ------------------
  |  Branch (251:57): [True: 14.6k, False: 1.38k]
  ------------------
  252|  14.6k|            if (!bstrcasecmp(bstr0(m->name),
  ------------------
  |  Branch (252:17): [True: 4.41k, False: 10.1k]
  ------------------
  253|  14.6k|                             (struct bstr){(char *)name, p - name})) {
  254|  4.41k|                modifiers |= m->key;
  255|  4.41k|                goto found;
  256|  4.41k|            }
  257|  1.38k|        if (!strcmp(name, "+"))
  ------------------
  |  Branch (257:13): [True: 722, False: 658]
  ------------------
  258|    722|            return '+' + modifiers;
  259|    658|        return -1;
  260|  4.41k|found:
  261|  4.41k|        name = p + 1;
  262|  4.41k|    }
  263|       |
  264|  57.4k|    struct bstr bname = bstr0(name);
  265|       |
  266|  57.4k|    struct bstr rest;
  267|  57.4k|    int code = bstr_decode_utf8(bname, &rest);
  268|  57.4k|    if (code >= 0 && rest.len == 0)
  ------------------
  |  Branch (268:9): [True: 56.5k, False: 889]
  |  Branch (268:22): [True: 25.5k, False: 30.9k]
  ------------------
  269|  25.5k|        return mp_normalize_keycode(code + modifiers);
  270|       |
  271|  31.8k|    if (bstr_startswith0(bname, "0x")) {
  ------------------
  |  Branch (271:9): [True: 264, False: 31.5k]
  ------------------
  272|    264|        char *end;
  273|    264|        long long val = strtoll(name, &end, 16);
  274|    264|        if (name == end || val > INT_MAX || val < INT_MIN)
  ------------------
  |  Branch (274:13): [True: 0, False: 264]
  |  Branch (274:28): [True: 11, False: 253]
  |  Branch (274:45): [True: 0, False: 253]
  ------------------
  275|     11|            return -1;
  276|    253|        long long keycode = val + modifiers;
  277|    253|        if (keycode > INT_MAX || keycode < INT_MIN)
  ------------------
  |  Branch (277:13): [True: 0, False: 253]
  |  Branch (277:34): [True: 0, False: 253]
  ------------------
  278|      0|            return -1;
  279|    253|        return mp_normalize_keycode(keycode);
  280|    253|    }
  281|       |
  282|  5.02M|    for (int i = 0; key_names[i].name != NULL; i++) {
  ------------------
  |  Branch (282:21): [True: 4.99M, False: 24.4k]
  ------------------
  283|  4.99M|        if (strcasecmp(key_names[i].name, name) == 0)
  ------------------
  |  Branch (283:13): [True: 7.16k, False: 4.99M]
  ------------------
  284|  7.16k|            return mp_normalize_keycode(key_names[i].key + modifiers);
  285|  4.99M|    }
  286|       |
  287|  24.4k|    return -1;
  288|  31.5k|}
mp_input_get_key_combo_name:
  322|  32.7k|{
  323|  32.7k|    bstr dst = {0};
  324|  35.8k|    while (max > 0) {
  ------------------
  |  Branch (324:12): [True: 35.8k, False: 0]
  ------------------
  325|  35.8k|        mp_input_append_key_name(&dst, *keys);
  326|  35.8k|        if (--max && *++keys)
  ------------------
  |  Branch (326:13): [True: 3.10k, False: 32.7k]
  |  Branch (326:22): [True: 3.10k, False: 0]
  ------------------
  327|  3.10k|            bstr_xappend(NULL, &dst, bstr0("-"));
  328|  32.7k|        else
  329|  32.7k|            break;
  330|  35.8k|    }
  331|  32.7k|    return dst.start;
  332|  32.7k|}
mp_input_get_keys_from_string:
  336|  45.5k|{
  337|  45.5k|    char *end, *ptr;
  338|  45.5k|    int n = 0;
  339|       |
  340|  45.5k|    ptr = name;
  341|  45.5k|    n = 0;
  342|  58.8k|    for (end = strchr(ptr, '-'); ; end = strchr(ptr, '-')) {
  343|  58.8k|        if (end && end[1] != '\0') {
  ------------------
  |  Branch (343:13): [True: 24.1k, False: 34.6k]
  |  Branch (343:20): [True: 23.9k, False: 214]
  ------------------
  344|  23.9k|            if (*ptr == '-' && end[1] == '-')
  ------------------
  |  Branch (344:17): [True: 11.4k, False: 12.5k]
  |  Branch (344:32): [True: 11.0k, False: 394]
  ------------------
  345|  11.0k|                end = &end[1];
  346|  23.9k|            end[0] = '\0';
  347|  23.9k|        }
  348|  58.8k|        keys[n] = mp_input_get_key_from_name(ptr);
  349|  58.8k|        if (keys[n] < 0)
  ------------------
  |  Branch (349:13): [True: 25.0k, False: 33.7k]
  ------------------
  350|  25.0k|            return 0;
  351|  33.7k|        n++;
  352|  33.7k|        if (end && end[1] != '\0' && n < max_num_keys)
  ------------------
  |  Branch (352:13): [True: 13.5k, False: 20.1k]
  |  Branch (352:20): [True: 13.3k, False: 204]
  |  Branch (352:38): [True: 13.3k, False: 30]
  ------------------
  353|  13.3k|            ptr = &end[1];
  354|  20.4k|        else
  355|  20.4k|            break;
  356|  33.7k|    }
  357|  20.4k|    *out_num_keys = n;
  358|  20.4k|    return 1;
  359|  45.5k|}
mp_print_key_list:
  362|    483|{
  363|    483|    mp_info(out, "\n");
  ------------------
  |  |   78|    483|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  364|  91.2k|    for (int i = 0; key_names[i].name != NULL; i++)
  ------------------
  |  Branch (364:21): [True: 90.8k, False: 483]
  ------------------
  365|  90.8k|        mp_info(out, "%s\n", key_names[i].name);
  ------------------
  |  |   78|  90.8k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  366|    483|}
mp_get_key_list:
  369|     45|{
  370|     45|    char **list = NULL;
  371|     45|    int num = 0;
  372|  8.50k|    for (int i = 0; key_names[i].name != NULL; i++)
  ------------------
  |  Branch (372:21): [True: 8.46k, False: 45]
  ------------------
  373|  8.46k|        MP_TARRAY_APPEND(NULL, list, num, talloc_strdup(NULL, key_names[i].name));
  ------------------
  |  |  105|  8.46k|    do {                                            \
  |  |  106|  8.46k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  8.46k|    do {                                            \
  |  |  |  |   97|  8.46k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  8.46k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  8.46k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  8.46k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 315, False: 8.14k]
  |  |  |  |  ------------------
  |  |  |  |   99|  8.46k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|    315|    do {                                                        \
  |  |  |  |  |  |   89|    315|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|    315|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|    315|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|    315|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    315|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|    315|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|    315|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 315]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  8.46k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 8.46k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  8.46k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  8.46k|        (idxvar)++;                                 \
  |  |  109|  8.46k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 8.46k]
  |  |  ------------------
  ------------------
  374|     45|    MP_TARRAY_APPEND(NULL, list, num, NULL);
  ------------------
  |  |  105|     45|    do {                                            \
  |  |  106|     45|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|     45|    do {                                            \
  |  |  |  |   97|     45|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|     45|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|     45|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|     45|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 45]
  |  |  |  |  ------------------
  |  |  |  |   99|     45|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|     45|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 45]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|     45|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|     45|        (idxvar)++;                                 \
  |  |  109|     45|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 45]
  |  |  ------------------
  ------------------
  375|     45|    return list;
  376|     45|}
mp_normalize_keycode:
  379|  33.0k|{
  380|  33.0k|    if (keycode <= 0)
  ------------------
  |  Branch (380:9): [True: 115, False: 32.8k]
  ------------------
  381|    115|        return keycode;
  382|  32.8k|    int code = keycode & ~MP_KEY_MODIFIER_MASK;
  ------------------
  |  |  264|  32.8k|#define MP_KEY_MODIFIER_MASK (MP_KEY_MODIFIER_SHIFT | MP_KEY_MODIFIER_CTRL | \
  |  |  ------------------
  |  |  |  |  245|  32.8k|#define MP_KEY_MODIFIER_SHIFT  (1u<<24)
  |  |  ------------------
  |  |               #define MP_KEY_MODIFIER_MASK (MP_KEY_MODIFIER_SHIFT | MP_KEY_MODIFIER_CTRL | \
  |  |  ------------------
  |  |  |  |  246|  32.8k|#define MP_KEY_MODIFIER_CTRL   (1u<<25)
  |  |  ------------------
  |  |  265|  32.8k|                              MP_KEY_MODIFIER_ALT | MP_KEY_MODIFIER_META | \
  |  |  ------------------
  |  |  |  |  247|  32.8k|#define MP_KEY_MODIFIER_ALT    (1u<<26)
  |  |  ------------------
  |  |                                             MP_KEY_MODIFIER_ALT | MP_KEY_MODIFIER_META | \
  |  |  ------------------
  |  |  |  |  248|  32.8k|#define MP_KEY_MODIFIER_META   (1u<<27)
  |  |  ------------------
  |  |  266|  32.8k|                              MP_KEY_STATE_DOWN | MP_KEY_STATE_UP)
  |  |  ------------------
  |  |  |  |  253|  32.8k|#define MP_KEY_STATE_DOWN      (1u<<28)
  |  |  ------------------
  |  |                                             MP_KEY_STATE_DOWN | MP_KEY_STATE_UP)
  |  |  ------------------
  |  |  |  |  259|  32.8k|#define MP_KEY_STATE_UP        (1u<<29)
  |  |  ------------------
  ------------------
  383|  32.8k|    int mod = keycode & MP_KEY_MODIFIER_MASK;
  ------------------
  |  |  264|  32.8k|#define MP_KEY_MODIFIER_MASK (MP_KEY_MODIFIER_SHIFT | MP_KEY_MODIFIER_CTRL | \
  |  |  ------------------
  |  |  |  |  245|  32.8k|#define MP_KEY_MODIFIER_SHIFT  (1u<<24)
  |  |  ------------------
  |  |               #define MP_KEY_MODIFIER_MASK (MP_KEY_MODIFIER_SHIFT | MP_KEY_MODIFIER_CTRL | \
  |  |  ------------------
  |  |  |  |  246|  32.8k|#define MP_KEY_MODIFIER_CTRL   (1u<<25)
  |  |  ------------------
  |  |  265|  32.8k|                              MP_KEY_MODIFIER_ALT | MP_KEY_MODIFIER_META | \
  |  |  ------------------
  |  |  |  |  247|  32.8k|#define MP_KEY_MODIFIER_ALT    (1u<<26)
  |  |  ------------------
  |  |                                             MP_KEY_MODIFIER_ALT | MP_KEY_MODIFIER_META | \
  |  |  ------------------
  |  |  |  |  248|  32.8k|#define MP_KEY_MODIFIER_META   (1u<<27)
  |  |  ------------------
  |  |  266|  32.8k|                              MP_KEY_STATE_DOWN | MP_KEY_STATE_UP)
  |  |  ------------------
  |  |  |  |  253|  32.8k|#define MP_KEY_STATE_DOWN      (1u<<28)
  |  |  ------------------
  |  |                                             MP_KEY_STATE_DOWN | MP_KEY_STATE_UP)
  |  |  ------------------
  |  |  |  |  259|  32.8k|#define MP_KEY_STATE_UP        (1u<<29)
  |  |  ------------------
  ------------------
  384|       |    /* On normal keyboards shift changes the character code of non-special
  385|       |     * keys, so don't count the modifier separately for those. In other words
  386|       |     * we want to have "a" and "A" instead of "a" and "Shift+A"; but a separate
  387|       |     * shift modifier is still kept for special keys like arrow keys. */
  388|  32.8k|    if (code >= 32 && code < MP_KEY_BASE) {
  ------------------
  |  |   23|  29.0k|#define MP_KEY_BASE (1<<21)
  ------------------
  |  Branch (388:9): [True: 29.0k, False: 3.89k]
  |  Branch (388:23): [True: 22.0k, False: 6.93k]
  ------------------
  389|       |        /* Still try to support ASCII case-modifications properly. For example,
  390|       |         * we want to change "Shift+a" to "A", not "a". Doing this for unicode
  391|       |         * in general would require huge lookup tables, or a libc with proper
  392|       |         * unicode support, so we don't do that. */
  393|  22.0k|        if (code >= 'a' && code <= 'z' && (mod & MP_KEY_MODIFIER_SHIFT))
  ------------------
  |  |  245|  4.07k|#define MP_KEY_MODIFIER_SHIFT  (1u<<24)
  ------------------
  |  Branch (393:13): [True: 4.35k, False: 17.7k]
  |  Branch (393:28): [True: 4.07k, False: 274]
  |  Branch (393:43): [True: 0, False: 4.07k]
  ------------------
  394|      0|            code &= 0x5F;
  395|  22.0k|        mod &= ~MP_KEY_MODIFIER_SHIFT;
  ------------------
  |  |  245|  22.0k|#define MP_KEY_MODIFIER_SHIFT  (1u<<24)
  ------------------
  396|  22.0k|    }
  397|  32.8k|    return code | mod;
  398|  33.0k|}
keycodes.c:mp_input_append_key_name:
  291|  35.8k|{
  292|   179k|    for (int i = 0; modifier_names[i].name; i++) {
  ------------------
  |  Branch (292:21): [True: 143k, False: 35.8k]
  ------------------
  293|   143k|        if (modifier_names[i].key & key) {
  ------------------
  |  Branch (293:13): [True: 8.50k, False: 134k]
  ------------------
  294|  8.50k|            bstr_xappend_asprintf(NULL, buf, "%s+", modifier_names[i].name);
  295|  8.50k|            key -= modifier_names[i].key;
  296|  8.50k|        }
  297|   143k|    }
  298|  4.98M|    for (int i = 0; key_names[i].name != NULL; i++) {
  ------------------
  |  Branch (298:21): [True: 4.95M, False: 22.3k]
  ------------------
  299|  4.95M|        if (key_names[i].key == key) {
  ------------------
  |  Branch (299:13): [True: 13.4k, False: 4.94M]
  ------------------
  300|  13.4k|            bstr_xappend_asprintf(NULL, buf, "%s", key_names[i].name);
  301|  13.4k|            return;
  302|  13.4k|        }
  303|  4.95M|    }
  304|       |
  305|  22.3k|    if (MP_KEY_IS_UNICODE(key)) {
  ------------------
  |  |   27|  22.3k|#define MP_KEY_IS_UNICODE(key) ((key) >= 32 && (key) <= 0x10FFFF)
  |  |  ------------------
  |  |  |  Branch (27:33): [True: 18.4k, False: 3.89k]
  |  |  |  Branch (27:48): [True: 18.4k, False: 31]
  |  |  ------------------
  ------------------
  306|  18.4k|        mp_append_utf8_bstr(NULL, buf, key);
  307|  18.4k|        return;
  308|  18.4k|    }
  309|       |
  310|       |    // Print the hex key code
  311|  3.92k|    bstr_xappend_asprintf(NULL, buf, "0x%x", key);
  312|  3.92k|}

bstrcmp:
   31|  24.1M|{
   32|  24.1M|    int ret = 0;
   33|  24.1M|    if (str1.len && str2.len)
  ------------------
  |  Branch (33:9): [True: 24.0M, False: 72.3k]
  |  Branch (33:21): [True: 24.0M, False: 17.8k]
  ------------------
   34|  24.0M|        ret = memcmp(str1.start, str2.start, MPMIN(str1.len, str2.len));
  ------------------
  |  |   45|  24.0M|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 6.55M, False: 17.5M]
  |  |  ------------------
  ------------------
   35|       |
   36|  24.1M|    if (!ret) {
  ------------------
  |  Branch (36:9): [True: 4.39M, False: 19.7M]
  ------------------
   37|  4.39M|        if (str1.len == str2.len)
  ------------------
  |  Branch (37:13): [True: 3.11M, False: 1.28M]
  ------------------
   38|  3.11M|            return 0;
   39|  1.28M|        else if (str1.len > str2.len)
  ------------------
  |  Branch (39:18): [True: 143k, False: 1.14M]
  ------------------
   40|   143k|            return 1;
   41|  1.14M|        else
   42|  1.14M|            return -1;
   43|  4.39M|    }
   44|  19.7M|    return ret;
   45|  24.1M|}
bstrcasecmp:
   48|   138k|{
   49|   138k|    int ret = 0;
   50|   138k|    if (str1.len && str2.len)
  ------------------
  |  Branch (50:9): [True: 80.3k, False: 58.5k]
  |  Branch (50:21): [True: 76.9k, False: 3.38k]
  ------------------
   51|  76.9k|        ret = strncasecmp(str1.start, str2.start, MPMIN(str1.len, str2.len));
  ------------------
  |  |   45|  76.9k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 9.96k, False: 66.9k]
  |  |  ------------------
  ------------------
   52|       |
   53|   138k|    if (!ret) {
  ------------------
  |  Branch (53:9): [True: 105k, False: 33.6k]
  ------------------
   54|   105k|        if (str1.len == str2.len)
  ------------------
  |  Branch (54:13): [True: 26.0k, False: 79.1k]
  ------------------
   55|  26.0k|            return 0;
   56|  79.1k|        else if (str1.len > str2.len)
  ------------------
  |  Branch (56:18): [True: 3.43k, False: 75.7k]
  ------------------
   57|  3.43k|            return 1;
   58|  75.7k|        else
   59|  75.7k|            return -1;
   60|   105k|    }
   61|  33.6k|    return ret;
   62|   138k|}
bstrchr:
   65|  4.75M|{
   66|  4.75M|    if (!str.len)
  ------------------
  |  Branch (66:9): [True: 1.38k, False: 4.74M]
  ------------------
   67|  1.38k|        return -1;
   68|  4.74M|    unsigned char *pos = memchr(str.start, c, str.len);
   69|  4.74M|    return pos ? pos - str.start : -1;
  ------------------
  |  Branch (69:12): [True: 3.10M, False: 1.64M]
  ------------------
   70|  4.75M|}
bstrrchr:
   73|  25.0k|{
   74|  25.0k|    if (!str.len)
  ------------------
  |  Branch (74:9): [True: 1.66k, False: 23.4k]
  ------------------
   75|  1.66k|        return -1;
   76|  23.4k|#if HAVE_MEMRCHR
   77|  23.4k|    unsigned char *pos = memrchr(str.start, c, str.len);
   78|  23.4k|    return pos ? pos - str.start : -1;
  ------------------
  |  Branch (78:12): [True: 10.1k, False: 13.3k]
  ------------------
   79|       |#else
   80|       |    for (int i = str.len - 1; i >= 0; i--)
   81|       |        if (str.start[i] == c)
   82|       |            return i;
   83|       |    return -1;
   84|       |#endif
   85|  25.0k|}
bstrcspn:
   88|   325k|{
   89|   325k|    int i;
   90|  4.78M|    for (i = 0; i < str.len; i++)
  ------------------
  |  Branch (90:17): [True: 4.75M, False: 27.4k]
  ------------------
   91|  4.75M|        if (strchr(reject, str.start[i]))
  ------------------
  |  Branch (91:13): [True: 297k, False: 4.46M]
  ------------------
   92|   297k|            break;
   93|   325k|    return i;
   94|   325k|}
bstrspn:
   97|  77.7k|{
   98|  77.7k|    int i;
   99|   322k|    for (i = 0; i < str.len; i++)
  ------------------
  |  Branch (99:17): [True: 281k, False: 41.1k]
  ------------------
  100|   281k|        if (!strchr(accept, str.start[i]))
  ------------------
  |  Branch (100:13): [True: 36.6k, False: 244k]
  ------------------
  101|  36.6k|            break;
  102|  77.7k|    return i;
  103|  77.7k|}
bstr_find:
  106|   546k|{
  107|  4.02M|    for (int i = 0; i < haystack.len; i++)
  ------------------
  |  Branch (107:21): [True: 3.76M, False: 258k]
  ------------------
  108|  3.76M|        if (bstr_startswith(bstr_splice(haystack, i, haystack.len), needle))
  ------------------
  |  Branch (108:13): [True: 288k, False: 3.47M]
  ------------------
  109|   288k|            return i;
  110|   258k|    return -1;
  111|   546k|}
bstr_lstrip:
  114|  6.62M|{
  115|  7.12M|    while (str.len && mp_isspace(*str.start)) {
  ------------------
  |  Branch (115:12): [True: 5.63M, False: 1.49M]
  |  Branch (115:23): [True: 502k, False: 5.13M]
  ------------------
  116|   502k|        str.start++;
  117|   502k|        str.len--;
  118|   502k|    }
  119|  6.62M|    return str;
  120|  6.62M|}
bstr_strip:
  123|  1.16M|{
  124|  1.16M|    str = bstr_lstrip(str);
  125|  2.27M|    while (str.len && mp_isspace(str.start[str.len - 1]))
  ------------------
  |  Branch (125:12): [True: 2.26M, False: 10.7k]
  |  Branch (125:23): [True: 1.10M, False: 1.15M]
  ------------------
  126|  1.10M|        str.len--;
  127|  1.16M|    return str;
  128|  1.16M|}
bstr_split:
  131|  52.3k|{
  132|  52.3k|    int start;
  133|  55.7k|    for (start = 0; start < str.len; start++)
  ------------------
  |  Branch (133:21): [True: 54.7k, False: 1.00k]
  ------------------
  134|  54.7k|        if (!strchr(sep, str.start[start]))
  ------------------
  |  Branch (134:13): [True: 51.3k, False: 3.38k]
  ------------------
  135|  51.3k|            break;
  136|  52.3k|    str = bstr_cut(str, start);
  137|  52.3k|    int end = bstrcspn(str, sep);
  138|  52.3k|    if (rest) {
  ------------------
  |  Branch (138:9): [True: 52.3k, False: 0]
  ------------------
  139|  52.3k|        *rest = bstr_cut(str, end);
  140|  52.3k|    }
  141|  52.3k|    return bstr_splice(str, 0, end);
  142|  52.3k|}
bstr_split_tok:
  148|   422k|{
  149|   422k|    bstr bsep = bstr0(tok);
  150|   422k|    int pos = bstr_find(str, bsep);
  151|   422k|    if (pos < 0)
  ------------------
  |  Branch (151:9): [True: 146k, False: 276k]
  ------------------
  152|   146k|        pos = str.len;
  153|   422k|    *out_left = bstr_splice(str, 0, pos);
  154|   422k|    *out_right = bstr_cut(str, pos + bsep.len);
  155|   422k|    return pos != str.len;
  156|   422k|}
bstr_splice:
  159|  10.3M|{
  160|  10.3M|    if (!str.len)
  ------------------
  |  Branch (160:9): [True: 5.47k, False: 10.2M]
  ------------------
  161|  5.47k|        return str;
  162|       |
  163|  10.2M|    if (start < 0)
  ------------------
  |  Branch (163:9): [True: 0, False: 10.2M]
  ------------------
  164|      0|        start += str.len;
  165|  10.2M|    if (end < 0)
  ------------------
  |  Branch (165:9): [True: 332, False: 10.2M]
  ------------------
  166|    332|        end += str.len;
  167|  10.2M|    end = MPMIN(end, str.len);
  ------------------
  |  |   45|  10.2M|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 615k, False: 9.68M]
  |  |  ------------------
  ------------------
  168|  10.2M|    start = MPMAX(start, 0);
  ------------------
  |  |   44|  10.2M|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 3.32M, False: 6.97M]
  |  |  ------------------
  ------------------
  169|  10.2M|    end = MPMAX(end, start);
  ------------------
  |  |   44|  10.2M|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 10.0M, False: 269k]
  |  |  ------------------
  ------------------
  170|  10.2M|    str.start += start;
  171|  10.2M|    str.len = end - start;
  172|  10.2M|    return str;
  173|  10.3M|}
bstrtoll:
  176|  46.9k|{
  177|  46.9k|    str = bstr_lstrip(str);
  178|  46.9k|    char buf[51];
  179|  46.9k|    int len = MPMIN(str.len, 50);
  ------------------
  |  |   45|  46.9k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 131, False: 46.7k]
  |  |  ------------------
  ------------------
  180|  46.9k|    memcpy(buf, str.start, len);
  181|  46.9k|    buf[len] = 0;
  182|  46.9k|    char *endptr;
  183|  46.9k|    long long r = strtoll(buf, &endptr, base);
  184|  46.9k|    if (rest)
  ------------------
  |  Branch (184:9): [True: 46.9k, False: 0]
  ------------------
  185|  46.9k|        *rest = bstr_cut(str, endptr - buf);
  186|  46.9k|    return r;
  187|  46.9k|}
bstrtod:
  190|   191k|{
  191|   191k|    str = bstr_lstrip(str);
  192|   191k|    char buf[101];
  193|   191k|    int len = MPMIN(str.len, 100);
  ------------------
  |  |   45|   191k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 24, False: 190k]
  |  |  ------------------
  ------------------
  194|   191k|    memcpy(buf, str.start, len);
  195|   191k|    buf[len] = 0;
  196|   191k|    char *endptr;
  197|   191k|    double r = strtod(buf, &endptr);
  198|   191k|    if (rest)
  ------------------
  |  Branch (198:9): [True: 191k, False: 0]
  ------------------
  199|   191k|        *rest = bstr_cut(str, endptr - buf);
  200|   191k|    return r;
  201|   191k|}
bstr_splitchar:
  204|  3.50M|{
  205|  3.50M|    int pos = bstrchr(str, c);
  206|  3.50M|    if (pos < 0)
  ------------------
  |  Branch (206:9): [True: 615k, False: 2.88M]
  ------------------
  207|   615k|        pos = str.len;
  208|  3.50M|    if (rest)
  ------------------
  |  Branch (208:9): [True: 3.50M, False: 0]
  ------------------
  209|  3.50M|        *rest = bstr_cut(str, pos + 1);
  210|  3.50M|    return bstr_splice(str, 0, pos + 1);
  211|  3.50M|}
bstr_strip_linebreaks:
  214|  1.71M|{
  215|  1.71M|    if (bstr_endswith0(str, "\r\n")) {
  ------------------
  |  Branch (215:9): [True: 644, False: 1.71M]
  ------------------
  216|    644|        str = bstr_splice(str, 0, str.len - 2);
  217|  1.71M|    } else if (bstr_endswith0(str, "\n")) {
  ------------------
  |  Branch (217:16): [True: 1.71M, False: 876]
  ------------------
  218|  1.71M|        str = bstr_splice(str, 0, str.len - 1);
  219|  1.71M|    }
  220|  1.71M|    return str;
  221|  1.71M|}
bstr_eatstart:
  224|  11.2M|{
  225|  11.2M|    if (!bstr_startswith(*s, prefix))
  ------------------
  |  Branch (225:9): [True: 9.54M, False: 1.75M]
  ------------------
  226|  9.54M|        return false;
  227|  1.75M|    *s = bstr_cut(*s, prefix.len);
  228|       |    return true;
  229|  11.2M|}
bstr_sscanf:
  246|  6.38k|{
  247|  6.38k|    char *ptr = bstrdup0(NULL, str);
  248|  6.38k|    va_list va;
  249|  6.38k|    va_start(va, format);
  250|  6.38k|    int ret = vsscanf(ptr, format, va);
  251|  6.38k|    va_end(va);
  252|  6.38k|    talloc_free(ptr);
  ------------------
  |  |   47|  6.38k|#define talloc_free                     ta_free
  ------------------
  253|  6.38k|    return ret;
  254|  6.38k|}
bstr_parse_utf8_code_length:
  257|   112M|{
  258|   112M|    if (b < 128)
  ------------------
  |  Branch (258:9): [True: 112M, False: 558k]
  ------------------
  259|   112M|        return 1;
  260|   558k|    int bytes = 7 - mp_log2(b ^ 255);
  261|   558k|    return (bytes >= 2 && bytes <= 4) ? bytes : -1;
  ------------------
  |  Branch (261:13): [True: 339k, False: 218k]
  |  Branch (261:27): [True: 136k, False: 203k]
  ------------------
  262|   112M|}
bstr_decode_partial_utf8:
  265|  2.85M|{
  266|  2.85M|    if (s->len == 0)
  ------------------
  |  Branch (266:9): [True: 394, False: 2.85M]
  ------------------
  267|    394|        return -1;
  268|  2.85M|    unsigned int codepoint = s->start[0];
  269|  2.85M|    s->start++; s->len--;
  270|  2.85M|    if (codepoint >= 128) {
  ------------------
  |  Branch (270:9): [True: 23.4k, False: 2.83M]
  ------------------
  271|  23.4k|        int bytes = bstr_parse_utf8_code_length(codepoint);
  272|  23.4k|        if (bytes < 1)
  ------------------
  |  Branch (272:13): [True: 8.17k, False: 15.2k]
  ------------------
  273|  8.17k|            return BSTR_DECODE_OUT_OF_RANGE;
  ------------------
  |  |   91|  8.17k|#define BSTR_DECODE_OUT_OF_RANGE -1
  ------------------
  274|  15.2k|        codepoint &= 127 >> bytes;
  275|  25.3k|        for (int n = 1; n < bytes; n++) {
  ------------------
  |  Branch (275:25): [True: 19.6k, False: 5.74k]
  ------------------
  276|  19.6k|            if (!s->len)
  ------------------
  |  Branch (276:17): [True: 332, False: 19.2k]
  ------------------
  277|    332|                return BSTR_DECODE_TRUNCATED_SEQUENCE;
  ------------------
  |  |   92|    332|#define BSTR_DECODE_TRUNCATED_SEQUENCE -2
  ------------------
  278|  19.2k|            int tmp = (unsigned char)s->start[0];
  279|  19.2k|            if ((tmp & 0xC0) != 0x80)
  ------------------
  |  Branch (279:17): [True: 9.18k, False: 10.0k]
  ------------------
  280|  9.18k|                return BSTR_DECODE_TRUNCATED_SEQUENCE;
  ------------------
  |  |   92|  9.18k|#define BSTR_DECODE_TRUNCATED_SEQUENCE -2
  ------------------
  281|  10.0k|            codepoint = (codepoint << 6) | (tmp & ~0xC0);
  282|  10.0k|            s->start++; s->len--;
  283|  10.0k|        }
  284|  5.74k|        if (codepoint > 0x10FFFF || (codepoint >= 0xD800 && codepoint <= 0xDFFF))
  ------------------
  |  Branch (284:13): [True: 207, False: 5.53k]
  |  Branch (284:38): [True: 1.42k, False: 4.11k]
  |  Branch (284:61): [True: 208, False: 1.21k]
  ------------------
  285|    415|            return BSTR_DECODE_OUT_OF_RANGE;
  ------------------
  |  |   91|    415|#define BSTR_DECODE_OUT_OF_RANGE -1
  ------------------
  286|       |
  287|       |        // Overlong sequences - check taken from libavcodec.
  288|  5.32k|        unsigned int min = bytes == 2 ? 0x80 : 1 << (5 * bytes - 4);
  ------------------
  |  Branch (288:28): [True: 2.93k, False: 2.39k]
  ------------------
  289|  5.32k|        if (codepoint < min)
  ------------------
  |  Branch (289:13): [True: 230, False: 5.09k]
  ------------------
  290|    230|            return BSTR_DECODE_OVERLONG_ENCODING;
  ------------------
  |  |   93|    230|#define BSTR_DECODE_OVERLONG_ENCODING -3
  ------------------
  291|  5.32k|    }
  292|  2.83M|    return codepoint;
  293|  2.85M|}
bstr_decode_utf8:
  296|  61.8k|{
  297|  61.8k|    int res = bstr_decode_partial_utf8(&s);
  298|  61.8k|    if (res >= 0 && out_next)
  ------------------
  |  Branch (298:9): [True: 58.8k, False: 2.94k]
  |  Branch (298:21): [True: 58.8k, False: 0]
  ------------------
  299|  58.8k|        *out_next = s;
  300|  61.8k|    return res;
  301|  61.8k|}
bstr_xappend:
  375|  4.62M|{
  376|  4.62M|    if (!append.len)
  ------------------
  |  Branch (376:9): [True: 7.57k, False: 4.61M]
  ------------------
  377|  7.57k|        return;
  378|  4.61M|    resize_append(talloc_ctx, s, append.len + 1);
  379|  4.61M|    memmove(s->start + s->len, append.start, append.len);
  380|  4.61M|    s->len += append.len;
  381|  4.61M|    s->start[s->len] = '\0';
  382|  4.61M|}
bstr_xappend_asprintf:
  385|   664k|{
  386|   664k|    va_list ap;
  387|   664k|    va_start(ap, fmt);
  388|   664k|    int ret = bstr_xappend_vasprintf(talloc_ctx, s, fmt, ap);
  389|       |    va_end(ap);
  390|   664k|    return ret;
  391|   664k|}
bstr_xappend_vasprintf:
  395|  2.43M|{
  396|  2.43M|    int size;
  397|  2.43M|    va_list copy;
  398|  2.43M|    va_copy(copy, ap);
  399|  2.43M|    size_t avail = talloc_get_size(s->start) - s->len;
  ------------------
  |  |   45|  2.43M|#define talloc_get_size                 ta_get_size
  ------------------
  400|  2.43M|    char *dest = s->start ? s->start + s->len : NULL;
  ------------------
  |  Branch (400:18): [True: 2.35M, False: 79.2k]
  ------------------
  401|  2.43M|    size = vsnprintf(dest, avail, fmt, copy);
  402|  2.43M|    va_end(copy);
  403|       |
  404|  2.43M|    if (size < 0)
  ------------------
  |  Branch (404:9): [True: 0, False: 2.43M]
  ------------------
  405|      0|        return size;
  406|       |
  407|  2.43M|    if (avail < 1 || size + 1 > avail) {
  ------------------
  |  Branch (407:9): [True: 79.2k, False: 2.35M]
  |  Branch (407:22): [True: 192k, False: 2.15M]
  ------------------
  408|   271k|        resize_append(talloc_ctx, s, size + 1);
  409|   271k|        vsnprintf(s->start + s->len, size + 1, fmt, ap);
  410|   271k|    }
  411|  2.43M|    s->len += size;
  412|  2.43M|    return size;
  413|  2.43M|}
bstr_decode_hex:
  440|    893|{
  441|    893|    if (!out)
  ------------------
  |  Branch (441:9): [True: 0, False: 893]
  ------------------
  442|      0|        return false;
  443|       |
  444|    893|    char *arr = talloc_array(talloc_ctx, char, hex.len / 2);
  ------------------
  |  |   29|    893|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|    893|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|    893|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  445|    893|    int len = 0;
  446|       |
  447|  88.8k|    while (hex.len >= 2) {
  ------------------
  |  Branch (447:12): [True: 87.9k, False: 861]
  ------------------
  448|  87.9k|        int a = h_to_i(hex.start[0]);
  449|  87.9k|        int b = h_to_i(hex.start[1]);
  450|  87.9k|        hex = bstr_splice(hex, 2, hex.len);
  451|       |
  452|  87.9k|        if (a < 0 || b < 0) {
  ------------------
  |  Branch (452:13): [True: 19, False: 87.9k]
  |  Branch (452:22): [True: 13, False: 87.9k]
  ------------------
  453|     32|            talloc_free(arr);
  ------------------
  |  |   47|     32|#define talloc_free                     ta_free
  ------------------
  454|     32|            return false;
  455|     32|        }
  456|       |
  457|  87.9k|        arr[len++] = (a << 4) | b;
  458|  87.9k|    }
  459|       |
  460|    861|    *out = (struct bstr){ .start = arr, .len = len };
  461|       |    return true;
  462|    893|}
bstr_find_in_list0:
  465|  2.24k|{
  466|  6.50k|    for (int n = 0; list && list[n]; n++)
  ------------------
  |  Branch (466:21): [True: 5.81k, False: 695]
  |  Branch (466:29): [True: 4.98k, False: 823]
  ------------------
  467|  4.98k|        if (case_sensitive ? !bstrcmp0(str, list[n]) : !bstrcasecmp0(str, list[n]))
  ------------------
  |  Branch (467:13): [True: 4.98k, False: 0]
  |  Branch (467:13): [True: 726, False: 4.26k]
  ------------------
  468|    726|            return n;
  469|       |
  470|  1.51k|    return -1;
  471|  2.24k|}
bstr.c:resize_append:
  362|  4.88M|{
  363|  4.88M|    size_t size = talloc_get_size(s->start);
  ------------------
  |  |   45|  4.88M|#define talloc_get_size                 ta_get_size
  ------------------
  364|  4.88M|    mp_assert(s->len <= size);
  ------------------
  |  |   41|  4.88M|#define mp_assert assert
  ------------------
  |  Branch (364:5): [True: 4.88M, False: 0]
  ------------------
  365|  4.88M|    if (append_min > size - s->len) {
  ------------------
  |  Branch (365:9): [True: 354k, False: 4.53M]
  ------------------
  366|   354k|        if (append_min < size)
  ------------------
  |  Branch (366:13): [True: 128k, False: 226k]
  ------------------
  367|   128k|            append_min = size; // preallocate in power of 2s
  368|   354k|        if (size >= SIZE_MAX / 2 || append_min >= SIZE_MAX / 2)
  ------------------
  |  Branch (368:13): [True: 0, False: 354k]
  |  Branch (368:37): [True: 0, False: 354k]
  ------------------
  369|      0|            abort(); // oom
  370|   354k|        s->start = talloc_realloc_size(talloc_ctx, s->start, size + append_min);
  ------------------
  |  |   39|   354k|#define talloc_realloc_size             ta_xrealloc_size
  |  |  ------------------
  |  |  |  |  158|   354k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   354k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|   354k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|   354k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  371|   354k|    }
  372|  4.88M|}
bstr.c:h_to_i:
  428|   175k|{
  429|   175k|    if (c >= '0' && c <= '9')
  ------------------
  |  Branch (429:9): [True: 175k, False: 17]
  |  Branch (429:21): [True: 127k, False: 48.1k]
  ------------------
  430|   127k|        return c - '0';
  431|  48.1k|    if (c >= 'a' && c <= 'f')
  ------------------
  |  Branch (431:9): [True: 32.5k, False: 15.6k]
  |  Branch (431:21): [True: 32.4k, False: 21]
  ------------------
  432|  32.4k|        return c - 'a' + 10;
  433|  15.6k|    if (c >= 'A' && c <= 'F')
  ------------------
  |  Branch (433:9): [True: 15.6k, False: 19]
  |  Branch (433:21): [True: 15.6k, False: 23]
  ------------------
  434|  15.6k|        return c - 'A' + 10;
  435|       |
  436|     42|    return -1; // invalid char
  437|  15.6k|}

chmap.c:bstr_eatstart0:
  291|  4.65k|{
  292|  4.65k|    return bstr_eatstart(s, bstr0(prefix));
  293|  4.65k|}
chmap.c:bstr_equals0:
  276|  82.4k|{
  277|  82.4k|    return bstr_equals(str1, bstr0(str2));
  278|  82.4k|}
chmap.c:bstr_equals:
  268|  82.4k|{
  269|  82.4k|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 64.1k, False: 18.2k]
  ------------------
  270|  64.1k|        return false;
  271|       |
  272|  18.2k|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 113, False: 18.1k]
  |  Branch (272:40): [True: 1.61k, False: 16.5k]
  ------------------
  273|  82.4k|}
chmap.c:bstr0:
   62|  87.3k|{
   63|  87.3k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 87.3k, False: 0]
  ------------------
   64|  87.3k|}
common.c:bstr0:
   62|     29|{
   63|     29|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 29, False: 0]
  ------------------
   64|     29|}
common.c:bstr_cut:
  227|  9.48k|{
  228|  9.48k|    if (n < 0) {
  ------------------
  |  Branch (228:9): [True: 0, False: 9.48k]
  ------------------
  229|      0|        n += str.len;
  230|      0|        if (n < 0)
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|      0|            n = 0;
  232|      0|    }
  233|  9.48k|    if (((size_t)n) > str.len)
  ------------------
  |  Branch (233:9): [True: 0, False: 9.48k]
  ------------------
  234|      0|        n = str.len;
  235|  9.48k|    return (struct bstr){str.start + n, str.len - n};
  236|  9.48k|}
msg.c:bstr_eatstart0:
  291|  1.15M|{
  292|  1.15M|    return bstr_eatstart(s, bstr0(prefix));
  293|  1.15M|}
msg.c:bstr0:
   62|  1.15M|{
   63|  1.15M|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 1.15M, False: 0]
  ------------------
   64|  1.15M|}
msg.c:bstr_getline:
  156|  1.76M|{
  157|  1.76M|    return bstr_splitchar(str, rest, '\n');
  158|  1.76M|}
msg.c:bstrdup0:
   40|   952k|{
   41|   952k|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|   952k|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|   952k|}
playlist.c:bstr0:
   62|  55.0k|{
   63|  55.0k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 55.0k, False: 0]
  ------------------
   64|  55.0k|}
playlist.c:bstrdup:
   52|  26.6k|{
   53|  26.6k|    struct bstr r = { NULL, str.len };
   54|  26.6k|    if (str.start)
  ------------------
  |  Branch (54:9): [True: 26.6k, False: 0]
  ------------------
   55|  26.6k|        r.start = (unsigned char *)talloc_memdup(talloc_ctx, str.start, str.len);
  ------------------
  |  |   49|  26.6k|#define talloc_memdup                   ta_xmemdup
  |  |  ------------------
  |  |  |  |  157|  26.6k|#define ta_xmemdup(...)         ta_dbg_set_loc(ta_xmemdup(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  26.6k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|  26.6k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|  26.6k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   56|  26.6k|    return r;
   57|  26.6k|}
cmd.c:bstr_equals0:
  276|   454k|{
  277|   454k|    return bstr_equals(str1, bstr0(str2));
  278|   454k|}
cmd.c:bstr_equals:
  268|   454k|{
  269|   454k|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 423k, False: 31.5k]
  ------------------
  270|   423k|        return false;
  271|       |
  272|  31.5k|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 0, False: 31.5k]
  |  Branch (272:40): [True: 1.02k, False: 30.5k]
  ------------------
  273|   454k|}
cmd.c:bstr0:
   62|   703k|{
   63|   703k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 703k, False: 0]
  ------------------
   64|   703k|}
cmd.c:bstr_cut:
  227|  43.2k|{
  228|  43.2k|    if (n < 0) {
  ------------------
  |  Branch (228:9): [True: 0, False: 43.2k]
  ------------------
  229|      0|        n += str.len;
  230|      0|        if (n < 0)
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|      0|            n = 0;
  232|      0|    }
  233|  43.2k|    if (((size_t)n) > str.len)
  ------------------
  |  Branch (233:9): [True: 1, False: 43.2k]
  ------------------
  234|      1|        n = str.len;
  235|  43.2k|    return (struct bstr){str.start + n, str.len - n};
  236|  43.2k|}
cmd.c:bstr_eatstart0:
  291|   182k|{
  292|   182k|    return bstr_eatstart(s, bstr0(prefix));
  293|   182k|}
cmd.c:bstrto0:
   46|  38.4k|{
   47|  38.4k|    return str.start ? bstrdup0(talloc_ctx, str) : talloc_strdup(talloc_ctx, "");
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (47:12): [True: 38.4k, False: 0]
  ------------------
   48|  38.4k|}
cmd.c:bstrdup0:
   40|  38.4k|{
   41|  38.4k|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|  38.4k|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|  38.4k|}
cmd.c:bstr_startswith0:
  246|  9.77k|{
  247|  9.77k|    return bstr_startswith(str, bstr0(prefix));
  248|  9.77k|}
cmd.c:bstr_startswith:
  239|  9.77k|{
  240|  9.77k|    if (str.len < prefix.len)
  ------------------
  |  Branch (240:9): [True: 66, False: 9.70k]
  ------------------
  241|     66|        return false;
  242|  9.70k|    return !memcmp(str.start, prefix.start, prefix.len);
  243|  9.77k|}
input.c:bstrdup:
   52|  17.2k|{
   53|  17.2k|    struct bstr r = { NULL, str.len };
   54|  17.2k|    if (str.start)
  ------------------
  |  Branch (54:9): [True: 17.2k, False: 0]
  ------------------
   55|  17.2k|        r.start = (unsigned char *)talloc_memdup(talloc_ctx, str.start, str.len);
  ------------------
  |  |   49|  17.2k|#define talloc_memdup                   ta_xmemdup
  |  |  ------------------
  |  |  |  |  157|  17.2k|#define ta_xmemdup(...)         ta_dbg_set_loc(ta_xmemdup(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  17.2k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|  17.2k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|  17.2k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   56|  17.2k|    return r;
   57|  17.2k|}
input.c:bstr0:
   62|   254k|{
   63|   254k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 238k, False: 16.4k]
  ------------------
   64|   254k|}
input.c:bstrdup0:
   40|  65.9k|{
   41|  65.9k|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|  65.9k|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|  65.9k|}
input.c:bstr_equals0:
  276|     64|{
  277|     64|    return bstr_equals(str1, bstr0(str2));
  278|     64|}
input.c:bstr_cut:
  227|  1.20k|{
  228|  1.20k|    if (n < 0) {
  ------------------
  |  Branch (228:9): [True: 0, False: 1.20k]
  ------------------
  229|      0|        n += str.len;
  230|      0|        if (n < 0)
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|      0|            n = 0;
  232|      0|    }
  233|  1.20k|    if (((size_t)n) > str.len)
  ------------------
  |  Branch (233:9): [True: 0, False: 1.20k]
  ------------------
  234|      0|        n = str.len;
  235|  1.20k|    return (struct bstr){str.start + n, str.len - n};
  236|  1.20k|}
input.c:bstr_getline:
  156|  76.3k|{
  157|  76.3k|    return bstr_splitchar(str, rest, '\n');
  158|  76.3k|}
input.c:bstr_eatstart0:
  291|  70.6k|{
  292|  70.6k|    return bstr_eatstart(s, bstr0(prefix));
  293|  70.6k|}
input.c:bstr_startswith0:
  246|  89.9k|{
  247|  89.9k|    return bstr_startswith(str, bstr0(prefix));
  248|  89.9k|}
input.c:bstr_startswith:
  239|  89.9k|{
  240|  89.9k|    if (str.len < prefix.len)
  ------------------
  |  Branch (240:9): [True: 0, False: 89.9k]
  ------------------
  241|      0|        return false;
  242|  89.9k|    return !memcmp(str.start, prefix.start, prefix.len);
  243|  89.9k|}
input.c:bstr_equals:
  268|  41.9k|{
  269|  41.9k|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 4.01k, False: 37.8k]
  ------------------
  270|  4.01k|        return false;
  271|       |
  272|  37.8k|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 16.9k, False: 20.9k]
  |  Branch (272:40): [True: 20.0k, False: 861]
  ------------------
  273|  41.9k|}
keycodes.c:bstr0:
   62|   107k|{
   63|   107k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 107k, False: 0]
  ------------------
   64|   107k|}
keycodes.c:bstr_startswith0:
  246|  31.8k|{
  247|  31.8k|    return bstr_startswith(str, bstr0(prefix));
  248|  31.8k|}
keycodes.c:bstr_startswith:
  239|  31.8k|{
  240|  31.8k|    if (str.len < prefix.len)
  ------------------
  |  Branch (240:9): [True: 783, False: 31.0k]
  ------------------
  241|    783|        return false;
  242|  31.0k|    return !memcmp(str.start, prefix.start, prefix.len);
  243|  31.8k|}
bstr.c:bstr_startswith:
  239|  15.0M|{
  240|  15.0M|    if (str.len < prefix.len)
  ------------------
  |  Branch (240:9): [True: 1.05M, False: 14.0M]
  ------------------
  241|  1.05M|        return false;
  242|  14.0M|    return !memcmp(str.start, prefix.start, prefix.len);
  243|  15.0M|}
bstr.c:bstr_cut:
  227|  6.02M|{
  228|  6.02M|    if (n < 0) {
  ------------------
  |  Branch (228:9): [True: 0, False: 6.02M]
  ------------------
  229|      0|        n += str.len;
  230|      0|        if (n < 0)
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|      0|            n = 0;
  232|      0|    }
  233|  6.02M|    if (((size_t)n) > str.len)
  ------------------
  |  Branch (233:9): [True: 761k, False: 5.26M]
  ------------------
  234|   761k|        n = str.len;
  235|  6.02M|    return (struct bstr){str.start + n, str.len - n};
  236|  6.02M|}
bstr.c:bstr0:
   62|  3.85M|{
   63|  3.85M|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 3.85M, False: 0]
  ------------------
   64|  3.85M|}
bstr.c:bstr_endswith0:
  258|  3.43M|{
  259|  3.43M|    return bstr_endswith(str, bstr0(suffix));
  260|  3.43M|}
bstr.c:bstr_endswith:
  251|  3.43M|{
  252|  3.43M|    if (str.len < suffix.len)
  ------------------
  |  Branch (252:9): [True: 219k, False: 3.21M]
  ------------------
  253|   219k|        return false;
  254|  3.21M|    return !memcmp(str.start + str.len - suffix.len, suffix.start, suffix.len);
  255|  3.43M|}
bstr.c:bstrdup0:
   40|  6.38k|{
   41|  6.38k|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|  6.38k|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|  6.38k|}
bstr.c:bstrcmp0:
  263|  4.98k|{
  264|  4.98k|    return bstrcmp(str1, bstr0(str2));
  265|  4.98k|}
codepoint_width.c:bstr_eatstart0:
  291|  2.79M|{
  292|  2.79M|    return bstr_eatstart(s, bstr0(prefix));
  293|  2.79M|}
codepoint_width.c:bstr0:
   62|  2.79M|{
   63|  2.79M|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 2.79M, False: 0]
  ------------------
   64|  2.79M|}
codepoint_width.c:bstr_cut:
  227|  1.91k|{
  228|  1.91k|    if (n < 0) {
  ------------------
  |  Branch (228:9): [True: 0, False: 1.91k]
  ------------------
  229|      0|        n += str.len;
  230|      0|        if (n < 0)
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|      0|            n = 0;
  232|      0|    }
  233|  1.91k|    if (((size_t)n) > str.len)
  ------------------
  |  Branch (233:9): [True: 0, False: 1.91k]
  ------------------
  234|      0|        n = str.len;
  235|  1.91k|    return (struct bstr){str.start + n, str.len - n};
  236|  1.91k|}
json.c:bstr0:
   62|  3.28M|{
   63|  3.28M|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 3.28M, False: 155]
  ------------------
   64|  3.28M|}
node.c:bstr0:
   62|  79.3k|{
   63|  79.3k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 79.3k, False: 0]
  ------------------
   64|  79.3k|}
node.c:bstrdup0:
   40|  93.3k|{
   41|  93.3k|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|  93.3k|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|  93.3k|}
node.c:bstrto0:
   46|  12.2k|{
   47|  12.2k|    return str.start ? bstrdup0(talloc_ctx, str) : talloc_strdup(talloc_ctx, "");
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (47:12): [True: 12.2k, False: 0]
  ------------------
   48|  12.2k|}
path_utils.c:bstr0:
   62|   359k|{
   63|   359k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 359k, False: 0]
  ------------------
   64|   359k|}
path_utils.c:bstrdup0:
   40|  41.7k|{
   41|  41.7k|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|  41.7k|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|  41.7k|}
path_utils.c:bstr_find0:
  286|   119k|{
  287|   119k|    return bstr_find(haystack, bstr0(needle));
  288|   119k|}
m_config_frontend.c:bstr0:
   62|   118M|{
   63|   118M|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 118M, False: 0]
  ------------------
   64|   118M|}
m_config_frontend.c:bstrcmp0:
  263|  21.2M|{
  264|  21.2M|    return bstrcmp(str1, bstr0(str2));
  265|  21.2M|}
m_config_frontend.c:bstr_eatstart0:
  291|   319k|{
  292|   319k|    return bstr_eatstart(s, bstr0(prefix));
  293|   319k|}
m_config_frontend.c:bstr_startswith:
  239|  90.1M|{
  240|  90.1M|    if (str.len < prefix.len)
  ------------------
  |  Branch (240:9): [True: 64.5M, False: 25.6M]
  ------------------
  241|  64.5M|        return false;
  242|  25.6M|    return !memcmp(str.start, prefix.start, prefix.len);
  243|  90.1M|}
m_config_frontend.c:bstr_endswith:
  251|   524k|{
  252|   524k|    if (str.len < suffix.len)
  ------------------
  |  Branch (252:9): [True: 1.32k, False: 522k]
  ------------------
  253|  1.32k|        return false;
  254|   522k|    return !memcmp(str.start + str.len - suffix.len, suffix.start, suffix.len);
  255|   524k|}
m_config_frontend.c:bstr_equals0:
  276|  5.09M|{
  277|  5.09M|    return bstr_equals(str1, bstr0(str2));
  278|  5.09M|}
m_config_frontend.c:bstr_equals:
  268|  5.09M|{
  269|  5.09M|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 4.61M, False: 480k]
  ------------------
  270|  4.61M|        return false;
  271|       |
  272|   480k|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 16.4k, False: 464k]
  |  Branch (272:40): [True: 61.0k, False: 403k]
  ------------------
  273|  5.09M|}
m_config_frontend.c:bstrto0:
   46|  1.93M|{
   47|  1.93M|    return str.start ? bstrdup0(talloc_ctx, str) : talloc_strdup(talloc_ctx, "");
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (47:12): [True: 1.93M, False: 0]
  ------------------
   48|  1.93M|}
m_config_frontend.c:bstrdup0:
   40|  1.93M|{
   41|  1.93M|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|  1.93M|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|  1.93M|}
m_option.c:bstr_equals0:
  276|  2.89M|{
  277|  2.89M|    return bstr_equals(str1, bstr0(str2));
  278|  2.89M|}
m_option.c:bstr_equals:
  268|  3.00M|{
  269|  3.00M|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 2.26M, False: 737k]
  ------------------
  270|  2.26M|        return false;
  271|       |
  272|   737k|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 65.1k, False: 672k]
  |  Branch (272:40): [True: 558k, False: 114k]
  ------------------
  273|  3.00M|}
m_option.c:bstr0:
   62|  7.91M|{
   63|  7.91M|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 7.78M, False: 125k]
  ------------------
   64|  7.91M|}
m_option.c:bstrcasecmp0:
  281|  52.5k|{
  282|  52.5k|    return bstrcasecmp(str1, bstr0(str2));
  283|  52.5k|}
m_option.c:bstrcmp0:
  263|  1.20M|{
  264|  1.20M|    return bstrcmp(str1, bstr0(str2));
  265|  1.20M|}
m_option.c:bstr_eatstart0:
  291|  1.74M|{
  292|  1.74M|    return bstr_eatstart(s, bstr0(prefix));
  293|  1.74M|}
m_option.c:bstrdup0:
   40|   634k|{
   41|   634k|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|   634k|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|   634k|}
m_option.c:bstr_endswith0:
  258|  1.70M|{
  259|  1.70M|    return bstr_endswith(str, bstr0(suffix));
  260|  1.70M|}
m_option.c:bstr_endswith:
  251|  1.70M|{
  252|  1.70M|    if (str.len < suffix.len)
  ------------------
  |  Branch (252:9): [True: 448k, False: 1.25M]
  ------------------
  253|   448k|        return false;
  254|  1.25M|    return !memcmp(str.start + str.len - suffix.len, suffix.start, suffix.len);
  255|  1.70M|}
m_option.c:bstr_cut:
  227|   598k|{
  228|   598k|    if (n < 0) {
  ------------------
  |  Branch (228:9): [True: 0, False: 598k]
  ------------------
  229|      0|        n += str.len;
  230|      0|        if (n < 0)
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|      0|            n = 0;
  232|      0|    }
  233|   598k|    if (((size_t)n) > str.len)
  ------------------
  |  Branch (233:9): [True: 73.8k, False: 524k]
  ------------------
  234|  73.8k|        n = str.len;
  235|   598k|    return (struct bstr){str.start + n, str.len - n};
  236|   598k|}
m_option.c:bstrdup:
   52|  74.9k|{
   53|  74.9k|    struct bstr r = { NULL, str.len };
   54|  74.9k|    if (str.start)
  ------------------
  |  Branch (54:9): [True: 74.9k, False: 0]
  ------------------
   55|  74.9k|        r.start = (unsigned char *)talloc_memdup(talloc_ctx, str.start, str.len);
  ------------------
  |  |   49|  74.9k|#define talloc_memdup                   ta_xmemdup
  |  |  ------------------
  |  |  |  |  157|  74.9k|#define ta_xmemdup(...)         ta_dbg_set_loc(ta_xmemdup(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  74.9k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|  74.9k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|  74.9k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   56|  74.9k|    return r;
   57|  74.9k|}
m_option.c:bstr_startswith0:
  246|  15.5k|{
  247|  15.5k|    return bstr_startswith(str, bstr0(prefix));
  248|  15.5k|}
m_option.c:bstr_startswith:
  239|  15.5k|{
  240|  15.5k|    if (str.len < prefix.len)
  ------------------
  |  Branch (240:9): [True: 1.07k, False: 14.5k]
  ------------------
  241|  1.07k|        return false;
  242|  14.5k|    return !memcmp(str.start, prefix.start, prefix.len);
  243|  15.5k|}
m_option.c:bstrto0:
   46|   421k|{
   47|   421k|    return str.start ? bstrdup0(talloc_ctx, str) : talloc_strdup(talloc_ctx, "");
  ------------------
  |  |   50|  1.18k|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (47:12): [True: 419k, False: 1.18k]
  ------------------
   48|   421k|}
m_option.c:bstr_find0:
  286|  4.38k|{
  287|  4.38k|    return bstr_find(haystack, bstr0(needle));
  288|  4.38k|}
m_property.c:bstrcmp0:
  263|  73.0k|{
  264|  73.0k|    return bstrcmp(str1, bstr0(str2));
  265|  73.0k|}
m_property.c:bstr0:
   62|   318k|{
   63|   318k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 316k, False: 1.42k]
  ------------------
   64|   318k|}
m_property.c:bstr_eatstart0:
  291|   175k|{
  292|   175k|    return bstr_eatstart(s, bstr0(prefix));
  293|   175k|}
m_property.c:bstr_startswith0:
  246|  51.8k|{
  247|  51.8k|    return bstr_startswith(str, bstr0(prefix));
  248|  51.8k|}
m_property.c:bstr_startswith:
  239|  51.8k|{
  240|  51.8k|    if (str.len < prefix.len)
  ------------------
  |  Branch (240:9): [True: 1.19k, False: 50.6k]
  ------------------
  241|  1.19k|        return false;
  242|  50.6k|    return !memcmp(str.start, prefix.start, prefix.len);
  243|  51.8k|}
m_property.c:bstr_cut:
  227|  58.3k|{
  228|  58.3k|    if (n < 0) {
  ------------------
  |  Branch (228:9): [True: 0, False: 58.3k]
  ------------------
  229|      0|        n += str.len;
  230|      0|        if (n < 0)
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|      0|            n = 0;
  232|      0|    }
  233|  58.3k|    if (((size_t)n) > str.len)
  ------------------
  |  Branch (233:9): [True: 0, False: 58.3k]
  ------------------
  234|      0|        n = str.len;
  235|  58.3k|    return (struct bstr){str.start + n, str.len - n};
  236|  58.3k|}
m_property.c:bstrdup0:
   40|  6.97k|{
   41|  6.97k|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|  6.97k|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|  6.97k|}
m_property.c:bstr_equals0:
  276|    134|{
  277|    134|    return bstr_equals(str1, bstr0(str2));
  278|    134|}
m_property.c:bstr_equals:
  268|    134|{
  269|    134|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 80, False: 54]
  ------------------
  270|     80|        return false;
  271|       |
  272|     54|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 0, False: 54]
  |  Branch (272:40): [True: 0, False: 54]
  ------------------
  273|    134|}
parse_commandline.c:bstr0:
   62|  1.64M|{
   63|  1.64M|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 1.37M, False: 267k]
  ------------------
   64|  1.64M|}
parse_commandline.c:bstr_startswith0:
  246|   267k|{
  247|   267k|    return bstr_startswith(str, bstr0(prefix));
  248|   267k|}
parse_commandline.c:bstr_startswith:
  239|   267k|{
  240|   267k|    if (str.len < prefix.len)
  ------------------
  |  Branch (240:9): [True: 1.99k, False: 265k]
  ------------------
  241|  1.99k|        return false;
  242|   265k|    return !memcmp(str.start, prefix.start, prefix.len);
  243|   267k|}
parse_commandline.c:bstr_eatstart0:
  291|   309k|{
  292|   309k|    return bstr_eatstart(s, bstr0(prefix));
  293|   309k|}
parse_commandline.c:bstrcmp0:
  263|   435k|{
  264|   435k|    return bstrcmp(str1, bstr0(str2));
  265|   435k|}
parse_commandline.c:bstrdup0:
   40|  54.9k|{
   41|  54.9k|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|  54.9k|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|  54.9k|}
parse_configfile.c:bstr_eatstart0:
  291|  4.41M|{
  292|  4.41M|    return bstr_eatstart(s, bstr0(prefix));
  293|  4.41M|}
parse_configfile.c:bstr0:
   62|  9.41M|{
   63|  9.41M|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 9.41M, False: 0]
  ------------------
   64|  9.41M|}
parse_configfile.c:bstr_getline:
  156|  1.65M|{
  157|  1.65M|    return bstr_splitchar(str, rest, '\n');
  158|  1.65M|}
parse_configfile.c:bstr_startswith0:
  246|  5.00M|{
  247|  5.00M|    return bstr_startswith(str, bstr0(prefix));
  248|  5.00M|}
parse_configfile.c:bstr_startswith:
  239|  5.00M|{
  240|  5.00M|    if (str.len < prefix.len)
  ------------------
  |  Branch (240:9): [True: 1.45M, False: 3.54M]
  ------------------
  241|  1.45M|        return false;
  242|  3.54M|    return !memcmp(str.start, prefix.start, prefix.len);
  243|  5.00M|}
parse_configfile.c:bstrto0:
   46|   196k|{
   47|   196k|    return str.start ? bstrdup0(talloc_ctx, str) : talloc_strdup(talloc_ctx, "");
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (47:12): [True: 196k, False: 0]
  ------------------
   48|   196k|}
parse_configfile.c:bstrdup0:
   40|   196k|{
   41|   196k|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|   196k|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|   196k|}
parse_configfile.c:bstr_cut:
  227|  13.0M|{
  228|  13.0M|    if (n < 0) {
  ------------------
  |  Branch (228:9): [True: 0, False: 13.0M]
  ------------------
  229|      0|        n += str.len;
  230|      0|        if (n < 0)
  ------------------
  |  Branch (230:13): [True: 0, False: 0]
  ------------------
  231|      0|            n = 0;
  232|      0|    }
  233|  13.0M|    if (((size_t)n) > str.len)
  ------------------
  |  Branch (233:9): [True: 0, False: 13.0M]
  ------------------
  234|      0|        n = str.len;
  235|  13.0M|    return (struct bstr){str.start + n, str.len - n};
  236|  13.0M|}
path.c:bstr0:
   62|   606k|{
   63|   606k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 570k, False: 35.4k]
  ------------------
   64|   606k|}
path.c:bstr_eatstart0:
  291|   104k|{
  292|   104k|    return bstr_eatstart(s, bstr0(prefix));
  293|   104k|}
path.c:bstr_equals0:
  276|  78.8k|{
  277|  78.8k|    return bstr_equals(str1, bstr0(str2));
  278|  78.8k|}
path.c:bstr_equals:
  268|  78.8k|{
  269|  78.8k|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 71.4k, False: 7.32k]
  ------------------
  270|  71.4k|        return false;
  271|       |
  272|  7.32k|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 0, False: 7.32k]
  |  Branch (272:40): [True: 6.44k, False: 874]
  ------------------
  273|  78.8k|}
client.c:bstr0:
   62|  16.4k|{
   63|  16.4k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 16.4k, False: 0]
  ------------------
   64|  16.4k|}
command.c:bstr_eatstart0:
  291|  2.90k|{
  292|  2.90k|    return bstr_eatstart(s, bstr0(prefix));
  293|  2.90k|}
command.c:bstr_equals0:
  276|    573|{
  277|    573|    return bstr_equals(str1, bstr0(str2));
  278|    573|}
command.c:bstr_equals:
  268|    573|{
  269|    573|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 384, False: 189]
  ------------------
  270|    384|        return false;
  271|       |
  272|    189|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 0, False: 189]
  |  Branch (272:40): [True: 85, False: 104]
  ------------------
  273|    573|}
command.c:bstr0:
   62|   391k|{
   63|   391k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 390k, False: 760]
  ------------------
   64|   391k|}
configfiles.c:bstr0:
   62|  10.1k|{
   63|  10.1k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 10.1k, False: 0]
  ------------------
   64|  10.1k|}
main.c:bstr0:
   62|  16.4k|{
   63|  16.4k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 16.4k, False: 0]
  ------------------
   64|  16.4k|}
misc.c:bstr0:
   62|  8.16k|{
   63|  8.16k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 8.16k, False: 0]
  ------------------
   64|  8.16k|}
osd.c:bstr0:
   62|  1.27k|{
   63|  1.27k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 638, False: 638]
  ------------------
   64|  1.27k|}
osd.c:bstr_equals:
  268|    638|{
  269|    638|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 44, False: 594]
  ------------------
  270|     44|        return false;
  271|       |
  272|    594|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 0, False: 594]
  |  Branch (272:40): [True: 594, False: 0]
  ------------------
  273|    638|}
scripting.c:bstrcasecmp0:
  281|  16.3k|{
  282|  16.3k|    return bstrcasecmp(str1, bstr0(str2));
  283|  16.3k|}
scripting.c:bstr0:
   62|  34.1k|{
   63|  34.1k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 34.1k, False: 0]
  ------------------
   64|  34.1k|}
video.c:bstr0:
   62|    442|{
   63|    442|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 442, False: 0]
  ------------------
   64|    442|}
video.c:bstr_equals:
  268|    221|{
  269|    221|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 211, False: 10]
  ------------------
  270|    211|        return false;
  271|       |
  272|     10|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 0, False: 10]
  |  Branch (272:40): [True: 1, False: 9]
  ------------------
  273|    221|}
video.c:bstr_equals0:
  276|    221|{
  277|    221|    return bstr_equals(str1, bstr0(str2));
  278|    221|}
stream.c:bstr0:
   62|  2.41k|{
   63|  2.41k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 2.41k, False: 0]
  ------------------
   64|  2.41k|}
stream_aes_ctr.c:bstr0:
   62|     19|{
   63|     19|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 19, False: 0]
  ------------------
   64|     19|}
stream_cb.c:bstr0:
   62|  2.10k|{
   63|  2.10k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 2.10k, False: 0]
  ------------------
   64|  2.10k|}
stream_cb.c:bstrto0:
   46|  2.10k|{
   47|  2.10k|    return str.start ? bstrdup0(talloc_ctx, str) : talloc_strdup(talloc_ctx, "");
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (47:12): [True: 2.10k, False: 0]
  ------------------
   48|  2.10k|}
stream_cb.c:bstrdup0:
   40|  2.10k|{
   41|  2.10k|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|  2.10k|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|  2.10k|}
stream_file.c:bstrcasecmp0:
  281|  55.3k|{
  282|  55.3k|    return bstrcasecmp(str1, bstr0(str2));
  283|  55.3k|}
stream_file.c:bstr0:
   62|  56.1k|{
   63|  56.1k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 56.1k, False: 0]
  ------------------
   64|  56.1k|}
stream_file.c:bstrto0:
   46|    631|{
   47|    631|    return str.start ? bstrdup0(talloc_ctx, str) : talloc_strdup(talloc_ctx, "");
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (47:12): [True: 631, False: 0]
  ------------------
   48|    631|}
stream_file.c:bstrdup0:
   40|    631|{
   41|    631|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|    631|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|    631|}
stream_file.c:bstr_startswith0:
  246|    250|{
  247|    250|    return bstr_startswith(str, bstr0(prefix));
  248|    250|}
stream_file.c:bstr_startswith:
  239|    250|{
  240|    250|    if (str.len < prefix.len)
  ------------------
  |  Branch (240:9): [True: 187, False: 63]
  ------------------
  241|    187|        return false;
  242|     63|    return !memcmp(str.start, prefix.start, prefix.len);
  243|    250|}
stream_lavf.c:bstr0:
   62|  26.2k|{
   63|  26.2k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 26.2k, False: 0]
  ------------------
   64|  26.2k|}
stream_lavf.c:bstr_eatstart0:
  291|  12.1k|{
  292|  12.1k|    return bstr_eatstart(s, bstr0(prefix));
  293|  12.1k|}
stream_lavf.c:bstr_equals0:
  276|  10.1k|{
  277|  10.1k|    return bstr_equals(str1, bstr0(str2));
  278|  10.1k|}
stream_lavf.c:bstr_equals:
  268|  10.1k|{
  269|  10.1k|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 9.71k, False: 386]
  ------------------
  270|  9.71k|        return false;
  271|       |
  272|    386|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 0, False: 386]
  |  Branch (272:40): [True: 37, False: 349]
  ------------------
  273|  10.1k|}
stream_memory.c:bstr0:
   62|  1.84k|{
   63|  1.84k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 1.84k, False: 0]
  ------------------
   64|  1.84k|}
stream_memory.c:bstr_eatstart0:
  291|    932|{
  292|    932|    return bstr_eatstart(s, bstr0(prefix));
  293|    932|}
stream_memory.c:bstrdup:
   52|    911|{
   53|    911|    struct bstr r = { NULL, str.len };
   54|    911|    if (str.start)
  ------------------
  |  Branch (54:9): [True: 911, False: 0]
  ------------------
   55|    911|        r.start = (unsigned char *)talloc_memdup(talloc_ctx, str.start, str.len);
  ------------------
  |  |   49|    911|#define talloc_memdup                   ta_xmemdup
  |  |  ------------------
  |  |  |  |  157|    911|#define ta_xmemdup(...)         ta_dbg_set_loc(ta_xmemdup(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    911|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|    911|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|    911|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   56|    911|    return r;
   57|    911|}
stream_env.c:bstr0:
   62|      2|{
   63|      2|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 2, False: 0]
  ------------------
   64|      2|}
stream_env.c:bstr_eatstart0:
  291|      1|{
  292|      1|    return bstr_eatstart(s, bstr0(prefix));
  293|      1|}
stream_env.c:bstrdup0:
   40|      1|{
   41|      1|    return talloc_strndup(talloc_ctx, (char *)str.start, str.len);
  ------------------
  |  |   51|      1|#define talloc_strndup                  ta_xstrndup
  ------------------
   42|      1|}
csputils.c:bstr0:
   62|    276|{
   63|    276|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 276, False: 0]
  ------------------
   64|    276|}
hwdec.c:bstr0:
   62|  1.41k|{
   63|  1.41k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 1.41k, False: 0]
  ------------------
   64|  1.41k|}
hwdec.c:bstr_equals:
  268|  1.00k|{
  269|  1.00k|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 661, False: 347]
  ------------------
  270|    661|        return false;
  271|       |
  272|    347|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 0, False: 347]
  |  Branch (272:40): [True: 243, False: 104]
  ------------------
  273|  1.00k|}
hwdec.c:bstr_equals0:
  276|  1.00k|{
  277|  1.00k|    return bstr_equals(str1, bstr0(str2));
  278|  1.00k|}
img_format.c:bstr_equals0:
  276|  49.1k|{
  277|  49.1k|    return bstr_equals(str1, bstr0(str2));
  278|  49.1k|}
img_format.c:bstr0:
   62|  49.1k|{
   63|  49.1k|    return (struct bstr){(unsigned char *)s, s ? strlen(s) : 0};
  ------------------
  |  Branch (63:46): [True: 49.1k, False: 0]
  ------------------
   64|  49.1k|}
img_format.c:bstr_equals:
  268|  51.1k|{
  269|  51.1k|    if (str1.len != str2.len)
  ------------------
  |  Branch (269:9): [True: 47.4k, False: 3.64k]
  ------------------
  270|  47.4k|        return false;
  271|       |
  272|  3.64k|    return str1.start == str2.start || bstrcmp(str1, str2) == 0;
  ------------------
  |  Branch (272:12): [True: 0, False: 3.64k]
  |  Branch (272:40): [True: 169, False: 3.47k]
  ------------------
  273|  51.1k|}

term_disp_width:
  681|  33.5k|{
  682|  33.5k|    static const int ambiguous_width = 1;
  683|       |
  684|  33.5k|    int width = 0;
  685|       |
  686|  33.5k|    const unsigned char *prev_pos = str.start;
  687|  2.83M|    while (str.len) {
  ------------------
  |  Branch (687:12): [True: 2.79M, False: 33.5k]
  ------------------
  688|  2.79M|        int current_width = 0;
  689|       |
  690|  2.79M|        if (bstr_eatstart0(&str, "\033[")) {
  ------------------
  |  Branch (690:13): [True: 1.70k, False: 2.79M]
  ------------------
  691|  1.91k|            while (str.len && !((*str.start >= '@' && *str.start <= '~') || *str.start == 'm'))
  ------------------
  |  Branch (691:20): [True: 1.91k, False: 0]
  |  Branch (691:34): [True: 1.70k, False: 209]
  |  Branch (691:55): [True: 1.70k, False: 0]
  |  Branch (691:77): [True: 0, False: 209]
  ------------------
  692|    209|                str = bstr_cut(str, 1);
  693|  1.70k|            str = bstr_cut(str, 1);
  694|  1.70k|            goto next;
  695|  1.70k|        }
  696|       |
  697|  2.79M|        prev_pos = str.start;
  698|  2.79M|        int cp = bstr_decode_partial_utf8(&str);
  699|       |
  700|       |        // Assume the terminal replaces maximal ill-formed subparts with
  701|       |        // a single U+FFFD replacement character as described in
  702|       |        // https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/#G66453
  703|  2.79M|        if (cp < 0) {
  ------------------
  |  Branch (703:13): [True: 15.7k, False: 2.77M]
  ------------------
  704|  15.7k|            struct bstr partial = {(unsigned char *)prev_pos, str.start - prev_pos};
  705|  15.7k|            if (cp == BSTR_DECODE_TRUNCATED_SEQUENCE &&
  ------------------
  |  |   92|  31.5k|#define BSTR_DECODE_TRUNCATED_SEQUENCE -2
  ------------------
  |  Branch (705:17): [True: 7.36k, False: 8.42k]
  ------------------
  706|  7.36k|                is_valid_partial_sequence(partial))
  ------------------
  |  Branch (706:17): [True: 6.94k, False: 421]
  ------------------
  707|  6.94k|            {
  708|       |                // This is a truncated but initially well-formed sequence,
  709|       |                // should be replaced with a single U+FFFD.
  710|  6.94k|                current_width = 1;
  711|  8.84k|            } else {
  712|       |                // Otherwise each byte should be replaced individually.
  713|  8.84k|                current_width = partial.len;
  714|  8.84k|            }
  715|  15.7k|            goto next;
  716|  15.7k|        }
  717|       |
  718|  2.77M|        if (cp == '\r') {
  ------------------
  |  Branch (718:13): [True: 201, False: 2.77M]
  ------------------
  719|    201|            width = 0;
  720|    201|            goto next;
  721|    201|        }
  722|       |
  723|  2.77M|        if (cp == '\t') {
  ------------------
  |  Branch (723:13): [True: 204, False: 2.77M]
  ------------------
  724|       |            // Assume tabstop width is 8
  725|    204|            current_width = 8 - width % 8;
  726|    204|            goto next;
  727|    204|        }
  728|       |
  729|  2.77M|        if (cp < 0x20)
  ------------------
  |  Branch (729:13): [True: 33.5k, False: 2.74M]
  ------------------
  730|  33.5k|            goto next;
  731|       |
  732|  2.74M|        if (cp <= 0x7E) {
  ------------------
  |  Branch (732:13): [True: 2.74M, False: 3.78k]
  ------------------
  733|  2.74M|            current_width = 1;
  734|  2.74M|            goto next;
  735|  2.74M|        }
  736|       |
  737|  3.78k|        int state = 0;
  738|       |
  739|  4.38k|        while (true) {
  ------------------
  |  Branch (739:16): [True: 4.38k, Folded]
  ------------------
  740|  4.38k|            int lead = ucdLookup(cp);
  741|  4.38k|            int w = ucdToCharacterWidth(lead);
  742|  4.38k|            if (w == 3)
  ------------------
  |  Branch (742:17): [True: 2.05k, False: 2.33k]
  ------------------
  743|  2.05k|                w = ambiguous_width;
  744|       |
  745|       |            // U+FE0F Variation Selector-16 is used to turn unqualified Emojis into qualified ones.
  746|       |            // By convention, this turns them from being ambiguous width (= narrow) into wide ones.
  747|       |            // We achieve this here by explicitly giving this codepoint a wide width.
  748|       |            // Later down below we'll clamp width back to <= 2.
  749|  4.38k|            if (cp == 0xFE0F)
  ------------------
  |  Branch (749:17): [True: 535, False: 3.85k]
  ------------------
  750|    535|                w = 2;
  751|       |
  752|  4.38k|            current_width += w;
  753|       |
  754|  4.38k|            if (!str.len)
  ------------------
  |  Branch (754:17): [True: 0, False: 4.38k]
  ------------------
  755|      0|                break;
  756|       |
  757|       |            // Fetch next codepoint in grapheme cluster
  758|  4.38k|            bstr cluster_end;
  759|  4.38k|            cp = bstr_decode_utf8(str, &cluster_end);
  760|       |            // Invalid sequences end the current grapheme.
  761|  4.38k|            if (cp < 0)
  ------------------
  |  Branch (761:17): [True: 2.05k, False: 2.33k]
  ------------------
  762|  2.05k|                break;
  763|  2.33k|            int trail = ucdLookup(cp);
  764|       |
  765|  2.33k|            state = ucdGraphemeJoins(state, lead, trail);
  766|  2.33k|            if (ucdGraphemeDone(state))
  ------------------
  |  Branch (766:17): [True: 1.72k, False: 601]
  ------------------
  767|  1.72k|                break;
  768|       |
  769|    601|            str = cluster_end;
  770|    601|        }
  771|       |
  772|  3.78k|        current_width = MPMIN(current_width, 2);
  ------------------
  |  |   45|  3.78k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 399, False: 3.38k]
  |  |  ------------------
  ------------------
  773|  2.79M|next:
  774|  2.79M|        if (width + current_width > max_width) {
  ------------------
  |  Branch (774:13): [True: 0, False: 2.79M]
  ------------------
  775|      0|            mp_assert(prev_pos < str.start + str.len);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (775:13): [True: 0, False: 0]
  ------------------
  776|      0|            *cut_pos = prev_pos;
  777|      0|            break;
  778|      0|        }
  779|  2.79M|        width += current_width;
  780|  2.79M|        if (width == max_width) {
  ------------------
  |  Branch (780:13): [True: 0, False: 2.79M]
  ------------------
  781|      0|            if (str.len)
  ------------------
  |  Branch (781:17): [True: 0, False: 0]
  ------------------
  782|      0|                *cut_pos = str.start;
  783|      0|            break;
  784|      0|        }
  785|  2.79M|    }
  786|       |
  787|  33.5k|    return width;
  788|  33.5k|}
codepoint_width.c:is_valid_partial_sequence:
  665|  7.36k|{
  666|  7.36k|    if (seq.len < 2)
  ------------------
  |  Branch (666:9): [True: 6.31k, False: 1.04k]
  ------------------
  667|  6.31k|        return true;
  668|       |
  669|  1.04k|    if (seq.start[0] == 0xE0)
  ------------------
  |  Branch (669:9): [True: 200, False: 846]
  ------------------
  670|    200|        return seq.start[1] >= 0xA0;
  671|    846|    else if (seq.start[0] == 0xED)
  ------------------
  |  Branch (671:14): [True: 225, False: 621]
  ------------------
  672|    225|        return seq.start[1] <= 0x9F;
  673|    621|    else if (seq.start[0] == 0xF0)
  ------------------
  |  Branch (673:14): [True: 194, False: 427]
  ------------------
  674|    194|        return seq.start[1] >= 0x90;
  675|    427|    else if (seq.start[0] == 0xF4)
  ------------------
  |  Branch (675:14): [True: 196, False: 231]
  ------------------
  676|    196|        return seq.start[1] <= 0x8F;
  677|    231|    return true;
  678|  1.04k|}
codepoint_width.c:ucdLookup:
  618|  6.71k|{
  619|  6.71k|    const uint16_t s0 = s_stage0[cp >> 11];
  620|  6.71k|    const uint16_t s1 = s_stage1[s0 + ((cp >> 6) & 31)];
  621|  6.71k|    const uint16_t s2 = s_stage2[s1 + ((cp >> 3) & 7)];
  622|  6.71k|    const uint8_t s3 = s_stage3[s2 + ((cp >> 0) & 7)];
  623|  6.71k|    return s3;
  624|  6.71k|}
codepoint_width.c:ucdToCharacterWidth:
  636|  4.38k|{
  637|  4.38k|    return val >> 6;
  638|  4.38k|}
codepoint_width.c:ucdGraphemeJoins:
  626|  2.33k|{
  627|  2.33k|    const int l = lead & 15;
  628|  2.33k|    const int t = trail & 15;
  629|  2.33k|    return (s_joinRules[state][l] >> (t * 2)) & 3;
  630|  2.33k|}
codepoint_width.c:ucdGraphemeDone:
  632|  2.33k|{
  633|  2.33k|    return state == 3;
  634|  2.33k|}

bstr.c:mp_isspace:
    8|  7.89M|static inline int mp_isspace(char c) { return c == ' ' || c == '\f' || c == '\n' ||
  ------------------
  |  Branch (8:47): [True: 1.60M, False: 6.29M]
  |  Branch (8:59): [True: 300, False: 6.29M]
  |  Branch (8:72): [True: 0, False: 6.29M]
  ------------------
    9|  6.29M|                                              c == '\r' || c == '\t' || c =='\v'; }
  ------------------
  |  Branch (9:47): [True: 5.15k, False: 6.28M]
  |  Branch (9:60): [True: 2.63k, False: 6.28M]
  |  Branch (9:73): [True: 619, False: 6.28M]
  ------------------
path_utils.c:mp_isalpha:
   13|  66.9k|static inline int mp_isalpha(char c) { return mp_isupper(c) || mp_islower(c); }
  ------------------
  |  Branch (13:47): [True: 6.19k, False: 60.7k]
  |  Branch (13:64): [True: 53.6k, False: 7.04k]
  ------------------
path_utils.c:mp_isupper:
   10|  66.9k|static inline int mp_isupper(char c) { return c >= 'A' && c <= 'Z'; }
  ------------------
  |  Branch (10:47): [True: 60.2k, False: 6.69k]
  |  Branch (10:59): [True: 6.19k, False: 54.0k]
  ------------------
path_utils.c:mp_islower:
   11|  60.7k|static inline int mp_islower(char c) { return c >= 'a' && c <= 'z'; }
  ------------------
  |  Branch (11:47): [True: 53.9k, False: 6.72k]
  |  Branch (11:59): [True: 53.6k, False: 321]
  ------------------
path_utils.c:mp_isalnum:
   14|  55.8k|static inline int mp_isalnum(char c) { return mp_isalpha(c) || mp_isdigit(c); }
  ------------------
  |  Branch (14:47): [True: 50.0k, False: 5.77k]
  |  Branch (14:64): [True: 2.04k, False: 3.72k]
  ------------------
path_utils.c:mp_isdigit:
   12|  5.77k|static inline int mp_isdigit(char c) { return c >= '0' && c <= '9'; }
  ------------------
  |  Branch (12:47): [True: 2.11k, False: 3.65k]
  |  Branch (12:59): [True: 2.04k, False: 75]
  ------------------
parse_configfile.c:mp_isalnum:
   14|  14.1M|static inline int mp_isalnum(char c) { return mp_isalpha(c) || mp_isdigit(c); }
  ------------------
  |  Branch (14:47): [True: 11.9M, False: 2.18M]
  |  Branch (14:64): [True: 0, False: 2.18M]
  ------------------
parse_configfile.c:mp_isalpha:
   13|  14.1M|static inline int mp_isalpha(char c) { return mp_isupper(c) || mp_islower(c); }
  ------------------
  |  Branch (13:47): [True: 0, False: 14.1M]
  |  Branch (13:64): [True: 11.9M, False: 2.18M]
  ------------------
parse_configfile.c:mp_isupper:
   10|  14.1M|static inline int mp_isupper(char c) { return c >= 'A' && c <= 'Z'; }
  ------------------
  |  Branch (10:47): [True: 11.9M, False: 2.18M]
  |  Branch (10:59): [True: 0, False: 11.9M]
  ------------------
parse_configfile.c:mp_islower:
   11|  14.1M|static inline int mp_islower(char c) { return c >= 'a' && c <= 'z'; }
  ------------------
  |  Branch (11:47): [True: 11.9M, False: 2.18M]
  |  Branch (11:59): [True: 11.9M, False: 0]
  ------------------
parse_configfile.c:mp_isdigit:
   12|  2.18M|static inline int mp_isdigit(char c) { return c >= '0' && c <= '9'; }
  ------------------
  |  Branch (12:47): [True: 1.04M, False: 1.13M]
  |  Branch (12:59): [True: 0, False: 1.04M]
  ------------------
client.c:mp_isalnum:
   14|   120k|static inline int mp_isalnum(char c) { return mp_isalpha(c) || mp_isdigit(c); }
  ------------------
  |  Branch (14:47): [True: 111k, False: 8.76k]
  |  Branch (14:64): [True: 1.31k, False: 7.45k]
  ------------------
client.c:mp_isalpha:
   13|   120k|static inline int mp_isalpha(char c) { return mp_isupper(c) || mp_islower(c); }
  ------------------
  |  Branch (13:47): [True: 1.70k, False: 118k]
  |  Branch (13:64): [True: 109k, False: 8.76k]
  ------------------
client.c:mp_isupper:
   10|   120k|static inline int mp_isupper(char c) { return c >= 'A' && c <= 'Z'; }
  ------------------
  |  Branch (10:47): [True: 118k, False: 1.31k]
  |  Branch (10:59): [True: 1.70k, False: 117k]
  ------------------
client.c:mp_islower:
   11|   118k|static inline int mp_islower(char c) { return c >= 'a' && c <= 'z'; }
  ------------------
  |  Branch (11:47): [True: 109k, False: 8.76k]
  |  Branch (11:59): [True: 109k, False: 0]
  ------------------
client.c:mp_isdigit:
   12|  8.76k|static inline int mp_isdigit(char c) { return c >= '0' && c <= '9'; }
  ------------------
  |  Branch (12:47): [True: 8.76k, False: 0]
  |  Branch (12:59): [True: 1.31k, False: 7.45k]
  ------------------

mp_dispatch_create:
   84|  16.4k|{
   85|  16.4k|    struct mp_dispatch_queue *queue = talloc_ptrtype(ta_parent, queue);
  ------------------
  |  |   34|  16.4k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  16.4k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   86|  16.4k|    *queue = (struct mp_dispatch_queue){0};
   87|  16.4k|    talloc_set_destructor(queue, queue_dtor);
  ------------------
  |  |   41|  16.4k|#define talloc_set_destructor           ta_set_destructor
  ------------------
   88|  16.4k|    mp_mutex_init(&queue->lock);
   89|  16.4k|    mp_cond_init(&queue->cond);
   90|  16.4k|    return queue;
   91|  16.4k|}
mp_dispatch_cancel_fn:
  220|  11.3k|{
  221|  11.3k|    mp_mutex_lock(&queue->lock);
  ------------------
  |  |  134|  11.3k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  222|  11.3k|    struct mp_dispatch_item **pcur = &queue->head;
  223|  11.3k|    queue->tail = NULL;
  224|  11.3k|    while (*pcur) {
  ------------------
  |  Branch (224:12): [True: 0, False: 11.3k]
  ------------------
  225|      0|        struct mp_dispatch_item *cur = *pcur;
  226|      0|        if (cur->fn == fn && cur->fn_data == fn_data) {
  ------------------
  |  Branch (226:13): [True: 0, False: 0]
  |  Branch (226:30): [True: 0, False: 0]
  ------------------
  227|      0|            *pcur = cur->next;
  228|      0|            talloc_free(cur);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  229|      0|        } else {
  230|      0|            queue->tail = cur;
  231|      0|            pcur = &cur->next;
  232|      0|        }
  233|      0|    }
  234|  11.3k|    mp_mutex_unlock(&queue->lock);
  ------------------
  |  |  136|  11.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  235|  11.3k|}
mp_dispatch_queue_process:
  273|  33.9k|{
  274|  33.9k|    mp_mutex_lock(&queue->lock);
  ------------------
  |  |  134|  33.9k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  275|  33.9k|    queue->wait = timeout > 0 ? mp_time_ns_add(mp_time_ns(), timeout) : 0;
  ------------------
  |  Branch (275:19): [True: 17.5k, False: 16.4k]
  ------------------
  276|  33.9k|    mp_assert(!queue->in_process); // recursion not allowed
  ------------------
  |  |   41|  33.9k|#define mp_assert assert
  ------------------
  |  Branch (276:5): [True: 33.9k, False: 0]
  ------------------
  277|  33.9k|    queue->in_process = true;
  278|  33.9k|    queue->in_process_thread_id = mp_thread_current_id();
  ------------------
  |  |  217|  33.9k|#define mp_thread_current_id      pthread_self
  ------------------
  279|       |    // Wake up thread which called mp_dispatch_lock().
  280|  33.9k|    if (queue->lock_requests)
  ------------------
  |  Branch (280:9): [True: 16.7k, False: 17.2k]
  ------------------
  281|  16.7k|        mp_cond_broadcast(&queue->cond);
  282|  98.2k|    while (1) {
  ------------------
  |  Branch (282:12): [True: 98.2k, Folded]
  ------------------
  283|  98.2k|        if (queue->lock_requests) {
  ------------------
  |  Branch (283:13): [True: 47.3k, False: 50.9k]
  ------------------
  284|       |            // Block due to something having called mp_dispatch_lock().
  285|  47.3k|            mp_cond_wait(&queue->cond, &queue->lock);
  286|  50.9k|        } else if (queue->head) {
  ------------------
  |  Branch (286:20): [True: 0, False: 50.9k]
  ------------------
  287|      0|            struct mp_dispatch_item *item = queue->head;
  288|      0|            queue->head = item->next;
  289|      0|            if (!queue->head)
  ------------------
  |  Branch (289:17): [True: 0, False: 0]
  ------------------
  290|      0|                queue->tail = NULL;
  291|      0|            item->next = NULL;
  292|       |            // Unlock, because we want to allow other threads to queue items
  293|       |            // while the dispatch item is processed.
  294|       |            // At the same time, we must prevent other threads from returning
  295|       |            // from mp_dispatch_lock(), which is done by locked=true.
  296|      0|            mp_assert(!queue->locked);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (296:13): [True: 0, False: 0]
  ------------------
  297|      0|            queue->locked = true;
  298|      0|            mp_mutex_unlock(&queue->lock);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  299|       |
  300|      0|            item->fn(item->fn_data);
  301|       |
  302|      0|            mp_mutex_lock(&queue->lock);
  ------------------
  |  |  134|      0|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  303|      0|            mp_assert(queue->locked);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (303:13): [True: 0, False: 0]
  ------------------
  304|      0|            queue->locked = false;
  305|       |            // Wakeup mp_dispatch_run(), also mp_dispatch_lock().
  306|      0|            mp_cond_broadcast(&queue->cond);
  307|      0|            if (item->asynchronous) {
  ------------------
  |  Branch (307:17): [True: 0, False: 0]
  ------------------
  308|      0|                talloc_free(item);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  309|      0|            } else {
  310|      0|                item->completed = true;
  311|      0|            }
  312|  50.9k|        } else if (queue->wait > 0 && !queue->interrupted) {
  ------------------
  |  Branch (312:20): [True: 34.5k, False: 16.4k]
  |  Branch (312:39): [True: 16.9k, False: 17.5k]
  ------------------
  313|  16.9k|            if (mp_cond_timedwait_until(&queue->cond, &queue->lock, queue->wait))
  ------------------
  |  Branch (313:17): [True: 0, False: 16.9k]
  ------------------
  314|      0|                queue->wait = 0;
  315|  33.9k|        } else {
  316|  33.9k|            break;
  317|  33.9k|        }
  318|  98.2k|    }
  319|  33.9k|    mp_assert(!queue->locked);
  ------------------
  |  |   41|  33.9k|#define mp_assert assert
  ------------------
  |  Branch (319:5): [True: 33.9k, False: 0]
  ------------------
  320|  33.9k|    queue->in_process = false;
  321|  33.9k|    queue->interrupted = false;
  322|  33.9k|    mp_mutex_unlock(&queue->lock);
  ------------------
  |  |  136|  33.9k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  323|  33.9k|}
mp_dispatch_interrupt:
  332|  77.9k|{
  333|  77.9k|    mp_mutex_lock(&queue->lock);
  ------------------
  |  |  134|  77.9k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  334|  77.9k|    queue->interrupted = true;
  335|  77.9k|    mp_cond_broadcast(&queue->cond);
  336|  77.9k|    mp_mutex_unlock(&queue->lock);
  ------------------
  |  |  136|  77.9k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  337|  77.9k|}
mp_dispatch_adjust_timeout:
  348|  17.0k|{
  349|  17.0k|    mp_mutex_lock(&queue->lock);
  ------------------
  |  |  134|  17.0k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  350|  17.0k|    if (queue->in_process && queue->wait > until) {
  ------------------
  |  Branch (350:9): [True: 0, False: 17.0k]
  |  Branch (350:30): [True: 0, False: 0]
  ------------------
  351|      0|        queue->wait = until;
  352|      0|        mp_cond_broadcast(&queue->cond);
  353|      0|    }
  354|  17.0k|    mp_mutex_unlock(&queue->lock);
  ------------------
  |  |  136|  17.0k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  355|  17.0k|}
mp_dispatch_lock:
  365|  60.6k|{
  366|  60.6k|    mp_mutex_lock(&queue->lock);
  ------------------
  |  |  134|  60.6k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  367|       |    // Must not be called recursively from dispatched callbacks.
  368|  60.6k|    if (queue->in_process)
  ------------------
  |  Branch (368:9): [True: 43.8k, False: 16.7k]
  ------------------
  369|  60.6k|        mp_assert(!mp_thread_id_equal(queue->in_process_thread_id, mp_thread_current_id()));
  ------------------
  |  |   41|  60.6k|#define mp_assert assert
  ------------------
  |  Branch (369:9): [True: 43.8k, False: 0]
  ------------------
  370|       |    // Must not be called recursively at all.
  371|  60.6k|    if (queue->locked_explicit)
  ------------------
  |  Branch (371:9): [True: 0, False: 60.6k]
  ------------------
  372|  60.6k|        mp_assert(!mp_thread_id_equal(queue->locked_explicit_thread_id, mp_thread_current_id()));
  ------------------
  |  |   41|  60.6k|#define mp_assert assert
  ------------------
  |  Branch (372:9): [True: 0, False: 0]
  ------------------
  373|  60.6k|    queue->lock_requests += 1;
  374|       |    // And now wait until the target thread gets "trapped" within the
  375|       |    // mp_dispatch_queue_process() call, which will mean we get exclusive
  376|       |    // access to the target's thread state.
  377|  60.6k|    if (queue->onlock_fn)
  ------------------
  |  Branch (377:9): [True: 0, False: 60.6k]
  ------------------
  378|      0|        queue->onlock_fn(queue->onlock_ctx);
  379|  77.3k|    while (!queue->in_process) {
  ------------------
  |  Branch (379:12): [True: 16.7k, False: 60.6k]
  ------------------
  380|  16.7k|        mp_mutex_unlock(&queue->lock);
  ------------------
  |  |  136|  16.7k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  381|  16.7k|        if (queue->wakeup_fn)
  ------------------
  |  Branch (381:13): [True: 0, False: 16.7k]
  ------------------
  382|      0|            queue->wakeup_fn(queue->wakeup_ctx);
  383|  16.7k|        mp_mutex_lock(&queue->lock);
  ------------------
  |  |  134|  16.7k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  384|  16.7k|        if (queue->in_process)
  ------------------
  |  Branch (384:13): [True: 1, False: 16.7k]
  ------------------
  385|      1|            break;
  386|  16.7k|        mp_cond_wait(&queue->cond, &queue->lock);
  387|  16.7k|    }
  388|       |    // Wait until we can get the lock.
  389|  60.6k|    while (!queue->in_process || queue->locked)
  ------------------
  |  Branch (389:12): [True: 0, False: 60.6k]
  |  Branch (389:34): [True: 0, False: 60.6k]
  ------------------
  390|      0|        mp_cond_wait(&queue->cond, &queue->lock);
  391|       |    // "Lock".
  392|  60.6k|    mp_assert(queue->lock_requests);
  ------------------
  |  |   41|  60.6k|#define mp_assert assert
  ------------------
  |  Branch (392:5): [True: 60.6k, False: 0]
  ------------------
  393|  60.6k|    mp_assert(!queue->locked);
  ------------------
  |  |   41|  60.6k|#define mp_assert assert
  ------------------
  |  Branch (393:5): [True: 60.6k, False: 0]
  ------------------
  394|  60.6k|    mp_assert(!queue->locked_explicit);
  ------------------
  |  |   41|  60.6k|#define mp_assert assert
  ------------------
  |  Branch (394:5): [True: 60.6k, False: 0]
  ------------------
  395|  60.6k|    queue->locked = true;
  396|  60.6k|    queue->locked_explicit = true;
  397|  60.6k|    queue->locked_explicit_thread_id = mp_thread_current_id();
  ------------------
  |  |  217|  60.6k|#define mp_thread_current_id      pthread_self
  ------------------
  398|  60.6k|    mp_mutex_unlock(&queue->lock);
  ------------------
  |  |  136|  60.6k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  399|  60.6k|}
mp_dispatch_unlock:
  403|  60.6k|{
  404|  60.6k|    mp_mutex_lock(&queue->lock);
  ------------------
  |  |  134|  60.6k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  405|  60.6k|    mp_assert(queue->locked);
  ------------------
  |  |   41|  60.6k|#define mp_assert assert
  ------------------
  |  Branch (405:5): [True: 60.6k, False: 0]
  ------------------
  406|       |    // Must be called after a mp_dispatch_lock(), from the same thread.
  407|  60.6k|    mp_assert(queue->locked_explicit);
  ------------------
  |  |   41|  60.6k|#define mp_assert assert
  ------------------
  |  Branch (407:5): [True: 60.6k, False: 0]
  ------------------
  408|  60.6k|    mp_assert(mp_thread_id_equal(queue->locked_explicit_thread_id, mp_thread_current_id()));
  ------------------
  |  |   41|  60.6k|#define mp_assert assert
  ------------------
  |  Branch (408:5): [True: 60.6k, False: 0]
  ------------------
  409|       |    // "Unlock".
  410|  60.6k|    queue->locked = false;
  411|  60.6k|    queue->locked_explicit = false;
  412|  60.6k|    queue->lock_requests -= 1;
  413|       |    // Wakeup mp_dispatch_queue_process(), and maybe other mp_dispatch_lock()s.
  414|       |    // (Would be nice to wake up only 1 other locker if lock_requests>0.)
  415|  60.6k|    mp_cond_broadcast(&queue->cond);
  416|  60.6k|    mp_mutex_unlock(&queue->lock);
  ------------------
  |  |  136|  60.6k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  417|  60.6k|}
dispatch.c:queue_dtor:
   64|  16.4k|{
   65|  16.4k|    struct mp_dispatch_queue *queue = p;
   66|  16.4k|    mp_assert(!queue->head);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (66:5): [True: 16.4k, False: 0]
  ------------------
   67|  16.4k|    mp_assert(!queue->in_process);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (67:5): [True: 16.4k, False: 0]
  ------------------
   68|  16.4k|    mp_assert(!queue->lock_requests);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (68:5): [True: 16.4k, False: 0]
  ------------------
   69|  16.4k|    mp_assert(!queue->locked);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (69:5): [True: 16.4k, False: 0]
  ------------------
   70|  16.4k|    mp_cond_destroy(&queue->cond);
   71|  16.4k|    mp_mutex_destroy(&queue->lock);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
   72|  16.4k|}

mp_hash_to_bstr:
   26|  36.1k|{
   27|  36.1k|    struct AVHashContext *ctx = NULL;
   28|  36.1k|    mp_require(av_hash_alloc(&ctx, algorithm) == 0);
  ------------------
  |  |   42|  36.1k|#define mp_require assert
  ------------------
  |  Branch (28:5): [True: 36.1k, False: 0]
  ------------------
   29|  36.1k|    int size = av_hash_get_size(ctx);
   30|  36.1k|    uint8_t hash[AV_HASH_MAX_SIZE] = {0};
   31|       |
   32|  36.1k|    av_hash_init(ctx);
   33|  36.1k|    av_hash_update(ctx, data, len);
   34|  36.1k|    av_hash_final(ctx, hash);
   35|  36.1k|    av_hash_freep(&ctx);
   36|       |
   37|  36.1k|    bstr ret = {0};
   38|   615k|    for (int n = 0; n < size; n++)
  ------------------
  |  Branch (38:21): [True: 578k, False: 36.1k]
  ------------------
   39|   578k|        bstr_xappend_asprintf(talloc_ctx, &ret, "%02X", hash[n]);
   40|  36.1k|    return ret;
   41|  36.1k|}

json_append:
  295|   345k|{
  296|   345k|    switch (src->format) {
  ------------------
  |  Branch (296:13): [True: 345k, False: 0]
  ------------------
  297|      0|    case MPV_FORMAT_NONE:
  ------------------
  |  Branch (297:5): [True: 0, False: 345k]
  ------------------
  298|      0|        APPEND(b, "null");
  ------------------
  |  |  248|      0|#define APPEND(b, s) bstr_xappend(NULL, (b), bstr0(s))
  ------------------
  299|      0|        return 0;
  300|  12.4k|    case MPV_FORMAT_FLAG:
  ------------------
  |  Branch (300:5): [True: 12.4k, False: 332k]
  ------------------
  301|  12.4k|        APPEND(b, src->u.flag ? "true" : "false");
  ------------------
  |  |  248|  24.9k|#define APPEND(b, s) bstr_xappend(NULL, (b), bstr0(s))
  |  |  ------------------
  |  |  |  Branch (248:52): [True: 11.9k, False: 479]
  |  |  ------------------
  ------------------
  302|  12.4k|        return 0;
  303|  21.7k|    case MPV_FORMAT_INT64:
  ------------------
  |  Branch (303:5): [True: 21.7k, False: 323k]
  ------------------
  304|  21.7k|        bstr_xappend_asprintf(NULL, b, "%"PRId64, src->u.int64);
  305|  21.7k|        return 0;
  306|    112|    case MPV_FORMAT_DOUBLE: {
  ------------------
  |  Branch (306:5): [True: 112, False: 345k]
  ------------------
  307|    112|        const char *px = (isfinite(src->u.double_) || indent == 0) ? "" : "\"";
  ------------------
  |  Branch (307:27): [True: 112, False: 0]
  |  Branch (307:55): [True: 0, False: 0]
  ------------------
  308|    112|        bstr_xappend_asprintf(NULL, b, "%s%f%s", px, src->u.double_, px);
  309|    112|        return 0;
  310|      0|    }
  311|   228k|    case MPV_FORMAT_STRING:
  ------------------
  |  Branch (311:5): [True: 228k, False: 116k]
  ------------------
  312|   228k|        if (indent == 0)
  ------------------
  |  Branch (312:13): [True: 0, False: 228k]
  ------------------
  313|      0|            APPEND(b, src->u.string);
  ------------------
  |  |  248|      0|#define APPEND(b, s) bstr_xappend(NULL, (b), bstr0(s))
  ------------------
  314|   228k|        else
  315|   228k|            write_json_str(b, src->u.string);
  316|   228k|        return 0;
  317|  1.47k|    case MPV_FORMAT_NODE_ARRAY:
  ------------------
  |  Branch (317:5): [True: 1.47k, False: 343k]
  ------------------
  318|  82.1k|    case MPV_FORMAT_NODE_MAP: {
  ------------------
  |  Branch (318:5): [True: 80.7k, False: 264k]
  ------------------
  319|  82.1k|        struct mpv_node_list *list = src->u.list;
  320|  82.1k|        bool is_obj = src->format == MPV_FORMAT_NODE_MAP;
  321|  82.1k|        APPEND(b, is_obj ? "{" : "[");
  ------------------
  |  |  248|   164k|#define APPEND(b, s) bstr_xappend(NULL, (b), bstr0(s))
  |  |  ------------------
  |  |  |  Branch (248:52): [True: 80.7k, False: 1.47k]
  |  |  ------------------
  ------------------
  322|  82.1k|        int next_indent = indent >= 0 ? indent + 1 : -1;
  ------------------
  |  Branch (322:27): [True: 78.9k, False: 3.25k]
  ------------------
  323|   426k|        for (int n = 0; n < list->num; n++) {
  ------------------
  |  Branch (323:25): [True: 344k, False: 82.1k]
  ------------------
  324|   344k|            if (n)
  ------------------
  |  Branch (324:17): [True: 262k, False: 81.9k]
  ------------------
  325|   262k|                APPEND(b, ",");
  ------------------
  |  |  248|   262k|#define APPEND(b, s) bstr_xappend(NULL, (b), bstr0(s))
  ------------------
  326|   344k|            add_indent(b, next_indent);
  327|   344k|            if (is_obj) {
  ------------------
  |  Branch (327:17): [True: 263k, False: 80.4k]
  ------------------
  328|   263k|                write_json_str(b, list->keys[n]);
  329|   263k|                APPEND(b, ":");
  ------------------
  |  |  248|   263k|#define APPEND(b, s) bstr_xappend(NULL, (b), bstr0(s))
  ------------------
  330|   263k|            }
  331|   344k|            json_append(b, &list->values[n], next_indent);
  332|   344k|        }
  333|  82.1k|        add_indent(b, indent);
  334|  82.1k|        APPEND(b, is_obj ? "}" : "]");
  ------------------
  |  |  248|   164k|#define APPEND(b, s) bstr_xappend(NULL, (b), bstr0(s))
  |  |  ------------------
  |  |  |  Branch (248:52): [True: 80.7k, False: 1.47k]
  |  |  ------------------
  ------------------
  335|  82.1k|        return 0;
  336|  1.47k|    }
  337|   345k|    }
  338|      0|    return -1; // unknown format
  339|   345k|}
json_write:
  355|    300|{
  356|    300|    return json_append_str(dst, src, -1);
  357|    300|}
json_write_pretty:
  361|    765|{
  362|    765|    return json_append_str(dst, src, 0);
  363|    765|}
json.c:write_json_str:
  259|   492k|{
  260|   492k|    mp_assert(str);
  ------------------
  |  |   41|   492k|#define mp_assert assert
  ------------------
  |  Branch (260:5): [True: 492k, False: 0]
  ------------------
  261|       |
  262|   492k|    APPEND(b, "\"");
  ------------------
  |  |  248|   492k|#define APPEND(b, s) bstr_xappend(NULL, (b), bstr0(s))
  ------------------
  263|   497k|    while (1) {
  ------------------
  |  Branch (263:12): [True: 497k, Folded]
  ------------------
  264|   497k|        unsigned char *cur = str;
  265|  5.37M|        while (cur[0] >= 32 && cur[0] != '"' && cur[0] != '\\')
  ------------------
  |  Branch (265:16): [True: 4.88M, False: 495k]
  |  Branch (265:32): [True: 4.88M, False: 1.05k]
  |  Branch (265:49): [True: 4.88M, False: 930]
  ------------------
  266|  4.88M|            cur++;
  267|   497k|        if (!cur[0])
  ------------------
  |  Branch (267:13): [True: 492k, False: 4.83k]
  ------------------
  268|   492k|            break;
  269|  4.83k|        bstr_xappend(NULL, b, (bstr){str, cur - str});
  270|  4.83k|        if (cur[0] == '\"') {
  ------------------
  |  Branch (270:13): [True: 1.05k, False: 3.78k]
  ------------------
  271|  1.05k|            bstr_xappend(NULL, b, (bstr){"\\\"", 2});
  272|  3.78k|        } else if (cur[0] == '\\') {
  ------------------
  |  Branch (272:20): [True: 930, False: 2.85k]
  ------------------
  273|    930|            bstr_xappend(NULL, b, (bstr){"\\\\", 2});
  274|  2.85k|        } else if (cur[0] < sizeof(special_escape) && special_escape[cur[0]]) {
  ------------------
  |  Branch (274:20): [True: 844, False: 2.00k]
  |  Branch (274:55): [True: 414, False: 430]
  ------------------
  275|    414|            bstr_xappend_asprintf(NULL, b, "\\%c", special_escape[cur[0]]);
  276|  2.43k|        } else {
  277|  2.43k|            bstr_xappend_asprintf(NULL, b, "\\u%04x", (unsigned char)cur[0]);
  278|  2.43k|        }
  279|  4.83k|        str = cur + 1;
  280|  4.83k|    }
  281|   492k|    APPEND(b, str);
  ------------------
  |  |  248|   492k|#define APPEND(b, s) bstr_xappend(NULL, (b), bstr0(s))
  ------------------
  282|       |    APPEND(b, "\"");
  ------------------
  |  |  248|   492k|#define APPEND(b, s) bstr_xappend(NULL, (b), bstr0(s))
  ------------------
  283|   492k|}
json.c:add_indent:
  286|   426k|{
  287|   426k|    if (indent < 0)
  ------------------
  |  Branch (287:9): [True: 14.1k, False: 412k]
  ------------------
  288|  14.1k|        return;
  289|   412k|    bstr_xappend(NULL, b, bstr0("\n"));
  290|  1.10M|    for (int n = 0; n < indent; n++)
  ------------------
  |  Branch (290:21): [True: 694k, False: 412k]
  ------------------
  291|   694k|        bstr_xappend(NULL, b, bstr0(" "));
  292|   412k|}
json.c:json_append_str:
  342|  1.06k|{
  343|  1.06k|    bstr buffer = bstr0(*dst);
  344|  1.06k|    int r = json_append(&buffer, src, indent);
  345|  1.06k|    *dst = buffer.start;
  346|  1.06k|    return r;
  347|  1.06k|}

node_init:
   13|   130k|{
   14|       |    // Other formats need to be initialized manually.
   15|   130k|    mp_assert(format == MPV_FORMAT_NODE_MAP || format == MPV_FORMAT_NODE_ARRAY ||
  ------------------
  |  |   41|   130k|#define mp_assert assert
  ------------------
  |  Branch (15:5): [True: 33.2k, False: 97.6k]
  |  Branch (15:5): [True: 17.4k, False: 80.1k]
  |  Branch (15:5): [True: 12.3k, False: 67.8k]
  |  Branch (15:5): [True: 12.3k, False: 55.5k]
  |  Branch (15:5): [True: 40, False: 55.4k]
  |  Branch (15:5): [True: 0, False: 55.4k]
  |  Branch (15:5): [True: 55.4k, False: 0]
  ------------------
   16|   130k|           format == MPV_FORMAT_FLAG || format == MPV_FORMAT_INT64 ||
   17|   130k|           format == MPV_FORMAT_DOUBLE || format == MPV_FORMAT_BYTE_ARRAY ||
   18|   130k|           format == MPV_FORMAT_NONE);
   19|       |
   20|   130k|    void *ta_parent = NULL;
   21|   130k|    if (parent) {
  ------------------
  |  Branch (21:9): [True: 97.7k, False: 33.1k]
  ------------------
   22|  97.7k|        mp_assert(parent->format == MPV_FORMAT_NODE_MAP ||
  ------------------
  |  |   41|  97.7k|#define mp_assert assert
  ------------------
  |  Branch (22:9): [True: 81.0k, False: 16.7k]
  |  Branch (22:9): [True: 16.7k, False: 0]
  ------------------
   23|  97.7k|               parent->format == MPV_FORMAT_NODE_ARRAY);
   24|  97.7k|        ta_parent = parent->u.list;
   25|  97.7k|    }
   26|       |
   27|   130k|    *dst = (struct mpv_node){ .format = format };
   28|   130k|    if (format == MPV_FORMAT_NODE_MAP || format == MPV_FORMAT_NODE_ARRAY)
  ------------------
  |  Branch (28:9): [True: 33.2k, False: 97.6k]
  |  Branch (28:42): [True: 17.4k, False: 80.1k]
  ------------------
   29|  50.7k|        dst->u.list = talloc_zero(ta_parent, struct mpv_node_list);
  ------------------
  |  |   27|  50.7k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  50.7k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  50.7k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   30|   130k|    if (format == MPV_FORMAT_BYTE_ARRAY)
  ------------------
  |  Branch (30:9): [True: 0, False: 130k]
  ------------------
   31|      0|        dst->u.ba = talloc_zero(ta_parent, struct mpv_byte_array);
  ------------------
  |  |   27|      0|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|      0|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      0|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   32|   130k|}
node_array_add:
   37|  16.7k|{
   38|  16.7k|    struct mpv_node_list *list = dst->u.list;
   39|  16.7k|    mp_assert(dst->format == MPV_FORMAT_NODE_ARRAY && dst->u.list);
  ------------------
  |  |   41|  16.7k|#define mp_assert assert
  ------------------
  |  Branch (39:5): [True: 16.7k, False: 0]
  |  Branch (39:5): [True: 16.7k, False: 0]
  ------------------
   40|  16.7k|    MP_TARRAY_GROW(list, list->values, list->num);
  ------------------
  |  |   96|  16.7k|    do {                                            \
  |  |   97|  16.7k|        size_t nextidx_ = (nextidx);                \
  |  |   98|  16.7k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  ------------------
  |  |  |  |   84|  16.7k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  16.7k|#define talloc_get_size                 ta_get_size
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 2.30k, False: 14.4k]
  |  |  ------------------
  |  |   99|  16.7k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  ------------------
  |  |  |  |   88|  2.30k|    do {                                                        \
  |  |  |  |   89|  2.30k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  2.30k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.30k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|  2.30k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|  2.30k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   90|  2.30k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |   91|  2.30k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (91:14): [Folded, False: 2.30k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  100|  16.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (100:14): [Folded, False: 16.7k]
  |  |  ------------------
  ------------------
   41|  16.7k|    node_init(&list->values[list->num], format, dst);
   42|  16.7k|    return &list->values[list->num++];
   43|  16.7k|}
node_map_add:
   49|  79.3k|{
   50|  79.3k|    mp_assert(key);
  ------------------
  |  |   41|  79.3k|#define mp_assert assert
  ------------------
  |  Branch (50:5): [True: 79.3k, False: 0]
  ------------------
   51|  79.3k|    return node_map_badd(dst, bstr0(key), format);
   52|  79.3k|}
node_map_badd:
   55|  81.0k|{
   56|  81.0k|    mp_assert(key.start);
  ------------------
  |  |   41|  81.0k|#define mp_assert assert
  ------------------
  |  Branch (56:5): [True: 81.0k, False: 0]
  ------------------
   57|       |
   58|  81.0k|    struct mpv_node_list *list = dst->u.list;
   59|  81.0k|    mp_assert(dst->format == MPV_FORMAT_NODE_MAP && dst->u.list);
  ------------------
  |  |   41|  81.0k|#define mp_assert assert
  ------------------
  |  Branch (59:5): [True: 81.0k, False: 0]
  |  Branch (59:5): [True: 81.0k, False: 0]
  ------------------
   60|  81.0k|    MP_TARRAY_GROW(list, list->values, list->num);
  ------------------
  |  |   96|  81.0k|    do {                                            \
  |  |   97|  81.0k|        size_t nextidx_ = (nextidx);                \
  |  |   98|  81.0k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  ------------------
  |  |  |  |   84|  81.0k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  81.0k|#define talloc_get_size                 ta_get_size
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 29.3k, False: 51.6k]
  |  |  ------------------
  |  |   99|  81.0k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  ------------------
  |  |  |  |   88|  29.3k|    do {                                                        \
  |  |  |  |   89|  29.3k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  29.3k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  29.3k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|  29.3k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|  29.3k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   90|  29.3k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |   91|  29.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (91:14): [Folded, False: 29.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  100|  81.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (100:14): [Folded, False: 81.0k]
  |  |  ------------------
  ------------------
   61|  81.0k|    MP_TARRAY_GROW(list, list->keys, list->num);
  ------------------
  |  |   96|  81.0k|    do {                                            \
  |  |   97|  81.0k|        size_t nextidx_ = (nextidx);                \
  |  |   98|  81.0k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  ------------------
  |  |  |  |   84|  81.0k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  81.0k|#define talloc_get_size                 ta_get_size
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 29.3k, False: 51.6k]
  |  |  ------------------
  |  |   99|  81.0k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  ------------------
  |  |  |  |   88|  29.3k|    do {                                                        \
  |  |  |  |   89|  29.3k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  29.3k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  29.3k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|  29.3k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|  29.3k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   90|  29.3k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |   91|  29.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (91:14): [Folded, False: 29.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  100|  81.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (100:14): [Folded, False: 81.0k]
  |  |  ------------------
  ------------------
   62|  81.0k|    list->keys[list->num] = bstrdup0(list, key);
   63|  81.0k|    node_init(&list->values[list->num], format, dst);
   64|  81.0k|    return &list->values[list->num++];
   65|  81.0k|}
node_map_add_string:
   71|  41.4k|{
   72|  41.4k|    mp_assert(val);
  ------------------
  |  |   41|  41.4k|#define mp_assert assert
  ------------------
  |  Branch (72:5): [True: 41.4k, False: 0]
  ------------------
   73|       |
   74|  41.4k|    struct mpv_node *entry = node_map_add(dst, key, MPV_FORMAT_NONE);
   75|  41.4k|    entry->format = MPV_FORMAT_STRING;
   76|  41.4k|    entry->u.string = talloc_strdup(dst->u.list, val);
  ------------------
  |  |   50|  41.4k|#define talloc_strdup                   ta_xstrdup
  ------------------
   77|  41.4k|}
node_map_add_bstr:
   80|  12.2k|{
   81|  12.2k|    mp_assert(val.start);
  ------------------
  |  |   41|  12.2k|#define mp_assert assert
  ------------------
  |  Branch (81:5): [True: 12.2k, False: 0]
  ------------------
   82|       |
   83|  12.2k|    struct mpv_node *entry = node_map_add(dst, key, MPV_FORMAT_NONE);
   84|  12.2k|    entry->format = MPV_FORMAT_STRING;
   85|  12.2k|    entry->u.string = bstrto0(dst->u.list, val);
   86|  12.2k|}
node_map_add_int64:
   89|  12.3k|{
   90|  12.3k|    node_map_add(dst, key, MPV_FORMAT_INT64)->u.int64 = v;
   91|  12.3k|}
node_map_add_double:
   94|     40|{
   95|     40|    node_map_add(dst, key, MPV_FORMAT_DOUBLE)->u.double_ = v;
   96|     40|}
node_map_add_flag:
   99|  12.3k|{
  100|  12.3k|    node_map_add(dst, key, MPV_FORMAT_FLAG)->u.flag = v;
  101|  12.3k|}

mp_basename_bstr:
   43|  15.4k|{
   44|  15.4k|    int separator_pos;
   45|       |
   46|       |#if HAVE_DOS_PATHS
   47|       |    if (!mp_is_url(path)) {
   48|       |        separator_pos = bstrrchr(path, '\\');
   49|       |        if (separator_pos >= 0)
   50|       |            path = bstr_splice(path, separator_pos + 1, path.len);
   51|       |        separator_pos = bstrrchr(path, ':');
   52|       |        if (separator_pos >= 0)
   53|       |            path = bstr_splice(path, separator_pos + 1, path.len);
   54|       |    }
   55|       |#endif
   56|  15.4k|    separator_pos = bstrrchr(path, '/');
   57|  15.4k|    if (separator_pos < 0)
  ------------------
  |  Branch (57:9): [True: 12.2k, False: 3.13k]
  ------------------
   58|  12.2k|        return path;
   59|  3.13k|    return bstr_splice(path, separator_pos + 1, path.len);
   60|  15.4k|}
mp_basename:
   63|  9.00k|{
   64|  9.00k|    return mp_basename_bstr(bstr0(path)).start;
   65|  9.00k|}
mp_get_ext:
  121|  6.39k|{
  122|       |    return split_ext(path, NULL);
  123|  6.39k|}
mp_path_is_absolute:
  126|   156k|{
  127|   156k|    if (path.len && strchr(mp_path_separators, path.start[0]))
  ------------------
  |  Branch (127:9): [True: 156k, False: 0]
  |  Branch (127:21): [True: 52.0k, False: 104k]
  ------------------
  128|  52.0k|        return true;
  129|       |
  130|       |#if HAVE_DOS_PATHS
  131|       |    // Note: "X:filename" is a path relative to the current working directory
  132|       |    //       of drive X, and thus is not an absolute path. It needs to be
  133|       |    //       followed by \ or /.
  134|       |    if (path.len >= 3 && path.start[1] == ':' &&
  135|       |        strchr(mp_path_separators, path.start[2]))
  136|       |        return true;
  137|       |#endif
  138|       |
  139|   104k|    return false;
  140|   156k|}
mp_path_join_bstr:
  143|   106k|{
  144|   106k|    if (p1.len == 0)
  ------------------
  |  Branch (144:9): [True: 35.4k, False: 70.6k]
  ------------------
  145|  35.4k|        return bstrdup0(talloc_ctx, p2);
  146|  70.6k|    if (p2.len == 0)
  ------------------
  |  Branch (146:9): [True: 4.72k, False: 65.9k]
  ------------------
  147|  4.72k|        return bstrdup0(talloc_ctx, p1);
  148|       |
  149|  65.9k|    if (mp_path_is_absolute(p2))
  ------------------
  |  Branch (149:9): [True: 1.56k, False: 64.3k]
  ------------------
  150|  1.56k|        return bstrdup0(talloc_ctx, p2);
  151|       |
  152|  65.9k|    bool have_separator = strchr(mp_path_separators, p1.start[p1.len - 1]);
  153|       |#if HAVE_DOS_PATHS
  154|       |    // "X:" only => path relative to "X:" current working directory.
  155|       |    if (p1.len == 2 && p1.start[1] == ':')
  156|       |        have_separator = true;
  157|       |#endif
  158|       |
  159|  64.3k|    return talloc_asprintf(talloc_ctx, "%.*s%s%.*s", BSTR_P(p1),
  ------------------
  |  |   52|  64.3k|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|   386k|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (127:62): [True: 64.3k, False: 0]
  |  |  |  |  |  Branch (127:62): [True: 3.52k, False: 60.8k]
  |  |  |  |  |  Branch (127:62): [True: 64.3k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  160|  65.9k|                           have_separator ? "" : "/", BSTR_P(p2));
  161|  65.9k|}
mp_path_join:
  164|  43.5k|{
  165|  43.5k|    return mp_path_join_bstr(talloc_ctx, bstr0(p1), bstr0(p2));
  166|  43.5k|}
mp_getcwd:
  169|  39.9k|{
  170|  39.9k|#if !HAVE_DOS_PATHS
  171|  39.9k|    char *e_wd = getenv("PWD");
  172|  39.9k|    struct stat pwd_st, dot_st;
  173|  39.9k|    if (e_wd && mp_path_is_absolute(bstr0(e_wd)) &&
  ------------------
  |  Branch (173:9): [True: 39.9k, False: 0]
  |  Branch (173:17): [True: 39.9k, False: 0]
  ------------------
  174|  39.9k|        stat(e_wd, &pwd_st) == 0 && stat(".", &dot_st) == 0 &&
  ------------------
  |  Branch (174:9): [True: 39.9k, False: 0]
  |  Branch (174:37): [True: 39.9k, False: 0]
  ------------------
  175|  39.9k|        pwd_st.st_dev == dot_st.st_dev && pwd_st.st_ino == dot_st.st_ino)
  ------------------
  |  Branch (175:9): [True: 39.9k, False: 0]
  |  Branch (175:43): [True: 39.9k, False: 0]
  ------------------
  176|  39.9k|        return talloc_strdup(talloc_ctx, e_wd);
  ------------------
  |  |   50|  39.9k|#define talloc_strdup                   ta_xstrdup
  ------------------
  177|      0|#endif
  178|       |
  179|      0|    char *wd = talloc_array(talloc_ctx, char, 20);
  ------------------
  |  |   29|      0|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|      0|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      0|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  180|      0|    while (getcwd(wd, talloc_get_size(wd)) == NULL) {
  ------------------
  |  |   45|      0|#define talloc_get_size                 ta_get_size
  ------------------
  |  Branch (180:12): [True: 0, False: 0]
  ------------------
  181|      0|        if (errno != ERANGE) {
  ------------------
  |  Branch (181:13): [True: 0, False: 0]
  ------------------
  182|      0|            talloc_free(wd);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  183|      0|            return NULL;
  184|      0|        }
  185|      0|        wd = talloc_realloc(talloc_ctx, wd, char, talloc_get_size(wd) * 2);
  ------------------
  |  |   33|      0|#define talloc_realloc                  ta_xrealloc
  |  |  ------------------
  |  |  |  |  144|      0|    (type *)ta_xrealloc_size(ta_parent, ptr, ta_calc_array_size(sizeof(type), count))
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  186|      0|    }
  187|      0|    return wd;
  188|      0|}
mp_normalize_path:
  191|  55.0k|{
  192|  55.0k|    if (!path)
  ------------------
  |  Branch (192:9): [True: 0, False: 55.0k]
  ------------------
  193|      0|        return NULL;
  194|       |
  195|  55.0k|    if (!path[0] || mp_is_url(bstr0(path)) || !strcmp(path, "-"))
  ------------------
  |  Branch (195:9): [True: 1.40k, False: 53.6k]
  |  Branch (195:21): [True: 853, False: 52.7k]
  |  Branch (195:47): [True: 2.27k, False: 50.4k]
  ------------------
  196|  4.53k|        return talloc_strdup(talloc_ctx, path);
  ------------------
  |  |   50|  4.53k|#define talloc_strdup                   ta_xstrdup
  ------------------
  197|       |
  198|  50.4k|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  50.4k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  50.4k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  199|  50.4k|    char *result;
  200|       |
  201|       |#if HAVE_DOS_PATHS
  202|       |    wchar_t *pathw = mp_from_utf8(tmp, path);
  203|       |    DWORD len = GetFullPathNameW(pathw, 0, NULL, NULL);
  204|       |    wchar_t *pathc = talloc_array(tmp, wchar_t, len);
  205|       |    if (!len || !GetFullPathNameW(pathw, len, pathc, NULL)) {
  206|       |        result = talloc_strdup(talloc_ctx, path);
  207|       |        goto exit;
  208|       |    }
  209|       |    // PathAllocCanonicalize() treats the "." of a \\.\ path as a directory and
  210|       |    // removes it, so skip it for device paths.
  211|       |    wchar_t *pathx = NULL;
  212|       |    if (wcsncmp(pathc, L"\\\\.\\", 4) &&
  213|       |        SUCCEEDED(PathAllocCanonicalize(pathc, PATHCCH_ALLOW_LONG_PATHS, &pathx)))
  214|       |        pathc = pathx;
  215|       |    result = mp_to_utf8(talloc_ctx, pathc);
  216|       |    LocalFree(pathx);
  217|       |#else
  218|  50.4k|    if (!mp_path_is_absolute(bstr0(path))) {
  ------------------
  |  Branch (218:9): [True: 39.9k, False: 10.5k]
  ------------------
  219|  39.9k|        char *cwd = mp_getcwd(tmp);
  220|  39.9k|        if (!cwd) {
  ------------------
  |  Branch (220:13): [True: 0, False: 39.9k]
  ------------------
  221|      0|            result = talloc_strdup(talloc_ctx, path);
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  222|      0|            goto exit;
  223|      0|        }
  224|  39.9k|        path = mp_path_join(tmp, cwd, path);
  225|  39.9k|    }
  226|       |
  227|  50.4k|    result = talloc_strdup(tmp, "");
  ------------------
  |  |   50|  50.4k|#define talloc_strdup                   ta_xstrdup
  ------------------
  228|  50.4k|    const char *next;
  229|  50.4k|    const char *end = path + strlen(path);
  230|       |
  231|   263k|    for (const char *ptr = path; ptr < end; ptr = next + 1) {
  ------------------
  |  Branch (231:34): [True: 213k, False: 49.9k]
  ------------------
  232|   213k|        next = memchr(ptr, '/', end - ptr);
  233|   213k|        if (next == NULL)
  ------------------
  |  Branch (233:13): [True: 39.5k, False: 173k]
  ------------------
  234|  39.5k|            next = end;
  235|       |
  236|   213k|        switch (next - ptr) {
  ------------------
  |  Branch (236:17): [True: 85.7k, False: 127k]
  ------------------
  237|  51.5k|            case 0:
  ------------------
  |  Branch (237:13): [True: 51.5k, False: 161k]
  ------------------
  238|  51.5k|                continue;
  239|  29.9k|            case 1:
  ------------------
  |  Branch (239:13): [True: 29.9k, False: 183k]
  ------------------
  240|  29.9k|                if (ptr[0] == '.')
  ------------------
  |  Branch (240:21): [True: 3.05k, False: 26.9k]
  ------------------
  241|  3.05k|                    continue;
  242|  26.9k|                break;
  243|  26.9k|            case 2:
  ------------------
  |  Branch (243:13): [True: 4.22k, False: 208k]
  ------------------
  244|       |                // Normalizing symlink/.. results in a wrong path: if the
  245|       |                // current working directory is /tmp/foo, and it is a symlink to
  246|       |                // /usr/bin, mpv ../file.mkv opens /usr/file.mkv, so we can't
  247|       |                // normalize the path to /tmp/file.mkv. Resolve symlinks to fix
  248|       |                // this. Otherwise we don't use realpath so users can use
  249|       |                // symlinks e.g. to hide how media files are distributed over
  250|       |                // real storage and move them while still resuming playback as
  251|       |                // long as the symlinked path doesn't change.
  252|  4.22k|                if (ptr[0] == '.' && ptr[1] == '.') {
  ------------------
  |  Branch (252:21): [True: 864, False: 3.36k]
  |  Branch (252:38): [True: 526, False: 338]
  ------------------
  253|    526|                    char *tmp_result = realpath(path, NULL);
  254|    526|                    result = talloc_strdup(talloc_ctx,
  ------------------
  |  |   50|    526|#define talloc_strdup                   ta_xstrdup
  ------------------
  255|    526|                                           tmp_result ? tmp_result : path);
  ------------------
  |  Branch (255:44): [True: 250, False: 276]
  ------------------
  256|    526|                    free(tmp_result);
  257|    526|                    goto exit;
  258|    526|                }
  259|   213k|        }
  260|       |
  261|   158k|        result = talloc_strdup_append_buffer(result, "/");
  ------------------
  |  |   58|   158k|#define talloc_strdup_append_buffer     ta_talloc_strdup_append_buffer
  ------------------
  262|   158k|        result = talloc_strndup_append_buffer(result, ptr, next - ptr);
  ------------------
  |  |   60|   158k|#define talloc_strndup_append_buffer    ta_talloc_strndup_append_buffer
  ------------------
  263|   158k|    }
  264|       |
  265|  49.9k|    if (!result[0])
  ------------------
  |  Branch (265:9): [True: 9.81k, False: 40.1k]
  ------------------
  266|  9.81k|        result = talloc_strdup_append_buffer(result, "/");
  ------------------
  |  |   58|  9.81k|#define talloc_strdup_append_buffer     ta_talloc_strdup_append_buffer
  ------------------
  267|       |
  268|  49.9k|    result = talloc_steal(talloc_ctx, result);
  ------------------
  |  |   38|  49.9k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  49.9k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
  269|  49.9k|#endif
  270|       |
  271|  50.4k|exit:
  272|  50.4k|    talloc_free(tmp);
  ------------------
  |  |   47|  50.4k|#define talloc_free                     ta_free
  ------------------
  273|  50.4k|    return result;
  274|  49.9k|}
mp_path_exists:
  277|  22.8k|{
  278|  22.8k|    struct stat st;
  279|  22.8k|    return path && stat(path, &st) == 0;
  ------------------
  |  Branch (279:12): [True: 22.8k, False: 0]
  |  Branch (279:20): [True: 1.09k, False: 21.7k]
  ------------------
  280|  22.8k|}
mp_is_url:
  290|   119k|{
  291|   119k|    int proto = bstr_find0(path, "://");
  292|   119k|    if (proto < 1)
  ------------------
  |  Branch (292:9): [True: 108k, False: 11.1k]
  ------------------
  293|   108k|        return false;
  294|       |    // Per RFC3986, the first character of the protocol must be alphabetic.
  295|       |    // The rest must be alphanumeric plus -, + and .
  296|  66.3k|    for (int i = 0; i < proto; i++) {
  ------------------
  |  Branch (296:21): [True: 57.0k, False: 9.25k]
  ------------------
  297|  57.0k|        unsigned char c = path.start[i];
  298|  57.0k|        if ((i == 0 && !mp_isalpha(c)) ||
  ------------------
  |  Branch (298:14): [True: 11.1k, False: 45.9k]
  |  Branch (298:24): [True: 1.27k, False: 9.83k]
  ------------------
  299|  55.8k|            (!mp_isalnum(c) && c != '.' && c != '-' && c != '+'))
  ------------------
  |  Branch (299:14): [True: 3.72k, False: 52.0k]
  |  Branch (299:32): [True: 2.91k, False: 813]
  |  Branch (299:44): [True: 1.38k, False: 1.53k]
  |  Branch (299:56): [True: 580, False: 804]
  ------------------
  300|  1.85k|        {
  301|  1.85k|            return false;
  302|  1.85k|        }
  303|  57.0k|    }
  304|  9.25k|    return true;
  305|  11.1k|}
mp_split_proto:
  310|  59.4k|{
  311|  59.4k|    if (!mp_is_url(path))
  ------------------
  |  Branch (311:9): [True: 53.9k, False: 5.49k]
  ------------------
  312|  53.9k|        return (bstr){0};
  313|  5.49k|    bstr r;
  314|  5.49k|    bstr_split_tok(path, "://", &r, out_url ? out_url : &(bstr){0});
  ------------------
  |  Branch (314:37): [True: 1.51k, False: 3.97k]
  ------------------
  315|  5.49k|    return r;
  316|  59.4k|}
mp_mkdirp:
  319|    450|{
  320|    450|    if (mp_path_exists(dir))
  ------------------
  |  Branch (320:9): [True: 33, False: 417]
  ------------------
  321|     33|        return;
  322|       |
  323|    417|    char *path = talloc_strdup(NULL, dir);
  ------------------
  |  |   50|    417|#define talloc_strdup                   ta_xstrdup
  ------------------
  324|    417|    char *cdir = path + 1;
  325|       |
  326|  1.87k|    while (cdir) {
  ------------------
  |  Branch (326:12): [True: 1.46k, False: 417]
  ------------------
  327|  1.46k|        cdir = strchr(cdir, '/');
  328|  1.46k|        if (cdir)
  ------------------
  |  Branch (328:13): [True: 1.04k, False: 417]
  ------------------
  329|  1.04k|            *cdir = 0;
  330|       |
  331|  1.46k|        mkdir(path, 0777);
  ------------------
  |  |  270|  1.46k|#define mkdir(...) mp_mkdir(__VA_ARGS__)
  ------------------
  332|       |
  333|  1.46k|        if (cdir)
  ------------------
  |  Branch (333:13): [True: 1.04k, False: 417]
  ------------------
  334|  1.04k|            *cdir++ = '/';
  335|  1.46k|    }
  336|       |
  337|    417|    talloc_free(path);
  ------------------
  |  |   47|    417|#define talloc_free                     ta_free
  ------------------
  338|    417|}
path_utils.c:split_ext:
   97|  6.39k|{
   98|  6.39k|    bstr basename = mp_basename_bstr(path);
   99|       |
  100|       |    // Skip all leading dots, not just for "hidden" unix files, otherwise we
  101|       |    // end up splitting a part of the filename sans leading dot.
  102|  6.39k|    basename = bstr_splice(basename, bstrspn(basename, "."), basename.len);
  103|       |
  104|  6.39k|    int dot_pos = bstrrchr(basename, '.');
  105|  6.39k|    if (dot_pos < 0 || dot_pos == basename.len - 1)
  ------------------
  |  Branch (105:9): [True: 1.73k, False: 4.66k]
  |  Branch (105:24): [True: 112, False: 4.55k]
  ------------------
  106|  1.84k|        return (bstr){0};
  107|  4.55k|    bstr ext = bstr_splice(basename, dot_pos + 1, basename.len);
  108|  4.55k|    if (root)
  ------------------
  |  Branch (108:9): [True: 0, False: 4.55k]
  ------------------
  109|      0|        *root = (bstr){path.start, ext.start - 1 - path.start};
  110|  4.55k|    return ext;
  111|  6.39k|}

mp_rand_seed:
   45|     29|{
   46|     29|    mp_rand_state ret;
   47|       |
   48|     29|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
   49|     29|    seed = 42;
   50|     29|#endif
   51|       |
   52|     29|    if (seed == 0) {
  ------------------
  |  Branch (52:9): [True: 0, False: 29]
  ------------------
   53|      0|        if (av_random_bytes((void *)ret.v, sizeof(ret.v)) == 0) {
  ------------------
  |  Branch (53:13): [True: 0, False: 0]
  ------------------
   54|      0|            return ret;
   55|      0|        }
   56|      0|        seed = mp_raw_time_ns();
   57|      0|        seed ^= (uintptr_t)&mp_rand_seed; // ASLR, hopefully
   58|      0|        seed += (uintptr_t)&ret; // stack position
   59|      0|    }
   60|       |
   61|     29|    ret.v[0] = seed;
   62|    116|    for (int i = 1; i < 4; i++)
  ------------------
  |  Branch (62:21): [True: 87, False: 29]
  ------------------
   63|     87|        ret.v[i] = splitmix64(&seed);
   64|     29|    return ret;
   65|     29|}
mp_rand_next:
   68|  2.58k|{
   69|  2.58k|    uint64_t result, t;
   70|  2.58k|    uint64_t *state = s->v;
   71|       |
   72|  2.58k|    result = rotl_u64(state[1] * 5, 7) * 9;
   73|  2.58k|    t = state[1] << 17;
   74|       |
   75|  2.58k|    state[2] ^= state[0];
   76|  2.58k|    state[3] ^= state[1];
   77|  2.58k|    state[1] ^= state[2];
   78|  2.58k|    state[0] ^= state[3];
   79|  2.58k|    state[2] ^= t;
   80|  2.58k|    state[3] = rotl_u64(state[3], 45);
   81|       |
   82|  2.58k|    return result;
   83|  2.58k|}
mp_rand_in_range32:
   93|  1.87k|{
   94|  1.87k|    mp_assert(min < max);
  ------------------
  |  |   41|  1.87k|#define mp_assert assert
  ------------------
  |  Branch (94:5): [True: 1.87k, False: 0]
  ------------------
   95|  1.87k|    uint32_t range = max - min;
   96|  1.87k|    uint32_t mask = mp_round_next_power_of_2(range) - 1;
   97|  1.87k|    uint32_t ret;
   98|  2.58k|    do {
   99|  2.58k|        ret = mp_rand_next(s) & mask;
  100|  2.58k|    } while (ret >= range);
  ------------------
  |  Branch (100:14): [True: 713, False: 1.87k]
  ------------------
  101|  1.87k|    return min + ret;
  102|  1.87k|}
random.c:splitmix64:
   37|     87|{
   38|     87|    uint64_t z = (*x += UINT64_C(0x9e3779b97f4a7c15));
   39|     87|    z = (z ^ (z >> 30)) * UINT64_C(0xbf58476d1ce4e5b9);
   40|       |    z = (z ^ (z >> 27)) * UINT64_C(0x94d049bb133111eb);
   41|     87|    return z ^ (z >> 31);
   42|     87|}
random.c:rotl_u64:
   32|  5.17k|{
   33|  5.17k|    return (x << k) | (x >> (64 - k));
   34|  5.17k|}

mp_thread_pool_create:
  155|  16.4k|{
  156|  16.4k|    mp_assert(min_threads >= 0);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (156:5): [True: 16.4k, False: 0]
  ------------------
  157|  16.4k|    mp_assert(init_threads <= min_threads);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (157:5): [True: 16.4k, False: 0]
  ------------------
  158|  16.4k|    mp_assert(max_threads > 0 && max_threads >= min_threads);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (158:5): [True: 16.4k, False: 0]
  |  Branch (158:5): [True: 16.4k, False: 0]
  ------------------
  159|       |
  160|  16.4k|    struct mp_thread_pool *pool = talloc_zero(ta_parent, struct mp_thread_pool);
  ------------------
  |  |   27|  16.4k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  16.4k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  161|  16.4k|    talloc_set_destructor(pool, thread_pool_dtor);
  ------------------
  |  |   41|  16.4k|#define talloc_set_destructor           ta_set_destructor
  ------------------
  162|       |
  163|  16.4k|    mp_mutex_init(&pool->lock);
  164|  16.4k|    mp_cond_init(&pool->wakeup);
  165|       |
  166|  16.4k|    pool->min_threads = min_threads;
  167|  16.4k|    pool->max_threads = max_threads;
  168|       |
  169|  16.4k|    mp_mutex_lock(&pool->lock);
  ------------------
  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  170|  16.4k|    for (int n = 0; n < init_threads; n++)
  ------------------
  |  Branch (170:21): [True: 0, False: 16.4k]
  ------------------
  171|      0|        add_thread(pool);
  172|  16.4k|    bool ok = pool->num_threads >= init_threads;
  173|  16.4k|    mp_mutex_unlock(&pool->lock);
  ------------------
  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  174|       |
  175|  16.4k|    if (!ok)
  ------------------
  |  Branch (175:9): [True: 0, False: 16.4k]
  ------------------
  176|      0|        TA_FREEP(&pool);
  ------------------
  |  |   81|      0|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|      0|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 0]
  |  |  ------------------
  ------------------
  177|       |
  178|  16.4k|    return pool;
  179|  16.4k|}
thread_pool.c:thread_pool_dtor:
  116|  16.4k|{
  117|  16.4k|    struct mp_thread_pool *pool = ctx;
  118|       |
  119|       |
  120|  16.4k|    mp_mutex_lock(&pool->lock);
  ------------------
  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  121|       |
  122|  16.4k|    pool->terminate = true;
  123|  16.4k|    mp_cond_broadcast(&pool->wakeup);
  124|       |
  125|  16.4k|    mp_thread *threads = pool->threads;
  126|  16.4k|    int num_threads = pool->num_threads;
  127|       |
  128|  16.4k|    pool->threads = NULL;
  129|  16.4k|    pool->num_threads = 0;
  130|       |
  131|  16.4k|    mp_mutex_unlock(&pool->lock);
  ------------------
  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  132|       |
  133|  16.4k|    for (int n = 0; n < num_threads; n++)
  ------------------
  |  Branch (133:21): [True: 0, False: 16.4k]
  ------------------
  134|      0|        mp_thread_join(threads[n]);
  ------------------
  |  |  215|      0|#define mp_thread_join(t)         pthread_join(t, NULL)
  ------------------
  135|       |
  136|  16.4k|    mp_assert(pool->num_work == 0);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (136:5): [True: 16.4k, False: 0]
  ------------------
  137|  16.4k|    mp_assert(pool->num_threads == 0);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (137:5): [True: 16.4k, False: 0]
  ------------------
  138|  16.4k|    mp_cond_destroy(&pool->wakeup);
  139|  16.4k|    mp_mutex_destroy(&pool->lock);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
  140|  16.4k|}

mp_waiter_wait:
   36|  11.3k|{
   37|  11.3k|    mp_mutex_lock(&waiter->lock);
  ------------------
  |  |  134|  11.3k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
   38|  11.3k|    while (!waiter->done)
  ------------------
  |  Branch (38:12): [True: 0, False: 11.3k]
  ------------------
   39|      0|        mp_cond_wait(&waiter->wakeup, &waiter->lock);
   40|  11.3k|    mp_mutex_unlock(&waiter->lock);
  ------------------
  |  |  136|  11.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
   41|       |
   42|  11.3k|    uintptr_t ret = waiter->value;
   43|       |
   44|       |    // We document that after mp_waiter_wait() the waiter object becomes
   45|       |    // invalid. (It strictly returns only after mp_waiter_wakeup() has returned,
   46|       |    // and the object is "single-shot".) So destroy it here.
   47|       |
   48|       |    // Normally, we expect that the system uses futexes, in which case the
   49|       |    // following functions will do nearly nothing. This is true for Windows
   50|       |    // and Linux. But some lesser OSes still might allocate kernel objects
   51|       |    // when initializing mutexes, so destroy them here.
   52|  11.3k|    mp_mutex_destroy(&waiter->lock);
  ------------------
  |  |  133|  11.3k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
   53|  11.3k|    mp_cond_destroy(&waiter->wakeup);
   54|       |
   55|  11.3k|    memset(waiter, 0xCA, sizeof(*waiter)); // for debugging
   56|       |
   57|  11.3k|    return ret;
   58|  11.3k|}
mp_waiter_wakeup:
   61|  11.3k|{
   62|  11.3k|    mp_mutex_lock(&waiter->lock);
  ------------------
  |  |  134|  11.3k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
   63|  11.3k|    mp_assert(!waiter->done);
  ------------------
  |  |   41|  11.3k|#define mp_assert assert
  ------------------
  |  Branch (63:5): [True: 11.3k, False: 0]
  ------------------
   64|  11.3k|    waiter->done = true;
   65|  11.3k|    waiter->value = value;
   66|  11.3k|    mp_cond_signal(&waiter->wakeup);
   67|  11.3k|    mp_mutex_unlock(&waiter->lock);
  ------------------
  |  |  136|  11.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
   68|  11.3k|}
mp_cancel_new:
  124|  16.4k|{
  125|  16.4k|    struct mp_cancel *c = talloc_ptrtype(talloc_ctx, c);
  ------------------
  |  |   34|  16.4k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  16.4k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  126|  16.4k|    talloc_set_destructor(c, cancel_destroy);
  ------------------
  |  |   41|  16.4k|#define talloc_set_destructor           ta_set_destructor
  ------------------
  127|  16.4k|    *c = (struct mp_cancel){
  128|       |        .triggered = false,
  129|  16.4k|        .wakeup_pipe = {-1, -1},
  130|  16.4k|    };
  131|  16.4k|    mp_mutex_init(&c->lock);
  132|  16.4k|    mp_cond_init(&c->wakeup);
  133|  16.4k|    return c;
  134|  16.4k|}
mp_cancel_trigger:
  158|  16.4k|{
  159|  16.4k|    mp_mutex_lock(&c->lock);
  ------------------
  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  160|  16.4k|    trigger_locked(c);
  161|  16.4k|    mp_mutex_unlock(&c->lock);
  ------------------
  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  162|  16.4k|}
mp_cancel_test:
  188|  9.44k|{
  189|  9.44k|    return c ? atomic_load_explicit(&c->triggered, memory_order_relaxed) : false;
  ------------------
  |  Branch (189:12): [True: 0, False: 9.44k]
  ------------------
  190|  9.44k|}
mp_cancel_set_parent:
  223|  16.4k|{
  224|       |    // We can access c->parent without synchronization, because:
  225|       |    //  - concurrent mp_cancel_set_parent() calls to slave are not allowed
  226|       |    //  - slave->parent needs to stay valid as long as the slave exists
  227|  16.4k|    if (slave->parent == parent)
  ------------------
  |  Branch (227:9): [True: 16.4k, False: 0]
  ------------------
  228|  16.4k|        return;
  229|      0|    if (slave->parent) {
  ------------------
  |  Branch (229:9): [True: 0, False: 0]
  ------------------
  230|      0|        mp_mutex_lock(&slave->parent->lock);
  ------------------
  |  |  134|      0|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  231|      0|        LL_REMOVE(siblings, &slave->parent->slaves, slave);
  ------------------
  |  |   78|      0|#define LL_REMOVE(field, list, item) do {                               \
  |  |   79|      0|    if ((item)->field.prev) {                                           \
  |  |  ------------------
  |  |  |  Branch (79:9): [True: 0, False: 0]
  |  |  ------------------
  |  |   80|      0|        (item)->field.prev->field.next = (item)->field.next;            \
  |  |   81|      0|    } else {                                                            \
  |  |   82|      0|        (list)->head = (item)->field.next;                              \
  |  |   83|      0|    }                                                                   \
  |  |   84|      0|    if ((item)->field.next) {                                           \
  |  |  ------------------
  |  |  |  Branch (84:9): [True: 0, False: 0]
  |  |  ------------------
  |  |   85|      0|        (item)->field.next->field.prev = (item)->field.prev;            \
  |  |   86|      0|    } else {                                                            \
  |  |   87|      0|        (list)->tail = (item)->field.prev;                              \
  |  |   88|      0|    }                                                                   \
  |  |   89|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (89:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  232|      0|        mp_mutex_unlock(&slave->parent->lock);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  233|      0|    }
  234|      0|    slave->parent = parent;
  235|      0|    if (slave->parent) {
  ------------------
  |  Branch (235:9): [True: 0, False: 0]
  ------------------
  236|      0|        mp_mutex_lock(&slave->parent->lock);
  ------------------
  |  |  134|      0|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  237|      0|        LL_APPEND(siblings, &slave->parent->slaves, slave);
  ------------------
  |  |   44|      0|#define LL_APPEND(field, list, item)  do {                              \
  |  |   45|      0|    (item)->field.prev = (list)->tail;                                  \
  |  |   46|      0|    (item)->field.next = NULL;                                          \
  |  |   47|      0|    LL_RELINK_(field, list, item)                                       \
  |  |  ------------------
  |  |  |  |   98|      0|    if ((item)->field.prev) {                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|      0|        (item)->field.prev->field.next = (item);                        \
  |  |  |  |  100|      0|    } else {                                                            \
  |  |  |  |  101|      0|        (list)->head = (item);                                          \
  |  |  |  |  102|      0|    }                                                                   \
  |  |  |  |  103|      0|    if ((item)->field.next) {                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  104|      0|        (item)->field.next->field.prev = (item);                        \
  |  |  |  |  105|      0|    } else {                                                            \
  |  |  |  |  106|      0|        (list)->tail = (item);                                          \
  |  |  |  |  107|      0|    }
  |  |  ------------------
  |  |   48|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (48:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  238|      0|        retrigger_locked(slave->parent);
  239|      0|        mp_mutex_unlock(&slave->parent->lock);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  240|      0|    }
  241|      0|}
thread_tools.c:cancel_destroy:
  102|  16.4k|{
  103|  16.4k|    struct mp_cancel *c = p;
  104|       |
  105|  16.4k|    mp_assert(!c->slaves.head); // API user error
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (105:5): [True: 16.4k, False: 0]
  ------------------
  106|       |
  107|  16.4k|    mp_cancel_set_parent(c, NULL);
  108|       |
  109|  16.4k|    if (c->wakeup_pipe[0] >= 0) {
  ------------------
  |  Branch (109:9): [True: 0, False: 16.4k]
  ------------------
  110|      0|        close(c->wakeup_pipe[0]);
  111|      0|        close(c->wakeup_pipe[1]);
  112|      0|    }
  113|       |
  114|       |#ifdef _WIN32
  115|       |    if (c->win32_event)
  116|       |        CloseHandle(c->win32_event);
  117|       |#endif
  118|       |
  119|  16.4k|    mp_mutex_destroy(&c->lock);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
  120|  16.4k|    mp_cond_destroy(&c->wakeup);
  121|  16.4k|}
thread_tools.c:trigger_locked:
  137|  16.4k|{
  138|  16.4k|    atomic_store(&c->triggered, true);
  139|       |
  140|  16.4k|    mp_cond_broadcast(&c->wakeup); // condition bound to c->triggered
  141|       |
  142|  16.4k|    if (c->cb)
  ------------------
  |  Branch (142:9): [True: 0, False: 16.4k]
  ------------------
  143|      0|        c->cb(c->cb_ctx);
  144|       |
  145|  16.4k|    for (struct mp_cancel *sub = c->slaves.head; sub; sub = sub->siblings.next)
  ------------------
  |  Branch (145:50): [True: 0, False: 16.4k]
  ------------------
  146|      0|        mp_cancel_trigger(sub);
  147|       |
  148|  16.4k|    if (c->wakeup_pipe[1] >= 0)
  ------------------
  |  Branch (148:9): [True: 0, False: 16.4k]
  ------------------
  149|      0|        (void)write(c->wakeup_pipe[1], &(char){0}, 1);
  150|       |
  151|       |#ifdef _WIN32
  152|       |    if (c->win32_event)
  153|       |        SetEvent(c->win32_event);
  154|       |#endif
  155|  16.4k|}

m_config_shadow_get_next_opt:
  187|  12.9M|{
  188|  12.9M|    return iter_next(shadow, 0, shadow->num_groups, p_id);
  189|  12.9M|}
m_config_shadow_get_opt:
  212|  12.9M|{
  213|  12.9M|    int group_index, opt_index;
  214|  12.9M|    get_opt_from_id(shadow, id, &group_index, &opt_index);
  215|       |
  216|  12.9M|    return &shadow->groups[group_index].group->opts[opt_index];
  217|  12.9M|}
m_config_shadow_get_opt_name:
  221|  12.9M|{
  222|  12.9M|    int group_index, opt_index;
  223|  12.9M|    get_opt_from_id(shadow, id, &group_index, &opt_index);
  224|       |
  225|  12.9M|    struct m_config_group *g = &shadow->groups[group_index];
  226|  12.9M|    return concat_name_buf(buf, buf_size, g->prefix,
  227|  12.9M|                           g->group->opts[opt_index].name);
  228|  12.9M|}
m_config_shadow_get_alias_from_opt:
  232|   765k|{
  233|   765k|    int group_index, opt_index;
  234|   765k|    get_opt_from_id(shadow, id, &group_index, &opt_index);
  235|       |
  236|   765k|    struct m_config_group *g = &shadow->groups[group_index];
  237|   765k|    const struct m_option *opt = &shadow->groups[group_index].group->opts[opt_index];
  238|   765k|    if (opt->alias_use_prefix)
  ------------------
  |  Branch (238:9): [True: 197k, False: 568k]
  ------------------
  239|   197k|        return concat_name_buf(buf, buf_size, g->prefix, (const char *)opt->priv);
  240|   568k|    return (const char *)opt->priv;
  241|   765k|}
m_config_shadow_get_opt_default:
  245|  29.7k|{
  246|  29.7k|    int group_index, opt_index;
  247|  29.7k|    get_opt_from_id(shadow, id, &group_index, &opt_index);
  248|       |
  249|  29.7k|    const struct m_sub_options *subopt = shadow->groups[group_index].group;
  250|  29.7k|    const struct m_option *opt = &subopt->opts[opt_index];
  251|       |
  252|  29.7k|    if (opt->offset < 0)
  ------------------
  |  Branch (252:9): [True: 1.66k, False: 28.1k]
  ------------------
  253|  1.66k|        return NULL;
  254|       |
  255|  28.1k|    if (opt->defval)
  ------------------
  |  Branch (255:9): [True: 47, False: 28.0k]
  ------------------
  256|     47|        return opt->defval;
  257|       |
  258|  28.0k|    if (subopt->defaults)
  ------------------
  |  Branch (258:9): [True: 27.6k, False: 417]
  ------------------
  259|  27.6k|        return (char *)subopt->defaults + opt->offset;
  260|       |
  261|    417|    return &m_option_value_default;
  262|  28.0k|}
m_config_cache_get_opt_data:
  265|  12.8M|{
  266|  12.8M|    int group_index, opt_index;
  267|  12.8M|    get_opt_from_id(cache->shadow, id, &group_index, &opt_index);
  268|       |
  269|  12.8M|    mp_assert(group_index >= cache->internal->group_start &&
  ------------------
  |  |   41|  12.8M|#define mp_assert assert
  ------------------
  |  Branch (269:5): [True: 12.8M, False: 0]
  |  Branch (269:5): [True: 12.8M, False: 0]
  ------------------
  270|  12.8M|           group_index < cache->internal->group_end);
  271|       |
  272|  12.8M|    struct m_group_data *gd = m_config_gdata(cache->internal->data, group_index);
  273|  12.8M|    const struct m_option *opt =
  274|  12.8M|        &cache->shadow->groups[group_index].group->opts[opt_index];
  275|       |
  276|  12.8M|    return gd && opt->offset >= 0 ? gd->udata + opt->offset : NULL;
  ------------------
  |  Branch (276:12): [True: 12.8M, False: 0]
  |  Branch (276:18): [True: 12.0M, False: 820k]
  ------------------
  277|  12.8M|}
m_config_cache_get_option_change_mask:
  293|   246k|{
  294|   246k|    struct m_config_shadow *shadow = cache->shadow;
  295|   246k|    int group_index, opt_index;
  296|   246k|    get_opt_from_id(shadow, id, &group_index, &opt_index);
  297|       |
  298|   246k|    mp_assert(group_index >= cache->internal->group_start &&
  ------------------
  |  |   41|   246k|#define mp_assert assert
  ------------------
  |  Branch (298:5): [True: 246k, False: 0]
  |  Branch (298:5): [True: 246k, False: 0]
  ------------------
  299|   246k|           group_index < cache->internal->group_end);
  300|       |
  301|   246k|    return get_opt_change_mask(cache->shadow, group_index,
  302|   246k|                               cache->internal->data->group_index,
  303|   246k|                               &shadow->groups[group_index].group->opts[opt_index]);
  304|   246k|}
m_config_shadow_new:
  443|  29.7k|{
  444|  29.7k|    struct m_config_shadow *shadow = talloc_zero(NULL, struct m_config_shadow);
  ------------------
  |  |   27|  29.7k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  29.7k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  29.7k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  445|  29.7k|    talloc_set_destructor(shadow, shadow_destroy);
  ------------------
  |  |   41|  29.7k|#define talloc_set_destructor           ta_set_destructor
  ------------------
  446|  29.7k|    mp_mutex_init(&shadow->lock);
  447|       |
  448|  29.7k|    add_sub_group(shadow, NULL, -1, -1, root);
  449|       |
  450|  29.7k|    if (!root->size)
  ------------------
  |  Branch (450:9): [True: 13.3k, False: 16.4k]
  ------------------
  451|  13.3k|        return shadow;
  452|       |
  453|  16.4k|    shadow->data = allocate_option_data(shadow, shadow, 0, NULL);
  454|       |
  455|  16.4k|    return shadow;
  456|  29.7k|}
m_config_cache_from_shadow:
  561|  87.7k|{
  562|  87.7k|    int group_index = -1;
  563|       |
  564|  1.70M|    for (int n = 0; n < shadow->num_groups; n++) {
  ------------------
  |  Branch (564:21): [True: 1.70M, False: 0]
  ------------------
  565|  1.70M|        if (shadow->groups[n].group == group) {
  ------------------
  |  Branch (565:13): [True: 87.7k, False: 1.61M]
  ------------------
  566|  87.7k|            group_index = n;
  567|  87.7k|            break;
  568|  87.7k|        }
  569|  1.70M|    }
  570|       |
  571|  87.7k|    mp_assert(group_index >= 0); // invalid group (or not in option tree)
  ------------------
  |  |   41|  87.7k|#define mp_assert assert
  ------------------
  |  Branch (571:5): [True: 87.7k, False: 0]
  ------------------
  572|       |
  573|  87.7k|    struct cache_alloc {
  574|  87.7k|        struct m_config_cache a;
  575|  87.7k|        struct config_cache b;
  576|  87.7k|    };
  577|  87.7k|    struct cache_alloc *alloc = talloc_zero(ta_parent, struct cache_alloc);
  ------------------
  |  |   27|  87.7k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  87.7k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  87.7k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  578|  87.7k|    mp_assert((void *)&alloc->a == (void *)alloc);
  ------------------
  |  |   41|  87.7k|#define mp_assert assert
  ------------------
  |  Branch (578:5): [True: 87.7k, False: 0]
  ------------------
  579|  87.7k|    struct m_config_cache *cache = &alloc->a;
  580|  87.7k|    talloc_set_destructor(cache, cache_destroy);
  ------------------
  |  |   41|  87.7k|#define talloc_set_destructor           ta_set_destructor
  ------------------
  581|  87.7k|    cache->internal = &alloc->b;
  582|  87.7k|    cache->shadow = shadow;
  583|       |
  584|  87.7k|    struct config_cache *in = cache->internal;
  585|  87.7k|    in->shadow = shadow;
  586|  87.7k|    in->src = shadow->data;
  587|       |
  588|  87.7k|    mp_mutex_lock(&shadow->lock);
  ------------------
  |  |  134|  87.7k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  589|  87.7k|    in->data = allocate_option_data(cache, shadow, group_index, in->src);
  590|  87.7k|    mp_mutex_unlock(&shadow->lock);
  ------------------
  |  |  136|  87.7k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  591|       |
  592|  87.7k|    cache->opts = in->data->gdata[0].udata;
  593|       |
  594|  87.7k|    in->group_start = in->data->group_index;
  595|  87.7k|    in->group_end = in->group_start + in->data->num_gdata;
  596|  87.7k|    mp_assert(shadow->groups[in->group_start].group_count == in->data->num_gdata);
  ------------------
  |  |   41|  87.7k|#define mp_assert assert
  ------------------
  |  Branch (596:5): [True: 87.7k, False: 0]
  ------------------
  597|       |
  598|  87.7k|    in->upd_group = -1;
  599|       |
  600|  87.7k|    return cache;
  601|  87.7k|}
m_config_cache_alloc:
  606|  71.3k|{
  607|  71.3k|    return m_config_cache_from_shadow(ta_parent, global->config, group);
  608|  71.3k|}
m_config_cache_update:
  720|  50.5k|{
  721|  50.5k|    struct config_cache *in = cache->internal;
  722|  50.5k|    struct m_config_shadow *shadow = in->shadow;
  723|       |
  724|  50.5k|    if (!cache_check_update(cache))
  ------------------
  |  Branch (724:9): [True: 22.7k, False: 27.7k]
  ------------------
  725|  22.7k|        return false;
  726|       |
  727|  27.7k|    mp_mutex_lock(&shadow->lock);
  ------------------
  |  |  134|  27.7k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  728|  27.7k|    bool res = false;
  729|  97.1k|    while (1) {
  ------------------
  |  Branch (729:12): [True: 97.1k, Folded]
  ------------------
  730|  97.1k|        void *p;
  731|  97.1k|        update_next_option(cache, &p);
  732|  97.1k|        if (!p)
  ------------------
  |  Branch (732:13): [True: 27.7k, False: 69.3k]
  ------------------
  733|  27.7k|            break;
  734|  69.3k|        res = true;
  735|  69.3k|    }
  736|  27.7k|    mp_mutex_unlock(&shadow->lock);
  ------------------
  |  |  136|  27.7k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  737|  27.7k|    return res;
  738|  50.5k|}
m_config_cache_write_opt:
  782|   338k|{
  783|   338k|    struct config_cache *in = cache->internal;
  784|   338k|    struct m_config_shadow *shadow = in->shadow;
  785|       |
  786|   338k|    int group_idx = -1;
  787|   338k|    int opt_idx = -1;
  788|   338k|    find_opt(shadow, in->data, ptr, &group_idx, &opt_idx);
  789|       |
  790|       |    // ptr was not in cache->opts, or no option declaration matching it.
  791|   338k|    mp_assert(group_idx >= 0);
  ------------------
  |  |   41|   338k|#define mp_assert assert
  ------------------
  |  Branch (791:5): [True: 338k, False: 0]
  ------------------
  792|       |
  793|   338k|    struct m_config_group *g = &shadow->groups[group_idx];
  794|   338k|    const struct m_option *opt = &g->group->opts[opt_idx];
  795|       |
  796|   338k|    mp_mutex_lock(&shadow->lock);
  ------------------
  |  |  134|   338k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  797|       |
  798|   338k|    struct m_group_data *gdst = m_config_gdata(in->data, group_idx);
  799|   338k|    struct m_group_data *gsrc = m_config_gdata(in->src, group_idx);
  800|   338k|    mp_assert(gdst && gsrc);
  ------------------
  |  |   41|   338k|#define mp_assert assert
  ------------------
  |  Branch (800:5): [True: 338k, False: 0]
  |  Branch (800:5): [True: 338k, False: 0]
  ------------------
  801|       |
  802|   338k|    bool changed = !m_option_equal(opt, gsrc->udata + opt->offset, ptr) ||
  ------------------
  |  Branch (802:20): [True: 245k, False: 92.9k]
  ------------------
  803|  92.9k|                   opt->force_update;
  ------------------
  |  Branch (803:20): [True: 1.28k, False: 91.6k]
  ------------------
  804|   338k|    if (changed) {
  ------------------
  |  Branch (804:9): [True: 246k, False: 91.6k]
  ------------------
  805|   246k|        m_option_copy(opt, gsrc->udata + opt->offset, ptr);
  806|       |
  807|   246k|        gsrc->ts = atomic_fetch_add(&shadow->ts, 1) + 1;
  808|       |
  809|   246k|        for (int n = 0; n < shadow->num_listeners; n++) {
  ------------------
  |  Branch (809:25): [True: 0, False: 246k]
  ------------------
  810|      0|            struct config_cache *listener = shadow->listeners[n];
  811|      0|            if (listener->wakeup_cb && m_config_gdata(listener->data, group_idx))
  ------------------
  |  Branch (811:17): [True: 0, False: 0]
  |  Branch (811:40): [True: 0, False: 0]
  ------------------
  812|      0|                listener->wakeup_cb(listener->wakeup_cb_ctx);
  813|      0|        }
  814|   246k|    }
  815|       |
  816|   338k|    if (opt->force_update)
  ------------------
  |  Branch (816:9): [True: 3.23k, False: 335k]
  ------------------
  817|  3.23k|        append_force_update(cache, gsrc, opt->name);
  818|       |
  819|   338k|    mp_mutex_unlock(&shadow->lock);
  ------------------
  |  |  136|   338k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  820|       |
  821|   338k|    return changed;
  822|   338k|}
m_config_cache_set_wakeup_cb:
  826|   198k|{
  827|   198k|    struct config_cache *in = cache->internal;
  828|   198k|    struct m_config_shadow *shadow = in->shadow;
  829|       |
  830|   198k|    mp_mutex_lock(&shadow->lock);
  ------------------
  |  |  134|   198k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  831|   198k|    if (in->in_list) {
  ------------------
  |  Branch (831:9): [True: 22.7k, False: 175k]
  ------------------
  832|  22.7k|        for (int n = 0; n < shadow->num_listeners; n++) {
  ------------------
  |  Branch (832:25): [True: 11.3k, False: 11.3k]
  ------------------
  833|  11.3k|            if (shadow->listeners[n] == in) {
  ------------------
  |  Branch (833:17): [True: 11.3k, False: 0]
  ------------------
  834|  11.3k|                MP_TARRAY_REMOVE_AT(shadow->listeners, shadow->num_listeners, n);
  ------------------
  |  |  143|  11.3k|    do {                                            \
  |  |  144|  11.3k|        size_t at_ = (at);                          \
  |  |  145|  11.3k|        assert(at_ < (idxvar));                     \
  |  |  146|  11.3k|        memmove((p) + at_, (p) + at_ + 1,           \
  |  |  147|  11.3k|                ((idxvar) - at_ - 1) * sizeof((p)[0])); \
  |  |  148|  11.3k|        (idxvar)--;                                 \
  |  |  149|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (149:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
  |  Branch (834:17): [True: 11.3k, False: 0]
  ------------------
  835|  11.3k|                break;
  836|  11.3k|            }
  837|  11.3k|        }
  838|  22.7k|        for (int n = 0; n < shadow->num_listeners; n++)
  ------------------
  |  Branch (838:25): [True: 0, False: 22.7k]
  ------------------
  839|  22.7k|            mp_assert(shadow->listeners[n] != in); // only 1 wakeup_cb per cache
  ------------------
  |  |   41|  22.7k|#define mp_assert assert
  ------------------
  |  Branch (839:13): [True: 0, False: 0]
  ------------------
  840|       |        // (The deinitialization path relies on this to free all memory.)
  841|  22.7k|        if (!shadow->num_listeners) {
  ------------------
  |  Branch (841:13): [True: 22.7k, False: 0]
  ------------------
  842|  22.7k|            talloc_free(shadow->listeners);
  ------------------
  |  |   47|  22.7k|#define talloc_free                     ta_free
  ------------------
  843|  22.7k|            shadow->listeners = NULL;
  844|  22.7k|        }
  845|  22.7k|    }
  846|   198k|    if (cb) {
  ------------------
  |  Branch (846:9): [True: 11.3k, False: 186k]
  ------------------
  847|  11.3k|        MP_TARRAY_APPEND(NULL, shadow->listeners, shadow->num_listeners, in);
  ------------------
  |  |  105|  11.3k|    do {                                            \
  |  |  106|  11.3k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  11.3k|    do {                                            \
  |  |  |  |   97|  11.3k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  11.3k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  11.3k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  11.3k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 11.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|  11.3k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  11.3k|    do {                                                        \
  |  |  |  |  |  |   89|  11.3k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  11.3k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  11.3k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  11.3k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  11.3k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  11.3k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  11.3k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 11.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  11.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 11.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  11.3k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  11.3k|        (idxvar)++;                                 \
  |  |  109|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
  848|  11.3k|        in->in_list = true;
  849|  11.3k|        in->wakeup_cb = cb;
  850|  11.3k|        in->wakeup_cb_ctx = cb_ctx;
  851|  11.3k|    }
  852|   198k|    mp_mutex_unlock(&shadow->lock);
  ------------------
  |  |  136|   198k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  853|   198k|}
m_config_cache_set_dispatch_change_cb:
  868|  99.1k|{
  869|  99.1k|    struct config_cache *in = cache->internal;
  870|       |
  871|       |    // Removing the old one is tricky. First make sure no new notifications will
  872|       |    // come.
  873|  99.1k|    m_config_cache_set_wakeup_cb(cache, NULL, NULL);
  874|       |    // Remove any pending notifications (assume we're on the same thread as
  875|       |    // any potential mp_dispatch_queue_process() callers).
  876|  99.1k|    if (in->wakeup_dispatch_queue) {
  ------------------
  |  Branch (876:9): [True: 11.3k, False: 87.7k]
  ------------------
  877|  11.3k|        mp_dispatch_cancel_fn(in->wakeup_dispatch_queue,
  878|  11.3k|                              in->wakeup_dispatch_cb,
  879|  11.3k|                              in->wakeup_dispatch_cb_ctx);
  880|  11.3k|    }
  881|       |
  882|  99.1k|    in->wakeup_dispatch_queue = NULL;
  883|  99.1k|    in->wakeup_dispatch_cb = NULL;
  884|  99.1k|    in->wakeup_dispatch_cb_ctx = NULL;
  885|       |
  886|  99.1k|    if (cb) {
  ------------------
  |  Branch (886:9): [True: 11.3k, False: 87.7k]
  ------------------
  887|  11.3k|        in->wakeup_dispatch_queue = dispatch;
  888|  11.3k|        in->wakeup_dispatch_cb = cb;
  889|  11.3k|        in->wakeup_dispatch_cb_ctx = cb_ctx;
  890|  11.3k|        m_config_cache_set_wakeup_cb(cache, dispatch_notify, in);
  891|  11.3k|    }
  892|  99.1k|}
mp_get_config_group:
  896|  38.5k|{
  897|  38.5k|    struct m_config_cache *cache = m_config_cache_alloc(NULL, global, group);
  898|       |    // Make talloc_free(cache->opts) free the entire cache.
  899|  38.5k|    ta_set_parent(cache->opts, ta_parent);
  900|  38.5k|    ta_set_parent(cache, cache->opts);
  901|  38.5k|    return cache->opts;
  902|  38.5k|}
m_config_core.c:iter_next:
  154|  12.9M|{
  155|  12.9M|    int32_t id = *p_id;
  156|  12.9M|    int group_index = id == -1 ? group_start : id >> 16;
  ------------------
  |  Branch (156:23): [True: 29.7k, False: 12.9M]
  ------------------
  157|  12.9M|    int opt_index = id == -1 ? -1 : id & 0xFFFF;
  ------------------
  |  Branch (157:21): [True: 29.7k, False: 12.9M]
  ------------------
  158|       |
  159|  12.9M|    mp_assert(group_index >= group_start && group_index <= group_end);
  ------------------
  |  |   41|  12.9M|#define mp_assert assert
  ------------------
  |  Branch (159:5): [True: 12.9M, False: 0]
  |  Branch (159:5): [True: 12.9M, False: 0]
  ------------------
  160|       |
  161|  14.4M|    while (1) {
  ------------------
  |  Branch (161:12): [True: 14.4M, Folded]
  ------------------
  162|  14.4M|        if (group_index >= group_end)
  ------------------
  |  Branch (162:13): [True: 29.7k, False: 14.4M]
  ------------------
  163|  29.7k|            return false;
  164|       |
  165|  14.4M|        struct m_config_group *g = &shadow->groups[group_index];
  166|  14.4M|        const struct m_option *opts = g->group->opts;
  167|       |
  168|  14.4M|        mp_assert(opt_index >= -1 && opt_index < g->opt_count);
  ------------------
  |  |   41|  14.4M|#define mp_assert assert
  ------------------
  |  Branch (168:9): [True: 14.4M, False: 0]
  |  Branch (168:9): [True: 14.4M, False: 0]
  ------------------
  169|       |
  170|  14.4M|        opt_index += 1;
  171|       |
  172|  14.4M|        if (!opts || !opts[opt_index].name) {
  ------------------
  |  Branch (172:13): [True: 6.81k, False: 14.4M]
  |  Branch (172:22): [True: 810k, False: 13.6M]
  ------------------
  173|   817k|            group_index += 1;
  174|   817k|            opt_index = -1;
  175|   817k|            continue;
  176|   817k|        }
  177|       |
  178|  13.6M|        if (opts[opt_index].type == &m_option_type_subconfig)
  ------------------
  |  Branch (178:13): [True: 688k, False: 12.9M]
  ------------------
  179|   688k|            continue;
  180|       |
  181|  12.9M|        *p_id = (group_index << 16) | opt_index;
  182|       |        return true;
  183|  13.6M|    }
  184|  12.9M|}
m_config_core.c:get_opt_from_id:
  199|  39.7M|{
  200|  39.7M|    int group_index = id >> 16;
  201|  39.7M|    int opt_index = id & 0xFFFF;
  202|       |
  203|  39.7M|    mp_assert(group_index >= 0 && group_index < shadow->num_groups);
  ------------------
  |  |   41|  39.7M|#define mp_assert assert
  ------------------
  |  Branch (203:5): [True: 39.7M, False: 0]
  |  Branch (203:5): [True: 39.7M, False: 0]
  ------------------
  204|  39.7M|    mp_assert(opt_index >= 0 && opt_index < shadow->groups[group_index].opt_count);
  ------------------
  |  |   41|  39.7M|#define mp_assert assert
  ------------------
  |  Branch (204:5): [True: 39.7M, False: 0]
  |  Branch (204:5): [True: 39.7M, False: 0]
  ------------------
  205|       |
  206|  39.7M|    *out_group_index = group_index;
  207|  39.7M|    *out_opt_index = opt_index;
  208|  39.7M|}
m_config_core.c:concat_name_buf:
  132|  13.8M|{
  133|  13.8M|    mp_assert(a);
  ------------------
  |  |   41|  13.8M|#define mp_assert assert
  ------------------
  |  Branch (133:5): [True: 13.8M, False: 0]
  ------------------
  134|  13.8M|    mp_assert(b);
  ------------------
  |  |   41|  13.8M|#define mp_assert assert
  ------------------
  |  Branch (134:5): [True: 13.8M, False: 0]
  ------------------
  135|  13.8M|    if (!a[0])
  ------------------
  |  Branch (135:9): [True: 10.8M, False: 3.01M]
  ------------------
  136|  10.8M|        return b;
  137|  3.01M|    if (!b[0])
  ------------------
  |  Branch (137:9): [True: 0, False: 3.01M]
  ------------------
  138|      0|        return a;
  139|  3.01M|    snprintf(buf, buf_size, "%s-%s", a, b);
  140|  3.01M|    return buf;
  141|  3.01M|}
m_config_core.c:m_config_gdata:
  120|  21.9M|{
  121|  21.9M|    if (group_index < data->group_index ||
  ------------------
  |  Branch (121:9): [True: 0, False: 21.9M]
  ------------------
  122|  21.9M|        group_index >= data->group_index + data->num_gdata)
  ------------------
  |  Branch (122:9): [True: 0, False: 21.9M]
  ------------------
  123|      0|        return NULL;
  124|       |
  125|  21.9M|    return &data->gdata[group_index - data->group_index];
  126|  21.9M|}
m_config_core.c:get_opt_change_mask:
  281|   316k|{
  282|   316k|    uint64_t changed = opt->flags & UPDATE_OPTS_MASK;
  ------------------
  |  |  465|   316k|#define UPDATE_OPTS_MASK        ((UPDATE_OPT_LAST << 1) - 1)
  |  |  ------------------
  |  |  |  |  462|   316k|#define UPDATE_OPT_LAST         (UINT64_C(1) << 20)
  |  |  ------------------
  ------------------
  283|   404k|    while (group_index != group_root) {
  ------------------
  |  Branch (283:12): [True: 88.6k, False: 316k]
  ------------------
  284|  88.6k|        struct m_config_group *g = &shadow->groups[group_index];
  285|  88.6k|        changed |= g->group->change_flags;
  286|  88.6k|        group_index = g->parent_group;
  287|  88.6k|    }
  288|   316k|    return changed;
  289|   316k|}
m_config_core.c:shadow_destroy:
  432|  29.7k|{
  433|  29.7k|    struct m_config_shadow *shadow = p;
  434|       |
  435|       |    // must all have been unregistered
  436|  29.7k|    mp_assert(shadow->num_listeners == 0);
  ------------------
  |  |   41|  29.7k|#define mp_assert assert
  ------------------
  |  Branch (436:5): [True: 29.7k, False: 0]
  ------------------
  437|       |
  438|  29.7k|    talloc_free(shadow->data);
  ------------------
  |  |   47|  29.7k|#define talloc_free                     ta_free
  ------------------
  439|  29.7k|    mp_mutex_destroy(&shadow->lock);
  ------------------
  |  |  133|  29.7k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
  440|  29.7k|}
m_config_core.c:allocate_option_data:
  414|   104k|{
  415|   104k|    mp_assert(group_index >= 0 && group_index < shadow->num_groups);
  ------------------
  |  |   41|   104k|#define mp_assert assert
  ------------------
  |  Branch (415:5): [True: 104k, False: 0]
  |  Branch (415:5): [True: 104k, False: 0]
  ------------------
  416|   104k|    struct m_config_data *data = talloc_zero(ta_parent, struct m_config_data);
  ------------------
  |  |   27|   104k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|   104k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|   104k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  417|   104k|    talloc_set_destructor(data, free_option_data);
  ------------------
  |  |   41|   104k|#define talloc_set_destructor           ta_set_destructor
  ------------------
  418|       |
  419|   104k|    data->shadow = shadow;
  420|   104k|    data->group_index = group_index;
  421|       |
  422|   104k|    struct m_config_group *root_group = &shadow->groups[group_index];
  423|   104k|    mp_assert(root_group->group_count > 0);
  ------------------
  |  |   41|   104k|#define mp_assert assert
  ------------------
  |  Branch (423:5): [True: 104k, False: 0]
  ------------------
  424|       |
  425|  2.35M|    for (int n = group_index; n < group_index + root_group->group_count; n++)
  ------------------
  |  Branch (425:31): [True: 2.25M, False: 104k]
  ------------------
  426|  2.25M|        alloc_group(data, n, copy);
  427|       |
  428|   104k|    return data;
  429|   104k|}
m_config_core.c:free_option_data:
  388|   104k|{
  389|   104k|    struct m_config_data *data = p;
  390|       |
  391|  2.35M|    for (int i = 0; i < data->num_gdata; i++) {
  ------------------
  |  Branch (391:21): [True: 2.25M, False: 104k]
  ------------------
  392|  2.25M|        struct m_group_data *gdata = &data->gdata[i];
  393|  2.25M|        struct m_config_group *group =
  394|  2.25M|            &data->shadow->groups[data->group_index + i];
  395|  2.25M|        const struct m_option *opts = group->group->opts;
  396|       |
  397|  39.9M|        for (int n = 0; opts && opts[n].name; n++) {
  ------------------
  |  Branch (397:25): [True: 39.9M, False: 0]
  |  Branch (397:33): [True: 37.7M, False: 2.25M]
  ------------------
  398|  37.7M|            const struct m_option *opt = &opts[n];
  399|       |
  400|  37.7M|            if (opt->offset >= 0 && opt->type->size > 0)
  ------------------
  |  Branch (400:17): [True: 35.3M, False: 2.30M]
  |  Branch (400:37): [True: 33.5M, False: 1.88M]
  ------------------
  401|  33.5M|                m_option_free(opt, gdata->udata + opt->offset);
  402|  37.7M|        }
  403|  2.25M|    }
  404|   104k|}
m_config_core.c:alloc_group:
  341|  2.25M|{
  342|  2.25M|    mp_assert(group_index == data->group_index + data->num_gdata);
  ------------------
  |  |   41|  2.25M|#define mp_assert assert
  ------------------
  |  Branch (342:5): [True: 2.25M, False: 0]
  ------------------
  343|  2.25M|    mp_assert(group_index < data->shadow->num_groups);
  ------------------
  |  |   41|  2.25M|#define mp_assert assert
  ------------------
  |  Branch (343:5): [True: 2.25M, False: 0]
  ------------------
  344|  2.25M|    struct m_config_group *group = &data->shadow->groups[group_index];
  345|  2.25M|    const struct m_sub_options *opts = group->group;
  346|       |
  347|  2.25M|    MP_TARRAY_GROW(data, data->gdata, data->num_gdata);
  ------------------
  |  |   96|  2.25M|    do {                                            \
  |  |   97|  2.25M|        size_t nextidx_ = (nextidx);                \
  |  |   98|  2.25M|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  ------------------
  |  |  |  |   84|  2.25M|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  2.25M|#define talloc_get_size                 ta_get_size
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 297k, False: 1.95M]
  |  |  ------------------
  |  |   99|  2.25M|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  ------------------
  |  |  |  |   88|   297k|    do {                                                        \
  |  |  |  |   89|   297k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   297k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   297k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|   297k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|   297k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   90|   297k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |   91|   297k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (91:14): [Folded, False: 297k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  100|  2.25M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (100:14): [Folded, False: 2.25M]
  |  |  ------------------
  ------------------
  348|  2.25M|    struct m_group_data *gdata = &data->gdata[data->num_gdata++];
  349|       |
  350|  2.25M|    struct m_group_data *copy_gdata =
  351|  2.25M|        copy ? m_config_gdata(copy, group_index) : NULL;
  ------------------
  |  Branch (351:9): [True: 1.45M, False: 803k]
  ------------------
  352|       |
  353|  2.25M|    *gdata = (struct m_group_data){
  354|  2.25M|        .udata = talloc_zero_size(data, opts->size),
  ------------------
  |  |   44|  2.25M|#define talloc_zero_size                ta_xzalloc_size
  |  |  ------------------
  |  |  |  |  121|  2.25M|#define ta_xzalloc_size(...)            ta_oom_p(ta_zalloc_size(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.25M|#define ta_zalloc_size(...)     ta_dbg_set_loc(ta_zalloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.25M|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|  2.25M|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|  2.25M|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  355|  2.25M|        .ts = copy_gdata ? copy_gdata->ts : 0,
  ------------------
  |  Branch (355:15): [True: 1.45M, False: 803k]
  ------------------
  356|  2.25M|    };
  357|       |
  358|  2.25M|    if (opts->defaults)
  ------------------
  |  Branch (358:9): [True: 1.98M, False: 266k]
  ------------------
  359|  1.98M|        memcpy(gdata->udata, opts->defaults, opts->size);
  360|       |
  361|  2.25M|    char *copy_src = copy_gdata ? copy_gdata->udata : NULL;
  ------------------
  |  Branch (361:22): [True: 1.45M, False: 803k]
  ------------------
  362|       |
  363|  39.9M|    for (int n = 0; opts->opts && opts->opts[n].name; n++) {
  ------------------
  |  Branch (363:21): [True: 39.9M, False: 0]
  |  Branch (363:35): [True: 37.7M, False: 2.25M]
  ------------------
  364|  37.7M|        const struct m_option *opt = &opts->opts[n];
  365|       |
  366|  37.7M|        if (opt->offset < 0 || opt->type->size == 0)
  ------------------
  |  Branch (366:13): [True: 2.30M, False: 35.3M]
  |  Branch (366:32): [True: 1.88M, False: 33.5M]
  ------------------
  367|  4.19M|            continue;
  368|       |
  369|  33.5M|        void *dst = gdata->udata + opt->offset;
  370|  33.5M|        const void *defptr = opt->defval ? opt->defval : dst;
  ------------------
  |  Branch (370:30): [True: 44.1k, False: 33.4M]
  ------------------
  371|  33.5M|        if (copy_src)
  ------------------
  |  Branch (371:13): [True: 21.4M, False: 12.0M]
  ------------------
  372|  21.4M|            defptr = copy_src + opt->offset;
  373|       |
  374|  33.5M|        init_opt_inplace(opt, dst, defptr);
  375|  33.5M|    }
  376|       |
  377|       |    // If there's a parent, update its pointer to the new struct.
  378|  2.25M|    if (group->parent_group >= data->group_index && group->parent_ptr >= 0) {
  ------------------
  |  Branch (378:9): [True: 2.15M, False: 104k]
  |  Branch (378:53): [True: 1.88M, False: 264k]
  ------------------
  379|  1.88M|        struct m_group_data *parent_gdata =
  380|  1.88M|            m_config_gdata(data, group->parent_group);
  381|  1.88M|        mp_assert(parent_gdata);
  ------------------
  |  |   41|  1.88M|#define mp_assert assert
  ------------------
  |  Branch (381:9): [True: 1.88M, False: 0]
  ------------------
  382|       |
  383|  1.88M|        substruct_write_ptr(parent_gdata->udata + group->parent_ptr, gdata->udata);
  384|  1.88M|    }
  385|  2.25M|}
m_config_core.c:init_opt_inplace:
  327|  33.5M|{
  328|       |    // The option will use dynamic memory allocation iff it has a free callback.
  329|  33.5M|    if (opt->type->free) {
  ------------------
  |  Branch (329:9): [True: 5.89M, False: 27.6M]
  ------------------
  330|  5.89M|        union m_option_value temp;
  331|  5.89M|        memcpy(&temp, src, opt->type->size);
  332|  5.89M|        memset(dst, 0, opt->type->size);
  333|  5.89M|        m_option_copy(opt, dst, &temp);
  334|  27.6M|    } else if (src != dst) {
  ------------------
  |  Branch (334:16): [True: 17.7M, False: 9.87M]
  ------------------
  335|  17.7M|        memcpy(dst, src, opt->type->size);
  336|  17.7M|    }
  337|  33.5M|}
m_config_core.c:substruct_write_ptr:
  318|  1.88M|{
  319|  1.88M|    struct mp_dummy_ *src = val;
  320|  1.88M|    memcpy(ptr, &src, sizeof(src));
  321|  1.88M|}
m_config_core.c:add_sub_group:
  486|   817k|{
  487|       |    // Can't be used multiple times.
  488|  20.1M|    for (int n = 0; n < shadow->num_groups; n++)
  ------------------
  |  Branch (488:21): [True: 19.2M, False: 817k]
  ------------------
  489|  19.2M|        mp_assert(shadow->groups[n].group != subopts);
  ------------------
  |  |   41|   817k|#define mp_assert assert
  ------------------
  |  Branch (489:9): [True: 19.2M, False: 0]
  ------------------
  490|       |
  491|   817k|    if (!name_prefix)
  ------------------
  |  Branch (491:9): [True: 128k, False: 688k]
  ------------------
  492|   128k|        name_prefix = "";
  493|   817k|    if (subopts->prefix && subopts->prefix[0]) {
  ------------------
  |  Branch (493:9): [True: 82.0k, False: 735k]
  |  Branch (493:28): [True: 82.0k, False: 0]
  ------------------
  494|  82.0k|        mp_assert(!name_prefix[0]);
  ------------------
  |  |   41|  82.0k|#define mp_assert assert
  ------------------
  |  Branch (494:9): [True: 82.0k, False: 0]
  ------------------
  495|  82.0k|        name_prefix = subopts->prefix;
  496|  82.0k|    }
  497|       |
  498|       |    // You can only use UPDATE_ flags here.
  499|   817k|    mp_assert(!(subopts->change_flags & ~UPDATE_OPTS_MASK));
  ------------------
  |  |   41|   817k|#define mp_assert assert
  ------------------
  |  Branch (499:5): [True: 817k, False: 0]
  ------------------
  500|       |
  501|   817k|    mp_assert(parent_group_index >= -1 && parent_group_index < shadow->num_groups);
  ------------------
  |  |   41|   817k|#define mp_assert assert
  ------------------
  |  Branch (501:5): [True: 817k, False: 0]
  |  Branch (501:5): [True: 817k, False: 0]
  ------------------
  502|       |
  503|   817k|    int group_index = shadow->num_groups++;
  504|   817k|    MP_TARRAY_GROW(shadow, shadow->groups, group_index);
  ------------------
  |  |   96|   817k|    do {                                            \
  |  |   97|   817k|        size_t nextidx_ = (nextidx);                \
  |  |   98|   817k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  ------------------
  |  |  |  |   84|   817k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|   817k|#define talloc_get_size                 ta_get_size
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 95.3k, False: 721k]
  |  |  ------------------
  |  |   99|   817k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  ------------------
  |  |  |  |   88|  95.3k|    do {                                                        \
  |  |  |  |   89|  95.3k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  95.3k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  95.3k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|  95.3k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|  95.3k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   90|  95.3k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |   91|  95.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (91:14): [Folded, False: 95.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  100|   817k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (100:14): [Folded, False: 817k]
  |  |  ------------------
  ------------------
  505|   817k|    shadow->groups[group_index] = (struct m_config_group){
  506|   817k|        .group = subopts,
  507|   817k|        .parent_group = parent_group_index,
  508|   817k|        .parent_ptr = parent_ptr,
  509|   817k|        .prefix = name_prefix,
  510|   817k|    };
  511|       |
  512|  14.4M|    for (int i = 0; subopts->opts && subopts->opts[i].name; i++) {
  ------------------
  |  Branch (512:21): [True: 14.4M, False: 6.81k]
  |  Branch (512:38): [True: 13.6M, False: 810k]
  ------------------
  513|  13.6M|        const struct m_option *opt = &subopts->opts[i];
  514|       |
  515|  13.6M|        if (opt->type == &m_option_type_subconfig) {
  ------------------
  |  Branch (515:13): [True: 688k, False: 12.9M]
  ------------------
  516|   688k|            const struct m_sub_options *new_subopts = opt->priv;
  517|       |
  518|       |            // Providing default structs in-place is not allowed.
  519|   688k|            if (opt->offset >= 0 && subopts->defaults) {
  ------------------
  |  Branch (519:17): [True: 688k, False: 0]
  |  Branch (519:37): [True: 672k, False: 16.4k]
  ------------------
  520|   672k|                void *ptr = (char *)subopts->defaults + opt->offset;
  521|   672k|                mp_assert(!substruct_read_ptr(ptr));
  ------------------
  |  |   41|   672k|#define mp_assert assert
  ------------------
  |  Branch (521:17): [True: 672k, False: 0]
  ------------------
  522|   672k|            }
  523|       |
  524|   688k|            const char *prefix = concat_name(shadow, name_prefix, opt->name);
  525|   688k|            add_sub_group(shadow, prefix, group_index, opt->offset, new_subopts);
  526|       |
  527|  12.9M|        } else if (opt->type == &m_option_type_obj_settings_list) {
  ------------------
  |  Branch (527:20): [True: 114k, False: 12.8M]
  ------------------
  528|   114k|            const struct m_obj_list *objlist = opt->priv;
  529|   114k|            init_obj_settings_list(shadow, group_index, objlist);
  530|   114k|        }
  531|       |
  532|  13.6M|        shadow->groups[group_index].opt_count = i + 1;
  533|  13.6M|    }
  534|       |
  535|   817k|    if (subopts->get_sub_options) {
  ------------------
  |  Branch (535:9): [True: 16.4k, False: 800k]
  ------------------
  536|   213k|        for (int i = 0; ; i++) {
  537|   213k|            const struct m_sub_options *sub = NULL;
  538|   213k|            if (!subopts->get_sub_options(i, &sub))
  ------------------
  |  Branch (538:17): [True: 16.4k, False: 196k]
  ------------------
  539|  16.4k|                break;
  540|   196k|            if (sub)
  ------------------
  |  Branch (540:17): [True: 0, False: 196k]
  ------------------
  541|      0|                add_sub_group(shadow, NULL, group_index, -1, sub);
  542|   196k|        }
  543|  16.4k|    }
  544|       |
  545|   817k|    shadow->groups[group_index].group_count = shadow->num_groups - group_index;
  546|   817k|}
m_config_core.c:substruct_read_ptr:
  312|   672k|{
  313|   672k|    struct mp_dummy_ *res;
  314|   672k|    memcpy(&res, ptr, sizeof(res));
  315|   672k|    return res;
  316|   672k|}
m_config_core.c:concat_name:
  146|   688k|{
  147|   688k|    char buf[M_CONFIG_MAX_OPT_NAME_LEN];
  148|   688k|    const char *r = concat_name_buf(buf, sizeof(buf), a, b);
  149|   688k|    return r == buf ? talloc_strdup(ta_parent, r) : r;
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (149:12): [True: 0, False: 688k]
  ------------------
  150|   688k|}
m_config_core.c:init_obj_settings_list:
  461|   114k|{
  462|   114k|    struct m_obj_desc desc;
  463|   541k|    for (int n = 0; ; n++) {
  464|   541k|        if (!list->get_desc(&desc, n))
  ------------------
  |  Branch (464:13): [True: 114k, False: 426k]
  ------------------
  465|   114k|            break;
  466|   426k|        if (desc.global_opts) {
  ------------------
  |  Branch (466:13): [True: 16.4k, False: 410k]
  ------------------
  467|  16.4k|            add_sub_group(shadow, NULL, parent_group_index, -1,
  468|  16.4k|                          desc.global_opts);
  469|  16.4k|        }
  470|   426k|        if (list->use_global_options && desc.options) {
  ------------------
  |  Branch (470:13): [True: 229k, False: 196k]
  |  Branch (470:41): [True: 82.0k, False: 147k]
  ------------------
  471|  82.0k|            struct m_sub_options *conf = talloc_ptrtype(shadow, conf);
  ------------------
  |  |   34|  82.0k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  82.0k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  82.0k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  472|  82.0k|            *conf = (struct m_sub_options){
  473|  82.0k|                .prefix = desc.options_prefix,
  474|  82.0k|                .opts = desc.options,
  475|  82.0k|                .defaults = desc.priv_defaults,
  476|  82.0k|                .size = desc.priv_size,
  477|  82.0k|            };
  478|       |            add_sub_group(shadow, NULL, parent_group_index, -1, conf);
  479|  82.0k|        }
  480|   426k|    }
  481|   114k|}
m_config_core.c:cache_destroy:
  549|  87.7k|{
  550|  87.7k|    struct m_config_cache *cache = p;
  551|       |
  552|       |    // (technically speaking, being able to call them both without anything
  553|       |    // breaking is a feature provided by these functions)
  554|  87.7k|    m_config_cache_set_wakeup_cb(cache, NULL, NULL);
  555|  87.7k|    m_config_cache_set_dispatch_change_cb(cache, NULL, NULL, NULL);
  556|  87.7k|}
m_config_core.c:cache_check_update:
  703|  50.5k|{
  704|  50.5k|    struct config_cache *in = cache->internal;
  705|  50.5k|    struct m_config_shadow *shadow = in->shadow;
  706|       |
  707|       |    // Using atomics and checking outside of the lock - it's unknown whether
  708|       |    // this makes it faster or slower. Just cargo culting it.
  709|  50.5k|    uint64_t new_ts = atomic_load(&shadow->ts);
  710|  50.5k|    if (in->ts >= new_ts)
  ------------------
  |  Branch (710:9): [True: 22.7k, False: 27.7k]
  ------------------
  711|  22.7k|        return false;
  712|       |
  713|  27.7k|    in->ts = new_ts;
  714|  27.7k|    in->upd_group = in->data->group_index;
  715|  27.7k|    in->upd_opt = 0;
  716|       |    return true;
  717|  50.5k|}
m_config_core.c:update_next_option:
  639|  97.1k|{
  640|  97.1k|    struct config_cache *in = cache->internal;
  641|  97.1k|    struct m_config_data *dst = in->data;
  642|  97.1k|    struct m_config_data *src = in->src;
  643|       |
  644|  97.1k|    mp_assert(src->group_index == 0); // must be the option root currently
  ------------------
  |  |   41|  97.1k|#define mp_assert assert
  ------------------
  |  Branch (644:5): [True: 97.1k, False: 0]
  ------------------
  645|       |
  646|  97.1k|    *p_opt = NULL;
  647|       |
  648|   147k|    while (in->upd_group < dst->group_index + dst->num_gdata) {
  ------------------
  |  Branch (648:12): [True: 119k, False: 27.7k]
  ------------------
  649|   119k|        struct m_group_data *gsrc = m_config_gdata(src, in->upd_group);
  650|   119k|        struct m_group_data *gdst = m_config_gdata(dst, in->upd_group);
  651|   119k|        mp_assert(gsrc && gdst);
  ------------------
  |  |   41|   119k|#define mp_assert assert
  ------------------
  |  Branch (651:9): [True: 119k, False: 0]
  |  Branch (651:9): [True: 119k, False: 0]
  ------------------
  652|       |
  653|   119k|        if (gdst->ts < gsrc->ts) {
  ------------------
  |  Branch (653:13): [True: 85.9k, False: 34.0k]
  ------------------
  654|  85.9k|            struct m_config_group *g = &dst->shadow->groups[in->upd_group];
  655|  85.9k|            const struct m_option *opts = g->group->opts;
  656|       |
  657|   348k|            while (opts && opts[in->upd_opt].name) {
  ------------------
  |  Branch (657:20): [True: 348k, False: 0]
  |  Branch (657:28): [True: 332k, False: 16.5k]
  ------------------
  658|   332k|                const struct m_option *opt = &opts[in->upd_opt];
  659|   332k|                void *dsrc = gsrc->udata + opt->offset;
  660|   332k|                void *ddst = gdst->udata + opt->offset;
  661|       |
  662|   332k|                if (opt->offset >= 0 && opt->type->size) {
  ------------------
  |  Branch (662:21): [True: 298k, False: 33.3k]
  |  Branch (662:41): [True: 298k, False: 8]
  ------------------
  663|   298k|                    bool opt_equal = m_option_equal(opt, ddst, dsrc);
  664|   298k|                    bool force_update = opt->force_update &&
  ------------------
  |  Branch (664:41): [True: 0, False: 298k]
  ------------------
  665|      0|                                        check_force_update(gsrc, opt->name, in->ts);
  ------------------
  |  Branch (665:41): [True: 0, False: 0]
  ------------------
  666|   298k|                    if (!opt_equal || force_update) {
  ------------------
  |  Branch (666:25): [True: 69.3k, False: 229k]
  |  Branch (666:39): [True: 0, False: 229k]
  ------------------
  667|  69.3k|                        uint64_t ch = get_opt_change_mask(dst->shadow,
  668|  69.3k|                                        in->upd_group, dst->group_index, opt);
  669|       |
  670|  69.3k|                        if (cache->debug && !opt_equal) {
  ------------------
  |  Branch (670:29): [True: 0, False: 69.3k]
  |  Branch (670:45): [True: 0, False: 0]
  ------------------
  671|      0|                            char *vdst = m_option_print(opt, ddst);
  672|      0|                            char *vsrc = m_option_print(opt, dsrc);
  673|      0|                            mp_warn(cache->debug, "Option '%s' changed from "
  ------------------
  |  |   77|      0|#define mp_warn(log, ...)       mp_msg(log, MSGL_WARN, __VA_ARGS__)
  ------------------
  674|      0|                                    "'%s' to' %s' (flags = 0x%"PRIx64")\n",
  675|      0|                                    opt->name, vdst, vsrc, ch);
  676|      0|                            talloc_free(vdst);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  677|      0|                            talloc_free(vsrc);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  678|      0|                        }
  679|       |
  680|  69.3k|                        m_option_copy(opt, ddst, dsrc);
  681|  69.3k|                        cache->change_flags |= ch;
  682|       |
  683|  69.3k|                        in->upd_opt++; // skip this next time
  684|  69.3k|                        *p_opt = ddst;
  685|  69.3k|                        return;
  686|  69.3k|                    }
  687|   298k|                }
  688|       |
  689|   262k|                in->upd_opt++;
  690|   262k|            }
  691|       |
  692|  16.5k|            gdst->ts = gsrc->ts;
  693|  16.5k|        }
  694|       |
  695|  50.5k|        in->upd_group++;
  696|  50.5k|        in->upd_opt = 0;
  697|  50.5k|    }
  698|       |
  699|  27.7k|    in->upd_group = -1;
  700|  27.7k|}
m_config_core.c:find_opt:
  757|   338k|{
  758|   338k|    *group_idx = -1;
  759|   338k|    *opt_idx = -1;
  760|       |
  761|  4.80M|    for (int n = data->group_index; n < data->group_index + data->num_gdata; n++)
  ------------------
  |  Branch (761:37): [True: 4.80M, False: 0]
  ------------------
  762|  4.80M|    {
  763|  4.80M|        struct m_group_data *gd = m_config_gdata(data, n);
  764|  4.80M|        struct m_config_group *g = &shadow->groups[n];
  765|  4.80M|        const struct m_option *opts = g->group->opts;
  766|       |
  767|  98.0M|        for (int i = 0; opts && opts[i].name; i++) {
  ------------------
  |  Branch (767:25): [True: 98.0M, False: 0]
  |  Branch (767:33): [True: 93.5M, False: 4.46M]
  ------------------
  768|  93.5M|            const struct m_option *opt = &opts[i];
  769|       |
  770|  93.5M|            if (opt->offset >= 0 && opt->type->size &&
  ------------------
  |  Branch (770:17): [True: 84.3M, False: 9.16M]
  |  Branch (770:37): [True: 77.2M, False: 7.10M]
  ------------------
  771|  77.2M|                ptr == gd->udata + opt->offset)
  ------------------
  |  Branch (771:17): [True: 338k, False: 76.9M]
  ------------------
  772|   338k|            {
  773|   338k|                *group_idx = n;
  774|   338k|                *opt_idx = i;
  775|   338k|                return;
  776|   338k|            }
  777|  93.5M|        }
  778|  4.80M|    }
  779|   338k|}
m_config_core.c:append_force_update:
  612|  3.23k|{
  613|  3.36k|    for (int i = 0; i < gdata->force_update_len; ++i) {
  ------------------
  |  Branch (613:21): [True: 2.87k, False: 485]
  ------------------
  614|  2.87k|        if (strcmp(opt_name, gdata->force_update[i]->name) == 0) {
  ------------------
  |  Branch (614:13): [True: 2.75k, False: 127]
  ------------------
  615|  2.75k|            gdata->force_update[i]->ts = gdata->ts;
  616|  2.75k|            return;
  617|  2.75k|        }
  618|  2.87k|    }
  619|    485|    struct force_update *new_update = talloc_zero(cache, struct force_update);
  ------------------
  |  |   27|    485|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|    485|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|    485|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  620|    485|    new_update->name = talloc_strdup(cache, opt_name);
  ------------------
  |  |   50|    485|#define talloc_strdup                   ta_xstrdup
  ------------------
  621|    485|    new_update->ts = gdata->ts;
  622|    485|    MP_TARRAY_APPEND(cache, gdata->force_update, gdata->force_update_len, new_update);
  ------------------
  |  |  105|    485|    do {                                            \
  |  |  106|    485|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|    485|    do {                                            \
  |  |  |  |   97|    485|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|    485|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|    485|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|    485|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 474, False: 11]
  |  |  |  |  ------------------
  |  |  |  |   99|    485|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|    474|    do {                                                        \
  |  |  |  |  |  |   89|    474|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|    474|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|    474|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|    474|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    474|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|    474|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|    474|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 474]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|    485|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 485]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|    485|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|    485|        (idxvar)++;                                 \
  |  |  109|    485|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 485]
  |  |  ------------------
  ------------------
  623|    485|}

m_config_from_obj_desc_noalloc:
  146|  13.3k|{
  147|       |    return m_config_from_obj_desc(talloc_ctx, log, NULL, desc);
  148|  13.3k|}
m_config_restore_backups:
  235|  47.2k|{
  236|  47.2k|    restore_backups(&config->backup_opts, config);
  237|  47.2k|}
m_config_backup_watch_later_opts:
  276|  11.3k|{
  277|       |    // Runs once on the empty list, which is looked up by name.
  278|  11.3k|    mp_assert(!config->watch_later_backup_opts);
  ------------------
  |  |   41|  11.3k|#define mp_assert assert
  ------------------
  |  Branch (278:5): [True: 11.3k, False: 0]
  ------------------
  279|  8.94M|    for (int n = 0; n < config->num_opts; n++) {
  ------------------
  |  Branch (279:21): [True: 8.93M, False: 11.3k]
  ------------------
  280|  8.93M|        if (config->opts[n].data)
  ------------------
  |  Branch (280:13): [True: 8.36M, False: 569k]
  ------------------
  281|  8.36M|            add_backup(&config->watch_later_backup_opts, 0, &config->opts[n]);
  282|  8.93M|    }
  283|  11.3k|}
m_config_get_co_raw:
  300|  2.39M|{
  301|  2.39M|    struct m_config_option **co =
  302|  2.39M|        bsearch(&name, config->sorted_opts, config->num_opts,
  303|  2.39M|                sizeof(config->sorted_opts[0]), search_opt_name);
  304|  2.39M|    return co ? *co : NULL;
  ------------------
  |  Branch (304:12): [True: 2.11M, False: 287k]
  ------------------
  305|  2.39M|}
m_config_get_co:
  359|  1.69M|{
  360|  1.69M|    struct m_config_option *co = m_config_get_co_any(config, name);
  361|       |    // CLI aliases should not be real options, and are explicitly handled by
  362|       |    // m_config_set_option_cli(). So pretend it does not exist.
  363|  1.69M|    if (co && co->opt->type == &m_option_type_cli_alias)
  ------------------
  |  Branch (363:9): [True: 1.54M, False: 150k]
  |  Branch (363:15): [True: 180k, False: 1.36M]
  ------------------
  364|   180k|        co = NULL;
  365|  1.69M|    return co;
  366|  1.69M|}
m_config_get_co_count:
  369|  16.4k|{
  370|  16.4k|    return config->num_opts;
  371|  16.4k|}
m_config_get_co_index:
  374|  12.8M|{
  375|  12.8M|    return &config->opts[index];
  376|  12.8M|}
m_config_get_co_default:
  380|  29.7k|{
  381|  29.7k|    return m_config_shadow_get_opt_default(config->shadow, co->opt_id);
  382|  29.7k|}
m_config_get_positional_option:
  385|  5.96k|{
  386|  5.96k|    int pos = 0;
  387|  12.5k|    for (int n = 0; n < config->num_opts; n++) {
  ------------------
  |  Branch (387:21): [True: 12.5k, False: 26]
  ------------------
  388|  12.5k|        struct m_config_option *co = &config->opts[n];
  389|  12.5k|        if (!co->opt->deprecation_message) {
  ------------------
  |  Branch (389:13): [True: 12.4k, False: 109]
  ------------------
  390|  12.4k|            if (pos == p)
  ------------------
  |  Branch (390:17): [True: 5.94k, False: 6.47k]
  ------------------
  391|  5.94k|                return co->name;
  392|  6.47k|            pos++;
  393|  6.47k|        }
  394|  12.5k|    }
  395|     26|    return NULL;
  396|  5.96k|}
m_config_mark_co_flags:
  431|   338k|{
  432|   338k|    if (flags & M_SETOPT_FROM_CMDLINE)
  ------------------
  |  Branch (432:9): [True: 171k, False: 167k]
  ------------------
  433|   171k|        co->is_set_from_cmdline = true;
  434|       |
  435|   338k|    if (flags & M_SETOPT_FROM_CONFIG_FILE)
  ------------------
  |  Branch (435:9): [True: 259k, False: 78.8k]
  ------------------
  436|   259k|        co->is_set_from_config = true;
  437|   338k|}
m_config_set_update_dispatch_queue:
  530|  11.3k|{
  531|  11.3k|    m_config_cache_set_dispatch_change_cb(config->cache, dispatch,
  532|  11.3k|                                          async_change_cb, config);
  533|  11.3k|}
m_config_new:
  554|  29.7k|{
  555|  29.7k|    struct m_config *config = talloc(talloc_ctx, struct m_config);
  ------------------
  |  |   26|  29.7k|#define talloc                          ta_xnew
  |  |  ------------------
  |  |  |  |  133|  29.7k|#define ta_xnew(...)                    ta_oom_g(ta_new(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  29.7k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  556|  29.7k|    talloc_set_destructor(config, config_destroy);
  ------------------
  |  |   41|  29.7k|#define talloc_set_destructor           ta_set_destructor
  ------------------
  557|  29.7k|    *config = (struct m_config){.log = log,};
  558|       |
  559|  29.7k|    config->shadow = m_config_shadow_new(root);
  560|       |
  561|  29.7k|    if (root->size) {
  ------------------
  |  Branch (561:9): [True: 16.4k, False: 13.3k]
  ------------------
  562|  16.4k|        config->cache = m_config_cache_from_shadow(config, config->shadow, root);
  563|  16.4k|        config->optstruct = config->cache->opts;
  564|  16.4k|    }
  565|       |
  566|  29.7k|    int32_t optid = -1;
  567|  12.9M|    while (m_config_shadow_get_next_opt(config->shadow, &optid)) {
  ------------------
  |  Branch (567:12): [True: 12.9M, False: 29.7k]
  ------------------
  568|  12.9M|        char buf[M_CONFIG_MAX_OPT_NAME_LEN];
  569|  12.9M|        const char *opt_name =
  570|  12.9M|            m_config_shadow_get_opt_name(config->shadow, optid, buf, sizeof(buf));
  571|       |
  572|  12.9M|        struct m_config_option co = {
  573|  12.9M|            .name = talloc_strdup(config, opt_name),
  ------------------
  |  |   50|  12.9M|#define talloc_strdup                   ta_xstrdup
  ------------------
  574|  12.9M|            .opt = m_config_shadow_get_opt(config->shadow, optid),
  575|  12.9M|            .opt_id = optid,
  576|  12.9M|        };
  577|       |
  578|  12.9M|        if (config->cache)
  ------------------
  |  Branch (578:13): [True: 12.8M, False: 82.4k]
  ------------------
  579|  12.8M|            co.data = m_config_cache_get_opt_data(config->cache, optid);
  580|       |
  581|  12.9M|        MP_TARRAY_APPEND(config, config->opts, config->num_opts, co);
  ------------------
  |  |  105|  12.9M|    do {                                            \
  |  |  106|  12.9M|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  12.9M|    do {                                            \
  |  |  |  |   97|  12.9M|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  12.9M|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  12.9M|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  12.9M|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 165k, False: 12.7M]
  |  |  |  |  ------------------
  |  |  |  |   99|  12.9M|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|   165k|    do {                                                        \
  |  |  |  |  |  |   89|   165k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|   165k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|   165k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|   165k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|   165k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|   165k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|   165k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 165k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  12.9M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 12.9M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  12.9M|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  12.9M|        (idxvar)++;                                 \
  |  |  109|  12.9M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 12.9M]
  |  |  ------------------
  ------------------
  582|  12.9M|    }
  583|       |
  584|  29.7k|    config->sorted_opts = talloc_array(config, struct m_config_option *, config->num_opts);
  ------------------
  |  |   29|  29.7k|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|  29.7k|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  29.7k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  585|  12.9M|    for (int n = 0; n < config->num_opts; n++)
  ------------------
  |  Branch (585:21): [True: 12.9M, False: 29.7k]
  ------------------
  586|  12.9M|        config->sorted_opts[n] = &config->opts[n];
  587|  29.7k|    qsort(config->sorted_opts, config->num_opts, sizeof(config->sorted_opts[0]), compare_opt_name);
  588|       |
  589|  29.7k|    return config;
  590|  29.7k|}
m_config_set_option_raw:
  637|  1.34M|{
  638|  1.34M|    if (!co)
  ------------------
  |  Branch (638:9): [True: 0, False: 1.34M]
  ------------------
  639|      0|        return M_OPT_UNKNOWN;
  ------------------
  |  |  529|      0|#define M_OPT_UNKNOWN           -1
  ------------------
  640|       |
  641|  1.34M|    int r = handle_set_opt_flags(config, co, flags);
  642|  1.34M|    if (r <= 1)
  ------------------
  |  Branch (642:9): [True: 982k, False: 359k]
  ------------------
  643|   982k|        return r;
  644|       |
  645|   359k|    r = m_config_handle_special_options(config, co, data, flags);
  646|   359k|    if (r != M_OPT_UNKNOWN)
  ------------------
  |  |  529|   359k|#define M_OPT_UNKNOWN           -1
  ------------------
  |  Branch (646:9): [True: 18.6k, False: 340k]
  ------------------
  647|  18.6k|        return r;
  648|       |
  649|       |    // This affects some special options like "playlist", "v". Maybe these
  650|       |    // should work, or maybe not. For now they would require special code.
  651|   340k|    if (!co->data)
  ------------------
  |  Branch (651:9): [True: 2.50k, False: 338k]
  ------------------
  652|  2.50k|        return flags & M_SETOPT_FROM_CMDLINE ? 0 : M_OPT_UNKNOWN;
  ------------------
  |  |  529|      0|#define M_OPT_UNKNOWN           -1
  ------------------
  |  Branch (652:16): [True: 2.50k, False: 0]
  ------------------
  653|       |
  654|   338k|    if (config->profile_backup_tmp)
  ------------------
  |  Branch (654:9): [True: 0, False: 338k]
  ------------------
  655|      0|        ensure_backup(config->profile_backup_tmp, config->profile_backup_flags, co);
  656|       |
  657|   338k|    m_config_mark_co_flags(co, flags);
  658|       |
  659|   338k|    m_option_copy(co->opt, co->data, data);
  660|   338k|    if (m_config_cache_write_opt(config->cache, co->data))
  ------------------
  |  Branch (660:9): [True: 246k, False: 91.6k]
  ------------------
  661|   246k|        force_self_notify_change_opt(config, co, false);
  662|       |
  663|   338k|    return 0;
  664|   340k|}
m_config_set_option_cli:
  739|  1.49M|{
  740|  1.49M|    int r;
  741|  1.49M|    mp_assert(config != NULL);
  ------------------
  |  |   41|  1.49M|#define mp_assert assert
  ------------------
  |  Branch (741:5): [True: 1.49M, False: 0]
  ------------------
  742|       |
  743|  1.49M|    bool negate;
  744|  1.49M|    struct m_config_option *co =
  745|  1.49M|        m_config_mogrify_cli_opt(config, &name, &negate, &(int){0});
  746|       |
  747|  1.49M|    if (!co) {
  ------------------
  |  Branch (747:9): [True: 86.5k, False: 1.40M]
  ------------------
  748|  86.5k|        r = M_OPT_UNKNOWN;
  ------------------
  |  |  529|  86.5k|#define M_OPT_UNKNOWN           -1
  ------------------
  749|  86.5k|        goto done;
  750|  86.5k|    }
  751|       |
  752|  1.40M|    if (negate) {
  ------------------
  |  Branch (752:9): [True: 569, False: 1.40M]
  ------------------
  753|    569|        if (param.len) {
  ------------------
  |  Branch (753:13): [True: 194, False: 375]
  ------------------
  754|    194|            r = M_OPT_DISALLOW_PARAM;
  ------------------
  |  |  542|    194|#define M_OPT_DISALLOW_PARAM    -5
  ------------------
  755|    194|            goto done;
  756|    194|        }
  757|       |
  758|    375|        param = bstr0("no");
  759|    375|    }
  760|       |
  761|  1.40M|    if (flags & M_SETOPT_FROM_CONFIG_FILE)
  ------------------
  |  Branch (761:9): [True: 1.24M, False: 159k]
  ------------------
  762|  1.24M|        co->coalesce = true;
  763|       |
  764|       |    // This is the only mandatory function
  765|  1.40M|    mp_assert(co->opt->type->parse);
  ------------------
  |  |   41|  1.40M|#define mp_assert assert
  ------------------
  |  Branch (765:5): [True: 1.40M, False: 0]
  ------------------
  766|       |
  767|  1.40M|    r = handle_set_opt_flags(config, co, flags);
  768|  1.40M|    if (r <= 0)
  ------------------
  |  Branch (768:9): [True: 67.2k, False: 1.33M]
  ------------------
  769|  67.2k|        goto done;
  770|       |
  771|  1.33M|    if (r == 2) {
  ------------------
  |  Branch (771:9): [True: 353k, False: 983k]
  ------------------
  772|   353k|        MP_VERBOSE(config, "Setting option '%.*s' = '%.*s' (flags = %d)\n",
  ------------------
  |  |   92|   353k|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  1.41M|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 353k, False: 0]
  |  |  |  |  |  Branch (86:57): [True: 353k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  773|   353k|                   BSTR_P(name), BSTR_P(param), flags);
  774|   353k|    }
  775|       |
  776|  1.33M|    union m_option_value val = m_option_value_default;
  777|       |
  778|       |    // Some option types are "impure" and work on the existing data.
  779|       |    // (Prime examples: --vf-add, --sub-file)
  780|  1.33M|    if (co->data)
  ------------------
  |  Branch (780:9): [True: 1.24M, False: 88.8k]
  ------------------
  781|  1.24M|        m_option_copy(co->opt, &val, co->data);
  782|       |
  783|  1.33M|    r = m_option_parse(config->log, co->opt, name, param, &val);
  784|       |
  785|  1.33M|    if (r >= 0)
  ------------------
  |  Branch (785:9): [True: 1.32M, False: 10.9k]
  ------------------
  786|  1.32M|        r = m_config_set_option_raw(config, co, &val, flags);
  787|       |
  788|  1.33M|    m_option_free(co->opt, &val);
  789|       |
  790|  1.49M|done:
  791|  1.49M|    if (r < 0 && r != M_OPT_EXIT) {
  ------------------
  |  |  545|  98.1k|#define M_OPT_EXIT              -6
  ------------------
  |  Branch (791:9): [True: 98.1k, False: 1.39M]
  |  Branch (791:18): [True: 93.2k, False: 4.88k]
  ------------------
  792|  93.2k|        MP_ERR(config, "Error parsing option %.*s (%s)\n",
  ------------------
  |  |   89|  93.2k|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|   186k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 93.2k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  793|  93.2k|               BSTR_P(name), m_option_strerror(r));
  794|  93.2k|        r = M_OPT_INVALID;
  ------------------
  |  |  535|  93.2k|#define M_OPT_INVALID           -3
  ------------------
  795|  93.2k|    }
  796|  1.49M|    return r;
  797|  1.33M|}
m_config_set_option_node:
  801|  16.4k|{
  802|  16.4k|    int r;
  803|       |
  804|  16.4k|    struct m_config_option *co = m_config_get_co(config, name);
  805|  16.4k|    if (!co)
  ------------------
  |  Branch (805:9): [True: 0, False: 16.4k]
  ------------------
  806|      0|        return M_OPT_UNKNOWN;
  ------------------
  |  |  529|      0|#define M_OPT_UNKNOWN           -1
  ------------------
  807|       |
  808|       |    // Do this on an "empty" type to make setting the option strictly overwrite
  809|       |    // the old value, as opposed to e.g. appending to lists.
  810|  16.4k|    union m_option_value val = m_option_value_default;
  811|       |
  812|  16.4k|    r = m_option_set_node_or_string(mp_null_log, co->opt, name, &val, data);
  813|  16.4k|    if (r >= 0)
  ------------------
  |  Branch (813:9): [True: 16.4k, False: 0]
  ------------------
  814|  16.4k|        r = m_config_set_option_raw(config, co, &val, flags);
  815|       |
  816|  16.4k|    if (mp_msg_test(config->log, MSGL_V)) {
  ------------------
  |  Branch (816:9): [True: 0, False: 16.4k]
  ------------------
  817|      0|        char *s = m_option_type_node.print(NULL, data);
  818|      0|        MP_DBG(config, "Setting option '%.*s' = %s (flags = %d) -> %d\n",
  ------------------
  |  |   93|      0|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 0, False: 0]
  |  |  |  |  |  Branch (86:57): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  819|      0|               BSTR_P(name), s ? s : "?", flags, r);
  820|      0|        talloc_free(s);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  821|      0|    }
  822|       |
  823|  16.4k|    m_option_free(co->opt, &val);
  824|  16.4k|    return r;
  825|  16.4k|}
m_config_option_requires_param:
  828|   170k|{
  829|   170k|    bool negate;
  830|   170k|    int flags;
  831|   170k|    struct m_config_option *co =
  832|   170k|        m_config_mogrify_cli_opt(config, &name, &negate, &flags);
  833|       |
  834|   170k|    if (!co)
  ------------------
  |  Branch (834:9): [True: 19.3k, False: 151k]
  ------------------
  835|  19.3k|        return M_OPT_UNKNOWN;
  ------------------
  |  |  529|  19.3k|#define M_OPT_UNKNOWN           -1
  ------------------
  836|       |
  837|   151k|    if (negate || (flags & M_OPT_TYPE_OPTIONAL_PARAM))
  ------------------
  |  |  507|   150k|#define M_OPT_TYPE_OPTIONAL_PARAM       (1 << 0)
  ------------------
  |  Branch (837:9): [True: 569, False: 150k]
  |  Branch (837:19): [True: 1.50k, False: 148k]
  ------------------
  838|  2.07k|        return 0;
  839|       |
  840|   148k|    return m_option_required_params(co->opt);
  841|   151k|}
m_config_print_option_list:
  851|    170|{
  852|    170|    char min[50], max[50];
  853|    170|    int count = 0;
  854|    170|    const char *prefix = config->is_toplevel ? "--" : "";
  ------------------
  |  Branch (854:26): [True: 164, False: 6]
  ------------------
  855|       |
  856|    170|    struct m_config_option *sorted =
  857|    170|        talloc_memdup(NULL, config->opts, config->num_opts * sizeof(sorted[0]));
  ------------------
  |  |   49|    170|#define talloc_memdup                   ta_xmemdup
  |  |  ------------------
  |  |  |  |  157|    170|#define ta_xmemdup(...)         ta_dbg_set_loc(ta_xmemdup(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    170|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|    170|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|    170|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  858|    170|    if (config->is_toplevel)
  ------------------
  |  Branch (858:9): [True: 164, False: 6]
  ------------------
  859|    164|        qsort(sorted, config->num_opts, sizeof(sorted[0]), sort_opt_compare);
  860|       |
  861|    170|    MP_INFO(config, "Options:\n\n");
  ------------------
  |  |   91|    170|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    170|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  862|   128k|    for (int i = 0; i < config->num_opts; i++) {
  ------------------
  |  Branch (862:21): [True: 128k, False: 170]
  ------------------
  863|   128k|        struct m_config_option *co = &sorted[i];
  864|   128k|        const struct m_option *opt = co->opt;
  865|   128k|        if (strcmp(name, "*") != 0 && !strstr(co->name, name))
  ------------------
  |  Branch (865:13): [True: 124k, False: 3.96k]
  |  Branch (865:39): [True: 99.0k, False: 25.6k]
  ------------------
  866|  99.0k|            continue;
  867|  29.6k|        MP_INFO(config, " %s%-30s", prefix, co->name);
  ------------------
  |  |   91|  29.6k|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  29.6k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  868|  29.6k|        if (opt->type == &m_option_type_choice) {
  ------------------
  |  Branch (868:13): [True: 4.70k, False: 24.8k]
  ------------------
  869|  4.70k|            MP_INFO(config, " Choices:");
  ------------------
  |  |   91|  4.70k|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  4.70k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  870|  4.70k|            const struct m_opt_choice_alternatives *alt = opt->priv;
  871|  26.8k|            for (int n = 0; alt[n].name; n++)
  ------------------
  |  Branch (871:29): [True: 22.1k, False: 4.70k]
  ------------------
  872|  22.1k|                MP_INFO(config, " %s", alt[n].name);
  ------------------
  |  |   91|  22.1k|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  22.1k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  873|  4.70k|            if (opt->min < opt->max)
  ------------------
  |  Branch (873:17): [True: 897, False: 3.81k]
  ------------------
  874|  4.70k|                MP_INFO(config, " (or an integer)");
  ------------------
  |  |   91|    897|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    897|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  875|  24.8k|        } else {
  876|  24.8k|            MP_INFO(config, " %s", opt->type->name);
  ------------------
  |  |   91|  24.8k|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  24.8k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  877|  24.8k|        }
  878|  29.6k|        if ((opt->type->flags & M_OPT_TYPE_USES_RANGE) && opt->min < opt->max) {
  ------------------
  |  |  515|  29.6k|#define M_OPT_TYPE_USES_RANGE           (1 << 2)
  ------------------
  |  Branch (878:13): [True: 14.7k, False: 14.8k]
  |  Branch (878:59): [True: 8.59k, False: 6.13k]
  ------------------
  879|  8.59k|            snprintf(min, sizeof(min), "any");
  880|  8.59k|            snprintf(max, sizeof(max), "any");
  881|  8.59k|            if (opt->min != DBL_MIN)
  ------------------
  |  Branch (881:17): [True: 8.59k, False: 0]
  ------------------
  882|  8.59k|                snprintf(min, sizeof(min), "%.14g", opt->min);
  883|  8.59k|            if (opt->max != DBL_MAX)
  ------------------
  |  Branch (883:17): [True: 7.96k, False: 638]
  ------------------
  884|  7.96k|                snprintf(max, sizeof(max), "%.14g", opt->max);
  885|  8.59k|            MP_INFO(config, " (%s to %s)", min, max);
  ------------------
  |  |   91|  8.59k|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  8.59k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  886|  8.59k|        }
  887|  29.6k|        char *def = NULL;
  888|  29.6k|        const void *defptr = m_config_get_co_default(config, co);
  889|  29.6k|        if (!defptr)
  ------------------
  |  Branch (889:13): [True: 1.66k, False: 27.9k]
  ------------------
  890|  1.66k|            defptr = &m_option_value_default;
  891|  29.6k|        if (defptr)
  ------------------
  |  Branch (891:13): [True: 29.6k, False: 0]
  ------------------
  892|  29.6k|            def = m_option_pretty_print(opt, defptr, false);
  893|  29.6k|        if (def) {
  ------------------
  |  Branch (893:13): [True: 28.0k, False: 1.57k]
  ------------------
  894|  28.0k|            MP_INFO(config, " (default: %s)", def);
  ------------------
  |  |   91|  28.0k|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  28.0k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  895|  28.0k|            talloc_free(def);
  ------------------
  |  |   47|  28.0k|#define talloc_free                     ta_free
  ------------------
  896|  28.0k|        }
  897|  29.6k|        if (opt->flags & M_OPT_NOCFG)
  ------------------
  |  |  468|  29.6k|#define M_OPT_NOCFG             (UINT64_C(1) << 63)
  ------------------
  |  Branch (897:13): [True: 371, False: 29.2k]
  ------------------
  898|  29.6k|            MP_INFO(config, " [not in config files]");
  ------------------
  |  |   91|    371|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    371|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  899|  29.6k|        if (opt->flags & M_OPT_FILE)
  ------------------
  |  |  474|  29.6k|#define M_OPT_FILE              (UINT64_C(1) << 61)
  ------------------
  |  Branch (899:13): [True: 1.22k, False: 28.3k]
  ------------------
  900|  29.6k|            MP_INFO(config, " [file]");
  ------------------
  |  |   91|  1.22k|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  1.22k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  901|  29.6k|        if (opt->deprecation_message)
  ------------------
  |  Branch (901:13): [True: 664, False: 28.9k]
  ------------------
  902|  29.6k|            MP_INFO(config, " [deprecated]");
  ------------------
  |  |   91|    664|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    664|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  903|  29.6k|        if (opt->type == &m_option_type_alias) {
  ------------------
  |  Branch (903:13): [True: 799, False: 28.8k]
  ------------------
  904|    799|            char buf[M_CONFIG_MAX_OPT_NAME_LEN];
  905|    799|            const char *alias = m_config_shadow_get_alias_from_opt(config->shadow, co->opt_id,
  906|    799|                                                                   buf, sizeof(buf));
  907|    799|            MP_INFO(config, " for %s", alias);
  ------------------
  |  |   91|    799|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    799|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  908|    799|        }
  909|  29.6k|        if (opt->type == &m_option_type_cli_alias)
  ------------------
  |  Branch (909:13): [True: 232, False: 29.3k]
  ------------------
  910|  29.6k|            MP_INFO(config, " for --%s (CLI/config files only)", (char *)opt->priv);
  ------------------
  |  |   91|    232|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    232|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  911|  29.6k|        MP_INFO(config, "\n");
  ------------------
  |  |   91|  29.6k|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  29.6k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  912|  42.2k|        for (int n = 0; opt->type->actions && opt->type->actions[n].name; n++) {
  ------------------
  |  Branch (912:25): [True: 14.3k, False: 27.9k]
  |  Branch (912:47): [True: 12.6k, False: 1.70k]
  ------------------
  913|  12.6k|            const struct m_option_action *action = &opt->type->actions[n];
  914|  12.6k|            MP_INFO(config, "    %s%s-%s\n", prefix, co->name, action->name);
  ------------------
  |  |   91|  12.6k|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  12.6k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  915|  12.6k|            count++;
  916|  12.6k|        }
  917|  29.6k|        count++;
  918|  29.6k|    }
  919|    170|    MP_INFO(config, "\nTotal: %d options\n", count);
  ------------------
  |  |   91|    170|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    170|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  920|    170|    talloc_free(sorted);
  ------------------
  |  |   47|    170|#define talloc_free                     ta_free
  ------------------
  921|    170|}
m_config_list_options:
  924|     62|{
  925|     62|    char **list = talloc_new(ta_parent);
  ------------------
  |  |   40|     62|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|     62|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  926|     62|    int count = 0;
  927|  48.6k|    for (int i = 0; i < config->num_opts; i++) {
  ------------------
  |  Branch (927:21): [True: 48.6k, False: 62]
  ------------------
  928|  48.6k|        struct m_config_option *co = &config->opts[i];
  929|       |        // For use with CONF_TYPE_STRING_LIST, it's important not to set list
  930|       |        // as allocation parent.
  931|  48.6k|        char *s = talloc_strdup(ta_parent, co->name);
  ------------------
  |  |   50|  48.6k|#define talloc_strdup                   ta_xstrdup
  ------------------
  932|  48.6k|        MP_TARRAY_APPEND(ta_parent, list, count, s);
  ------------------
  |  |  105|  48.6k|    do {                                            \
  |  |  106|  48.6k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  48.6k|    do {                                            \
  |  |  |  |   97|  48.6k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  48.6k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  48.6k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  48.6k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 558, False: 48.0k]
  |  |  |  |  ------------------
  |  |  |  |   99|  48.6k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|    558|    do {                                                        \
  |  |  |  |  |  |   89|    558|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|    558|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|    558|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|    558|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    558|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|    558|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|    558|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 558]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  48.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 48.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  48.6k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  48.6k|        (idxvar)++;                                 \
  |  |  109|  48.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 48.6k]
  |  |  ------------------
  ------------------
  933|  48.6k|    }
  934|     62|    MP_TARRAY_APPEND(ta_parent, list, count, NULL);
  ------------------
  |  |  105|     62|    do {                                            \
  |  |  106|     62|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|     62|    do {                                            \
  |  |  |  |   97|     62|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|     62|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|     62|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|     62|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 62]
  |  |  |  |  ------------------
  |  |  |  |   99|     62|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|     62|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 62]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|     62|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|     62|        (idxvar)++;                                 \
  |  |  109|     62|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 62]
  |  |  ------------------
  ------------------
  935|     62|    return list;
  936|     62|}
m_config_get_profile:
  939|   290k|{
  940|  2.15M|    for (struct m_profile *p = config->profiles; p; p = p->next) {
  ------------------
  |  Branch (940:50): [True: 1.94M, False: 213k]
  ------------------
  941|  1.94M|        if (bstr_equals0(name, p->name))
  ------------------
  |  Branch (941:13): [True: 77.4k, False: 1.86M]
  ------------------
  942|  77.4k|            return p;
  943|  1.94M|    }
  944|   213k|    return NULL;
  945|   290k|}
m_config_get_profile0:
  949|   290k|{
  950|   290k|    return m_config_get_profile(config, bstr0(name));
  951|   290k|}
m_config_add_profile:
  954|   229k|{
  955|   229k|    if (!name || !name[0])
  ------------------
  |  Branch (955:9): [True: 32.8k, False: 196k]
  |  Branch (955:18): [True: 0, False: 196k]
  ------------------
  956|  32.8k|        name = "default";
  957|   229k|    struct m_profile *p = m_config_get_profile0(config, name);
  958|   229k|    if (p)
  ------------------
  |  Branch (958:9): [True: 16.4k, False: 213k]
  ------------------
  959|  16.4k|        return p;
  960|   213k|    p = talloc_zero(config, struct m_profile);
  ------------------
  |  |   27|   213k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|   213k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|   213k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  961|   213k|    p->name = talloc_strdup(p, name);
  ------------------
  |  |   50|   213k|#define talloc_strdup                   ta_xstrdup
  ------------------
  962|   213k|    p->next = config->profiles;
  963|   213k|    config->profiles = p;
  964|   213k|    return p;
  965|   229k|}
m_config_set_profile_option:
  969|  1.04M|{
  970|  1.04M|    if (bstr_equals0(name, "profile-desc")) {
  ------------------
  |  Branch (970:9): [True: 0, False: 1.04M]
  ------------------
  971|      0|        talloc_free(p->desc);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  972|      0|        p->desc = bstrto0(p, val);
  973|      0|        return 0;
  974|      0|    }
  975|  1.04M|    if (bstr_equals0(name, "profile-cond")) {
  ------------------
  |  Branch (975:9): [True: 0, False: 1.04M]
  ------------------
  976|      0|        TA_FREEP(&p->cond);
  ------------------
  |  |   81|      0|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|      0|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 0]
  |  |  ------------------
  ------------------
  977|      0|        val = bstr_strip(val);
  978|      0|        if (val.len)
  ------------------
  |  Branch (978:13): [True: 0, False: 0]
  ------------------
  979|      0|            p->cond = bstrto0(p, val);
  980|      0|        return 0;
  981|      0|    }
  982|  1.04M|    if (bstr_equals0(name, profile_restore_mode_opt.name)) {
  ------------------
  |  Branch (982:9): [True: 0, False: 1.04M]
  ------------------
  983|      0|        return m_option_parse(config->log, &profile_restore_mode_opt, name, val,
  984|      0|                              &p->restore_mode);
  985|      0|    }
  986|       |
  987|  1.04M|    int i = m_config_set_option_cli(config, name, val,
  988|  1.04M|                                    M_SETOPT_CHECK_ONLY |
  989|  1.04M|                                    M_SETOPT_FROM_CONFIG_FILE);
  990|  1.04M|    if (i < 0)
  ------------------
  |  Branch (990:9): [True: 82.0k, False: 967k]
  ------------------
  991|  82.0k|        return i;
  992|   967k|    p->opts = talloc_realloc(p, p->opts, char *, 2 * (p->num_opts + 2));
  ------------------
  |  |   33|   967k|#define talloc_realloc                  ta_xrealloc
  |  |  ------------------
  |  |  |  |  144|   967k|    (type *)ta_xrealloc_size(ta_parent, ptr, ta_calc_array_size(sizeof(type), count))
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   967k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   967k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|   967k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|   967k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  993|   967k|    p->opts[p->num_opts * 2] = bstrto0(p, name);
  994|   967k|    p->opts[p->num_opts * 2 + 1] = bstrto0(p, val);
  995|   967k|    p->num_opts++;
  996|       |    p->opts[p->num_opts * 2] = p->opts[p->num_opts * 2 + 1] = NULL;
  997|   967k|    return 1;
  998|  1.04M|}
m_config_set_profile:
 1021|  61.2k|{
 1022|  61.2k|    MP_VERBOSE(config, "Applying profile '%s'...\n", name);
  ------------------
  |  |   92|  61.2k|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  61.2k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
 1023|  61.2k|    struct m_profile *p = find_check_profile(config, name);
 1024|  61.2k|    if (!p)
  ------------------
  |  Branch (1024:9): [True: 172, False: 61.0k]
  ------------------
 1025|    172|        return M_OPT_INVALID;
  ------------------
  |  |  535|    172|#define M_OPT_INVALID           -3
  ------------------
 1026|       |
 1027|  61.0k|    if (!config->profile_backup_tmp && p->restore_mode) {
  ------------------
  |  Branch (1027:9): [True: 61.0k, False: 0]
  |  Branch (1027:40): [True: 0, False: 61.0k]
  ------------------
 1028|      0|        config->profile_backup_tmp = &p->backups;
 1029|      0|        config->profile_backup_flags = p->restore_mode == 2 ? BACKUP_NVAL : 0;
  ------------------
  |  |  187|      0|#define BACKUP_NVAL 2
  ------------------
  |  Branch (1029:40): [True: 0, False: 0]
  ------------------
 1030|      0|    }
 1031|       |
 1032|  61.0k|    char *profile_name = talloc_strdup(NULL, name);
  ------------------
  |  |   50|  61.0k|#define talloc_strdup                   ta_xstrdup
  ------------------
 1033|       |    // Note that we don't check if profile applied correctly, it doesn't matter.
 1034|  61.0k|    MP_TARRAY_APPEND(config, config->profile_stack, config->profile_stack_depth, profile_name);
  ------------------
  |  |  105|  61.0k|    do {                                            \
  |  |  106|  61.0k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  61.0k|    do {                                            \
  |  |  |  |   97|  61.0k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  61.0k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  61.0k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  61.0k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 16.4k, False: 44.6k]
  |  |  |  |  ------------------
  |  |  |  |   99|  61.0k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  16.4k|    do {                                                        \
  |  |  |  |  |  |   89|  16.4k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  16.4k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  16.4k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  16.4k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  16.4k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  16.4k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  16.4k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 16.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  61.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 61.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  61.0k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  61.0k|        (idxvar)++;                                 \
  |  |  109|  61.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 61.0k]
  |  |  ------------------
  ------------------
 1035|  61.0k|    talloc_steal(config->profile_stack, profile_name);
  ------------------
  |  |   38|  61.0k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  61.0k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
 1036|   338k|    for (int i = 0; i < p->num_opts; i++) {
  ------------------
  |  Branch (1036:21): [True: 277k, False: 61.0k]
  ------------------
 1037|   277k|        m_config_set_option_cli(config,
 1038|   277k|                                bstr0(p->opts[2 * i]),
 1039|   277k|                                bstr0(p->opts[2 * i + 1]),
 1040|   277k|                                flags | M_SETOPT_FROM_CONFIG_FILE);
 1041|   277k|    }
 1042|  61.0k|    if (MP_TARRAY_POP(config->profile_stack, config->profile_stack_depth, &profile_name))
  ------------------
  |  |  153|  61.0k|    ((idxvar) > 0                                   \
  |  |  ------------------
  |  |  |  Branch (153:5): [True: 61.0k, False: 0]
  |  |  |  Branch (153:6): [True: 61.0k, False: 0]
  |  |  ------------------
  |  |  154|  61.0k|        ? (*(out) = (p)[--(idxvar)], true)          \
  |  |  155|  61.0k|        : false                                     \
  |  |  156|  61.0k|    )
  ------------------
 1043|  61.0k|        talloc_free(profile_name);
  ------------------
  |  |   47|  61.0k|#define talloc_free                     ta_free
  ------------------
 1044|       |
 1045|  61.0k|    if (config->profile_backup_tmp == &p->backups) {
  ------------------
  |  Branch (1045:9): [True: 0, False: 61.0k]
  ------------------
 1046|      0|        config->profile_backup_tmp = NULL;
 1047|       |
 1048|      0|        for (struct m_opt_backup *bc = p->backups; bc; bc = bc->next) {
  ------------------
  |  Branch (1048:52): [True: 0, False: 0]
  ------------------
 1049|      0|            if (bc && bc->nval)
  ------------------
  |  Branch (1049:17): [True: 0, False: 0]
  |  Branch (1049:23): [True: 0, False: 0]
  ------------------
 1050|      0|                m_option_copy(bc->co->opt, bc->nval, bc->co->data);
 1051|      0|            talloc_steal(p, bc);
  ------------------
  |  |   38|      0|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|      0|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
 1052|      0|        }
 1053|      0|    }
 1054|       |
 1055|  61.0k|    return 0;
 1056|  61.2k|}
m_config_finish_default_profile:
 1074|  16.4k|{
 1075|       |    struct m_profile *p = m_config_add_profile(config, NULL);
 1076|  16.4k|    m_config_set_profile(config, p->name, flags & ~M_SETOPT_FROM_CONFIG_FILE);
 1077|  16.4k|    p->num_opts = 0;
 1078|  16.4k|}
m_config_get_profiles:
 1081|     61|{
 1082|     61|    struct mpv_node root;
 1083|     61|    node_init(&root, MPV_FORMAT_NODE_ARRAY, NULL);
 1084|       |
 1085|    854|    for (m_profile_t *profile = config->profiles; profile; profile = profile->next)
  ------------------
  |  Branch (1085:51): [True: 793, False: 61]
  ------------------
 1086|    793|    {
 1087|    793|        struct mpv_node *entry = node_array_add(&root, MPV_FORMAT_NODE_MAP);
 1088|       |
 1089|    793|        node_map_add_string(entry, "name", profile->name);
 1090|    793|        if (profile->desc)
  ------------------
  |  Branch (1090:13): [True: 0, False: 793]
  ------------------
 1091|      0|            node_map_add_string(entry, "profile-desc", profile->desc);
 1092|    793|        if (profile->cond)
  ------------------
  |  Branch (1092:13): [True: 0, False: 793]
  ------------------
 1093|      0|            node_map_add_string(entry, "profile-cond", profile->cond);
 1094|    793|        if (profile->restore_mode) {
  ------------------
  |  Branch (1094:13): [True: 0, False: 793]
  ------------------
 1095|      0|            char *s =
 1096|      0|                m_option_print(&profile_restore_mode_opt, &profile->restore_mode);
 1097|      0|            node_map_add_string(entry, profile_restore_mode_opt.name, s);
 1098|      0|            talloc_free(s);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 1099|      0|        }
 1100|       |
 1101|    793|        struct mpv_node *opts =
 1102|    793|            node_map_add(entry, "options", MPV_FORMAT_NODE_ARRAY);
 1103|       |
 1104|  4.39k|        for (int n = 0; n < profile->num_opts; n++) {
  ------------------
  |  Branch (1104:25): [True: 3.59k, False: 793]
  ------------------
 1105|  3.59k|            struct mpv_node *opt_entry = node_array_add(opts, MPV_FORMAT_NODE_MAP);
 1106|  3.59k|            node_map_add_string(opt_entry, "key", profile->opts[n * 2 + 0]);
 1107|  3.59k|            node_map_add_string(opt_entry, "value", profile->opts[n * 2 + 1]);
 1108|  3.59k|        }
 1109|    793|    }
 1110|       |
 1111|     61|    return root;
 1112|     61|}
m_config_frontend.c:m_config_from_obj_desc:
  128|  13.3k|{
  129|  13.3k|    struct m_sub_options *root = talloc_ptrtype(NULL, root);
  ------------------
  |  |   34|  13.3k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  13.3k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  13.3k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  130|  13.3k|    *root = (struct m_sub_options){
  131|  13.3k|        .opts = desc->options,
  132|       |        // (global == NULL got repurposed to mean "no alloc")
  133|  13.3k|        .size = global ? desc->priv_size : 0,
  ------------------
  |  Branch (133:17): [True: 0, False: 13.3k]
  ------------------
  134|  13.3k|        .defaults = desc->priv_defaults,
  135|  13.3k|    };
  136|       |
  137|  13.3k|    struct m_config *c = m_config_new(talloc_ctx, log, root);
  138|  13.3k|    talloc_steal(c, root);
  ------------------
  |  |   38|  13.3k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  13.3k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
  139|  13.3k|    c->global = global;
  140|  13.3k|    return c;
  141|  13.3k|}
m_config_frontend.c:restore_backups:
  220|  47.2k|{
  221|  47.2k|    while (*list) {
  ------------------
  |  Branch (221:12): [True: 0, False: 47.2k]
  ------------------
  222|      0|        struct m_opt_backup *bc = *list;
  223|      0|        *list = bc->next;
  224|       |
  225|      0|        if (!bc->nval || m_option_equal(bc->co->opt, bc->co->data, bc->nval))
  ------------------
  |  Branch (225:13): [True: 0, False: 0]
  |  Branch (225:26): [True: 0, False: 0]
  ------------------
  226|      0|            m_config_set_option_raw(config, bc->co, bc->backup, 0);
  227|       |
  228|      0|        if (bc->flags & BACKUP_LOCAL)
  ------------------
  |  |  186|      0|#define BACKUP_LOCAL 1
  ------------------
  |  Branch (228:13): [True: 0, False: 0]
  ------------------
  229|      0|            bc->co->is_set_locally = false;
  230|      0|        talloc_free(bc);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  231|      0|    }
  232|  47.2k|}
m_config_frontend.c:add_backup:
  190|  8.36M|{
  191|  8.36M|    struct m_opt_backup *bc = talloc_ptrtype(NULL, bc);
  ------------------
  |  |   34|  8.36M|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  8.36M|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  8.36M|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  192|  8.36M|    talloc_set_destructor(bc, backup_dtor);
  ------------------
  |  |   41|  8.36M|#define talloc_set_destructor           ta_set_destructor
  ------------------
  193|  8.36M|    *bc = (struct m_opt_backup) {
  194|  8.36M|        .co = co,
  195|  8.36M|        .backup = talloc_zero_size(bc, co->opt->type->size),
  ------------------
  |  |   44|  8.36M|#define talloc_zero_size                ta_xzalloc_size
  |  |  ------------------
  |  |  |  |  121|  8.36M|#define ta_xzalloc_size(...)            ta_oom_p(ta_zalloc_size(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  8.36M|#define ta_zalloc_size(...)     ta_dbg_set_loc(ta_zalloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  8.36M|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|  8.36M|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|  8.36M|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  196|  8.36M|        .nval = flags & BACKUP_NVAL
  ------------------
  |  |  187|  8.36M|#define BACKUP_NVAL 2
  ------------------
  |  Branch (196:17): [True: 0, False: 8.36M]
  ------------------
  197|  8.36M|            ? talloc_zero_size(bc, co->opt->type->size) : NULL,
  ------------------
  |  |   44|      0|#define talloc_zero_size                ta_xzalloc_size
  |  |  ------------------
  |  |  |  |  121|      0|#define ta_xzalloc_size(...)            ta_oom_p(ta_zalloc_size(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define ta_zalloc_size(...)     ta_dbg_set_loc(ta_zalloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  198|  8.36M|        .flags = flags,
  199|  8.36M|    };
  200|  8.36M|    m_option_copy(co->opt, bc->backup, co->data);
  201|  8.36M|    bc->next = *list;
  202|  8.36M|    *list = bc;
  203|  8.36M|    if (bc->flags & BACKUP_LOCAL)
  ------------------
  |  |  186|  8.36M|#define BACKUP_LOCAL 1
  ------------------
  |  Branch (203:9): [True: 0, False: 8.36M]
  ------------------
  204|      0|        co->is_set_locally = true;
  205|  8.36M|}
m_config_frontend.c:backup_dtor:
  179|  8.36M|{
  180|  8.36M|    struct m_opt_backup *bc = p;
  181|  8.36M|    m_option_free(bc->co->opt, bc->backup);
  182|  8.36M|    if (bc->nval)
  ------------------
  |  Branch (182:9): [True: 0, False: 8.36M]
  ------------------
  183|      0|        m_option_free(bc->co->opt, bc->nval);
  184|  8.36M|}
m_config_frontend.c:search_opt_name:
  293|  21.2M|{
  294|  21.2M|    const struct m_config_option *co = *(const struct m_config_option **)pelem;
  295|  21.2M|    return bstrcmp0(*(const bstr *)pkey, co->name);
  296|  21.2M|}
m_config_frontend.c:m_config_get_co_any:
  310|  2.02M|{
  311|  2.02M|    struct m_config_option *co = m_config_get_co_raw(config, name);
  312|  2.02M|    if (!co)
  ------------------
  |  Branch (312:9): [True: 287k, False: 1.73M]
  ------------------
  313|   287k|        return NULL;
  314|       |
  315|  1.73M|    const char *prefix = config->is_toplevel ? "--" : "";
  ------------------
  |  Branch (315:26): [True: 1.72M, False: 8.98k]
  ------------------
  316|  1.73M|    if (co->opt->type == &m_option_type_alias) {
  ------------------
  |  Branch (316:9): [True: 9.78k, False: 1.72M]
  ------------------
  317|  9.78k|        char buf[M_CONFIG_MAX_OPT_NAME_LEN];
  318|  9.78k|        const char *alias = m_config_shadow_get_alias_from_opt(config->shadow, co->opt_id,
  319|  9.78k|                                                               buf, sizeof(buf));
  320|  9.78k|        if (co->opt->deprecation_message && !co->warning_was_printed) {
  ------------------
  |  Branch (320:13): [True: 231, False: 9.55k]
  |  Branch (320:45): [True: 28, False: 203]
  ------------------
  321|     28|            if (co->opt->deprecation_message[0]) {
  ------------------
  |  Branch (321:17): [True: 0, False: 28]
  ------------------
  322|      0|                MP_WARN(config, "Warning: option %s%s was replaced with "
  ------------------
  |  |   90|      0|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  323|      0|                        "%s%s: %s\n", prefix, co->name, prefix, alias,
  324|      0|                        co->opt->deprecation_message);
  325|     28|            } else {
  326|     28|                MP_WARN(config, "Warning: option %s%s was replaced with "
  ------------------
  |  |   90|     28|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     28|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  327|     28|                        "%s%s and might be removed in the future.\n",
  328|     28|                        prefix, co->name, prefix, alias);
  329|     28|            }
  330|     28|            co->warning_was_printed = true;
  331|     28|        }
  332|  9.78k|        return m_config_get_co_any(config, bstr0(alias));
  333|  1.72M|    } else if (co->opt->type == &m_option_type_removed) {
  ------------------
  |  Branch (333:16): [True: 230, False: 1.72M]
  ------------------
  334|    230|        if (!co->warning_was_printed) {
  ------------------
  |  Branch (334:13): [True: 17, False: 213]
  ------------------
  335|     17|            char *msg = co->opt->priv;
  336|     17|            if (msg) {
  ------------------
  |  Branch (336:17): [True: 17, False: 0]
  ------------------
  337|     17|                MP_FATAL(config, "Option %s%s was removed: %s\n",
  ------------------
  |  |   88|     17|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     17|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  338|     17|                         prefix, co->name, msg);
  339|     17|            } else {
  340|      0|                MP_FATAL(config, "Option %s%s was removed.\n",
  ------------------
  |  |   88|      0|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  341|      0|                         prefix, co->name);
  342|      0|            }
  343|     17|            co->warning_was_printed = true;
  344|     17|        }
  345|    230|        return NULL;
  346|  1.72M|    } else if (co->opt->deprecation_message) {
  ------------------
  |  Branch (346:16): [True: 222, False: 1.72M]
  ------------------
  347|    222|        if (!co->warning_was_printed) {
  ------------------
  |  Branch (347:13): [True: 16, False: 206]
  ------------------
  348|     16|            MP_WARN(config, "Warning: option %s%s is deprecated "
  ------------------
  |  |   90|     16|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     16|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  349|     16|                    "and might be removed in the future (%s).\n",
  350|     16|                    prefix, co->name, co->opt->deprecation_message);
  351|     16|            co->warning_was_printed = true;
  352|     16|        }
  353|    222|    }
  354|  1.72M|    return co;
  355|  1.73M|}
m_config_frontend.c:config_destroy:
  536|  29.7k|{
  537|  29.7k|    struct m_config *config = p;
  538|  29.7k|    config->option_change_callback = NULL;
  539|  29.7k|    m_config_restore_backups(config);
  540|       |
  541|  29.7k|    struct m_opt_backup **list = &config->watch_later_backup_opts;
  542|  8.39M|    while (*list) {
  ------------------
  |  Branch (542:12): [True: 8.36M, False: 29.7k]
  ------------------
  543|  8.36M|        struct m_opt_backup *bc = *list;
  544|  8.36M|        *list = bc->next;
  545|  8.36M|        talloc_free(bc);
  ------------------
  |  |   47|  8.36M|#define talloc_free                     ta_free
  ------------------
  546|  8.36M|    }
  547|       |
  548|  29.7k|    talloc_free(config->cache);
  ------------------
  |  |   47|  29.7k|#define talloc_free                     ta_free
  ------------------
  549|  29.7k|    talloc_free(config->shadow);
  ------------------
  |  |   47|  29.7k|#define talloc_free                     ta_free
  ------------------
  550|  29.7k|}
m_config_frontend.c:compare_opt_name:
  286|   101M|{
  287|   101M|    const struct m_config_option *a = *(const struct m_config_option **)pa;
  288|   101M|    const struct m_config_option *b = *(const struct m_config_option **)pb;
  289|   101M|    return strcmp(a->name, b->name);
  290|   101M|}
m_config_frontend.c:handle_set_opt_flags:
  401|  2.74M|{
  402|  2.74M|    uint64_t optflags = co->opt->flags;
  403|  2.74M|    bool set = !(flags & M_SETOPT_CHECK_ONLY);
  404|       |
  405|  2.74M|    if ((flags & M_SETOPT_PRE_PARSE_ONLY) && !(optflags & M_OPT_PRE_PARSE))
  ------------------
  |  |  471|  85.8k|#define M_OPT_PRE_PARSE         (UINT64_C(1) << 62)
  ------------------
  |  Branch (405:9): [True: 85.8k, False: 2.66M]
  |  Branch (405:46): [True: 67.2k, False: 18.5k]
  ------------------
  406|  67.2k|        return 0;
  407|       |
  408|  2.67M|    if ((flags & M_SETOPT_PRESERVE_CMDLINE) && co->is_set_from_cmdline)
  ------------------
  |  Branch (408:9): [True: 0, False: 2.67M]
  |  Branch (408:48): [True: 0, False: 0]
  ------------------
  409|      0|        set = false;
  410|       |
  411|  2.67M|    if ((flags & M_SETOPT_NO_OVERWRITE) &&
  ------------------
  |  Branch (411:9): [True: 24, False: 2.67M]
  ------------------
  412|     24|        (co->is_set_from_cmdline || co->is_set_from_config))
  ------------------
  |  Branch (412:10): [True: 6, False: 18]
  |  Branch (412:37): [True: 10, False: 8]
  ------------------
  413|     16|        set = false;
  414|       |
  415|  2.67M|    if ((flags & M_SETOPT_NO_PRE_PARSE) && (optflags & M_OPT_PRE_PARSE))
  ------------------
  |  |  471|      0|#define M_OPT_PRE_PARSE         (UINT64_C(1) << 62)
  ------------------
  |  Branch (415:9): [True: 0, False: 2.67M]
  |  Branch (415:44): [True: 0, False: 0]
  ------------------
  416|      0|        return M_OPT_INVALID;
  ------------------
  |  |  535|      0|#define M_OPT_INVALID           -3
  ------------------
  417|       |
  418|       |    // Check if this option isn't forbidden in the current mode
  419|  2.67M|    if ((flags & M_SETOPT_FROM_CONFIG_FILE) && (optflags & M_OPT_NOCFG)) {
  ------------------
  |  |  468|  2.48M|#define M_OPT_NOCFG             (UINT64_C(1) << 63)
  ------------------
  |  Branch (419:9): [True: 2.48M, False: 189k]
  |  Branch (419:48): [True: 0, False: 2.48M]
  ------------------
  420|      0|        MP_ERR(config, "The %s option can't be used in a config file.\n",
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  421|      0|               co->name);
  422|      0|        return M_OPT_INVALID;
  ------------------
  |  |  535|      0|#define M_OPT_INVALID           -3
  ------------------
  423|      0|    }
  424|  2.67M|    if ((flags & M_SETOPT_BACKUP) && set)
  ------------------
  |  Branch (424:9): [True: 13.7k, False: 2.66M]
  |  Branch (424:38): [True: 0, False: 13.7k]
  ------------------
  425|      0|        ensure_backup(&config->backup_opts, BACKUP_LOCAL, co);
  ------------------
  |  |  186|      0|#define BACKUP_LOCAL 1
  ------------------
  426|       |
  427|  2.67M|    return set ? 2 : 1;
  ------------------
  |  Branch (427:12): [True: 713k, False: 1.96M]
  ------------------
  428|  2.67M|}
m_config_frontend.c:m_config_handle_special_options:
  446|   359k|{
  447|   359k|    if (config->use_profiles && strcmp(co->name, "profile") == 0) {
  ------------------
  |  Branch (447:9): [True: 359k, False: 0]
  |  Branch (447:33): [True: 18.5k, False: 341k]
  ------------------
  448|  18.5k|        char **list = *(char ***)data;
  449|       |
  450|  18.5k|        if (list && list[0] && !list[1] && strcmp(list[0], "help") == 0) {
  ------------------
  |  Branch (450:13): [True: 18.4k, False: 66]
  |  Branch (450:21): [True: 18.4k, False: 0]
  |  Branch (450:32): [True: 18.0k, False: 376]
  |  Branch (450:44): [True: 1, False: 18.0k]
  ------------------
  451|      1|            if (!config->profiles) {
  ------------------
  |  Branch (451:17): [True: 0, False: 1]
  ------------------
  452|      0|                MP_INFO(config, "No profiles have been defined.\n");
  ------------------
  |  |   91|      0|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  453|      0|                return M_OPT_EXIT;
  ------------------
  |  |  545|      0|#define M_OPT_EXIT              -6
  ------------------
  454|      0|            }
  455|      1|            list_profiles(config);
  456|      1|            return M_OPT_EXIT;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
  457|      1|        }
  458|       |
  459|  46.3k|        for (int n = 0; list && list[n]; n++) {
  ------------------
  |  Branch (459:25): [True: 46.2k, False: 66]
  |  Branch (459:33): [True: 28.0k, False: 18.2k]
  ------------------
  460|  28.0k|            int r = m_config_set_profile(config, list[n], flags);
  461|  28.0k|            if (r < 0)
  ------------------
  |  Branch (461:17): [True: 172, False: 27.8k]
  ------------------
  462|    172|                return r;
  463|  28.0k|        }
  464|  18.3k|        return 0;
  465|  18.5k|    }
  466|       |
  467|   341k|    if (config->includefunc && strcmp(co->name, "include") == 0) {
  ------------------
  |  Branch (467:9): [True: 341k, False: 0]
  |  Branch (467:32): [True: 0, False: 341k]
  ------------------
  468|      0|        char *param = *(char **)data;
  469|      0|        if (!param || !param[0])
  ------------------
  |  Branch (469:13): [True: 0, False: 0]
  |  Branch (469:23): [True: 0, False: 0]
  ------------------
  470|      0|            return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      0|#define M_OPT_MISSING_PARAM     -2
  ------------------
  471|      0|        if (config->recursion_depth >= MAX_RECURSION_DEPTH) {
  ------------------
  |  |   45|      0|#define MAX_RECURSION_DEPTH 8
  ------------------
  |  Branch (471:13): [True: 0, False: 0]
  ------------------
  472|      0|            MP_ERR(config, "Maximum 'include' nesting depth exceeded.\n");
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  473|      0|            return M_OPT_INVALID;
  ------------------
  |  |  535|      0|#define M_OPT_INVALID           -3
  ------------------
  474|      0|        }
  475|      0|        config->recursion_depth += 1;
  476|      0|        config->includefunc(config->includefunc_ctx, param, flags);
  477|      0|        config->recursion_depth -= 1;
  478|      0|        if (config->recursion_depth == 0 && config->profile_stack_depth == 0)
  ------------------
  |  Branch (478:13): [True: 0, False: 0]
  |  Branch (478:45): [True: 0, False: 0]
  ------------------
  479|      0|            m_config_finish_default_profile(config, flags);
  480|      0|        return 1;
  481|      0|    }
  482|       |
  483|   341k|    if (config->use_profiles && strcmp(co->name, "show-profile") == 0)
  ------------------
  |  Branch (483:9): [True: 341k, False: 0]
  |  Branch (483:33): [True: 14, False: 341k]
  ------------------
  484|     14|        return show_profile(config, bstr0(*(char **)data), 0);
  485|       |
  486|   341k|    if (config->is_toplevel && (strcmp(co->name, "h") == 0 ||
  ------------------
  |  Branch (486:9): [True: 341k, False: 0]
  |  Branch (486:33): [True: 176, False: 340k]
  ------------------
  487|   340k|                                strcmp(co->name, "help") == 0))
  ------------------
  |  Branch (487:33): [True: 1, False: 340k]
  ------------------
  488|    177|    {
  489|    177|        char *h = *(char **)data;
  490|    177|        mp_info(config->log, "%s", mp_help_text);
  ------------------
  |  |   78|    177|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  491|    177|        if (h && h[0])
  ------------------
  |  Branch (491:13): [True: 177, False: 0]
  |  Branch (491:18): [True: 161, False: 16]
  ------------------
  492|    161|            m_config_print_option_list(config, h);
  493|    177|        return M_OPT_EXIT;
  ------------------
  |  |  545|    177|#define M_OPT_EXIT              -6
  ------------------
  494|    177|    }
  495|       |
  496|   340k|    if (strcmp(co->name, "list-options") == 0) {
  ------------------
  |  Branch (496:9): [True: 3, False: 340k]
  ------------------
  497|      3|        m_config_print_option_list(config, "*");
  498|      3|        return M_OPT_EXIT;
  ------------------
  |  |  545|      3|#define M_OPT_EXIT              -6
  ------------------
  499|      3|    }
  500|       |
  501|   340k|    return M_OPT_UNKNOWN;
  ------------------
  |  |  529|   340k|#define M_OPT_UNKNOWN           -1
  ------------------
  502|   340k|}
m_config_frontend.c:list_profiles:
   77|      3|{
   78|      3|    MP_INFO(config, "Available profiles:\n");
  ------------------
  |  |   91|      3|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      3|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
   79|     42|    for (struct m_profile *p = config->profiles; p; p = p->next)
  ------------------
  |  Branch (79:50): [True: 39, False: 3]
  ------------------
   80|     39|        MP_INFO(config, "\t%s\t%s\n", p->name, p->desc ? p->desc : "");
  ------------------
  |  |   91|     39|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     78|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 0, False: 39]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   81|      3|}
m_config_frontend.c:show_profile:
   84|     17|{
   85|     17|    struct m_profile *p;
   86|     17|    if (!param.len) {
  ------------------
  |  Branch (86:9): [True: 2, False: 15]
  ------------------
   87|      2|        list_profiles(config);
   88|      2|        return M_OPT_EXIT;
  ------------------
  |  |  545|      2|#define M_OPT_EXIT              -6
  ------------------
   89|      2|    }
   90|     15|    if (!(p = m_config_get_profile(config, param))) {
  ------------------
  |  Branch (90:9): [True: 5, False: 10]
  ------------------
   91|      5|        MP_ERR(config, "Unknown profile '%.*s'.\n", BSTR_P(param));
  ------------------
  |  |   89|      5|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     10|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 5, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   92|      5|        return M_OPT_EXIT;
  ------------------
  |  |  545|      5|#define M_OPT_EXIT              -6
  ------------------
   93|      5|    }
   94|     10|    if (!depth)
  ------------------
  |  Branch (94:9): [True: 7, False: 3]
  ------------------
   95|     10|        MP_INFO(config, "Profile %s: %s\n", p->name,
  ------------------
  |  |   91|      7|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     14|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 0, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   96|     10|                p->desc ? p->desc : "");
   97|     10|    depth++;
   98|     10|    if (p->cond) {
  ------------------
  |  Branch (98:9): [True: 0, False: 10]
  ------------------
   99|      0|        MP_INFO(config, "%*sprofile-cond=%s\n", depth, "",
  ------------------
  |  |   91|      0|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  100|      0|                p->cond);
  101|      0|    }
  102|     49|    for (int i = 0; i < p->num_opts; i++) {
  ------------------
  |  Branch (102:21): [True: 39, False: 10]
  ------------------
  103|     39|        MP_INFO(config, "%*s%s=%s\n", depth, "",
  ------------------
  |  |   91|     39|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     39|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  104|     39|                p->opts[2 * i], p->opts[2 * i + 1]);
  105|       |
  106|     39|        if (depth < MAX_PROFILE_DEPTH
  ------------------
  |  |   43|     78|#define MAX_PROFILE_DEPTH 20
  ------------------
  |  Branch (106:13): [True: 39, False: 0]
  ------------------
  107|     39|            && !strcmp(p->opts[2*i], "profile")) {
  ------------------
  |  Branch (107:16): [True: 3, False: 36]
  ------------------
  108|      3|            char *e, *list = p->opts[2 * i + 1];
  109|      3|            while ((e = strchr(list, ','))) {
  ------------------
  |  Branch (109:20): [True: 0, False: 3]
  ------------------
  110|      0|                int l = e - list;
  111|      0|                if (!l)
  ------------------
  |  Branch (111:21): [True: 0, False: 0]
  ------------------
  112|      0|                    continue;
  113|      0|                show_profile(config, (bstr){list, e - list}, depth);
  114|      0|                list = e + 1;
  115|      0|            }
  116|      3|            if (list[0] != '\0')
  ------------------
  |  Branch (116:17): [True: 3, False: 0]
  ------------------
  117|      3|                show_profile(config, bstr0(list), depth);
  118|      3|        }
  119|     39|    }
  120|     10|    depth--;
  121|     10|    return M_OPT_EXIT;
  ------------------
  |  |  545|     10|#define M_OPT_EXIT              -6
  ------------------
  122|     15|}
m_config_frontend.c:force_self_notify_change_opt:
  597|   246k|{
  598|   246k|    int changed =
  599|   246k|        m_config_cache_get_option_change_mask(config->cache, co->opt_id);
  600|       |
  601|   246k|    if (config->option_change_callback) {
  ------------------
  |  Branch (601:9): [True: 0, False: 246k]
  ------------------
  602|      0|        config->option_change_callback(config->option_change_callback_ctx, co,
  603|      0|                                       changed, self_notification);
  604|      0|    }
  605|   246k|}
m_config_frontend.c:m_config_mogrify_cli_opt:
  673|  1.66M|{
  674|  1.66M|    *out_negate = false;
  675|  1.66M|    *out_add_flags = 0;
  676|       |
  677|  1.66M|    struct m_config_option *co = m_config_get_co(config, *name);
  678|  1.66M|    if (co)
  ------------------
  |  Branch (678:9): [True: 1.34M, False: 319k]
  ------------------
  679|  1.34M|        return co;
  680|       |
  681|       |    // Turn "--no-foo" into "foo" + set *out_negate.
  682|   319k|    bstr no_name = *name;
  683|   319k|    if (!co && bstr_eatstart0(&no_name, "no-")) {
  ------------------
  |  Branch (683:9): [True: 319k, False: 0]
  |  Branch (683:16): [True: 1.78k, False: 317k]
  ------------------
  684|  1.78k|        co = m_config_get_co(config, no_name);
  685|  1.78k|        if (!co)
  ------------------
  |  Branch (685:13): [True: 444, False: 1.34k]
  ------------------
  686|    444|            return NULL;
  687|       |
  688|       |        // Not all choice types have this value - if they don't, then parsing
  689|       |        // them will simply result in an error. Good enough.
  690|  1.34k|        if (!(co->opt->type->flags & M_OPT_TYPE_CHOICE) &&
  ------------------
  |  |  512|  1.34k|#define M_OPT_TYPE_CHOICE               (1 << 1)
  ------------------
  |  Branch (690:13): [True: 460, False: 880]
  ------------------
  691|    460|            !(co->opt->flags & M_OPT_ALLOW_NO))
  ------------------
  |  |  488|    460|#define M_OPT_ALLOW_NO          (UINT64_C(1) << 57)
  ------------------
  |  Branch (691:13): [True: 202, False: 258]
  ------------------
  692|    202|            return NULL;
  693|       |
  694|  1.13k|        *name = no_name;
  695|  1.13k|        *out_negate = true;
  696|  1.13k|        return co;
  697|  1.34k|    }
  698|       |
  699|       |    // Resolve CLI alias. (We don't allow you to combine them with "--no-".)
  700|   317k|    co = m_config_get_co_any(config, *name);
  701|   317k|    if (co && co->opt->type == &m_option_type_cli_alias)
  ------------------
  |  Branch (701:9): [True: 180k, False: 137k]
  |  Branch (701:15): [True: 180k, False: 0]
  ------------------
  702|   180k|        *name = bstr0((char *)co->opt->priv);
  703|       |
  704|       |    // Might be a suffix "action", like "--vf-add". Expensively check for
  705|       |    // matches. (We don't allow you to combine them with "--no-".)
  706|  90.2M|    for (int n = 0; n < config->num_opts; n++) {
  ------------------
  |  Branch (706:21): [True: 90.1M, False: 105k]
  ------------------
  707|  90.1M|        co = &config->opts[n];
  708|  90.1M|        struct bstr basename = bstr0(co->name);
  709|       |
  710|  90.1M|        if (!bstr_startswith(*name, basename))
  ------------------
  |  Branch (710:13): [True: 89.7M, False: 455k]
  ------------------
  711|  89.7M|            continue;
  712|       |
  713|       |        // Aliased option + a suffix action, e.g. --opengl-shaders-append
  714|   455k|        if (co->opt->type == &m_option_type_alias)
  ------------------
  |  Branch (714:13): [True: 538, False: 454k]
  ------------------
  715|    538|            co = m_config_get_co_any(config, basename);
  716|   455k|        if (!co)
  ------------------
  |  Branch (716:13): [True: 0, False: 455k]
  ------------------
  717|      0|            continue;
  718|       |
  719|   455k|        const struct m_option_type *type = co->opt->type;
  720|   767k|        for (int i = 0; type->actions && type->actions[i].name; i++) {
  ------------------
  |  Branch (720:25): [True: 525k, False: 241k]
  |  Branch (720:42): [True: 524k, False: 1.09k]
  ------------------
  721|   524k|            const struct m_option_action *action = &type->actions[i];
  722|   524k|            bstr suffix = bstr0(action->name);
  723|       |
  724|   524k|            if (bstr_endswith(*name, suffix) &&
  ------------------
  |  Branch (724:17): [True: 212k, False: 311k]
  ------------------
  725|   212k|                (name->len == basename.len + 1 + suffix.len) &&
  ------------------
  |  Branch (725:17): [True: 212k, False: 280]
  ------------------
  726|   212k|                name->start[basename.len] == '-')
  ------------------
  |  Branch (726:17): [True: 212k, False: 201]
  ------------------
  727|   212k|            {
  728|   212k|                *out_add_flags = action->flags;
  729|   212k|                return co;
  730|   212k|            }
  731|   524k|        }
  732|   455k|    }
  733|       |
  734|   105k|    return NULL;
  735|   317k|}
m_config_frontend.c:sort_opt_compare:
  844|  1.01M|{
  845|  1.01M|    const struct m_config_option *a = pa;
  846|  1.01M|    const struct m_config_option *b = pb;
  847|  1.01M|    return strcasecmp(a->name, b->name);
  848|  1.01M|}
m_config_frontend.c:find_check_profile:
 1001|  61.2k|{
 1002|  61.2k|    struct m_profile *p = m_config_get_profile0(config, name);
 1003|  61.2k|    if (!p) {
  ------------------
  |  Branch (1003:9): [True: 172, False: 61.0k]
  ------------------
 1004|    172|        MP_WARN(config, "Unknown profile '%s'.\n", name);
  ------------------
  |  |   90|    172|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    172|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
 1005|    172|        return NULL;
 1006|    172|    }
 1007|  78.5k|    for (size_t i = 0; i < config->profile_stack_depth; ++i) {
  ------------------
  |  Branch (1007:24): [True: 17.5k, False: 61.0k]
  ------------------
 1008|  17.5k|        if (strcmp(config->profile_stack[i], name))
  ------------------
  |  Branch (1008:13): [True: 17.5k, False: 0]
  ------------------
 1009|  17.5k|            continue;
 1010|      0|        MP_WARN(config, "Profile '%s' has already been applied.\n", name);
  ------------------
  |  |   90|      0|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
 1011|      0|        return NULL;
 1012|  17.5k|    }
 1013|  61.0k|    if (config->profile_stack_depth > MAX_PROFILE_DEPTH) {
  ------------------
  |  |   43|  61.0k|#define MAX_PROFILE_DEPTH 20
  ------------------
  |  Branch (1013:9): [True: 0, False: 61.0k]
  ------------------
 1014|      0|        MP_WARN(config, "Profile inclusion too deep.\n");
  ------------------
  |  |   90|      0|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
 1015|      0|        return NULL;
 1016|      0|    }
 1017|  61.0k|    return p;
 1018|  61.0k|}

m_option_parse:
   65|  1.37M|{
   66|  1.37M|    int r = M_OPT_INVALID;
  ------------------
  |  |  535|  1.37M|#define M_OPT_INVALID           -3
  ------------------
   67|  1.37M|    if (bstr_equals0(param, "help") && opt->help) {
  ------------------
  |  Branch (67:9): [True: 1.11k, False: 1.37M]
  |  Branch (67:40): [True: 29, False: 1.08k]
  ------------------
   68|     29|        r = opt->help(log, opt, name);
   69|     29|        if (r < 0)
  ------------------
  |  Branch (69:13): [True: 29, False: 0]
  ------------------
   70|     29|            return r;
   71|     29|    }
   72|       |
   73|  1.37M|    r = opt->type->parse(log, opt, name, param, dst);
   74|  1.37M|    if (r < 0)
  ------------------
  |  Branch (74:9): [True: 10.7k, False: 1.36M]
  ------------------
   75|  10.7k|        return r;
   76|       |
   77|  1.36M|    if (opt->validate) {
  ------------------
  |  Branch (77:9): [True: 821, False: 1.36M]
  ------------------
   78|    821|        r = opt->validate(log, opt, name, dst);
   79|    821|        if (r < 0) {
  ------------------
  |  Branch (79:13): [True: 188, False: 633]
  ------------------
   80|    188|            if (opt->type->free)
  ------------------
  |  Branch (80:17): [True: 188, False: 0]
  ------------------
   81|    188|                opt->type->free(dst);
   82|    188|            return r;
   83|    188|        }
   84|    821|    }
   85|  1.36M|    return 1;
   86|  1.36M|}
m_option_strerror:
   89|  93.3k|{
   90|  93.3k|    switch (code) {
   91|  86.5k|    case M_OPT_UNKNOWN:
  ------------------
  |  |  529|  86.5k|#define M_OPT_UNKNOWN           -1
  ------------------
  |  Branch (91:5): [True: 86.5k, False: 6.76k]
  ------------------
   92|  86.5k|        return "option not found";
   93|    231|    case M_OPT_MISSING_PARAM:
  ------------------
  |  |  532|    231|#define M_OPT_MISSING_PARAM     -2
  ------------------
  |  Branch (93:5): [True: 231, False: 93.1k]
  ------------------
   94|    231|        return "option requires parameter";
   95|  6.12k|    case M_OPT_INVALID:
  ------------------
  |  |  535|  6.12k|#define M_OPT_INVALID           -3
  ------------------
  |  Branch (95:5): [True: 6.12k, False: 87.2k]
  ------------------
   96|  6.12k|        return "option parameter could not be parsed";
   97|    204|    case M_OPT_OUT_OF_RANGE:
  ------------------
  |  |  539|    204|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  |  Branch (97:5): [True: 204, False: 93.1k]
  ------------------
   98|    204|        return "parameter is outside values allowed for option";
   99|    207|    case M_OPT_DISALLOW_PARAM:
  ------------------
  |  |  542|    207|#define M_OPT_DISALLOW_PARAM    -5
  ------------------
  |  Branch (99:5): [True: 207, False: 93.1k]
  ------------------
  100|    207|        return "option doesn't take a parameter";
  101|      0|    default:
  ------------------
  |  Branch (101:5): [True: 0, False: 93.3k]
  ------------------
  102|      0|        return "parser error";
  103|  93.3k|    }
  104|  93.3k|}
m_option_required_params:
  107|   148k|{
  108|   148k|    if (opt->type->flags & M_OPT_TYPE_OPTIONAL_PARAM)
  ------------------
  |  |  507|   148k|#define M_OPT_TYPE_OPTIONAL_PARAM       (1 << 0)
  ------------------
  |  Branch (108:9): [True: 27.8k, False: 121k]
  ------------------
  109|  27.8k|        return 0;
  110|   121k|    if (opt->flags & M_OPT_OPTIONAL_PARAM)
  ------------------
  |  |  497|   121k|#define M_OPT_OPTIONAL_PARAM    (UINT64_C(1) << 54)
  ------------------
  |  Branch (110:9): [True: 1.17k, False: 119k]
  ------------------
  111|  1.17k|        return 0;
  112|   119k|    if (opt->type == &m_option_type_choice) {
  ------------------
  |  Branch (112:9): [True: 2.61k, False: 117k]
  ------------------
  113|  2.61k|        const struct m_opt_choice_alternatives *alt;
  114|  8.75k|        for (alt = opt->priv; alt->name; alt++) {
  ------------------
  |  Branch (114:31): [True: 7.02k, False: 1.72k]
  ------------------
  115|  7.02k|            if (strcmp(alt->name, "yes") == 0)
  ------------------
  |  Branch (115:17): [True: 883, False: 6.14k]
  ------------------
  116|    883|                return 0;
  117|  7.02k|        }
  118|  2.61k|    }
  119|   119k|    return 1;
  120|   119k|}
m_option_set_node_or_string:
  124|  16.4k|{
  125|  16.4k|    if (src->format == MPV_FORMAT_STRING) {
  ------------------
  |  Branch (125:9): [True: 16.4k, False: 0]
  ------------------
  126|  16.4k|        return m_option_parse(log, opt, name, bstr0(src->u.string), dst);
  127|  16.4k|    } else {
  128|      0|        return m_option_set_node(opt, dst, src);
  129|      0|    }
  130|  16.4k|}
format_file_size:
  569|    407|{
  570|    407|    double s = size;
  571|    407|    if (size < 1024)
  ------------------
  |  Branch (571:9): [True: 98, False: 309]
  ------------------
  572|     98|        return talloc_asprintf(NULL, "%.0f B", s);
  ------------------
  |  |   52|     98|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     98|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  573|       |
  574|    309|    if (size < (1024 * 1024))
  ------------------
  |  Branch (574:9): [True: 88, False: 221]
  ------------------
  575|     88|        return talloc_asprintf(NULL, "%.3f KiB", s / (1024.0));
  ------------------
  |  |   52|     88|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     88|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  576|       |
  577|    221|    if (size < (1024 * 1024 * 1024))
  ------------------
  |  Branch (577:9): [True: 176, False: 45]
  ------------------
  578|    176|        return talloc_asprintf(NULL, "%.3f MiB", s / (1024.0 * 1024.0));
  ------------------
  |  |   52|    176|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|    176|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  579|       |
  580|     45|    if (size < (1024LL * 1024LL * 1024LL * 1024LL))
  ------------------
  |  Branch (580:9): [True: 45, False: 0]
  ------------------
  581|     45|        return talloc_asprintf(NULL, "%.3f GiB", s / (1024.0 * 1024.0 * 1024.0));
  ------------------
  |  |   52|     45|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     45|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  582|       |
  583|      0|    return talloc_asprintf(NULL, "%.3f TiB", s / (1024.0 * 1024.0 * 1024.0 * 1024.0));
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  584|     45|}
m_opt_choice_str:
  608|     28|{
  609|     28|    const char *val = m_opt_choice_str_def(choices, value, NULL);
  610|     28|    if (val)
  ------------------
  |  Branch (610:9): [True: 28, False: 0]
  ------------------
  611|     28|        return val;
  612|      0|    return "<unknown>";
  613|     28|}
m_opt_choice_str_def:
  617|     28|{
  618|     28|    for (const struct m_opt_choice_alternatives *c = choices; c->name; c++) {
  ------------------
  |  Branch (618:63): [True: 28, False: 0]
  ------------------
  619|     28|        if (c->value == value)
  ------------------
  |  Branch (619:13): [True: 28, False: 0]
  ------------------
  620|     28|            return c->name;
  621|     28|    }
  622|      0|    return def;
  623|     28|}
m_obj_list_find:
 3045|  76.4k|{
 3046|   458k|    for (int i = 0; ; i++) {
 3047|   458k|        if (!l->get_desc(dst, i))
  ------------------
  |  Branch (3047:13): [True: 27.2k, False: 431k]
  ------------------
 3048|  27.2k|            break;
 3049|   431k|        if (bstr_equals0(name, dst->name))
  ------------------
  |  Branch (3049:13): [True: 49.1k, False: 382k]
  ------------------
 3050|  49.1k|            return true;
 3051|   431k|    }
 3052|  97.1k|    for (int i = 0; l->aliases[i][0]; i++) {
  ------------------
  |  Branch (3052:21): [True: 77.8k, False: 19.2k]
  ------------------
 3053|  77.8k|        const char *aname = l->aliases[i][0];
 3054|  77.8k|        const char *alias = l->aliases[i][1];
 3055|  77.8k|        if (bstr_equals0(name, aname) && m_obj_list_find(dst, l, bstr0(alias)))
  ------------------
  |  Branch (3055:13): [True: 8.08k, False: 69.7k]
  |  Branch (3055:42): [True: 7.99k, False: 93]
  ------------------
 3056|  7.99k|        {
 3057|  7.99k|            dst->replaced_name = aname;
 3058|  7.99k|            return true;
 3059|  7.99k|        }
 3060|  77.8k|    }
 3061|  19.2k|    return false;
 3062|  27.2k|}
m_obj_settings_equal:
 3891|  42.4k|{
 3892|  42.4k|    if (!str_equal(NULL, &a->name, &b->name))
  ------------------
  |  Branch (3892:9): [True: 11.2k, False: 31.1k]
  ------------------
 3893|  11.2k|        return false;
 3894|       |
 3895|  31.1k|    if (!str_equal(NULL, &a->label, &b->label))
  ------------------
  |  Branch (3895:9): [True: 258, False: 30.9k]
  ------------------
 3896|    258|        return false;
 3897|       |
 3898|  30.9k|    if (a->enabled != b->enabled)
  ------------------
  |  Branch (3898:9): [True: 113, False: 30.8k]
  ------------------
 3899|    113|        return false;
 3900|       |
 3901|  30.8k|    return str_list_equal(NULL, &a->attribs, &b->attribs);
 3902|  30.9k|}
node_get_alloc:
 4018|  76.0k|{
 4019|       |    // Assume it was allocated with copy_node(), which allocates all
 4020|       |    // sub-nodes with the parent node as talloc parent.
 4021|  76.0k|    switch (node->format) {
 4022|      0|    case MPV_FORMAT_STRING:
  ------------------
  |  Branch (4022:5): [True: 0, False: 76.0k]
  ------------------
 4023|      0|        return node->u.string;
 4024|    678|    case MPV_FORMAT_NODE_ARRAY:
  ------------------
  |  Branch (4024:5): [True: 678, False: 75.3k]
  ------------------
 4025|  64.6k|    case MPV_FORMAT_NODE_MAP:
  ------------------
  |  Branch (4025:5): [True: 63.9k, False: 12.0k]
  ------------------
 4026|  64.6k|        return node->u.list;
 4027|  11.3k|    default:
  ------------------
  |  Branch (4027:5): [True: 11.3k, False: 64.6k]
  ------------------
 4028|       |        return NULL;
 4029|  76.0k|    }
 4030|  76.0k|}
m_option.c:parse_bool:
  146|   440k|{
  147|   440k|    if (bstr_equals0(param, "yes") || !param.len) {
  ------------------
  |  Branch (147:9): [True: 49.9k, False: 390k]
  |  Branch (147:39): [True: 3.97k, False: 386k]
  ------------------
  148|  53.9k|        if (dst)
  ------------------
  |  Branch (148:13): [True: 53.9k, False: 0]
  ------------------
  149|  53.9k|            VAL(dst) = 1;
  ------------------
  |  |  142|  53.9k|#define VAL(x) (*(bool *)(x))
  ------------------
  150|  53.9k|        return 1;
  151|  53.9k|    }
  152|   386k|    if (bstr_equals0(param, "no")) {
  ------------------
  |  Branch (152:9): [True: 385k, False: 833]
  ------------------
  153|   385k|        if (dst)
  ------------------
  |  Branch (153:13): [True: 385k, False: 0]
  ------------------
  154|   385k|            VAL(dst) = 0;
  ------------------
  |  |  142|   385k|#define VAL(x) (*(bool *)(x))
  ------------------
  155|   385k|        return 1;
  156|   385k|    }
  157|   386k|    bool is_help = bstr_equals0(param, "help");
  158|    833|    if (is_help) {
  ------------------
  |  Branch (158:9): [True: 76, False: 757]
  ------------------
  159|     76|        mp_info(log, "Valid values for %.*s flag are:\n", BSTR_P(name));
  ------------------
  |  |   78|    152|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (78:56): [True: 76, False: 0]
  |  |  ------------------
  ------------------
  160|    757|    } else {
  161|    757|        mp_fatal(log, "Invalid parameter for %.*s flag: %.*s\n",
  ------------------
  |  |   75|  3.02k|#define mp_fatal(log, ...)      mp_msg(log, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (75:57): [True: 757, False: 0]
  |  |  |  Branch (75:57): [True: 757, False: 0]
  |  |  ------------------
  ------------------
  162|    757|                 BSTR_P(name), BSTR_P(param));
  163|    757|        mp_info(log, "Valid values are:\n");
  ------------------
  |  |   78|    757|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  164|    757|    }
  165|    833|    mp_info(log, "    yes\n");
  ------------------
  |  |   78|    833|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  166|    833|    mp_info(log, "    no\n");
  ------------------
  |  |   78|    833|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  167|    833|    mp_info(log, "    (passing nothing)\n");
  ------------------
  |  |   78|    833|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  168|    833|    return is_help ? M_OPT_EXIT : M_OPT_INVALID;
  ------------------
  |  |  545|     76|#define M_OPT_EXIT              -6
  ------------------
                  return is_help ? M_OPT_EXIT : M_OPT_INVALID;
  ------------------
  |  |  535|    757|#define M_OPT_INVALID           -3
  ------------------
  |  Branch (168:12): [True: 76, False: 757]
  ------------------
  169|   386k|}
m_option.c:print_bool:
  172|  8.08k|{
  173|  8.08k|    return talloc_strdup(NULL, VAL(val) ? "yes" : "no");
  ------------------
  |  |   50|  8.08k|#define talloc_strdup                   ta_xstrdup
  ------------------
                  return talloc_strdup(NULL, VAL(val) ? "yes" : "no");
  ------------------
  |  |  142|  8.08k|#define VAL(x) (*(bool *)(x))
  |  |  ------------------
  |  |  |  Branch (142:16): [True: 3.42k, False: 4.66k]
  |  |  ------------------
  ------------------
  174|  8.08k|}
m_option.c:copy_opt:
  135|  8.31M|{
  136|  8.31M|    if (dst && src)
  ------------------
  |  Branch (136:9): [True: 8.31M, False: 0]
  |  Branch (136:16): [True: 8.31M, False: 0]
  ------------------
  137|  8.31M|        memcpy(dst, src, opt->type->size);
  138|  8.31M|}
m_option.c:bool_get:
  195|    106|{
  196|    106|    dst->format = MPV_FORMAT_FLAG;
  197|    106|    dst->u.flag = !!VAL(src);
  ------------------
  |  |  142|    106|#define VAL(x) (*(bool *)(x))
  ------------------
  198|    106|    return 1;
  199|    106|}
m_option.c:bool_equal:
  202|   341k|{
  203|   341k|    return VAL(a) == VAL(b);
  ------------------
  |  |  142|   341k|#define VAL(x) (*(bool *)(x))
  ------------------
                  return VAL(a) == VAL(b);
  ------------------
  |  |  142|   341k|#define VAL(x) (*(bool *)(x))
  ------------------
  204|   341k|}
m_option.c:parse_int:
  352|  17.0k|{
  353|  17.0k|    long long tmp;
  354|  17.0k|    int r = parse_longlong(log, opt, INT_MIN, INT_MAX, name, param, &tmp);
  355|  17.0k|    if (r >= 0 && dst)
  ------------------
  |  Branch (355:9): [True: 17.0k, False: 10]
  |  Branch (355:19): [True: 17.0k, False: 0]
  ------------------
  356|  17.0k|        *(int *)dst = tmp;
  357|  17.0k|    return r;
  358|  17.0k|}
m_option.c:parse_longlong:
  308|  18.1k|{
  309|  18.1k|    if (param.len == 0)
  ------------------
  |  Branch (309:9): [True: 4, False: 18.1k]
  ------------------
  310|      4|        return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      4|#define M_OPT_MISSING_PARAM     -2
  ------------------
  311|       |
  312|  18.1k|    struct bstr rest;
  313|  18.1k|    long long tmp_int = bstrtoll(param, &rest, 10);
  314|  18.1k|    if (rest.len)
  ------------------
  |  Branch (314:9): [True: 246, False: 17.9k]
  ------------------
  315|    246|        tmp_int = bstrtoll(param, &rest, 0);
  316|  18.1k|    if (rest.len) {
  ------------------
  |  Branch (316:9): [True: 54, False: 18.1k]
  ------------------
  317|     54|        mp_err(log, "The %.*s option must be an integer: %.*s\n",
  ------------------
  |  |   76|    216|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 54, False: 0]
  |  |  |  Branch (76:55): [True: 54, False: 0]
  |  |  ------------------
  ------------------
  318|     54|               BSTR_P(name), BSTR_P(param));
  319|     54|        return M_OPT_INVALID;
  ------------------
  |  |  535|     54|#define M_OPT_INVALID           -3
  ------------------
  320|     54|    }
  321|       |
  322|  18.1k|    long long min = OPT_INT_MIN(opt, long long, i_min);
  ------------------
  |  |   58|  18.1k|#define OPT_INT_MIN(opt, T, Tm) ((opt)->min < (opt)->max \
  |  |  ------------------
  |  |  |  Branch (58:34): [True: 17.1k, False: 1.00k]
  |  |  ------------------
  |  |   59|  18.1k|    ? ((opt)->min <= (double)(Tm) ? (Tm) : (T)((opt)->min)) : (Tm))
  |  |  ------------------
  |  |  |  Branch (59:8): [True: 0, False: 17.1k]
  |  |  ------------------
  ------------------
  323|  18.1k|    if (tmp_int < min) {
  ------------------
  |  Branch (323:9): [True: 4, False: 18.1k]
  ------------------
  324|      4|        mp_err(log, "The %.*s option must be >= %lld: %.*s\n",
  ------------------
  |  |   76|     16|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 4, False: 0]
  |  |  |  Branch (76:55): [True: 4, False: 0]
  |  |  ------------------
  ------------------
  325|      4|               BSTR_P(name), min, BSTR_P(param));
  326|      4|        return M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|      4|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  327|      4|    }
  328|       |
  329|  18.1k|    long long max = OPT_INT_MAX(opt, long long, i_max);
  ------------------
  |  |   60|  18.1k|#define OPT_INT_MAX(opt, T, Tm) ((opt)->min < (opt)->max \
  |  |  ------------------
  |  |  |  Branch (60:34): [True: 17.1k, False: 1.00k]
  |  |  ------------------
  |  |   61|  18.1k|    ? ((opt)->max >= (double)(Tm) ? (Tm) : (T)((opt)->max)) : (Tm))
  |  |  ------------------
  |  |  |  Branch (61:8): [True: 16.5k, False: 605]
  |  |  ------------------
  ------------------
  330|  18.1k|    if (tmp_int > max) {
  ------------------
  |  Branch (330:9): [True: 58, False: 18.0k]
  ------------------
  331|     58|        mp_err(log, "The %.*s option must be <= %lld: %.*s\n",
  ------------------
  |  |   76|    232|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 58, False: 0]
  |  |  |  Branch (76:55): [True: 58, False: 0]
  |  |  ------------------
  ------------------
  332|     58|               BSTR_P(name), max, BSTR_P(param));
  333|     58|        return M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|     58|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  334|     58|    }
  335|       |
  336|  18.0k|    if (dst)
  ------------------
  |  Branch (336:9): [True: 18.0k, False: 0]
  ------------------
  337|  18.0k|        *(long long *)dst = tmp_int;
  338|       |
  339|  18.0k|    return 1;
  340|  18.1k|}
m_option.c:print_int:
  371|  3.66k|{
  372|  3.66k|    if (opt->type->size == sizeof(int64_t))
  ------------------
  |  Branch (372:9): [True: 251, False: 3.41k]
  ------------------
  373|    251|        return talloc_asprintf(NULL, "%"PRId64, *(const int64_t *)val);
  ------------------
  |  |   52|    251|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|    251|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  374|  3.41k|    return talloc_asprintf(NULL, "%d", *(const int *)val);
  ------------------
  |  |   52|  3.41k|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|  3.41k|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  375|  3.66k|}
m_option.c:int_get:
  461|    216|{
  462|    216|    dst->format = MPV_FORMAT_INT64;
  463|    216|    dst->u.int64 = *(int *)src;
  464|    216|    return 1;
  465|    216|}
m_option.c:int_equal:
  468|   123k|{
  469|   123k|    return *(int *)a == *(int *)b;
  470|   123k|}
m_option.c:parse_int64:
  362|    408|{
  363|    408|    long long tmp;
  364|    408|    int r = parse_longlong(log, opt, INT64_MIN, INT64_MAX, name, param, &tmp);
  365|    408|    if (r >= 0 && dst)
  ------------------
  |  Branch (365:9): [True: 390, False: 18]
  |  Branch (365:19): [True: 390, False: 0]
  ------------------
  366|    390|        *(int64_t *)dst = tmp;
  367|    408|    return r;
  368|    408|}
m_option.c:int64_get:
  453|  9.18k|{
  454|  9.18k|    dst->format = MPV_FORMAT_INT64;
  455|  9.18k|    dst->u.int64 = *(int64_t *)src;
  456|  9.18k|    return 1;
  457|  9.18k|}
m_option.c:int64_equal:
  473|  1.04k|{
  474|  1.04k|    return *(int64_t *)a == *(int64_t *)b;
  475|  1.04k|}
m_option.c:parse_byte_size:
  507|  17.2k|{
  508|  17.2k|    if (param.len == 0)
  ------------------
  |  Branch (508:9): [True: 1, False: 17.2k]
  ------------------
  509|      1|        return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      1|#define M_OPT_MISSING_PARAM     -2
  ------------------
  510|       |
  511|  17.2k|    struct bstr r;
  512|  17.2k|    long long tmp_int = bstrtoll(param, &r, 0);
  513|  17.2k|    int64_t unit = 1;
  514|  17.2k|    if (r.len) {
  ------------------
  |  Branch (514:9): [True: 17.0k, False: 218]
  ------------------
  515|  17.0k|        if (bstrcasecmp0(r, "b") == 0) {
  ------------------
  |  Branch (515:13): [True: 81, False: 16.9k]
  ------------------
  516|     81|            unit = 1;
  517|  16.9k|        } else if (bstrcasecmp0(r, "kib") == 0 || bstrcasecmp0(r, "k") == 0) {
  ------------------
  |  Branch (517:20): [True: 34, False: 16.9k]
  |  Branch (517:51): [True: 16.4k, False: 434]
  ------------------
  518|  16.5k|            unit = 1024;
  519|  16.5k|        } else if (bstrcasecmp0(r, "mib") == 0 || bstrcasecmp0(r, "m") == 0) {
  ------------------
  |  Branch (519:20): [True: 66, False: 368]
  |  Branch (519:51): [True: 80, False: 288]
  ------------------
  520|    146|            unit = 1024 * 1024;
  521|    288|        } else if (bstrcasecmp0(r, "gib") == 0 || bstrcasecmp0(r, "g") == 0) {
  ------------------
  |  Branch (521:20): [True: 34, False: 254]
  |  Branch (521:51): [True: 57, False: 197]
  ------------------
  522|     91|            unit = 1024 * 1024 * 1024;
  523|    197|        } else if (bstrcasecmp0(r, "tib") == 0 || bstrcasecmp0(r, "t") == 0) {
  ------------------
  |  Branch (523:20): [True: 66, False: 131]
  |  Branch (523:51): [True: 101, False: 30]
  ------------------
  524|    167|            unit = 1024 * 1024 * 1024 * 1024LL;
  525|    167|        } else {
  526|     30|            mp_err(log, "The %.*s option must be an integer: %.*s\n",
  ------------------
  |  |   76|    120|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 30, False: 0]
  |  |  |  Branch (76:55): [True: 30, False: 0]
  |  |  ------------------
  ------------------
  527|     30|                   BSTR_P(name), BSTR_P(param));
  528|     30|            mp_err(log, "The following suffixes are also allowed: "
  ------------------
  |  |   76|     30|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
  529|     30|                   "KiB, MiB, GiB, TiB, B, K, M, G, T.\n");
  530|     30|            return M_OPT_INVALID;
  ------------------
  |  |  535|     30|#define M_OPT_INVALID           -3
  ------------------
  531|     30|        }
  532|  17.0k|    }
  533|       |
  534|  17.2k|    if (tmp_int < 0) {
  ------------------
  |  Branch (534:9): [True: 73, False: 17.1k]
  ------------------
  535|     73|        mp_err(log, "The %.*s option does not support negative numbers: %.*s\n",
  ------------------
  |  |   76|    292|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 73, False: 0]
  |  |  |  Branch (76:55): [True: 73, False: 0]
  |  |  ------------------
  ------------------
  536|     73|               BSTR_P(name), BSTR_P(param));
  537|     73|        return M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|     73|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  538|     73|    }
  539|       |
  540|  17.1k|    if (INT64_MAX / unit < tmp_int) {
  ------------------
  |  Branch (540:9): [True: 1, False: 17.1k]
  ------------------
  541|      1|        mp_err(log, "The %.*s option overflows: %.*s\n",
  ------------------
  |  |   76|      4|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 1, False: 0]
  |  |  |  Branch (76:55): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  542|      1|               BSTR_P(name), BSTR_P(param));
  543|      1|        return M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|      1|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  544|      1|    }
  545|       |
  546|  17.1k|    tmp_int *= unit;
  547|       |
  548|  17.1k|    int64_t min = OPT_INT_MIN(opt, int64_t, INT64_MIN);
  ------------------
  |  |   58|  17.1k|#define OPT_INT_MIN(opt, T, Tm) ((opt)->min < (opt)->max \
  |  |  ------------------
  |  |  |  Branch (58:34): [True: 17.1k, False: 0]
  |  |  ------------------
  |  |   59|  17.1k|    ? ((opt)->min <= (double)(Tm) ? (Tm) : (T)((opt)->min)) : (Tm))
  |  |  ------------------
  |  |  |  Branch (59:8): [True: 0, False: 17.1k]
  |  |  ------------------
  ------------------
  549|  17.1k|    if (tmp_int < min) {
  ------------------
  |  Branch (549:9): [True: 1, False: 17.1k]
  ------------------
  550|      1|        mp_err(log, "The %.*s option must be >= %"PRId64": %.*s\n",
  ------------------
  |  |   76|      4|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 1, False: 0]
  |  |  |  Branch (76:55): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  551|      1|               BSTR_P(name), min, BSTR_P(param));
  552|      1|        return M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|      1|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  553|      1|    }
  554|       |
  555|  17.1k|    int64_t max = OPT_INT_MAX(opt, int64_t, INT64_MAX);
  ------------------
  |  |   60|  17.1k|#define OPT_INT_MAX(opt, T, Tm) ((opt)->min < (opt)->max \
  |  |  ------------------
  |  |  |  Branch (60:34): [True: 17.1k, False: 0]
  |  |  ------------------
  |  |   61|  17.1k|    ? ((opt)->max >= (double)(Tm) ? (Tm) : (T)((opt)->max)) : (Tm))
  |  |  ------------------
  |  |  |  Branch (61:8): [True: 0, False: 17.1k]
  |  |  ------------------
  ------------------
  556|  17.1k|    if (tmp_int > max) {
  ------------------
  |  Branch (556:9): [True: 82, False: 17.0k]
  ------------------
  557|     82|        mp_err(log, "The %.*s option must be <= %"PRId64": %.*s\n",
  ------------------
  |  |   76|    328|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 82, False: 0]
  |  |  |  Branch (76:55): [True: 82, False: 0]
  |  |  ------------------
  ------------------
  558|     82|               BSTR_P(name), max, BSTR_P(param));
  559|     82|        return M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|     82|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  560|     82|    }
  561|       |
  562|  17.0k|    if (dst)
  ------------------
  |  Branch (562:9): [True: 17.0k, False: 0]
  ------------------
  563|  17.0k|        *(int64_t *)dst = tmp_int;
  564|       |
  565|  17.0k|    return 1;
  566|  17.1k|}
m_option.c:pretty_print_byte_size:
  587|    407|{
  588|    407|    return format_file_size(*(int64_t *)val);
  589|    407|}
m_option.c:parse_choice:
  636|   336k|{
  637|   336k|    const struct m_opt_choice_alternatives *alt = opt->priv;
  638|  1.14M|    for ( ; alt->name; alt++) {
  ------------------
  |  Branch (638:13): [True: 1.14M, False: 1.42k]
  ------------------
  639|  1.14M|        if (!bstrcmp0(param, alt->name))
  ------------------
  |  Branch (639:13): [True: 335k, False: 805k]
  ------------------
  640|   335k|            break;
  641|  1.14M|    }
  642|   336k|    if (!alt->name && param.len == 0) {
  ------------------
  |  Branch (642:9): [True: 1.42k, False: 335k]
  |  Branch (642:23): [True: 507, False: 915]
  ------------------
  643|       |        // allow flag-style options, e.g. "--mute" implies "--mute=yes"
  644|  1.58k|        for (alt = opt->priv; alt->name; alt++) {
  ------------------
  |  Branch (644:31): [True: 1.51k, False: 70]
  ------------------
  645|  1.51k|            if (!strcmp("yes", alt->name))
  ------------------
  |  Branch (645:17): [True: 437, False: 1.07k]
  ------------------
  646|    437|                break;
  647|  1.51k|        }
  648|    507|    }
  649|   336k|    if (!alt->name) {
  ------------------
  |  Branch (649:9): [True: 985, False: 335k]
  ------------------
  650|    985|        if (!bstrcmp0(param, "help")) {
  ------------------
  |  Branch (650:13): [True: 74, False: 911]
  ------------------
  651|     74|            mp_info(log, "Valid values for option %.*s are:\n", BSTR_P(name));
  ------------------
  |  |   78|    148|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (78:56): [True: 74, False: 0]
  |  |  ------------------
  ------------------
  652|     74|            print_choice_values(log, opt);
  653|     74|            return M_OPT_EXIT;
  ------------------
  |  |  545|     74|#define M_OPT_EXIT              -6
  ------------------
  654|     74|        }
  655|    911|        if (param.len == 0)
  ------------------
  |  Branch (655:13): [True: 70, False: 841]
  ------------------
  656|     70|            return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|     70|#define M_OPT_MISSING_PARAM     -2
  ------------------
  657|    841|        if (opt->min < opt->max) {
  ------------------
  |  Branch (657:13): [True: 689, False: 152]
  ------------------
  658|    689|            long long val;
  659|    689|            if (parse_longlong(mp_null_log, opt, INT_MIN, INT_MAX, name, param,
  ------------------
  |  Branch (659:17): [True: 597, False: 92]
  ------------------
  660|    689|                               &val) == 1)
  661|    597|            {
  662|    597|                if (dst)
  ------------------
  |  Branch (662:21): [True: 597, False: 0]
  ------------------
  663|    597|                    *(int *)dst = val;
  664|    597|                return 1;
  665|    597|            }
  666|    689|        }
  667|    244|        mp_fatal(log, "Invalid value for option %.*s: %.*s\n",
  ------------------
  |  |   75|    976|#define mp_fatal(log, ...)      mp_msg(log, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (75:57): [True: 244, False: 0]
  |  |  |  Branch (75:57): [True: 244, False: 0]
  |  |  ------------------
  ------------------
  668|    244|                 BSTR_P(name), BSTR_P(param));
  669|    244|        mp_info(log, "Valid values are:\n");
  ------------------
  |  |   78|    244|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  670|    244|        print_choice_values(log, opt);
  671|    244|        return M_OPT_INVALID;
  ------------------
  |  |  535|    244|#define M_OPT_INVALID           -3
  ------------------
  672|    841|    }
  673|   335k|    if (dst)
  ------------------
  |  Branch (673:9): [True: 335k, False: 0]
  ------------------
  674|   335k|        *(int *)dst = alt->value;
  675|       |
  676|   335k|    return 1;
  677|   336k|}
m_option.c:print_choice_values:
  626|    318|{
  627|    318|    const struct m_opt_choice_alternatives *alt = opt->priv;
  628|  1.45k|    for ( ; alt->name; alt++)
  ------------------
  |  Branch (628:13): [True: 1.14k, False: 318]
  ------------------
  629|  1.14k|        mp_info(log, "    %s\n", alt->name[0] ? alt->name : "(passing nothing)");
  ------------------
  |  |   78|  2.28k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (78:56): [True: 1.13k, False: 3]
  |  |  ------------------
  ------------------
  630|    318|    if (opt->min < opt->max)
  ------------------
  |  Branch (630:9): [True: 94, False: 224]
  ------------------
  631|     94|        mp_info(log, "    %g-%g (integer range)\n", opt->min, opt->max);
  ------------------
  |  |   78|     94|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  632|    318|}
m_option.c:print_choice:
  814|  4.81k|{
  815|  4.81k|    int ival = 0;
  816|  4.81k|    const struct m_opt_choice_alternatives *alt = get_choice(opt, val, &ival);
  817|  4.81k|    return alt ? talloc_strdup(NULL, alt->name)
  ------------------
  |  |   50|  4.61k|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (817:12): [True: 4.61k, False: 201]
  ------------------
  818|  4.81k|               : talloc_asprintf(NULL, "%d", ival);
  ------------------
  |  |   52|    201|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|    201|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  819|  4.81k|}
m_option.c:get_choice:
  764|  4.81k|{
  765|  4.81k|    int v = *(int *)val;
  766|  4.81k|    const struct m_opt_choice_alternatives *alt;
  767|  8.57k|    for (alt = opt->priv; alt->name; alt++) {
  ------------------
  |  Branch (767:27): [True: 8.37k, False: 201]
  ------------------
  768|  8.37k|        if (alt->value == v)
  ------------------
  |  Branch (768:13): [True: 4.61k, False: 3.76k]
  ------------------
  769|  4.61k|            return alt;
  770|  8.37k|    }
  771|    201|    if (opt->min < opt->max) {
  ------------------
  |  Branch (771:9): [True: 201, False: 0]
  ------------------
  772|    201|        if (v >= opt->min && v <= opt->max) {
  ------------------
  |  Branch (772:13): [True: 201, False: 0]
  |  Branch (772:30): [True: 201, False: 0]
  ------------------
  773|    201|            *out_val = v;
  774|    201|            return NULL;
  775|    201|        }
  776|    201|    }
  777|      0|    MP_ASSERT_UNREACHABLE();
  ------------------
  |  |   46|      0|#define MP_ASSERT_UNREACHABLE() (assert(!"unreachable"), abort())
  ------------------
  |  Branch (777:5): [Folded, False: 0]
  ------------------
  778|      0|}
m_option.c:parse_flags:
  868|    640|{
  869|    640|    int value = 0;
  870|  1.28k|    while (param.len) {
  ------------------
  |  Branch (870:12): [True: 640, False: 640]
  ------------------
  871|    640|        bstr flag;
  872|    640|        bstr_split_tok(param, "+", &flag, &param);
  873|    640|        int r = apply_flag(opt, &value, flag);
  874|    640|        if (r == M_OPT_UNKNOWN) {
  ------------------
  |  |  529|    640|#define M_OPT_UNKNOWN           -1
  ------------------
  |  Branch (874:13): [True: 0, False: 640]
  ------------------
  875|      0|            mp_fatal(log, "Invalid flag for option %.*s: %.*s\n",
  ------------------
  |  |   75|      0|#define mp_fatal(log, ...)      mp_msg(log, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (75:57): [True: 0, False: 0]
  |  |  |  Branch (75:57): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  876|      0|                     BSTR_P(name), BSTR_P(flag));
  877|      0|            mp_info(log, "Valid flags are:\n");
  ------------------
  |  |   78|      0|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  878|      0|            const struct m_opt_choice_alternatives *alt;
  879|      0|            for (alt = opt->priv; alt->name; alt++)
  ------------------
  |  Branch (879:35): [True: 0, False: 0]
  ------------------
  880|      0|                mp_info(log, "    %s\n", alt->name);
  ------------------
  |  |   78|      0|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  881|      0|            mp_info(log, "Flags can usually be combined with '+'.\n");
  ------------------
  |  |   78|      0|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  882|      0|            return M_OPT_INVALID;
  ------------------
  |  |  535|      0|#define M_OPT_INVALID           -3
  ------------------
  883|    640|        } else if (r < 0) {
  ------------------
  |  Branch (883:20): [True: 0, False: 640]
  ------------------
  884|      0|            mp_fatal(log, "Option %.*s: flag '%.*s' conflicts with a previous "
  ------------------
  |  |   75|      0|#define mp_fatal(log, ...)      mp_msg(log, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (75:57): [True: 0, False: 0]
  |  |  |  Branch (75:57): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  885|      0|                     "flag value.\n", BSTR_P(name), BSTR_P(flag));
  886|      0|            return M_OPT_INVALID;
  ------------------
  |  |  535|      0|#define M_OPT_INVALID           -3
  ------------------
  887|      0|        }
  888|    640|    }
  889|    640|    if (dst)
  ------------------
  |  Branch (889:9): [True: 640, False: 0]
  ------------------
  890|    640|        *(int *)dst = value;
  891|    640|    return 1;
  892|    640|}
m_option.c:apply_flag:
  835|    640|{
  836|    640|    const struct m_opt_choice_alternatives *alt;
  837|  3.32k|    for (alt = opt->priv; alt->name; alt++) {
  ------------------
  |  Branch (837:27): [True: 3.32k, False: 0]
  ------------------
  838|  3.32k|        if (bstr_equals0(flag, alt->name)) {
  ------------------
  |  Branch (838:13): [True: 640, False: 2.68k]
  ------------------
  839|    640|            if (*val & alt->value)
  ------------------
  |  Branch (839:17): [True: 0, False: 640]
  ------------------
  840|      0|                return M_OPT_INVALID;
  ------------------
  |  |  535|      0|#define M_OPT_INVALID           -3
  ------------------
  841|    640|            *val |= alt->value;
  842|    640|            return 0;
  843|    640|        }
  844|  3.32k|    }
  845|      0|    return M_OPT_UNKNOWN;
  ------------------
  |  |  529|      0|#define M_OPT_UNKNOWN           -1
  ------------------
  846|    640|}
m_option.c:parse_double:
 1021|  21.9k|{
 1022|  21.9k|    double tmp;
 1023|  21.9k|    int r = parse_numeric(log, opt, name, param, &tmp, clamp_double);
 1024|  21.9k|    if (r == 1 && dst)
  ------------------
  |  Branch (1024:9): [True: 21.9k, False: 17]
  |  Branch (1024:19): [True: 21.9k, False: 0]
  ------------------
 1025|  21.9k|        VAL(dst) = tmp;
  ------------------
  |  |  960|  21.9k|#define VAL(x) (*(double *)(x))
  ------------------
 1026|  21.9k|    return r;
 1027|  21.9k|}
m_option.c:parse_numeric:
  988|   188k|{
  989|   188k|    if (param.len == 0)
  ------------------
  |  Branch (989:9): [True: 3, False: 188k]
  ------------------
  990|      3|        return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      3|#define M_OPT_MISSING_PARAM     -2
  ------------------
  991|       |
  992|   188k|    struct bstr rest;
  993|   188k|    *out = bstrtod(param, &rest);
  994|       |
  995|   188k|    if (bstr_eatstart0(&rest, ":") || bstr_eatstart0(&rest, "/"))
  ------------------
  |  Branch (995:9): [True: 84, False: 188k]
  |  Branch (995:39): [True: 228, False: 188k]
  ------------------
  996|    312|        *out /= bstrtod(rest, &rest);
  997|       |
  998|   188k|    if ((opt->flags & M_OPT_DEFAULT_NAN) && bstr_equals0(param, "default")) {
  ------------------
  |  |  483|   188k|#define M_OPT_DEFAULT_NAN       (UINT64_C(1) << 58)
  ------------------
  |  Branch (998:9): [True: 315, False: 188k]
  |  Branch (998:45): [True: 100, False: 215]
  ------------------
  999|    100|        *out = NAN;
 1000|    100|        return 1;
 1001|    100|    }
 1002|       |
 1003|   188k|    if (rest.len) {
  ------------------
  |  Branch (1003:9): [True: 55, False: 188k]
  ------------------
 1004|     55|        mp_err(log, "The %.*s option must be a floating point number or a "
  ------------------
  |  |   76|    220|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 55, False: 0]
  |  |  |  Branch (76:55): [True: 55, False: 0]
  |  |  ------------------
  ------------------
 1005|     55|               "ratio (numerator[:/]denominator): %.*s\n",
 1006|     55|               BSTR_P(name), BSTR_P(param));
 1007|     55|        return M_OPT_INVALID;
  ------------------
  |  |  535|     55|#define M_OPT_INVALID           -3
  ------------------
 1008|     55|    }
 1009|       |
 1010|   188k|    if (clamp(opt, out) < 0) {
  ------------------
  |  Branch (1010:9): [True: 16, False: 188k]
  ------------------
 1011|     16|        mp_err(log, "The %.*s option is out of range: %.*s\n",
  ------------------
  |  |   76|     64|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 16, False: 0]
  |  |  |  Branch (76:55): [True: 16, False: 0]
  |  |  ------------------
  ------------------
 1012|     16|               BSTR_P(name), BSTR_P(param));
 1013|     16|        return M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|     16|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
 1014|     16|    }
 1015|       |
 1016|   188k|    return 1;
 1017|   188k|}
m_option.c:clamp_double:
  963|   188k|{
  964|   188k|    double v = *val;
  965|   188k|    int r = 0;
  966|   188k|    if (opt->min < opt->max) {
  ------------------
  |  Branch (966:9): [True: 82.2k, False: 106k]
  ------------------
  967|  82.2k|        if (v > opt->max) {
  ------------------
  |  Branch (967:13): [True: 2, False: 82.2k]
  ------------------
  968|      2|            v = opt->max;
  969|      2|            r = M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|      2|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  970|      2|        }
  971|  82.2k|        if (v < opt->min) {
  ------------------
  |  Branch (971:13): [True: 4, False: 82.2k]
  ------------------
  972|      4|            v = opt->min;
  973|      4|            r = M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|      4|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  974|      4|        }
  975|  82.2k|    }
  976|       |    // (setting max/min to INFINITY/-INFINITY is allowed)
  977|   188k|    if (!isfinite(v) && v != opt->max && v != opt->min) {
  ------------------
  |  Branch (977:9): [True: 8, False: 188k]
  |  Branch (977:25): [True: 8, False: 0]
  |  Branch (977:42): [True: 8, False: 0]
  ------------------
  978|      8|        v = opt->min;
  979|      8|        r = M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|      8|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  980|      8|    }
  981|   188k|    *val = v;
  982|   188k|    return r;
  983|   188k|}
m_option.c:print_double:
 1030|    590|{
 1031|    590|    double f = VAL(val);
  ------------------
  |  |  960|    590|#define VAL(x) (*(double *)(x))
  ------------------
 1032|    590|    if (isnan(f) && (opt->flags & M_OPT_DEFAULT_NAN))
  ------------------
  |  |  483|    472|#define M_OPT_DEFAULT_NAN       (UINT64_C(1) << 58)
  ------------------
  |  Branch (1032:9): [True: 472, False: 118]
  |  Branch (1032:21): [True: 472, False: 0]
  ------------------
 1033|    472|        return talloc_strdup(NULL, "default");
  ------------------
  |  |   50|    472|#define talloc_strdup                   ta_xstrdup
  ------------------
 1034|    118|    return talloc_asprintf(NULL, "%f", f);
  ------------------
  |  |   52|    118|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|    118|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 1035|    590|}
m_option.c:pretty_print_double:
 1038|  6.54k|{
 1039|  6.54k|    double f = VAL(val);
  ------------------
  |  |  960|  6.54k|#define VAL(x) (*(double *)(x))
  ------------------
 1040|  6.54k|    if (isnan(f))
  ------------------
  |  Branch (1040:9): [True: 454, False: 6.08k]
  ------------------
 1041|    454|        return print_double(opt, val);
 1042|  6.08k|    return mp_format_double(NULL, f, 4, false, false, !(opt->flags & M_OPT_FIXED_LEN_PRINT));
  ------------------
  |  |  494|  6.08k|#define M_OPT_FIXED_LEN_PRINT   (UINT64_C(1) << 55)
  ------------------
 1043|  6.54k|}
m_option.c:double_get:
 1087|     72|{
 1088|     72|    double f = VAL(src);
  ------------------
  |  |  960|     72|#define VAL(x) (*(double *)(x))
  ------------------
 1089|     72|    if (isnan(f) && (opt->flags & M_OPT_DEFAULT_NAN)) {
  ------------------
  |  |  483|      0|#define M_OPT_DEFAULT_NAN       (UINT64_C(1) << 58)
  ------------------
  |  Branch (1089:9): [True: 0, False: 72]
  |  Branch (1089:21): [True: 0, False: 0]
  ------------------
 1090|      0|        dst->format = MPV_FORMAT_STRING;
 1091|      0|        dst->u.string = talloc_strdup(ta_parent, "default");
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
 1092|     72|    } else {
 1093|     72|        dst->format = MPV_FORMAT_DOUBLE;
 1094|     72|        dst->u.double_ = f;
 1095|     72|    }
 1096|     72|    return 1;
 1097|     72|}
m_option.c:double_equal:
 1100|  36.9k|{
 1101|  36.9k|    double fa = VAL(a), fb = VAL(b);
  ------------------
  |  |  960|  36.9k|#define VAL(x) (*(double *)(x))
  ------------------
                  double fa = VAL(a), fb = VAL(b);
  ------------------
  |  |  960|  36.9k|#define VAL(x) (*(double *)(x))
  ------------------
 1102|  36.9k|    if (isnan(fa) || isnan(fb))
  ------------------
  |  Branch (1102:9): [True: 131, False: 36.8k]
  |  Branch (1102:22): [True: 34, False: 36.8k]
  ------------------
 1103|    165|        return isnan(fa) == isnan(fb);
 1104|  36.8k|    return fa == fb;
 1105|  36.9k|}
m_option.c:parse_double_aspect:
 1125|    148|{
 1126|    148|    if (bstr_equals0(param, "no")) {
  ------------------
  |  Branch (1126:9): [True: 66, False: 82]
  ------------------
 1127|     66|        if (dst)
  ------------------
  |  Branch (1127:13): [True: 66, False: 0]
  ------------------
 1128|     66|            VAL(dst) = -2.0;
  ------------------
  |  |  960|     66|#define VAL(x) (*(double *)(x))
  ------------------
 1129|     66|        return 1;
 1130|     66|    }
 1131|     82|    return parse_double(log, opt, name, param, dst);
 1132|    148|}
m_option.c:parse_float:
 1172|   166k|{
 1173|   166k|    double tmp;
 1174|   166k|    int r = parse_numeric(log, opt, name, param, &tmp, clamp_float);
 1175|   166k|    if (r == 1 && dst)
  ------------------
  |  Branch (1175:9): [True: 166k, False: 57]
  |  Branch (1175:19): [True: 166k, False: 0]
  ------------------
 1176|   166k|        VAL(dst) = tmp;
  ------------------
  |  | 1150|   166k|#define VAL(x) (*(float *)(x))
  ------------------
 1177|   166k|    return r;
 1178|   166k|}
m_option.c:clamp_float:
 1153|   166k|{
 1154|   166k|    double v = *val;
 1155|   166k|    int r = clamp_double(opt, &v);
 1156|       |    // Handle the case where range is not set and v is finite
 1157|       |    // but overflows the float range.
 1158|   166k|    if (isfinite(v) && v > FLT_MAX) {
  ------------------
  |  Branch (1158:9): [True: 166k, False: 0]
  |  Branch (1158:24): [True: 1, False: 166k]
  ------------------
 1159|      1|        v = FLT_MAX;
 1160|      1|        r = M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|      1|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
 1161|      1|    }
 1162|   166k|    if (isfinite(v) && v < -FLT_MAX) {
  ------------------
  |  Branch (1162:9): [True: 166k, False: 0]
  |  Branch (1162:24): [True: 1, False: 166k]
  ------------------
 1163|      1|        v = -FLT_MAX;
 1164|      1|        r = M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|      1|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
 1165|      1|    }
 1166|   166k|    *val = v;
 1167|   166k|    return r;
 1168|   166k|}
m_option.c:print_float:
 1181|     82|{
 1182|     82|    double tmp = VAL(val);
  ------------------
  |  | 1150|     82|#define VAL(x) (*(float *)(x))
  ------------------
 1183|     82|    return print_double(opt, &tmp);
 1184|     82|}
m_option.c:pretty_print_float:
 1187|  5.05k|{
 1188|  5.05k|    double tmp = VAL(val);
  ------------------
  |  | 1150|  5.05k|#define VAL(x) (*(float *)(x))
  ------------------
 1189|  5.05k|    return pretty_print_double(opt, &tmp);
 1190|  5.05k|}
m_option.c:float_equal:
 1227|  36.3k|{
 1228|  36.3k|    return double_equal(opt, &(double){VAL(a)}, &(double){VAL(b)});
  ------------------
  |  | 1150|  36.3k|#define VAL(x) (*(float *)(x))
  ------------------
                  return double_equal(opt, &(double){VAL(a)}, &(double){VAL(b)});
  ------------------
  |  | 1150|  36.3k|#define VAL(x) (*(float *)(x))
  ------------------
 1229|  36.3k|}
m_option.c:parse_str:
 1254|  47.3k|{
 1255|  47.3k|    if (dst) {
  ------------------
  |  Branch (1255:9): [True: 47.3k, False: 0]
  ------------------
 1256|  47.3k|        talloc_free(VAL(dst));
  ------------------
  |  |   47|  47.3k|#define talloc_free                     ta_free
  ------------------
                      talloc_free(VAL(dst));
  ------------------
  |  | 1250|  47.3k|#define VAL(x) (*(char **)(x))
  ------------------
 1257|  47.3k|        VAL(dst) = bstrdup0(NULL, param);
  ------------------
  |  | 1250|  47.3k|#define VAL(x) (*(char **)(x))
  ------------------
 1258|  47.3k|    }
 1259|       |
 1260|  47.3k|    return 0;
 1261|  47.3k|}
m_option.c:print_str:
 1264|   217k|{
 1265|   217k|    return talloc_strdup(NULL, VAL(val) ? VAL(val) : "");
  ------------------
  |  |   50|   217k|#define talloc_strdup                   ta_xstrdup
  ------------------
                  return talloc_strdup(NULL, VAL(val) ? VAL(val) : "");
  ------------------
  |  | 1250|   217k|#define VAL(x) (*(char **)(x))
  |  |  ------------------
  |  |  |  Branch (1250:16): [True: 215k, False: 1.98k]
  |  |  ------------------
  ------------------
                  return talloc_strdup(NULL, VAL(val) ? VAL(val) : "");
  ------------------
  |  | 1250|   215k|#define VAL(x) (*(char **)(x))
  ------------------
 1266|   217k|}
m_option.c:copy_str:
 1269|  4.41M|{
 1270|  4.41M|    if (dst && src)
  ------------------
  |  Branch (1270:9): [True: 4.41M, False: 0]
  |  Branch (1270:16): [True: 4.41M, False: 0]
  ------------------
 1271|  4.41M|        talloc_replace(NULL, VAL(dst), VAL(src));
  ------------------
  |  |   54|  4.41M|#define talloc_replace                  ta_replace
  |  |  ------------------
  |  |  |  |  106|  4.41M|    do {                                                \
  |  |  |  |  107|  4.41M|        if (!(str)) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:13): [True: 4.40M, False: 8.79k]
  |  |  |  |  ------------------
  |  |  |  |  108|  4.40M|            (str) = ta_xstrdup((ta_parent), (replace)); \
  |  |  |  |  109|  4.40M|        } else {                                        \
  |  |  |  |  110|  8.79k|            *(str) = '\0';                              \
  |  |  |  |  111|  8.79k|            ta_xstrdup_append(&(str), (replace));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|  8.79k|#define ta_xstrdup_append(...)          ta_oom_b(ta_strdup_append(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  112|  8.79k|        }                                               \
  |  |  |  |  113|  4.41M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (113:14): [Folded, False: 4.41M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1272|  4.41M|}
m_option.c:free_str:
 1299|  4.40M|{
 1300|  4.40M|    if (src && VAL(src)) {
  ------------------
  |  | 1250|  4.40M|#define VAL(x) (*(char **)(x))
  |  |  ------------------
  |  |  |  Branch (1250:16): [True: 1.15M, False: 3.24M]
  |  |  ------------------
  ------------------
  |  Branch (1300:9): [True: 4.40M, False: 0]
  ------------------
 1301|  1.15M|        talloc_free(VAL(src));
  ------------------
  |  |   47|  1.15M|#define talloc_free                     ta_free
  ------------------
                      talloc_free(VAL(src));
  ------------------
  |  | 1250|  1.15M|#define VAL(x) (*(char **)(x))
  ------------------
 1302|  1.15M|        VAL(src) = NULL;
  ------------------
  |  | 1250|  1.15M|#define VAL(x) (*(char **)(x))
  ------------------
 1303|  1.15M|    }
 1304|  4.40M|}
m_option.c:str_get:
 1287|   173k|{
 1288|   173k|    dst->format = MPV_FORMAT_STRING;
 1289|   173k|    dst->u.string = talloc_strdup(ta_parent, VAL(src) ? VAL(src) : "");
  ------------------
  |  |   50|   173k|#define talloc_strdup                   ta_xstrdup
  ------------------
                  dst->u.string = talloc_strdup(ta_parent, VAL(src) ? VAL(src) : "");
  ------------------
  |  | 1250|   173k|#define VAL(x) (*(char **)(x))
  |  |  ------------------
  |  |  |  Branch (1250:16): [True: 173k, False: 24]
  |  |  ------------------
  ------------------
                  dst->u.string = talloc_strdup(ta_parent, VAL(src) ? VAL(src) : "");
  ------------------
  |  | 1250|   173k|#define VAL(x) (*(char **)(x))
  ------------------
 1290|   173k|    return 1;
 1291|   173k|}
m_option.c:str_equal:
 1294|   103k|{
 1295|   103k|    return bstr_equals(bstr0(VAL(a)), bstr0(VAL(b)));
  ------------------
  |  | 1250|   103k|#define VAL(x) (*(char **)(x))
  ------------------
                  return bstr_equals(bstr0(VAL(a)), bstr0(VAL(b)));
  ------------------
  |  | 1250|   103k|#define VAL(x) (*(char **)(x))
  ------------------
 1296|   103k|}
m_option.c:parse_str_list:
 1622|  75.1k|{
 1623|  75.1k|    return parse_str_list_impl(log, opt, name, param, dst, OP_NONE);
  ------------------
  |  | 1323|  75.1k|#define OP_NONE 0
  ------------------
 1624|  75.1k|}
m_option.c:parse_str_list_impl:
 1467|  75.1k|{
 1468|  75.1k|    char **res;
 1469|  75.1k|    int op = default_op;
 1470|       |
 1471|  75.1k|    if (bstr_endswith0(name, "-add")) {
  ------------------
  |  Branch (1471:9): [True: 182, False: 74.9k]
  ------------------
 1472|    182|        op = OP_ADD;
  ------------------
  |  | 1324|    182|#define OP_ADD 1
  ------------------
 1473|  74.9k|    } else if (bstr_endswith0(name, "-append")) {
  ------------------
  |  Branch (1473:16): [True: 5.20k, False: 69.7k]
  ------------------
 1474|  5.20k|        op = OP_APPEND;
  ------------------
  |  | 1329|  5.20k|#define OP_APPEND 6
  ------------------
 1475|  69.7k|    } else if (bstr_endswith0(name, "-pre")) {
  ------------------
  |  Branch (1475:16): [True: 66, False: 69.7k]
  ------------------
 1476|     66|        op = OP_PRE;
  ------------------
  |  | 1325|     66|#define OP_PRE 2
  ------------------
 1477|  69.7k|    } else if (bstr_endswith0(name, "-clr")) {
  ------------------
  |  Branch (1477:16): [True: 209, False: 69.4k]
  ------------------
 1478|    209|        op = OP_CLR;
  ------------------
  |  | 1326|    209|#define OP_CLR 3
  ------------------
 1479|  69.4k|    } else if (bstr_endswith0(name, "-del")) {
  ------------------
  |  Branch (1479:16): [True: 139, False: 69.3k]
  ------------------
 1480|    139|        op = OP_DEL;
  ------------------
  |  | 1327|    139|#define OP_DEL 4
  ------------------
 1481|  69.3k|    } else if (bstr_endswith0(name, "-set")) {
  ------------------
  |  Branch (1481:16): [True: 68, False: 69.2k]
  ------------------
 1482|     68|        op = OP_NONE;
  ------------------
  |  | 1323|     68|#define OP_NONE 0
  ------------------
 1483|  69.2k|    } else if (bstr_endswith0(name, "-toggle")) {
  ------------------
  |  Branch (1483:16): [True: 112, False: 69.1k]
  ------------------
 1484|    112|        op = OP_TOGGLE;
  ------------------
  |  | 1328|    112|#define OP_TOGGLE 5
  ------------------
 1485|  69.1k|    } else if (bstr_endswith0(name, "-remove")) {
  ------------------
  |  Branch (1485:16): [True: 402, False: 68.7k]
  ------------------
 1486|    402|        op = OP_REMOVE;
  ------------------
  |  | 1330|    402|#define OP_REMOVE 7
  ------------------
 1487|    402|    }
 1488|       |
 1489|  75.1k|    if (op == OP_TOGGLE || op == OP_REMOVE) {
  ------------------
  |  | 1328|   150k|#define OP_TOGGLE 5
  ------------------
                  if (op == OP_TOGGLE || op == OP_REMOVE) {
  ------------------
  |  | 1330|  75.0k|#define OP_REMOVE 7
  ------------------
  |  Branch (1489:9): [True: 112, False: 75.0k]
  |  Branch (1489:28): [True: 402, False: 74.6k]
  ------------------
 1490|    514|        if (dst) {
  ------------------
  |  Branch (1490:13): [True: 514, False: 0]
  ------------------
 1491|    514|            res = talloc_array(NULL, char *, 2);
  ------------------
  |  |   29|    514|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|    514|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|    514|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1492|    514|            res[0] = bstrdup0(res, param);
 1493|    514|            res[1] = NULL;
 1494|    514|            bool found = str_list_remove(res, 2, dst);
 1495|    514|            if (found)
  ------------------
  |  Branch (1495:17): [True: 278, False: 236]
  ------------------
 1496|    278|                return 1;
 1497|    514|        }
 1498|    236|        if (op == OP_REMOVE)
  ------------------
  |  | 1330|    236|#define OP_REMOVE 7
  ------------------
  |  Branch (1498:13): [True: 145, False: 91]
  ------------------
 1499|    145|            return 1; // ignore if not found
 1500|     91|        op = OP_APPEND;
  ------------------
  |  | 1329|     91|#define OP_APPEND 6
  ------------------
 1501|     91|    }
 1502|       |
 1503|       |    // Clear the list ??
 1504|  74.7k|    if (op == OP_CLR) {
  ------------------
  |  | 1326|  74.7k|#define OP_CLR 3
  ------------------
  |  Branch (1504:9): [True: 209, False: 74.5k]
  ------------------
 1505|    209|        if (dst)
  ------------------
  |  Branch (1505:13): [True: 209, False: 0]
  ------------------
 1506|    209|            free_str_list(dst);
 1507|    209|        return 0;
 1508|    209|    }
 1509|       |
 1510|       |    // All other ops need a param
 1511|  74.5k|    if (param.len == 0 && op != OP_NONE)
  ------------------
  |  | 1323|    480|#define OP_NONE 0
  ------------------
  |  Branch (1511:9): [True: 480, False: 74.0k]
  |  Branch (1511:27): [True: 7, False: 473]
  ------------------
 1512|      7|        return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      7|#define M_OPT_MISSING_PARAM     -2
  ------------------
 1513|       |
 1514|  74.5k|    if (!dst)
  ------------------
  |  Branch (1514:9): [True: 0, False: 74.5k]
  ------------------
 1515|      0|        return 1;
 1516|       |
 1517|  74.5k|    int n = 0;
 1518|  74.5k|    res = separate_input_param(opt, param, &n, op);
 1519|  74.5k|    if (!res)
  ------------------
  |  Branch (1519:9): [True: 0, False: 74.5k]
  ------------------
 1520|      0|        return M_OPT_INVALID;
  ------------------
  |  |  535|      0|#define M_OPT_INVALID           -3
  ------------------
 1521|       |
 1522|  74.5k|    switch (op) {
  ------------------
  |  Branch (1522:13): [True: 5.67k, False: 68.8k]
  ------------------
 1523|    182|    case OP_ADD:
  ------------------
  |  | 1324|    182|#define OP_ADD 1
  ------------------
  |  Branch (1523:5): [True: 182, False: 74.3k]
  ------------------
 1524|  5.46k|    case OP_APPEND:
  ------------------
  |  | 1329|  5.46k|#define OP_APPEND 6
  ------------------
  |  Branch (1524:5): [True: 5.28k, False: 69.2k]
  ------------------
 1525|  5.46k|        return str_list_add(res, n, dst, 0);
 1526|     66|    case OP_PRE:
  ------------------
  |  | 1325|     66|#define OP_PRE 2
  ------------------
  |  Branch (1526:5): [True: 66, False: 74.4k]
  ------------------
 1527|     66|        return str_list_add(res, n, dst, 1);
 1528|    139|    case OP_DEL:
  ------------------
  |  | 1327|    139|#define OP_DEL 4
  ------------------
  |  Branch (1528:5): [True: 139, False: 74.3k]
  ------------------
 1529|    139|        return str_list_remove(res, n, dst);
 1530|  74.5k|    }
 1531|       |
 1532|  68.8k|    if (VAL(dst))
  ------------------
  |  | 1321|  68.8k|#define VAL(x) (*(char ***)(x))
  |  |  ------------------
  |  |  |  Branch (1321:16): [True: 672, False: 68.1k]
  |  |  ------------------
  ------------------
 1533|    672|        free_str_list(dst);
 1534|  68.8k|    VAL(dst) = res;
  ------------------
  |  | 1321|  68.8k|#define VAL(x) (*(char ***)(x))
  ------------------
 1535|       |
 1536|  68.8k|    if (!res[0])
  ------------------
  |  Branch (1536:9): [True: 0, False: 68.8k]
  ------------------
 1537|      0|        free_str_list(dst);
 1538|       |
 1539|  68.8k|    return 1;
 1540|  74.5k|}
m_option.c:str_list_remove:
 1443|    653|{
 1444|    653|    bool found = false;
 1445|    653|    char **list = VAL(dst);
  ------------------
  |  | 1321|    653|#define VAL(x) (*(char ***)(x))
  ------------------
 1446|  2.17k|    for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (1446:21): [True: 1.51k, False: 653]
  ------------------
 1447|  1.51k|        int index = 0;
 1448|  2.24k|        do {
 1449|  2.24k|            index = bstr_find_in_list0(bstr0(remove[i]), list, true);
 1450|  2.24k|            if (index >= 0) {
  ------------------
  |  Branch (1450:17): [True: 726, False: 1.51k]
  ------------------
 1451|    726|                found = true;
 1452|    726|                char *old = list[index];
 1453|  9.76k|                for (int j = index; list[j]; j++)
  ------------------
  |  Branch (1453:37): [True: 9.03k, False: 726]
  ------------------
 1454|  9.03k|                    list[j] = list[j + 1];
 1455|    726|                talloc_free(old);
  ------------------
  |  |   47|    726|#define talloc_free                     ta_free
  ------------------
 1456|    726|            }
 1457|  2.24k|        } while (index >= 0);
  ------------------
  |  Branch (1457:18): [True: 726, False: 1.51k]
  ------------------
 1458|  1.51k|        talloc_free(remove[i]);
  ------------------
  |  |   47|  1.51k|#define talloc_free                     ta_free
  ------------------
 1459|  1.51k|    }
 1460|    653|    talloc_free(remove);
  ------------------
  |  |   47|    653|#define talloc_free                     ta_free
  ------------------
 1461|    653|    return found;
 1462|    653|}
m_option.c:separate_input_param:
 1405|  74.9k|{
 1406|  74.9k|    char separator = opt->priv ? *(char *)opt->priv : OPTION_LIST_SEPARATOR;
  ------------------
  |  |  644|   144k|#define OPTION_LIST_SEPARATOR ','
  ------------------
  |  Branch (1406:22): [True: 5.35k, False: 69.6k]
  ------------------
 1407|  74.9k|    if (op == OP_APPEND || op == OP_REMOVE)
  ------------------
  |  | 1329|   149k|#define OP_APPEND 6
  ------------------
                  if (op == OP_APPEND || op == OP_REMOVE)
  ------------------
  |  | 1330|  69.6k|#define OP_REMOVE 7
  ------------------
  |  Branch (1407:9): [True: 5.28k, False: 69.6k]
  |  Branch (1407:28): [True: 136, False: 69.5k]
  ------------------
 1408|  5.42k|        separator = 0; // specially handled
 1409|  74.9k|    struct bstr str = param;
 1410|  74.9k|    int n = *len;
 1411|   174k|    while (str.len) {
  ------------------
  |  Branch (1411:12): [True: 99.2k, False: 74.9k]
  ------------------
 1412|  99.2k|        get_nextsep(&str, separator, 0);
 1413|  99.2k|        str = bstr_cut(str, 1);
 1414|  99.2k|        n++;
 1415|  99.2k|    }
 1416|  74.9k|    if (n == 0 && op != OP_NONE)
  ------------------
  |  | 1323|    479|#define OP_NONE 0
  ------------------
  |  Branch (1416:9): [True: 479, False: 74.5k]
  |  Branch (1416:19): [True: 6, False: 473]
  ------------------
 1417|      6|        return NULL;
 1418|       |
 1419|  74.9k|    char **list = talloc_array(NULL, char *, n + 2);
  ------------------
  |  |   29|  74.9k|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|  74.9k|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  74.9k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1420|  74.9k|    str = bstrdup(NULL, param);
 1421|  74.9k|    char *ptr = str.start;
 1422|  74.9k|    n = 0;
 1423|       |
 1424|  98.6k|    while (1) {
  ------------------
  |  Branch (1424:12): [True: 98.6k, Folded]
  ------------------
 1425|  98.6k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1426|  98.6k|        if (n >= 100)
  ------------------
  |  Branch (1426:13): [True: 54, False: 98.6k]
  ------------------
 1427|     54|            break;
 1428|  98.6k|#endif
 1429|  98.6k|        struct bstr el = get_nextsep(&str, separator, 1);
 1430|  98.6k|        list[n] = bstrdup0(NULL, el);
 1431|  98.6k|        n++;
 1432|  98.6k|        if (!str.len)
  ------------------
  |  Branch (1432:13): [True: 74.9k, False: 23.7k]
  ------------------
 1433|  74.9k|            break;
 1434|  23.7k|        str = bstr_cut(str, 1);
 1435|  23.7k|    }
 1436|  74.9k|    list[n] = NULL;
 1437|  74.9k|    *len = n;
 1438|  74.9k|    talloc_free(ptr);
  ------------------
  |  |   47|  74.9k|#define talloc_free                     ta_free
  ------------------
 1439|  74.9k|    return list;
 1440|  74.9k|}
m_option.c:get_nextsep:
 1382|   197k|{
 1383|   197k|    struct bstr str = *ptr;
 1384|   197k|    struct bstr orig = str;
 1385|   198k|    for (;;) {
 1386|   198k|        int idx = sep ? bstrchr(str, sep) : -1;
  ------------------
  |  Branch (1386:19): [True: 187k, False: 10.8k]
  ------------------
 1387|   198k|        if (idx > 0 && str.start[idx - 1] == '\\') {
  ------------------
  |  Branch (1387:13): [True: 26.6k, False: 171k]
  |  Branch (1387:24): [True: 537, False: 26.0k]
  ------------------
 1388|    537|            if (modify) {
  ------------------
  |  Branch (1388:17): [True: 268, False: 269]
  ------------------
 1389|    268|                memmove(str.start + idx - 1, str.start + idx, str.len - idx);
 1390|    268|                str.len--;
 1391|    268|                str = bstr_cut(str, idx);
 1392|    268|            } else
 1393|    269|                str = bstr_cut(str, idx + 1);
 1394|   197k|        } else {
 1395|   197k|            str = bstr_cut(str, idx < 0 ? str.len : idx);
  ------------------
  |  Branch (1395:33): [True: 148k, False: 49.1k]
  ------------------
 1396|   197k|            break;
 1397|   197k|        }
 1398|   198k|    }
 1399|   197k|    *ptr = str;
 1400|   197k|    return bstr_splice(orig, 0, str.start - orig.start);
 1401|   197k|}
m_option.c:str_list_add:
 1348|  5.53k|{
 1349|  5.53k|    char **lst = VAL(dst);
  ------------------
  |  | 1321|  5.53k|#define VAL(x) (*(char ***)(x))
  ------------------
 1350|       |
 1351|  5.53k|    int ln;
 1352|   143k|    for (ln = 0; lst && lst[ln]; ln++)
  ------------------
  |  Branch (1352:18): [True: 142k, False: 924]
  |  Branch (1352:25): [True: 137k, False: 4.60k]
  ------------------
 1353|   137k|        /**/;
 1354|       |
 1355|  5.53k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 1356|  5.53k|    if (ln >= 100) {
  ------------------
  |  Branch (1356:9): [True: 163, False: 5.36k]
  ------------------
 1357|    695|        while (n--)
  ------------------
  |  Branch (1357:16): [True: 532, False: 163]
  ------------------
 1358|    532|            talloc_free(add[n]);
  ------------------
  |  |   47|    532|#define talloc_free                     ta_free
  ------------------
 1359|    163|        talloc_free(add);
  ------------------
  |  |   47|    163|#define talloc_free                     ta_free
  ------------------
 1360|    163|        return 0;
 1361|    163|    }
 1362|  5.36k|#endif
 1363|       |
 1364|  5.36k|    lst = talloc_realloc(NULL, lst, char *, n + ln + 1);
  ------------------
  |  |   33|  5.36k|#define talloc_realloc                  ta_xrealloc
  |  |  ------------------
  |  |  |  |  144|  5.36k|    (type *)ta_xrealloc_size(ta_parent, ptr, ta_calc_array_size(sizeof(type), count))
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  5.36k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  5.36k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|  5.36k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|  5.36k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1365|       |
 1366|  5.36k|    if (pre) {
  ------------------
  |  Branch (1366:9): [True: 66, False: 5.30k]
  ------------------
 1367|     66|        memmove(&lst[n], lst, ln * sizeof(char *));
 1368|     66|        memcpy(lst, add, n * sizeof(char *));
 1369|     66|    } else
 1370|  5.30k|        memcpy(&lst[ln], add, n * sizeof(char *));
 1371|       |    // (re-)add NULL-termination
 1372|  5.36k|    lst[ln + n] = NULL;
 1373|       |
 1374|  5.36k|    talloc_free(add);
  ------------------
  |  |   47|  5.36k|#define talloc_free                     ta_free
  ------------------
 1375|       |
 1376|  5.36k|    VAL(dst) = lst;
  ------------------
  |  | 1321|  5.36k|#define VAL(x) (*(char ***)(x))
  ------------------
 1377|       |
 1378|  5.36k|    return 1;
 1379|  5.53k|}
m_option.c:print_str_list:
 1569|  1.33k|{
 1570|  1.33k|    char **lst = NULL;
 1571|  1.33k|    char *ret = talloc_strdup(NULL, "");
  ------------------
  |  |   50|  1.33k|#define talloc_strdup                   ta_xstrdup
  ------------------
 1572|  1.33k|    const char sep = opt->priv ? *(char *)opt->priv : OPTION_LIST_SEPARATOR;
  ------------------
  |  |  644|  2.38k|#define OPTION_LIST_SEPARATOR ','
  ------------------
  |  Branch (1572:22): [True: 290, False: 1.04k]
  ------------------
 1573|       |
 1574|  1.33k|    if (!(src && VAL(src)))
  ------------------
  |  | 1321|  1.33k|#define VAL(x) (*(char ***)(x))
  |  |  ------------------
  |  |  |  Branch (1321:16): [True: 732, False: 603]
  |  |  ------------------
  ------------------
  |  Branch (1574:11): [True: 1.33k, False: 0]
  ------------------
 1575|    603|        return ret;
 1576|    732|    lst = VAL(src);
  ------------------
  |  | 1321|    732|#define VAL(x) (*(char ***)(x))
  ------------------
 1577|       |
 1578|   147k|    for (int i = 0; lst[i]; i++) {
  ------------------
  |  Branch (1578:21): [True: 146k, False: 732]
  ------------------
 1579|   146k|        if (i > 0)
  ------------------
  |  Branch (1579:13): [True: 146k, False: 722]
  ------------------
 1580|   146k|            ret = talloc_strndup_append_buffer(ret, &sep, 1);
  ------------------
  |  |   60|   146k|#define talloc_strndup_append_buffer    ta_talloc_strndup_append_buffer
  ------------------
 1581|   146k|        ret = talloc_strdup_append_buffer(ret, lst[i]);
  ------------------
  |  |   58|   146k|#define talloc_strdup_append_buffer     ta_talloc_strdup_append_buffer
  ------------------
 1582|   146k|    }
 1583|    732|    return ret;
 1584|  1.33k|}
m_option.c:copy_str_list:
 1543|  3.23M|{
 1544|  3.23M|    int n;
 1545|  3.23M|    char **d, **s;
 1546|       |
 1547|  3.23M|    if (!(dst && src))
  ------------------
  |  Branch (1547:11): [True: 3.23M, False: 0]
  |  Branch (1547:18): [True: 3.23M, False: 0]
  ------------------
 1548|      0|        return;
 1549|  3.23M|    s = VAL(src);
  ------------------
  |  | 1321|  3.23M|#define VAL(x) (*(char ***)(x))
  ------------------
 1550|       |
 1551|  3.23M|    if (VAL(dst))
  ------------------
  |  | 1321|  3.23M|#define VAL(x) (*(char ***)(x))
  |  |  ------------------
  |  |  |  Branch (1321:16): [True: 105k, False: 3.12M]
  |  |  ------------------
  ------------------
 1552|   105k|        free_str_list(dst);
 1553|       |
 1554|  3.23M|    if (!s) {
  ------------------
  |  Branch (1554:9): [True: 2.21M, False: 1.01M]
  ------------------
 1555|  2.21M|        VAL(dst) = NULL;
  ------------------
  |  | 1321|  2.21M|#define VAL(x) (*(char ***)(x))
  ------------------
 1556|  2.21M|        return;
 1557|  2.21M|    }
 1558|       |
 1559|  13.6M|    for (n = 0; s[n] != NULL; n++)
  ------------------
  |  Branch (1559:17): [True: 12.6M, False: 1.01M]
  ------------------
 1560|  12.6M|        /* NOTHING */;
 1561|  1.01M|    d = talloc_array(NULL, char *, n + 1);
  ------------------
  |  |   29|  1.01M|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|  1.01M|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  1.01M|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1562|  14.6M|    for (; n >= 0; n--)
  ------------------
  |  Branch (1562:12): [True: 13.6M, False: 1.01M]
  ------------------
 1563|  13.6M|        d[n] = talloc_strdup(NULL, s[n]);
  ------------------
  |  |   50|  13.6M|#define talloc_strdup                   ta_xstrdup
  ------------------
 1564|       |
 1565|  1.01M|    VAL(dst) = d;
  ------------------
  |  | 1321|  1.01M|#define VAL(x) (*(char ***)(x))
  ------------------
 1566|  1.01M|}
m_option.c:free_str_list:
 1333|  3.39M|{
 1334|  3.39M|    char **d;
 1335|  3.39M|    int i;
 1336|       |
 1337|  3.39M|    if (!dst || !VAL(dst))
  ------------------
  |  | 1321|  3.39M|#define VAL(x) (*(char ***)(x))
  ------------------
  |  Branch (1337:9): [True: 0, False: 3.39M]
  |  Branch (1337:17): [True: 2.18M, False: 1.21M]
  ------------------
 1338|  2.18M|        return;
 1339|  1.21M|    d = VAL(dst);
  ------------------
  |  | 1321|  1.21M|#define VAL(x) (*(char ***)(x))
  ------------------
 1340|       |
 1341|  14.3M|    for (i = 0; d[i] != NULL; i++)
  ------------------
  |  Branch (1341:17): [True: 13.1M, False: 1.21M]
  ------------------
 1342|  13.1M|        talloc_free(d[i]);
  ------------------
  |  |   47|  13.1M|#define talloc_free                     ta_free
  ------------------
 1343|  1.21M|    talloc_free(d);
  ------------------
  |  |   47|  1.21M|#define talloc_free                     ta_free
  ------------------
 1344|  1.21M|    VAL(dst) = NULL;
  ------------------
  |  | 1321|  1.21M|#define VAL(x) (*(char ***)(x))
  ------------------
 1345|  1.21M|}
m_option.c:str_list_equal:
 1627|   103k|{
 1628|   103k|    char **la = VAL(a);
  ------------------
  |  | 1321|   103k|#define VAL(x) (*(char ***)(x))
  ------------------
 1629|   103k|    char **lb = VAL(b);
  ------------------
  |  | 1321|   103k|#define VAL(x) (*(char ***)(x))
  ------------------
 1630|       |
 1631|   103k|    bool a_empty = !la || !la[0];
  ------------------
  |  Branch (1631:20): [True: 43.3k, False: 59.7k]
  |  Branch (1631:27): [True: 618, False: 59.1k]
  ------------------
 1632|   103k|    bool b_empty = !lb || !lb[0];
  ------------------
  |  Branch (1632:20): [True: 25.7k, False: 77.4k]
  |  Branch (1632:27): [True: 548, False: 76.8k]
  ------------------
 1633|   103k|    if (a_empty || b_empty)
  ------------------
  |  Branch (1633:9): [True: 43.9k, False: 59.1k]
  |  Branch (1633:20): [True: 1.33k, False: 57.8k]
  ------------------
 1634|  45.3k|        return a_empty == b_empty;
 1635|       |
 1636|   313k|    for (int n = 0; la[n] || lb[n]; n++) {
  ------------------
  |  Branch (1636:21): [True: 300k, False: 12.3k]
  |  Branch (1636:30): [True: 5.97k, False: 6.41k]
  ------------------
 1637|   306k|        if (!la[n] || !lb[n])
  ------------------
  |  Branch (1637:13): [True: 5.97k, False: 300k]
  |  Branch (1637:23): [True: 295, False: 300k]
  ------------------
 1638|  6.27k|            return false;
 1639|   300k|        if (strcmp(la[n], lb[n]) != 0)
  ------------------
  |  Branch (1639:13): [True: 45.1k, False: 255k]
  ------------------
 1640|  45.1k|            return false;
 1641|   300k|    }
 1642|       |
 1643|  6.41k|    return true;
 1644|  57.8k|}
m_option.c:parse_keyvalue_list:
 1799|   168k|{
 1800|   168k|    char **lst = NULL;
 1801|   168k|    int num = 0;
 1802|   168k|    int r = 0;
 1803|   168k|    bool append = false;
 1804|   168k|    bool full_value = false;
 1805|       |
 1806|   168k|    if ((opt->flags & M_OPT_HAVE_HELP) && bstr_equals0(param, "help"))
  ------------------
  |  |  480|   168k|#define M_OPT_HAVE_HELP         (UINT64_C(1) << 59)
  ------------------
  |  Branch (1806:9): [True: 2.50k, False: 165k]
  |  Branch (1806:43): [True: 114, False: 2.38k]
  ------------------
 1807|    114|        param = bstr0("help=");
 1808|       |
 1809|   168k|    int op = 0;
 1810|   168k|    if (bstr_endswith0(name, "-del")) {
  ------------------
  |  Branch (1810:9): [True: 338, False: 168k]
  ------------------
 1811|    338|        op = OP_DEL;
  ------------------
  |  | 1327|    338|#define OP_DEL 4
  ------------------
 1812|   168k|    } else if (bstr_endswith0(name, "-remove")) {
  ------------------
  |  Branch (1812:16): [True: 136, False: 167k]
  ------------------
 1813|    136|        op = OP_REMOVE;
  ------------------
  |  | 1330|    136|#define OP_REMOVE 7
  ------------------
 1814|    136|    }
 1815|       |
 1816|   168k|    if (bstr_endswith0(name, "-add")) {
  ------------------
  |  Branch (1816:9): [True: 204, False: 168k]
  ------------------
 1817|    204|        append = true;
 1818|   168k|    } else if (bstr_endswith0(name, "-append")) {
  ------------------
  |  Branch (1818:16): [True: 159k, False: 8.66k]
  ------------------
 1819|   159k|        append = full_value = true;
 1820|   159k|    } else if (bstr_endswith0(name, "-clr")) {
  ------------------
  |  Branch (1820:16): [True: 218, False: 8.44k]
  ------------------
 1821|    218|        if (dst)
  ------------------
  |  Branch (1821:13): [True: 218, False: 0]
  ------------------
 1822|    218|            free_str_list(dst);
 1823|    218|        return 0;
 1824|  8.44k|    } else if (op == OP_DEL || op == OP_REMOVE) {
  ------------------
  |  | 1327|  16.8k|#define OP_DEL 4
  ------------------
                  } else if (op == OP_DEL || op == OP_REMOVE) {
  ------------------
  |  | 1330|  8.10k|#define OP_REMOVE 7
  ------------------
  |  Branch (1824:16): [True: 338, False: 8.10k]
  |  Branch (1824:32): [True: 136, False: 7.96k]
  ------------------
 1825|    474|        int n = 0;
 1826|    474|        char **res = separate_input_param(opt, param, &n, op);
 1827|    474|        if (!res)
  ------------------
  |  Branch (1827:13): [True: 6, False: 468]
  ------------------
 1828|      6|            return M_OPT_INVALID;
  ------------------
  |  |  535|      6|#define M_OPT_INVALID           -3
  ------------------
 1829|    468|        lst = dst ? VAL(dst) : NULL;
  ------------------
  |  | 1321|    468|#define VAL(x) (*(char ***)(x))
  ------------------
  |  Branch (1829:15): [True: 468, False: 0]
  ------------------
 1830|  2.24k|        for (int i = 0; i < n; i++) {
  ------------------
  |  Branch (1830:25): [True: 1.77k, False: 468]
  ------------------
 1831|  1.77k|            int index = dst ? keyvalue_list_find_key(lst, bstr0(res[i])) : -1;
  ------------------
  |  Branch (1831:25): [True: 1.77k, False: 0]
  ------------------
 1832|  1.77k|            if (index >= 0) {
  ------------------
  |  Branch (1832:17): [True: 488, False: 1.29k]
  ------------------
 1833|    488|                keyvalue_list_del_key(lst, index);
 1834|    488|                VAL(dst) = lst;
  ------------------
  |  | 1321|    488|#define VAL(x) (*(char ***)(x))
  ------------------
 1835|    488|            }
 1836|  1.77k|            talloc_free(res[i]);
  ------------------
  |  |   47|  1.77k|#define talloc_free                     ta_free
  ------------------
 1837|  1.77k|        }
 1838|    468|        talloc_free(res);
  ------------------
  |  |   47|    468|#define talloc_free                     ta_free
  ------------------
 1839|    468|        return 1;
 1840|    474|    }
 1841|       |
 1842|   167k|    if (append && dst) {
  ------------------
  |  Branch (1842:9): [True: 159k, False: 7.96k]
  |  Branch (1842:19): [True: 159k, False: 0]
  ------------------
 1843|   159k|        lst = VAL(dst);
  ------------------
  |  | 1321|   159k|#define VAL(x) (*(char ***)(x))
  ------------------
 1844|   688k|        for (int n = 0; lst && lst[n]; n++)
  ------------------
  |  Branch (1844:25): [True: 573k, False: 114k]
  |  Branch (1844:32): [True: 528k, False: 44.7k]
  ------------------
 1845|   528k|            num++;
 1846|   159k|    }
 1847|       |
 1848|   172k|    while (param.len) {
  ------------------
  |  Branch (1848:12): [True: 169k, False: 3.45k]
  ------------------
 1849|   169k|        bstr key, val;
 1850|   169k|        r = read_subparam(log, name, "=", &param, &key);
 1851|   169k|        if (r < 0)
  ------------------
  |  Branch (1851:13): [True: 525, False: 168k]
  ------------------
 1852|    525|            break;
 1853|   168k|        if (!bstr_eatstart0(&param, "=")) {
  ------------------
  |  Branch (1853:13): [True: 593, False: 168k]
  ------------------
 1854|    593|            mp_err(log, "Expected '=' and a value.\n");
  ------------------
  |  |   76|    593|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
 1855|    593|            r = M_OPT_INVALID;
  ------------------
  |  |  535|    593|#define M_OPT_INVALID           -3
  ------------------
 1856|    593|            break;
 1857|    593|        }
 1858|   168k|        if (full_value) {
  ------------------
  |  Branch (1858:13): [True: 159k, False: 8.56k]
  ------------------
 1859|   159k|            val = param;
 1860|   159k|            param.len = 0;
 1861|   159k|        } else {
 1862|  8.56k|            r = read_subparam(log, name, ",", &param, &val);
 1863|  8.56k|            if (r < 0)
  ------------------
  |  Branch (1863:17): [True: 69, False: 8.49k]
  ------------------
 1864|     69|                break;
 1865|  8.56k|        }
 1866|   167k|        if (dst) {
  ------------------
  |  Branch (1866:13): [True: 167k, False: 0]
  ------------------
 1867|   167k|            int index = keyvalue_list_find_key(lst, key);
 1868|   167k|            if (index >= 0) {
  ------------------
  |  Branch (1868:17): [True: 45.2k, False: 122k]
  ------------------
 1869|  45.2k|                keyvalue_list_del_key(lst, index);
 1870|  45.2k|                num -= 2;
 1871|  45.2k|            }
 1872|   167k|            MP_TARRAY_APPEND(NULL, lst, num, bstrto0(NULL, key));
  ------------------
  |  |  105|   167k|    do {                                            \
  |  |  106|   167k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|   167k|    do {                                            \
  |  |  |  |   97|   167k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|   167k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|   167k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|   167k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 118k, False: 49.3k]
  |  |  |  |  ------------------
  |  |  |  |   99|   167k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|   118k|    do {                                                        \
  |  |  |  |  |  |   89|   118k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|   118k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|   118k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|   118k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|   118k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|   118k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|   118k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 118k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|   167k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 167k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|   167k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|   167k|        (idxvar)++;                                 \
  |  |  109|   167k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 167k]
  |  |  ------------------
  ------------------
 1873|   167k|            MP_TARRAY_APPEND(NULL, lst, num, bstrto0(NULL, val));
  ------------------
  |  |  105|   167k|    do {                                            \
  |  |  106|   167k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|   167k|    do {                                            \
  |  |  |  |   97|   167k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|   167k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|   167k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|   167k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 1.37k, False: 166k]
  |  |  |  |  ------------------
  |  |  |  |   99|   167k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  1.37k|    do {                                                        \
  |  |  |  |  |  |   89|  1.37k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  1.37k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  1.37k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.37k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.37k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  1.37k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  1.37k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 1.37k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|   167k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 167k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|   167k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|   167k|        (idxvar)++;                                 \
  |  |  109|   167k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 167k]
  |  |  ------------------
  ------------------
 1874|   167k|            MP_TARRAY_APPEND(NULL, lst, num, NULL);
  ------------------
  |  |  105|   167k|    do {                                            \
  |  |  106|   167k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|   167k|    do {                                            \
  |  |  |  |   97|   167k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|   167k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|   167k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|   167k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 119k, False: 48.9k]
  |  |  |  |  ------------------
  |  |  |  |   99|   167k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|   119k|    do {                                                        \
  |  |  |  |  |  |   89|   119k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|   119k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|   119k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|   119k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|   119k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|   119k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|   119k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 119k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|   167k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 167k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|   167k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|   167k|        (idxvar)++;                                 \
  |  |  109|   167k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 167k]
  |  |  ------------------
  ------------------
 1875|   167k|            num -= 1;
 1876|   167k|        }
 1877|       |
 1878|   167k|        if (!bstr_eatstart0(&param, ",") && !bstr_eatstart0(&param, ":"))
  ------------------
  |  Branch (1878:13): [True: 163k, False: 4.70k]
  |  Branch (1878:45): [True: 163k, False: 252]
  ------------------
 1879|   163k|            break;
 1880|   167k|    }
 1881|       |
 1882|   167k|    if (param.len) {
  ------------------
  |  Branch (1882:9): [True: 670, False: 167k]
  ------------------
 1883|    670|        mp_err(log, "Unparsable garbage at end of option value: '%.*s'\n",
  ------------------
  |  |   76|  1.34k|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 670, False: 0]
  |  |  ------------------
  ------------------
 1884|    670|               BSTR_P(param));
 1885|    670|        r = M_OPT_INVALID;
  ------------------
  |  |  535|    670|#define M_OPT_INVALID           -3
  ------------------
 1886|    670|    }
 1887|       |
 1888|   167k|    if (dst) {
  ------------------
  |  Branch (1888:9): [True: 167k, False: 0]
  ------------------
 1889|   167k|        if (!append)
  ------------------
  |  Branch (1889:13): [True: 7.96k, False: 159k]
  ------------------
 1890|  7.96k|            free_str_list(dst);
 1891|   167k|        VAL(dst) = lst;
  ------------------
  |  | 1321|   167k|#define VAL(x) (*(char ***)(x))
  ------------------
 1892|   167k|        if (r < 0)
  ------------------
  |  Branch (1892:13): [True: 1.19k, False: 166k]
  ------------------
 1893|  1.19k|            free_str_list(dst);
 1894|   167k|    } else {
 1895|      0|        free_str_list(&lst);
 1896|      0|    }
 1897|   167k|    return r;
 1898|   168k|}
m_option.c:keyvalue_list_find_key:
 1776|   169k|{
 1777|   243k|    for (int n = 0; lst && lst[n] && lst[n + 1]; n += 2) {
  ------------------
  |  Branch (1777:21): [True: 124k, False: 118k]
  |  Branch (1777:28): [True: 119k, False: 5.02k]
  |  Branch (1777:38): [True: 119k, False: 0]
  ------------------
 1778|   119k|        if (bstr_equals0(str, lst[n]))
  ------------------
  |  Branch (1778:13): [True: 45.7k, False: 73.7k]
  ------------------
 1779|  45.7k|            return n / 2;
 1780|   119k|    }
 1781|   124k|    return -1;
 1782|   169k|}
m_option.c:keyvalue_list_del_key:
 1785|  45.7k|{
 1786|  45.7k|    int count = 0;
 1787|   578k|    for (int n = 0; lst && lst[n]; n++)
  ------------------
  |  Branch (1787:21): [True: 578k, False: 0]
  |  Branch (1787:28): [True: 532k, False: 45.7k]
  ------------------
 1788|   532k|        count++;
 1789|  45.7k|    mp_assert(index * 2 + 1 < count);
  ------------------
  |  |   41|  45.7k|#define mp_assert assert
  ------------------
  |  Branch (1789:5): [True: 45.7k, False: 0]
  ------------------
 1790|  45.7k|    count += 1; // terminating item
 1791|  45.7k|    talloc_free(lst[index * 2 + 0]);
  ------------------
  |  |   47|  45.7k|#define talloc_free                     ta_free
  ------------------
 1792|  45.7k|    talloc_free(lst[index * 2 + 1]);
  ------------------
  |  |   47|  45.7k|#define talloc_free                     ta_free
  ------------------
 1793|  45.7k|    MP_TARRAY_REMOVE_AT(lst, count, index * 2 + 1);
  ------------------
  |  |  143|  45.7k|    do {                                            \
  |  |  144|  45.7k|        size_t at_ = (at);                          \
  |  |  145|  45.7k|        assert(at_ < (idxvar));                     \
  |  |  146|  45.7k|        memmove((p) + at_, (p) + at_ + 1,           \
  |  |  147|  45.7k|                ((idxvar) - at_ - 1) * sizeof((p)[0])); \
  |  |  148|  45.7k|        (idxvar)--;                                 \
  |  |  149|  45.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (149:14): [Folded, False: 45.7k]
  |  |  ------------------
  ------------------
  |  Branch (1793:5): [True: 45.7k, False: 0]
  ------------------
 1794|  45.7k|    MP_TARRAY_REMOVE_AT(lst, count, index * 2 + 0);
  ------------------
  |  |  143|  45.7k|    do {                                            \
  |  |  144|  45.7k|        size_t at_ = (at);                          \
  |  |  145|  45.7k|        assert(at_ < (idxvar));                     \
  |  |  146|  45.7k|        memmove((p) + at_, (p) + at_ + 1,           \
  |  |  147|  45.7k|                ((idxvar) - at_ - 1) * sizeof((p)[0])); \
  |  |  148|  45.7k|        (idxvar)--;                                 \
  |  |  149|  45.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (149:14): [Folded, False: 45.7k]
  |  |  ------------------
  ------------------
  |  Branch (1794:5): [True: 45.7k, False: 0]
  ------------------
 1795|  45.7k|}
m_option.c:read_subparam:
 2081|   198k|{
 2082|   198k|    bstr p = *str;
 2083|   198k|    bstr subparam = {0};
 2084|       |
 2085|   198k|    if (bstr_eatstart0(&p, "\"")) {
  ------------------
  |  Branch (2085:9): [True: 413, False: 198k]
  ------------------
 2086|    413|        int optlen = bstrcspn(p, "\"");
 2087|    413|        subparam = bstr_splice(p, 0, optlen);
 2088|    413|        p = bstr_cut(p, optlen);
 2089|    413|        if (!bstr_startswith0(p, "\"")) {
  ------------------
  |  Branch (2089:13): [True: 208, False: 205]
  ------------------
 2090|    208|            mp_err(log, "Terminating '\"' missing for '%.*s'\n",
  ------------------
  |  |   76|    416|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 208, False: 0]
  |  |  ------------------
  ------------------
 2091|    208|                   BSTR_P(optname));
 2092|    208|            return M_OPT_INVALID;
  ------------------
  |  |  535|    208|#define M_OPT_INVALID           -3
  ------------------
 2093|    208|        }
 2094|    205|        p = bstr_cut(p, 1);
 2095|   198k|    } else if (bstr_eatstart0(&p, "[")) {
  ------------------
  |  Branch (2095:16): [True: 382, False: 197k]
  ------------------
 2096|    382|        bstr s = p;
 2097|    382|        int balance = 1;
 2098|  6.87k|        while (p.len && balance > 0) {
  ------------------
  |  Branch (2098:16): [True: 6.75k, False: 121]
  |  Branch (2098:25): [True: 6.49k, False: 261]
  ------------------
 2099|  6.49k|            if (p.start[0] == '[') {
  ------------------
  |  Branch (2099:17): [True: 2.57k, False: 3.92k]
  ------------------
 2100|  2.57k|                balance++;
 2101|  3.92k|            } else if (p.start[0] == ']') {
  ------------------
  |  Branch (2101:24): [True: 556, False: 3.36k]
  ------------------
 2102|    556|                balance--;
 2103|    556|            }
 2104|  6.49k|            p = bstr_cut(p, 1);
 2105|  6.49k|        }
 2106|    382|        if (balance != 0) {
  ------------------
  |  Branch (2106:13): [True: 105, False: 277]
  ------------------
 2107|    105|            mp_err(log, "Terminating ']' missing for '%.*s'\n",
  ------------------
  |  |   76|    210|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 105, False: 0]
  |  |  ------------------
  ------------------
 2108|    105|                   BSTR_P(optname));
 2109|    105|            return M_OPT_INVALID;
  ------------------
  |  |  535|    105|#define M_OPT_INVALID           -3
  ------------------
 2110|    105|        }
 2111|    277|        subparam = bstr_splice(s, 0, s.len - p.len - 1);
 2112|   197k|    } else if (bstr_eatstart0(&p, "%")) {
  ------------------
  |  Branch (2112:16): [True: 403, False: 197k]
  ------------------
 2113|    403|        int optlen = bstrtoll(p, &p, 0);
 2114|    403|        if (!bstr_startswith0(p, "%") || (optlen > p.len - 1)) {
  ------------------
  |  Branch (2114:13): [True: 177, False: 226]
  |  Branch (2114:42): [True: 137, False: 89]
  ------------------
 2115|    314|            mp_err(log, "Invalid length %d for '%.*s'\n",
  ------------------
  |  |   76|    628|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 314, False: 0]
  |  |  ------------------
  ------------------
 2116|    314|                   optlen, BSTR_P(optname));
 2117|    314|            return M_OPT_INVALID;
  ------------------
  |  |  535|    314|#define M_OPT_INVALID           -3
  ------------------
 2118|    314|        }
 2119|     89|        subparam = bstr_splice(p, 1, optlen + 1);
 2120|     89|        p = bstr_cut(p, optlen + 1);
 2121|   197k|    } else {
 2122|       |        // Skip until the next character that could possibly be a meta
 2123|       |        // character in option parsing.
 2124|   197k|        int optlen = bstrcspn(p, termset);
 2125|   197k|        subparam = bstr_splice(p, 0, optlen);
 2126|   197k|        p = bstr_cut(p, optlen);
 2127|   197k|    }
 2128|       |
 2129|   197k|    *str = p;
 2130|   197k|    *out_subparam = subparam;
 2131|   197k|    return 0;
 2132|   198k|}
m_option.c:print_keyvalue_list:
 1901|    518|{
 1902|    518|    char **lst = VAL(src);
  ------------------
  |  | 1321|    518|#define VAL(x) (*(char ***)(x))
  ------------------
 1903|    518|    char *ret = talloc_strdup(NULL, "");
  ------------------
  |  |   50|    518|#define talloc_strdup                   ta_xstrdup
  ------------------
 1904|    827|    for (int n = 0; lst && lst[n] && lst[n + 1]; n += 2) {
  ------------------
  |  Branch (1904:21): [True: 406, False: 421]
  |  Branch (1904:28): [True: 309, False: 97]
  |  Branch (1904:38): [True: 309, False: 0]
  ------------------
 1905|    309|        if (ret[0])
  ------------------
  |  Branch (1905:13): [True: 212, False: 97]
  ------------------
 1906|    212|            ret = talloc_strdup_append(ret, ",");
  ------------------
  |  |   57|    212|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 1907|    309|        ret = talloc_asprintf_append(ret, "%s=%s", lst[n], lst[n + 1]);
  ------------------
  |  |   63|    309|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 1908|    309|    }
 1909|    518|    return ret;
 1910|    518|}
m_option.c:parse_msglevels:
 1993|  3.60k|{
 1994|  3.60k|    if (bstr_equals0(param, "help")) {
  ------------------
  |  Branch (1994:9): [True: 66, False: 3.54k]
  ------------------
 1995|     66|        mp_info(log, "Syntax:\n\n   --msg-level=module1=level,module2=level,...\n\n"
  ------------------
  |  |   78|     66|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 1996|     66|                     "'module' is output prefix as shown with -v, or a prefix\n"
 1997|     66|                     "of it. level is one of:\n\n"
 1998|     66|                     "  fatal error warn info status v debug trace\n\n"
 1999|     66|                     "The level specifies the minimum log level a message\n"
 2000|     66|                     "must have to be printed.\n"
 2001|     66|                     "The special module name 'all' affects all modules.\n");
 2002|     66|        return M_OPT_EXIT;
  ------------------
  |  |  545|     66|#define M_OPT_EXIT              -6
  ------------------
 2003|     66|    }
 2004|       |
 2005|  3.54k|    char **dst_copy = NULL;
 2006|  3.54k|    int r = m_option_type_keyvalue_list.parse(log, opt, name, param, &dst_copy);
 2007|  3.54k|    if (r >= 0)
  ------------------
  |  Branch (2007:9): [True: 2.48k, False: 1.05k]
  ------------------
 2008|  2.48k|        r = check_msg_levels(log, dst_copy);
 2009|       |
 2010|  3.54k|    if (r >= 0)
  ------------------
  |  Branch (2010:9): [True: 1.78k, False: 1.75k]
  ------------------
 2011|  1.78k|        m_option_type_keyvalue_list.copy(opt, dst, &dst_copy);
 2012|  3.54k|    m_option_type_keyvalue_list.free(&dst_copy);
 2013|  3.54k|    return r;
 2014|  3.60k|}
m_option.c:check_msg_levels:
 1980|  2.48k|{
 1981|  4.14k|    for (int n = 0; list && list[n * 2 + 0]; n++) {
  ------------------
  |  Branch (1981:21): [True: 3.94k, False: 196]
  |  Branch (1981:29): [True: 2.35k, False: 1.59k]
  ------------------
 1982|  2.35k|        char *level = list[n * 2 + 1];
 1983|  2.35k|        if (mp_msg_find_level(level) < 0 && strcmp(level, "no") != 0) {
  ------------------
  |  Branch (1983:13): [True: 1.82k, False: 533]
  |  Branch (1983:45): [True: 702, False: 1.12k]
  ------------------
 1984|    702|            mp_err(log, "Invalid message level '%s'\n", level);
  ------------------
  |  |   76|    702|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
 1985|    702|            return M_OPT_INVALID;
  ------------------
  |  |  535|    702|#define M_OPT_INVALID           -3
  ------------------
 1986|    702|        }
 1987|  2.35k|    }
 1988|  1.78k|    return 1;
 1989|  2.48k|}
m_option.c:parse_print:
 2044|  4.42k|{
 2045|  4.42k|    ((m_opt_print_fn) opt->priv)(log);
 2046|  4.42k|    return M_OPT_EXIT;
  ------------------
  |  |  545|  4.42k|#define M_OPT_EXIT              -6
  ------------------
 2047|  4.42k|}
m_option.c:parse_dummy_flag:
 2057|  7.59k|{
 2058|  7.59k|    if (param.len) {
  ------------------
  |  Branch (2058:9): [True: 13, False: 7.57k]
  ------------------
 2059|     13|        mp_err(log, "Invalid parameter for %.*s flag: %.*s\n",
  ------------------
  |  |   76|     52|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 13, False: 0]
  |  |  |  Branch (76:55): [True: 13, False: 0]
  |  |  ------------------
  ------------------
 2060|     13|               BSTR_P(name), BSTR_P(param));
 2061|     13|        return M_OPT_DISALLOW_PARAM;
  ------------------
  |  |  542|     13|#define M_OPT_DISALLOW_PARAM    -5
  ------------------
 2062|     13|    }
 2063|  7.57k|    return 0;
 2064|  7.59k|}
m_option.c:parse_color:
 2184|    935|{
 2185|    935|    if (param.len == 0)
  ------------------
  |  Branch (2185:9): [True: 3, False: 932]
  ------------------
 2186|      3|        return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      3|#define M_OPT_MISSING_PARAM     -2
  ------------------
 2187|       |
 2188|    935|    bool is_help = bstr_equals0(param, "help");
 2189|    932|    if (is_help)
  ------------------
  |  Branch (2189:9): [True: 1, False: 931]
  ------------------
 2190|      1|        goto exit;
 2191|       |
 2192|    931|    bstr val = param;
 2193|    931|    struct m_color color = {0};
 2194|       |
 2195|    931|    if (bstr_eatstart0(&val, "#")) {
  ------------------
  |  Branch (2195:9): [True: 180, False: 751]
  ------------------
 2196|       |        // #[AA]RRGGBB
 2197|    180|        if (val.len != 6 && val.len != 8)
  ------------------
  |  Branch (2197:13): [True: 104, False: 76]
  |  Branch (2197:29): [True: 6, False: 98]
  ------------------
 2198|      6|            goto exit;
 2199|    180|        bool has_alpha = val.len == 8;
 2200|    174|        uint32_t c = bstrtoll(val, &val, 16);
 2201|    174|        if (val.len)
  ------------------
  |  Branch (2201:13): [True: 2, False: 172]
  ------------------
 2202|      2|            goto exit;
 2203|    172|        color = (struct m_color) {
 2204|    172|            (c >> 16) & 0xFF,
 2205|    172|            (c >> 8) & 0xFF,
 2206|    172|            c & 0xFF,
 2207|    172|            has_alpha ? (c >> 24) & 0xFF : 0xFF,
  ------------------
  |  Branch (2207:13): [True: 97, False: 75]
  ------------------
 2208|    172|        };
 2209|    751|    } else {
 2210|    751|        bstr comp_str[5];
 2211|    751|        int num = split_char(param, '/', 5, comp_str);
 2212|    751|        if (num < 1 || num > 4)
  ------------------
  |  Branch (2212:13): [True: 0, False: 751]
  |  Branch (2212:24): [True: 6, False: 745]
  ------------------
 2213|      6|            goto exit;
 2214|    745|        double comp[4] = {0, 0, 0, 1};
 2215|  2.31k|        for (int n = 0; n < num; n++) {
  ------------------
  |  Branch (2215:25): [True: 1.59k, False: 714]
  ------------------
 2216|  1.59k|            bstr rest;
 2217|  1.59k|            double d = bstrtod(comp_str[n], &rest);
 2218|  1.59k|            if (rest.len || !comp_str[n].len || d < 0 || d > 1 || !isfinite(d))
  ------------------
  |  Branch (2218:17): [True: 22, False: 1.57k]
  |  Branch (2218:29): [True: 7, False: 1.57k]
  |  Branch (2218:49): [True: 1, False: 1.56k]
  |  Branch (2218:58): [True: 1, False: 1.56k]
  |  Branch (2218:67): [True: 0, False: 1.56k]
  ------------------
 2219|     31|                goto exit;
 2220|  1.56k|            comp[n] = d;
 2221|  1.56k|        }
 2222|    714|        if (num == 2)
  ------------------
  |  Branch (2222:13): [True: 320, False: 394]
  ------------------
 2223|    320|            comp[3] = comp[1];
 2224|    714|        if (num < 3)
  ------------------
  |  Branch (2224:13): [True: 451, False: 263]
  ------------------
 2225|    451|            comp[2] = comp[1] = comp[0];
 2226|    714|        color = (struct m_color) { comp[0] * 0xFF, comp[1] * 0xFF,
 2227|    714|                                   comp[2] * 0xFF, comp[3] * 0xFF };
 2228|    714|    }
 2229|       |
 2230|    886|    if (dst)
  ------------------
  |  Branch (2230:9): [True: 886, False: 0]
  ------------------
 2231|    886|        *((struct m_color *)dst) = color;
 2232|       |
 2233|    886|    return 1;
 2234|       |
 2235|     46|exit:
 2236|     46|    if (!is_help) {
  ------------------
  |  Branch (2236:9): [True: 45, False: 1]
  ------------------
 2237|     45|        mp_err(log, "Option %.*s: invalid color: '%.*s'\n",
  ------------------
  |  |   76|    180|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 45, False: 0]
  |  |  |  Branch (76:55): [True: 45, False: 0]
  |  |  ------------------
  ------------------
 2238|     45|               BSTR_P(name), BSTR_P(param));
 2239|     45|    }
 2240|     46|    mp_info(log, "Valid colors must be in the form #RRGGBB or #AARRGGBB (in hex)\n"
  ------------------
  |  |   78|     46|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2241|     46|            "or in the form 'r/g/b/a', where each component is a value in the\n"
 2242|     46|            "range 0.0-1.0. (Also allowed: 'gray', 'gray/a', 'r/g/b').\n");
 2243|     46|    return is_help ? M_OPT_EXIT : M_OPT_INVALID;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
                  return is_help ? M_OPT_EXIT : M_OPT_INVALID;
  ------------------
  |  |  535|     45|#define M_OPT_INVALID           -3
  ------------------
  |  Branch (2243:12): [True: 1, False: 45]
  ------------------
 2244|    931|}
m_option.c:split_char:
 2164|    751|{
 2165|    751|    if (max < 1)
  ------------------
  |  Branch (2165:9): [True: 0, False: 751]
  ------------------
 2166|      0|        return 0;
 2167|       |
 2168|    751|    int count = 0;
 2169|  1.64k|    while (1) {
  ------------------
  |  Branch (2169:12): [True: 1.64k, Folded]
  ------------------
 2170|  1.64k|        int next = bstrchr(str, split);
 2171|  1.64k|        if (next >= 0 && max - count > 1) {
  ------------------
  |  Branch (2171:13): [True: 900, False: 748]
  |  Branch (2171:26): [True: 897, False: 3]
  ------------------
 2172|    897|            out_arr[count++] = bstr_splice(str, 0, next);
 2173|    897|            str = bstr_cut(str, next + 1);
 2174|    897|        } else {
 2175|    751|            out_arr[count++] = str;
 2176|    751|            break;
 2177|    751|        }
 2178|  1.64k|    }
 2179|    751|    return count;
 2180|    751|}
m_option.c:print_color:
 2247|    462|{
 2248|    462|    const struct m_color *c = val;
 2249|    462|    return talloc_asprintf(NULL, "#%02X%02X%02X%02X", c->a, c->r, c->g, c->b);
  ------------------
  |  |   52|    462|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|    462|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 2250|    462|}
m_option.c:color_equal:
 2253|  1.42k|{
 2254|  1.42k|    struct m_color *ca = a;
 2255|  1.42k|    struct m_color *cb = b;
 2256|  1.42k|    return ca->a == cb->a && ca->r == cb->r && ca->g == cb->g && ca->b == cb->b;
  ------------------
  |  Branch (2256:12): [True: 1.17k, False: 247]
  |  Branch (2256:30): [True: 841, False: 334]
  |  Branch (2256:48): [True: 711, False: 130]
  |  Branch (2256:66): [True: 635, False: 76]
  ------------------
 2257|  1.42k|}
m_option.c:parse_geometry:
 2434|  1.13k|{
 2435|  1.13k|    bool is_help = bstr_equals0(param, "help");
 2436|  1.13k|    if (is_help)
  ------------------
  |  Branch (2436:9): [True: 1, False: 1.13k]
  ------------------
 2437|      1|        goto exit;
 2438|       |
 2439|  1.13k|    struct m_geometry gm;
 2440|  1.13k|    if (!parse_geometry_str(&gm, param))
  ------------------
  |  Branch (2440:9): [True: 38, False: 1.09k]
  ------------------
 2441|     38|        goto exit;
 2442|       |
 2443|  1.09k|    if (dst)
  ------------------
  |  Branch (2443:9): [True: 1.09k, False: 0]
  ------------------
 2444|  1.09k|        *((struct m_geometry *)dst) = gm;
 2445|       |
 2446|  1.09k|    return 1;
 2447|       |
 2448|     39|exit:
 2449|     39|    if (!is_help) {
  ------------------
  |  Branch (2449:9): [True: 38, False: 1]
  ------------------
 2450|     38|        mp_err(log, "Option %.*s: invalid geometry: '%.*s'\n",
  ------------------
  |  |   76|    152|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 38, False: 0]
  |  |  |  Branch (76:55): [True: 38, False: 0]
  |  |  ------------------
  ------------------
 2451|     38|               BSTR_P(name), BSTR_P(param));
 2452|     38|    }
 2453|     39|    mp_info(log,
  ------------------
  |  |   78|     39|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2454|     39|         "Valid format: [W[%%][xH[%%]]][{+-}X[%%]{+-}Y[%%]][/WS] | [X[%%]:Y[%%]]\n");
 2455|     39|    return is_help ? M_OPT_EXIT : M_OPT_INVALID;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
                  return is_help ? M_OPT_EXIT : M_OPT_INVALID;
  ------------------
  |  |  535|     38|#define M_OPT_INVALID           -3
  ------------------
  |  Branch (2455:12): [True: 1, False: 38]
  ------------------
 2456|  1.13k|}
m_option.c:parse_geometry_str:
 2289|  4.16k|{
 2290|  4.16k|    *gm = (struct m_geometry) { .x = INT_MIN, .y = INT_MIN };
 2291|  4.16k|    if (s.len == 0)
  ------------------
  |  Branch (2291:9): [True: 740, False: 3.42k]
  ------------------
 2292|    740|        return true;
 2293|       |    // Approximate grammar:
 2294|       |    // [[W][xH]][{+-}X{+-}Y][/WS] | [X:Y]
 2295|       |    // (meaning: [optional] {one character of} one|alternative)
 2296|       |    // Every number can be followed by '%'
 2297|  3.42k|    int num;
 2298|  3.42k|    bool per;
 2299|       |
 2300|  3.42k|#define READ_NUM(F, F_PER) do {         \
 2301|  3.42k|    if (!eat_num_per(&s, &num, &per))   \
 2302|  3.42k|        goto error;                     \
 2303|  3.42k|    gm->F = num;                        \
 2304|  3.42k|    gm->F_PER = per;                    \
 2305|  3.42k|} while(0)
 2306|       |
 2307|  3.42k|#define READ_SIGN(F) do {               \
 2308|  3.42k|    if (bstr_eatstart0(&s, "+")) {      \
 2309|  3.42k|        gm->F = false;                  \
 2310|  3.42k|    } else if (bstr_eatstart0(&s, "-")) {\
 2311|  3.42k|        gm->F = true;                   \
 2312|  3.42k|    } else goto error;                  \
 2313|  3.42k|} while(0)
 2314|       |
 2315|  3.42k|    if (bstrchr(s, ':') < 0) {
  ------------------
  |  Branch (2315:9): [True: 2.77k, False: 653]
  ------------------
 2316|  2.77k|        gm->wh_valid = true;
 2317|  2.77k|        if (!bstr_startswith0(s, "+") && !bstr_startswith0(s, "-") &&
  ------------------
  |  Branch (2317:13): [True: 2.49k, False: 274]
  |  Branch (2317:42): [True: 1.79k, False: 698]
  ------------------
 2318|  1.79k|            !bstr_startswith0(s, "/"))
  ------------------
  |  Branch (2318:13): [True: 1.45k, False: 346]
  ------------------
 2319|  1.45k|        {
 2320|  1.45k|            if (!bstr_startswith0(s, "x"))
  ------------------
  |  Branch (2320:17): [True: 846, False: 607]
  ------------------
 2321|    846|                READ_NUM(w, w_per);
  ------------------
  |  | 2300|    846|#define READ_NUM(F, F_PER) do {         \
  |  | 2301|    846|    if (!eat_num_per(&s, &num, &per))   \
  |  |  ------------------
  |  |  |  Branch (2301:9): [True: 38, False: 808]
  |  |  ------------------
  |  | 2302|    846|        goto error;                     \
  |  | 2303|    846|    gm->F = num;                        \
  |  | 2304|    808|    gm->F_PER = per;                    \
  |  | 2305|    808|} while(0)
  |  |  ------------------
  |  |  |  Branch (2305:9): [Folded, False: 808]
  |  |  ------------------
  ------------------
 2322|  1.41k|            if (bstr_eatstart0(&s, "x"))
  ------------------
  |  Branch (2322:17): [True: 614, False: 801]
  ------------------
 2323|    614|                READ_NUM(h, h_per);
  ------------------
  |  | 2300|    614|#define READ_NUM(F, F_PER) do {         \
  |  | 2301|    614|    if (!eat_num_per(&s, &num, &per))   \
  |  |  ------------------
  |  |  |  Branch (2301:9): [True: 38, False: 576]
  |  |  ------------------
  |  | 2302|    614|        goto error;                     \
  |  | 2303|    614|    gm->F = num;                        \
  |  | 2304|    576|    gm->F_PER = per;                    \
  |  | 2305|    576|} while(0)
  |  |  ------------------
  |  |  |  Branch (2305:9): [Folded, False: 576]
  |  |  ------------------
  ------------------
 2324|  1.41k|        }
 2325|  2.69k|        if (s.len > 0 && !bstr_startswith0(s, "/")) {
  ------------------
  |  Branch (2325:13): [True: 1.39k, False: 1.29k]
  |  Branch (2325:26): [True: 1.05k, False: 346]
  ------------------
 2326|  1.05k|            gm->xy_valid = true;
 2327|  1.05k|            READ_SIGN(x_sign);
  ------------------
  |  | 2307|  1.05k|#define READ_SIGN(F) do {               \
  |  | 2308|  1.05k|    if (bstr_eatstart0(&s, "+")) {      \
  |  |  ------------------
  |  |  |  Branch (2308:9): [True: 275, False: 778]
  |  |  ------------------
  |  | 2309|    275|        gm->F = false;                  \
  |  | 2310|    778|    } else if (bstr_eatstart0(&s, "-")) {\
  |  |  ------------------
  |  |  |  Branch (2310:16): [True: 703, False: 75]
  |  |  ------------------
  |  | 2311|    703|        gm->F = true;                   \
  |  | 2312|    703|    } else goto error;                  \
  |  | 2313|  1.05k|} while(0)
  |  |  ------------------
  |  |  |  Branch (2313:9): [Folded, False: 978]
  |  |  ------------------
  ------------------
 2328|    978|            READ_NUM(x, x_per);
  ------------------
  |  | 2300|    978|#define READ_NUM(F, F_PER) do {         \
  |  | 2301|    978|    if (!eat_num_per(&s, &num, &per))   \
  |  |  ------------------
  |  |  |  Branch (2301:9): [True: 66, False: 912]
  |  |  ------------------
  |  | 2302|    978|        goto error;                     \
  |  | 2303|    978|    gm->F = num;                        \
  |  | 2304|    912|    gm->F_PER = per;                    \
  |  | 2305|    912|} while(0)
  |  |  ------------------
  |  |  |  Branch (2305:9): [Folded, False: 912]
  |  |  ------------------
  ------------------
 2329|    912|            READ_SIGN(y_sign);
  ------------------
  |  | 2307|    912|#define READ_SIGN(F) do {               \
  |  | 2308|    912|    if (bstr_eatstart0(&s, "+")) {      \
  |  |  ------------------
  |  |  |  Branch (2308:9): [True: 345, False: 567]
  |  |  ------------------
  |  | 2309|    345|        gm->F = false;                  \
  |  | 2310|    567|    } else if (bstr_eatstart0(&s, "-")) {\
  |  |  ------------------
  |  |  |  Branch (2310:16): [True: 410, False: 157]
  |  |  ------------------
  |  | 2311|    410|        gm->F = true;                   \
  |  | 2312|    410|    } else goto error;                  \
  |  | 2313|    912|} while(0)
  |  |  ------------------
  |  |  |  Branch (2313:9): [Folded, False: 755]
  |  |  ------------------
  ------------------
 2330|    755|            READ_NUM(y, y_per);
  ------------------
  |  | 2300|    755|#define READ_NUM(F, F_PER) do {         \
  |  | 2301|    755|    if (!eat_num_per(&s, &num, &per))   \
  |  |  ------------------
  |  |  |  Branch (2301:9): [True: 9, False: 746]
  |  |  ------------------
  |  | 2302|    755|        goto error;                     \
  |  | 2303|    755|    gm->F = num;                        \
  |  | 2304|    746|    gm->F_PER = per;                    \
  |  | 2305|    746|} while(0)
  |  |  ------------------
  |  |  |  Branch (2305:9): [Folded, False: 746]
  |  |  ------------------
  ------------------
 2331|    755|        }
 2332|  2.38k|        if (bstr_eatstart0(&s, "/")) {
  ------------------
  |  Branch (2332:13): [True: 349, False: 2.03k]
  ------------------
 2333|    349|            bstr rest;
 2334|    349|            long long v = bstrtoll(s, &rest, 10);
 2335|    349|            if (s.len == rest.len || v < 1 || v > INT_MAX)
  ------------------
  |  Branch (2335:17): [True: 1, False: 348]
  |  Branch (2335:38): [True: 76, False: 272]
  |  Branch (2335:47): [True: 35, False: 237]
  ------------------
 2336|    112|                goto error;
 2337|    237|            s = rest;
 2338|    237|            gm->ws = v;
 2339|    237|        }
 2340|  2.38k|    } else {
 2341|    653|        gm->xy_valid = true;
 2342|    653|        READ_NUM(x, x_per);
  ------------------
  |  | 2300|    653|#define READ_NUM(F, F_PER) do {         \
  |  | 2301|    653|    if (!eat_num_per(&s, &num, &per))   \
  |  |  ------------------
  |  |  |  Branch (2301:9): [True: 64, False: 589]
  |  |  ------------------
  |  | 2302|    653|        goto error;                     \
  |  | 2303|    653|    gm->F = num;                        \
  |  | 2304|    589|    gm->F_PER = per;                    \
  |  | 2305|    589|} while(0)
  |  |  ------------------
  |  |  |  Branch (2305:9): [Folded, False: 589]
  |  |  ------------------
  ------------------
 2343|    589|        if (!bstr_eatstart0(&s, ":"))
  ------------------
  |  Branch (2343:13): [True: 69, False: 520]
  ------------------
 2344|     69|            goto error;
 2345|    520|        READ_NUM(y, y_per);
  ------------------
  |  | 2300|    520|#define READ_NUM(F, F_PER) do {         \
  |  | 2301|    520|    if (!eat_num_per(&s, &num, &per))   \
  |  |  ------------------
  |  |  |  Branch (2301:9): [True: 116, False: 404]
  |  |  ------------------
  |  | 2302|    520|        goto error;                     \
  |  | 2303|    520|    gm->F = num;                        \
  |  | 2304|    404|    gm->F_PER = per;                    \
  |  | 2305|    404|} while(0)
  |  |  ------------------
  |  |  |  Branch (2305:9): [Folded, False: 404]
  |  |  ------------------
  ------------------
 2346|    520|    }
 2347|       |
 2348|  2.68k|    return s.len == 0;
 2349|       |
 2350|    744|error:
 2351|       |    return false;
 2352|  3.42k|}
m_option.c:eat_num_per:
 2273|  4.36k|{
 2274|  4.36k|    bstr rest;
 2275|  4.36k|    long long v = bstrtoll(*s, &rest, 10);
 2276|  4.36k|    if (s->len == rest.len || v < INT_MIN || v > INT_MAX)
  ------------------
  |  Branch (2276:9): [True: 131, False: 4.23k]
  |  Branch (2276:31): [True: 187, False: 4.04k]
  |  Branch (2276:46): [True: 13, False: 4.03k]
  ------------------
 2277|    331|        return false;
 2278|  4.03k|    *out_num = v;
 2279|  4.03k|    *out_per = false;
 2280|  4.03k|    *s = rest;
 2281|  4.03k|    if (bstr_eatstart0(&rest, "%") && v >= 0 && v <= 100) {
  ------------------
  |  Branch (2281:9): [True: 781, False: 3.25k]
  |  Branch (2281:39): [True: 633, False: 148]
  |  Branch (2281:49): [True: 488, False: 145]
  ------------------
 2282|    488|        *out_per = true;
 2283|    488|        *s = rest;
 2284|    488|    }
 2285|       |    return true;
 2286|  4.36k|}
m_option.c:print_geometry:
 2361|    179|{
 2362|    179|    const struct m_geometry *gm = val;
 2363|    179|    char *res = talloc_strdup(NULL, "");
  ------------------
  |  |   50|    179|#define talloc_strdup                   ta_xstrdup
  ------------------
 2364|    179|    if (gm->wh_valid || gm->xy_valid) {
  ------------------
  |  Branch (2364:9): [True: 0, False: 179]
  |  Branch (2364:25): [True: 0, False: 179]
  ------------------
 2365|      0|        if (gm->wh_valid) {
  ------------------
  |  Branch (2365:13): [True: 0, False: 0]
  ------------------
 2366|      0|            APPEND_PER(w, w_per);
  ------------------
  |  | 2358|      0|    res = talloc_asprintf_append(res, "%d%s", gm->F, gm->F_PER ? "%" : "")
  |  |  ------------------
  |  |  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  |  |  ------------------
  |  |  |  Branch (2358:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2367|      0|            res = talloc_asprintf_append(res, "x");
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 2368|      0|            APPEND_PER(h, h_per);
  ------------------
  |  | 2358|      0|    res = talloc_asprintf_append(res, "%d%s", gm->F, gm->F_PER ? "%" : "")
  |  |  ------------------
  |  |  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  |  |  ------------------
  |  |  |  Branch (2358:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2369|      0|            if (gm->xy_valid) {
  ------------------
  |  Branch (2369:17): [True: 0, False: 0]
  ------------------
 2370|      0|                res = talloc_asprintf_append(res, gm->x_sign ? "-" : "+");
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
  |  Branch (2370:51): [True: 0, False: 0]
  ------------------
 2371|      0|                APPEND_PER(x, x_per);
  ------------------
  |  | 2358|      0|    res = talloc_asprintf_append(res, "%d%s", gm->F, gm->F_PER ? "%" : "")
  |  |  ------------------
  |  |  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  |  |  ------------------
  |  |  |  Branch (2358:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2372|      0|                res = talloc_asprintf_append(res, gm->y_sign ? "-" : "+");
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
  |  Branch (2372:51): [True: 0, False: 0]
  ------------------
 2373|      0|                APPEND_PER(y, y_per);
  ------------------
  |  | 2358|      0|    res = talloc_asprintf_append(res, "%d%s", gm->F, gm->F_PER ? "%" : "")
  |  |  ------------------
  |  |  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  |  |  ------------------
  |  |  |  Branch (2358:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2374|      0|            }
 2375|      0|        } else {
 2376|      0|            APPEND_PER(x, x_per);
  ------------------
  |  | 2358|      0|    res = talloc_asprintf_append(res, "%d%s", gm->F, gm->F_PER ? "%" : "")
  |  |  ------------------
  |  |  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  |  |  ------------------
  |  |  |  Branch (2358:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2377|      0|            res = talloc_asprintf_append(res, ":");
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 2378|      0|            APPEND_PER(y, y_per);
  ------------------
  |  | 2358|      0|    res = talloc_asprintf_append(res, "%d%s", gm->F, gm->F_PER ? "%" : "")
  |  |  ------------------
  |  |  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  |  |  ------------------
  |  |  |  Branch (2358:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2379|      0|        }
 2380|      0|        if (gm->ws > 0)
  ------------------
  |  Branch (2380:13): [True: 0, False: 0]
  ------------------
 2381|      0|            res = talloc_asprintf_append(res, "/%d", gm->ws);
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 2382|      0|    }
 2383|    179|    return res;
 2384|    179|}
m_option.c:geometry_equal:
 2459|  3.18k|{
 2460|  3.18k|    struct m_geometry *ga = a;
 2461|  3.18k|    struct m_geometry *gb = b;
 2462|  3.18k|    return ga->x == gb->x && ga->y == gb->y && ga->w == gb->w && ga->h == gb->h &&
  ------------------
  |  Branch (2462:12): [True: 2.44k, False: 740]
  |  Branch (2462:30): [True: 2.21k, False: 230]
  |  Branch (2462:48): [True: 1.87k, False: 340]
  |  Branch (2462:66): [True: 1.65k, False: 217]
  ------------------
 2463|  1.65k|           ga->xy_valid == gb->xy_valid && ga->wh_valid == gb->wh_valid &&
  ------------------
  |  Branch (2463:12): [True: 1.65k, False: 6]
  |  Branch (2463:44): [True: 1.58k, False: 66]
  ------------------
 2464|  1.58k|           ga->w_per == gb->w_per && ga->h_per == gb->h_per &&
  ------------------
  |  Branch (2464:12): [True: 1.52k, False: 66]
  |  Branch (2464:38): [True: 1.45k, False: 66]
  ------------------
 2465|  1.45k|           ga->x_per == gb->x_per && ga->y_per == gb->y_per &&
  ------------------
  |  Branch (2465:12): [True: 1.34k, False: 115]
  |  Branch (2465:38): [True: 1.27k, False: 66]
  ------------------
 2466|  1.27k|           ga->x_sign == gb->x_sign && ga->y_sign == gb->y_sign &&
  ------------------
  |  Branch (2466:12): [True: 1.19k, False: 76]
  |  Branch (2466:40): [True: 1.13k, False: 66]
  ------------------
 2467|  1.13k|           ga->ws == gb->ws;
  ------------------
  |  Branch (2467:12): [True: 1.02k, False: 107]
  ------------------
 2468|  3.18k|}
m_option.c:parse_size_box:
 2481|  2.58k|{
 2482|  2.58k|    bool is_help = bstr_equals0(param, "help");
 2483|  2.58k|    if (is_help)
  ------------------
  |  Branch (2483:9): [True: 1, False: 2.58k]
  ------------------
 2484|      1|        goto exit;
 2485|       |
 2486|  2.58k|    struct m_geometry gm;
 2487|  2.58k|    if (!parse_geometry_str(&gm, param))
  ------------------
  |  Branch (2487:9): [True: 805, False: 1.77k]
  ------------------
 2488|    805|        goto exit;
 2489|       |
 2490|  1.77k|    if (gm.xy_valid)
  ------------------
  |  Branch (2490:9): [True: 55, False: 1.72k]
  ------------------
 2491|     55|        goto exit;
 2492|       |
 2493|  1.72k|    if (dst)
  ------------------
  |  Branch (2493:9): [True: 1.72k, False: 0]
  ------------------
 2494|  1.72k|        *((struct m_geometry *)dst) = gm;
 2495|       |
 2496|  1.72k|    return 1;
 2497|       |
 2498|    861|exit:
 2499|    861|    if (!is_help) {
  ------------------
  |  Branch (2499:9): [True: 860, False: 1]
  ------------------
 2500|    860|        mp_err(log, "Option %.*s: invalid size: '%.*s'\n",
  ------------------
  |  |   76|  3.44k|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 860, False: 0]
  |  |  |  Branch (76:55): [True: 860, False: 0]
  |  |  ------------------
  ------------------
 2501|    860|               BSTR_P(name), BSTR_P(param));
 2502|    860|    }
 2503|    861|    mp_info(log, "Valid format: W[%%][xH[%%]] or empty string\n");
  ------------------
  |  |   78|    861|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2504|    861|    return is_help ? M_OPT_EXIT : M_OPT_INVALID;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
                  return is_help ? M_OPT_EXIT : M_OPT_INVALID;
  ------------------
  |  |  535|    860|#define M_OPT_INVALID           -3
  ------------------
  |  Branch (2504:12): [True: 1, False: 860]
  ------------------
 2505|  1.77k|}
m_option.c:parse_rect:
 2536|    451|{
 2537|    451|    bool is_help = bstr_equals0(param, "help");
 2538|    451|    if (is_help)
  ------------------
  |  Branch (2538:9): [True: 1, False: 450]
  ------------------
 2539|      1|        goto exit;
 2540|       |
 2541|    450|    struct m_geometry gm;
 2542|    450|    if (!parse_geometry_str(&gm, param))
  ------------------
  |  Branch (2542:9): [True: 15, False: 435]
  ------------------
 2543|     15|        goto exit;
 2544|       |
 2545|    450|    bool invalid = gm.x_sign || gm.y_sign || gm.ws;
  ------------------
  |  Branch (2545:20): [True: 2, False: 433]
  |  Branch (2545:33): [True: 1, False: 432]
  |  Branch (2545:46): [True: 26, False: 406]
  ------------------
 2546|    435|    invalid |= gm.wh_valid && (gm.w < 0 || gm.h < 0);
  ------------------
  |  Branch (2546:16): [True: 303, False: 132]
  |  Branch (2546:32): [True: 0, False: 303]
  |  Branch (2546:44): [True: 33, False: 270]
  ------------------
 2547|    435|    invalid |= gm.wh_valid && !gm.xy_valid && gm.w <= 0 && gm.h <= 0;
  ------------------
  |  Branch (2547:16): [True: 303, False: 132]
  |  Branch (2547:31): [True: 291, False: 12]
  |  Branch (2547:47): [True: 185, False: 106]
  |  Branch (2547:60): [True: 62, False: 123]
  ------------------
 2548|       |
 2549|    435|    if (invalid)
  ------------------
  |  Branch (2549:9): [True: 65, False: 370]
  ------------------
 2550|     65|        goto exit;
 2551|       |
 2552|    370|    if (dst)
  ------------------
  |  Branch (2552:9): [True: 370, False: 0]
  ------------------
 2553|    370|        *((struct m_geometry *)dst) = gm;
 2554|       |
 2555|    370|    return 1;
 2556|       |
 2557|     81|exit:
 2558|     81|    if (!is_help) {
  ------------------
  |  Branch (2558:9): [True: 80, False: 1]
  ------------------
 2559|     80|        mp_err(log, "Option %.*s: invalid rect: '%.*s'\n",
  ------------------
  |  |   76|    320|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 80, False: 0]
  |  |  |  Branch (76:55): [True: 80, False: 0]
  |  |  ------------------
  ------------------
 2560|     80|               BSTR_P(name), BSTR_P(param));
 2561|     80|    }
 2562|     81|    mp_info(log, "Valid format: W[%%][xH[%%]][+x+y]\n");
  ------------------
  |  |   78|     81|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2563|     81|    return is_help ? M_OPT_EXIT : M_OPT_INVALID;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
                  return is_help ? M_OPT_EXIT : M_OPT_INVALID;
  ------------------
  |  |  535|     80|#define M_OPT_INVALID           -3
  ------------------
  |  Branch (2563:12): [True: 1, False: 80]
  ------------------
 2564|    435|}
m_option.c:parse_imgfmt:
 2579|  1.95k|{
 2580|  1.95k|    if (param.len == 0)
  ------------------
  |  Branch (2580:9): [True: 1, False: 1.94k]
  ------------------
 2581|      1|        return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      1|#define M_OPT_MISSING_PARAM     -2
  ------------------
 2582|       |
 2583|  1.94k|    if (!bstrcmp0(param, "help")) {
  ------------------
  |  Branch (2583:9): [True: 1, False: 1.94k]
  ------------------
 2584|      1|        mp_info(log, "Available formats:");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2585|      1|        char **list = mp_imgfmt_name_list();
 2586|    292|        for (int i = 0; list[i]; i++)
  ------------------
  |  Branch (2586:25): [True: 291, False: 1]
  ------------------
 2587|    291|            mp_info(log, " %s", list[i]);
  ------------------
  |  |   78|    291|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2588|      1|        mp_info(log, " no");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2589|      1|        mp_info(log, "\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2590|      1|        talloc_free(list);
  ------------------
  |  |   47|      1|#define talloc_free                     ta_free
  ------------------
 2591|      1|        return M_OPT_EXIT;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
 2592|      1|    }
 2593|       |
 2594|  1.94k|    unsigned int fmt = mp_imgfmt_from_name(param);
 2595|  1.94k|    if (!fmt && !bstr_equals0(param, "no")) {
  ------------------
  |  Branch (2595:9): [True: 1.03k, False: 914]
  |  Branch (2595:17): [True: 245, False: 789]
  ------------------
 2596|    245|        mp_err(log, "Option %.*s: unknown format name: '%.*s'\n",
  ------------------
  |  |   76|    980|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 245, False: 0]
  |  |  |  Branch (76:55): [True: 245, False: 0]
  |  |  ------------------
  ------------------
 2597|    245|               BSTR_P(name), BSTR_P(param));
 2598|    245|        return M_OPT_INVALID;
  ------------------
  |  |  535|    245|#define M_OPT_INVALID           -3
  ------------------
 2599|    245|    }
 2600|       |
 2601|  1.70k|    if (dst)
  ------------------
  |  Branch (2601:9): [True: 1.70k, False: 0]
  ------------------
 2602|  1.70k|        *((int *)dst) = fmt;
 2603|       |
 2604|  1.70k|    return 1;
 2605|  1.94k|}
m_option.c:print_imgfmt:
 2608|     98|{
 2609|     98|    int fmt = *(int *)val;
 2610|     98|    return talloc_strdup(NULL, fmt ? mp_imgfmt_to_name(fmt) : "no");
  ------------------
  |  |   50|     98|#define talloc_strdup                   ta_xstrdup
  ------------------
                  return talloc_strdup(NULL, fmt ? mp_imgfmt_to_name(fmt) : "no");
  ------------------
  |  |  333|      0|#define mp_imgfmt_to_name(fmt) mp_imgfmt_to_name_buf((char[16]){0}, 16, (fmt))
  ------------------
  |  Branch (2610:32): [True: 0, False: 98]
  ------------------
 2611|     98|}
m_option.c:parse_fourcc:
 2624|    102|{
 2625|    102|    if (param.len == 0)
  ------------------
  |  Branch (2625:9): [True: 1, False: 101]
  ------------------
 2626|      1|        return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      1|#define M_OPT_MISSING_PARAM     -2
  ------------------
 2627|       |
 2628|    101|    unsigned int value;
 2629|       |
 2630|    101|    if (param.len == 4) {
  ------------------
  |  Branch (2630:9): [True: 82, False: 19]
  ------------------
 2631|     82|        uint8_t *s = param.start;
 2632|     82|        value = s[0] | (s[1] << 8) | (s[2] << 16) | (s[3] << 24);
 2633|     82|    } else {
 2634|     19|        bstr rest;
 2635|     19|        value = bstrtoll(param, &rest, 16);
 2636|     19|        if (rest.len != 0) {
  ------------------
  |  Branch (2636:13): [True: 1, False: 18]
  ------------------
 2637|      1|            mp_err(log, "Option %.*s: invalid FourCC: '%.*s'\n",
  ------------------
  |  |   76|      4|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 1, False: 0]
  |  |  |  Branch (76:55): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 2638|      1|                   BSTR_P(name), BSTR_P(param));
 2639|      1|            return M_OPT_INVALID;
  ------------------
  |  |  535|      1|#define M_OPT_INVALID           -3
  ------------------
 2640|      1|        }
 2641|     19|    }
 2642|       |
 2643|    100|    if (dst)
  ------------------
  |  Branch (2643:9): [True: 100, False: 0]
  ------------------
 2644|    100|        *((unsigned int *)dst) = value;
 2645|       |
 2646|    100|    return 1;
 2647|    101|}
m_option.c:print_fourcc:
 2650|     46|{
 2651|     46|    unsigned int fourcc = *(unsigned int *)val;
 2652|     46|    return talloc_asprintf(NULL, "%08x", fourcc);
  ------------------
  |  |   52|     46|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     46|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 2653|     46|}
m_option.c:parse_afmt:
 2668|    467|{
 2669|    467|    if (param.len == 0)
  ------------------
  |  Branch (2669:9): [True: 1, False: 466]
  ------------------
 2670|      1|        return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      1|#define M_OPT_MISSING_PARAM     -2
  ------------------
 2671|       |
 2672|    466|    if (!bstrcmp0(param, "help")) {
  ------------------
  |  Branch (2672:9): [True: 1, False: 465]
  ------------------
 2673|      1|        mp_info(log, "Available formats:");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2674|     22|        for (int i = 1; i < AF_FORMAT_COUNT; i++)
  ------------------
  |  Branch (2674:25): [True: 21, False: 1]
  ------------------
 2675|     21|            mp_info(log, " %s", af_fmt_to_str(i));
  ------------------
  |  |   78|     21|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2676|      1|        mp_info(log, "\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2677|      1|        return M_OPT_EXIT;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
 2678|      1|    }
 2679|       |
 2680|    465|    int fmt = 0;
 2681|  10.2k|    for (int i = 1; i < AF_FORMAT_COUNT; i++) {
  ------------------
  |  Branch (2681:21): [True: 9.76k, False: 465]
  ------------------
 2682|  9.76k|        if (bstr_equals0(param, af_fmt_to_str(i)))
  ------------------
  |  Branch (2682:13): [True: 416, False: 9.34k]
  ------------------
 2683|    416|            fmt = i;
 2684|  9.76k|    }
 2685|    465|    if (!fmt) {
  ------------------
  |  Branch (2685:9): [True: 49, False: 416]
  ------------------
 2686|     49|        mp_err(log, "Option %.*s: unknown format name: '%.*s'\n",
  ------------------
  |  |   76|    196|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 49, False: 0]
  |  |  |  Branch (76:55): [True: 49, False: 0]
  |  |  ------------------
  ------------------
 2687|     49|               BSTR_P(name), BSTR_P(param));
 2688|     49|        return M_OPT_INVALID;
  ------------------
  |  |  535|     49|#define M_OPT_INVALID           -3
  ------------------
 2689|     49|    }
 2690|       |
 2691|    416|    if (dst)
  ------------------
  |  Branch (2691:9): [True: 416, False: 0]
  ------------------
 2692|    416|        *((int *)dst) = fmt;
 2693|       |
 2694|    416|    return 1;
 2695|    465|}
m_option.c:print_afmt:
 2698|     78|{
 2699|     78|    int fmt = *(int *)val;
 2700|     78|    return talloc_strdup(NULL, fmt ? af_fmt_to_str(fmt) : "no");
  ------------------
  |  |   50|     78|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (2700:32): [True: 0, False: 78]
  ------------------
 2701|     78|}
m_option.c:parse_channels:
 2716|  3.01k|{
 2717|  3.01k|    bool limited = opt->flags & M_OPT_CHANNELS_LIMITED;
  ------------------
  |  |  491|  3.01k|#define M_OPT_CHANNELS_LIMITED  (UINT64_C(1) << 56)
  ------------------
 2718|       |
 2719|  3.01k|    struct m_channels res = {0};
 2720|       |
 2721|  3.01k|    if (bstr_equals0(param, "help")) {
  ------------------
  |  Branch (2721:9): [True: 2, False: 3.01k]
  ------------------
 2722|      2|        mp_chmap_print_help(log);
 2723|      2|        if (!limited) {
  ------------------
  |  Branch (2723:13): [True: 1, False: 1]
  ------------------
 2724|      1|            mp_info(log, "\nOther values:\n"
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 2725|      1|                         "    auto-safe\n");
 2726|      1|        }
 2727|      2|        return M_OPT_EXIT;
  ------------------
  |  |  545|      2|#define M_OPT_EXIT              -6
  ------------------
 2728|      2|    }
 2729|       |
 2730|  3.01k|    bool auto_safe = bstr_equals0(param, "auto-safe");
 2731|  3.01k|    if (bstr_equals0(param, "auto") || bstr_equals0(param, "empty") || auto_safe) {
  ------------------
  |  Branch (2731:9): [True: 66, False: 2.94k]
  |  Branch (2731:40): [True: 66, False: 2.87k]
  |  Branch (2731:72): [True: 102, False: 2.77k]
  ------------------
 2732|    234|        if (limited) {
  ------------------
  |  Branch (2732:13): [True: 1, False: 233]
  ------------------
 2733|      1|            mp_err(log, "Disallowed parameter.\n");
  ------------------
  |  |   76|      1|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
 2734|      1|            return M_OPT_INVALID;
  ------------------
  |  |  535|      1|#define M_OPT_INVALID           -3
  ------------------
 2735|      1|        }
 2736|    233|        param.len = 0;
 2737|    233|        res.set = true;
 2738|    233|        res.auto_safe = auto_safe;
 2739|    233|    }
 2740|       |
 2741|  6.84k|    while (param.len) {
  ------------------
  |  Branch (2741:12): [True: 4.09k, False: 2.74k]
  ------------------
 2742|  4.09k|        bstr item;
 2743|  4.09k|        if (limited) {
  ------------------
  |  Branch (2743:13): [True: 1.72k, False: 2.36k]
  ------------------
 2744|  1.72k|            item = param;
 2745|  1.72k|            param.len = 0;
 2746|  2.36k|        } else {
 2747|  2.36k|            bstr_split_tok(param, ",", &item, &param);
 2748|  2.36k|        }
 2749|       |
 2750|  4.09k|        struct mp_chmap map = {0};
 2751|  4.09k|        if (!mp_chmap_from_str(&map, item) || !mp_chmap_is_valid(&map)) {
  ------------------
  |  Branch (2751:13): [True: 255, False: 3.83k]
  |  Branch (2751:47): [True: 6, False: 3.83k]
  ------------------
 2752|    261|            mp_err(log, "Invalid channel layout: %.*s\n", BSTR_P(item));
  ------------------
  |  |   76|    522|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 261, False: 0]
  |  |  ------------------
  ------------------
 2753|    261|            talloc_free(res.chmaps);
  ------------------
  |  |   47|    261|#define talloc_free                     ta_free
  ------------------
 2754|    261|            return M_OPT_INVALID;
  ------------------
  |  |  535|    261|#define M_OPT_INVALID           -3
  ------------------
 2755|    261|        }
 2756|       |
 2757|  3.83k|        MP_TARRAY_APPEND(NULL, res.chmaps, res.num_chmaps, map);
  ------------------
  |  |  105|  3.83k|    do {                                            \
  |  |  106|  3.83k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  3.83k|    do {                                            \
  |  |  |  |   97|  3.83k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  3.83k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  3.83k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  3.83k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 2.43k, False: 1.39k]
  |  |  |  |  ------------------
  |  |  |  |   99|  3.83k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  2.43k|    do {                                                        \
  |  |  |  |  |  |   89|  2.43k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  2.43k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  2.43k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  2.43k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  2.43k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  2.43k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  2.43k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 2.43k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  3.83k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 3.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  3.83k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  3.83k|        (idxvar)++;                                 \
  |  |  109|  3.83k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 3.83k]
  |  |  ------------------
  ------------------
 2758|  3.83k|        res.set = true;
 2759|  3.83k|    }
 2760|       |
 2761|  2.74k|    if (dst) {
  ------------------
  |  Branch (2761:9): [True: 2.74k, False: 0]
  ------------------
 2762|  2.74k|        opt->type->free(dst);
 2763|  2.74k|        *(struct m_channels *)dst = res;
 2764|  2.74k|    } else {
 2765|      0|        talloc_free(res.chmaps);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 2766|      0|    }
 2767|       |
 2768|  2.74k|    return 1;
 2769|  3.01k|}
m_option.c:print_channels:
 2772|    151|{
 2773|    151|    const struct m_channels *ch = val;
 2774|    151|    if (!ch->set)
  ------------------
  |  Branch (2774:9): [True: 50, False: 101]
  ------------------
 2775|     50|        return talloc_strdup(NULL, "");
  ------------------
  |  |   50|     50|#define talloc_strdup                   ta_xstrdup
  ------------------
 2776|    101|    if (ch->auto_safe)
  ------------------
  |  Branch (2776:9): [True: 46, False: 55]
  ------------------
 2777|     46|        return talloc_strdup(NULL, "auto-safe");
  ------------------
  |  |   50|     46|#define talloc_strdup                   ta_xstrdup
  ------------------
 2778|     55|    if (ch->num_chmaps > 0) {
  ------------------
  |  Branch (2778:9): [True: 55, False: 0]
  ------------------
 2779|     55|        char *res = talloc_strdup(NULL, "");
  ------------------
  |  |   50|     55|#define talloc_strdup                   ta_xstrdup
  ------------------
 2780|    110|        for (int n = 0; n < ch->num_chmaps; n++) {
  ------------------
  |  Branch (2780:25): [True: 55, False: 55]
  ------------------
 2781|     55|            if (n > 0)
  ------------------
  |  Branch (2781:17): [True: 0, False: 55]
  ------------------
 2782|      0|                res = talloc_strdup_append(res, ",");
  ------------------
  |  |   57|      0|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 2783|     55|            res = talloc_strdup_append(res, mp_chmap_to_str(&ch->chmaps[n]));
  ------------------
  |  |   57|     55|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
                          res = talloc_strdup_append(res, mp_chmap_to_str(&ch->chmaps[n]));
  ------------------
  |  |  149|     55|#define mp_chmap_to_str(m) mp_chmap_to_str_(m, MP_NUM_CHANNELS * 4)
  |  |  ------------------
  |  |  |  |  148|     55|#define mp_chmap_to_str_(m, sz) mp_chmap_to_str_buf((char[sz]){0}, sz, (m))
  |  |  ------------------
  ------------------
 2784|     55|        }
 2785|     55|        return res;
 2786|     55|    }
 2787|      0|    return talloc_strdup(NULL, "auto");
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
 2788|     55|}
m_option.c:copy_channels:
 2801|   169k|{
 2802|   169k|    if (!(dst && src))
  ------------------
  |  Branch (2802:11): [True: 169k, False: 0]
  |  Branch (2802:18): [True: 169k, False: 0]
  ------------------
 2803|      0|        return;
 2804|       |
 2805|   169k|    struct m_channels *ch = dst;
 2806|   169k|    free_channels(dst);
 2807|   169k|    *ch = *(struct m_channels *)src;
 2808|   169k|    ch->chmaps =
 2809|   169k|        talloc_memdup(NULL, ch->chmaps, sizeof(ch->chmaps[0]) * ch->num_chmaps);
  ------------------
  |  |   49|   169k|#define talloc_memdup                   ta_xmemdup
  |  |  ------------------
  |  |  |  |  157|   169k|#define ta_xmemdup(...)         ta_dbg_set_loc(ta_xmemdup(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|   169k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|   169k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|   169k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2810|   169k|}
m_option.c:free_channels:
 2791|   342k|{
 2792|   342k|    if (!src)
  ------------------
  |  Branch (2792:9): [True: 0, False: 342k]
  ------------------
 2793|      0|        return;
 2794|       |
 2795|   342k|    struct m_channels *ch = src;
 2796|   342k|    talloc_free(ch->chmaps);
  ------------------
  |  |   47|   342k|#define talloc_free                     ta_free
  ------------------
 2797|   342k|    *ch = (struct m_channels){0};
 2798|   342k|}
m_option.c:channels_equal:
 2813|  1.26k|{
 2814|  1.26k|    struct m_channels *ca = a;
 2815|  1.26k|    struct m_channels *cb = b;
 2816|       |
 2817|  1.26k|    if (ca->set         != cb->set ||
  ------------------
  |  Branch (2817:9): [True: 78, False: 1.19k]
  ------------------
 2818|  1.19k|        ca->auto_safe   != cb->auto_safe ||
  ------------------
  |  Branch (2818:9): [True: 165, False: 1.02k]
  ------------------
 2819|  1.02k|        ca->num_chmaps  != cb->num_chmaps)
  ------------------
  |  Branch (2819:9): [True: 73, False: 952]
  ------------------
 2820|    316|        return false;
 2821|       |
 2822|  1.70k|    for (int n = 0; n < ca->num_chmaps; n++) {
  ------------------
  |  Branch (2822:21): [True: 1.14k, False: 566]
  ------------------
 2823|  1.14k|        if (!mp_chmap_equals(&ca->chmaps[n], &cb->chmaps[n]))
  ------------------
  |  Branch (2823:13): [True: 386, False: 756]
  ------------------
 2824|    386|            return false;
 2825|  1.14k|    }
 2826|       |
 2827|    566|    return true;
 2828|    952|}
m_option.c:parse_time:
 2879|  1.29k|{
 2880|  1.29k|    if (param.len == 0)
  ------------------
  |  Branch (2880:9): [True: 1, False: 1.28k]
  ------------------
 2881|      1|        return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      1|#define M_OPT_MISSING_PARAM     -2
  ------------------
 2882|       |
 2883|  1.28k|    double time = MP_NOPTS_VALUE;
  ------------------
  |  |   39|  1.28k|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
 2884|  1.28k|    if (HAS_NOPTS(opt) && bstr_equals0(param, "no")) {
  ------------------
  |  | 2875|  2.57k|#define HAS_NOPTS(opt) ((opt)->flags & M_OPT_ALLOW_NO)
  |  |  ------------------
  |  |  |  |  488|  1.28k|#define M_OPT_ALLOW_NO          (UINT64_C(1) << 57)
  |  |  ------------------
  |  |  |  Branch (2875:24): [True: 329, False: 960]
  |  |  ------------------
  ------------------
  |  Branch (2884:27): [True: 66, False: 263]
  ------------------
 2885|       |        // nothing
 2886|  1.22k|    } else if (!parse_timestring(param, &time, 0)) {
  ------------------
  |  Branch (2886:16): [True: 9, False: 1.21k]
  ------------------
 2887|      9|        mp_err(log, "Option %.*s: invalid time: '%.*s'\n",
  ------------------
  |  |   76|     36|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 9, False: 0]
  |  |  |  Branch (76:55): [True: 9, False: 0]
  |  |  ------------------
  ------------------
 2888|      9|               BSTR_P(name), BSTR_P(param));
 2889|      9|        return M_OPT_INVALID;
  ------------------
  |  |  535|      9|#define M_OPT_INVALID           -3
  ------------------
 2890|      9|    }
 2891|       |
 2892|  1.28k|    if (dst)
  ------------------
  |  Branch (2892:9): [True: 1.28k, False: 0]
  ------------------
 2893|  1.28k|        *(double *)dst = time;
 2894|  1.28k|    return 1;
 2895|  1.28k|}
m_option.c:parse_timestring:
 2841|  2.24k|{
 2842|  2.24k|    int len;
 2843|  2.24k|    unsigned h, m;
 2844|  2.24k|    double s;
 2845|  2.24k|    *time = 0; /* ensure initialization for error cases */
 2846|  2.24k|    bool neg = bstr_eatstart0(&str, "-");
 2847|  2.24k|    if (!neg)
  ------------------
  |  Branch (2847:9): [True: 1.51k, False: 736]
  ------------------
 2848|  1.51k|        bstr_eatstart0(&str, "+");
 2849|  2.24k|    bool sci = bstr_find0(str, "e-") >= 0 || bstr_find0(str, "e+") >= 0;
  ------------------
  |  Branch (2849:16): [True: 110, False: 2.13k]
  |  Branch (2849:46): [True: 8, False: 2.12k]
  ------------------
 2850|       |    /* non-scientific notation timestamps shouldn't contain anymore +/- after this point */
 2851|  2.24k|    if (!sci && (bstrchr(str, '-') >= 0 || bstrchr(str, '+') >= 0))
  ------------------
  |  Branch (2851:9): [True: 2.12k, False: 118]
  |  Branch (2851:18): [True: 9, False: 2.11k]
  |  Branch (2851:44): [True: 3, False: 2.11k]
  ------------------
 2852|     12|        return 0;
 2853|  2.23k|    if (bstr_sscanf(str, "%u:%u:%lf%n", &h, &m, &s, &len) >= 3) {
  ------------------
  |  Branch (2853:9): [True: 108, False: 2.12k]
  ------------------
 2854|    108|        if (m >= 60 || s >= 60)
  ------------------
  |  Branch (2854:13): [True: 38, False: 70]
  |  Branch (2854:24): [True: 1, False: 69]
  ------------------
 2855|     39|            return 0; /* minutes or seconds are out of range */
 2856|     69|        *time = 3600.0 * h + 60 * m + s;
 2857|  2.12k|    } else if (bstr_sscanf(str, "%u:%lf%n", &m, &s, &len) >= 2) {
  ------------------
  |  Branch (2857:16): [True: 105, False: 2.02k]
  ------------------
 2858|    105|        if (s >= 60)
  ------------------
  |  Branch (2858:13): [True: 1, False: 104]
  ------------------
 2859|      1|            return 0; /* seconds are out of range */
 2860|    104|        *time = 60.0 * m + s;
 2861|  2.02k|    } else if (bstr_sscanf(str, "%lf%n", &s, &len) >= 1) {
  ------------------
  |  Branch (2861:16): [True: 1.92k, False: 96]
  ------------------
 2862|  1.92k|        *time = s;
 2863|  1.92k|    } else {
 2864|     96|        return 0;  /* unsupported time format */
 2865|     96|    }
 2866|  2.09k|    if (len < str.len && str.start[len] != endchar)
  ------------------
  |  Branch (2866:9): [True: 20, False: 2.07k]
  |  Branch (2866:26): [True: 20, False: 0]
  ------------------
 2867|     20|        return 0;  /* invalid extra characters at the end */
 2868|  2.07k|    if (!isfinite(*time))
  ------------------
  |  Branch (2868:9): [True: 1, False: 2.07k]
  ------------------
 2869|      1|        return 0;
 2870|  2.07k|    if (neg)
  ------------------
  |  Branch (2870:9): [True: 717, False: 1.36k]
  ------------------
 2871|    717|        *time = -*time;
 2872|  2.07k|    return len;
 2873|  2.07k|}
m_option.c:print_time:
 2898|     36|{
 2899|     36|    double pts = *(double *)val;
 2900|     36|    if (pts == MP_NOPTS_VALUE && HAS_NOPTS(opt))
  ------------------
  |  |   39|     72|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
                  if (pts == MP_NOPTS_VALUE && HAS_NOPTS(opt))
  ------------------
  |  | 2875|     18|#define HAS_NOPTS(opt) ((opt)->flags & M_OPT_ALLOW_NO)
  |  |  ------------------
  |  |  |  |  488|     18|#define M_OPT_ALLOW_NO          (UINT64_C(1) << 57)
  |  |  ------------------
  |  |  |  Branch (2875:24): [True: 18, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2900:9): [True: 18, False: 18]
  ------------------
 2901|     18|        return talloc_strdup(NULL, "no"); // symmetry with parsing
  ------------------
  |  |   50|     18|#define talloc_strdup                   ta_xstrdup
  ------------------
 2902|     18|    return talloc_asprintf(NULL, "%f", pts);
  ------------------
  |  |   52|     18|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     18|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 2903|     36|}
m_option.c:pretty_print_time:
 2906|    127|{
 2907|    127|    double pts = *(double *)val;
 2908|    127|    if (pts == MP_NOPTS_VALUE && HAS_NOPTS(opt))
  ------------------
  |  |   39|    254|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
                  if (pts == MP_NOPTS_VALUE && HAS_NOPTS(opt))
  ------------------
  |  | 2875|     77|#define HAS_NOPTS(opt) ((opt)->flags & M_OPT_ALLOW_NO)
  |  |  ------------------
  |  |  |  |  488|     77|#define M_OPT_ALLOW_NO          (UINT64_C(1) << 57)
  |  |  ------------------
  |  |  |  Branch (2875:24): [True: 77, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2908:9): [True: 77, False: 50]
  ------------------
 2909|     77|        return talloc_strdup(NULL, "no"); // symmetry with parsing
  ------------------
  |  |   50|     77|#define talloc_strdup                   ta_xstrdup
  ------------------
 2910|     50|    return mp_format_time(pts, false);
 2911|    127|}
m_option.c:parse_rel_time:
 2953|  1.45k|{
 2954|  1.45k|    struct m_rel_time t = {0};
 2955|       |
 2956|  1.45k|    if (param.len == 0)
  ------------------
  |  Branch (2956:9): [True: 1, False: 1.45k]
  ------------------
 2957|      1|        return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      1|#define M_OPT_MISSING_PARAM     -2
  ------------------
 2958|       |
 2959|  1.45k|    if (bstr_equals0(param, "none")) {
  ------------------
  |  Branch (2959:9): [True: 68, False: 1.38k]
  ------------------
 2960|     68|        t.type = REL_TIME_NONE;
 2961|     68|        goto out;
 2962|     68|    }
 2963|       |
 2964|       |    // Percent pos
 2965|  1.38k|    if (bstr_endswith0(param, "%")) {
  ------------------
  |  Branch (2965:9): [True: 332, False: 1.05k]
  ------------------
 2966|    332|        double percent = bstrtod(bstr_splice(param, 0, -1), &param);
 2967|    332|        if (param.len == 0 && percent >= 0 && percent <= 100) {
  ------------------
  |  Branch (2967:13): [True: 79, False: 253]
  |  Branch (2967:31): [True: 78, False: 1]
  |  Branch (2967:47): [True: 76, False: 2]
  ------------------
 2968|     76|            t.type = REL_TIME_PERCENT;
 2969|     76|            t.pos = percent;
 2970|     76|            goto out;
 2971|     76|        }
 2972|    332|    }
 2973|       |
 2974|       |    // Chapter pos
 2975|  1.31k|    if (bstr_startswith0(param, "#")) {
  ------------------
  |  Branch (2975:9): [True: 416, False: 895]
  ------------------
 2976|    416|        int chapter = bstrtoll(bstr_cut(param, 1), &param, 10);
 2977|    416|        if (param.len == 0 && chapter >= 1) {
  ------------------
  |  Branch (2977:13): [True: 330, False: 86]
  |  Branch (2977:31): [True: 288, False: 42]
  ------------------
 2978|    288|            t.type = REL_TIME_CHAPTER;
 2979|    288|            t.pos = chapter - 1;
 2980|    288|            goto out;
 2981|    288|        }
 2982|    416|    }
 2983|       |
 2984|  1.02k|    double time;
 2985|  1.02k|    if (parse_timestring(param, &time, 0)) {
  ------------------
  |  Branch (2985:9): [True: 863, False: 160]
  ------------------
 2986|    863|        if (bstr_startswith0(param, "+") || bstr_startswith0(param, "-")) {
  ------------------
  |  Branch (2986:13): [True: 89, False: 774]
  |  Branch (2986:45): [True: 238, False: 536]
  ------------------
 2987|    327|            t.type = REL_TIME_RELATIVE;
 2988|    536|        } else {
 2989|    536|            t.type = REL_TIME_ABSOLUTE;
 2990|    536|        }
 2991|    863|        t.pos = time;
 2992|    863|        goto out;
 2993|    863|    }
 2994|       |
 2995|    160|    mp_err(log, "Option %.*s: invalid time or position: '%.*s'\n",
  ------------------
  |  |   76|    640|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 160, False: 0]
  |  |  |  Branch (76:55): [True: 160, False: 0]
  |  |  ------------------
  ------------------
 2996|    160|           BSTR_P(name), BSTR_P(param));
 2997|    160|    return M_OPT_INVALID;
  ------------------
  |  |  535|    160|#define M_OPT_INVALID           -3
  ------------------
 2998|       |
 2999|  1.29k|out:
 3000|  1.29k|    if (dst)
  ------------------
  |  Branch (3000:9): [True: 1.29k, False: 0]
  ------------------
 3001|  1.29k|        *(struct m_rel_time *)dst = t;
 3002|  1.29k|    return 1;
 3003|  1.02k|}
m_option.c:print_rel_time:
 3006|     53|{
 3007|     53|    const struct m_rel_time *t = val;
 3008|     53|    switch(t->type) {
  ------------------
  |  Branch (3008:12): [True: 0, False: 53]
  ------------------
 3009|      0|    case REL_TIME_ABSOLUTE:
  ------------------
  |  Branch (3009:5): [True: 0, False: 53]
  ------------------
 3010|      0|        return talloc_asprintf(NULL, "%g", t->pos);
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3011|      0|    case REL_TIME_RELATIVE:
  ------------------
  |  Branch (3011:5): [True: 0, False: 53]
  ------------------
 3012|      0|        return talloc_asprintf(NULL, "%+g", t->pos);
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3013|      0|    case REL_TIME_CHAPTER:
  ------------------
  |  Branch (3013:5): [True: 0, False: 53]
  ------------------
 3014|      0|        return talloc_asprintf(NULL, "#%g", t->pos + 1);
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3015|      0|    case REL_TIME_PERCENT:
  ------------------
  |  Branch (3015:5): [True: 0, False: 53]
  ------------------
 3016|      0|        return talloc_asprintf(NULL, "%g%%", t->pos);
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3017|     53|    }
 3018|     53|    return talloc_strdup(NULL, "none");
  ------------------
  |  |   50|     53|#define talloc_strdup                   ta_xstrdup
  ------------------
 3019|     53|}
m_option.c:rel_time_equal:
 3022|  1.29k|{
 3023|  1.29k|    struct m_rel_time *ta = a;
 3024|  1.29k|    struct m_rel_time *tb = b;
 3025|  1.29k|    return ta->type == tb->type && ta->pos == tb->pos;
  ------------------
  |  Branch (3025:12): [True: 956, False: 339]
  |  Branch (3025:36): [True: 498, False: 458]
  ------------------
 3026|  1.29k|}
m_option.c:parse_obj_settings_list:
 3510|  59.2k|{
 3511|  59.2k|    m_obj_settings_t *res = NULL;
 3512|  59.2k|    int op = OP_NONE;
  ------------------
  |  | 1323|  59.2k|#define OP_NONE 0
  ------------------
 3513|  59.2k|    bool *mark_del = NULL;
 3514|  59.2k|    int num_items = obj_settings_list_num_items(dst ? VAL(dst) : 0);
  ------------------
  |  | 3041|  59.2k|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
  |  Branch (3514:49): [True: 59.2k, False: 0]
  ------------------
 3515|  59.2k|    const struct m_obj_list *ol = opt->priv;
 3516|  59.2k|    int ret = 1;
 3517|       |
 3518|  59.2k|    mp_assert(opt->priv);
  ------------------
  |  |   41|  59.2k|#define mp_assert assert
  ------------------
  |  Branch (3518:5): [True: 59.2k, False: 0]
  ------------------
 3519|       |
 3520|  59.2k|    if (bstr_endswith0(name, "-add")) {
  ------------------
  |  Branch (3520:9): [True: 1.10k, False: 58.1k]
  ------------------
 3521|  1.10k|        op = OP_ADD;
  ------------------
  |  | 1324|  1.10k|#define OP_ADD 1
  ------------------
 3522|  58.1k|    } else if (bstr_endswith0(name, "-append")) {
  ------------------
  |  Branch (3522:16): [True: 71, False: 58.0k]
  ------------------
 3523|     71|        op = OP_APPEND;
  ------------------
  |  | 1329|     71|#define OP_APPEND 6
  ------------------
 3524|  58.0k|    } else if (bstr_endswith0(name, "-set")) {
  ------------------
  |  Branch (3524:16): [True: 116, False: 57.9k]
  ------------------
 3525|    116|        op = OP_NONE;
  ------------------
  |  | 1323|    116|#define OP_NONE 0
  ------------------
 3526|  57.9k|    } else if (bstr_endswith0(name, "-pre")) {
  ------------------
  |  Branch (3526:16): [True: 2.00k, False: 55.9k]
  ------------------
 3527|  2.00k|        op = OP_PRE;
  ------------------
  |  | 1325|  2.00k|#define OP_PRE 2
  ------------------
 3528|  55.9k|    } else if (bstr_endswith0(name, "-remove")) {
  ------------------
  |  Branch (3528:16): [True: 1.00k, False: 54.9k]
  ------------------
 3529|  1.00k|        op = OP_REMOVE;
  ------------------
  |  | 1330|  1.00k|#define OP_REMOVE 7
  ------------------
 3530|  54.9k|    } else if (bstr_endswith0(name, "-clr")) {
  ------------------
  |  Branch (3530:16): [True: 295, False: 54.6k]
  ------------------
 3531|    295|        op = OP_CLR;
  ------------------
  |  | 1326|    295|#define OP_CLR 3
  ------------------
 3532|  54.6k|    } else if (bstr_endswith0(name, "-toggle")) {
  ------------------
  |  Branch (3532:16): [True: 1.20k, False: 53.4k]
  ------------------
 3533|  1.20k|        op = OP_TOGGLE;
  ------------------
  |  | 1328|  1.20k|#define OP_TOGGLE 5
  ------------------
 3534|  53.4k|    } else if (bstr_endswith0(name, "-help")) {
  ------------------
  |  Branch (3534:16): [True: 2, False: 53.4k]
  ------------------
 3535|      2|        mp_err(log, "Option %s:\n"
  ------------------
  |  |   76|      2|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
 3536|      2|                "Supported operations are:\n"
 3537|      2|                "  %s-set\n"
 3538|      2|                " Overwrite the old list with the given list\n\n"
 3539|      2|                "  %s-append\n"
 3540|      2|                " Append the given item to the current list\n\n"
 3541|      2|                "  %s-add\n"
 3542|      2|                " Append the given list to the current list\n\n"
 3543|      2|                "  %s-pre\n"
 3544|      2|                " Prepend the given list to the current list\n\n"
 3545|      2|                "  %s-remove\n"
 3546|      2|                " Remove the given item from the current list\n\n"
 3547|      2|                "  %s-toggle\n"
 3548|      2|                " Add the item to the list, or remove it if it's already added.\n\n"
 3549|      2|                "  %s-clr\n"
 3550|      2|                " Clear the current list.\n\n",
 3551|      2|                opt->name, opt->name, opt->name, opt->name, opt->name,
 3552|      2|                opt->name, opt->name, opt->name);
 3553|       |
 3554|      2|        ret = M_OPT_EXIT;
  ------------------
  |  |  545|      2|#define M_OPT_EXIT              -6
  ------------------
 3555|      2|        goto done;
 3556|      2|    }
 3557|       |
 3558|  59.2k|    if (!bstrcmp0(param, "help")) {
  ------------------
  |  Branch (3558:9): [True: 6, False: 59.2k]
  ------------------
 3559|      6|        mp_info(log, "Available %s:\n", ol->description);
  ------------------
  |  |   78|      6|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 3560|     31|        for (int n = 0; ; n++) {
 3561|     31|            struct m_obj_desc desc;
 3562|     31|            if (!ol->get_desc(&desc, n))
  ------------------
  |  Branch (3562:17): [True: 6, False: 25]
  ------------------
 3563|      6|                break;
 3564|     25|            if (!desc.hidden) {
  ------------------
  |  Branch (3564:17): [True: 23, False: 2]
  ------------------
 3565|     23|                mp_info(log, "  %-16s %s\n",
  ------------------
  |  |   78|     23|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 3566|     23|                       desc.name, desc.description);
 3567|     23|            }
 3568|     25|        }
 3569|      6|        mp_info(log, "\n");
  ------------------
  |  |   78|      6|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 3570|      6|        if (ol->print_help_list)
  ------------------
  |  Branch (3570:13): [True: 3, False: 3]
  ------------------
 3571|      3|            ol->print_help_list(log);
 3572|      6|        if (!ol->use_global_options) {
  ------------------
  |  Branch (3572:13): [True: 2, False: 4]
  ------------------
 3573|      2|            mp_info(log, "Get help on individual entries via: --%s=entry=help\n",
  ------------------
  |  |   78|      2|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 3574|      2|                    opt->name);
 3575|      2|        }
 3576|      6|        ret = M_OPT_EXIT;
  ------------------
  |  |  545|      6|#define M_OPT_EXIT              -6
  ------------------
 3577|      6|        goto done;
 3578|      6|    }
 3579|       |
 3580|  59.2k|    if (op == OP_CLR) {
  ------------------
  |  | 1326|  59.2k|#define OP_CLR 3
  ------------------
  |  Branch (3580:9): [True: 295, False: 58.9k]
  ------------------
 3581|    295|        if (param.len) {
  ------------------
  |  Branch (3581:13): [True: 1, False: 294]
  ------------------
 3582|      1|            mp_err(log, "Option %.*s: -clr does not take an argument.\n",
  ------------------
  |  |   76|      2|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 3583|      1|                   BSTR_P(name));
 3584|      1|            ret = M_OPT_INVALID;
  ------------------
  |  |  535|      1|#define M_OPT_INVALID           -3
  ------------------
 3585|      1|            goto done;
 3586|      1|        }
 3587|    294|        if (dst)
  ------------------
  |  Branch (3587:13): [True: 294, False: 0]
  ------------------
 3588|    294|            free_obj_settings_list(dst);
 3589|    294|        ret = 0;
 3590|    294|        goto done;
 3591|  58.9k|    } else if (op == OP_REMOVE) {
  ------------------
  |  | 1330|  58.9k|#define OP_REMOVE 7
  ------------------
  |  Branch (3591:16): [True: 1.00k, False: 57.9k]
  ------------------
 3592|  1.00k|        mark_del = talloc_zero_array(NULL, bool, num_items + 1);
  ------------------
  |  |   30|  1.00k|#define talloc_zero_array               ta_xznew_array
  |  |  ------------------
  |  |  |  |  136|  1.00k|#define ta_xznew_array(...)             ta_oom_g(ta_znew_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  1.00k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3593|  1.00k|    }
 3594|       |
 3595|  58.9k|    if (op != OP_NONE && param.len == 0) {
  ------------------
  |  | 1323|   117k|#define OP_NONE 0
  ------------------
  |  Branch (3595:9): [True: 5.37k, False: 53.5k]
  |  Branch (3595:26): [True: 3, False: 5.37k]
  ------------------
 3596|      3|        ret = M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      3|#define M_OPT_MISSING_PARAM     -2
  ------------------
 3597|      3|        goto done;
 3598|      3|    }
 3599|       |
 3600|   129k|    while (param.len > 0) {
  ------------------
  |  Branch (3600:12): [True: 71.1k, False: 57.9k]
  ------------------
 3601|  71.1k|        int r = 0;
 3602|  71.1k|        if (op == OP_REMOVE)
  ------------------
  |  | 1330|  71.1k|#define OP_REMOVE 7
  ------------------
  |  Branch (3602:13): [True: 3.41k, False: 67.7k]
  ------------------
 3603|  3.41k|            r = parse_obj_settings_del(log, name, &param, dst, mark_del);
 3604|  71.1k|        if (r == 0) {
  ------------------
  |  Branch (3604:13): [True: 69.5k, False: 1.66k]
  ------------------
 3605|  69.5k|            r = parse_obj_settings(log, name, op, &param, ol, dst ? &res : NULL);
  ------------------
  |  Branch (3605:63): [True: 69.5k, False: 0]
  ------------------
 3606|  69.5k|        }
 3607|  71.1k|        if (r < 0) {
  ------------------
  |  Branch (3607:13): [True: 989, False: 70.1k]
  ------------------
 3608|    989|            free_obj_settings_list(&res);
 3609|    989|            ret = r;
 3610|    989|            goto done;
 3611|    989|        }
 3612|  70.1k|        if (param.len > 0) {
  ------------------
  |  Branch (3612:13): [True: 16.8k, False: 53.3k]
  ------------------
 3613|  16.8k|            const char sep[2] = {OPTION_LIST_SEPARATOR, 0};
  ------------------
  |  |  644|  16.8k|#define OPTION_LIST_SEPARATOR ','
  ------------------
 3614|  16.8k|            if (!bstr_eatstart0(&param, sep)) {
  ------------------
  |  Branch (3614:17): [True: 53, False: 16.7k]
  ------------------
 3615|     53|                free_obj_settings_list(&res);
 3616|     53|                ret = M_OPT_INVALID;
  ------------------
  |  |  535|     53|#define M_OPT_INVALID           -3
  ------------------
 3617|     53|                goto done;
 3618|     53|            }
 3619|  16.7k|            if (param.len == 0) {
  ------------------
  |  Branch (3619:17): [True: 2.09k, False: 14.6k]
  ------------------
 3620|  2.09k|                if (!ol->allow_trailer) {
  ------------------
  |  Branch (3620:21): [True: 6, False: 2.09k]
  ------------------
 3621|      6|                    free_obj_settings_list(&res);
 3622|      6|                    ret = M_OPT_INVALID;
  ------------------
  |  |  535|      6|#define M_OPT_INVALID           -3
  ------------------
 3623|      6|                    goto done;
 3624|      6|                }
 3625|  2.09k|                if (dst) {
  ------------------
  |  Branch (3625:21): [True: 2.09k, False: 0]
  ------------------
 3626|  2.09k|                    m_obj_settings_t item = {
 3627|  2.09k|                        .name = talloc_strdup(NULL, ""),
  ------------------
  |  |   50|  2.09k|#define talloc_strdup                   ta_xstrdup
  ------------------
 3628|  2.09k|                    };
 3629|  2.09k|                    if (!obj_settings_list_insert_at(log, &res, -1, &item))
  ------------------
  |  Branch (3629:25): [True: 184, False: 1.90k]
  ------------------
 3630|    184|                        obj_setting_free(&item);
 3631|  2.09k|                }
 3632|  2.09k|            }
 3633|  16.7k|        }
 3634|  70.1k|    }
 3635|       |
 3636|  57.9k|    if (op != OP_NONE && res && res[0].name && res[1].name) {
  ------------------
  |  | 1323|   115k|#define OP_NONE 0
  ------------------
  |  Branch (3636:9): [True: 5.30k, False: 52.6k]
  |  Branch (3636:26): [True: 4.57k, False: 729]
  |  Branch (3636:33): [True: 4.57k, False: 0]
  |  Branch (3636:48): [True: 1.79k, False: 2.78k]
  ------------------
 3637|  1.79k|        if (op == OP_APPEND) {
  ------------------
  |  | 1329|  1.79k|#define OP_APPEND 6
  ------------------
  |  Branch (3637:13): [True: 1, False: 1.79k]
  ------------------
 3638|      1|            mp_err(log, "Option %.*s: -append takes only 1 item (no ',').\n",
  ------------------
  |  |   76|      2|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 3639|      1|                   BSTR_P(name));
 3640|      1|            free_obj_settings_list(&res);
 3641|      1|            ret = M_OPT_INVALID;
  ------------------
  |  |  535|      1|#define M_OPT_INVALID           -3
  ------------------
 3642|      1|            goto done;
 3643|      1|        }
 3644|  1.79k|    }
 3645|       |
 3646|  57.9k|    if (dst) {
  ------------------
  |  Branch (3646:9): [True: 57.9k, False: 0]
  ------------------
 3647|  57.9k|        m_obj_settings_t *list = VAL(dst);
  ------------------
  |  | 3041|  57.9k|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
 3648|  57.9k|        if (op == OP_PRE) {
  ------------------
  |  | 1325|  57.9k|#define OP_PRE 2
  ------------------
  |  Branch (3648:13): [True: 1.98k, False: 55.9k]
  ------------------
 3649|  1.98k|            int prepend_counter = 0;
 3650|  4.94k|            for (int n = 0; res && res[n].name; n++) {
  ------------------
  |  Branch (3650:29): [True: 4.94k, False: 0]
  |  Branch (3650:36): [True: 2.96k, False: 1.98k]
  ------------------
 3651|  2.96k|                int label = obj_settings_list_find_by_label0(list, res[n].label);
 3652|  2.96k|                if (label < 0) {
  ------------------
  |  Branch (3652:21): [True: 2.36k, False: 605]
  ------------------
 3653|  2.36k|                    if (!obj_settings_list_insert_at(log, &list, prepend_counter, &res[n]))
  ------------------
  |  Branch (3653:25): [True: 1.27k, False: 1.09k]
  ------------------
 3654|  1.27k|                        obj_setting_free(&res[n]);
 3655|  2.36k|                    prepend_counter++;
 3656|  2.36k|                } else {
 3657|       |                    // Prefer replacement semantics, instead of actually
 3658|       |                    // prepending.
 3659|    605|                    obj_setting_free(&list[label]);
 3660|    605|                    list[label] = res[n];
 3661|    605|                }
 3662|  2.96k|            }
 3663|  1.98k|            talloc_free(res);
  ------------------
  |  |   47|  1.98k|#define talloc_free                     ta_free
  ------------------
 3664|  55.9k|        } else if (op == OP_ADD || op == OP_APPEND) {
  ------------------
  |  | 1324|   111k|#define OP_ADD 1
  ------------------
                      } else if (op == OP_ADD || op == OP_APPEND) {
  ------------------
  |  | 1329|  54.8k|#define OP_APPEND 6
  ------------------
  |  Branch (3664:20): [True: 1.09k, False: 54.8k]
  |  Branch (3664:36): [True: 69, False: 54.7k]
  ------------------
 3665|  3.42k|            for (int n = 0; res && res[n].name; n++) {
  ------------------
  |  Branch (3665:29): [True: 3.42k, False: 0]
  |  Branch (3665:36): [True: 2.25k, False: 1.16k]
  ------------------
 3666|  2.25k|                int label = obj_settings_list_find_by_label0(list, res[n].label);
 3667|  2.25k|                if (label < 0) {
  ------------------
  |  Branch (3667:21): [True: 1.95k, False: 301]
  ------------------
 3668|  1.95k|                    if (!obj_settings_list_insert_at(log, &list, -1, &res[n]))
  ------------------
  |  Branch (3668:25): [True: 988, False: 968]
  ------------------
 3669|    988|                        obj_setting_free(&res[n]);
 3670|  1.95k|                } else {
 3671|       |                    // Prefer replacement semantics, instead of actually
 3672|       |                    // appending.
 3673|    301|                    obj_setting_free(&list[label]);
 3674|    301|                    list[label] = res[n];
 3675|    301|                }
 3676|  2.25k|            }
 3677|  1.16k|            talloc_free(res);
  ------------------
  |  |   47|  1.16k|#define talloc_free                     ta_free
  ------------------
 3678|  54.7k|        } else if (op == OP_TOGGLE) {
  ------------------
  |  | 1328|  54.7k|#define OP_TOGGLE 5
  ------------------
  |  Branch (3678:20): [True: 1.20k, False: 53.5k]
  ------------------
 3679|  5.57k|            for (int n = 0; res && res[n].name; n++) {
  ------------------
  |  Branch (3679:29): [True: 5.57k, False: 0]
  |  Branch (3679:36): [True: 4.37k, False: 1.20k]
  ------------------
 3680|  4.37k|                if (res[n].label && !res[n].name[0]) {
  ------------------
  |  Branch (3680:21): [True: 1.46k, False: 2.91k]
  |  Branch (3680:37): [True: 709, False: 752]
  ------------------
 3681|       |                    // Toggle enable/disable special case.
 3682|    709|                    int found =
 3683|    709|                        obj_settings_list_find_by_label0(list, res[n].label);
 3684|    709|                    if (found < 0) {
  ------------------
  |  Branch (3684:25): [True: 635, False: 74]
  ------------------
 3685|    635|                        mp_warn(log, "Option %.*s: Label %s not found\n",
  ------------------
  |  |   77|  1.27k|#define mp_warn(log, ...)       mp_msg(log, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (77:56): [True: 635, False: 0]
  |  |  ------------------
  ------------------
 3686|    635|                                BSTR_P(name), res[n].label);
 3687|    635|                    } else {
 3688|     74|                        list[found].enabled = !list[found].enabled;
 3689|     74|                    }
 3690|    709|                    obj_setting_free(&res[n]);
 3691|  3.66k|                } else {
 3692|  3.66k|                    int found = obj_settings_find_by_content(list, &res[n]);
 3693|  3.66k|                    if (found < 0) {
  ------------------
  |  Branch (3693:25): [True: 2.46k, False: 1.19k]
  ------------------
 3694|  2.46k|                        if (!obj_settings_list_insert_at(log, &list, -1, &res[n]))
  ------------------
  |  Branch (3694:29): [True: 600, False: 1.86k]
  ------------------
 3695|    600|                            obj_setting_free(&res[n]);
 3696|  2.46k|                    } else {
 3697|  1.19k|                        obj_settings_list_del_at(&list, found);
 3698|  1.19k|                        obj_setting_free(&res[n]);
 3699|  1.19k|                    }
 3700|  3.66k|                }
 3701|  4.37k|            }
 3702|  1.20k|            talloc_free(res);
  ------------------
  |  |   47|  1.20k|#define talloc_free                     ta_free
  ------------------
 3703|  53.5k|        } else if (op == OP_REMOVE) {
  ------------------
  |  | 1330|  53.5k|#define OP_REMOVE 7
  ------------------
  |  Branch (3703:20): [True: 962, False: 52.6k]
  ------------------
 3704|  2.37k|            for (int n = num_items - 1; n >= 0; n--) {
  ------------------
  |  Branch (3704:41): [True: 1.41k, False: 962]
  ------------------
 3705|  1.41k|                if (mark_del[n])
  ------------------
  |  Branch (3705:21): [True: 76, False: 1.33k]
  ------------------
 3706|     76|                    obj_settings_list_del_at(&list, n);
 3707|  1.41k|            }
 3708|  2.08k|            for (int n = 0; res && res[n].name; n++) {
  ------------------
  |  Branch (3708:29): [True: 1.35k, False: 729]
  |  Branch (3708:36): [True: 1.12k, False: 233]
  ------------------
 3709|  1.12k|                int found = obj_settings_find_by_content(list, &res[n]);
 3710|  1.12k|                if (found >= 0)
  ------------------
  |  Branch (3710:21): [True: 458, False: 663]
  ------------------
 3711|    458|                    obj_settings_list_del_at(&list, found);
 3712|  1.12k|            }
 3713|    962|            free_obj_settings_list(&res);
 3714|  52.6k|        } else {
 3715|  52.6k|            mp_assert(op == OP_NONE);
  ------------------
  |  |   41|  52.6k|#define mp_assert assert
  ------------------
  |  Branch (3715:13): [True: 52.6k, False: 0]
  ------------------
 3716|  52.6k|            free_obj_settings_list(&list);
 3717|  52.6k|            list = res;
 3718|  52.6k|        }
 3719|  57.9k|        VAL(dst) = list;
  ------------------
  |  | 3041|  57.9k|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
 3720|  57.9k|    }
 3721|       |
 3722|  59.2k|done:
 3723|  59.2k|    talloc_free(mark_del);
  ------------------
  |  |   47|  59.2k|#define talloc_free                     ta_free
  ------------------
 3724|  59.2k|    return ret;
 3725|  57.9k|}
m_option.c:obj_settings_list_num_items:
 3082|   138k|{
 3083|   138k|    int num = 0;
 3084|   295k|    while (obj_list && obj_list[num].name)
  ------------------
  |  Branch (3084:12): [True: 199k, False: 95.6k]
  |  Branch (3084:24): [True: 156k, False: 42.6k]
  ------------------
 3085|   156k|        num++;
 3086|   138k|    return num;
 3087|   138k|}
m_option.c:parse_obj_settings_del:
 3482|  3.41k|{
 3483|  3.41k|    bstr s = *param;
 3484|  3.41k|    if (bstr_eatstart0(&s, "@")) {
  ------------------
  |  Branch (3484:9): [True: 1.90k, False: 1.51k]
  ------------------
 3485|       |        // '@name:' -> parse as normal filter entry
 3486|       |        // '@name,' or '@name<end>' -> parse here
 3487|  1.90k|        int idx = bstrspn(s, NAMECH);
  ------------------
  |  | 3383|  1.90k|#define NAMECH "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"
  ------------------
 3488|  1.90k|        bstr label = bstr_splice(s, 0, idx);
 3489|  1.90k|        s = bstr_cut(s, idx);
 3490|  1.90k|        if (bstr_startswith0(s, ":"))
  ------------------
  |  Branch (3490:13): [True: 243, False: 1.66k]
  ------------------
 3491|    243|            return 0;
 3492|  1.66k|        if (dst) {
  ------------------
  |  Branch (3492:13): [True: 1.66k, False: 0]
  ------------------
 3493|  1.66k|            int label_index = 0;
 3494|  1.66k|            label_index = obj_settings_list_find_by_label(VAL(dst), label);
  ------------------
  |  | 3041|  1.66k|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
 3495|  1.66k|            if (label_index >= 0) {
  ------------------
  |  Branch (3495:17): [True: 155, False: 1.50k]
  ------------------
 3496|    155|                mark_del[label_index] = true;
 3497|  1.50k|            } else {
 3498|  1.50k|                mp_warn(log, "Option %.*s: item label @%.*s not found.\n",
  ------------------
  |  |   77|  6.02k|#define mp_warn(log, ...)       mp_msg(log, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (77:56): [True: 1.50k, False: 0]
  |  |  |  Branch (77:56): [True: 1.50k, False: 0]
  |  |  ------------------
  ------------------
 3499|  1.50k|                        BSTR_P(opt_name), BSTR_P(label));
 3500|  1.50k|            }
 3501|  1.66k|        }
 3502|  1.66k|        *param = s;
 3503|  1.66k|        return 1;
 3504|  1.90k|    }
 3505|  1.51k|    return 0;
 3506|  3.41k|}
m_option.c:obj_settings_list_find_by_label:
 3141|  7.59k|{
 3142|  35.5k|    for (int n = 0; obj_list && obj_list[n].name; n++) {
  ------------------
  |  Branch (3142:21): [True: 33.8k, False: 1.77k]
  |  Branch (3142:33): [True: 29.1k, False: 4.68k]
  ------------------
 3143|  29.1k|        if (label.len && bstr_equals0(label, obj_list[n].label))
  ------------------
  |  Branch (3143:13): [True: 7.76k, False: 21.3k]
  |  Branch (3143:26): [True: 1.13k, False: 6.63k]
  ------------------
 3144|  1.13k|            return n;
 3145|  29.1k|    }
 3146|  6.46k|    return -1;
 3147|  7.59k|}
m_option.c:parse_obj_settings:
 3389|  69.5k|{
 3390|  69.5k|    int r;
 3391|  69.5k|    char **plist = NULL;
 3392|  69.5k|    struct m_obj_desc desc;
 3393|  69.5k|    bstr str = {0};
 3394|  69.5k|    bstr label = {0};
 3395|  69.5k|    bool nopos = list->disallow_positional_parameters;
 3396|  69.5k|    bool enabled = true;
 3397|       |
 3398|  69.5k|    if (bstr_eatstart0(pstr, "@")) {
  ------------------
  |  Branch (3398:9): [True: 3.79k, False: 65.7k]
  ------------------
 3399|  3.79k|        bstr rest;
 3400|  3.79k|        if (!bstr_split_tok(*pstr, ":", &label, &rest)) {
  ------------------
  |  Branch (3400:13): [True: 1.12k, False: 2.67k]
  ------------------
 3401|       |            // "@labelname" is the special enable/disable toggle syntax
 3402|  1.12k|            if (op == OP_TOGGLE) {
  ------------------
  |  | 1328|  1.12k|#define OP_TOGGLE 5
  ------------------
  |  Branch (3402:17): [True: 1.11k, False: 12]
  ------------------
 3403|  1.11k|                int idx = bstrspn(*pstr, NAMECH);
  ------------------
  |  | 3383|  1.11k|#define NAMECH "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"
  ------------------
 3404|  1.11k|                label = bstr_splice(*pstr, 0, idx);
 3405|  1.11k|                if (label.len) {
  ------------------
  |  Branch (3405:21): [True: 1.10k, False: 1]
  ------------------
 3406|  1.10k|                    *pstr = bstr_cut(*pstr, idx);
 3407|  1.10k|                    goto done;
 3408|  1.10k|                }
 3409|  1.11k|            }
 3410|     13|            mp_err(log, "Option %.*s: ':' expected after label.\n", BSTR_P(opt));
  ------------------
  |  |   76|     26|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 13, False: 0]
  |  |  ------------------
  ------------------
 3411|     13|            return M_OPT_INVALID;
  ------------------
  |  |  535|     13|#define M_OPT_INVALID           -3
  ------------------
 3412|  1.12k|        }
 3413|  2.67k|        *pstr = rest;
 3414|  2.67k|        if (label.len == 0) {
  ------------------
  |  Branch (3414:13): [True: 5, False: 2.66k]
  ------------------
 3415|      5|            mp_err(log, "Option %.*s: label name expected.\n", BSTR_P(opt));
  ------------------
  |  |   76|     10|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 5, False: 0]
  |  |  ------------------
  ------------------
 3416|      5|            return M_OPT_INVALID;
  ------------------
  |  |  535|      5|#define M_OPT_INVALID           -3
  ------------------
 3417|      5|        }
 3418|  2.67k|    }
 3419|       |
 3420|  68.3k|    if (list->allow_disable_entries && bstr_eatstart0(pstr, "!"))
  ------------------
  |  Branch (3420:9): [True: 7.11k, False: 61.2k]
  |  Branch (3420:40): [True: 203, False: 6.91k]
  ------------------
 3421|    203|        enabled = false;
 3422|       |
 3423|  68.3k|    bool has_param = false;
 3424|  68.3k|    int idx = bstrspn(*pstr, NAMECH);
  ------------------
  |  | 3383|  68.3k|#define NAMECH "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"
  ------------------
 3425|  68.3k|    str = bstr_splice(*pstr, 0, idx);
 3426|  68.3k|    if (!str.len) {
  ------------------
  |  Branch (3426:9): [True: 52, False: 68.3k]
  ------------------
 3427|     52|        mp_err(log, "Option %.*s: item name expected.\n", BSTR_P(opt));
  ------------------
  |  |   76|    104|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 52, False: 0]
  |  |  ------------------
  ------------------
 3428|     52|        return M_OPT_INVALID;
  ------------------
  |  |  535|     52|#define M_OPT_INVALID           -3
  ------------------
 3429|     52|    }
 3430|  68.3k|    *pstr = bstr_cut(*pstr, idx);
 3431|       |    // video filters use "=", VOs use ":"
 3432|  68.3k|    if (bstr_eatstart0(pstr, "=") || bstr_eatstart0(pstr, ":"))
  ------------------
  |  Branch (3432:9): [True: 6.90k, False: 61.4k]
  |  Branch (3432:38): [True: 6.69k, False: 54.7k]
  ------------------
 3433|  13.6k|        has_param = true;
 3434|       |
 3435|  68.3k|    bool skip = false;
 3436|  68.3k|    if (m_obj_list_find(&desc, list, str)) {
  ------------------
  |  Branch (3436:9): [True: 49.1k, False: 19.1k]
  ------------------
 3437|  49.1k|        if (desc.replaced_name)
  ------------------
  |  Branch (3437:13): [True: 7.99k, False: 41.1k]
  ------------------
 3438|  7.99k|            mp_warn(log, "Driver '%s' has been replaced with '%s'!\n",
  ------------------
  |  |   77|  7.99k|#define mp_warn(log, ...)       mp_msg(log, MSGL_WARN, __VA_ARGS__)
  ------------------
 3439|  49.1k|                   desc.replaced_name, desc.name);
 3440|  49.1k|    } else {
 3441|  19.1k|        char name[80];
 3442|  19.1k|        snprintf(name, sizeof(name), "%.*s", BSTR_P(str));
  ------------------
  |  |  307|  19.1k|#define BSTR_P(bstr) (int)((bstr).len), ((bstr).start ? (char*)(bstr).start : "")
  |  |  ------------------
  |  |  |  Branch (307:42): [True: 19.1k, False: 0]
  |  |  ------------------
  ------------------
 3443|  19.1k|        if (list->check_unknown_entry && !list->check_unknown_entry(name)) {
  ------------------
  |  Branch (3443:13): [True: 222, False: 18.9k]
  |  Branch (3443:42): [True: 222, False: 0]
  ------------------
 3444|    222|            mp_err(log, "Option %.*s: '%.*s' isn't supported.\n",
  ------------------
  |  |   76|    888|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 222, False: 0]
  |  |  |  Branch (76:55): [True: 222, False: 0]
  |  |  ------------------
  ------------------
 3445|    222|                   BSTR_P(opt), BSTR_P(str));
 3446|    222|            return M_OPT_INVALID;
  ------------------
  |  |  535|    222|#define M_OPT_INVALID           -3
  ------------------
 3447|    222|        }
 3448|  18.9k|        desc = (struct m_obj_desc){0};
 3449|  18.9k|        skip = true;
 3450|  18.9k|    }
 3451|       |
 3452|  68.1k|    if (has_param) {
  ------------------
  |  Branch (3452:9): [True: 13.5k, False: 54.5k]
  ------------------
 3453|  13.5k|        struct m_config *config = NULL;
 3454|  13.5k|        if (!skip)
  ------------------
  |  Branch (3454:13): [True: 13.3k, False: 222]
  ------------------
 3455|  13.3k|            config = m_config_from_obj_desc_noalloc(NULL, log, &desc);
 3456|  13.5k|        r = m_obj_parse_sub_config(log, opt, str, pstr, config,
 3457|  13.5k|                                   M_SETOPT_CHECK_ONLY, nopos, &desc, list,
 3458|  13.5k|                                   _ret ? &plist : NULL);
  ------------------
  |  Branch (3458:36): [True: 13.5k, False: 0]
  ------------------
 3459|  13.5k|        talloc_free(config);
  ------------------
  |  |   47|  13.5k|#define talloc_free                     ta_free
  ------------------
 3460|  13.5k|        if (r < 0)
  ------------------
  |  Branch (3460:13): [True: 697, False: 12.8k]
  ------------------
 3461|    697|            return r;
 3462|  13.5k|    }
 3463|  67.4k|    if (!_ret)
  ------------------
  |  Branch (3463:9): [True: 0, False: 67.4k]
  ------------------
 3464|      0|        return 1;
 3465|       |
 3466|  68.5k|done: ;
 3467|  68.5k|    m_obj_settings_t item = {
 3468|  68.5k|        .name = bstrto0(NULL, str),
 3469|  68.5k|        .label = bstrdup0(NULL, label),
 3470|  68.5k|        .enabled = enabled,
 3471|  68.5k|        .attribs = plist,
 3472|  68.5k|    };
 3473|  68.5k|    if (!obj_settings_list_insert_at(log, _ret, -1, &item))
  ------------------
  |  Branch (3473:9): [True: 6.64k, False: 61.8k]
  ------------------
 3474|  6.64k|        obj_setting_free(&item);
 3475|  68.5k|    return 1;
 3476|  67.4k|}
m_option.c:m_obj_parse_sub_config:
 3306|  13.5k|{
 3307|  13.5k|    int nold = 0;
 3308|  13.5k|    char **args = NULL;
 3309|  13.5k|    int num_args = 0;
 3310|  13.5k|    int r = 1;
 3311|  13.5k|    char tmp[80];
 3312|       |
 3313|  13.5k|    if (ret) {
  ------------------
  |  Branch (3313:9): [True: 13.5k, False: 0]
  ------------------
 3314|  13.5k|        args = *ret;
 3315|  13.5k|        while (args && args[num_args])
  ------------------
  |  Branch (3315:16): [True: 0, False: 13.5k]
  |  Branch (3315:24): [True: 0, False: 0]
  ------------------
 3316|      0|            num_args++;
 3317|  13.5k|    }
 3318|       |
 3319|  25.8k|    while (pstr->len > 0) {
  ------------------
  |  Branch (3319:12): [True: 17.8k, False: 8.03k]
  ------------------
 3320|  17.8k|        bstr fname, fval;
 3321|  17.8k|        r = split_subconf(log, opt_name, pstr, &fname, &fval);
 3322|  17.8k|        if (r < 0)
  ------------------
  |  Branch (3322:13): [True: 33, False: 17.7k]
  ------------------
 3323|     33|            goto exit;
 3324|       |
 3325|  17.7k|        if (list->use_global_options) {
  ------------------
  |  Branch (3325:13): [True: 35, False: 17.7k]
  ------------------
 3326|     35|            mp_err(log, "Option %.*s: this option does not accept sub-options.\n",
  ------------------
  |  |   76|     70|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 35, False: 0]
  |  |  ------------------
  ------------------
 3327|     35|                   BSTR_P(opt_name));
 3328|     35|            mp_err(log, "Sub-options for --vo and --ao were removed from mpv in "
  ------------------
  |  |   76|     35|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
 3329|     35|                   "release 0.23.0.\nSee https://0x0.st/uM for details.\n");
 3330|     35|            r = M_OPT_INVALID;
  ------------------
  |  |  535|     35|#define M_OPT_INVALID           -3
  ------------------
 3331|     35|            goto exit;
 3332|     35|        }
 3333|       |
 3334|  17.7k|        if (bstr_equals0(fname, "help"))
  ------------------
  |  Branch (3334:13): [True: 6, False: 17.7k]
  ------------------
 3335|      6|            goto print_help;
 3336|  17.7k|        r = get_obj_param(log, opt_name, name, config, fname, fval, flags,
 3337|  17.7k|                          nopos, &nold, &fname, &fval, tmp, sizeof(tmp));
 3338|  17.7k|        if (r < 0)
  ------------------
  |  Branch (3338:13): [True: 623, False: 17.1k]
  ------------------
 3339|    623|            goto exit;
 3340|       |
 3341|  17.1k|        if (r > 0 && ret) {
  ------------------
  |  Branch (3341:13): [True: 8.29k, False: 8.83k]
  |  Branch (3341:22): [True: 8.29k, False: 0]
  ------------------
 3342|  8.29k|            MP_TARRAY_APPEND(NULL, args, num_args, bstrto0(NULL, fname));
  ------------------
  |  |  105|  8.29k|    do {                                            \
  |  |  106|  8.29k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  8.29k|    do {                                            \
  |  |  |  |   97|  8.29k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  8.29k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  8.29k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  8.29k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 5.01k, False: 3.28k]
  |  |  |  |  ------------------
  |  |  |  |   99|  8.29k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  5.01k|    do {                                                        \
  |  |  |  |  |  |   89|  5.01k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  5.01k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  5.01k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  5.01k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  5.01k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  5.01k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  5.01k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 5.01k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  8.29k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 8.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  8.29k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  8.29k|        (idxvar)++;                                 \
  |  |  109|  8.29k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 8.29k]
  |  |  ------------------
  ------------------
 3343|  8.29k|            MP_TARRAY_APPEND(NULL, args, num_args, bstrto0(NULL, fval));
  ------------------
  |  |  105|  8.29k|    do {                                            \
  |  |  106|  8.29k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  8.29k|    do {                                            \
  |  |  |  |   97|  8.29k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  8.29k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  8.29k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  8.29k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 8.29k]
  |  |  |  |  ------------------
  |  |  |  |   99|  8.29k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  8.29k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 8.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  8.29k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  8.29k|        (idxvar)++;                                 \
  |  |  109|  8.29k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 8.29k]
  |  |  ------------------
  ------------------
 3344|  8.29k|            MP_TARRAY_APPEND(NULL, args, num_args, NULL);
  ------------------
  |  |  105|  8.29k|    do {                                            \
  |  |  106|  8.29k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  8.29k|    do {                                            \
  |  |  |  |   97|  8.29k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  8.29k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  8.29k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  8.29k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 5.22k, False: 3.06k]
  |  |  |  |  ------------------
  |  |  |  |   99|  8.29k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  5.22k|    do {                                                        \
  |  |  |  |  |  |   89|  5.22k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  5.22k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  5.22k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  5.22k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  5.22k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  5.22k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  5.22k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 5.22k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  8.29k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 8.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  8.29k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  8.29k|        (idxvar)++;                                 \
  |  |  109|  8.29k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 8.29k]
  |  |  ------------------
  ------------------
 3345|  8.29k|            MP_TARRAY_APPEND(NULL, args, num_args, NULL);
  ------------------
  |  |  105|  8.29k|    do {                                            \
  |  |  106|  8.29k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  8.29k|    do {                                            \
  |  |  |  |   97|  8.29k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  8.29k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  8.29k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  8.29k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 8.29k]
  |  |  |  |  ------------------
  |  |  |  |   99|  8.29k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  8.29k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 8.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  8.29k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  8.29k|        (idxvar)++;                                 \
  |  |  109|  8.29k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 8.29k]
  |  |  ------------------
  ------------------
 3346|  8.29k|            num_args -= 2;
 3347|  8.29k|        }
 3348|       |
 3349|  17.1k|        if (!bstr_eatstart0(pstr, ":"))
  ------------------
  |  Branch (3349:13): [True: 4.85k, False: 12.2k]
  ------------------
 3350|  4.85k|            break;
 3351|  17.1k|    }
 3352|       |
 3353|  12.8k|    if (ret) {
  ------------------
  |  Branch (3353:9): [True: 12.8k, False: 0]
  ------------------
 3354|  12.8k|        if (num_args > 0) {
  ------------------
  |  Branch (3354:13): [True: 4.95k, False: 7.93k]
  ------------------
 3355|  4.95k|            *ret = args;
 3356|  4.95k|            args = NULL;
 3357|  7.93k|        } else {
 3358|  7.93k|            *ret = NULL;
 3359|  7.93k|        }
 3360|  12.8k|    }
 3361|       |
 3362|  12.8k|    goto exit;
 3363|       |
 3364|      6|print_help: ;
 3365|      6|    if (config) {
  ------------------
  |  Branch (3365:9): [True: 6, False: 0]
  ------------------
 3366|      6|        if (desc->print_help)
  ------------------
  |  Branch (3366:13): [True: 2, False: 4]
  ------------------
 3367|      2|            desc->print_help(log);
 3368|      6|        m_config_print_option_list(config, "*");
 3369|      6|    } else if (list->print_unknown_entry_help) {
  ------------------
  |  Branch (3369:16): [True: 0, False: 0]
  ------------------
 3370|      0|        list->print_unknown_entry_help(log, mp_tprintf(80, "%.*s", BSTR_P(name)));
  ------------------
  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (195:55): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3371|      0|    } else {
 3372|      0|        mp_warn(log, "Option %.*s: item '%.*s' isn't supported.\n",
  ------------------
  |  |   77|      0|#define mp_warn(log, ...)       mp_msg(log, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (77:56): [True: 0, False: 0]
  |  |  |  Branch (77:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3373|      0|               BSTR_P(opt_name), BSTR_P(name));
 3374|      0|    }
 3375|      6|    r = M_OPT_EXIT;
  ------------------
  |  |  545|      6|#define M_OPT_EXIT              -6
  ------------------
 3376|       |
 3377|  13.5k|exit:
 3378|  13.5k|    free_str_list(&args);
 3379|  13.5k|    return r;
 3380|      6|}
m_option.c:split_subconf:
 2140|  17.8k|{
 2141|  17.8k|    bstr p = *str;
 2142|  17.8k|    bstr subparam = {0};
 2143|  17.8k|    bstr subopt;
 2144|  17.8k|    int r = read_subparam(log, optname, ":=,\\%\"'[]", &p, &subopt);
 2145|  17.8k|    if (r < 0)
  ------------------
  |  Branch (2145:9): [True: 28, False: 17.7k]
  ------------------
 2146|     28|        return r;
 2147|  17.7k|    if (bstr_eatstart0(&p, "=")) {
  ------------------
  |  Branch (2147:9): [True: 2.88k, False: 14.9k]
  ------------------
 2148|  2.88k|        r = read_subparam(log, subopt, ":=,\\%\"'[]", &p, &subparam);
 2149|  2.88k|        if (r < 0)
  ------------------
  |  Branch (2149:13): [True: 5, False: 2.88k]
  ------------------
 2150|      5|            return r;
 2151|  2.88k|    }
 2152|  17.7k|    *str = p;
 2153|  17.7k|    *out_name = subopt;
 2154|  17.7k|    *out_val = subparam;
 2155|  17.7k|    return 0;
 2156|  17.7k|}
m_option.c:get_obj_param:
 3220|  17.7k|{
 3221|  17.7k|    int r;
 3222|       |
 3223|  17.7k|    if (!config) {
  ------------------
  |  Branch (3223:9): [True: 0, False: 17.7k]
  ------------------
 3224|       |        // Duplicates the logic below, but with unknown parameter types/names.
 3225|      0|        if (val.start || nopos) {
  ------------------
  |  Branch (3225:13): [True: 0, False: 0]
  |  Branch (3225:26): [True: 0, False: 0]
  ------------------
 3226|      0|            *out_name = name;
 3227|      0|            *out_val = val;
 3228|      0|        } else {
 3229|      0|            val = name;
 3230|       |            // positional fields
 3231|      0|            if (val.len == 0) { // Empty field, count it and go on
  ------------------
  |  Branch (3231:17): [True: 0, False: 0]
  ------------------
 3232|      0|                (*nold)++;
 3233|      0|                return 0;
 3234|      0|            }
 3235|       |            // Positional naming convention for/followed by mp_set_avopts().
 3236|      0|            snprintf(tmp, tmp_size, "@%d", *nold);
 3237|      0|            *out_name = bstr0(tmp);
 3238|      0|            *out_val = val;
 3239|      0|            (*nold)++;
 3240|      0|        }
 3241|      0|        return 1;
 3242|      0|    }
 3243|       |
 3244|       |    // val.start != NULL => of the form name=val (not positional)
 3245|       |    // If it's just "name", and the associated option exists and is a flag,
 3246|       |    // don't accept it as positional argument.
 3247|  17.7k|    if (val.start || m_config_option_requires_param(config, name) == 0 || nopos) {
  ------------------
  |  Branch (3247:9): [True: 2.87k, False: 14.8k]
  |  Branch (3247:22): [True: 72, False: 14.8k]
  |  Branch (3247:75): [True: 0, False: 14.8k]
  ------------------
 3248|  2.94k|        r = m_config_set_option_cli(config, name, val, flags);
 3249|  2.94k|        if (r < 0) {
  ------------------
  |  Branch (3249:13): [True: 6, False: 2.94k]
  ------------------
 3250|      6|            if (r == M_OPT_UNKNOWN) {
  ------------------
  |  |  529|      6|#define M_OPT_UNKNOWN           -1
  ------------------
  |  Branch (3250:17): [True: 0, False: 6]
  ------------------
 3251|      0|                mp_err(log, "Option %.*s: %.*s doesn't have a %.*s parameter.\n",
  ------------------
  |  |   76|      0|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 0, False: 0]
  |  |  |  Branch (76:55): [True: 0, False: 0]
  |  |  |  Branch (76:55): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3252|      0|                       BSTR_P(opt_name), BSTR_P(obj_name), BSTR_P(name));
 3253|      0|                return M_OPT_UNKNOWN;
  ------------------
  |  |  529|      0|#define M_OPT_UNKNOWN           -1
  ------------------
 3254|      0|            }
 3255|      6|            if (r != M_OPT_EXIT)
  ------------------
  |  |  545|      6|#define M_OPT_EXIT              -6
  ------------------
  |  Branch (3255:17): [True: 5, False: 1]
  ------------------
 3256|      5|                mp_err(log, "Option %.*s: "
  ------------------
  |  |   76|     40|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 5, False: 0]
  |  |  |  Branch (76:55): [True: 5, False: 0]
  |  |  |  Branch (76:55): [True: 5, False: 0]
  |  |  |  Branch (76:55): [True: 5, False: 0]
  |  |  ------------------
  ------------------
 3257|      6|                       "Error while parsing %.*s parameter %.*s (%.*s)\n",
 3258|      6|                       BSTR_P(opt_name), BSTR_P(obj_name), BSTR_P(name),
 3259|      6|                       BSTR_P(val));
 3260|      6|            return r;
 3261|      6|        }
 3262|  2.94k|        *out_name = name;
 3263|  2.94k|        *out_val = val;
 3264|  2.94k|        return 1;
 3265|  14.8k|    } else {
 3266|  14.8k|        val = name;
 3267|       |        // positional fields
 3268|  14.8k|        if (val.len == 0) { // Empty field, count it and go on
  ------------------
  |  Branch (3268:13): [True: 8.83k, False: 5.96k]
  ------------------
 3269|  8.83k|            (*nold)++;
 3270|  8.83k|            return 0;
 3271|  8.83k|        }
 3272|  5.96k|        const char *opt = m_config_get_positional_option(config, *nold);
 3273|  5.96k|        if (!opt) {
  ------------------
  |  Branch (3273:13): [True: 26, False: 5.94k]
  ------------------
 3274|     26|            mp_err(log, "Option %.*s: %.*s has only %d "
  ------------------
  |  |   76|    104|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 26, False: 0]
  |  |  |  Branch (76:55): [True: 26, False: 0]
  |  |  ------------------
  ------------------
 3275|     26|                   "params, so you can't give more than %d unnamed params.\n",
 3276|     26|                   BSTR_P(opt_name), BSTR_P(obj_name), *nold, *nold);
 3277|     26|            return M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|     26|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
 3278|     26|        }
 3279|  5.94k|        r = m_config_set_option_cli(config, bstr0(opt), val, flags);
 3280|  5.94k|        if (r < 0) {
  ------------------
  |  Branch (3280:13): [True: 591, False: 5.35k]
  ------------------
 3281|    591|            if (r != M_OPT_EXIT)
  ------------------
  |  |  545|    591|#define M_OPT_EXIT              -6
  ------------------
  |  Branch (3281:17): [True: 591, False: 0]
  ------------------
 3282|    591|                mp_err(log, "Option %.*s: "
  ------------------
  |  |   76|  3.54k|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (76:55): [True: 591, False: 0]
  |  |  |  Branch (76:55): [True: 591, False: 0]
  |  |  |  Branch (76:55): [True: 591, False: 0]
  |  |  ------------------
  ------------------
 3283|    591|                       "Error while parsing %.*s parameter %s (%.*s)\n",
 3284|    591|                       BSTR_P(opt_name), BSTR_P(obj_name), opt, BSTR_P(val));
 3285|    591|            return r;
 3286|    591|        }
 3287|  5.35k|        *out_name = bstr0(opt);
 3288|  5.35k|        *out_val = val;
 3289|  5.35k|        (*nold)++;
 3290|  5.35k|        return 1;
 3291|  5.94k|    }
 3292|  17.7k|}
m_option.c:obj_settings_list_insert_at:
 3117|  77.3k|{
 3118|  77.3k|    int num = obj_settings_list_num_items(*p_obj_list);
 3119|       |    // Limit list entries. obj_settings_list is not designed to hold more
 3120|       |    // items, and it quickly starts taking ages to add all items.
 3121|  77.3k|    if (num >= OBJ_SETTINGS_LIST_MAX) {
  ------------------
  |  | 3106|  77.3k|#define OBJ_SETTINGS_LIST_MAX 8
  ------------------
  |  Branch (3121:9): [True: 9.69k, False: 67.7k]
  ------------------
 3122|  9.69k|        mp_warn(log, "Object settings list capacity exceeded: "
  ------------------
  |  |   77|  9.69k|#define mp_warn(log, ...)       mp_msg(log, MSGL_WARN, __VA_ARGS__)
  ------------------
 3123|  9.69k|                     "a maximum of %d elements is allowed.\n",
 3124|  9.69k|                OBJ_SETTINGS_LIST_MAX);
 3125|  9.69k|        return false;
 3126|  9.69k|    }
 3127|  67.7k|    if (idx < 0)
  ------------------
  |  Branch (3127:9): [True: 66.6k, False: 1.09k]
  ------------------
 3128|  66.6k|        idx = num + idx + 1;
 3129|  67.7k|    mp_assert(idx >= 0 && idx <= num);
  ------------------
  |  |   41|  67.7k|#define mp_assert assert
  ------------------
  |  Branch (3129:5): [True: 67.7k, False: 0]
  |  Branch (3129:5): [True: 67.7k, False: 0]
  ------------------
 3130|  67.7k|    *p_obj_list = talloc_realloc(NULL, *p_obj_list, struct m_obj_settings,
  ------------------
  |  |   33|  67.7k|#define talloc_realloc                  ta_xrealloc
  |  |  ------------------
  |  |  |  |  144|  67.7k|    (type *)ta_xrealloc_size(ta_parent, ptr, ta_calc_array_size(sizeof(type), count))
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  67.7k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  67.7k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|  67.7k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|  67.7k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3131|  67.7k|                                 num + 2);
 3132|  67.7k|    memmove(*p_obj_list + idx + 1, *p_obj_list + idx,
 3133|  67.7k|            (num - idx) * sizeof(m_obj_settings_t));
 3134|  67.7k|    (*p_obj_list)[idx] = *item;
 3135|  67.7k|    (*p_obj_list)[num + 1] = (m_obj_settings_t){0};
 3136|       |    return true;
 3137|  67.7k|}
m_option.c:obj_setting_free:
 3065|   501k|{
 3066|   501k|    talloc_free(item->name);
  ------------------
  |  |   47|   501k|#define talloc_free                     ta_free
  ------------------
 3067|   501k|    talloc_free(item->label);
  ------------------
  |  |   47|   501k|#define talloc_free                     ta_free
  ------------------
 3068|   501k|    free_str_list(&(item->attribs));
 3069|   501k|}
m_option.c:obj_settings_list_find_by_label0:
 3151|  5.93k|{
 3152|  5.93k|    return obj_settings_list_find_by_label(obj_list, bstr0(label));
 3153|  5.93k|}
m_option.c:obj_settings_find_by_content:
 3157|  4.78k|{
 3158|  18.9k|    for (int n = 0; obj_list && obj_list[n].name; n++) {
  ------------------
  |  Branch (3158:21): [True: 18.5k, False: 452]
  |  Branch (3158:33): [True: 15.8k, False: 2.67k]
  ------------------
 3159|  15.8k|        if (obj_setting_match(&obj_list[n], item))
  ------------------
  |  Branch (3159:13): [True: 1.65k, False: 14.1k]
  ------------------
 3160|  1.65k|            return n;
 3161|  15.8k|    }
 3162|  3.13k|    return -1;
 3163|  4.78k|}
m_option.c:obj_setting_match:
 3073|  15.8k|{
 3074|  15.8k|    bstr la = bstr0(a->label), lb = bstr0(b->label);
 3075|  15.8k|    if (la.len || lb.len)
  ------------------
  |  Branch (3075:9): [True: 3.38k, False: 12.4k]
  |  Branch (3075:19): [True: 559, False: 11.8k]
  ------------------
 3076|  3.94k|        return bstr_equals(la, lb);
 3077|       |
 3078|  11.8k|    return m_obj_settings_equal(a, b);
 3079|  15.8k|}
m_option.c:obj_settings_list_del_at:
 3090|  1.72k|{
 3091|  1.72k|    m_obj_settings_t *obj_list = *p_obj_list;
 3092|  1.72k|    int num = obj_settings_list_num_items(obj_list);
 3093|       |
 3094|  1.72k|    mp_assert(idx >= 0 && idx < num);
  ------------------
  |  |   41|  1.72k|#define mp_assert assert
  ------------------
  |  Branch (3094:5): [True: 1.72k, False: 0]
  |  Branch (3094:5): [True: 1.72k, False: 0]
  ------------------
 3095|       |
 3096|  1.72k|    obj_setting_free(&obj_list[idx]);
 3097|       |
 3098|       |    // Note: the NULL-terminating element is moved down as part of this
 3099|  1.72k|    memmove(&obj_list[idx], &obj_list[idx + 1],
 3100|  1.72k|            sizeof(m_obj_settings_t) * (num - idx));
 3101|       |
 3102|  1.72k|    *p_obj_list = talloc_realloc(NULL, obj_list, struct m_obj_settings, num);
  ------------------
  |  |   33|  1.72k|#define talloc_realloc                  ta_xrealloc
  |  |  ------------------
  |  |  |  |  144|  1.72k|    (type *)ta_xrealloc_size(ta_parent, ptr, ta_calc_array_size(sizeof(type), count))
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  1.72k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  1.72k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|  1.72k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.72k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3103|  1.72k|}
m_option.c:print_obj_settings_list:
 3738|    323|{
 3739|    323|    m_obj_settings_t *list = VAL(val);
  ------------------
  |  | 3041|    323|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
 3740|    323|    char *res = talloc_strdup(NULL, "");
  ------------------
  |  |   50|    323|#define talloc_strdup                   ta_xstrdup
  ------------------
 3741|    897|    for (int n = 0; list && list[n].name; n++) {
  ------------------
  |  Branch (3741:21): [True: 762, False: 135]
  |  Branch (3741:29): [True: 574, False: 188]
  ------------------
 3742|    574|        m_obj_settings_t *entry = &list[n];
 3743|    574|        if (n > 0)
  ------------------
  |  Branch (3743:13): [True: 387, False: 187]
  ------------------
 3744|    387|            res = talloc_strdup_append(res, ",");
  ------------------
  |  |   57|    387|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 3745|       |        // Assume labels and names don't need escaping
 3746|    574|        if (entry->label && entry->label[0])
  ------------------
  |  Branch (3746:13): [True: 34, False: 540]
  |  Branch (3746:29): [True: 34, False: 0]
  ------------------
 3747|     34|            res = talloc_asprintf_append(res, "@%s:", entry->label);
  ------------------
  |  |   63|     34|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 3748|    574|        if (!entry->enabled)
  ------------------
  |  Branch (3748:13): [True: 54, False: 520]
  ------------------
 3749|     54|            res = talloc_strdup_append(res, "!");
  ------------------
  |  |   57|     54|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 3750|    574|        res = talloc_strdup_append(res, entry->name);
  ------------------
  |  |   57|    574|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 3751|    574|        if (entry->attribs && entry->attribs[0]) {
  ------------------
  |  Branch (3751:13): [True: 107, False: 467]
  |  Branch (3751:31): [True: 107, False: 0]
  ------------------
 3752|    107|            res = talloc_strdup_append(res, "=");
  ------------------
  |  |   57|    107|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 3753|    464|            for (int i = 0; entry->attribs[i * 2 + 0]; i++) {
  ------------------
  |  Branch (3753:29): [True: 357, False: 107]
  ------------------
 3754|    357|                if (i > 0)
  ------------------
  |  Branch (3754:21): [True: 250, False: 107]
  ------------------
 3755|    250|                    res = talloc_strdup_append(res, ":");
  ------------------
  |  |   57|    250|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 3756|    357|                append_param(&res, entry->attribs[i * 2 + 0]);
 3757|    357|                res = talloc_strdup_append(res, "=");
  ------------------
  |  |   57|    357|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 3758|    357|                append_param(&res, entry->attribs[i * 2 + 1]);
 3759|    357|            }
 3760|    107|        }
 3761|    574|    }
 3762|    323|    return res;
 3763|    323|}
m_option.c:append_param:
 3728|    714|{
 3729|    714|    if (strspn(param, NAMECH) == strlen(param)) {
  ------------------
  |  | 3383|    714|#define NAMECH "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"
  ------------------
  |  Branch (3729:9): [True: 645, False: 69]
  ------------------
 3730|    645|        *res = talloc_strdup_append(*res, param);
  ------------------
  |  |   57|    645|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 3731|    645|    } else {
 3732|       |        // Simple escaping: %BYTECOUNT%STRING
 3733|     69|        *res = talloc_asprintf_append(*res, "%%%zd%%%s", strlen(param), param);
  ------------------
  |  |   63|     69|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 3734|     69|    }
 3735|    714|}
m_option.c:copy_obj_settings_list:
 3182|   493k|{
 3183|   493k|    m_obj_settings_t *d, *s;
 3184|   493k|    int n;
 3185|       |
 3186|   493k|    if (!(dst && src))
  ------------------
  |  Branch (3186:11): [True: 493k, False: 0]
  |  Branch (3186:18): [True: 493k, False: 0]
  ------------------
 3187|      0|        return;
 3188|       |
 3189|   493k|    s = VAL(src);
  ------------------
  |  | 3041|   493k|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
 3190|       |
 3191|   493k|    if (VAL(dst))
  ------------------
  |  | 3041|   493k|#define VAL(x) (*(m_obj_settings_t **)(x))
  |  |  ------------------
  |  |  |  Branch (3041:16): [True: 25.7k, False: 467k]
  |  |  ------------------
  ------------------
 3192|  25.7k|        free_obj_settings_list(dst);
 3193|   493k|    if (!s)
  ------------------
  |  Branch (3193:9): [True: 373k, False: 120k]
  ------------------
 3194|   373k|        return;
 3195|       |
 3196|   551k|    for (n = 0; s[n].name; n++)
  ------------------
  |  Branch (3196:17): [True: 430k, False: 120k]
  ------------------
 3197|   430k|        /* NOP */;
 3198|   120k|    d = talloc_array(NULL, struct m_obj_settings, n + 1);
  ------------------
  |  |   29|   120k|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|   120k|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|   120k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3199|   551k|    for (n = 0; s[n].name; n++) {
  ------------------
  |  Branch (3199:17): [True: 430k, False: 120k]
  ------------------
 3200|   430k|        d[n].name = talloc_strdup(NULL, s[n].name);
  ------------------
  |  |   50|   430k|#define talloc_strdup                   ta_xstrdup
  ------------------
 3201|   430k|        d[n].label = talloc_strdup(NULL, s[n].label);
  ------------------
  |  |   50|   430k|#define talloc_strdup                   ta_xstrdup
  ------------------
 3202|   430k|        d[n].enabled = s[n].enabled;
 3203|   430k|        d[n].attribs = NULL;
 3204|   430k|        copy_str_list(NULL, &(d[n].attribs), &(s[n].attribs));
 3205|   430k|    }
 3206|   120k|    d[n].name = NULL;
 3207|   120k|    d[n].label = NULL;
 3208|   120k|    d[n].attribs = NULL;
 3209|   120k|    VAL(dst) = d;
  ------------------
  |  | 3041|   120k|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
 3210|   120k|}
m_option.c:free_obj_settings_list:
 3166|   540k|{
 3167|   540k|    int n;
 3168|   540k|    m_obj_settings_t *d;
 3169|       |
 3170|   540k|    if (!dst || !VAL(dst))
  ------------------
  |  | 3041|   540k|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
  |  Branch (3170:9): [True: 0, False: 540k]
  |  Branch (3170:17): [True: 368k, False: 171k]
  ------------------
 3171|   368k|        return;
 3172|       |
 3173|   171k|    d = VAL(dst);
  ------------------
  |  | 3041|   171k|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
 3174|   659k|    for (n = 0; d[n].name; n++)
  ------------------
  |  Branch (3174:17): [True: 487k, False: 171k]
  ------------------
 3175|   487k|        obj_setting_free(&d[n]);
 3176|   171k|    talloc_free(d);
  ------------------
  |  |   47|   171k|#define talloc_free                     ta_free
  ------------------
 3177|   171k|    VAL(dst) = NULL;
  ------------------
  |  | 3041|   171k|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
 3178|   171k|}
m_option.c:obj_settings_list_equal:
 3873|  24.6k|{
 3874|  24.6k|    struct m_obj_settings *a = VAL(pa);
  ------------------
  |  | 3041|  24.6k|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
 3875|  24.6k|    struct m_obj_settings *b = VAL(pb);
  ------------------
  |  | 3041|  24.6k|#define VAL(x) (*(m_obj_settings_t **)(x))
  ------------------
 3876|       |
 3877|  24.6k|    if (a == b || !a || !b)
  ------------------
  |  Branch (3877:9): [True: 2.47k, False: 22.1k]
  |  Branch (3877:19): [True: 3.01k, False: 19.1k]
  |  Branch (3877:25): [True: 588, False: 18.5k]
  ------------------
 3878|  6.08k|        return a == b || (!a && !b[0].name) || (!b && !a[0].name);
  ------------------
  |  Branch (3878:16): [True: 2.47k, False: 3.60k]
  |  Branch (3878:27): [True: 3.01k, False: 588]
  |  Branch (3878:33): [True: 138, False: 2.87k]
  |  Branch (3878:49): [True: 588, False: 2.87k]
  |  Branch (3878:55): [True: 0, False: 588]
  ------------------
 3879|       |
 3880|  44.3k|    for (int n = 0; a[n].name || b[n].name; n++) {
  ------------------
  |  Branch (3880:21): [True: 30.9k, False: 13.3k]
  |  Branch (3880:34): [True: 770, False: 12.5k]
  ------------------
 3881|  31.7k|        if (!a[n].name || !b[n].name)
  ------------------
  |  Branch (3881:13): [True: 770, False: 30.9k]
  |  Branch (3881:27): [True: 400, False: 30.5k]
  ------------------
 3882|  1.17k|            return false;
 3883|  30.5k|        if (!m_obj_settings_equal(&a[n], &b[n]))
  ------------------
  |  Branch (3883:13): [True: 4.77k, False: 25.8k]
  ------------------
 3884|  4.77k|            return false;
 3885|  30.5k|    }
 3886|       |
 3887|  12.5k|    return true;
 3888|  18.5k|}
m_option.c:print_node:
 3939|    145|{
 3940|    145|    char *t = talloc_strdup(NULL, "");
  ------------------
  |  |   50|    145|#define talloc_strdup                   ta_xstrdup
  ------------------
 3941|    145|    if (json_write(&t, &VAL(val)) < 0) {
  ------------------
  |  | 3928|    145|#define VAL(x) (*(struct mpv_node *)(x))
  ------------------
  |  Branch (3941:9): [True: 0, False: 145]
  ------------------
 3942|      0|        talloc_free(t);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 3943|       |        t = NULL;
 3944|      0|    }
 3945|    145|    return t;
 3946|    145|}
m_option.c:pretty_print_node:
 3949|    765|{
 3950|    765|    char *t = talloc_strdup(NULL, "");
  ------------------
  |  |   50|    765|#define talloc_strdup                   ta_xstrdup
  ------------------
 3951|    765|    if (json_write_pretty(&t, &VAL(val)) < 0) {
  ------------------
  |  | 3928|    765|#define VAL(x) (*(struct mpv_node *)(x))
  ------------------
  |  Branch (3951:9): [True: 0, False: 765]
  ------------------
 3952|      0|        talloc_free(t);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 3953|       |        t = NULL;
 3954|      0|    }
 3955|    765|    return t;
 3956|    765|}
m_option.c:free_node:
 4033|  12.3k|{
 4034|  12.3k|    if (src) {
  ------------------
  |  Branch (4034:9): [True: 12.3k, False: 0]
  ------------------
 4035|  12.3k|        struct mpv_node *node = &VAL(src);
  ------------------
  |  | 3928|  12.3k|#define VAL(x) (*(struct mpv_node *)(x))
  ------------------
 4036|  12.3k|        talloc_free(node_get_alloc(node));
  ------------------
  |  |   47|  12.3k|#define talloc_free                     ta_free
  ------------------
 4037|  12.3k|        *node = (struct mpv_node){{0}};
 4038|  12.3k|    }
 4039|  12.3k|}
m_option.c:parse_cycle_dir:
 4076|     64|{
 4077|     64|    double val;
 4078|     64|    if (bstrcmp0(param, "up") == 0) {
  ------------------
  |  Branch (4078:9): [True: 0, False: 64]
  ------------------
 4079|      0|        val = +1;
 4080|     64|    } else if (bstrcmp0(param, "down") == 0) {
  ------------------
  |  Branch (4080:16): [True: 64, False: 0]
  ------------------
 4081|     64|        val = -1;
 4082|     64|    } else {
 4083|      0|        return m_option_type_double.parse(log, opt, name, param, dst);
 4084|      0|    }
 4085|     64|    *(double *)dst = val;
 4086|     64|    return 1;
 4087|     64|}

f_lavfi.c:ra_hwdec_validate_drivers_only_opt_str:
  209|     75|                                            struct bstr name, void *value) { \
  210|     75|    return OPT_FUNC(func)(log, opt, name, value); \
  ------------------
  |  |  203|     75|#define OPT_FUNC(name) name
  ------------------
  211|     75|} \
cmd.c:m_option_free:
  589|  47.6k|{
  590|  47.6k|    if (opt->type->free)
  ------------------
  |  Branch (590:9): [True: 16.3k, False: 31.2k]
  ------------------
  591|  16.3k|        opt->type->free(dst);
  592|  47.6k|}
cmd.c:m_option_copy:
  582|  5.69k|{
  583|  5.69k|    if (opt->type->copy)
  ------------------
  |  Branch (583:9): [True: 5.69k, False: 0]
  ------------------
  584|  5.69k|        opt->type->copy(opt, dst, src);
  585|  5.69k|}
cmd.c:m_option_print:
  559|    155|{
  560|    155|    if (opt->type->print)
  ------------------
  |  Branch (560:9): [True: 155, False: 0]
  ------------------
  561|    155|        return opt->type->print(opt, val_ptr);
  562|      0|    else
  563|      0|        return NULL;
  564|    155|}
m_config_core.c:m_option_free:
  589|  33.5M|{
  590|  33.5M|    if (opt->type->free)
  ------------------
  |  Branch (590:9): [True: 5.89M, False: 27.6M]
  ------------------
  591|  5.89M|        opt->type->free(dst);
  592|  33.5M|}
m_config_core.c:m_option_equal:
  617|   637k|{
  618|       |    // Handle trivial equivalence.
  619|       |    // If not implemented, assume this type has no actual values => always equal.
  620|   637k|    if (a == b || !opt->type->equal)
  ------------------
  |  Branch (620:9): [True: 0, False: 637k]
  |  Branch (620:19): [True: 0, False: 637k]
  ------------------
  621|      0|        return true;
  622|   637k|    return opt->type->equal(opt, a, b);
  623|   637k|}
m_config_core.c:m_option_copy:
  582|  6.20M|{
  583|  6.20M|    if (opt->type->copy)
  ------------------
  |  Branch (583:9): [True: 6.20M, False: 0]
  ------------------
  584|  6.20M|        opt->type->copy(opt, dst, src);
  585|  6.20M|}
m_config_frontend.c:m_option_copy:
  582|  9.95M|{
  583|  9.95M|    if (opt->type->copy)
  ------------------
  |  Branch (583:9): [True: 9.95M, False: 0]
  ------------------
  584|  9.95M|        opt->type->copy(opt, dst, src);
  585|  9.95M|}
m_config_frontend.c:m_option_free:
  589|  9.71M|{
  590|  9.71M|    if (opt->type->free)
  ------------------
  |  Branch (590:9): [True: 1.83M, False: 7.88M]
  ------------------
  591|  1.83M|        opt->type->free(dst);
  592|  9.71M|}
m_config_frontend.c:m_option_pretty_print:
  569|  29.6k|{
  570|  29.6k|    m_option_t o = *opt;
  571|  29.6k|    if (fixed_len)
  ------------------
  |  Branch (571:9): [True: 0, False: 29.6k]
  ------------------
  572|      0|        o.flags |= M_OPT_FIXED_LEN_PRINT;
  ------------------
  |  |  494|      0|#define M_OPT_FIXED_LEN_PRINT   (UINT64_C(1) << 55)
  ------------------
  573|  29.6k|    if (opt->type->pretty_print)
  ------------------
  |  Branch (573:9): [True: 6.93k, False: 22.6k]
  ------------------
  574|  6.93k|        return opt->type->pretty_print(&o, val_ptr);
  575|  22.6k|    else
  576|  22.6k|        return m_option_print(&o, val_ptr);
  577|  29.6k|}
m_config_frontend.c:m_option_print:
  559|  22.6k|{
  560|  22.6k|    if (opt->type->print)
  ------------------
  |  Branch (560:9): [True: 21.0k, False: 1.57k]
  ------------------
  561|  21.0k|        return opt->type->print(opt, val_ptr);
  562|  1.57k|    else
  563|  1.57k|        return NULL;
  564|  22.6k|}
m_property.c:m_option_pretty_print:
  569|  1.89k|{
  570|  1.89k|    m_option_t o = *opt;
  571|  1.89k|    if (fixed_len)
  ------------------
  |  Branch (571:9): [True: 679, False: 1.21k]
  ------------------
  572|    679|        o.flags |= M_OPT_FIXED_LEN_PRINT;
  ------------------
  |  |  494|    679|#define M_OPT_FIXED_LEN_PRINT   (UINT64_C(1) << 55)
  ------------------
  573|  1.89k|    if (opt->type->pretty_print)
  ------------------
  |  Branch (573:9): [True: 906, False: 985]
  ------------------
  574|    906|        return opt->type->pretty_print(&o, val_ptr);
  575|    985|    else
  576|    985|        return m_option_print(&o, val_ptr);
  577|  1.89k|}
m_property.c:m_option_free:
  589|  2.37k|{
  590|  2.37k|    if (opt->type->free)
  ------------------
  |  Branch (590:9): [True: 1.57k, False: 803]
  ------------------
  591|  1.57k|        opt->type->free(dst);
  592|  2.37k|}
m_property.c:m_option_print:
  559|   216k|{
  560|   216k|    if (opt->type->print)
  ------------------
  |  Branch (560:9): [True: 216k, False: 0]
  ------------------
  561|   216k|        return opt->type->print(opt, val_ptr);
  562|      0|    else
  563|      0|        return NULL;
  564|   216k|}
m_property.c:m_option_get_node:
  610|   182k|{
  611|   182k|    if (opt->type->get)
  ------------------
  |  Branch (611:9): [True: 182k, False: 0]
  ------------------
  612|   182k|        return opt->type->get(opt, ta_parent, dst, src);
  613|      0|    return M_OPT_UNKNOWN;
  ------------------
  |  |  529|      0|#define M_OPT_UNKNOWN           -1
  ------------------
  614|   182k|}
m_property.c:m_option_copy:
  582|     73|{
  583|     73|    if (opt->type->copy)
  ------------------
  |  Branch (583:9): [True: 73, False: 0]
  ------------------
  584|     73|        opt->type->copy(opt, dst, src);
  585|     73|}
client.c:m_option_free:
  589|  11.3k|{
  590|  11.3k|    if (opt->type->free)
  ------------------
  |  Branch (590:9): [True: 11.3k, False: 0]
  ------------------
  591|  11.3k|        opt->type->free(dst);
  592|  11.3k|}
command.c:m_option_copy:
  582|    819|{
  583|    819|    if (opt->type->copy)
  ------------------
  |  Branch (583:9): [True: 819, False: 0]
  ------------------
  584|    819|        opt->type->copy(opt, dst, src);
  585|    819|}
command.c:m_option_free:
  589|  16.4k|{
  590|  16.4k|    if (opt->type->free)
  ------------------
  |  Branch (590:9): [True: 16.4k, False: 0]
  ------------------
  591|  16.4k|        opt->type->free(dst);
  592|  16.4k|}
lcms.c:validate_3dlut_size_opt_str:
  209|     51|                                            struct bstr name, void *value) { \
  210|     51|    return OPT_FUNC(func)(log, opt, name, value); \
  ------------------
  |  |  203|     51|#define OPT_FUNC(name) name
  ------------------
  211|     51|} \
video.c:validate_target_gamut_str:
  209|    139|                                            struct bstr name, void *value) { \
  210|    139|    return OPT_FUNC(func)(log, opt, name, value); \
  ------------------
  |  |  203|    139|#define OPT_FUNC(name) name
  ------------------
  211|    139|} \
video.c:validate_error_diffusion_opt_str:
  209|    221|                                            struct bstr name, void *value) { \
  210|    221|    return OPT_FUNC(func)(log, opt, name, value); \
  ------------------
  |  |  203|    221|#define OPT_FUNC(name) name
  ------------------
  211|    221|} \
video.c:ra_hwdec_validate_opt_str:
  209|    335|                                            struct bstr name, void *value) { \
  210|    335|    return OPT_FUNC(func)(log, opt, name, value); \
  ------------------
  |  |  203|    335|#define OPT_FUNC(name) name
  ------------------
  211|    335|} \

m_property_list_sort:
   45|  16.4k|{
   46|  16.4k|    qsort(list->props, list->num, sizeof(list->props[0]), compare_prop_name);
   47|  16.4k|}
m_property_do:
  142|  7.88k|{
  143|  7.88k|    union m_option_value val = m_option_value_default;
  144|  7.88k|    int r;
  145|       |
  146|  7.88k|    const char *key;
  147|  7.88k|    struct m_property *prop = resolve_name(prop_list, name, &key);
  148|  7.88k|    if (!prop)
  ------------------
  |  Branch (148:9): [True: 693, False: 7.19k]
  ------------------
  149|    693|        return M_PROPERTY_UNKNOWN;
  150|       |
  151|  7.19k|    struct m_option opt = {0};
  152|  7.19k|    bool get_opt_required[M_PROPERTY_MAX_ACTION] = {
  153|  7.19k|        [M_PROPERTY_FIXED_LEN_PRINT] = true, [M_PROPERTY_PRINT] = true,
  154|  7.19k|        [M_PROPERTY_PRINT_UNCUT] = true, [M_PROPERTY_GET_STRING] = true,
  155|  7.19k|        [M_PROPERTY_MULTIPLY] = true, [M_PROPERTY_SWITCH] = true,
  156|  7.19k|        [M_PROPERTY_GET_NODE] = true, [M_PROPERTY_SET_NODE] = true,
  157|  7.19k|    };
  158|  7.19k|    if (get_opt_required[action]) {
  ------------------
  |  Branch (158:9): [True: 6.50k, False: 691]
  ------------------
  159|  6.50k|        r = do_action(prop, key, M_PROPERTY_GET_TYPE, &opt, ctx);
  160|  6.50k|        if (r <= 0)
  ------------------
  |  Branch (160:13): [True: 2.30k, False: 4.20k]
  ------------------
  161|  2.30k|            return r;
  162|  4.20k|        mp_assert(opt.type);
  ------------------
  |  |   41|  4.20k|#define mp_assert assert
  ------------------
  |  Branch (162:9): [True: 4.20k, False: 0]
  ------------------
  163|       |        // Make sure dynamic range from properties with M_PROPERTY_GET_CONSTRICTED_TYPE is applied
  164|  4.20k|        struct m_option copt = {0};
  165|  4.20k|        r = do_action(prop, key, M_PROPERTY_GET_CONSTRICTED_TYPE, &copt, ctx);
  166|  4.20k|        if (r == M_PROPERTY_OK) {
  ------------------
  |  Branch (166:13): [True: 383, False: 3.82k]
  ------------------
  167|    383|            opt.min = copt.min;
  168|    383|            opt.max = copt.max;
  169|    383|        }
  170|  4.20k|    }
  171|       |
  172|  4.89k|    switch (action) {
  173|      0|    case M_PROPERTY_PRINT_UNCUT:
  ------------------
  |  Branch (173:5): [True: 0, False: 4.89k]
  ------------------
  174|    808|    case M_PROPERTY_FIXED_LEN_PRINT:
  ------------------
  |  Branch (174:5): [True: 808, False: 4.08k]
  ------------------
  175|  3.66k|    case M_PROPERTY_PRINT: {
  ------------------
  |  Branch (175:5): [True: 2.85k, False: 2.03k]
  ------------------
  176|  3.66k|        if ((r = do_action(prop, key, action, arg, ctx)) >= 0)
  ------------------
  |  Branch (176:13): [True: 1.64k, False: 2.02k]
  ------------------
  177|  1.64k|            return r;
  178|  2.02k|        if (action == M_PROPERTY_PRINT_UNCUT &&
  ------------------
  |  Branch (178:13): [True: 0, False: 2.02k]
  ------------------
  179|      0|            (r = do_action(prop, key, M_PROPERTY_PRINT, arg, ctx)) >= 0)
  ------------------
  |  Branch (179:13): [True: 0, False: 0]
  ------------------
  180|      0|            return r;
  181|       |        // Fallback to m_option
  182|  2.02k|        if ((r = do_action(prop, key, M_PROPERTY_GET, &val, ctx)) <= 0)
  ------------------
  |  Branch (182:13): [True: 131, False: 1.89k]
  ------------------
  183|    131|            return r;
  184|  1.89k|        char *str = m_option_pretty_print(&opt, &val, action == M_PROPERTY_FIXED_LEN_PRINT);
  185|  1.89k|        m_option_free(&opt, &val);
  186|  1.89k|        *(char **)arg = str;
  187|  1.89k|        return str != NULL;
  188|  2.02k|    }
  189|    539|    case M_PROPERTY_GET_STRING: {
  ------------------
  |  Branch (189:5): [True: 539, False: 4.35k]
  ------------------
  190|    539|        if ((r = do_action(prop, key, M_PROPERTY_GET, &val, ctx)) <= 0)
  ------------------
  |  Branch (190:13): [True: 55, False: 484]
  ------------------
  191|     55|            return r;
  192|    484|        char *str = m_option_print(&opt, &val);
  193|    484|        m_option_free(&opt, &val);
  194|    484|        *(char **)arg = str;
  195|    484|        return str != NULL;
  196|    539|    }
  197|      0|    case M_PROPERTY_SET_STRING: {
  ------------------
  |  Branch (197:5): [True: 0, False: 4.89k]
  ------------------
  198|      0|        struct mpv_node node = { .format = MPV_FORMAT_STRING, .u.string = arg };
  199|      0|        return m_property_do(log, prop_list, name, M_PROPERTY_SET_NODE, &node, ctx);
  200|    539|    }
  201|      0|    case M_PROPERTY_MULTIPLY: {
  ------------------
  |  Branch (201:5): [True: 0, False: 4.89k]
  ------------------
  202|      0|        return m_property_multiply(log, prop, key, *(double *)arg, ctx, &opt);
  203|    539|    }
  204|      0|    case M_PROPERTY_SWITCH: {
  ------------------
  |  Branch (204:5): [True: 0, False: 4.89k]
  ------------------
  205|      0|        return m_property_switch(log, prop, key, arg, ctx, &opt);
  206|    539|    }
  207|    271|    case M_PROPERTY_GET_CONSTRICTED_TYPE: {
  ------------------
  |  Branch (207:5): [True: 271, False: 4.62k]
  ------------------
  208|    271|        r = do_action(prop, key, action, arg, ctx);
  209|    271|        if (r >= 0 || r == M_PROPERTY_UNAVAILABLE)
  ------------------
  |  Branch (209:13): [True: 0, False: 271]
  |  Branch (209:23): [True: 0, False: 271]
  ------------------
  210|      0|            return r;
  211|    271|        if ((r = do_action(prop, key, M_PROPERTY_GET_TYPE, arg, ctx)) >= 0)
  ------------------
  |  Branch (211:13): [True: 271, False: 0]
  ------------------
  212|    271|            return r;
  213|      0|        return M_PROPERTY_NOT_IMPLEMENTED;
  214|    271|    }
  215|      0|    case M_PROPERTY_SET: {
  ------------------
  |  Branch (215:5): [True: 0, False: 4.89k]
  ------------------
  216|      0|        return do_action(prop, key, M_PROPERTY_SET, arg, ctx);
  217|    271|    }
  218|      0|    case M_PROPERTY_GET_NODE: {
  ------------------
  |  Branch (218:5): [True: 0, False: 4.89k]
  ------------------
  219|      0|        if ((r = do_action(prop, key, M_PROPERTY_GET_NODE, arg, ctx)) !=
  ------------------
  |  Branch (219:13): [True: 0, False: 0]
  ------------------
  220|      0|            M_PROPERTY_NOT_IMPLEMENTED)
  221|      0|            return r;
  222|      0|        if ((r = do_action(prop, key, M_PROPERTY_GET, &val, ctx)) <= 0)
  ------------------
  |  Branch (222:13): [True: 0, False: 0]
  ------------------
  223|      0|            return r;
  224|      0|        struct mpv_node *node = arg;
  225|      0|        int err = m_option_get_node(&opt, NULL, node, &val);
  226|      0|        if (err == M_OPT_UNKNOWN) {
  ------------------
  |  |  529|      0|#define M_OPT_UNKNOWN           -1
  ------------------
  |  Branch (226:13): [True: 0, False: 0]
  ------------------
  227|      0|            r = M_PROPERTY_NOT_IMPLEMENTED;
  228|      0|        } else if (err < 0) {
  ------------------
  |  Branch (228:20): [True: 0, False: 0]
  ------------------
  229|      0|            r = M_PROPERTY_INVALID_FORMAT;
  230|      0|        } else {
  231|      0|            r = M_PROPERTY_OK;
  232|      0|        }
  233|      0|        m_option_free(&opt, &val);
  234|      0|        return r;
  235|      0|    }
  236|      0|    case M_PROPERTY_SET_NODE: {
  ------------------
  |  Branch (236:5): [True: 0, False: 4.89k]
  ------------------
  237|      0|        if (!log)
  ------------------
  |  Branch (237:13): [True: 0, False: 0]
  ------------------
  238|      0|            return M_PROPERTY_ERROR;
  239|      0|        if ((r = do_action(prop, key, M_PROPERTY_SET_NODE, arg, ctx)) !=
  ------------------
  |  Branch (239:13): [True: 0, False: 0]
  ------------------
  240|      0|            M_PROPERTY_NOT_IMPLEMENTED)
  241|      0|            return r;
  242|      0|        int err = m_option_set_node_or_string(log, &opt, bstr0(name), &val, arg);
  243|      0|        if (err == M_OPT_UNKNOWN) {
  ------------------
  |  |  529|      0|#define M_OPT_UNKNOWN           -1
  ------------------
  |  Branch (243:13): [True: 0, False: 0]
  ------------------
  244|      0|            r = M_PROPERTY_NOT_IMPLEMENTED;
  245|      0|        } else if (err < 0) {
  ------------------
  |  Branch (245:20): [True: 0, False: 0]
  ------------------
  246|      0|            r = M_PROPERTY_INVALID_FORMAT;
  247|      0|        } else {
  248|      0|            r = do_action(prop, key, M_PROPERTY_SET, &val, ctx);
  249|      0|        }
  250|      0|        m_option_free(&opt, &val);
  251|      0|        return r;
  252|      0|    }
  253|    420|    default:
  ------------------
  |  Branch (253:5): [True: 420, False: 4.47k]
  ------------------
  254|    420|        return do_action(prop, key, action, arg, ctx);
  255|  4.89k|    }
  256|  4.89k|}
m_property_split_path:
  259|    391|{
  260|    391|    const char *next = strchr(path, '/');
  261|    391|    if (next) {
  ------------------
  |  Branch (261:9): [True: 74, False: 317]
  ------------------
  262|     74|        *prefix = bstr_splice(bstr0(path), 0, next - path);
  263|     74|        *rem = next + 1;
  264|     74|        return true;
  265|    317|    } else {
  266|    317|        *prefix = bstr0(path);
  267|    317|        *rem = "";
  268|       |        return false;
  269|    317|    }
  270|    391|}
m_properties_expand_string:
  338|  3.28k|{
  339|  3.28k|    char *ret = NULL;
  340|  3.28k|    int ret_len = 0;
  341|  3.28k|    bool skip = false;
  342|  3.28k|    int level = 0, skip_level = 0;
  343|  3.28k|    bstr str = bstr0(str0);
  344|  3.28k|    int last_brace = bstrrchr(str, '}');
  345|  3.28k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  346|  3.28k|    int n = 0;
  347|  3.28k|#endif
  348|       |
  349|  61.6k|    while (str.len) {
  ------------------
  |  Branch (349:12): [True: 58.4k, False: 3.24k]
  ------------------
  350|  58.4k|        if (level > 0 && bstr_eatstart0(&str, "}")) {
  ------------------
  |  Branch (350:13): [True: 11.7k, False: 46.7k]
  |  Branch (350:26): [True: 6.60k, False: 5.09k]
  ------------------
  351|  6.60k|            if (skip && level <= skip_level)
  ------------------
  |  Branch (351:17): [True: 3.61k, False: 2.99k]
  |  Branch (351:25): [True: 3.59k, False: 26]
  ------------------
  352|  3.59k|                skip = false;
  353|  6.60k|            level--;
  354|  51.8k|        } else if (bstr_startswith0(str, "${") && str.start - (unsigned char *)str0 < last_brace) {
  ------------------
  |  Branch (354:20): [True: 8.33k, False: 43.4k]
  |  Branch (354:51): [True: 7.03k, False: 1.30k]
  ------------------
  355|  7.03k|            str = bstr_cut(str, 2);
  356|  7.03k|            level++;
  357|       |
  358|       |            // Assume ":" and "}" can't be part of the property name
  359|       |            // => if ":" comes before "}", it must be for the fallback
  360|  7.03k|            int term_pos = bstrcspn(str, ":}");
  361|  7.03k|            bstr name = bstr_splice(str, 0, term_pos < 0 ? str.len : term_pos);
  ------------------
  |  Branch (361:45): [True: 0, False: 7.03k]
  ------------------
  362|  7.03k|            str = bstr_cut(str, term_pos);
  363|  7.03k|            bool have_fallback = bstr_eatstart0(&str, ":");
  364|       |
  365|  7.03k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  366|  7.03k|            if (n++ > 10)
  ------------------
  |  Branch (366:17): [True: 13, False: 7.01k]
  ------------------
  367|     13|                break;
  368|  7.01k|#endif
  369|       |
  370|  7.01k|            if (!skip) {
  ------------------
  |  Branch (370:17): [True: 6.97k, False: 41]
  ------------------
  371|  6.97k|                skip = expand_property(prop_list, &ret, &ret_len, name,
  372|  6.97k|                                       have_fallback, ctx, print_action);
  373|  6.97k|                if (skip)
  ------------------
  |  Branch (373:21): [True: 3.60k, False: 3.37k]
  ------------------
  374|  3.60k|                    skip_level = level;
  375|  6.97k|            }
  376|  44.7k|        } else if (level == 0 && bstr_eatstart0(&str, "$>")) {
  ------------------
  |  Branch (376:20): [True: 40.1k, False: 4.62k]
  |  Branch (376:34): [True: 29, False: 40.1k]
  ------------------
  377|     29|            append_str(&ret, &ret_len, str);
  378|     29|            break;
  379|  44.7k|        } else {
  380|  44.7k|            char c;
  381|       |
  382|       |            // Other combinations, e.g. "$x", are added verbatim
  383|  44.7k|            if (bstr_eatstart0(&str, "$$")) {
  ------------------
  |  Branch (383:17): [True: 247, False: 44.4k]
  ------------------
  384|    247|                c = '$';
  385|  44.4k|            } else if (bstr_eatstart0(&str, "$}")) {
  ------------------
  |  Branch (385:24): [True: 252, False: 44.2k]
  ------------------
  386|    252|                c = '}';
  387|  44.2k|            } else {
  388|  44.2k|                c = str.start[0];
  389|  44.2k|                str = bstr_cut(str, 1);
  390|  44.2k|            }
  391|       |
  392|  44.7k|            if (!skip)
  ------------------
  |  Branch (392:17): [True: 42.8k, False: 1.90k]
  ------------------
  393|  42.8k|                MP_TARRAY_APPEND(NULL, ret, ret_len, c);
  ------------------
  |  |  105|  42.8k|    do {                                            \
  |  |  106|  42.8k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  42.8k|    do {                                            \
  |  |  |  |   97|  42.8k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  42.8k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  42.8k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  42.8k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 3.22k, False: 39.6k]
  |  |  |  |  ------------------
  |  |  |  |   99|  42.8k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  3.22k|    do {                                                        \
  |  |  |  |  |  |   89|  3.22k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  3.22k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  3.22k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  3.22k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  3.22k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  3.22k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  3.22k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 3.22k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  42.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 42.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  42.8k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  42.8k|        (idxvar)++;                                 \
  |  |  109|  42.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 42.8k]
  |  |  ------------------
  ------------------
  394|  44.7k|        }
  395|  58.4k|    }
  396|       |
  397|  3.28k|    MP_TARRAY_APPEND(NULL, ret, ret_len, '\0');
  ------------------
  |  |  105|  3.28k|    do {                                            \
  |  |  106|  3.28k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  3.28k|    do {                                            \
  |  |  |  |   97|  3.28k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  3.28k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  3.28k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  3.28k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 973, False: 2.31k]
  |  |  |  |  ------------------
  |  |  |  |   99|  3.28k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|    973|    do {                                                        \
  |  |  |  |  |  |   89|    973|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|    973|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|    973|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|    973|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    973|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|    973|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|    973|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 973]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  3.28k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 3.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  3.28k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  3.28k|        (idxvar)++;                                 \
  |  |  109|  3.28k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 3.28k]
  |  |  ------------------
  ------------------
  398|  3.28k|    return ret;
  399|  3.28k|}
m_properties_print_help_list:
  403|      4|{
  404|      4|    mp_info(log, "Name\n\n");
  ------------------
  |  |   78|      4|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  405|  3.71k|    for (int i = 0; i < list->num; i++)
  ------------------
  |  Branch (405:21): [True: 3.70k, False: 4]
  ------------------
  406|  3.70k|        mp_info(log, " %s\n", list->props[i].name);
  ------------------
  |  |   78|  3.70k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  407|      4|    mp_info(log, "\nTotal: %d properties\n", list->num);
  ------------------
  |  |   78|      4|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  408|      4|}
m_property_bool_ro:
  411|    315|{
  412|    315|    switch (action) {
  ------------------
  |  Branch (412:13): [True: 148, False: 167]
  ------------------
  413|     74|    case M_PROPERTY_GET:
  ------------------
  |  Branch (413:5): [True: 74, False: 241]
  ------------------
  414|     74|        *(bool *)arg = !!var;
  415|     74|        return M_PROPERTY_OK;
  416|     74|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (416:5): [True: 74, False: 241]
  ------------------
  417|     74|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_BOOL};
  ------------------
  |  |  238|     74|#define CONF_TYPE_BOOL          (&m_option_type_bool)
  ------------------
  418|     74|        return M_PROPERTY_OK;
  419|    315|    }
  420|    167|    return M_PROPERTY_NOT_IMPLEMENTED;
  421|    315|}
m_property_int_ro:
  424|    213|{
  425|    213|    switch (action) {
  ------------------
  |  Branch (425:13): [True: 106, False: 107]
  ------------------
  426|     53|    case M_PROPERTY_GET:
  ------------------
  |  Branch (426:5): [True: 53, False: 160]
  ------------------
  427|     53|        *(int *)arg = var;
  428|     53|        return M_PROPERTY_OK;
  429|     53|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (429:5): [True: 53, False: 160]
  ------------------
  430|     53|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_INT};
  ------------------
  |  |  240|     53|#define CONF_TYPE_INT           (&m_option_type_int)
  ------------------
  431|     53|        return M_PROPERTY_OK;
  432|    213|    }
  433|    107|    return M_PROPERTY_NOT_IMPLEMENTED;
  434|    213|}
m_property_int64_ro:
  437|    147|{
  438|    147|    switch (action) {
  ------------------
  |  Branch (438:13): [True: 72, False: 75]
  ------------------
  439|     36|    case M_PROPERTY_GET:
  ------------------
  |  Branch (439:5): [True: 36, False: 111]
  ------------------
  440|     36|        *(int64_t *)arg = var;
  441|     36|        return M_PROPERTY_OK;
  442|     36|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (442:5): [True: 36, False: 111]
  ------------------
  443|     36|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_INT64};
  ------------------
  |  |  241|     36|#define CONF_TYPE_INT64         (&m_option_type_int64)
  ------------------
  444|     36|        return M_PROPERTY_OK;
  445|    147|    }
  446|     75|    return M_PROPERTY_NOT_IMPLEMENTED;
  447|    147|}
m_property_strdup_ro:
  476|    542|{
  477|    542|    if (!var)
  ------------------
  |  Branch (477:9): [True: 75, False: 467]
  ------------------
  478|     75|        return M_PROPERTY_UNAVAILABLE;
  479|    467|    switch (action) {
  ------------------
  |  Branch (479:13): [True: 238, False: 229]
  ------------------
  480|    119|    case M_PROPERTY_GET:
  ------------------
  |  Branch (480:5): [True: 119, False: 348]
  ------------------
  481|    119|        *(char **)arg = talloc_strdup(NULL, var);
  ------------------
  |  |   50|    119|#define talloc_strdup                   ta_xstrdup
  ------------------
  482|    119|        return M_PROPERTY_OK;
  483|    119|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (483:5): [True: 119, False: 348]
  ------------------
  484|    119|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING};
  ------------------
  |  |  244|    119|#define CONF_TYPE_STRING        (&m_option_type_string)
  ------------------
  485|    119|        return M_PROPERTY_OK;
  486|    467|    }
  487|    229|    return M_PROPERTY_NOT_IMPLEMENTED;
  488|    467|}
m_property_read_sub_validate:
  492|  2.94k|{
  493|  2.94k|    m_property_unkey(&action, &arg);
  494|  2.94k|    switch (action) {
  495|    581|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (495:5): [True: 581, False: 2.36k]
  ------------------
  496|    581|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE};
  ------------------
  |  |  253|    581|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
  497|    581|        return M_PROPERTY_OK;
  498|    326|    case M_PROPERTY_GET:
  ------------------
  |  Branch (498:5): [True: 326, False: 2.62k]
  ------------------
  499|    597|    case M_PROPERTY_PRINT:
  ------------------
  |  Branch (499:5): [True: 271, False: 2.67k]
  ------------------
  500|  1.54k|    case M_PROPERTY_KEY_ACTION:
  ------------------
  |  Branch (500:5): [True: 943, False: 2.00k]
  ------------------
  501|  1.54k|        return M_PROPERTY_VALID;
  502|    825|    default:
  ------------------
  |  Branch (502:5): [True: 825, False: 2.12k]
  ------------------
  503|    825|        return M_PROPERTY_NOT_IMPLEMENTED;
  504|  2.94k|    };
  505|      0|}
m_property_read_sub:
  512|   136k|{
  513|   136k|    m_property_unkey(&action, &arg);
  514|   136k|    switch (action) {
  ------------------
  |  Branch (514:13): [True: 136k, False: 316]
  ------------------
  515|    285|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (515:5): [True: 285, False: 136k]
  ------------------
  516|    285|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE};
  ------------------
  |  |  253|    285|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
  517|    285|        return M_PROPERTY_OK;
  518|    152|    case M_PROPERTY_GET:
  ------------------
  |  Branch (518:5): [True: 152, False: 136k]
  ------------------
  519|  63.8k|    case M_PROPERTY_GET_NODE: {
  ------------------
  |  Branch (519:5): [True: 63.7k, False: 73.1k]
  ------------------
  520|  63.8k|        struct mpv_node node;
  521|  63.8k|        node.format = MPV_FORMAT_NODE_MAP;
  522|  63.8k|        node.u.list = talloc_zero(NULL, mpv_node_list);
  ------------------
  |  |   27|  63.8k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  63.8k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  63.8k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  523|  63.8k|        mpv_node_list *list = node.u.list;
  524|   283k|        for (int n = 0; props && props[n].name; n++) {
  ------------------
  |  Branch (524:25): [True: 283k, False: 0]
  |  Branch (524:34): [True: 219k, False: 63.8k]
  ------------------
  525|   219k|            const struct m_sub_property *prop = &props[n];
  526|   219k|            if (prop->unavailable)
  ------------------
  |  Branch (526:17): [True: 36.5k, False: 182k]
  ------------------
  527|  36.5k|                continue;
  528|   182k|            MP_TARRAY_GROW(list, list->values, list->num);
  ------------------
  |  |   96|   182k|    do {                                            \
  |  |   97|   182k|        size_t nextidx_ = (nextidx);                \
  |  |   98|   182k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  ------------------
  |  |  |  |   84|   182k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|   182k|#define talloc_get_size                 ta_get_size
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 118k, False: 64.1k]
  |  |  ------------------
  |  |   99|   182k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  ------------------
  |  |  |  |   88|   118k|    do {                                                        \
  |  |  |  |   89|   118k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   118k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   118k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|   118k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|   118k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   90|   118k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |   91|   118k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (91:14): [Folded, False: 118k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  100|   182k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (100:14): [Folded, False: 182k]
  |  |  ------------------
  ------------------
  529|   182k|            MP_TARRAY_GROW(list, list->keys, list->num);
  ------------------
  |  |   96|   182k|    do {                                            \
  |  |   97|   182k|        size_t nextidx_ = (nextidx);                \
  |  |   98|   182k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  ------------------
  |  |  |  |   84|   182k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|   182k|#define talloc_get_size                 ta_get_size
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 118k, False: 64.1k]
  |  |  ------------------
  |  |   99|   182k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  ------------------
  |  |  |  |   88|   118k|    do {                                                        \
  |  |  |  |   89|   118k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|   118k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|   118k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|   118k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|   118k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   90|   118k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |   91|   118k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (91:14): [Folded, False: 118k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  100|   182k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (100:14): [Folded, False: 182k]
  |  |  ------------------
  ------------------
  530|   182k|            mpv_node *val = &list->values[list->num];
  531|   182k|            if (m_option_get_node(&prop->type, list, val, (void*)&prop->value) < 0)
  ------------------
  |  Branch (531:17): [True: 0, False: 182k]
  ------------------
  532|      0|            {
  533|      0|                char *s = m_option_print(&prop->type, &prop->value);
  534|      0|                val->format = MPV_FORMAT_STRING;
  535|      0|                val->u.string = talloc_steal(list, s);
  ------------------
  |  |   38|      0|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|      0|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
  536|      0|            }
  537|   182k|            list->keys[list->num] = (char *)prop->name;
  538|   182k|            list->num++;
  539|   182k|        }
  540|  63.8k|        *(struct mpv_node *)arg = node;
  541|  63.8k|        return M_PROPERTY_OK;
  542|    152|    }
  543|  71.6k|    case M_PROPERTY_PRINT: {
  ------------------
  |  Branch (543:5): [True: 71.6k, False: 65.2k]
  ------------------
  544|       |        // Output "something" - what it really should return is not yet decided.
  545|       |        // It should probably be something that is easy to consume by slave
  546|       |        // mode clients. (M_PROPERTY_PRINT on the other hand can return this
  547|       |        // as human readable version just fine).
  548|  71.6k|        char *res = NULL;
  549|   286k|        for (int n = 0; props && props[n].name; n++) {
  ------------------
  |  Branch (549:25): [True: 286k, False: 0]
  |  Branch (549:34): [True: 215k, False: 71.6k]
  ------------------
  550|   215k|            const struct m_sub_property *prop = &props[n];
  551|   215k|            if (prop->unavailable)
  ------------------
  |  Branch (551:17): [True: 241, False: 214k]
  ------------------
  552|    241|                continue;
  553|   214k|            char *s = m_option_print(&prop->type, &prop->value);
  554|   214k|            ta_xasprintf_append(&res, "%s=%s\n", prop->name, s);
  ------------------
  |  |  129|   214k|#define ta_xasprintf_append(...)        ta_oom_b(ta_asprintf_append(__VA_ARGS__))
  ------------------
  555|   214k|            talloc_free(s);
  ------------------
  |  |   47|   214k|#define talloc_free                     ta_free
  ------------------
  556|   214k|        }
  557|  71.6k|        *(char **)arg = res;
  558|  71.6k|        return M_PROPERTY_OK;
  559|    152|    }
  560|    751|    case M_PROPERTY_KEY_ACTION: {
  ------------------
  |  Branch (560:5): [True: 751, False: 136k]
  ------------------
  561|    751|        struct m_property_action_arg *ka = arg;
  562|    751|        const struct m_sub_property *prop = NULL;
  563|  2.51k|        for (int n = 0; props && props[n].name; n++) {
  ------------------
  |  Branch (563:25): [True: 2.51k, False: 0]
  |  Branch (563:34): [True: 2.38k, False: 130]
  ------------------
  564|  2.38k|            if (strcmp(props[n].name, ka->key) == 0) {
  ------------------
  |  Branch (564:17): [True: 621, False: 1.76k]
  ------------------
  565|    621|                prop = &props[n];
  566|    621|                break;
  567|    621|            }
  568|  2.38k|        }
  569|    751|        if (!prop)
  ------------------
  |  Branch (569:13): [True: 130, False: 621]
  ------------------
  570|    130|            return M_PROPERTY_UNKNOWN;
  571|    621|        if (prop->unavailable)
  ------------------
  |  Branch (571:13): [True: 153, False: 468]
  ------------------
  572|    153|            return M_PROPERTY_UNAVAILABLE;
  573|    468|        switch (ka->action) {
  ------------------
  |  Branch (573:17): [True: 268, False: 200]
  ------------------
  574|     73|        case M_PROPERTY_GET: {
  ------------------
  |  Branch (574:9): [True: 73, False: 395]
  ------------------
  575|     73|            memset(ka->arg, 0, prop->type.type->size);
  576|     73|            m_option_copy(&prop->type, ka->arg, &prop->value);
  577|     73|            return M_PROPERTY_OK;
  578|      0|        }
  579|    195|        case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (579:9): [True: 195, False: 273]
  ------------------
  580|    195|            *(struct m_option *)ka->arg = prop->type;
  581|    195|            return M_PROPERTY_OK;
  582|    468|        }
  583|    468|    }
  584|   136k|    }
  585|    516|    return M_PROPERTY_NOT_IMPLEMENTED;
  586|   136k|}
m_property_read_list:
  599|  3.33k|{
  600|  3.33k|    m_property_unkey(&action, &arg);
  601|  3.33k|    switch (action) {
  ------------------
  |  Branch (601:13): [True: 2.75k, False: 584]
  ------------------
  602|    442|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (602:5): [True: 442, False: 2.89k]
  ------------------
  603|    442|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE};
  ------------------
  |  |  253|    442|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
  604|    442|        return M_PROPERTY_OK;
  605|    389|    case M_PROPERTY_GET:
  ------------------
  |  Branch (605:5): [True: 389, False: 2.94k]
  ------------------
  606|    389|    case M_PROPERTY_GET_NODE: {
  ------------------
  |  Branch (606:5): [True: 0, False: 3.33k]
  ------------------
  607|    389|        struct mpv_node node;
  608|    389|        node.format = MPV_FORMAT_NODE_ARRAY;
  609|    389|        node.u.list = talloc_zero(NULL, mpv_node_list);
  ------------------
  |  |   27|    389|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|    389|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|    389|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  610|    389|        node.u.list->num = count;
  611|    389|        node.u.list->values = talloc_array(node.u.list, mpv_node, count);
  ------------------
  |  |   29|    389|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|    389|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|    389|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  612|  64.1k|        for (int n = 0; n < count; n++) {
  ------------------
  |  Branch (612:25): [True: 63.7k, False: 389]
  ------------------
  613|  63.7k|            struct mpv_node *sub = &node.u.list->values[n];
  614|  63.7k|            sub->format = MPV_FORMAT_NONE;
  615|  63.7k|            int r;
  616|  63.7k|            r = get_item(n, M_PROPERTY_GET_NODE, sub, ctx);
  617|  63.7k|            if (r >= 0) {
  ------------------
  |  Branch (617:17): [True: 63.7k, False: 0]
  ------------------
  618|  63.7k|                talloc_steal(node.u.list, node_get_alloc(sub));
  ------------------
  |  |   38|  63.7k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  63.7k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
  619|  63.7k|            } else if (r == M_PROPERTY_NOT_IMPLEMENTED) {
  ------------------
  |  Branch (619:24): [True: 0, False: 0]
  ------------------
  620|      0|                struct m_option opt = {0};
  621|      0|                r = get_item(n, M_PROPERTY_GET_TYPE, &opt, ctx);
  622|      0|                if (r != M_PROPERTY_OK)
  ------------------
  |  Branch (622:21): [True: 0, False: 0]
  ------------------
  623|      0|                    goto err;
  624|      0|                union m_option_value val = m_option_value_default;
  625|      0|                r = get_item(n, M_PROPERTY_GET, &val, ctx);
  626|      0|                if (r != M_PROPERTY_OK)
  ------------------
  |  Branch (626:21): [True: 0, False: 0]
  ------------------
  627|      0|                    goto err;
  628|      0|                m_option_get_node(&opt, node.u.list, sub, &val);
  629|      0|                m_option_free(&opt, &val);
  630|      0|            err: ;
  631|      0|            }
  632|  63.7k|        }
  633|    389|        *(struct mpv_node *)arg = node;
  634|    389|        return M_PROPERTY_OK;
  635|    389|    }
  636|    214|    case M_PROPERTY_PRINT: {
  ------------------
  |  Branch (636:5): [True: 214, False: 3.12k]
  ------------------
  637|       |        // See m_property_read_sub() remarks.
  638|    214|        char *res = NULL;
  639|  71.6k|        for (int n = 0; n < count; n++) {
  ------------------
  |  Branch (639:25): [True: 71.3k, False: 214]
  ------------------
  640|  71.3k|            char *s = NULL;
  641|  71.3k|            int r = get_item(n, M_PROPERTY_PRINT, &s, ctx);
  642|  71.3k|            if (r != M_PROPERTY_OK) {
  ------------------
  |  Branch (642:17): [True: 0, False: 71.3k]
  ------------------
  643|      0|                talloc_free(res);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  644|      0|                return r;
  645|      0|            }
  646|  71.3k|            ta_xasprintf_append(&res, "%d: %s\n", n, s);
  ------------------
  |  |  129|  71.3k|#define ta_xasprintf_append(...)        ta_oom_b(ta_asprintf_append(__VA_ARGS__))
  ------------------
  647|  71.3k|            talloc_free(s);
  ------------------
  |  |   47|  71.3k|#define talloc_free                     ta_free
  ------------------
  648|  71.3k|        }
  649|    214|        *(char **)arg = res;
  650|    214|        return M_PROPERTY_OK;
  651|    214|    }
  652|  1.70k|    case M_PROPERTY_KEY_ACTION: {
  ------------------
  |  Branch (652:5): [True: 1.70k, False: 1.62k]
  ------------------
  653|  1.70k|        struct m_property_action_arg *ka = arg;
  654|  1.70k|        if (strcmp(ka->key, "count") == 0) {
  ------------------
  |  Branch (654:13): [True: 288, False: 1.41k]
  ------------------
  655|    288|            switch (ka->action) {
  ------------------
  |  Branch (655:21): [True: 165, False: 123]
  ------------------
  656|    123|            case M_PROPERTY_GET_TYPE: {
  ------------------
  |  Branch (656:13): [True: 123, False: 165]
  ------------------
  657|    123|                struct m_option opt = {.type = CONF_TYPE_INT};
  ------------------
  |  |  240|    123|#define CONF_TYPE_INT           (&m_option_type_int)
  ------------------
  658|    123|                *(struct m_option *)ka->arg = opt;
  659|    123|                return M_PROPERTY_OK;
  660|      0|            }
  661|     42|            case M_PROPERTY_GET:
  ------------------
  |  Branch (661:13): [True: 42, False: 246]
  ------------------
  662|     42|                *(int *)ka->arg = MPMAX(0, count);
  ------------------
  |  |   44|     42|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 42]
  |  |  ------------------
  ------------------
  663|     42|                return M_PROPERTY_OK;
  664|    288|            }
  665|    123|            return M_PROPERTY_NOT_IMPLEMENTED;
  666|    288|        }
  667|       |        // This is expected of the form "123" or "123/rest"
  668|  1.41k|        char *end;
  669|  1.41k|        long int item = strtol(ka->key, &end, 10);
  670|       |        // not a number, trailing characters, etc.
  671|  1.41k|        if (end == ka->key || (end[0] == '/' && !end[1]))
  ------------------
  |  Branch (671:13): [True: 158, False: 1.26k]
  |  Branch (671:32): [True: 62, False: 1.19k]
  |  Branch (671:49): [True: 20, False: 42]
  ------------------
  672|    178|            return M_PROPERTY_UNKNOWN;
  673|  1.24k|        if (item < 0 || item >= count)
  ------------------
  |  Branch (673:13): [True: 90, False: 1.15k]
  |  Branch (673:25): [True: 128, False: 1.02k]
  ------------------
  674|    218|            return M_PROPERTY_UNKNOWN;
  675|  1.02k|        if (*end) {
  ------------------
  |  Branch (675:13): [True: 539, False: 483]
  ------------------
  676|       |            // Sub-path
  677|    539|            struct m_property_action_arg n_ka = *ka;
  678|    539|            n_ka.key = end + 1;
  679|    539|            return get_item(item, M_PROPERTY_KEY_ACTION, &n_ka, ctx);
  680|    539|        } else {
  681|       |            // Direct query
  682|    483|            return get_item(item, ka->action, ka->arg, ctx);
  683|    483|        }
  684|  1.02k|    }
  685|  3.33k|    }
  686|    584|    return M_PROPERTY_NOT_IMPLEMENTED;
  687|  3.33k|}
m_property.c:compare_prop_name:
   39|   124M|{
   40|   124M|    const struct m_property *a = pa, *b = pb;
   41|   124M|    return strcmp(a->name, b->name);
   42|   124M|}
m_property.c:find_prop:
   57|  7.88k|{
   58|  7.88k|    return bsearch(&name, list->props, list->num, sizeof(list->props[0]),
   59|  7.88k|                   search_prop_name);
   60|  7.88k|}
m_property.c:search_prop_name:
   50|  73.0k|{
   51|  73.0k|    const struct m_property *prop = pelem;
   52|  73.0k|    return bstrcmp0(*(const bstr *)pkey, prop->name);
   53|  73.0k|}
m_property.c:resolve_name:
   72|  7.88k|{
   73|  7.88k|    *key = NULL;
   74|  7.88k|    const char *sep = strchr(name, '/');
   75|  7.88k|    if (sep && sep[1]) {
  ------------------
  |  Branch (75:9): [True: 2.19k, False: 5.69k]
  |  Branch (75:16): [True: 2.17k, False: 22]
  ------------------
   76|  2.17k|        *key = sep + 1;
   77|  2.17k|        return find_prop(list, bstr_splice(bstr0(name), 0, sep - name));
   78|  2.17k|    }
   79|  5.71k|    return find_prop(list, bstr0(name));
   80|  7.88k|}
m_property.c:do_action:
   84|  17.8k|{
   85|  17.8k|    if (key) {
  ------------------
  |  Branch (85:9): [True: 3.52k, False: 14.3k]
  ------------------
   86|  3.52k|        struct m_property_action_arg ka = {
   87|  3.52k|            .key = key,
   88|  3.52k|            .action = action,
   89|  3.52k|            .arg = arg,
   90|  3.52k|        };
   91|  3.52k|        return prop->call(ctx, prop, M_PROPERTY_KEY_ACTION, &ka);
   92|  3.52k|    }
   93|  14.3k|    return prop->call(ctx, prop, action, arg);
   94|  17.8k|}
m_property.c:expand_property:
  305|  6.97k|{
  306|  6.97k|    bool cond_yes = bstr_eatstart0(&prop, "?");
  307|  6.97k|    bool cond_no = !cond_yes && bstr_eatstart0(&prop, "!");
  ------------------
  |  Branch (307:20): [True: 6.38k, False: 587]
  |  Branch (307:33): [True: 90, False: 6.29k]
  ------------------
  308|  6.97k|    bool test = cond_yes || cond_no;
  ------------------
  |  Branch (308:17): [True: 587, False: 6.38k]
  |  Branch (308:29): [True: 90, False: 6.29k]
  ------------------
  309|  6.97k|    bool raw = bstr_eatstart0(&prop, "=");
  310|  6.97k|    bool fixed_len = !raw && bstr_eatstart0(&prop, ">");
  ------------------
  |  Branch (310:22): [True: 6.75k, False: 219]
  |  Branch (310:30): [True: 1.01k, False: 5.74k]
  ------------------
  311|  6.97k|    bstr comp_with = {0};
  312|  6.97k|    bool comp = test && bstr_split_tok(prop, "==", &prop, &comp_with);
  ------------------
  |  Branch (312:17): [True: 677, False: 6.29k]
  |  Branch (312:25): [True: 194, False: 483]
  ------------------
  313|  6.97k|    if (test && !comp)
  ------------------
  |  Branch (313:9): [True: 677, False: 6.29k]
  |  Branch (313:17): [True: 483, False: 194]
  ------------------
  314|    483|        raw = true;
  315|  6.97k|    int method = raw ? M_PROPERTY_GET_STRING : print_action;
  ------------------
  |  Branch (315:18): [True: 702, False: 6.27k]
  ------------------
  316|  6.97k|    method = fixed_len ? M_PROPERTY_FIXED_LEN_PRINT : method;
  ------------------
  |  Branch (316:14): [True: 1.01k, False: 5.96k]
  ------------------
  317|       |
  318|  6.97k|    char *s = NULL;
  319|  6.97k|    int r = m_property_do_bstr(prop_list, prop, method, &s, ctx);
  320|  6.97k|    bool skip;
  321|  6.97k|    if (comp) {
  ------------------
  |  Branch (321:9): [True: 194, False: 6.78k]
  ------------------
  322|    194|        skip = ((s && bstr_equals0(comp_with, s)) != cond_yes);
  ------------------
  |  Branch (322:18): [True: 134, False: 60]
  |  Branch (322:23): [True: 0, False: 134]
  ------------------
  323|  6.78k|    } else if (test) {
  ------------------
  |  Branch (323:16): [True: 483, False: 6.29k]
  ------------------
  324|    483|        skip = (!!s != cond_yes);
  325|  6.29k|    } else {
  326|  6.29k|        skip = !!s;
  327|  6.29k|        char *append = s;
  328|  6.29k|        if (!s && !silent_error && !raw)
  ------------------
  |  Branch (328:13): [True: 3.04k, False: 3.25k]
  |  Branch (328:19): [True: 2.46k, False: 580]
  |  Branch (328:36): [True: 2.38k, False: 84]
  ------------------
  329|  2.38k|            append = (r == M_PROPERTY_UNAVAILABLE) ? "(unavailable)" : "(error)";
  ------------------
  |  Branch (329:22): [True: 1.12k, False: 1.25k]
  ------------------
  330|  6.29k|        append_str(ret, ret_len, bstr0(append));
  331|  6.29k|    }
  332|  6.97k|    talloc_free(s);
  ------------------
  |  |   47|  6.97k|#define talloc_free                     ta_free
  ------------------
  333|  6.97k|    return skip;
  334|  6.97k|}
m_property.c:m_property_do_bstr:
  287|  6.97k|{
  288|  6.97k|    char *name0 = bstrdup0(NULL, name);
  289|  6.97k|    int ret = m_property_do(NULL, prop_list, name0, action, arg, ctx);
  290|  6.97k|    talloc_free(name0);
  ------------------
  |  |   47|  6.97k|#define talloc_free                     ta_free
  ------------------
  291|  6.97k|    return ret;
  292|  6.97k|}
m_property.c:append_str:
  295|  6.32k|{
  296|  6.32k|    MP_TARRAY_GROW(NULL, *s, *len + append.len);
  ------------------
  |  |   96|  6.32k|    do {                                            \
  |  |   97|  6.32k|        size_t nextidx_ = (nextidx);                \
  |  |   98|  6.32k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  ------------------
  |  |  |  |   84|  6.32k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  6.32k|#define talloc_get_size                 ta_get_size
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 2.96k, False: 3.35k]
  |  |  ------------------
  |  |   99|  6.32k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  ------------------
  |  |  |  |   88|  2.96k|    do {                                                        \
  |  |  |  |   89|  2.96k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|  2.96k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|  2.96k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|  2.96k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|  2.96k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   90|  2.96k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |   91|  2.96k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (91:14): [Folded, False: 2.96k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  100|  6.32k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (100:14): [Folded, False: 6.32k]
  |  |  ------------------
  ------------------
  297|  6.32k|    if (append.len)
  ------------------
  |  Branch (297:9): [True: 5.52k, False: 802]
  ------------------
  298|  5.52k|        memcpy(*s + *len, append.start, append.len);
  299|  6.32k|    *len = *len + append.len;
  300|  6.32k|}
m_property.c:m_property_unkey:
  275|   143k|{
  276|   143k|    if (*action == M_PROPERTY_KEY_ACTION) {
  ------------------
  |  Branch (276:9): [True: 3.74k, False: 139k]
  ------------------
  277|  3.74k|        struct m_property_action_arg *ka = *arg;
  278|  3.74k|        if (!ka->key[0]) {
  ------------------
  |  Branch (278:13): [True: 342, False: 3.40k]
  ------------------
  279|    342|            *action = ka->action;
  280|    342|            *arg = ka->arg;
  281|    342|        }
  282|  3.74k|    }
  283|   143k|}

options.c:print_version:
   56|    873|{
   57|       |    mp_print_version(log, true);
   58|    873|}

m_config_parse_mp_command_line:
  124|  16.4k|{
  125|  16.4k|    int ret = M_OPT_UNKNOWN;
  ------------------
  |  |  529|  16.4k|#define M_OPT_UNKNOWN           -1
  ------------------
  126|  16.4k|    int mode = 0;
  127|  16.4k|    struct playlist_entry *local_start = NULL;
  128|       |
  129|  16.4k|    int local_params_count = 0;
  130|  16.4k|    struct playlist_param *local_params = 0;
  131|       |
  132|  16.4k|    mp_assert(config != NULL);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (132:5): [True: 16.4k, False: 0]
  ------------------
  133|       |
  134|  16.4k|    mode = GLOBAL;
  ------------------
  |  |   34|  16.4k|#define GLOBAL 0
  ------------------
  135|       |
  136|  16.4k|    struct parse_state p = {config, argv, config->log};
  137|   138k|    while (split_opt(&p)) {
  ------------------
  |  Branch (137:12): [True: 126k, False: 11.5k]
  ------------------
  138|   126k|        if (p.is_opt) {
  ------------------
  |  Branch (138:13): [True: 71.6k, False: 54.9k]
  ------------------
  139|  71.6k|            int flags = M_SETOPT_FROM_CMDLINE;
  140|  71.6k|            if (mode == LOCAL)
  ------------------
  |  |   35|  71.6k|#define LOCAL 1
  ------------------
  |  Branch (140:17): [True: 6.89k, False: 64.7k]
  ------------------
  141|  6.89k|                flags |= M_SETOPT_BACKUP | M_SETOPT_CHECK_ONLY;
  142|  71.6k|            int r = m_config_set_option_cli(config, p.arg, p.param, flags);
  143|  71.6k|            if (r == M_OPT_EXIT) {
  ------------------
  |  |  545|  71.6k|#define M_OPT_EXIT              -6
  ------------------
  |  Branch (143:17): [True: 407, False: 71.2k]
  ------------------
  144|    407|                ret = r;
  145|    407|                goto err_out;
  146|  71.2k|            } else if (r < 0) {
  ------------------
  |  Branch (146:24): [True: 4.45k, False: 66.7k]
  ------------------
  147|  4.45k|                MP_FATAL(config, "Setting commandline option --%.*s=%.*s failed.\n",
  ------------------
  |  |   88|  4.45k|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  17.8k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 4.45k, False: 0]
  |  |  |  |  |  Branch (86:57): [True: 4.45k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  148|  4.45k|                         BSTR_P(p.arg), BSTR_P(p.param));
  149|  4.45k|                goto err_out;
  150|  4.45k|            }
  151|       |
  152|       |            // Handle some special arguments outside option parser.
  153|       |
  154|  66.7k|            if (!bstrcmp0(p.arg, "{")) {
  ------------------
  |  Branch (154:17): [True: 1.22k, False: 65.5k]
  ------------------
  155|  1.22k|                if (mode != GLOBAL) {
  ------------------
  |  |   34|  1.22k|#define GLOBAL 0
  ------------------
  |  Branch (155:21): [True: 1, False: 1.22k]
  ------------------
  156|      1|                    MP_ERR(config, "'--{' can not be nested.\n");
  ------------------
  |  |   89|      1|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      1|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  157|      1|                    goto err_out;
  158|      1|                }
  159|  1.22k|                mode = LOCAL;
  ------------------
  |  |   35|  1.22k|#define LOCAL 1
  ------------------
  160|  1.22k|                mp_assert(!local_start);
  ------------------
  |  |   41|  1.22k|#define mp_assert assert
  ------------------
  |  Branch (160:17): [True: 1.22k, False: 0]
  ------------------
  161|  1.22k|                local_start = playlist_get_last(files);
  162|  1.22k|                continue;
  163|  1.22k|            }
  164|       |
  165|  65.5k|            if (!bstrcmp0(p.arg, "}")) {
  ------------------
  |  Branch (165:17): [True: 1.12k, False: 64.4k]
  ------------------
  166|  1.12k|                if (mode != LOCAL) {
  ------------------
  |  |   35|  1.12k|#define LOCAL 1
  ------------------
  |  Branch (166:21): [True: 11, False: 1.11k]
  ------------------
  167|     11|                    MP_ERR(config, "Too many closing '--}'.\n");
  ------------------
  |  |   89|     11|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     11|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  168|     11|                    goto err_out;
  169|     11|                }
  170|  1.11k|                if (local_params_count) {
  ------------------
  |  Branch (170:21): [True: 561, False: 549]
  ------------------
  171|       |                    // The files added between '{' and '}' are the entries from
  172|       |                    // the entry _after_ local_start, until the end of the list.
  173|       |                    // If local_start is NULL, the list was empty on '{', and we
  174|       |                    // want all files in the list.
  175|    561|                    struct playlist_entry *cur = local_start
  ------------------
  |  Branch (175:50): [True: 262, False: 299]
  ------------------
  176|    561|                        ? playlist_entry_get_rel(local_start, 1)
  177|    561|                        : playlist_get_first(files);
  178|    561|                    if (!cur)
  ------------------
  |  Branch (178:25): [True: 442, False: 119]
  ------------------
  179|    561|                        MP_WARN(config, "Ignored options!\n");
  ------------------
  |  |   90|    442|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    442|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  180|  2.21k|                    while (cur) {
  ------------------
  |  Branch (180:28): [True: 1.65k, False: 561]
  ------------------
  181|  1.65k|                        playlist_entry_add_params(cur, local_params,
  182|  1.65k|                                                local_params_count);
  183|  1.65k|                        cur = playlist_entry_get_rel(cur, 1);
  184|  1.65k|                    }
  185|    561|                }
  186|  1.11k|                local_params_count = 0;
  187|  1.11k|                mode = GLOBAL;
  ------------------
  |  |   34|  1.11k|#define GLOBAL 0
  ------------------
  188|  1.11k|                m_config_restore_backups(config);
  189|  1.11k|                local_start = NULL;
  190|  1.11k|                continue;
  191|  1.12k|            }
  192|       |
  193|  64.4k|            if (bstrcmp0(p.arg, "playlist") == 0) {
  ------------------
  |  Branch (193:17): [True: 0, False: 64.4k]
  ------------------
  194|       |                // append the playlist to the local args
  195|      0|                char *param0 = bstrdup0(NULL, p.param);
  196|      0|                struct playlist *pl = playlist_parse_file(param0, NULL, global);
  197|      0|                if (!pl) {
  ------------------
  |  Branch (197:21): [True: 0, False: 0]
  ------------------
  198|      0|                    MP_FATAL(config, "Error reading playlist '%.*s'\n",
  ------------------
  |  |   88|      0|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  199|      0|                             BSTR_P(p.param));
  200|      0|                    talloc_free(param0);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  201|      0|                    goto err_out;
  202|      0|                }
  203|      0|                playlist_transfer_entries(files, pl);
  204|      0|                talloc_free(param0);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  205|      0|                talloc_free(pl);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  206|      0|                continue;
  207|      0|            }
  208|       |
  209|  64.4k|            if (mode == LOCAL) {
  ------------------
  |  |   35|  64.4k|#define LOCAL 1
  ------------------
  |  Branch (209:17): [True: 5.75k, False: 58.6k]
  ------------------
  210|  5.75k|                MP_TARRAY_APPEND(NULL, local_params, local_params_count,
  ------------------
  |  |  105|  5.75k|    do {                                            \
  |  |  106|  5.75k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  5.75k|    do {                                            \
  |  |  |  |   97|  5.75k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  5.75k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  5.75k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  5.75k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 497, False: 5.25k]
  |  |  |  |  ------------------
  |  |  |  |   99|  5.75k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|    497|    do {                                                        \
  |  |  |  |  |  |   89|    497|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|    497|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|    497|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|    497|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    497|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|    497|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|    497|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 497]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  5.75k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 5.75k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  5.75k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  5.75k|        (idxvar)++;                                 \
  |  |  109|  5.75k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 5.75k]
  |  |  ------------------
  ------------------
  211|  5.75k|                                 (struct playlist_param) {p.arg, p.param});
  212|  5.75k|            }
  213|  64.4k|        } else {
  214|       |            // filename
  215|  54.9k|            void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  54.9k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  54.9k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  216|  54.9k|            char *file0 = bstrdup0(tmp, p.arg);
  217|  54.9k|            process_non_option(files, file0);
  218|  54.9k|            talloc_free(tmp);
  ------------------
  |  |   47|  54.9k|#define talloc_free                     ta_free
  ------------------
  219|  54.9k|        }
  220|   126k|    }
  221|       |
  222|  11.5k|    if (p.error)
  ------------------
  |  Branch (222:9): [True: 45, False: 11.4k]
  ------------------
  223|     45|        goto err_out;
  224|       |
  225|  11.4k|    if (mode != GLOBAL) {
  ------------------
  |  |   34|  11.4k|#define GLOBAL 0
  ------------------
  |  Branch (225:9): [True: 88, False: 11.3k]
  ------------------
  226|     88|        MP_ERR(config, "Missing closing --} on command line.\n");
  ------------------
  |  |   89|     88|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     88|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  227|     88|        goto err_out;
  228|     88|    }
  229|       |
  230|  11.3k|    ret = 0; // success
  231|       |
  232|  16.4k|err_out:
  233|  16.4k|    talloc_free(local_params);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  234|  16.4k|    m_config_restore_backups(config);
  235|  16.4k|    return ret;
  236|  11.3k|}
m_config_preparse_command_line:
  245|  16.4k|{
  246|  16.4k|    struct parse_state p = {config, argv, mp_null_log};
  247|   157k|    while (split_opt(&p)) {
  ------------------
  |  Branch (247:12): [True: 141k, False: 16.4k]
  ------------------
  248|   141k|        if (p.is_opt) {
  ------------------
  |  Branch (248:13): [True: 83.7k, False: 57.3k]
  ------------------
  249|       |            // Ignore non-pre-parse options. They will be set later.
  250|       |            // Option parsing errors will be handled later as well.
  251|  83.7k|            int flags = M_SETOPT_FROM_CMDLINE | M_SETOPT_PRE_PARSE_ONLY;
  252|  83.7k|            m_config_set_option_cli(config, p.arg, p.param, flags);
  253|  83.7k|            if (bstrcmp0(p.arg, "v") == 0)
  ------------------
  |  Branch (253:17): [True: 6.94k, False: 76.7k]
  ------------------
  254|  6.94k|                (*verbose)++;
  255|  83.7k|        }
  256|   141k|    }
  257|       |
  258|  12.8M|    for (int n = 0; n < config->num_opts; n++)
  ------------------
  |  Branch (258:21): [True: 12.8M, False: 16.4k]
  ------------------
  259|  12.8M|        config->opts[n].warning_was_printed = false;
  260|  16.4k|}
parse_commandline.c:split_opt:
   52|   295k|{
   53|   295k|    mp_assert(!p->error);
  ------------------
  |  |   41|   295k|#define mp_assert assert
  ------------------
  |  Branch (53:5): [True: 295k, False: 0]
  ------------------
   54|       |
   55|   295k|    if (!p->argv || !p->argv[0])
  ------------------
  |  Branch (55:9): [True: 0, False: 295k]
  |  Branch (55:21): [True: 27.7k, False: 267k]
  ------------------
   56|  27.7k|        return false;
   57|       |
   58|   267k|    p->is_opt = false;
   59|   267k|    p->arg = bstr0(p->argv[0]);
   60|   267k|    p->param = bstr0(NULL);
   61|       |
   62|   267k|    p->argv++;
   63|       |
   64|   267k|    if (p->no_more_opts || !bstr_startswith0(p->arg, "-") || p->arg.len == 1)
  ------------------
  |  Branch (64:9): [True: 492, False: 267k]
  |  Branch (64:28): [True: 107k, False: 159k]
  |  Branch (64:62): [True: 4.40k, False: 155k]
  ------------------
   65|   112k|        return true;
   66|       |
   67|   155k|    if (bstrcmp0(p->arg, "--") == 0) {
  ------------------
  |  Branch (67:9): [True: 38, False: 155k]
  ------------------
   68|     38|        p->no_more_opts = true;
   69|     38|        return split_opt(p);
   70|     38|    }
   71|       |
   72|   155k|    p->is_opt = true;
   73|       |
   74|   155k|    bool new_opt = bstr_eatstart0(&p->arg, "--");
   75|   155k|    if (!new_opt)
  ------------------
  |  Branch (75:9): [True: 154k, False: 1.05k]
  ------------------
   76|   154k|        bstr_eatstart0(&p->arg, "-");
   77|       |
   78|   155k|    bool ambiguous = !bstr_split_tok(p->arg, "=", &p->arg, &p->param);
   79|       |
   80|   155k|    bool need_param = m_config_option_requires_param(p->config, p->arg) > 0;
   81|       |
   82|   155k|    if (ambiguous && need_param) {
  ------------------
  |  Branch (82:9): [True: 132k, False: 23.1k]
  |  Branch (82:22): [True: 97.8k, False: 34.4k]
  ------------------
   83|  97.8k|        if (!p->argv[0] || new_opt) {
  ------------------
  |  Branch (83:13): [True: 127, False: 97.7k]
  |  Branch (83:28): [True: 7, False: 97.7k]
  ------------------
   84|    134|            p->error = true;
   85|    134|            MP_FATAL(p, "Error parsing commandline option %.*s: %s\n",
  ------------------
  |  |   88|    134|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    268|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 134, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   86|    134|                     BSTR_P(p->arg), m_option_strerror(M_OPT_MISSING_PARAM));
   87|    134|            MP_WARN(p, "Make sure you're using e.g. '--%.*s=value' instead "
  ------------------
  |  |   90|    134|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    536|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 134, False: 0]
  |  |  |  |  |  Branch (86:57): [True: 134, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   88|    134|                    "of '--%.*s value'.\n", BSTR_P(p->arg), BSTR_P(p->arg));
   89|    134|            return false;
   90|    134|        }
   91|  97.7k|        p->param = bstr0(p->argv[0]);
   92|  97.7k|        p->argv++;
   93|  97.7k|    }
   94|       |
   95|   155k|    return true;
   96|   155k|}
parse_commandline.c:process_non_option:
  116|  54.9k|{
  117|  54.9k|    playlist_append_file(files, arg);
  118|  54.9k|}

m_config_parse:
   45|  16.4k|{
   46|  16.4k|    m_profile_t *profile = m_config_add_profile(config, initial_section);
   47|  16.4k|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  16.4k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  16.4k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
   48|  16.4k|    int line_no = 0;
   49|  16.4k|    int errors = 0;
   50|       |
   51|  16.4k|    bstr_eatstart0(&data, "\xEF\xBB\xBF"); // skip BOM
   52|       |
   53|  1.67M|    while (data.len) {
  ------------------
  |  Branch (53:12): [True: 1.65M, False: 16.4k]
  ------------------
   54|  1.65M|        talloc_free_children(tmp);
  ------------------
  |  |   46|  1.65M|#define talloc_free_children            ta_free_children
  ------------------
   55|  1.65M|        bool ok = false;
   56|       |
   57|  1.65M|        line_no++;
   58|  1.65M|        char loc[512];
   59|  1.65M|        snprintf(loc, sizeof(loc), "%s:%d:", location, line_no);
   60|       |
   61|  1.65M|        bstr line = bstr_strip_linebreaks(bstr_getline(data, &data));
   62|  1.65M|        if (!skip_ws(&line))
  ------------------
  |  Branch (62:13): [True: 410k, False: 1.24M]
  ------------------
   63|   410k|            continue;
   64|       |
   65|       |        // Profile declaration
   66|  1.24M|        if (bstr_eatstart0(&line, "[")) {
  ------------------
  |  Branch (66:13): [True: 196k, False: 1.04M]
  ------------------
   67|   196k|            bstr profilename;
   68|   196k|            if (!bstr_split_tok(line, "]", &profilename, &line)) {
  ------------------
  |  Branch (68:17): [True: 0, False: 196k]
  ------------------
   69|      0|                MP_ERR(config, "%s missing closing ]\n", loc);
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
   70|      0|                goto error;
   71|      0|            }
   72|   196k|            if (skip_ws(&line)) {
  ------------------
  |  Branch (72:17): [True: 0, False: 196k]
  ------------------
   73|      0|                MP_ERR(config, "%s unparsable extra characters: '%.*s'\n",
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   74|      0|                       loc, BSTR_P(line));
   75|      0|                goto error;
   76|      0|            }
   77|   196k|            profile = m_config_add_profile(config, bstrto0(tmp, profilename));
   78|   196k|            continue;
   79|   196k|        }
   80|       |
   81|  1.04M|        bstr_eatstart0(&line, "--");
   82|       |
   83|  1.04M|        bstr option = line;
   84|  14.1M|        while (line.len && (mp_isalnum(line.start[0]) || line.start[0] == '_' ||
  ------------------
  |  Branch (84:16): [True: 14.1M, False: 0]
  |  Branch (84:29): [True: 11.9M, False: 2.18M]
  |  Branch (84:58): [True: 0, False: 2.18M]
  ------------------
   85|  2.18M|                            line.start[0] == '-'))
  ------------------
  |  Branch (85:29): [True: 1.13M, False: 1.04M]
  ------------------
   86|  13.0M|            line = bstr_cut(line, 1);
   87|  1.04M|        option.len = option.len - line.len;
   88|  1.04M|        skip_ws(&line);
   89|       |
   90|  1.04M|        bstr value = {0};
   91|  1.04M|        if (bstr_eatstart0(&line, "=")) {
  ------------------
  |  Branch (91:13): [True: 1.04M, False: 0]
  ------------------
   92|  1.04M|            skip_ws(&line);
   93|  1.04M|            if (line.len && (line.start[0] == '"' || line.start[0] == '\'')) {
  ------------------
  |  Branch (93:17): [True: 1.04M, False: 0]
  |  Branch (93:30): [True: 0, False: 1.04M]
  |  Branch (93:54): [True: 0, False: 1.04M]
  ------------------
   94|       |                // Simple quoting, like "value"
   95|      0|                char term[2] = {line.start[0], 0};
   96|      0|                line = bstr_cut(line, 1);
   97|      0|                if (!bstr_split_tok(line, term, &value, &line)) {
  ------------------
  |  Branch (97:21): [True: 0, False: 0]
  ------------------
   98|      0|                    MP_ERR(config, "%s unterminated quote\n", loc);
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
   99|      0|                    goto error;
  100|      0|                }
  101|  1.04M|            } else if (bstr_eatstart0(&line, "%")) {
  ------------------
  |  Branch (101:24): [True: 0, False: 1.04M]
  ------------------
  102|       |                // Quoting with length, like %5%value
  103|      0|                bstr rest;
  104|      0|                long long len = bstrtoll(line, &rest, 10);
  105|      0|                if (rest.len == line.len || !bstr_eatstart0(&rest, "%") ||
  ------------------
  |  Branch (105:21): [True: 0, False: 0]
  |  Branch (105:45): [True: 0, False: 0]
  ------------------
  106|      0|                    len > rest.len)
  ------------------
  |  Branch (106:21): [True: 0, False: 0]
  ------------------
  107|      0|                {
  108|      0|                    MP_ERR(config, "%s fixed-length quoting expected - put "
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  109|      0|                           "\"quotes\" around the option value if you did not "
  110|      0|                           "intend to use this, but your option value starts "
  111|      0|                           "with '%%'\n", loc);
  112|      0|                    goto error;
  113|      0|                }
  114|      0|                value = bstr_splice(rest, 0, len);
  115|      0|                line = bstr_cut(rest, len);
  116|  1.04M|            } else {
  117|       |                // No quoting; take everything until the comment or end of line
  118|  1.04M|                int end = bstrchr(line, '#');
  119|  1.04M|                value = bstr_strip(end < 0 ? line : bstr_splice(line, 0, end));
  ------------------
  |  Branch (119:36): [True: 885k, False: 164k]
  ------------------
  120|  1.04M|                line.len = 0;
  121|  1.04M|            }
  122|  1.04M|        }
  123|  1.04M|        if (skip_ws(&line)) {
  ------------------
  |  Branch (123:13): [True: 0, False: 1.04M]
  ------------------
  124|      0|            MP_ERR(config, "%s unparsable extra characters: '%.*s'\n",
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  125|      0|                   loc, BSTR_P(line));
  126|      0|            goto error;
  127|      0|        }
  128|       |
  129|  1.04M|        int res = m_config_set_profile_option(config, profile, option, value);
  130|  1.04M|        if (res < 0) {
  ------------------
  |  Branch (130:13): [True: 82.0k, False: 967k]
  ------------------
  131|  82.0k|            MP_ERR(config, "%s setting option %.*s='%.*s' failed.\n",
  ------------------
  |  |   89|  82.0k|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|   328k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 82.0k, False: 0]
  |  |  |  |  |  Branch (86:57): [True: 82.0k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  132|  82.0k|                   loc, BSTR_P(option), BSTR_P(value));
  133|  82.0k|            goto error;
  134|  82.0k|        }
  135|       |
  136|   967k|        ok = true;
  137|  1.04M|    error:
  138|  1.04M|        if (!ok)
  ------------------
  |  Branch (138:13): [True: 82.0k, False: 967k]
  ------------------
  139|  82.0k|            errors++;
  140|  1.04M|        if (errors > 16) {
  ------------------
  |  Branch (140:13): [True: 0, False: 1.04M]
  ------------------
  141|      0|            MP_ERR(config, "%s: too many errors, stopping.\n", location);
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  142|      0|            break;
  143|      0|        }
  144|  1.04M|    }
  145|       |
  146|  16.4k|    if (config->recursion_depth == 0)
  ------------------
  |  Branch (146:9): [True: 16.4k, False: 0]
  ------------------
  147|  16.4k|        m_config_finish_default_profile(config, flags);
  148|       |
  149|  16.4k|    talloc_free(tmp);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  150|  16.4k|    return 1;
  151|  16.4k|}
parse_configfile.c:skip_ws:
   36|  5.00M|{
   37|  5.00M|    *s = bstr_lstrip(*s);
   38|  5.00M|    if (bstr_startswith0(*s, "#"))
  ------------------
  |  Branch (38:9): [True: 196k, False: 4.80M]
  ------------------
   39|   196k|        s->len = 0;
   40|  5.00M|    return s->len;
   41|  5.00M|}

mp_init_paths:
  109|  16.4k|{
  110|  16.4k|    TA_FREEP(&global->configdir);
  ------------------
  |  |   81|  16.4k|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|  16.4k|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 16.4k]
  |  |  ------------------
  ------------------
  111|       |
  112|  16.4k|    const char *force_configdir = getenv("MPV_HOME");
  113|  16.4k|    if (opts->force_configdir && opts->force_configdir[0])
  ------------------
  |  Branch (113:9): [True: 102, False: 16.3k]
  |  Branch (113:34): [True: 101, False: 1]
  ------------------
  114|    101|        force_configdir = opts->force_configdir;
  115|  16.4k|    if (!opts->load_config)
  ------------------
  |  Branch (115:9): [True: 15.9k, False: 451]
  ------------------
  116|  15.9k|        force_configdir = "";
  117|       |
  118|  16.4k|    global->configdir = mp_get_user_path(global, global, force_configdir);
  119|  16.4k|}
mp_find_user_file:
  123|  42.5k|{
  124|  42.5k|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  42.5k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  42.5k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  125|  42.5k|    char *res = (char *)mp_get_platform_path(tmp, global, type);
  126|  42.5k|    if (res)
  ------------------
  |  Branch (126:9): [True: 2.88k, False: 39.6k]
  ------------------
  127|  2.88k|        res = mp_path_join(talloc_ctx, res, filename);
  128|  42.5k|    talloc_free(tmp);
  ------------------
  |  |   47|  42.5k|#define talloc_free                     ta_free
  ------------------
  129|  42.5k|    MP_DBG(global, "%s path: '%s' -> '%s'\n", type, filename, res ? res : "-");
  ------------------
  |  |   93|  42.5k|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  85.0k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 2.88k, False: 39.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  130|  42.5k|    return res;
  131|  42.5k|}
mp_find_all_config_files:
  170|  53.9k|{
  171|  53.9k|    return mp_find_all_config_files_limited(talloc_ctx, global, 64, filename);
  172|  53.9k|}
mp_find_config_file:
  176|  6.21k|{
  177|  6.21k|    char **l = mp_find_all_config_files_limited(talloc_ctx, global, 1, filename);
  178|  6.21k|    char *r = l && l[0] ? talloc_steal(talloc_ctx, l[0]) : NULL;
  ------------------
  |  |   38|  1.06k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  1.06k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
  |  Branch (178:15): [True: 6.21k, False: 0]
  |  Branch (178:20): [True: 1.06k, False: 5.15k]
  ------------------
  179|  6.21k|    talloc_free(l);
  ------------------
  |  |   47|  6.21k|#define talloc_free                     ta_free
  ------------------
  180|  6.21k|    return r;
  181|  6.21k|}
mp_get_user_path:
  185|   135k|{
  186|   135k|    if (!path)
  ------------------
  |  Branch (186:9): [True: 67.2k, False: 68.6k]
  ------------------
  187|  67.2k|        return NULL;
  188|  68.6k|    char *res = NULL;
  189|  68.6k|    bstr bpath = bstr0(path);
  190|  68.6k|    if (bstr_eatstart0(&bpath, "~")) {
  ------------------
  |  Branch (190:9): [True: 43.0k, False: 25.6k]
  ------------------
  191|       |        // parse to "~" <prefix> "/" <rest>
  192|  43.0k|        bstr prefix, rest;
  193|  43.0k|        if (bstr_split_tok(bpath, "/", &prefix, &rest)) {
  ------------------
  |  Branch (193:13): [True: 42.5k, False: 561]
  ------------------
  194|  42.5k|            const char *rest0 = rest.start; // ok in this case
  195|  42.5k|            if (bstr_equals0(prefix, "~")) {
  ------------------
  |  Branch (195:17): [True: 6.21k, False: 36.3k]
  ------------------
  196|  6.21k|                res = mp_find_config_file(talloc_ctx, global, rest0);
  197|  6.21k|                if (!res) {
  ------------------
  |  Branch (197:21): [True: 5.15k, False: 1.06k]
  ------------------
  198|  5.15k|                    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  5.15k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  5.15k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  199|  5.15k|                    const char *p = mp_get_platform_path(tmp, global, "home");
  200|  5.15k|                    res = mp_path_join_bstr(talloc_ctx, bstr0(p), rest);
  201|  5.15k|                    talloc_free(tmp);
  ------------------
  |  |   47|  5.15k|#define talloc_free                     ta_free
  ------------------
  202|  5.15k|                }
  203|  36.3k|            } else if (bstr_equals0(prefix, "")) {
  ------------------
  |  Branch (203:24): [True: 232, False: 36.0k]
  ------------------
  204|    232|                char *home = getenv("HOME");
  205|    232|                if (!home)
  ------------------
  |  Branch (205:21): [True: 0, False: 232]
  ------------------
  206|      0|                    home = getenv("USERPROFILE");
  207|    232|                res = mp_path_join_bstr(talloc_ctx, bstr0(home), rest);
  208|  36.0k|            } else if (bstr_eatstart0(&prefix, "~")) {
  ------------------
  |  Branch (208:24): [True: 35.1k, False: 874]
  ------------------
  209|  35.1k|                void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  35.1k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  35.1k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  210|  35.1k|                char type[80];
  211|  35.1k|                snprintf(type, sizeof(type), "%.*s", BSTR_P(prefix));
  ------------------
  |  |  307|  35.1k|#define BSTR_P(bstr) (int)((bstr).len), ((bstr).start ? (char*)(bstr).start : "")
  |  |  ------------------
  |  |  |  Branch (307:42): [True: 35.1k, False: 0]
  |  |  ------------------
  ------------------
  212|  35.1k|                const char *p = mp_get_platform_path(tmp, global, type);
  213|  35.1k|                res = mp_path_join_bstr(talloc_ctx, bstr0(p), rest);
  214|  35.1k|                talloc_free(tmp);
  ------------------
  |  |   47|  35.1k|#define talloc_free                     ta_free
  ------------------
  215|  35.1k|            }
  216|  42.5k|        }
  217|  43.0k|    }
  218|  68.6k|    if (!res) {
  ------------------
  |  Branch (218:9): [True: 27.0k, False: 41.6k]
  ------------------
  219|  27.0k|        res = talloc_strdup(talloc_ctx, path);
  ------------------
  |  |   50|  27.0k|#define talloc_strdup                   ta_xstrdup
  ------------------
  220|  41.6k|    } else {
  221|  41.6k|        MP_DBG(global, "user path: '%s' -> '%s'\n", path, res);
  ------------------
  |  |   93|  41.6k|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  41.6k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  222|  41.6k|    }
  223|  68.6k|    return res;
  224|   135k|}
mp_mk_user_dir:
  236|  16.4k|{
  237|  16.4k|    char *dir = mp_find_user_file(NULL, global, type, subdir);
  238|  16.4k|    if (dir)
  ------------------
  |  Branch (238:9): [True: 450, False: 15.9k]
  ------------------
  239|    450|        mp_mkdirp(dir);
  240|  16.4k|    talloc_free(dir);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  241|  16.4k|}
path.c:mp_get_platform_path:
   74|   383k|{
   75|   383k|    mp_assert(talloc_ctx);
  ------------------
  |  |   41|   383k|#define mp_assert assert
  ------------------
  |  Branch (75:5): [True: 383k, False: 0]
  ------------------
   76|       |
   77|   383k|    if (global->configdir) {
  ------------------
  |  Branch (77:9): [True: 351k, False: 31.9k]
  ------------------
   78|       |        // Return NULL for all platform paths if --no-config is passed
   79|   351k|        if (!global->configdir[0])
  ------------------
  |  Branch (79:13): [True: 343k, False: 7.91k]
  ------------------
   80|   343k|            return NULL;
   81|       |
   82|       |        // force all others to NULL, only first returns the path
   83|  22.5k|        for (int n = 0; n < MP_ARRAY_SIZE(config_dirs); n++) {
  ------------------
  |  |   49|  22.5k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (83:25): [True: 22.1k, False: 346]
  ------------------
   84|  22.1k|            if (strcmp(config_dirs[n], type) == 0)
  ------------------
  |  Branch (84:17): [True: 7.57k, False: 14.5k]
  ------------------
   85|  7.57k|                return (n == 0) ? global->configdir : NULL;
  ------------------
  |  Branch (85:24): [True: 2.36k, False: 5.20k]
  ------------------
   86|  22.1k|        }
   87|  7.91k|    }
   88|       |
   89|       |    // Return the native config path if the platform doesn't support the
   90|       |    // type we are trying to fetch.
   91|  32.3k|    const char *fallback_type = NULL;
   92|  32.3k|    if (!strcmp(type, "cache") || !strcmp(type, "state"))
  ------------------
  |  Branch (92:9): [True: 244, False: 32.0k]
  |  Branch (92:35): [True: 2.43k, False: 29.6k]
  ------------------
   93|  2.67k|        fallback_type = "home";
   94|       |
   95|  42.7k|    for (int n = 0; n < MP_ARRAY_SIZE(path_resolvers); n++) {
  ------------------
  |  |   49|  42.7k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (95:21): [True: 32.3k, False: 10.4k]
  ------------------
   96|  32.3k|        const char *path = path_resolvers[n](talloc_ctx, type);
   97|  32.3k|        if (path && path[0])
  ------------------
  |  Branch (97:13): [True: 21.8k, False: 10.4k]
  |  Branch (97:21): [True: 21.8k, False: 0]
  ------------------
   98|  21.8k|            return path;
   99|  32.3k|    }
  100|       |
  101|  10.4k|    if (fallback_type) {
  ------------------
  |  Branch (101:9): [True: 0, False: 10.4k]
  ------------------
  102|      0|        mp_assert(strcmp(fallback_type, type) != 0);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (102:9): [True: 0, False: 0]
  ------------------
  103|      0|        return mp_get_platform_path(talloc_ctx, global, fallback_type);
  104|      0|    }
  105|  10.4k|    return NULL;
  106|  10.4k|}
path.c:mp_find_all_config_files_limited:
  137|  60.2k|{
  138|  60.2k|    char **ret = talloc_array(talloc_ctx, char*, 2); // 2 preallocated
  ------------------
  |  |   29|  60.2k|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|  60.2k|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  60.2k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  139|  60.2k|    int num_ret = 0;
  140|       |
  141|   361k|    for (int i = 0; i < MP_ARRAY_SIZE(config_dirs); i++) {
  ------------------
  |  |   49|   361k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (141:21): [True: 301k, False: 60.2k]
  ------------------
  142|   301k|        const char *dir = mp_get_platform_path(ret, global, config_dirs[i]);
  143|   301k|        bstr s = bstr0(filename);
  144|   313k|        while (dir && num_ret < max_files && s.len) {
  ------------------
  |  Branch (144:16): [True: 28.8k, False: 284k]
  |  Branch (144:23): [True: 25.6k, False: 3.18k]
  |  Branch (144:46): [True: 12.4k, False: 13.2k]
  ------------------
  145|  12.4k|            bstr fn;
  146|  12.4k|            bstr_split_tok(s, "|", &fn, &s);
  147|       |
  148|  12.4k|            char *file = mp_path_join_bstr(ret, bstr0(dir), fn);
  149|  12.4k|            if (mp_path_exists(file)) {
  ------------------
  |  Branch (149:17): [True: 1.06k, False: 11.3k]
  ------------------
  150|  1.06k|                MP_DBG(global, "config path: '%.*s' -> '%s'\n",
  ------------------
  |  |   93|  1.06k|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  2.12k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 1.06k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  151|  1.06k|                        BSTR_P(fn), file);
  152|  1.06k|                MP_TARRAY_APPEND(NULL, ret, num_ret, file);
  ------------------
  |  |  105|  1.06k|    do {                                            \
  |  |  106|  1.06k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  1.06k|    do {                                            \
  |  |  |  |   97|  1.06k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  1.06k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  1.06k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  1.06k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 1.06k]
  |  |  |  |  ------------------
  |  |  |  |   99|  1.06k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  1.06k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 1.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  1.06k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  1.06k|        (idxvar)++;                                 \
  |  |  109|  1.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.06k]
  |  |  ------------------
  ------------------
  153|  11.3k|            } else {
  154|  11.3k|                MP_DBG(global, "config path: '%.*s' -/-> '%s'\n",
  ------------------
  |  |   93|  11.3k|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  22.7k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 11.3k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  155|  11.3k|                        BSTR_P(fn), file);
  156|  11.3k|            }
  157|  12.4k|        }
  158|   301k|    }
  159|       |
  160|  60.2k|    MP_TARRAY_GROW(NULL, ret, num_ret);
  ------------------
  |  |   96|  60.2k|    do {                                            \
  |  |   97|  60.2k|        size_t nextidx_ = (nextidx);                \
  |  |   98|  60.2k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  ------------------
  |  |  |  |   84|  60.2k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  60.2k|#define talloc_get_size                 ta_get_size
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 0, False: 60.2k]
  |  |  ------------------
  |  |   99|  60.2k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  ------------------
  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  ------------------
  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  100|  60.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (100:14): [Folded, False: 60.2k]
  |  |  ------------------
  ------------------
  161|  60.2k|    ret[num_ret] = NULL;
  162|       |
  163|  60.2k|    for (int n = 0; n < num_ret / 2; n++)
  ------------------
  |  Branch (163:21): [True: 0, False: 60.2k]
  ------------------
  164|      0|        MPSWAP(char*, ret[n], ret[num_ret - n - 1]);
  ------------------
  |  |   48|      0|    do { type SWAP_tmp = b; b = a; a = SWAP_tmp; } while (0)
  |  |  ------------------
  |  |  |  Branch (48:59): [Folded, False: 0]
  |  |  ------------------
  ------------------
  165|  60.2k|    return ret;
  166|  60.2k|}

mp_als_create:
   64|     12|{
   65|     12|    struct mp_als *state =
   66|     12|        talloc_zero(parent, struct mp_als);
  ------------------
  |  |   27|     12|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|     12|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|     12|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   67|       |
   68|     12|    state->log = mp_log_new(state, mpctx->global->log, "linux-als");
   69|       |
   70|     12|    talloc_set_destructor(state, mp_als_destroy);
  ------------------
  |  |   41|     12|#define talloc_set_destructor           ta_set_destructor
  ------------------
   71|       |
   72|     12|    return state;
   73|     12|}
mp_als_get_lux:
  179|     37|{
  180|     37|    if (state->found_no_devices)
  ------------------
  |  Branch (180:9): [True: 25, False: 12]
  ------------------
  181|     25|        return MP_ALS_STATUS_NODEVICE;
  182|       |
  183|     12|    if (!state->device_dir && acquire_sensor(state) < 0) {
  ------------------
  |  Branch (183:9): [True: 12, False: 0]
  |  Branch (183:31): [True: 12, False: 0]
  ------------------
  184|     12|        state->found_no_devices = true;
  185|     12|        return MP_ALS_STATUS_NODEVICE;
  186|     12|    }
  187|       |
  188|      0|    return read_als_assume_have_sensor(state, lux);
  189|     12|}
als-linux.c:mp_als_destroy:
   55|     12|{
   56|     12|    struct mp_als *state = p;
   57|       |
   58|     12|    if (state->device_dir) {
  ------------------
  |  Branch (58:9): [True: 0, False: 12]
  ------------------
   59|      0|        closedir(state->device_dir);
   60|      0|    }
   61|     12|}
als-linux.c:acquire_sensor:
   77|     12|{
   78|     12|    mp_assert(!state->device_dir);
  ------------------
  |  |   41|     12|#define mp_assert assert
  ------------------
  |  Branch (78:5): [True: 12, False: 0]
  ------------------
   79|     12|    DIR *devices_dir = opendir(SYSFS_BASEDIR);
  ------------------
  |  |   40|     12|#define SYSFS_BASEDIR "/sys/bus/iio/devices"
  ------------------
   80|     12|    if (!devices_dir) {
  ------------------
  |  Branch (80:9): [True: 12, False: 0]
  ------------------
   81|     12|        MP_WARN(state,
  ------------------
  |  |   90|     12|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     12|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
   82|     12|                "No IIO device directory in sysfs: %s\n",
   83|     12|                mp_strerror(errno));
   84|     12|        return -1;
   85|     12|    }
   86|       |
   87|      0|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|      0|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|      0|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
   88|       |
   89|      0|    struct dirent *ent;
   90|      0|    while ((ent = readdir(devices_dir))) {
  ------------------
  |  Branch (90:12): [True: 0, False: 0]
  ------------------
   91|       |        // The directory also contains files named `trigger*` which we don't
   92|       |        // care about; only include ones for devices.
   93|      0|        if (!bstr_startswith0(bstr0(ent->d_name), "iio:device"))
  ------------------
  |  Branch (93:13): [True: 0, False: 0]
  ------------------
   94|      0|            continue;
   95|       |
   96|       |        // Check if in_illuminance_raw exists so we know we have an ambient
   97|       |        // light sensor.
   98|      0|        char *inp_raw_path = mp_path_join(tmp, ent->d_name, INP_RAW);
  ------------------
  |  |   41|      0|#define INP_RAW "in_illuminance_raw"
  ------------------
   99|       |
  100|      0|        if (faccessat(dirfd(devices_dir), inp_raw_path, R_OK, 0) != 0) {
  ------------------
  |  Branch (100:13): [True: 0, False: 0]
  ------------------
  101|       |            // Couldn't stat, continue
  102|      0|            continue;
  103|      0|        }
  104|       |
  105|       |        // We found an ALS
  106|       |
  107|      0|        char *dev_path = mp_path_join(tmp, SYSFS_BASEDIR, ent->d_name);
  ------------------
  |  |   40|      0|#define SYSFS_BASEDIR "/sys/bus/iio/devices"
  ------------------
  108|       |
  109|      0|        state->device_dir = opendir(dev_path);
  110|      0|        if (state->device_dir) {
  ------------------
  |  Branch (110:13): [True: 0, False: 0]
  ------------------
  111|      0|            MP_VERBOSE(state, "Chose ALS device %s\n", dev_path);
  ------------------
  |  |   92|      0|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  112|      0|            break;
  113|      0|        }
  114|       |
  115|      0|        MP_WARN(state, "Failed to open ambient light sensor %s: %s\n",
  ------------------
  |  |   90|      0|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  116|      0|                ent->d_name,
  117|      0|                mp_strerror(errno));
  118|      0|    }
  119|       |
  120|      0|    talloc_free(tmp);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  121|      0|    closedir(devices_dir);
  122|       |
  123|      0|    return state->device_dir ? 0 : -1;
  ------------------
  |  Branch (123:12): [True: 0, False: 0]
  ------------------
  124|     12|}

mp_fopen:
   67|     27|{
   68|     27|    if (!mode[0]) {
  ------------------
  |  Branch (68:9): [True: 0, False: 27]
  ------------------
   69|      0|        errno = EINVAL;
   70|      0|        return NULL;
   71|      0|    }
   72|       |
   73|     27|    int rwmode;
   74|     27|    int oflags = 0;
   75|     27|    switch (mode[0]) {
   76|      0|    case 'r':
  ------------------
  |  Branch (76:5): [True: 0, False: 27]
  ------------------
   77|      0|        rwmode = O_RDONLY;
   78|      0|        break;
   79|     27|    case 'w':
  ------------------
  |  Branch (79:5): [True: 27, False: 0]
  ------------------
   80|     27|        rwmode = O_WRONLY;
   81|     27|        oflags |= O_CREAT | O_TRUNC;
   82|     27|        break;
   83|      0|    case 'a':
  ------------------
  |  Branch (83:5): [True: 0, False: 27]
  ------------------
   84|      0|        rwmode = O_WRONLY;
   85|      0|        oflags |= O_CREAT | O_APPEND;
   86|      0|        break;
   87|      0|    default:
  ------------------
  |  Branch (87:5): [True: 0, False: 27]
  ------------------
   88|      0|        errno = EINVAL;
   89|      0|        return NULL;
   90|     27|    }
   91|       |
   92|       |    // Parse extra mode flags
   93|     54|    for (const char *pos = mode + 1; *pos; pos++) {
  ------------------
  |  Branch (93:38): [True: 27, False: 27]
  ------------------
   94|     27|        switch (*pos) {
   95|      0|        case '+': rwmode = O_RDWR;  break;
  ------------------
  |  Branch (95:9): [True: 0, False: 27]
  ------------------
   96|      0|        case 'x': oflags |= O_EXCL; break;
  ------------------
  |  Branch (96:9): [True: 0, False: 27]
  ------------------
   97|       |        // Ignore unknown flags (glibc does too)
   98|     27|        default: break;
  ------------------
  |  Branch (98:9): [True: 27, False: 0]
  ------------------
   99|     27|        }
  100|     27|    }
  101|       |
  102|       |    // Open a CRT file descriptor
  103|     27|    int fd = open(filename, rwmode | oflags | O_CLOEXEC, 0666);
  ------------------
  |  |  269|     27|#define open(...) mp_open(__VA_ARGS__)
  ------------------
  104|     27|    if (fd < 0)
  ------------------
  |  Branch (104:9): [True: 0, False: 27]
  ------------------
  105|      0|        return NULL;
  106|       |
  107|       |    // Add 'b' to the mode so the CRT knows the file is opened in binary mode
  108|     27|    char bmode[] = { mode[0], '\0', '\0', '\0' };
  109|     27|    int idx = 1;
  110|     27|    if (rwmode == O_RDWR)
  ------------------
  |  Branch (110:9): [True: 0, False: 27]
  ------------------
  111|      0|        bmode[idx++] = '+';
  112|     27|    bmode[idx++] = 'b';
  113|     27|    FILE *fp = fdopen(fd, bmode);
  114|     27|    if (!fp) {
  ------------------
  |  Branch (114:9): [True: 0, False: 27]
  ------------------
  115|      0|        close(fd);
  116|      0|        return NULL;
  117|      0|    }
  118|       |
  119|     27|    return fp;
  120|     27|}
mp_make_cloexec_pipe:
  129|  2.59k|{
  130|  2.59k|#if HAVE_PIPE2
  131|  2.59k|    if (pipe2(pipes, O_CLOEXEC) != 0) {
  ------------------
  |  Branch (131:9): [True: 0, False: 2.59k]
  ------------------
  132|      0|        pipes[0] = pipes[1] = -1;
  133|      0|        return -1;
  134|      0|    }
  135|       |#else
  136|       |    if (pipe(pipes) != 0) {
  137|       |        pipes[0] = pipes[1] = -1;
  138|       |        return -1;
  139|       |    }
  140|       |
  141|       |    for (int i = 0; i < 2; i++)
  142|       |        mp_set_cloexec(pipes[i]);
  143|       |#endif
  144|  2.59k|    return 0;
  145|  2.59k|}
mp_make_wakeup_pipe:
  149|  2.59k|{
  150|  2.59k|    if (mp_make_cloexec_pipe(pipes) < 0)
  ------------------
  |  Branch (150:9): [True: 0, False: 2.59k]
  ------------------
  151|      0|        return -1;
  152|       |
  153|  7.77k|    for (int i = 0; i < 2; i++) {
  ------------------
  |  Branch (153:21): [True: 5.18k, False: 2.59k]
  ------------------
  154|  5.18k|        int val = fcntl(pipes[i], F_GETFL) | O_NONBLOCK;
  155|       |        fcntl(pipes[i], F_SETFL, val);
  156|  5.18k|    }
  157|  2.59k|    return 0;
  158|  2.59k|}
mp_flush_wakeup_pipe:
  161|  1.95k|{
  162|  1.95k|    char buf[100];
  163|  1.95k|    (void)read(pipe_end, buf, sizeof(buf));
  164|  1.95k|}
mp_open:
  171|  1.30k|{
  172|  1.30k|    if (oflag & (O_WRONLY | O_RDWR | O_CREAT | O_TRUNC))
  ------------------
  |  Branch (172:9): [True: 666, False: 634]
  ------------------
  173|    666|        return memfd_create("mpv", oflag & O_CLOEXEC ? MFD_CLOEXEC : 0);
  ------------------
  |  Branch (173:36): [True: 666, False: 0]
  ------------------
  174|    634|    return (open)(filename, oflag);
  175|  1.30k|}
mp_mkdir:
  178|  1.46k|{
  179|  1.46k|    return 0;
  180|  1.46k|}

mp_get_platform_path_unix:
  124|  32.3k|{
  125|  32.3k|    mp_exec_once(&path_init_once, path_init);
  ------------------
  |  |  209|  32.3k|#define mp_exec_once pthread_once
  ------------------
  126|  32.3k|    if (strcmp(type, "home") == 0)
  ------------------
  |  Branch (126:9): [True: 8.53k, False: 23.7k]
  ------------------
  127|  8.53k|        return mpv_home;
  128|  23.7k|    if (strcmp(type, "old_home") == 0)
  ------------------
  |  Branch (128:9): [True: 5.39k, False: 18.3k]
  ------------------
  129|  5.39k|        return old_home;
  130|  18.3k|    if (strcmp(type, "cache") == 0)
  ------------------
  |  Branch (130:9): [True: 244, False: 18.1k]
  ------------------
  131|    244|        return mpv_cache;
  132|  18.1k|    if (strcmp(type, "state") == 0)
  ------------------
  |  Branch (132:9): [True: 2.43k, False: 15.7k]
  ------------------
  133|  2.43k|        return mpv_state;
  134|  15.7k|    if (strcmp(type, "global") == 0)
  ------------------
  |  Branch (134:9): [True: 5.04k, False: 10.6k]
  ------------------
  135|  5.04k|        return MPV_CONFDIR;
  ------------------
  |  |  282|  5.04k|#define MPV_CONFDIR "/usr/local/etc/mpv"
  ------------------
  136|  10.6k|    if (strcmp(type, "desktop") == 0)
  ------------------
  |  Branch (136:9): [True: 194, False: 10.4k]
  ------------------
  137|    194|        return mpv_desktop;
  138|  10.4k|    return NULL;
  139|  10.6k|}
path-unix.c:path_init:
   40|      1|{
   41|      1|    char *home = getenv("HOME");
   42|      1|    char *xdg_cache = getenv("XDG_CACHE_HOME");
   43|      1|    char *xdg_config = getenv("XDG_CONFIG_HOME");
   44|      1|    char *xdg_state = getenv("XDG_STATE_HOME");
   45|       |
   46|      1|    bool err = false;
   47|      1|    if (xdg_config && xdg_config[0] == '/') {
  ------------------
  |  Branch (47:9): [True: 0, False: 1]
  |  Branch (47:23): [True: 0, False: 0]
  ------------------
   48|      0|        err = err || MKPATH(mpv_home, "%s/mpv", xdg_config);
  ------------------
  |  |   37|      0|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (48:15): [True: 0, False: 0]
  ------------------
   49|      1|    } else if (home && home[0]) {
  ------------------
  |  Branch (49:16): [True: 1, False: 0]
  |  Branch (49:24): [True: 1, False: 0]
  ------------------
   50|      1|        err = err || MKPATH(mpv_home, "%s/.config/mpv", home);
  ------------------
  |  |   37|      2|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (50:15): [True: 0, False: 1]
  ------------------
   51|      1|    }
   52|       |
   53|       |    // Maintain compatibility with old ~/.mpv
   54|      1|    if (home && home[0]) {
  ------------------
  |  Branch (54:9): [True: 1, False: 0]
  |  Branch (54:17): [True: 1, False: 0]
  ------------------
   55|      1|        err = err || MKPATH(old_home, "%s/.mpv", home);
  ------------------
  |  |   37|      2|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (55:15): [True: 0, False: 1]
  ------------------
   56|      1|        err = err || MKPATH(old_cache, "%s/.mpv/cache", home);
  ------------------
  |  |   37|      2|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (56:15): [True: 0, False: 1]
  ------------------
   57|      1|    }
   58|       |
   59|      1|    if (xdg_cache && xdg_cache[0] == '/') {
  ------------------
  |  Branch (59:9): [True: 0, False: 1]
  |  Branch (59:22): [True: 0, False: 0]
  ------------------
   60|      0|        err = err || MKPATH(mpv_cache, "%s/mpv", xdg_cache);
  ------------------
  |  |   37|      0|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (60:15): [True: 0, False: 0]
  ------------------
   61|      1|    } else if (home && home[0]) {
  ------------------
  |  Branch (61:16): [True: 1, False: 0]
  |  Branch (61:24): [True: 1, False: 0]
  ------------------
   62|      1|        err = err || MKPATH(mpv_cache, "%s/.cache/mpv", home);
  ------------------
  |  |   37|      2|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (62:15): [True: 0, False: 1]
  ------------------
   63|      1|    }
   64|       |
   65|      1|    if (xdg_state && xdg_state[0] == '/') {
  ------------------
  |  Branch (65:9): [True: 0, False: 1]
  |  Branch (65:22): [True: 0, False: 0]
  ------------------
   66|      0|        err = err || MKPATH(mpv_state, "%s/mpv", xdg_state);
  ------------------
  |  |   37|      0|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (66:15): [True: 0, False: 0]
  ------------------
   67|      1|    } else if (home && home[0]) {
  ------------------
  |  Branch (67:16): [True: 1, False: 0]
  |  Branch (67:24): [True: 1, False: 0]
  ------------------
   68|      1|        err = err || MKPATH(mpv_state, "%s/.local/state/mpv", home);
  ------------------
  |  |   37|      2|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (68:15): [True: 0, False: 1]
  ------------------
   69|      1|    }
   70|       |
   71|      1|    char xdg_user_dirs[CONF_MAX] = {0};
   72|      1|    if (xdg_config && xdg_config[0] == '/') {
  ------------------
  |  Branch (72:9): [True: 0, False: 1]
  |  Branch (72:23): [True: 0, False: 0]
  ------------------
   73|      0|        err = err || MKPATH(xdg_user_dirs, "%s/user-dirs.dirs", xdg_config);
  ------------------
  |  |   37|      0|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (73:15): [True: 0, False: 0]
  ------------------
   74|      1|    } else if (home && home[0]) {
  ------------------
  |  Branch (74:16): [True: 1, False: 0]
  |  Branch (74:24): [True: 1, False: 0]
  ------------------
   75|      1|        err = err || MKPATH(xdg_user_dirs, "%s/.config/user-dirs.dirs", home);
  ------------------
  |  |   37|      2|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (75:15): [True: 0, False: 1]
  ------------------
   76|      1|    }
   77|       |
   78|       |    // Attempt to read user-dirs for XDG_DESKTOP_DIR
   79|      1|    mpv_desktop[0] = '\0';
   80|      1|    if (mp_path_exists(xdg_user_dirs)) {
  ------------------
  |  Branch (80:9): [True: 0, False: 1]
  ------------------
   81|      0|        char line[4096];
   82|      0|        FILE *user_dirs = fopen(xdg_user_dirs, "r");
  ------------------
  |  |   84|      0|#define fopen(...) mp_fopen(__VA_ARGS__)
  ------------------
   83|      0|        if (!user_dirs)
  ------------------
  |  Branch (83:13): [True: 0, False: 0]
  ------------------
   84|      0|            goto skip_user_dirs;
   85|      0|        while (fgets(line, sizeof(line), user_dirs)) {
  ------------------
  |  Branch (85:16): [True: 0, False: 0]
  ------------------
   86|      0|            bstr data = bstr0(line);
   87|      0|            if (bstr_eatstart0(&data, "XDG_DESKTOP_DIR=")) {
  ------------------
  |  Branch (87:17): [True: 0, False: 0]
  ------------------
   88|      0|                bstr value = bstr_strip_linebreaks(data);
   89|      0|                if (bstr_eatstart0(&value, "\"") && bstr_eatend0(&value, "\"")) {
  ------------------
  |  Branch (89:21): [True: 0, False: 0]
  |  Branch (89:53): [True: 0, False: 0]
  ------------------
   90|      0|                    bool home_prefix = bstr_eatstart0(&value, "$HOME/");
   91|      0|                    if (home_prefix) {
  ------------------
  |  Branch (91:25): [True: 0, False: 0]
  ------------------
   92|      0|                        err = err || MKPATH(mpv_desktop, "%s/%.*s", home, BSTR_P(value));
  ------------------
  |  |   37|      0|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 0]
  |  |  |  Branch (37:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (92:31): [True: 0, False: 0]
  ------------------
   93|      0|                    } else {
   94|      0|                        err = err || MKPATH(mpv_desktop, "%.*s", BSTR_P(value));
  ------------------
  |  |   37|      0|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 0]
  |  |  |  Branch (37:53): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (94:31): [True: 0, False: 0]
  ------------------
   95|      0|                    }
   96|      0|                }
   97|      0|                break;
   98|      0|            }
   99|      0|        }
  100|      0|        fclose(user_dirs);
  101|      0|    }
  102|       |
  103|      1|skip_user_dirs:
  104|      1|    if (!mpv_desktop[0] && home && home[0])
  ------------------
  |  Branch (104:9): [True: 1, False: 0]
  |  Branch (104:28): [True: 1, False: 0]
  |  Branch (104:36): [True: 1, False: 0]
  ------------------
  105|      1|        err = err || MKPATH(mpv_desktop, "%s/%s", home, "Desktop");
  ------------------
  |  |   37|      1|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      1|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (105:15): [True: 0, False: 1]
  ------------------
  106|       |
  107|       |    // If the old ~/.mpv exists, and the XDG config dir doesn't, use the old
  108|       |    // config dir only. Also do not use any other XDG directories.
  109|      1|    if (mp_path_exists(old_home) && !mp_path_exists(mpv_home)) {
  ------------------
  |  Branch (109:9): [True: 0, False: 1]
  |  Branch (109:37): [True: 0, False: 0]
  ------------------
  110|      0|        err = err || MKPATH(mpv_home, "%s", old_home);
  ------------------
  |  |   37|      0|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (110:15): [True: 0, False: 0]
  ------------------
  111|      0|        err = err || MKPATH(mpv_cache, "%s", old_cache);
  ------------------
  |  |   37|      0|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (111:15): [True: 0, False: 0]
  ------------------
  112|      0|        err = err || MKPATH(mpv_state, "%s", old_home);
  ------------------
  |  |   37|      0|#define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |               #define MKPATH(BUF, ...) (snprintf((BUF), CONF_MAX, __VA_ARGS__) >= CONF_MAX)
  |  |  ------------------
  |  |  |  |   30|      0|#define CONF_MAX 512
  |  |  ------------------
  |  |  |  Branch (37:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (112:15): [True: 0, False: 0]
  ------------------
  113|      0|        old_home[0] = '\0';
  114|      0|        old_cache[0] = '\0';
  115|      0|    }
  116|       |
  117|      1|    if (err) {
  ------------------
  |  Branch (117:9): [True: 0, False: 1]
  ------------------
  118|      0|        fprintf(stderr, "Config dir exceeds %d bytes\n", CONF_MAX);
  ------------------
  |  |   30|      0|#define CONF_MAX 512
  ------------------
  119|      0|        abort();
  120|      0|    }
  121|      1|}

polldev:
   48|      1|{
   49|       |#ifdef __APPLE__
   50|       |    int maxfd = 0;
   51|       |    fd_set readfds, writefds;
   52|       |    FD_ZERO(&readfds);
   53|       |    FD_ZERO(&writefds);
   54|       |    for (size_t i = 0; i < nfds; ++i) {
   55|       |        struct pollfd *fd = &fds[i];
   56|       |        if (fd->fd > maxfd) {
   57|       |            maxfd = fd->fd;
   58|       |        }
   59|       |        if ((fd->events & POLLIN)) {
   60|       |            FD_SET(fd->fd, &readfds);
   61|       |        }
   62|       |        if ((fd->events & POLLOUT)) {
   63|       |            FD_SET(fd->fd, &writefds);
   64|       |        }
   65|       |    }
   66|       |    struct timeval _timeout = {
   67|       |        .tv_sec = timeout / 1000,
   68|       |        .tv_usec = (timeout % 1000) * 1000
   69|       |    };
   70|       |    int n = select(maxfd + 1, &readfds, &writefds, NULL,
   71|       |        timeout != -1 ? &_timeout : NULL);
   72|       |    if (n < 0) {
   73|       |        return n;
   74|       |    }
   75|       |    for (size_t i = 0; i < nfds; ++i) {
   76|       |        struct pollfd *fd = &fds[i];
   77|       |        fd->revents = 0;
   78|       |        if (FD_ISSET(fd->fd, &readfds)) {
   79|       |            fd->revents |= POLLIN;
   80|       |        }
   81|       |        if (FD_ISSET(fd->fd, &writefds)) {
   82|       |            fd->revents |= POLLOUT;
   83|       |        }
   84|       |    }
   85|       |    return n;
   86|       |#else
   87|      1|    return poll(fds, nfds, timeout);
   88|      1|#endif
   89|      1|}

mp_subprocess2:
    5|  1.95k|{
    6|  1.95k|    *res = (struct mp_subprocess_result){.error = MP_SUBPROCESS_EUNSUPPORTED};
  ------------------
  |  |   77|  1.95k|#define MP_SUBPROCESS_EUNSUPPORTED      -4  // API not supported
  ------------------
    7|  1.95k|}

mp_subprocess_err_str:
   25|  1.95k|{
   26|       |    // Note: these are visible to the public client API
   27|  1.95k|    switch (num) {
   28|      0|    case MP_SUBPROCESS_OK:              return "success";
  ------------------
  |  |   73|      0|#define MP_SUBPROCESS_OK                0   // no error
  ------------------
  |  Branch (28:5): [True: 0, False: 1.95k]
  ------------------
   29|      0|    case MP_SUBPROCESS_EKILLED_BY_US:   return "killed";
  ------------------
  |  |   75|      0|#define MP_SUBPROCESS_EKILLED_BY_US     -2  // mp_cancel was triggered
  ------------------
  |  Branch (29:5): [True: 0, False: 1.95k]
  ------------------
   30|      0|    case MP_SUBPROCESS_EINIT:           return "init";
  ------------------
  |  |   76|      0|#define MP_SUBPROCESS_EINIT             -3  // error during initialization
  ------------------
  |  Branch (30:5): [True: 0, False: 1.95k]
  ------------------
   31|  1.95k|    case MP_SUBPROCESS_EUNSUPPORTED:    return "unsupported";
  ------------------
  |  |   77|  1.95k|#define MP_SUBPROCESS_EUNSUPPORTED      -4  // API not supported
  ------------------
  |  Branch (31:5): [True: 1.95k, False: 0]
  ------------------
   32|      0|    case MP_SUBPROCESS_EGENERIC:        // fall through
  ------------------
  |  |   74|      0|#define MP_SUBPROCESS_EGENERIC          -1  // unknown error
  ------------------
  |  Branch (32:5): [True: 0, False: 1.95k]
  ------------------
   33|      0|    default:                            return "unknown";
  ------------------
  |  Branch (33:5): [True: 0, False: 1.95k]
  ------------------
   34|  1.95k|    }
   35|  1.95k|}
mp_subprocess:
   40|  1.95k|{
   41|  1.95k|    mp_verbose(log, "Starting subprocess: [%s", opts->args[0]);
  ------------------
  |  |   79|  1.95k|#define mp_verbose(log, ...)    mp_msg(log, MSGL_V, __VA_ARGS__)
  ------------------
   42|  1.95k|    char **arg = &opts->args[1];
   43|  3.90k|    while (*arg)
  ------------------
  |  Branch (43:12): [True: 1.95k, False: 1.95k]
  ------------------
   44|  1.95k|        mp_verbose(log, ", %s", *arg++);
  ------------------
  |  |   79|  1.95k|#define mp_verbose(log, ...)    mp_msg(log, MSGL_V, __VA_ARGS__)
  ------------------
   45|  1.95k|    mp_verbose(log, "]\n");
  ------------------
  |  |   79|  1.95k|#define mp_verbose(log, ...)    mp_msg(log, MSGL_V, __VA_ARGS__)
  ------------------
   46|  1.95k|    mp_subprocess2(opts, res);
   47|  1.95k|    if (res->error < 0) {
  ------------------
  |  Branch (47:9): [True: 1.95k, False: 0]
  ------------------
   48|  1.95k|        int lev = res->error == MP_SUBPROCESS_EKILLED_BY_US ? MSGL_V : MSGL_ERR;
  ------------------
  |  |   75|  1.95k|#define MP_SUBPROCESS_EKILLED_BY_US     -2  // mp_cancel was triggered
  ------------------
  |  Branch (48:19): [True: 0, False: 1.95k]
  ------------------
   49|  1.95k|        mp_msg(log, lev, "Subprocess failed: %s\n", mp_subprocess_err_str(res->error));
   50|  1.95k|    }
   51|  1.95k|}

terminal_setup_getch:
  542|      2|{
  543|      2|    if (!getch2_enabled || input_ctx)
  ------------------
  |  Branch (543:9): [True: 1, False: 1]
  |  Branch (543:28): [True: 0, False: 1]
  ------------------
  544|      1|        return;
  545|       |
  546|      1|    if (mp_make_wakeup_pipe(death_pipe) < 0)
  ------------------
  |  Branch (546:9): [True: 0, False: 1]
  ------------------
  547|      0|        return;
  548|       |
  549|       |    // Disable reading from the terminal even if stdout is not a tty, to make
  550|       |    //   mpv ... | less
  551|       |    // do the right thing.
  552|      1|    read_terminal = isatty(tty_in) && isatty(STDOUT_FILENO);
  ------------------
  |  Branch (552:21): [True: 0, False: 1]
  |  Branch (552:39): [True: 0, False: 0]
  ------------------
  553|       |
  554|      1|    input_ctx = ictx;
  555|       |
  556|      1|    if (mp_thread_create(&input_thread, terminal_thread, NULL)) {
  ------------------
  |  |  214|      1|#define mp_thread_create(t, f, a) pthread_create(t, NULL, f, a)
  |  |  ------------------
  |  |  |  Branch (214:35): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  557|      0|        input_ctx = NULL;
  558|      0|        close_sig_pipes();
  559|      0|        close_tty();
  560|      0|        return;
  561|      0|    }
  562|       |
  563|      1|    setsigaction(SIGINT,  quit_request_sighandler, SA_RESETHAND, false, &old_sigint);
  564|      1|    setsigaction(SIGQUIT, quit_request_sighandler, 0, true, &old_sigquit);
  565|      1|    setsigaction(SIGTERM, quit_request_sighandler, 0, true, &old_sigterm);
  566|      1|}
terminal_uninit:
  577|    639|{
  578|    639|    if (!getch2_enabled)
  ------------------
  |  Branch (578:9): [True: 0, False: 639]
  ------------------
  579|      0|        return;
  580|       |
  581|       |    // restore signals
  582|    639|    restore_sigaction(SIGCONT, stop_cont_sighandler, &old_sigcont);
  583|    639|    restore_sigaction(SIGTSTP, stop_cont_sighandler, &old_sigtstp);
  584|    639|    restore_sigaction(SIGWINCH, winch_sighandler, &old_sigwinch);
  585|    639|    if (input_ctx) {
  ------------------
  |  Branch (585:9): [True: 1, False: 638]
  ------------------
  586|      1|        restore_sigaction(SIGINT, quit_request_sighandler, &old_sigint);
  587|      1|        restore_sigaction(SIGQUIT, quit_request_sighandler, &old_sigquit);
  588|      1|        restore_sigaction(SIGTERM, quit_request_sighandler, &old_sigterm);
  589|      1|    }
  590|    639|    restore_sigaction(SIGTTIN, SIG_IGN, &old_sigttin);
  591|    639|    restore_sigaction(SIGTTOU, SIG_IGN, &old_sigttou);
  592|       |
  593|    639|    if (input_ctx) {
  ------------------
  |  Branch (593:9): [True: 1, False: 638]
  ------------------
  594|      1|        (void)write(death_pipe[1], &(char){0}, 1);
  595|      1|        mp_thread_join(input_thread);
  ------------------
  |  |  215|      1|#define mp_thread_join(t)         pthread_join(t, NULL)
  ------------------
  596|      1|    }
  597|       |
  598|    639|    close_sig_pipes();
  599|    639|    input_ctx = NULL;
  600|       |
  601|    639|    do_deactivate_getch2();
  602|    639|    close_tty();
  603|       |
  604|    639|    getch2_enabled = 0;
  605|       |    read_terminal = false;
  606|    639|}
terminal_in_background:
  609|  1.26k|{
  610|  1.26k|    return read_terminal && tcgetpgrp(STDERR_FILENO) != getpgrp();
  ------------------
  |  Branch (610:12): [True: 0, False: 1.26k]
  |  Branch (610:29): [True: 0, False: 0]
  ------------------
  611|  1.26k|}
terminal_get_size:
  614|    332|{
  615|    332|    struct winsize ws;
  616|    332|    if (ioctl(tty_in, TIOCGWINSZ, &ws) < 0 || !ws.ws_row || !ws.ws_col)
  ------------------
  |  Branch (616:9): [True: 332, False: 0]
  |  Branch (616:47): [True: 0, False: 0]
  |  Branch (616:61): [True: 0, False: 0]
  ------------------
  617|    332|        return;
  618|       |
  619|      0|    *w = ws.ws_col;
  620|      0|    *h = ws.ws_row;
  621|      0|}
terminal_lock_output:
  645|  33.3k|{
  646|  33.3k|    mp_mutex_lock(&output_lock);
  ------------------
  |  |  134|  33.3k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  647|  33.3k|}
terminal_unlock_output:
  650|  33.3k|{
  651|  33.3k|    mp_mutex_unlock(&output_lock);
  ------------------
  |  |  136|  33.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  652|  33.3k|}
terminal_init:
  655|    639|{
  656|    639|    mp_assert(!getch2_enabled);
  ------------------
  |  |   41|    639|#define mp_assert assert
  ------------------
  |  Branch (656:5): [True: 639, False: 0]
  ------------------
  657|    639|    getch2_enabled = 1;
  658|       |
  659|    639|    if (mp_make_wakeup_pipe(stop_cont_pipe) < 0) {
  ------------------
  |  Branch (659:9): [True: 0, False: 639]
  ------------------
  660|      0|        getch2_enabled = 0;
  661|      0|        return;
  662|      0|    }
  663|       |
  664|    639|    tty_in = tty_out = open("/dev/tty", O_RDWR | O_CLOEXEC);
  ------------------
  |  |  269|    639|#define open(...) mp_open(__VA_ARGS__)
  ------------------
  665|    639|    if (tty_in < 0) {
  ------------------
  |  Branch (665:9): [True: 0, False: 639]
  ------------------
  666|      0|        tty_in = STDIN_FILENO;
  667|      0|        tty_out = STDOUT_FILENO;
  668|      0|    }
  669|       |
  670|    639|    tcgetattr(tty_in, &tio_orig);
  671|       |
  672|       |    // handlers to fix terminal settings
  673|    639|    setsigaction(SIGCONT, stop_cont_sighandler, 0, true, &old_sigcont);
  674|    639|    setsigaction(SIGTSTP, stop_cont_sighandler, 0, true, &old_sigtstp);
  675|    639|    setsigaction(SIGWINCH, winch_sighandler, 0, true, &old_sigwinch);
  676|    639|    setsigaction(SIGTTIN, SIG_IGN, 0, true, &old_sigttin);
  677|    639|    setsigaction(SIGTTOU, SIG_IGN, 0, true, &old_sigttou);
  678|       |
  679|    639|    getch2_poll();
  680|    639|}
terminal-unix.c:terminal_thread:
  472|      1|{
  473|      1|    mp_thread_set_name("terminal/input");
  474|      1|    bool stdin_ok = read_terminal; // if false, we still wait for SIGTERM
  475|      1|    while (1) {
  ------------------
  |  Branch (475:12): [True: 1, Folded]
  ------------------
  476|      1|        getch2_poll();
  477|      1|        struct pollfd fds[3] = {
  478|      1|            { .events = POLLIN, .fd = death_pipe[0] },
  479|      1|            { .events = POLLIN, .fd = stop_cont_pipe[0] },
  480|      1|            { .events = POLLIN, .fd = tty_in }
  481|      1|        };
  482|       |        /*
  483|       |         * if the process isn't in foreground process group, then on macos
  484|       |         * polldev() doesn't rest and gets into 100% cpu usage (see issue #11795)
  485|       |         * with read() returning EIO. but we shouldn't quit on EIO either since
  486|       |         * the process might be foregrounded later.
  487|       |         *
  488|       |         * so just avoid poll-ing tty_in when we know the process is not in the
  489|       |         * foreground. there's a small race window, but the timeout will take
  490|       |         * care of it so it's fine.
  491|       |         */
  492|      1|        bool is_fg = tcgetpgrp(tty_in) == getpgrp();
  493|      1|        int r = polldev(fds, stdin_ok && is_fg ? 3 : 2, buf.len ? ESC_TIMEOUT : INPUT_TIMEOUT);
  ------------------
  |  |   43|      0|#define ESC_TIMEOUT 100
  ------------------
                      int r = polldev(fds, stdin_ok && is_fg ? 3 : 2, buf.len ? ESC_TIMEOUT : INPUT_TIMEOUT);
  ------------------
  |  |   51|      1|#define INPUT_TIMEOUT 1000
  ------------------
  |  Branch (493:30): [True: 0, False: 1]
  |  Branch (493:42): [True: 0, False: 0]
  |  Branch (493:57): [True: 0, False: 1]
  ------------------
  494|      1|        if (fds[0].revents) {
  ------------------
  |  Branch (494:13): [True: 1, False: 0]
  ------------------
  495|      1|            do_deactivate_getch2();
  496|      1|            break;
  497|      1|        }
  498|      0|        if (fds[1].revents & POLLIN) {
  ------------------
  |  Branch (498:13): [True: 0, False: 0]
  ------------------
  499|      0|            int8_t c = -1;
  500|      0|            (void)read(stop_cont_pipe[0], &c, 1);
  501|      0|            if (c == PIPE_STOP) {
  ------------------
  |  Branch (501:17): [True: 0, False: 0]
  ------------------
  502|      0|                do_deactivate_getch2();
  503|      0|                if (isatty(STDERR_FILENO)) {
  ------------------
  |  Branch (503:21): [True: 0, False: 0]
  ------------------
  504|      0|                    (void)write(STDERR_FILENO, TERM_ESC_RESTORE_CURSOR,
  ------------------
  |  |   30|      0|#define TERM_ESC_RESTORE_CURSOR     "\033[?25h"
  ------------------
  505|      0|                                sizeof(TERM_ESC_RESTORE_CURSOR) - 1);
  ------------------
  |  |   30|      0|#define TERM_ESC_RESTORE_CURSOR     "\033[?25h"
  ------------------
  506|      0|                }
  507|       |                // trying to reset SIGTSTP handler to default and raise it will
  508|       |                // result in a race and there's no other way to invoke the
  509|       |                // default handler. so just invoke SIGSTOP since it's
  510|       |                // effectively the same thing.
  511|      0|                raise(SIGSTOP);
  512|      0|            } else if (c == PIPE_CONT) {
  ------------------
  |  Branch (512:24): [True: 0, False: 0]
  ------------------
  513|      0|                getch2_poll();
  514|      0|            } else if (c == PIPE_WINCH) {
  ------------------
  |  Branch (514:24): [True: 0, False: 0]
  ------------------
  515|      0|                notify_resize();
  516|      0|            }
  517|      0|        }
  518|      0|        if (fds[2].revents) {
  ------------------
  |  Branch (518:13): [True: 0, False: 0]
  ------------------
  519|      0|            int retval = read(tty_in, &buf.b[buf.len], BUF_LEN - buf.len);
  ------------------
  |  |  188|      0|#define BUF_LEN 256
  ------------------
  520|      0|            if (!retval || (retval == -1 && errno != EINTR && errno != EAGAIN && errno != EIO))
  ------------------
  |  Branch (520:17): [True: 0, False: 0]
  |  Branch (520:29): [True: 0, False: 0]
  |  Branch (520:45): [True: 0, False: 0]
  |  Branch (520:63): [True: 0, False: 0]
  |  Branch (520:82): [True: 0, False: 0]
  ------------------
  521|      0|                break; // EOF/closed
  522|      0|            if (retval > 0) {
  ------------------
  |  Branch (522:17): [True: 0, False: 0]
  ------------------
  523|      0|                buf.len += retval;
  524|      0|                process_input(input_ctx, false);
  525|      0|            }
  526|      0|        }
  527|      0|        if (r == 0)
  ------------------
  |  Branch (527:13): [True: 0, False: 0]
  ------------------
  528|      0|            process_input(input_ctx, true);
  529|      0|    }
  530|      1|    char c;
  531|      1|    bool quit = read(death_pipe[0], &c, 1) == 1 && c == 1;
  ------------------
  |  Branch (531:17): [True: 1, False: 0]
  |  Branch (531:52): [True: 0, False: 1]
  ------------------
  532|       |    // Important if we received SIGTERM, rather than regular quit.
  533|      1|    if (quit) {
  ------------------
  |  Branch (533:9): [True: 0, False: 1]
  ------------------
  534|      0|        struct mp_cmd *cmd = mp_input_parse_cmd(input_ctx, bstr0("quit 4"), "");
  535|      0|        if (cmd)
  ------------------
  |  Branch (535:13): [True: 0, False: 0]
  ------------------
  536|      0|            mp_input_queue_cmd(input_ctx, cmd);
  537|      0|    }
  538|       |    MP_THREAD_RETURN();
  ------------------
  |  |  212|      1|#define MP_THREAD_RETURN() return NULL
  ------------------
  539|      1|}
terminal-unix.c:close_sig_pipes:
  449|    639|{
  450|  1.91k|    for (int n = 0; n < 2; n++) {
  ------------------
  |  Branch (450:21): [True: 1.27k, False: 639]
  ------------------
  451|  1.27k|        safe_close(&death_pipe[n]);
  452|  1.27k|        safe_close(&stop_cont_pipe[n]);
  453|  1.27k|    }
  454|    639|}
terminal-unix.c:safe_close:
  442|  2.55k|{
  443|  2.55k|    if (*p >= 0)
  ------------------
  |  Branch (443:9): [True: 1.28k, False: 1.27k]
  ------------------
  444|  1.28k|        close(*p);
  445|  2.55k|    *p = -1;
  446|  2.55k|}
terminal-unix.c:close_tty:
  457|    639|{
  458|    639|    if (tty_in >= 0 && tty_in != STDIN_FILENO)
  ------------------
  |  Branch (458:9): [True: 639, False: 0]
  |  Branch (458:24): [True: 639, False: 0]
  ------------------
  459|    639|        close(tty_in);
  460|       |
  461|    639|    tty_in = tty_out = -1;
  462|    639|}
terminal-unix.c:setsigaction:
  371|  3.19k|{
  372|  3.19k|    struct sigaction sa;
  373|  3.19k|    sa.sa_handler = handler;
  374|       |
  375|  3.19k|    if (do_mask)
  ------------------
  |  Branch (375:9): [True: 3.19k, False: 1]
  ------------------
  376|  3.19k|        sigfillset(&sa.sa_mask);
  377|      1|    else
  378|      1|        sigemptyset(&sa.sa_mask);
  379|       |
  380|       |    sa.sa_flags = flags | SA_RESTART;
  381|  3.19k|    return sigaction(signo, &sa, old);
  382|  3.19k|}
terminal-unix.c:restore_sigaction:
  570|  3.19k|{
  571|  3.19k|    struct sigaction cur;
  572|  3.19k|    if (!sigaction(signo, NULL, &cur) && cur.sa_handler == handler)
  ------------------
  |  Branch (572:9): [True: 3.19k, False: 0]
  |  Branch (572:42): [True: 3.19k, False: 0]
  ------------------
  573|  3.19k|        sigaction(signo, old, NULL);
  574|  3.19k|}
terminal-unix.c:do_deactivate_getch2:
  355|  1.28k|{
  356|  1.28k|    if (!getch2_active)
  ------------------
  |  Branch (356:9): [True: 1.28k, False: 0]
  ------------------
  357|  1.28k|        return;
  358|       |
  359|      0|    enable_kx(false);
  360|      0|    tcsetattr(tty_in, TCSANOW, &tio_orig);
  361|       |
  362|      0|    getch2_active = 0;
  363|      0|}
terminal-unix.c:getch2_poll:
  385|    640|{
  386|    640|    if (!getch2_enabled)
  ------------------
  |  Branch (386:9): [True: 0, False: 640]
  ------------------
  387|      0|        return;
  388|       |
  389|       |    // check if stdin is in the foreground process group
  390|    640|    int newstatus = (tcgetpgrp(tty_in) == getpgrp());
  391|       |
  392|       |    // and activate getch2 if it is, deactivate otherwise
  393|    640|    if (newstatus)
  ------------------
  |  Branch (393:9): [True: 0, False: 640]
  ------------------
  394|      0|        do_activate_getch2();
  395|    640|    else
  396|    640|        do_deactivate_getch2();
  397|    640|}

msg.c:mp_mutex_init:
  113|  65.6k|{
  114|  65.6k|#ifndef NDEBUG
  115|  65.6k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  65.6k|    int ret = 0;
  121|  65.6k|    pthread_mutexattr_t attr;
  122|  65.6k|    ret = pthread_mutexattr_init(&attr);
  123|  65.6k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 65.6k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  65.6k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  65.6k|    ret = pthread_mutex_init(mutex, &attr);
  128|  65.6k|    pthread_mutexattr_destroy(&attr);
  129|  65.6k|    mp_assert(!ret);
  ------------------
  |  |   41|  65.6k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 65.6k, False: 0]
  ------------------
  130|  65.6k|    return ret;
  131|  65.6k|}
msg.c:mp_cond_init:
  139|  16.4k|{
  140|  16.4k|    mp_assert(cond);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (140:5): [True: 16.4k, False: 0]
  ------------------
  141|       |
  142|  16.4k|    int ret = 0;
  143|  16.4k|    pthread_condattr_t attr;
  144|  16.4k|    ret = pthread_condattr_init(&attr);
  145|  16.4k|    if (ret)
  ------------------
  |  Branch (145:9): [True: 0, False: 16.4k]
  ------------------
  146|      0|        return ret;
  147|       |
  148|  16.4k|    cond->clk_id = CLOCK_REALTIME;
  149|  16.4k|#if HAVE_PTHREAD_CONDATTR_SETCLOCK
  150|  16.4k|    if (!pthread_condattr_setclock(&attr, CLOCK_MONOTONIC))
  ------------------
  |  Branch (150:9): [True: 16.4k, False: 0]
  ------------------
  151|  16.4k|        cond->clk_id = CLOCK_MONOTONIC;
  152|  16.4k|#endif
  153|       |
  154|  16.4k|    ret = pthread_cond_init(&cond->cond, &attr);
  155|  16.4k|    pthread_condattr_destroy(&attr);
  156|  16.4k|    return ret;
  157|  16.4k|}
msg.c:mp_cond_destroy:
  160|  16.4k|{
  161|  16.4k|    mp_assert(cond);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (161:5): [True: 16.4k, False: 0]
  ------------------
  162|  16.4k|    return pthread_cond_destroy(&cond->cond);
  163|  16.4k|}
stats.c:mp_mutex_init:
  113|  16.4k|{
  114|  16.4k|#ifndef NDEBUG
  115|  16.4k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  16.4k|    int ret = 0;
  121|  16.4k|    pthread_mutexattr_t attr;
  122|  16.4k|    ret = pthread_mutexattr_init(&attr);
  123|  16.4k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 16.4k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  16.4k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  16.4k|    ret = pthread_mutex_init(mutex, &attr);
  128|  16.4k|    pthread_mutexattr_destroy(&attr);
  129|  16.4k|    mp_assert(!ret);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 16.4k, False: 0]
  ------------------
  130|  16.4k|    return ret;
  131|  16.4k|}
packet_pool.c:mp_mutex_init:
  113|  16.4k|{
  114|  16.4k|#ifndef NDEBUG
  115|  16.4k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  16.4k|    int ret = 0;
  121|  16.4k|    pthread_mutexattr_t attr;
  122|  16.4k|    ret = pthread_mutexattr_init(&attr);
  123|  16.4k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 16.4k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  16.4k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  16.4k|    ret = pthread_mutex_init(mutex, &attr);
  128|  16.4k|    pthread_mutexattr_destroy(&attr);
  129|  16.4k|    mp_assert(!ret);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 16.4k, False: 0]
  ------------------
  130|  16.4k|    return ret;
  131|  16.4k|}
input.c:mp_mutex_init:
  113|  16.4k|{
  114|  16.4k|#ifndef NDEBUG
  115|  16.4k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  16.4k|    int ret = 0;
  121|  16.4k|    pthread_mutexattr_t attr;
  122|  16.4k|    ret = pthread_mutexattr_init(&attr);
  123|  16.4k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 16.4k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  16.4k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  16.4k|    ret = pthread_mutex_init(mutex, &attr);
  128|  16.4k|    pthread_mutexattr_destroy(&attr);
  129|  16.4k|    mp_assert(!ret);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 16.4k, False: 0]
  ------------------
  130|  16.4k|    return ret;
  131|  16.4k|}
dispatch.c:mp_cond_destroy:
  160|  16.4k|{
  161|  16.4k|    mp_assert(cond);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (161:5): [True: 16.4k, False: 0]
  ------------------
  162|  16.4k|    return pthread_cond_destroy(&cond->cond);
  163|  16.4k|}
dispatch.c:mp_mutex_init:
  113|  16.4k|{
  114|  16.4k|#ifndef NDEBUG
  115|  16.4k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  16.4k|    int ret = 0;
  121|  16.4k|    pthread_mutexattr_t attr;
  122|  16.4k|    ret = pthread_mutexattr_init(&attr);
  123|  16.4k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 16.4k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  16.4k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  16.4k|    ret = pthread_mutex_init(mutex, &attr);
  128|  16.4k|    pthread_mutexattr_destroy(&attr);
  129|  16.4k|    mp_assert(!ret);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 16.4k, False: 0]
  ------------------
  130|  16.4k|    return ret;
  131|  16.4k|}
dispatch.c:mp_cond_init:
  139|  16.4k|{
  140|  16.4k|    mp_assert(cond);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (140:5): [True: 16.4k, False: 0]
  ------------------
  141|       |
  142|  16.4k|    int ret = 0;
  143|  16.4k|    pthread_condattr_t attr;
  144|  16.4k|    ret = pthread_condattr_init(&attr);
  145|  16.4k|    if (ret)
  ------------------
  |  Branch (145:9): [True: 0, False: 16.4k]
  ------------------
  146|      0|        return ret;
  147|       |
  148|  16.4k|    cond->clk_id = CLOCK_REALTIME;
  149|  16.4k|#if HAVE_PTHREAD_CONDATTR_SETCLOCK
  150|  16.4k|    if (!pthread_condattr_setclock(&attr, CLOCK_MONOTONIC))
  ------------------
  |  Branch (150:9): [True: 16.4k, False: 0]
  ------------------
  151|  16.4k|        cond->clk_id = CLOCK_MONOTONIC;
  152|  16.4k|#endif
  153|       |
  154|  16.4k|    ret = pthread_cond_init(&cond->cond, &attr);
  155|  16.4k|    pthread_condattr_destroy(&attr);
  156|  16.4k|    return ret;
  157|  16.4k|}
dispatch.c:mp_cond_wait:
  178|  64.1k|{
  179|  64.1k|    mp_assert(cond);
  ------------------
  |  |   41|  64.1k|#define mp_assert assert
  ------------------
  |  Branch (179:5): [True: 64.1k, False: 0]
  ------------------
  180|  64.1k|    return pthread_cond_wait(&cond->cond, mutex);
  181|  64.1k|}
dispatch.c:mp_cond_broadcast:
  166|   155k|{
  167|   155k|    mp_assert(cond);
  ------------------
  |  |   41|   155k|#define mp_assert assert
  ------------------
  |  Branch (167:5): [True: 155k, False: 0]
  ------------------
  168|   155k|    return pthread_cond_broadcast(&cond->cond);
  169|   155k|}
dispatch.c:mp_cond_timedwait_until:
  205|  16.9k|{
  206|  16.9k|    return mp_cond_timedwait(cond, mutex, until - mp_time_ns());
  207|  16.9k|}
dispatch.c:mp_cond_timedwait:
  184|  16.9k|{
  185|  16.9k|    mp_assert(cond);
  ------------------
  |  |   41|  16.9k|#define mp_assert assert
  ------------------
  |  Branch (185:5): [True: 16.9k, False: 0]
  ------------------
  186|       |
  187|  16.9k|    timeout = MPMAX(0, timeout);
  ------------------
  |  |   44|  16.9k|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 16.9k]
  |  |  ------------------
  ------------------
  188|       |    // consider anything above 1000 days as infinity
  189|  16.9k|    if (timeout > MP_TIME_S_TO_NS(1000 * 24 * 60 * 60))
  ------------------
  |  |   71|  16.9k|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
  |  Branch (189:9): [True: 453, False: 16.4k]
  ------------------
  190|    453|        return pthread_cond_wait(&cond->cond, mutex);
  191|       |
  192|  16.4k|    struct timespec ts;
  193|  16.4k|    clock_gettime(cond->clk_id, &ts);
  194|  16.4k|    ts.tv_sec  += timeout / MP_TIME_S_TO_NS(1);
  ------------------
  |  |   71|  16.4k|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
  195|  16.4k|    ts.tv_nsec += timeout % MP_TIME_S_TO_NS(1);
  ------------------
  |  |   71|  16.4k|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
  196|  16.4k|    if (ts.tv_nsec >= MP_TIME_S_TO_NS(1)) {
  ------------------
  |  |   71|  16.4k|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
  |  Branch (196:9): [True: 16.4k, False: 0]
  ------------------
  197|  16.4k|        ts.tv_nsec -= MP_TIME_S_TO_NS(1);
  ------------------
  |  |   71|  16.4k|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
  198|  16.4k|        ts.tv_sec++;
  199|  16.4k|    }
  200|       |
  201|  16.4k|    return pthread_cond_timedwait(&cond->cond, mutex, &ts);
  202|  16.9k|}
thread_pool.c:mp_cond_broadcast:
  166|  16.4k|{
  167|  16.4k|    mp_assert(cond);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (167:5): [True: 16.4k, False: 0]
  ------------------
  168|  16.4k|    return pthread_cond_broadcast(&cond->cond);
  169|  16.4k|}
thread_pool.c:mp_cond_destroy:
  160|  16.4k|{
  161|  16.4k|    mp_assert(cond);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (161:5): [True: 16.4k, False: 0]
  ------------------
  162|  16.4k|    return pthread_cond_destroy(&cond->cond);
  163|  16.4k|}
thread_pool.c:mp_mutex_init:
  113|  16.4k|{
  114|  16.4k|#ifndef NDEBUG
  115|  16.4k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  16.4k|    int ret = 0;
  121|  16.4k|    pthread_mutexattr_t attr;
  122|  16.4k|    ret = pthread_mutexattr_init(&attr);
  123|  16.4k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 16.4k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  16.4k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  16.4k|    ret = pthread_mutex_init(mutex, &attr);
  128|  16.4k|    pthread_mutexattr_destroy(&attr);
  129|  16.4k|    mp_assert(!ret);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 16.4k, False: 0]
  ------------------
  130|  16.4k|    return ret;
  131|  16.4k|}
thread_pool.c:mp_cond_init:
  139|  16.4k|{
  140|  16.4k|    mp_assert(cond);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (140:5): [True: 16.4k, False: 0]
  ------------------
  141|       |
  142|  16.4k|    int ret = 0;
  143|  16.4k|    pthread_condattr_t attr;
  144|  16.4k|    ret = pthread_condattr_init(&attr);
  145|  16.4k|    if (ret)
  ------------------
  |  Branch (145:9): [True: 0, False: 16.4k]
  ------------------
  146|      0|        return ret;
  147|       |
  148|  16.4k|    cond->clk_id = CLOCK_REALTIME;
  149|  16.4k|#if HAVE_PTHREAD_CONDATTR_SETCLOCK
  150|  16.4k|    if (!pthread_condattr_setclock(&attr, CLOCK_MONOTONIC))
  ------------------
  |  Branch (150:9): [True: 16.4k, False: 0]
  ------------------
  151|  16.4k|        cond->clk_id = CLOCK_MONOTONIC;
  152|  16.4k|#endif
  153|       |
  154|  16.4k|    ret = pthread_cond_init(&cond->cond, &attr);
  155|  16.4k|    pthread_condattr_destroy(&attr);
  156|  16.4k|    return ret;
  157|  16.4k|}
thread_tools.c:mp_cond_destroy:
  160|  27.7k|{
  161|  27.7k|    mp_assert(cond);
  ------------------
  |  |   41|  27.7k|#define mp_assert assert
  ------------------
  |  Branch (161:5): [True: 27.7k, False: 0]
  ------------------
  162|  27.7k|    return pthread_cond_destroy(&cond->cond);
  163|  27.7k|}
thread_tools.c:mp_cond_signal:
  172|  11.3k|{
  173|  11.3k|    mp_assert(cond);
  ------------------
  |  |   41|  11.3k|#define mp_assert assert
  ------------------
  |  Branch (173:5): [True: 11.3k, False: 0]
  ------------------
  174|  11.3k|    return pthread_cond_signal(&cond->cond);
  175|  11.3k|}
thread_tools.c:mp_mutex_init:
  113|  16.4k|{
  114|  16.4k|#ifndef NDEBUG
  115|  16.4k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  16.4k|    int ret = 0;
  121|  16.4k|    pthread_mutexattr_t attr;
  122|  16.4k|    ret = pthread_mutexattr_init(&attr);
  123|  16.4k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 16.4k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  16.4k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  16.4k|    ret = pthread_mutex_init(mutex, &attr);
  128|  16.4k|    pthread_mutexattr_destroy(&attr);
  129|  16.4k|    mp_assert(!ret);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 16.4k, False: 0]
  ------------------
  130|  16.4k|    return ret;
  131|  16.4k|}
thread_tools.c:mp_cond_init:
  139|  16.4k|{
  140|  16.4k|    mp_assert(cond);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (140:5): [True: 16.4k, False: 0]
  ------------------
  141|       |
  142|  16.4k|    int ret = 0;
  143|  16.4k|    pthread_condattr_t attr;
  144|  16.4k|    ret = pthread_condattr_init(&attr);
  145|  16.4k|    if (ret)
  ------------------
  |  Branch (145:9): [True: 0, False: 16.4k]
  ------------------
  146|      0|        return ret;
  147|       |
  148|  16.4k|    cond->clk_id = CLOCK_REALTIME;
  149|  16.4k|#if HAVE_PTHREAD_CONDATTR_SETCLOCK
  150|  16.4k|    if (!pthread_condattr_setclock(&attr, CLOCK_MONOTONIC))
  ------------------
  |  Branch (150:9): [True: 16.4k, False: 0]
  ------------------
  151|  16.4k|        cond->clk_id = CLOCK_MONOTONIC;
  152|  16.4k|#endif
  153|       |
  154|  16.4k|    ret = pthread_cond_init(&cond->cond, &attr);
  155|  16.4k|    pthread_condattr_destroy(&attr);
  156|  16.4k|    return ret;
  157|  16.4k|}
thread_tools.c:mp_cond_broadcast:
  166|  16.4k|{
  167|  16.4k|    mp_assert(cond);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (167:5): [True: 16.4k, False: 0]
  ------------------
  168|  16.4k|    return pthread_cond_broadcast(&cond->cond);
  169|  16.4k|}
m_config_core.c:mp_mutex_init:
  113|  29.7k|{
  114|  29.7k|#ifndef NDEBUG
  115|  29.7k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  29.7k|    int ret = 0;
  121|  29.7k|    pthread_mutexattr_t attr;
  122|  29.7k|    ret = pthread_mutexattr_init(&attr);
  123|  29.7k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 29.7k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  29.7k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  29.7k|    ret = pthread_mutex_init(mutex, &attr);
  128|  29.7k|    pthread_mutexattr_destroy(&attr);
  129|  29.7k|    mp_assert(!ret);
  ------------------
  |  |   41|  29.7k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 29.7k, False: 0]
  ------------------
  130|  29.7k|    return ret;
  131|  29.7k|}
client.c:mp_mutex_init:
  113|  79.5k|{
  114|  79.5k|#ifndef NDEBUG
  115|  79.5k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  79.5k|    int ret = 0;
  121|  79.5k|    pthread_mutexattr_t attr;
  122|  79.5k|    ret = pthread_mutexattr_init(&attr);
  123|  79.5k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 79.5k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  79.5k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  79.5k|    ret = pthread_mutex_init(mutex, &attr);
  128|  79.5k|    pthread_mutexattr_destroy(&attr);
  129|  79.5k|    mp_assert(!ret);
  ------------------
  |  |   41|  79.5k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 79.5k, False: 0]
  ------------------
  130|  79.5k|    return ret;
  131|  79.5k|}
client.c:mp_cond_init:
  139|  31.5k|{
  140|  31.5k|    mp_assert(cond);
  ------------------
  |  |   41|  31.5k|#define mp_assert assert
  ------------------
  |  Branch (140:5): [True: 31.5k, False: 0]
  ------------------
  141|       |
  142|  31.5k|    int ret = 0;
  143|  31.5k|    pthread_condattr_t attr;
  144|  31.5k|    ret = pthread_condattr_init(&attr);
  145|  31.5k|    if (ret)
  ------------------
  |  Branch (145:9): [True: 0, False: 31.5k]
  ------------------
  146|      0|        return ret;
  147|       |
  148|  31.5k|    cond->clk_id = CLOCK_REALTIME;
  149|  31.5k|#if HAVE_PTHREAD_CONDATTR_SETCLOCK
  150|  31.5k|    if (!pthread_condattr_setclock(&attr, CLOCK_MONOTONIC))
  ------------------
  |  Branch (150:9): [True: 31.5k, False: 0]
  ------------------
  151|  31.5k|        cond->clk_id = CLOCK_MONOTONIC;
  152|  31.5k|#endif
  153|       |
  154|  31.5k|    ret = pthread_cond_init(&cond->cond, &attr);
  155|  31.5k|    pthread_condattr_destroy(&attr);
  156|  31.5k|    return ret;
  157|  31.5k|}
client.c:mp_cond_timedwait_until:
  205|  18.3k|{
  206|  18.3k|    return mp_cond_timedwait(cond, mutex, until - mp_time_ns());
  207|  18.3k|}
client.c:mp_cond_timedwait:
  184|  18.3k|{
  185|  18.3k|    mp_assert(cond);
  ------------------
  |  |   41|  18.3k|#define mp_assert assert
  ------------------
  |  Branch (185:5): [True: 18.3k, False: 0]
  ------------------
  186|       |
  187|  18.3k|    timeout = MPMAX(0, timeout);
  ------------------
  |  |   44|  18.3k|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 1.95k, False: 16.3k]
  |  |  ------------------
  ------------------
  188|       |    // consider anything above 1000 days as infinity
  189|  18.3k|    if (timeout > MP_TIME_S_TO_NS(1000 * 24 * 60 * 60))
  ------------------
  |  |   71|  18.3k|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
  |  Branch (189:9): [True: 16.3k, False: 1.95k]
  ------------------
  190|  16.3k|        return pthread_cond_wait(&cond->cond, mutex);
  191|       |
  192|  1.95k|    struct timespec ts;
  193|  1.95k|    clock_gettime(cond->clk_id, &ts);
  194|  1.95k|    ts.tv_sec  += timeout / MP_TIME_S_TO_NS(1);
  ------------------
  |  |   71|  1.95k|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
  195|  1.95k|    ts.tv_nsec += timeout % MP_TIME_S_TO_NS(1);
  ------------------
  |  |   71|  1.95k|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
  196|  1.95k|    if (ts.tv_nsec >= MP_TIME_S_TO_NS(1)) {
  ------------------
  |  |   71|  1.95k|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
  |  Branch (196:9): [True: 0, False: 1.95k]
  ------------------
  197|      0|        ts.tv_nsec -= MP_TIME_S_TO_NS(1);
  ------------------
  |  |   71|      0|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
  198|      0|        ts.tv_sec++;
  199|      0|    }
  200|       |
  201|  1.95k|    return pthread_cond_timedwait(&cond->cond, mutex, &ts);
  202|  18.3k|}
client.c:mp_cond_destroy:
  160|  31.5k|{
  161|  31.5k|    mp_assert(cond);
  ------------------
  |  |   41|  31.5k|#define mp_assert assert
  ------------------
  |  Branch (161:5): [True: 31.5k, False: 0]
  ------------------
  162|  31.5k|    return pthread_cond_destroy(&cond->cond);
  163|  31.5k|}
client.c:mp_thread_set_name:
  222|  16.4k|{
  223|  16.4k|#if HAVE_GLIBC_THREAD_NAME
  224|  16.4k|    if (pthread_setname_np(pthread_self(), name) == ERANGE) {
  ------------------
  |  Branch (224:9): [True: 0, False: 16.4k]
  ------------------
  225|      0|        char tname[16] = {0}; // glibc-checked kernel limit
  226|      0|        strncpy(tname, name, sizeof(tname) - 1);
  227|      0|        pthread_setname_np(pthread_self(), tname);
  228|      0|    }
  229|       |#elif HAVE_BSD_THREAD_NAME
  230|       |    pthread_set_name_np(pthread_self(), name);
  231|       |#elif HAVE_MAC_THREAD_NAME
  232|       |    pthread_setname_np(name);
  233|       |#endif
  234|  16.4k|}
client.c:mp_cond_broadcast:
  166|  16.5k|{
  167|  16.5k|    mp_assert(cond);
  ------------------
  |  |   41|  16.5k|#define mp_assert assert
  ------------------
  |  Branch (167:5): [True: 16.5k, False: 0]
  ------------------
  168|  16.5k|    return pthread_cond_broadcast(&cond->cond);
  169|  16.5k|}
main.c:mp_mutex_init:
  113|  16.4k|{
  114|  16.4k|#ifndef NDEBUG
  115|  16.4k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  16.4k|    int ret = 0;
  121|  16.4k|    pthread_mutexattr_t attr;
  122|  16.4k|    ret = pthread_mutexattr_init(&attr);
  123|  16.4k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 16.4k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  16.4k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  16.4k|    ret = pthread_mutex_init(mutex, &attr);
  128|  16.4k|    pthread_mutexattr_destroy(&attr);
  129|  16.4k|    mp_assert(!ret);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 16.4k, False: 0]
  ------------------
  130|  16.4k|    return ret;
  131|  16.4k|}
osd.c:mp_mutex_init:
  113|  16.4k|{
  114|  16.4k|#ifndef NDEBUG
  115|  16.4k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  16.4k|    int ret = 0;
  121|  16.4k|    pthread_mutexattr_t attr;
  122|  16.4k|    ret = pthread_mutexattr_init(&attr);
  123|  16.4k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 16.4k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  16.4k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  16.4k|    ret = pthread_mutex_init(mutex, &attr);
  128|  16.4k|    pthread_mutexattr_destroy(&attr);
  129|  16.4k|    mp_assert(!ret);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 16.4k, False: 0]
  ------------------
  130|  16.4k|    return ret;
  131|  16.4k|}
scripting.c:mp_thread_set_name:
  222|  3.85k|{
  223|  3.85k|#if HAVE_GLIBC_THREAD_NAME
  224|  3.85k|    if (pthread_setname_np(pthread_self(), name) == ERANGE) {
  ------------------
  |  Branch (224:9): [True: 382, False: 3.46k]
  ------------------
  225|    382|        char tname[16] = {0}; // glibc-checked kernel limit
  226|    382|        strncpy(tname, name, sizeof(tname) - 1);
  227|    382|        pthread_setname_np(pthread_self(), tname);
  228|    382|    }
  229|       |#elif HAVE_BSD_THREAD_NAME
  230|       |    pthread_set_name_np(pthread_self(), name);
  231|       |#elif HAVE_MAC_THREAD_NAME
  232|       |    pthread_setname_np(name);
  233|       |#endif
  234|  3.85k|}
clipboard.c:mp_mutex_init:
  113|  16.4k|{
  114|  16.4k|#ifndef NDEBUG
  115|  16.4k|    int mutex_type = PTHREAD_MUTEX_ERRORCHECK;
  116|       |#else
  117|       |    int mutex_type = PTHREAD_MUTEX_DEFAULT;
  118|       |#endif
  119|       |
  120|  16.4k|    int ret = 0;
  121|  16.4k|    pthread_mutexattr_t attr;
  122|  16.4k|    ret = pthread_mutexattr_init(&attr);
  123|  16.4k|    if (ret != 0)
  ------------------
  |  Branch (123:9): [True: 0, False: 16.4k]
  ------------------
  124|      0|        return ret;
  125|       |
  126|  16.4k|    pthread_mutexattr_settype(&attr, mutex_type);
  127|  16.4k|    ret = pthread_mutex_init(mutex, &attr);
  128|  16.4k|    pthread_mutexattr_destroy(&attr);
  129|  16.4k|    mp_assert(!ret);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (129:5): [True: 16.4k, False: 0]
  ------------------
  130|  16.4k|    return ret;
  131|  16.4k|}
ipc-unix.c:mp_thread_set_name:
  222|  1.95k|{
  223|  1.95k|#if HAVE_GLIBC_THREAD_NAME
  224|  1.95k|    if (pthread_setname_np(pthread_self(), name) == ERANGE) {
  ------------------
  |  Branch (224:9): [True: 157, False: 1.79k]
  ------------------
  225|    157|        char tname[16] = {0}; // glibc-checked kernel limit
  226|    157|        strncpy(tname, name, sizeof(tname) - 1);
  227|    157|        pthread_setname_np(pthread_self(), tname);
  228|    157|    }
  229|       |#elif HAVE_BSD_THREAD_NAME
  230|       |    pthread_set_name_np(pthread_self(), name);
  231|       |#elif HAVE_MAC_THREAD_NAME
  232|       |    pthread_setname_np(name);
  233|       |#endif
  234|  1.95k|}
terminal-unix.c:mp_thread_set_name:
  222|      1|{
  223|      1|#if HAVE_GLIBC_THREAD_NAME
  224|      1|    if (pthread_setname_np(pthread_self(), name) == ERANGE) {
  ------------------
  |  Branch (224:9): [True: 0, False: 1]
  ------------------
  225|      0|        char tname[16] = {0}; // glibc-checked kernel limit
  226|      0|        strncpy(tname, name, sizeof(tname) - 1);
  227|      0|        pthread_setname_np(pthread_self(), tname);
  228|      0|    }
  229|       |#elif HAVE_BSD_THREAD_NAME
  230|       |    pthread_set_name_np(pthread_self(), name);
  231|       |#elif HAVE_MAC_THREAD_NAME
  232|       |    pthread_setname_np(name);
  233|       |#endif
  234|      1|}

mp_raw_time_ns:
   45|   190k|{
   46|   190k|    struct timespec tp = {0};
   47|   190k|    clock_gettime(clk_id, &tp);
   48|       |    return MP_TIME_S_TO_NS(tp.tv_sec) + tp.tv_nsec;
  ------------------
  |  |   71|   190k|#define MP_TIME_S_TO_NS(s) ((s) * INT64_C(1000000000))
  ------------------
   49|   190k|}
mp_raw_time_init:
   52|      1|{
   53|      1|    static const clockid_t clock_ids[] = {
   54|      1|#ifdef CLOCK_MONOTONIC_RAW
   55|      1|        CLOCK_MONOTONIC_RAW,
   56|      1|#endif
   57|      1|        CLOCK_MONOTONIC,
   58|      1|    };
   59|       |
   60|      1|    struct timespec tp;
   61|      1|    for (int i = 0; i < MP_ARRAY_SIZE(clock_ids); ++i) {
  ------------------
  |  |   49|      1|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (61:21): [True: 1, False: 0]
  ------------------
   62|      1|        clk_id = clock_ids[i];
   63|      1|        if (!clock_gettime(clk_id, &tp))
  ------------------
  |  Branch (63:13): [True: 1, False: 0]
  ------------------
   64|      1|            return;
   65|      1|    }
   66|      0|    fputs("No clock source available!\n", stderr);
   67|      0|    abort();
   68|      1|}

mp_time_init:
   39|  16.4k|{
   40|  16.4k|    mp_exec_once(&timer_init_once, do_timer_init);
  ------------------
  |  |  209|  16.4k|#define mp_exec_once pthread_once
  ------------------
   41|  16.4k|}
mp_time_ns:
   44|   190k|{
   45|   190k|    return mp_time_ns_from_raw_time(mp_raw_time_ns());
   46|   190k|}
mp_time_ns_from_raw_time:
   49|   190k|{
   50|   190k|    return raw_time - raw_time_offset;
   51|   190k|}
mp_time_sec:
   54|   102k|{
   55|   102k|    return mp_time_ns() / 1e9;
   56|   102k|}
mp_time_ns_add:
   59|  53.0k|{
   60|  53.0k|    mp_assert(time_ns > 0); // mp_time_ns() returns strictly positive values
  ------------------
  |  |   41|  53.0k|#define mp_assert assert
  ------------------
  |  Branch (60:5): [True: 53.0k, False: 0]
  ------------------
   61|  53.0k|    double t = MPCLAMP(timeout_sec * 1e9, -0x1p63, 0x1p63);
  ------------------
  |  |   46|  53.0k|#define MPCLAMP(a, min, max) (((a) < (min)) ? (min) : (((a) > (max)) ? (max) : (a)))
  |  |  ------------------
  |  |  |  Branch (46:31): [True: 0, False: 53.0k]
  |  |  |  Branch (46:56): [True: 16.8k, False: 36.1k]
  |  |  ------------------
  ------------------
   62|  53.0k|    int64_t ti = t == 0x1p63 ? INT64_MAX : (int64_t)t;
  ------------------
  |  Branch (62:18): [True: 16.8k, False: 36.1k]
  ------------------
   63|  53.0k|    if (ti > INT64_MAX - time_ns)
  ------------------
  |  Branch (63:9): [True: 16.8k, False: 36.1k]
  ------------------
   64|  16.8k|        return INT64_MAX;
   65|  36.1k|    if (ti <= -time_ns)
  ------------------
  |  Branch (65:9): [True: 0, False: 36.1k]
  ------------------
   66|      0|        return 1;
   67|  36.1k|    return time_ns + ti;
   68|  36.1k|}
timer.c:do_timer_init:
   32|      1|{
   33|      1|    mp_raw_time_init();
   34|      1|    raw_time_offset = mp_raw_time_ns();
   35|       |    mp_assert(raw_time_offset > 0);
  ------------------
  |  |   41|      1|#define mp_assert assert
  ------------------
  |  Branch (35:5): [True: 1, False: 0]
  ------------------
   36|      1|}

audio_update_volume:
  187|  11.3k|{
  188|  11.3k|    struct ao_chain *ao_c = mpctx->ao_chain;
  189|  11.3k|    if (!ao_c || !ao_c->ao)
  ------------------
  |  Branch (189:9): [True: 11.3k, False: 0]
  |  Branch (189:18): [True: 0, False: 0]
  ------------------
  190|  11.3k|        return;
  191|       |
  192|      0|    float gain = audio_get_gain(mpctx);
  193|      0|    ao_set_gain(ao_c->ao, gain);
  194|      0|}
uninit_audio_out:
  243|  16.4k|{
  244|  16.4k|    struct ao_chain *ao_c = mpctx->ao_chain;
  245|  16.4k|    if (ao_c) {
  ------------------
  |  Branch (245:9): [True: 0, False: 16.4k]
  ------------------
  246|      0|        ao_c->ao_queue = NULL;
  247|      0|        TA_FREEP(&ao_c->queue_filter);
  ------------------
  |  |   81|      0|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|      0|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 0]
  |  |  ------------------
  ------------------
  248|      0|        ao_c->ao = NULL;
  249|      0|    }
  250|  16.4k|    if (mpctx->ao) {
  ------------------
  |  Branch (250:9): [True: 0, False: 16.4k]
  ------------------
  251|       |        // Note: with gapless_audio, stop_play is not correctly set
  252|      0|        if ((mpctx->opts->gapless_audio || mpctx->stop_play == AT_END_OF_FILE) &&
  ------------------
  |  Branch (252:14): [True: 0, False: 0]
  |  Branch (252:44): [True: 0, False: 0]
  ------------------
  253|      0|            ao_is_playing(mpctx->ao) && !get_internal_paused(mpctx))
  ------------------
  |  Branch (253:13): [True: 0, False: 0]
  |  Branch (253:41): [True: 0, False: 0]
  ------------------
  254|      0|        {
  255|      0|            MP_VERBOSE(mpctx, "draining left over audio\n");
  ------------------
  |  |   92|      0|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  256|      0|            ao_drain(mpctx->ao);
  257|      0|        }
  258|      0|        ao_uninit(mpctx->ao);
  259|       |
  260|      0|        mp_notify(mpctx, MPV_EVENT_AUDIO_RECONFIG, NULL);
  261|      0|    }
  262|  16.4k|    mpctx->ao = NULL;
  263|       |    TA_FREEP(&mpctx->ao_filter_fmt);
  ------------------
  |  |   81|  16.4k|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|  16.4k|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 16.4k]
  |  |  ------------------
  ------------------
  264|  16.4k|}
reload_audio_output:
  787|  11.3k|{
  788|  11.3k|    if (!mpctx->ao)
  ------------------
  |  Branch (788:9): [True: 11.3k, False: 0]
  ------------------
  789|  11.3k|        return;
  790|       |
  791|      0|    ao_reset(mpctx->ao);
  792|      0|    uninit_audio_out(mpctx);
  793|      0|    reinit_audio_filters(mpctx); // mostly to issue refresh seek
  794|       |
  795|      0|    struct ao_chain *ao_c = mpctx->ao_chain;
  796|       |
  797|      0|    if (ao_c) {
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  ------------------
  798|      0|        reset_audio_state(mpctx);
  799|      0|        mp_output_chain_reset_harder(ao_c->filter);
  800|      0|    }
  801|       |
  802|       |    // Whether we can use spdif might have changed. If we failed to use spdif
  803|       |    // in the previous initialization, try it with spdif again (we'll fallback
  804|       |    // to PCM again if necessary).
  805|      0|    if (ao_c && ao_c->track) {
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  |  Branch (805:17): [True: 0, False: 0]
  ------------------
  806|      0|        struct mp_decoder_wrapper *dec = ao_c->track->dec;
  807|      0|        if (dec && ao_c->spdif_failed) {
  ------------------
  |  Branch (807:13): [True: 0, False: 0]
  |  Branch (807:20): [True: 0, False: 0]
  ------------------
  808|      0|            ao_c->spdif_passthrough = true;
  809|      0|            ao_c->spdif_failed = false;
  810|      0|            mp_decoder_wrapper_set_spdif_flag(ao_c->track->dec, true);
  811|      0|            if (!mp_decoder_wrapper_reinit(dec)) {
  ------------------
  |  Branch (811:17): [True: 0, False: 0]
  ------------------
  812|      0|                MP_ERR(mpctx, "Error reinitializing audio.\n");
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  813|      0|                error_on_track(mpctx, ao_c->track);
  814|      0|            }
  815|      0|        }
  816|      0|    }
  817|       |
  818|      0|    mp_wakeup_core(mpctx);
  819|      0|}

mp_clients_init:
  180|  16.4k|{
  181|  16.4k|    mpctx->clients = talloc_ptrtype(NULL, mpctx->clients);
  ------------------
  |  |   34|  16.4k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  16.4k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  182|  16.4k|    *mpctx->clients = (struct mp_client_api) {
  183|  16.4k|        .mpctx = mpctx,
  184|  16.4k|    };
  185|  16.4k|    mpctx->global->client_api = mpctx->clients;
  186|  16.4k|    mp_mutex_init(&mpctx->clients->lock);
  187|  16.4k|}
mp_clients_destroy:
  190|  16.4k|{
  191|  16.4k|    if (!mpctx->clients)
  ------------------
  |  Branch (191:9): [True: 0, False: 16.4k]
  ------------------
  192|      0|        return;
  193|  16.4k|    mp_assert(mpctx->clients->num_clients == 0);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (193:5): [True: 16.4k, False: 0]
  ------------------
  194|       |
  195|       |    // The API user is supposed to call mpv_render_context_free(). It's simply
  196|       |    // not allowed not to do this.
  197|  16.4k|    if (mpctx->clients->render_context) {
  ------------------
  |  Branch (197:9): [True: 0, False: 16.4k]
  ------------------
  198|      0|        MP_FATAL(mpctx, "Broken API use: mpv_render_context_free() not called.\n");
  ------------------
  |  |   88|      0|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  199|      0|        abort();
  200|      0|    }
  201|       |
  202|  16.4k|    mp_mutex_destroy(&mpctx->clients->lock);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
  203|  16.4k|    talloc_free(mpctx->clients);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  204|       |    mpctx->clients = NULL;
  205|  16.4k|}
mp_clients_all_initialized:
  210|  12.0k|{
  211|  12.0k|    bool all_ok = true;
  212|  12.0k|    mp_mutex_lock(&mpctx->clients->lock);
  ------------------
  |  |  134|  12.0k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  213|  26.5k|    for (int n = 0; n < mpctx->clients->num_clients; n++) {
  ------------------
  |  Branch (213:21): [True: 14.4k, False: 12.0k]
  ------------------
  214|  14.4k|        struct mpv_handle *ctx = mpctx->clients->clients[n];
  215|  14.4k|        mp_mutex_lock(&ctx->lock);
  ------------------
  |  |  134|  14.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  216|  14.4k|        all_ok &= ctx->fuzzy_initialized;
  217|  14.4k|        mp_mutex_unlock(&ctx->lock);
  ------------------
  |  |  136|  14.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  218|  14.4k|    }
  219|  12.0k|    mp_mutex_unlock(&mpctx->clients->lock);
  ------------------
  |  |  136|  12.0k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  220|  12.0k|    return all_ok;
  221|  12.0k|}
mp_new_weak_client:
  324|  15.2k|{
  325|       |    return new_client(clients, name, true);
  326|  15.2k|}
mpv_client_name:
  329|  5.80k|{
  330|  5.80k|    return ctx->name;
  331|  5.80k|}
mpv_client_id:
  334|  3.85k|{
  335|  3.85k|    return ctx->id;
  336|  3.85k|}
mp_client_get_log:
  339|  5.80k|{
  340|  5.80k|    return ctx->log;
  341|  5.80k|}
mpv_wait_async_requests:
  398|  31.5k|{
  399|  31.5k|    mp_mutex_lock(&ctx->lock);
  ------------------
  |  |  134|  31.5k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  400|  31.5k|    while (ctx->reserved_events || ctx->async_counter)
  ------------------
  |  Branch (400:12): [True: 0, False: 31.5k]
  |  Branch (400:36): [True: 0, False: 31.5k]
  ------------------
  401|      0|        wait_wakeup(ctx, INT64_MAX);
  402|  31.5k|    mp_mutex_unlock(&ctx->lock);
  ------------------
  |  |  136|  31.5k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  403|  31.5k|}
mpv_destroy:
  537|  17.1k|{
  538|       |    mp_destroy_client(ctx, false);
  539|  17.1k|}
mpv_terminate_destroy:
  542|  16.4k|{
  543|       |    mp_destroy_client(ctx, true);
  544|  16.4k|}
mp_shutdown_clients:
  549|  32.8k|{
  550|  32.8k|    struct mp_client_api *clients = mpctx->clients;
  551|       |
  552|       |    // Forcefully abort async work after 2 seconds of waiting.
  553|  32.8k|    double abort_time = mp_time_sec() + 2;
  554|       |
  555|  32.8k|    mp_mutex_lock(&clients->lock);
  ------------------
  |  |  134|  32.8k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  556|       |
  557|       |    // Prevent that new clients can appear.
  558|  32.8k|    clients->shutting_down = true;
  559|       |
  560|       |    // Wait until we can terminate.
  561|  49.9k|    while (clients->num_clients || mpctx->outstanding_async ||
  ------------------
  |  Branch (561:12): [True: 16.7k, False: 33.1k]
  |  Branch (561:36): [True: 0, False: 33.1k]
  ------------------
  562|  33.1k|           !(mpctx->is_cli || clients->terminate_core_thread))
  ------------------
  |  Branch (562:14): [True: 0, False: 33.1k]
  |  Branch (562:31): [True: 32.8k, False: 301]
  ------------------
  563|  17.0k|    {
  564|  17.0k|        mp_mutex_unlock(&clients->lock);
  ------------------
  |  |  136|  17.0k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  565|       |
  566|  17.0k|        double left = abort_time - mp_time_sec();
  567|  17.0k|        if (left >= 0) {
  ------------------
  |  Branch (567:13): [True: 17.0k, False: 0]
  ------------------
  568|  17.0k|            mp_set_timeout(mpctx, left);
  569|  17.0k|        } else {
  570|       |            // Forcefully abort any ongoing async work. This is quite rude and
  571|       |            // probably not what everyone wants, so it happens only after a
  572|       |            // timeout.
  573|      0|            abort_async(mpctx, NULL, 0, 0);
  574|      0|        }
  575|       |
  576|  17.0k|        mp_client_broadcast_event(mpctx, MPV_EVENT_SHUTDOWN, NULL);
  577|  17.0k|        mp_wait_events(mpctx);
  578|       |
  579|  17.0k|        mp_mutex_lock(&clients->lock);
  ------------------
  |  |  134|  17.0k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  580|  17.0k|    }
  581|       |
  582|  32.8k|    mp_mutex_unlock(&clients->lock);
  ------------------
  |  |  136|  32.8k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  583|  32.8k|}
mpv_create:
  639|  16.4k|{
  640|       |    return create_core(false);
  641|  16.4k|}
mpv_initialize_opts:
  669|  16.4k|{
  670|  16.4k|    lock_core(ctx);
  671|  16.4k|    int res = mp_initialize(ctx->mpctx, options) ? MPV_ERROR_INVALID_PARAMETER : 0;
  ------------------
  |  Branch (671:15): [True: 5.35k, False: 11.0k]
  ------------------
  672|  16.4k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  673|       |    // Only the options parser fuzzer passes options. It wants them parsed and
  674|       |    // applied, not played.
  675|  16.4k|    if (options)
  ------------------
  |  Branch (675:9): [True: 16.4k, False: 0]
  ------------------
  676|  16.4k|        ctx->mpctx->stop_play = PT_QUIT;
  677|  16.4k|#endif
  678|  16.4k|    mp_wakeup_core(ctx->mpctx);
  679|  16.4k|    unlock_core(ctx);
  680|  16.4k|    return res;
  681|  16.4k|}
mp_client_broadcast_event:
  786|  33.4k|{
  787|  33.4k|    struct mp_client_api *clients = mpctx->clients;
  788|       |
  789|  33.4k|    mp_mutex_lock(&clients->lock);
  ------------------
  |  |  134|  33.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  790|       |
  791|  66.9k|    for (int n = 0; n < clients->num_clients; n++) {
  ------------------
  |  Branch (791:21): [True: 33.4k, False: 33.4k]
  ------------------
  792|  33.4k|        struct mpv_event event_data = {
  793|  33.4k|            .event_id = event,
  794|  33.4k|            .data = data,
  795|  33.4k|        };
  796|  33.4k|        send_event(clients->clients[n], &event_data, true);
  797|  33.4k|    }
  798|       |
  799|  33.4k|    mp_mutex_unlock(&clients->lock);
  ------------------
  |  |  136|  33.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  800|  33.4k|}
mpv_request_event:
  872|  31.5k|{
  873|  31.5k|    if (!mpv_event_name(event) || enable < 0 || enable > 1)
  ------------------
  |  Branch (873:9): [True: 0, False: 31.5k]
  |  Branch (873:35): [True: 0, False: 31.5k]
  |  Branch (873:49): [True: 0, False: 31.5k]
  ------------------
  874|      0|        return MPV_ERROR_INVALID_PARAMETER;
  875|  31.5k|    if (event == MPV_EVENT_SHUTDOWN && !enable)
  ------------------
  |  Branch (875:9): [True: 0, False: 31.5k]
  |  Branch (875:40): [True: 0, False: 0]
  ------------------
  876|      0|        return MPV_ERROR_INVALID_PARAMETER;
  877|  31.5k|    mp_assert(event < (int)INTERNAL_EVENT_BASE); // excluded above; they have no name
  ------------------
  |  |   41|  31.5k|#define mp_assert assert
  ------------------
  |  Branch (877:5): [True: 31.5k, False: 0]
  ------------------
  878|  31.5k|    mp_mutex_lock(&ctx->lock);
  ------------------
  |  |  134|  31.5k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  879|  31.5k|    uint64_t bit = 1ULL << event;
  880|  31.5k|    ctx->event_mask = enable ? ctx->event_mask | bit : ctx->event_mask & ~bit;
  ------------------
  |  Branch (880:23): [True: 0, False: 31.5k]
  ------------------
  881|  31.5k|    if (enable && event < MP_ARRAY_SIZE(deprecated_events) &&
  ------------------
  |  |   49|  31.5k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (881:9): [True: 0, False: 31.5k]
  |  Branch (881:19): [True: 0, False: 0]
  ------------------
  882|      0|        deprecated_events[event])
  ------------------
  |  Branch (882:9): [True: 0, False: 0]
  ------------------
  883|      0|    {
  884|      0|        MP_WARN(ctx, "The '%s' event is deprecated and will be removed.\n",
  ------------------
  |  |   90|      0|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  885|      0|                mpv_event_name(event));
  886|      0|    }
  887|  31.5k|    mp_mutex_unlock(&ctx->lock);
  ------------------
  |  |  136|  31.5k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  888|  31.5k|    return 0;
  889|  31.5k|}
mpv_wait_event:
  913|  18.3k|{
  914|  18.3k|    mpv_event *event = ctx->cur_event;
  915|       |
  916|  18.3k|    mp_mutex_lock(&ctx->lock);
  ------------------
  |  |  134|  18.3k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  917|       |
  918|  18.3k|    if (!ctx->fuzzy_initialized)
  ------------------
  |  Branch (918:9): [True: 1.95k, False: 16.4k]
  ------------------
  919|  1.95k|        mp_wakeup_core(ctx->clients->mpctx);
  920|  18.3k|    ctx->fuzzy_initialized = true;
  921|       |
  922|  18.3k|    if (timeout < 0)
  ------------------
  |  Branch (922:9): [True: 16.4k, False: 1.95k]
  ------------------
  923|  16.4k|        timeout = 1e20;
  924|       |
  925|  18.3k|    int64_t deadline = mp_time_ns_add(mp_time_ns(), timeout);
  926|       |
  927|  18.3k|    *event = (mpv_event){0};
  928|  18.3k|    talloc_free_children(event);
  ------------------
  |  |   46|  18.3k|#define talloc_free_children            ta_free_children
  ------------------
  929|       |
  930|  34.8k|    while (1) {
  ------------------
  |  Branch (930:12): [True: 34.8k, Folded]
  ------------------
  931|  34.8k|        if (ctx->queued_wakeup)
  ------------------
  |  Branch (931:13): [True: 0, False: 34.8k]
  ------------------
  932|      0|            deadline = 0;
  933|       |        // Recover from overflow.
  934|  34.8k|        if (ctx->choked && !ctx->num_events) {
  ------------------
  |  Branch (934:13): [True: 0, False: 34.8k]
  |  Branch (934:28): [True: 0, False: 0]
  ------------------
  935|      0|            ctx->choked = false;
  936|      0|            event->event_id = MPV_EVENT_QUEUE_OVERFLOW;
  937|      0|            break;
  938|      0|        }
  939|  34.8k|        struct mpv_event *ev =
  940|  34.8k|            ctx->num_events ? &ctx->events[ctx->first_event] : NULL;
  ------------------
  |  Branch (940:13): [True: 16.4k, False: 18.3k]
  ------------------
  941|  34.8k|        if (ev && ev->event_id == MPV_EVENT_HOOK) {
  ------------------
  |  Branch (941:13): [True: 16.4k, False: 18.3k]
  |  Branch (941:19): [True: 0, False: 16.4k]
  ------------------
  942|       |            // Give old property notifications priority over hooks. This is a
  943|       |            // guarantee given to clients to simplify their logic. New property
  944|       |            // changes after this are treated normally, so
  945|      0|            if (!ctx->hook_pending) {
  ------------------
  |  Branch (945:17): [True: 0, False: 0]
  ------------------
  946|      0|                ctx->hook_pending = true;
  947|      0|                set_wait_for_hook_flags(ctx);
  948|      0|            }
  949|      0|            if (check_for_for_hook_flags(ctx)) {
  ------------------
  |  Branch (949:17): [True: 0, False: 0]
  ------------------
  950|      0|                ev = NULL; // delay
  951|      0|            } else {
  952|      0|                ctx->hook_pending = false;
  953|      0|            }
  954|      0|        }
  955|  34.8k|        if (ev) {
  ------------------
  |  Branch (955:13): [True: 16.4k, False: 18.3k]
  ------------------
  956|  16.4k|            *event = *ev;
  957|  16.4k|            ctx->first_event = (ctx->first_event + 1) % ctx->max_events;
  958|  16.4k|            ctx->num_events--;
  959|  16.4k|            talloc_steal(event, event->data);
  ------------------
  |  |   38|  16.4k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  16.4k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
  960|  16.4k|            break;
  961|  16.4k|        }
  962|       |        // If there's a changed property, generate change event (never queued).
  963|  18.3k|        if (gen_property_change_event(ctx))
  ------------------
  |  Branch (963:13): [True: 0, False: 18.3k]
  ------------------
  964|      0|            break;
  965|       |        // Pop item from message queue, and return as event.
  966|  18.3k|        if (gen_log_message_event(ctx))
  ------------------
  |  Branch (966:13): [True: 0, False: 18.3k]
  ------------------
  967|      0|            break;
  968|  18.3k|        int r = wait_wakeup(ctx, deadline);
  969|  18.3k|        if (r == ETIMEDOUT)
  ------------------
  |  Branch (969:13): [True: 1.90k, False: 16.4k]
  ------------------
  970|  1.90k|            break;
  971|  18.3k|    }
  972|  18.3k|    ctx->queued_wakeup = false;
  973|       |
  974|  18.3k|    mp_mutex_unlock(&ctx->lock);
  ------------------
  |  |  136|  18.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  975|       |
  976|  18.3k|    return event;
  977|  18.3k|}
mpv_free_node_contents:
 1038|  11.3k|{
 1039|  11.3k|    static const struct m_option type = { .type = CONF_TYPE_NODE };
  ------------------
  |  |  253|  11.3k|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
 1040|  11.3k|    m_option_free(&type, node);
 1041|  11.3k|}
mpv_set_option:
 1045|  16.4k|{
 1046|  16.4k|    const struct m_option *type = get_mp_type(format);
 1047|  16.4k|    if (!type)
  ------------------
  |  Branch (1047:9): [True: 0, False: 16.4k]
  ------------------
 1048|      0|        return MPV_ERROR_OPTION_FORMAT;
 1049|  16.4k|    struct mpv_node tmp;
 1050|  16.4k|    if (format != MPV_FORMAT_NODE) {
  ------------------
  |  Branch (1050:9): [True: 16.4k, False: 0]
  ------------------
 1051|  16.4k|        tmp.format = format;
 1052|  16.4k|        memcpy(&tmp.u, data, type->type->size);
 1053|  16.4k|        data = &tmp;
 1054|  16.4k|    }
 1055|  16.4k|    lock_core(ctx);
 1056|  16.4k|    int err = m_config_set_option_node(ctx->mpctx->mconfig, bstr0(name), data, 0);
 1057|  16.4k|    unlock_core(ctx);
 1058|  16.4k|    switch (err) {
 1059|      0|    case M_OPT_MISSING_PARAM:
  ------------------
  |  |  532|      0|#define M_OPT_MISSING_PARAM     -2
  ------------------
  |  Branch (1059:5): [True: 0, False: 16.4k]
  ------------------
 1060|      0|    case M_OPT_INVALID:
  ------------------
  |  |  535|      0|#define M_OPT_INVALID           -3
  ------------------
  |  Branch (1060:5): [True: 0, False: 16.4k]
  ------------------
 1061|      0|        return MPV_ERROR_OPTION_ERROR;
 1062|      0|    case M_OPT_OUT_OF_RANGE:
  ------------------
  |  |  539|      0|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  |  Branch (1062:5): [True: 0, False: 16.4k]
  ------------------
 1063|      0|        return MPV_ERROR_OPTION_FORMAT;
 1064|      0|    case M_OPT_UNKNOWN:
  ------------------
  |  |  529|      0|#define M_OPT_UNKNOWN           -1
  ------------------
  |  Branch (1064:5): [True: 0, False: 16.4k]
  ------------------
 1065|      0|        return MPV_ERROR_OPTION_NOT_FOUND;
 1066|  16.4k|    default:
  ------------------
  |  Branch (1066:5): [True: 16.4k, False: 0]
  ------------------
 1067|  16.4k|        if (err >= 0)
  ------------------
  |  Branch (1067:13): [True: 16.4k, False: 0]
  ------------------
 1068|  16.4k|            return 0;
 1069|      0|        return MPV_ERROR_OPTION_ERROR;
 1070|  16.4k|    }
 1071|  16.4k|}
mpv_set_option_string:
 1074|  16.4k|{
 1075|  16.4k|    return mpv_set_option(ctx, name, MPV_FORMAT_STRING, &data);
 1076|  16.4k|}
mpv_command:
 1165|  16.4k|{
 1166|       |    return run_client_command(ctx, mp_input_parse_cmd_strv(ctx->log, args), NULL);
 1167|  16.4k|}
mp_client_send_property_changes:
 1774|  33.9k|{
 1775|  33.9k|    struct mp_client_api *clients = mpctx->clients;
 1776|       |
 1777|  33.9k|    mp_mutex_lock(&clients->lock);
  ------------------
  |  |  134|  33.9k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
 1778|  33.9k|    uint64_t cur_ts = clients->clients_list_change_ts;
 1779|       |
 1780|  69.5k|    for (int n = 0; n < clients->num_clients; n++) {
  ------------------
  |  Branch (1780:21): [True: 35.5k, False: 33.9k]
  ------------------
 1781|  35.5k|        struct mpv_handle *ctx = clients->clients[n];
 1782|       |
 1783|  35.5k|        mp_mutex_lock(&ctx->lock);
  ------------------
  |  |  134|  35.5k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
 1784|  35.5k|        if (!ctx->has_pending_properties || ctx->destroying) {
  ------------------
  |  Branch (1784:13): [True: 35.5k, False: 0]
  |  Branch (1784:45): [True: 0, False: 0]
  ------------------
 1785|  35.5k|            mp_mutex_unlock(&ctx->lock);
  ------------------
  |  |  136|  35.5k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 1786|  35.5k|            continue;
 1787|  35.5k|        }
 1788|       |        // Keep ctx->lock locked (unlock order does not matter).
 1789|      0|        mp_mutex_unlock(&clients->lock);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 1790|      0|        send_client_property_changes(ctx);
 1791|      0|        mp_mutex_unlock(&ctx->lock);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 1792|      0|        mp_mutex_lock(&clients->lock);
  ------------------
  |  |  134|      0|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
 1793|      0|        if (cur_ts != clients->clients_list_change_ts) {
  ------------------
  |  Branch (1793:13): [True: 0, False: 0]
  ------------------
 1794|       |            // List changed; need to start over. Do it in the next iteration.
 1795|      0|            mp_wakeup_core(mpctx);
 1796|      0|            break;
 1797|      0|        }
 1798|      0|    }
 1799|       |
 1800|  33.9k|    mp_mutex_unlock(&clients->lock);
  ------------------
  |  |  136|  33.9k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 1801|  33.9k|}
mpv_get_wakeup_pipe:
 1953|  1.95k|{
 1954|  1.95k|    mp_mutex_lock(&ctx->wakeup_lock);
  ------------------
  |  |  134|  1.95k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
 1955|  1.95k|    if (ctx->wakeup_pipe[0] == -1) {
  ------------------
  |  Branch (1955:9): [True: 1.95k, False: 0]
  ------------------
 1956|  1.95k|        if (mp_make_wakeup_pipe(ctx->wakeup_pipe) >= 0)
  ------------------
  |  Branch (1956:13): [True: 1.95k, False: 0]
  ------------------
 1957|  1.95k|            (void)write(ctx->wakeup_pipe[1], &(char){0}, 1);
 1958|  1.95k|    }
 1959|  1.95k|    int fd = ctx->wakeup_pipe[0];
 1960|  1.95k|    mp_mutex_unlock(&ctx->wakeup_lock);
  ------------------
  |  |  136|  1.95k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 1961|  1.95k|    return fd;
 1962|  1.95k|}
mpv_event_name:
 2140|  31.5k|{
 2141|  31.5k|    if ((unsigned)event >= MP_ARRAY_SIZE(event_table))
  ------------------
  |  |   49|  31.5k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (2141:9): [True: 0, False: 31.5k]
  ------------------
 2142|      0|        return NULL;
 2143|  31.5k|    return event_table[event];
 2144|  31.5k|}
mp_streamcb_lookup:
 2252|  2.10k|{
 2253|  2.10k|    struct mp_client_api *clients = g->client_api;
 2254|  2.10k|    bool found = false;
 2255|  2.10k|    mp_mutex_lock(&clients->lock);
  ------------------
  |  |  134|  2.10k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
 2256|  2.10k|    for (int n = 0; n < clients->num_custom_protocols; n++) {
  ------------------
  |  Branch (2256:21): [True: 0, False: 2.10k]
  ------------------
 2257|      0|        struct mp_custom_protocol *proto = &clients->custom_protocols[n];
 2258|      0|        if (strcmp(proto->protocol, protocol) == 0) {
  ------------------
  |  Branch (2258:13): [True: 0, False: 0]
  ------------------
 2259|      0|            *out_user_data = proto->user_data;
 2260|      0|            *out_fn = proto->open_fn;
 2261|      0|            found = true;
 2262|      0|            break;
 2263|      0|        }
 2264|      0|    }
 2265|  2.10k|    mp_mutex_unlock(&clients->lock);
  ------------------
  |  |  136|  2.10k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
 2266|  2.10k|    return found;
 2267|  2.10k|}
client.c:new_client:
  262|  31.6k|{
  263|  31.6k|    mp_mutex_lock(&clients->lock);
  ------------------
  |  |  134|  31.6k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  264|       |
  265|  31.6k|    char nname[MAX_CLIENT_NAME];
  266|  36.8k|    for (int n = 1; n < 1000; n++) {
  ------------------
  |  Branch (266:21): [True: 36.8k, False: 0]
  ------------------
  267|  36.8k|        if (!name)
  ------------------
  |  Branch (267:13): [True: 0, False: 36.8k]
  ------------------
  268|      0|            name = "client";
  269|  36.8k|        snprintf(nname, sizeof(nname) - 3, "%s", name); // - space for number
  270|   156k|        for (int i = 0; nname[i]; i++)
  ------------------
  |  Branch (270:25): [True: 120k, False: 36.8k]
  ------------------
  271|   120k|            nname[i] = mp_isalnum(nname[i]) ? nname[i] : '_';
  ------------------
  |  Branch (271:24): [True: 112k, False: 7.45k]
  ------------------
  272|  36.8k|        if (n > 1)
  ------------------
  |  Branch (272:13): [True: 5.18k, False: 31.6k]
  ------------------
  273|  5.18k|            mp_snprintf_cat(nname, sizeof(nname), "%d", n);
  274|  36.8k|        if (!find_client(clients, nname))
  ------------------
  |  Branch (274:13): [True: 31.6k, False: 5.18k]
  ------------------
  275|  31.6k|            break;
  276|  5.18k|        nname[0] = '\0';
  277|  5.18k|    }
  278|       |
  279|  31.6k|    if (!nname[0] || clients->shutting_down) {
  ------------------
  |  Branch (279:9): [True: 66, False: 31.5k]
  |  Branch (279:22): [True: 0, False: 31.5k]
  ------------------
  280|     66|        mp_mutex_unlock(&clients->lock);
  ------------------
  |  |  136|     66|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  281|     66|        return NULL;
  282|     66|    }
  283|       |
  284|  31.5k|    int num_events = 1000;
  285|       |
  286|  31.5k|    struct mpv_handle *client = talloc_ptrtype(NULL, client);
  ------------------
  |  |   34|  31.5k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  31.5k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  31.5k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  287|  31.5k|    *client = (struct mpv_handle){
  288|  31.5k|        .log = mp_log_new(client, clients->mpctx->log, nname),
  289|  31.5k|        .mpctx = clients->mpctx,
  290|  31.5k|        .clients = clients,
  291|  31.5k|        .id = ++(clients->id_alloc),
  292|  31.5k|        .cur_event = talloc_zero(client, struct mpv_event),
  ------------------
  |  |   27|  31.5k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  31.5k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  31.5k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  293|  31.5k|        .events = talloc_array(client, mpv_event, num_events),
  ------------------
  |  |   29|  31.5k|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|  31.5k|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  31.5k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  294|  31.5k|        .max_events = num_events,
  295|  31.5k|        .event_mask = (1ULL << INTERNAL_EVENT_BASE) - 1, // exclude internal events
  296|  31.5k|        .wakeup_pipe = {-1, -1},
  297|  31.5k|        .is_weak = weak,
  298|  31.5k|    };
  299|  31.5k|    mp_mutex_init(&client->lock);
  300|  31.5k|    mp_mutex_init(&client->wakeup_lock);
  301|  31.5k|    mp_cond_init(&client->wakeup);
  302|       |
  303|  31.5k|    snprintf(client->name, sizeof(client->name), "%s", nname);
  304|       |
  305|  31.5k|    clients->clients_list_change_ts += 1;
  306|  31.5k|    MP_TARRAY_APPEND(clients, clients->clients, clients->num_clients, client);
  ------------------
  |  |  105|  31.5k|    do {                                            \
  |  |  106|  31.5k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  31.5k|    do {                                            \
  |  |  |  |   97|  31.5k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  31.5k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  31.5k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  31.5k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 16.6k, False: 14.9k]
  |  |  |  |  ------------------
  |  |  |  |   99|  31.5k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  16.6k|    do {                                                        \
  |  |  |  |  |  |   89|  16.6k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  16.6k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  16.6k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  16.6k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  16.6k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  16.6k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  16.6k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 16.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  31.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 31.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  31.5k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  31.5k|        (idxvar)++;                                 \
  |  |  109|  31.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 31.5k]
  |  |  ------------------
  ------------------
  307|       |
  308|  31.5k|    if (clients->num_clients == 1 && !clients->mpctx->is_cli)
  ------------------
  |  Branch (308:9): [True: 16.4k, False: 15.1k]
  |  Branch (308:38): [True: 16.4k, False: 0]
  ------------------
  309|  16.4k|        client->fuzzy_initialized = true;
  310|       |
  311|  31.5k|    mp_mutex_unlock(&clients->lock);
  ------------------
  |  |  136|  31.5k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  312|       |
  313|  31.5k|    mpv_request_event(client, MPV_EVENT_TICK, 0);
  314|       |
  315|  31.5k|    return client;
  316|  31.6k|}
client.c:wait_wakeup:
  364|  18.3k|{
  365|  18.3k|    int r = 0;
  366|  18.3k|    mp_mutex_unlock(&ctx->lock);
  ------------------
  |  |  136|  18.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  367|  18.3k|    mp_mutex_lock(&ctx->wakeup_lock);
  ------------------
  |  |  134|  18.3k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  368|  18.3k|    if (!ctx->need_wakeup)
  ------------------
  |  Branch (368:9): [True: 18.3k, False: 0]
  ------------------
  369|  18.3k|        r = mp_cond_timedwait_until(&ctx->wakeup, &ctx->wakeup_lock, end);
  370|  18.3k|    if (r == 0)
  ------------------
  |  Branch (370:9): [True: 16.4k, False: 1.90k]
  ------------------
  371|  16.4k|        ctx->need_wakeup = false;
  372|  18.3k|    mp_mutex_unlock(&ctx->wakeup_lock);
  ------------------
  |  |  136|  18.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  373|  18.3k|    mp_mutex_lock(&ctx->lock);
  ------------------
  |  |  134|  18.3k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  374|  18.3k|    return r;
  375|  18.3k|}
client.c:mp_destroy_client:
  430|  33.5k|{
  431|  33.5k|    if (!ctx)
  ------------------
  |  Branch (431:9): [True: 1.95k, False: 31.5k]
  ------------------
  432|  1.95k|        return;
  433|       |
  434|  31.5k|    struct MPContext *mpctx = ctx->mpctx;
  435|  31.5k|    struct mp_client_api *clients = ctx->clients;
  436|       |
  437|  31.5k|    MP_DBG(ctx, "Destroying client handle...\n");
  ------------------
  |  |   93|  31.5k|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  31.5k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  438|       |
  439|  31.5k|    if (terminate)
  ------------------
  |  Branch (439:9): [True: 16.4k, False: 15.1k]
  ------------------
  440|  16.4k|        mpv_command(ctx, (const char*[]){"quit", NULL});
  441|       |
  442|  31.5k|    mp_mutex_lock(&ctx->lock);
  ------------------
  |  |  134|  31.5k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  443|       |
  444|  31.5k|    ctx->destroying = true;
  445|       |
  446|  31.5k|    for (int n = 0; n < ctx->num_properties; n++)
  ------------------
  |  Branch (446:21): [True: 0, False: 31.5k]
  ------------------
  447|      0|        prop_unref(ctx->properties[n]);
  448|  31.5k|    ctx->num_properties = 0;
  449|  31.5k|    ctx->properties_change_ts += 1;
  450|       |
  451|  31.5k|    prop_unref(ctx->cur_property);
  452|  31.5k|    ctx->cur_property = NULL;
  453|       |
  454|  31.5k|    mp_mutex_unlock(&ctx->lock);
  ------------------
  |  |  136|  31.5k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  455|       |
  456|  31.5k|    abort_async(mpctx, ctx, 0, 0);
  457|       |
  458|       |    // reserved_events equals the number of asynchronous requests that weren't
  459|       |    // yet replied. In order to avoid that trying to reply to a removed client
  460|       |    // causes a crash, block until all asynchronous requests were served.
  461|  31.5k|    mpv_wait_async_requests(ctx);
  462|       |
  463|  31.5k|    osd_set_external_remove_owner(mpctx->osd, ctx);
  464|  31.5k|    mp_input_remove_sections_by_owner(mpctx->input, ctx->name);
  465|       |
  466|  31.5k|    mp_mutex_lock(&clients->lock);
  ------------------
  |  |  134|  31.5k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  467|       |
  468|  49.9k|    for (int n = 0; n < clients->num_clients; n++) {
  ------------------
  |  Branch (468:21): [True: 49.9k, False: 18.4E]
  ------------------
  469|  49.9k|        if (clients->clients[n] == ctx) {
  ------------------
  |  Branch (469:13): [True: 31.5k, False: 18.3k]
  ------------------
  470|  31.5k|            clients->clients_list_change_ts += 1;
  471|  31.5k|            MP_TARRAY_REMOVE_AT(clients->clients, clients->num_clients, n);
  ------------------
  |  |  143|  31.5k|    do {                                            \
  |  |  144|  31.5k|        size_t at_ = (at);                          \
  |  |  145|  31.5k|        assert(at_ < (idxvar));                     \
  |  |  146|  31.5k|        memmove((p) + at_, (p) + at_ + 1,           \
  |  |  147|  31.5k|                ((idxvar) - at_ - 1) * sizeof((p)[0])); \
  |  |  148|  31.5k|        (idxvar)--;                                 \
  |  |  149|  31.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (149:14): [Folded, False: 31.5k]
  |  |  ------------------
  ------------------
  |  Branch (471:13): [True: 31.5k, False: 0]
  ------------------
  472|  31.7k|            while (ctx->num_events) {
  ------------------
  |  Branch (472:20): [True: 124, False: 31.5k]
  ------------------
  473|    124|                talloc_free(ctx->events[ctx->first_event].data);
  ------------------
  |  |   47|    124|#define talloc_free                     ta_free
  ------------------
  474|    124|                ctx->first_event = (ctx->first_event + 1) % ctx->max_events;
  475|    124|                ctx->num_events--;
  476|    124|            }
  477|  31.5k|            mp_msg_log_buffer_destroy(ctx->messages);
  478|  31.5k|            mp_cond_destroy(&ctx->wakeup);
  479|  31.5k|            mp_mutex_destroy(&ctx->wakeup_lock);
  ------------------
  |  |  133|  31.5k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
  480|  31.5k|            mp_mutex_destroy(&ctx->lock);
  ------------------
  |  |  133|  31.5k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
  481|  31.5k|            if (ctx->wakeup_pipe[0] != -1) {
  ------------------
  |  Branch (481:17): [True: 1.95k, False: 29.6k]
  ------------------
  482|  1.95k|                close(ctx->wakeup_pipe[0]);
  483|  1.95k|                close(ctx->wakeup_pipe[1]);
  484|  1.95k|            }
  485|  31.5k|            talloc_free(ctx);
  ------------------
  |  |   47|  31.5k|#define talloc_free                     ta_free
  ------------------
  486|  31.5k|            ctx = NULL;
  487|  31.5k|            break;
  488|  31.5k|        }
  489|  49.9k|    }
  490|  31.5k|    mp_assert(!ctx);
  ------------------
  |  |   41|  31.5k|#define mp_assert assert
  ------------------
  |  Branch (490:5): [True: 31.5k, False: 18.4E]
  ------------------
  491|       |
  492|  31.5k|    if (mpctx->is_cli) {
  ------------------
  |  Branch (492:9): [True: 0, False: 31.5k]
  ------------------
  493|      0|        terminate = false;
  494|  31.5k|    } else {
  495|       |        // If the last strong mpv_handle got destroyed, destroy the core.
  496|  31.5k|        bool has_strong_ref = false;
  497|  59.6k|        for (int n = 0; n < clients->num_clients; n++)
  ------------------
  |  Branch (497:25): [True: 28.0k, False: 31.5k]
  ------------------
  498|  28.0k|            has_strong_ref |= !clients->clients[n]->is_weak;
  499|  31.5k|        if (!has_strong_ref)
  ------------------
  |  Branch (499:13): [True: 16.4k, False: 15.1k]
  ------------------
  500|  16.4k|            terminate = true;
  501|       |
  502|       |        // Reserve the right to destroy mpctx for us.
  503|  31.5k|        if (clients->have_terminator)
  ------------------
  |  Branch (503:13): [True: 48, False: 31.5k]
  ------------------
  504|     48|            terminate = false;
  505|  31.5k|        clients->have_terminator |= terminate;
  506|  31.5k|    }
  507|       |
  508|       |    // mp_shutdown_clients() sleeps to avoid wasting CPU.
  509|       |    // mp_hook_test_completion() also relies on this a bit.
  510|  31.5k|    mp_wakeup_core(mpctx);
  511|       |
  512|  31.5k|    mp_mutex_unlock(&clients->lock);
  ------------------
  |  |  136|  31.5k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  513|       |
  514|       |    // Note that even if num_clients==0, having set have_terminator keeps mpctx
  515|       |    // and the core thread alive.
  516|  31.5k|    if (terminate) {
  ------------------
  |  Branch (516:9): [True: 16.4k, False: 15.1k]
  ------------------
  517|       |        // Make sure the core stops playing files etc. Being able to lock the
  518|       |        // dispatch queue requires that the core thread is still active.
  519|  16.4k|        mp_dispatch_lock(mpctx->dispatch);
  520|  16.4k|        mpctx->stop_play = PT_QUIT;
  521|  16.4k|        mp_dispatch_unlock(mpctx->dispatch);
  522|       |
  523|       |        // Ask the core thread to stop.
  524|  16.4k|        mp_mutex_lock(&clients->lock);
  ------------------
  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  525|  16.4k|        clients->terminate_core_thread = true;
  526|  16.4k|        mp_mutex_unlock(&clients->lock);
  ------------------
  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  527|  16.4k|        mp_wakeup_core(mpctx);
  528|       |
  529|       |        // Blocking wait for all clients and core thread to terminate.
  530|  16.4k|        mp_thread_join(mpctx->core_thread);
  ------------------
  |  |  215|  16.4k|#define mp_thread_join(t)         pthread_join(t, NULL)
  ------------------
  531|       |
  532|  16.4k|        mp_destroy(mpctx);
  533|  16.4k|    }
  534|  31.5k|}
client.c:abort_async:
  410|  31.5k|{
  411|  31.5k|    mp_mutex_lock(&mpctx->abort_lock);
  ------------------
  |  |  134|  31.5k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  412|       |
  413|       |    // Destroy all => ensure any newly appearing work is aborted immediately.
  414|  31.5k|    if (ctx == NULL)
  ------------------
  |  Branch (414:9): [True: 0, False: 31.5k]
  ------------------
  415|      0|        mpctx->abort_all = true;
  416|       |
  417|  31.5k|    for (int n = 0; n < mpctx->num_abort_list; n++) {
  ------------------
  |  Branch (417:21): [True: 0, False: 31.5k]
  ------------------
  418|      0|        struct mp_abort_entry *abort = mpctx->abort_list[n];
  419|      0|        if (!ctx || (abort->client == ctx && (!type ||
  ------------------
  |  Branch (419:13): [True: 0, False: 0]
  |  Branch (419:22): [True: 0, False: 0]
  |  Branch (419:47): [True: 0, False: 0]
  ------------------
  420|      0|            (abort->client_work_type == type && abort->client_work_id == id))))
  ------------------
  |  Branch (420:14): [True: 0, False: 0]
  |  Branch (420:49): [True: 0, False: 0]
  ------------------
  421|      0|        {
  422|      0|            mp_abort_trigger_locked(mpctx, abort);
  423|      0|        }
  424|      0|    }
  425|       |
  426|  31.5k|    mp_mutex_unlock(&mpctx->abort_lock);
  ------------------
  |  |  136|  31.5k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  427|  31.5k|}
client.c:create_core:
  615|  16.4k|{
  616|  16.4k|    struct MPContext *mpctx = mp_create();
  617|  16.4k|    if (!mpctx)
  ------------------
  |  Branch (617:9): [True: 0, False: 16.4k]
  ------------------
  618|      0|        return NULL;
  619|       |
  620|  16.4k|    m_config_set_profile(mpctx->mconfig, "libmpv", 0);
  621|       |
  622|  16.4k|    mpv_handle *ctx = new_client(mpctx->clients, "main", weak);
  623|  16.4k|    if (!ctx) {
  ------------------
  |  Branch (623:9): [True: 0, False: 16.4k]
  ------------------
  624|      0|        mp_destroy(mpctx);
  625|      0|        return NULL;
  626|      0|    }
  627|       |
  628|  16.4k|    if (mp_thread_create(&mpctx->core_thread, core_thread, mpctx) != 0) {
  ------------------
  |  |  214|  16.4k|#define mp_thread_create(t, f, a) pthread_create(t, NULL, f, a)
  ------------------
  |  Branch (628:9): [True: 0, False: 16.4k]
  ------------------
  629|      0|        ctx->clients->have_terminator = true; // avoid blocking
  630|      0|        mpv_terminate_destroy(ctx);
  631|      0|        mp_destroy(mpctx);
  632|      0|        return NULL;
  633|      0|    }
  634|       |
  635|  16.4k|    return ctx;
  636|  16.4k|}
client.c:core_thread:
  595|  16.4k|{
  596|  16.4k|    struct MPContext *mpctx = p;
  597|       |
  598|  16.4k|    mp_thread_set_name("core");
  599|       |
  600|  32.8k|    while (!mpctx->initialized && mpctx->stop_play != PT_QUIT)
  ------------------
  |  Branch (600:12): [True: 21.4k, False: 11.3k]
  |  Branch (600:35): [True: 16.4k, False: 5.00k]
  ------------------
  601|  16.4k|        mp_idle(mpctx);
  602|       |
  603|  16.4k|    if (mpctx->initialized)
  ------------------
  |  Branch (603:9): [True: 11.3k, False: 5.00k]
  ------------------
  604|  11.3k|        mp_play_files(mpctx);
  605|       |
  606|       |    // This actually waits until all clients are gone before actually
  607|       |    // destroying mpctx. Actual destruction is done by whatever destroys
  608|       |    // the last mpv_handle.
  609|  16.4k|    mp_shutdown_clients(mpctx);
  610|       |
  611|       |    MP_THREAD_RETURN();
  ------------------
  |  |  212|  16.4k|#define MP_THREAD_RETURN() return NULL
  ------------------
  612|  16.4k|}
client.c:lock_core:
  388|  44.2k|{
  389|  44.2k|    mp_dispatch_lock(ctx->mpctx->dispatch);
  390|  44.2k|}
client.c:unlock_core:
  393|  44.2k|{
  394|  44.2k|    mp_dispatch_unlock(ctx->mpctx->dispatch);
  395|  44.2k|}
client.c:send_event:
  749|  33.4k|{
  750|  33.4k|    mp_mutex_lock(&ctx->lock);
  ------------------
  |  |  134|  33.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  751|  33.4k|    uint64_t mask = 1ULL << event->event_id;
  752|  33.4k|    if (ctx->property_event_masks & mask)
  ------------------
  |  Branch (752:9): [True: 0, False: 33.4k]
  ------------------
  753|      0|        notify_property_events(ctx, event->event_id);
  754|  33.4k|    int r;
  755|  33.4k|    if (!(ctx->event_mask & mask)) {
  ------------------
  |  Branch (755:9): [True: 16.9k, False: 16.5k]
  ------------------
  756|  16.9k|        r = 0;
  757|  16.9k|    } else if (ctx->choked) {
  ------------------
  |  Branch (757:16): [True: 0, False: 16.5k]
  ------------------
  758|      0|        r = -1;
  759|  16.5k|    } else {
  760|  16.5k|        r = append_event(ctx, *event, copy);
  761|  16.5k|        if (r < 0) {
  ------------------
  |  Branch (761:13): [True: 0, False: 16.5k]
  ------------------
  762|      0|            MP_ERR(ctx, "Too many events queued.\n");
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  763|      0|            ctx->choked = true;
  764|      0|        }
  765|  16.5k|    }
  766|  33.4k|    mp_mutex_unlock(&ctx->lock);
  ------------------
  |  |  136|  33.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  767|  33.4k|    return r;
  768|  33.4k|}
client.c:append_event:
  735|  16.5k|{
  736|  16.5k|    if (ctx->num_events + ctx->reserved_events >= ctx->max_events)
  ------------------
  |  Branch (736:9): [True: 0, False: 16.5k]
  ------------------
  737|      0|        return -1;
  738|  16.5k|    if (copy)
  ------------------
  |  Branch (738:9): [True: 16.5k, False: 0]
  ------------------
  739|  16.5k|        dup_event_data(&event);
  740|  16.5k|    ctx->events[(ctx->first_event + ctx->num_events) % ctx->max_events] = event;
  741|  16.5k|    ctx->num_events++;
  742|  16.5k|    wakeup_client(ctx);
  743|  16.5k|    if (event.event_id == MPV_EVENT_SHUTDOWN)
  ------------------
  |  Branch (743:9): [True: 16.5k, False: 0]
  ------------------
  744|  16.5k|        ctx->event_mask &= ctx->event_mask & ~(1ULL << MPV_EVENT_SHUTDOWN);
  745|  16.5k|    return 0;
  746|  16.5k|}
client.c:find_client:
  234|  36.8k|{
  235|  36.8k|    if (name[0] == '@') {
  ------------------
  |  Branch (235:9): [True: 0, False: 36.8k]
  ------------------
  236|      0|        char *end;
  237|      0|        errno = 0;
  238|      0|        long long int id = strtoll(name + 1, &end, 10);
  239|      0|        if (errno || end[0])
  ------------------
  |  Branch (239:13): [True: 0, False: 0]
  |  Branch (239:22): [True: 0, False: 0]
  ------------------
  240|      0|            return NULL;
  241|      0|        return find_client_id(clients, id);
  242|      0|    }
  243|       |
  244|  83.5k|    for (int n = 0; n < clients->num_clients; n++) {
  ------------------
  |  Branch (244:21): [True: 51.9k, False: 31.6k]
  ------------------
  245|  51.9k|        if (strcmp(clients->clients[n]->name, name) == 0)
  ------------------
  |  Branch (245:13): [True: 5.18k, False: 46.7k]
  ------------------
  246|  5.18k|            return clients->clients[n];
  247|  51.9k|    }
  248|       |
  249|  31.6k|    return NULL;
  250|  36.8k|}
client.c:dup_event_data:
  691|  16.5k|{
  692|  16.5k|    switch (ev->event_id) {
  693|      0|    case MPV_EVENT_CLIENT_MESSAGE: {
  ------------------
  |  Branch (693:5): [True: 0, False: 16.5k]
  ------------------
  694|      0|        struct mpv_event_client_message *src = ev->data;
  695|      0|        struct mpv_event_client_message *msg =
  696|      0|            talloc_zero(NULL, struct mpv_event_client_message);
  ------------------
  |  |   27|      0|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|      0|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      0|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  697|      0|        for (int n = 0; n < src->num_args; n++) {
  ------------------
  |  Branch (697:25): [True: 0, False: 0]
  ------------------
  698|      0|            MP_TARRAY_APPEND(msg, msg->args, msg->num_args,
  ------------------
  |  |  105|      0|    do {                                            \
  |  |  106|      0|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      0|    do {                                            \
  |  |  |  |   97|      0|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      0|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      0|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|      0|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      0|        (idxvar)++;                                 \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  699|      0|                             talloc_strdup(msg, src->args[n]));
  700|      0|        }
  701|      0|        ev->data = msg;
  702|      0|        break;
  703|      0|    }
  704|      0|    case MPV_EVENT_START_FILE:
  ------------------
  |  Branch (704:5): [True: 0, False: 16.5k]
  ------------------
  705|      0|        ev->data = talloc_memdup(NULL, ev->data, sizeof(mpv_event_start_file));
  ------------------
  |  |   49|      0|#define talloc_memdup                   ta_xmemdup
  |  |  ------------------
  |  |  |  |  157|      0|#define ta_xmemdup(...)         ta_dbg_set_loc(ta_xmemdup(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  706|      0|        break;
  707|      0|    case MPV_EVENT_END_FILE:
  ------------------
  |  Branch (707:5): [True: 0, False: 16.5k]
  ------------------
  708|      0|        ev->data = talloc_memdup(NULL, ev->data, sizeof(mpv_event_end_file));
  ------------------
  |  |   49|      0|#define talloc_memdup                   ta_xmemdup
  |  |  ------------------
  |  |  |  |  157|      0|#define ta_xmemdup(...)         ta_dbg_set_loc(ta_xmemdup(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  709|      0|        break;
  710|  16.5k|    default:
  ------------------
  |  Branch (710:5): [True: 16.5k, False: 0]
  ------------------
  711|       |        // Doesn't use events with memory allocation.
  712|  16.5k|        if (ev->data)
  ------------------
  |  Branch (712:13): [True: 0, False: 16.5k]
  ------------------
  713|      0|            abort();
  714|  16.5k|    }
  715|  16.5k|}
client.c:wakeup_client:
  349|  16.5k|{
  350|  16.5k|    mp_mutex_lock(&ctx->wakeup_lock);
  ------------------
  |  |  134|  16.5k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  351|  16.5k|    if (!ctx->need_wakeup) {
  ------------------
  |  Branch (351:9): [True: 16.5k, False: 0]
  ------------------
  352|  16.5k|        ctx->need_wakeup = true;
  353|  16.5k|        mp_cond_broadcast(&ctx->wakeup);
  354|  16.5k|        if (ctx->wakeup_cb)
  ------------------
  |  Branch (354:13): [True: 0, False: 16.5k]
  ------------------
  355|      0|            ctx->wakeup_cb(ctx->wakeup_cb_ctx);
  356|  16.5k|        if (ctx->wakeup_pipe[0] != -1)
  ------------------
  |  Branch (356:13): [True: 172, False: 16.4k]
  ------------------
  357|    172|            (void)write(ctx->wakeup_pipe[1], &(char){0}, 1);
  358|  16.5k|    }
  359|  16.5k|    mp_mutex_unlock(&ctx->wakeup_lock);
  ------------------
  |  |  136|  16.5k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  360|  16.5k|}
client.c:get_mp_type:
  997|  16.4k|{
  998|  16.4k|    if ((unsigned)format >= MP_ARRAY_SIZE(type_conv))
  ------------------
  |  |   49|  16.4k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (998:9): [True: 0, False: 16.4k]
  ------------------
  999|      0|        return NULL;
 1000|  16.4k|    if (!type_conv[format].type)
  ------------------
  |  Branch (1000:9): [True: 0, False: 16.4k]
  ------------------
 1001|      0|        return NULL;
 1002|  16.4k|    return &type_conv[format];
 1003|  16.4k|}
client.c:run_client_command:
 1126|  16.4k|{
 1127|  16.4k|    if (!cmd)
  ------------------
  |  Branch (1127:9): [True: 0, False: 16.4k]
  ------------------
 1128|      0|        return MPV_ERROR_INVALID_PARAMETER;
 1129|  16.4k|    if (!ctx->mpctx->initialized) {
  ------------------
  |  Branch (1129:9): [True: 5.00k, False: 11.3k]
  ------------------
 1130|  5.00k|        talloc_free(cmd);
  ------------------
  |  |   47|  5.00k|#define talloc_free                     ta_free
  ------------------
 1131|  5.00k|        return MPV_ERROR_UNINITIALIZED;
 1132|  5.00k|    }
 1133|       |
 1134|  11.3k|    cmd->sender = ctx->name;
 1135|       |
 1136|  11.3k|    struct cmd_request req = {
 1137|  11.3k|        .mpctx = ctx->mpctx,
 1138|  11.3k|        .cmd = cmd,
 1139|  11.3k|        .res = res,
 1140|  11.3k|        .completion = MP_WAITER_INITIALIZER,
  ------------------
  |  |   19|  11.3k|#define MP_WAITER_INITIALIZER { \
  |  |   20|  11.3k|    .lock = MP_STATIC_MUTEX_INITIALIZER, \
  |  |  ------------------
  |  |  |  |  109|  11.3k|#define MP_STATIC_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
  |  |  ------------------
  |  |   21|  11.3k|    .wakeup = MP_STATIC_COND_INITIALIZER, \
  |  |  ------------------
  |  |  |  |  108|  11.3k|#define MP_STATIC_COND_INITIALIZER { .cond = PTHREAD_COND_INITIALIZER, .clk_id = CLOCK_REALTIME }
  |  |  ------------------
  |  |   22|  11.3k|    }
  ------------------
 1141|  11.3k|    };
 1142|       |
 1143|  11.3k|    bool async = cmd->flags & MP_ASYNC_CMD;
 1144|       |
 1145|  11.3k|    lock_core(ctx);
 1146|  11.3k|    if (async) {
  ------------------
  |  Branch (1146:9): [True: 0, False: 11.3k]
  ------------------
 1147|      0|        run_command(ctx->mpctx, cmd, NULL, NULL, NULL);
 1148|  11.3k|    } else {
 1149|  11.3k|        struct mp_abort_entry *abort = NULL;
 1150|  11.3k|        if (cmd->def->can_abort) {
  ------------------
  |  Branch (1150:13): [True: 0, False: 11.3k]
  ------------------
 1151|      0|            abort = talloc_zero(NULL, struct mp_abort_entry);
  ------------------
  |  |   27|      0|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|      0|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      0|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1152|      0|            abort->client = ctx;
 1153|      0|        }
 1154|  11.3k|        run_command(ctx->mpctx, cmd, abort, cmd_complete, &req);
 1155|  11.3k|    }
 1156|  11.3k|    unlock_core(ctx);
 1157|       |
 1158|  11.3k|    if (!async)
  ------------------
  |  Branch (1158:9): [True: 11.3k, False: 0]
  ------------------
 1159|  11.3k|        mp_waiter_wait(&req.completion);
 1160|       |
 1161|  11.3k|    return req.status;
 1162|  16.4k|}
client.c:cmd_complete:
 1112|  11.3k|{
 1113|  11.3k|    struct cmd_request *req = cmd->on_completion_priv;
 1114|       |
 1115|  11.3k|    req->status = cmd->success ? 0 : MPV_ERROR_COMMAND;
  ------------------
  |  Branch (1115:19): [True: 11.3k, False: 0]
  ------------------
 1116|  11.3k|    if (req->res) {
  ------------------
  |  Branch (1116:9): [True: 0, False: 11.3k]
  ------------------
 1117|      0|        *req->res = cmd->result;
 1118|      0|        cmd->result = (mpv_node){0};
 1119|      0|    }
 1120|       |
 1121|       |    // Unblock the waiting thread (especially for async commands).
 1122|  11.3k|    mp_waiter_wakeup(&req->completion, 0);
 1123|  11.3k|}
client.c:prop_unref:
  169|  31.5k|{
  170|  31.5k|    if (!prop)
  ------------------
  |  Branch (170:9): [True: 31.5k, False: 0]
  ------------------
  171|  31.5k|        return;
  172|       |
  173|      0|    mp_assert(prop->refcount > 0);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (173:5): [True: 0, False: 0]
  ------------------
  174|      0|    prop->refcount -= 1;
  175|      0|    if (!prop->refcount)
  ------------------
  |  Branch (175:9): [True: 0, False: 0]
  ------------------
  176|      0|        talloc_free(prop);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  177|      0|}
client.c:gen_property_change_event:
 1806|  18.3k|{
 1807|  18.3k|    if (!ctx->mpctx->initialized)
  ------------------
  |  Branch (1807:9): [True: 5.00k, False: 13.3k]
  ------------------
 1808|  5.00k|        return false;
 1809|       |
 1810|  13.3k|    while (1) {
  ------------------
  |  Branch (1810:12): [True: 13.3k, Folded]
  ------------------
 1811|  13.3k|        if (ctx->cur_property_index >= ctx->num_properties) {
  ------------------
  |  Branch (1811:13): [True: 13.3k, False: 0]
  ------------------
 1812|  13.3k|            ctx->new_property_events &= ctx->num_properties > 0;
 1813|  13.3k|            if (!ctx->new_property_events)
  ------------------
  |  Branch (1813:17): [True: 13.3k, False: 0]
  ------------------
 1814|  13.3k|                break;
 1815|      0|            ctx->new_property_events = false;
 1816|      0|            ctx->cur_property_index = 0;
 1817|      0|        }
 1818|       |
 1819|      0|        struct observe_property *prop = ctx->properties[ctx->cur_property_index++];
 1820|       |
 1821|      0|        if (prop->value_ts == prop->change_ts &&    // not a stale value?
  ------------------
  |  Branch (1821:13): [True: 0, False: 0]
  ------------------
 1822|      0|            prop->value_ret_ts != prop->value_ts)   // other value than last time?
  ------------------
  |  Branch (1822:13): [True: 0, False: 0]
  ------------------
 1823|      0|        {
 1824|      0|            prop->value_ret_ts = prop->value_ts;
 1825|      0|            prop->waiting_for_hook = false;
 1826|      0|            prop_unref(ctx->cur_property);
 1827|      0|            ctx->cur_property = prop;
 1828|      0|            prop->refcount += 1;
 1829|       |
 1830|      0|            if (prop->value_valid)
  ------------------
  |  Branch (1830:17): [True: 0, False: 0]
  ------------------
 1831|      0|                m_option_copy(prop->type, &prop->value_ret, &prop->value);
 1832|       |
 1833|      0|            ctx->cur_property_event = (struct mpv_event_property){
 1834|      0|                .name = prop->name,
 1835|      0|                .format = prop->value_valid ? prop->format : 0,
  ------------------
  |  Branch (1835:27): [True: 0, False: 0]
  ------------------
 1836|      0|                .data = prop->value_valid ? &prop->value_ret : NULL,
  ------------------
  |  Branch (1836:25): [True: 0, False: 0]
  ------------------
 1837|      0|            };
 1838|      0|            *ctx->cur_event = (struct mpv_event){
 1839|      0|                .event_id = MPV_EVENT_PROPERTY_CHANGE,
 1840|      0|                .reply_userdata = prop->reply_id,
 1841|      0|                .data = &ctx->cur_property_event,
 1842|      0|            };
 1843|      0|            return true;
 1844|      0|        }
 1845|      0|    }
 1846|       |
 1847|  13.3k|    return false;
 1848|  13.3k|}
client.c:gen_log_message_event:
 1928|  18.3k|{
 1929|  18.3k|    if (ctx->messages) {
  ------------------
  |  Branch (1929:9): [True: 0, False: 18.3k]
  ------------------
 1930|      0|        struct mp_log_buffer_entry *msg =
 1931|      0|            mp_msg_log_buffer_read(ctx->messages);
 1932|      0|        if (msg) {
  ------------------
  |  Branch (1932:13): [True: 0, False: 0]
  ------------------
 1933|      0|            struct mpv_event_log_message *cmsg =
 1934|      0|                talloc_ptrtype(ctx->cur_event, cmsg);
  ------------------
  |  |   34|      0|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|      0|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      0|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1935|      0|            talloc_steal(cmsg, msg);
  ------------------
  |  |   38|      0|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|      0|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
 1936|      0|            *cmsg = (struct mpv_event_log_message){
 1937|      0|                .prefix = msg->prefix,
 1938|      0|                .level = mp_log_levels[msg->level],
 1939|      0|                .log_level = mp_mpv_log_levels[msg->level],
 1940|      0|                .text = msg->text,
 1941|      0|            };
 1942|      0|            *ctx->cur_event = (struct mpv_event){
 1943|      0|                .event_id = MPV_EVENT_LOG_MESSAGE,
 1944|      0|                .data = cmsg,
 1945|      0|            };
 1946|      0|            return true;
 1947|      0|        }
 1948|      0|    }
 1949|  18.3k|    return false;
 1950|  18.3k|}

clipboard-vo.c:init:
   29|  11.3k|{
   30|  11.3k|    struct clipboard_vo_priv *priv = talloc_ptrtype(cl, priv);
  ------------------
  |  |   34|  11.3k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  11.3k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  11.3k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   31|  11.3k|    priv->mpctx = params->mpctx;
   32|  11.3k|    priv->log = mp_log_new(priv, cl->log, "vo"),
   33|  11.3k|    cl->priv = priv;
   34|  11.3k|    return CLIPBOARD_SUCCESS;
   35|  11.3k|}

mp_clipboard_destroy:
  131|  27.7k|{
  132|  27.7k|    mp_mutex_lock(&cl->lock);
  ------------------
  |  |  134|  27.7k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  133|  27.7k|    if (cl->backend && cl->backend->uninit)
  ------------------
  |  Branch (133:9): [True: 11.3k, False: 16.4k]
  |  Branch (133:24): [True: 0, False: 11.3k]
  ------------------
  134|      0|        cl->backend->uninit(cl);
  135|  27.7k|    cl->backend = cl->priv = NULL;
  136|  27.7k|    mp_mutex_unlock(&cl->lock);
  ------------------
  |  |  136|  27.7k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  137|  27.7k|}
mp_clipboard_data_changed:
  140|  16.8k|{
  141|  16.8k|    if (cl->backend && cl->backend->data_changed && cl->monitor)
  ------------------
  |  Branch (141:9): [True: 479, False: 16.4k]
  |  Branch (141:24): [True: 0, False: 479]
  |  Branch (141:53): [True: 0, False: 0]
  ------------------
  142|      0|        return cl->backend->data_changed(cl);
  143|  16.8k|    return false;
  144|  16.8k|}
reinit_clipboard:
  194|  11.3k|{
  195|  11.3k|    mp_clipboard_destroy(mpctx->clipboard);
  196|       |
  197|  11.3k|    struct clipboard_opts *opts = mp_get_config_group(NULL, mpctx->global, &clipboard_conf);
  198|  11.3k|    if (opts->backends && opts->backends[0].name) {
  ------------------
  |  Branch (198:9): [True: 11.3k, False: 1]
  |  Branch (198:27): [True: 11.3k, False: 0]
  ------------------
  199|  11.3k|        struct clipboard_init_params params = {
  200|  11.3k|            .mpctx = mpctx,
  201|  11.3k|            .backends = opts->backends,
  202|  11.3k|        };
  203|  11.3k|        params.flags |= opts->monitor ? CLIPBOARD_INIT_ENABLE_MONITORING : 0;
  ------------------
  |  |   28|      0|#define CLIPBOARD_INIT_ENABLE_MONITORING (1 << 0)
  ------------------
  |  Branch (203:25): [True: 0, False: 11.3k]
  ------------------
  204|  11.3k|        params.flags |= opts->xwayland ? CLIPBOARD_INIT_ENABLE_XWAYLAND : 0;
  ------------------
  |  |   29|      0|#define CLIPBOARD_INIT_ENABLE_XWAYLAND   (1 << 1)
  ------------------
  |  Branch (204:25): [True: 0, False: 11.3k]
  ------------------
  205|  11.3k|        mp_clipboard_create(mpctx->clipboard, &params);
  206|  11.3k|    }
  207|  11.3k|    talloc_free(opts);
  ------------------
  |  |   47|  11.3k|#define talloc_free                     ta_free
  ------------------
  208|  11.3k|}
clipboard_init:
  217|  16.4k|{
  218|  16.4k|    struct clipboard_ctx *cl = talloc_zero_ptrtype(mpctx, cl);
  ------------------
  |  |   35|  16.4k|#define talloc_zero_ptrtype             ta_xznew_ptrtype
  |  |  ------------------
  |  |  |  |  139|  16.4k|#define ta_xznew_ptrtype(...)           ta_oom_g(ta_znew_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  219|  16.4k|    talloc_set_destructor(cl, clipboard_destructor);
  ------------------
  |  |   41|  16.4k|#define talloc_set_destructor           ta_set_destructor
  ------------------
  220|  16.4k|    cl->log = mp_log_new(cl, mpctx->global->log, "clipboard");
  221|  16.4k|    mp_mutex_init(&cl->lock);
  222|  16.4k|    mpctx->clipboard = cl;
  223|  16.4k|}
clipboard.c:get_desc:
   56|  33.3k|{
   57|  33.3k|    if (index >= MP_ARRAY_SIZE(clipboard_backend_list))
  ------------------
  |  |   49|  33.3k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (57:9): [True: 16.6k, False: 16.6k]
  ------------------
   58|  16.6k|        return false;
   59|  16.6k|    const struct clipboard_backend *backend = clipboard_backend_list[index];
   60|  16.6k|    *dst = (struct m_obj_desc) {
   61|  16.6k|        .name = backend->name,
   62|  16.6k|        .description = backend->desc,
   63|  16.6k|    };
   64|       |    return true;
   65|  33.3k|}
clipboard.c:mp_clipboard_create:
   99|  11.3k|{
  100|  11.3k|    cl->monitor = params->flags & CLIPBOARD_INIT_ENABLE_MONITORING;
  ------------------
  |  |   28|  11.3k|#define CLIPBOARD_INIT_ENABLE_MONITORING (1 << 0)
  ------------------
  101|       |
  102|  56.9k|    for (int n = 0; params->backends && params->backends[n].name; n++) {
  ------------------
  |  Branch (102:21): [True: 56.9k, False: 0]
  |  Branch (102:41): [True: 56.9k, False: 19]
  ------------------
  103|  56.9k|        if (!params->backends[n].enabled)
  ------------------
  |  Branch (103:13): [True: 5, False: 56.9k]
  ------------------
  104|      5|            continue;
  105|   102k|        for (int i = 0; i < MP_ARRAY_SIZE(clipboard_backend_list); i++) {
  ------------------
  |  |   49|   102k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (105:25): [True: 56.9k, False: 45.5k]
  ------------------
  106|  56.9k|            const struct clipboard_backend *backend = clipboard_backend_list[i];
  107|  56.9k|            if (strcmp(params->backends[n].name, backend->name))
  ------------------
  |  Branch (107:17): [True: 45.5k, False: 11.3k]
  ------------------
  108|  45.5k|                continue;
  109|  11.3k|            if (backend->init(cl, params) != CLIPBOARD_SUCCESS)
  ------------------
  |  Branch (109:17): [True: 0, False: 11.3k]
  ------------------
  110|      0|                break;
  111|  11.3k|            mp_mutex_lock(&cl->lock);
  ------------------
  |  |  134|  11.3k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  112|  11.3k|            cl->backend = backend;
  113|  11.3k|            mp_mutex_unlock(&cl->lock);
  ------------------
  |  |  136|  11.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  114|  11.3k|            MP_VERBOSE(cl, "Initialized %s clipboard backend.\n", cl->backend->name);
  ------------------
  |  |   92|  11.3k|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  11.3k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  115|  11.3k|            return;
  116|  11.3k|        }
  117|  56.9k|    }
  118|       |
  119|     19|    MP_WARN(cl, "Failed to initialize any clipboard backend.\n");
  ------------------
  |  |   90|     19|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     19|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  120|     19|}
clipboard.c:clipboard_destructor:
  211|  16.4k|{
  212|  16.4k|    struct clipboard_ctx *cl = ctx;
  213|  16.4k|    mp_mutex_destroy(&cl->lock);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
  214|  16.4k|}

mp_property_do:
 5069|    912|{
 5070|    912|    struct command_ctx *cmd = ctx->command_ctx;
 5071|    912|    int r = m_property_do(ctx->log, &cmd->properties, name, action, val, ctx);
 5072|       |
 5073|    912|    if (mp_msg_test(ctx->log, MSGL_V) && is_property_set(action, val)) {
  ------------------
  |  Branch (5073:9): [True: 912, False: 0]
  |  Branch (5073:42): [True: 0, False: 912]
  ------------------
 5074|      0|        struct m_property *property = m_property_list_find(&cmd->properties, name);
 5075|      0|        if (property && property->is_noisy && !mp_msg_test(ctx->log, MSGL_TRACE))
  ------------------
  |  Branch (5075:13): [True: 0, False: 0]
  |  Branch (5075:25): [True: 0, False: 0]
  |  Branch (5075:47): [True: 0, False: 0]
  ------------------
 5076|      0|            return r;
 5077|       |
 5078|      0|        struct m_option option_type = {0};
 5079|      0|        void *data = val;
 5080|      0|        switch (action) {
  ------------------
  |  Branch (5080:17): [True: 0, False: 0]
  ------------------
 5081|      0|        case M_PROPERTY_SET_NODE:
  ------------------
  |  Branch (5081:9): [True: 0, False: 0]
  ------------------
 5082|      0|            option_type.type = &m_option_type_node;
 5083|      0|            break;
 5084|      0|        case M_PROPERTY_SET_STRING:
  ------------------
  |  Branch (5084:9): [True: 0, False: 0]
  ------------------
 5085|      0|            option_type.type = &m_option_type_string;
 5086|      0|            data = &val;
 5087|      0|            break;
 5088|      0|        }
 5089|      0|        char *t = option_type.type ? m_option_print(&option_type, data) : NULL;
  ------------------
  |  Branch (5089:19): [True: 0, False: 0]
  ------------------
 5090|      0|        MP_VERBOSE(ctx, "Set property: %s%s%s -> %d\n",
  ------------------
  |  |   92|      0|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 0, False: 0]
  |  |  |  |  |  Branch (86:57): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5091|      0|                   name, t ? "=" : "", t ? t : "", r);
 5092|      0|        talloc_free(t);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 5093|      0|    }
 5094|    912|    return r;
 5095|    912|}
mp_property_expand_escaped_string:
 5129|  3.22k|{
 5130|  3.22k|    return expand_escaped_string(mpctx, str, M_PROPERTY_PRINT);
 5131|  3.22k|}
mp_expand_term_status_msg:
 5134|    166|{
 5135|    166|    const char *str = mpctx->opts->status_msg;
 5136|    166|    if (mpctx->video_out && mpctx->opts->video_osd)
  ------------------
  |  Branch (5136:9): [True: 0, False: 166]
  |  Branch (5136:29): [True: 0, False: 0]
  ------------------
 5137|      0|        return mp_property_expand_escaped_string(mpctx, str);
 5138|       |
 5139|    166|    char *msg = expand_escaped_string(mpctx, str, M_PROPERTY_PRINT_UNCUT);
 5140|    166|    int w = -1, h = 24;
 5141|    166|    terminal_get_size(&w, &h);
 5142|    166|    char *end = skip_n_lines(msg, MPMAX(h, 1));
  ------------------
  |  |   44|    166|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 166, False: 0]
  |  |  ------------------
  ------------------
 5143|    166|    if (end)
  ------------------
  |  Branch (5143:9): [True: 0, False: 166]
  ------------------
 5144|      0|        end[-1] = '\0';
 5145|    166|    return msg;
 5146|    166|}
property_print_help:
 5149|      4|{
 5150|      4|    struct command_ctx *ctx = mpctx->command_ctx;
 5151|      4|    m_properties_print_help_list(mpctx->log, &ctx->properties);
 5152|      4|}
mp_cmd_ctx_complete:
 5933|  11.3k|{
 5934|  11.3k|    cmd->completed = true;
 5935|  11.3k|    if (!cmd->success)
  ------------------
  |  Branch (5935:9): [True: 0, False: 11.3k]
  ------------------
 5936|      0|        mpv_free_node_contents(&cmd->result);
 5937|  11.3k|    if (cmd->on_completion)
  ------------------
  |  Branch (5937:9): [True: 11.3k, False: 0]
  ------------------
 5938|  11.3k|        cmd->on_completion(cmd);
 5939|  11.3k|    if (cmd->abort)
  ------------------
  |  Branch (5939:9): [True: 0, False: 11.3k]
  ------------------
 5940|      0|        mp_abort_remove(cmd->mpctx, cmd->abort);
 5941|  11.3k|    mpv_free_node_contents(&cmd->result);
 5942|  11.3k|    talloc_free(cmd);
  ------------------
  |  |   47|  11.3k|#define talloc_free                     ta_free
  ------------------
 5943|  11.3k|}
run_command:
 5980|  11.3k|{
 5981|  11.3k|    struct mp_cmd_ctx *ctx = talloc(NULL, struct mp_cmd_ctx);
  ------------------
  |  |   26|  11.3k|#define talloc                          ta_xnew
  |  |  ------------------
  |  |  |  |  133|  11.3k|#define ta_xnew(...)                    ta_oom_g(ta_new(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  11.3k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5982|  11.3k|    *ctx = (struct mp_cmd_ctx){
 5983|  11.3k|        .mpctx = mpctx,
 5984|  11.3k|        .cmd = talloc_steal(ctx, cmd),
  ------------------
  |  |   38|  11.3k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  11.3k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
 5985|  11.3k|        .args = cmd->args,
 5986|  11.3k|        .num_args = cmd->nargs,
 5987|  11.3k|        .priv = cmd->def->priv,
 5988|  11.3k|        .abort = talloc_steal(ctx, abort),
  ------------------
  |  |   38|  11.3k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  11.3k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
 5989|  11.3k|        .success = true,
 5990|  11.3k|        .completed = true,
 5991|  11.3k|        .on_completion = on_completion,
 5992|  11.3k|        .on_completion_priv = on_completion_priv,
 5993|  11.3k|    };
 5994|       |
 5995|  11.3k|    if (!ctx->abort && cmd->def->can_abort)
  ------------------
  |  Branch (5995:9): [True: 11.3k, False: 0]
  |  Branch (5995:24): [True: 0, False: 11.3k]
  ------------------
 5996|      0|        ctx->abort = talloc_zero(ctx, struct mp_abort_entry);
  ------------------
  |  |   27|      0|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|      0|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      0|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5997|       |
 5998|  11.3k|    mp_assert(cmd->def->can_abort == !!ctx->abort);
  ------------------
  |  |   41|  11.3k|#define mp_assert assert
  ------------------
  |  Branch (5998:5): [True: 11.3k, False: 0]
  ------------------
 5999|       |
 6000|  11.3k|    if (ctx->abort) {
  ------------------
  |  Branch (6000:9): [True: 0, False: 11.3k]
  ------------------
 6001|      0|        ctx->abort->coupled_to_playback |= cmd->def->abort_on_playback_end;
 6002|      0|        mp_abort_add(mpctx, ctx->abort);
 6003|      0|    }
 6004|       |
 6005|  11.3k|    struct MPOpts *opts = mpctx->opts;
 6006|  11.3k|    ctx->on_osd = cmd->flags & MP_ON_OSD_FLAGS;
 6007|  11.3k|    bool auto_osd = ctx->on_osd == MP_ON_OSD_AUTO;
 6008|  11.3k|    ctx->msg_osd = auto_osd || (ctx->on_osd & MP_ON_OSD_MSG);
  ------------------
  |  Branch (6008:20): [True: 0, False: 11.3k]
  |  Branch (6008:32): [True: 0, False: 11.3k]
  ------------------
 6009|  11.3k|    ctx->bar_osd = auto_osd || (ctx->on_osd & MP_ON_OSD_BAR);
  ------------------
  |  Branch (6009:20): [True: 0, False: 11.3k]
  |  Branch (6009:32): [True: 0, False: 11.3k]
  ------------------
 6010|  11.3k|    ctx->seek_msg_osd = auto_osd ? opts->osd_on_seek & 2 : ctx->msg_osd;
  ------------------
  |  Branch (6010:25): [True: 0, False: 11.3k]
  ------------------
 6011|  11.3k|    ctx->seek_bar_osd = auto_osd ? opts->osd_on_seek & 1 : ctx->bar_osd;
  ------------------
  |  Branch (6011:25): [True: 0, False: 11.3k]
  ------------------
 6012|       |
 6013|  11.3k|    bool noise = cmd->def->is_noisy || cmd->mouse_move;
  ------------------
  |  Branch (6013:18): [True: 0, False: 11.3k]
  |  Branch (6013:40): [True: 0, False: 11.3k]
  ------------------
 6014|  11.3k|    mp_cmd_dump(mpctx->log, noise ? MSGL_TRACE : MSGL_DEBUG, "Run command:", cmd);
  ------------------
  |  Branch (6014:29): [True: 0, False: 11.3k]
  ------------------
 6015|       |
 6016|  11.3k|    if (cmd->flags & MP_EXPAND_PROPERTIES) {
  ------------------
  |  Branch (6016:9): [True: 0, False: 11.3k]
  ------------------
 6017|      0|        for (int n = 0; n < cmd->nargs; n++) {
  ------------------
  |  Branch (6017:25): [True: 0, False: 0]
  ------------------
 6018|      0|            const m_option_type_t *type = cmd->args[n].type->type;
 6019|      0|            char **list = NULL;
 6020|      0|            if (type == CONF_TYPE_STRING)
  ------------------
  |  |  244|      0|#define CONF_TYPE_STRING        (&m_option_type_string)
  ------------------
  |  Branch (6020:17): [True: 0, False: 0]
  ------------------
 6021|      0|                list = &cmd->args[n].v.s;
 6022|      0|            else if (type == CONF_TYPE_STRING_LIST || type == CONF_TYPE_KV_LIST)
  ------------------
  |  |  245|      0|#define CONF_TYPE_STRING_LIST   (&m_option_type_string_list)
  ------------------
                          else if (type == CONF_TYPE_STRING_LIST || type == CONF_TYPE_KV_LIST)
  ------------------
  |  |  246|      0|#define CONF_TYPE_KV_LIST       (&m_option_type_keyvalue_list)
  ------------------
  |  Branch (6022:22): [True: 0, False: 0]
  |  Branch (6022:55): [True: 0, False: 0]
  ------------------
 6023|      0|                list = cmd->args[n].v.str_list;
 6024|      0|            for (; list && *list; list++) {
  ------------------
  |  Branch (6024:20): [True: 0, False: 0]
  |  Branch (6024:28): [True: 0, False: 0]
  ------------------
 6025|      0|                char *s = mp_property_expand_string(mpctx, *list);
 6026|      0|                if (!s) {
  ------------------
  |  Branch (6026:21): [True: 0, False: 0]
  ------------------
 6027|      0|                    ctx->success = false;
 6028|      0|                    mp_cmd_ctx_complete(ctx);
 6029|      0|                    return;
 6030|      0|                }
 6031|      0|                talloc_free(*list);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 6032|      0|                *list = s;
 6033|      0|                if (type == CONF_TYPE_STRING)
  ------------------
  |  |  244|      0|#define CONF_TYPE_STRING        (&m_option_type_string)
  ------------------
  |  Branch (6033:21): [True: 0, False: 0]
  ------------------
 6034|      0|                    break;
 6035|      0|            }
 6036|      0|        }
 6037|      0|    }
 6038|       |
 6039|  11.3k|    if (cmd->def->spawn_thread) {
  ------------------
  |  Branch (6039:9): [True: 0, False: 11.3k]
  ------------------
 6040|      0|        mpctx->outstanding_async += 1; // prevent that core disappears
 6041|      0|        if (!mp_thread_pool_queue(mpctx->thread_pool,
  ------------------
  |  Branch (6041:13): [True: 0, False: 0]
  ------------------
 6042|      0|                                  run_command_on_worker_thread, ctx))
 6043|      0|        {
 6044|      0|            mpctx->outstanding_async -= 1;
 6045|      0|            ctx->success = false;
 6046|      0|            mp_cmd_ctx_complete(ctx);
 6047|      0|        }
 6048|  11.3k|    } else {
 6049|  11.3k|        bool exec_async = cmd->def->exec_async;
 6050|  11.3k|        cmd->def->handler(ctx);
 6051|  11.3k|        if (!exec_async)
  ------------------
  |  Branch (6051:13): [True: 11.3k, False: 0]
  ------------------
 6052|  11.3k|            mp_cmd_ctx_complete(ctx);
 6053|  11.3k|    }
 6054|  11.3k|}
command_uninit:
 8218|  16.4k|{
 8219|  16.4k|    struct command_ctx *ctx = mpctx->command_ctx;
 8220|       |
 8221|  16.4k|    mp_assert(!ctx->cache_dump_cmd); // closing the demuxer must have aborted it
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (8221:5): [True: 16.4k, False: 0]
  ------------------
 8222|       |
 8223|  16.4k|    overlay_uninit(mpctx);
 8224|  16.4k|    ao_hotplug_destroy(ctx->hotplug);
 8225|       |
 8226|  16.4k|    m_option_free(&script_props_type, &ctx->script_props);
 8227|       |
 8228|  16.4k|    talloc_free(mpctx->command_ctx);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
 8229|       |    mpctx->command_ctx = NULL;
 8230|  16.4k|}
command_init:
 8238|  16.4k|{
 8239|  16.4k|    struct command_ctx *ctx = talloc(NULL, struct command_ctx);
  ------------------
  |  |   26|  16.4k|#define talloc                          ta_xnew
  |  |  ------------------
  |  |  |  |  133|  16.4k|#define ta_xnew(...)                    ta_oom_g(ta_new(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 8240|  16.4k|    *ctx = (struct command_ctx){
 8241|  16.4k|        .last_seek_pts = MP_NOPTS_VALUE,
  ------------------
  |  |   39|  16.4k|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
 8242|  16.4k|    };
 8243|  16.4k|    mpctx->command_ctx = ctx;
 8244|       |
 8245|  16.4k|    int num_base = MP_ARRAY_SIZE(mp_properties_base);
  ------------------
  |  |   49|  16.4k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
 8246|  16.4k|    int num_opts = m_config_get_co_count(mpctx->mconfig);
 8247|  16.4k|    struct m_property *props =
 8248|  16.4k|        talloc_zero_array(ctx, struct m_property, num_base + num_opts);
  ------------------
  |  |   30|  16.4k|#define talloc_zero_array               ta_xznew_array
  |  |  ------------------
  |  |  |  |  136|  16.4k|#define ta_xznew_array(...)             ta_oom_g(ta_znew_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 8249|  16.4k|    memcpy(props, mp_properties_base, sizeof(mp_properties_base));
 8250|       |
 8251|  16.4k|    const char **prop_names = talloc_array(NULL, const char *, num_base);
  ------------------
  |  |   29|  16.4k|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|  16.4k|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 8252|  3.21M|    for (int i = 0; i < num_base; ++i)
  ------------------
  |  Branch (8252:21): [True: 3.19M, False: 16.4k]
  ------------------
 8253|  3.19M|        prop_names[i] = mp_properties_base[i].name;
 8254|  16.4k|    qsort(prop_names, num_base, sizeof(const char *), str_compare);
 8255|       |
 8256|  16.4k|    int count = num_base;
 8257|  12.8M|    for (int n = 0; n < num_opts; n++) {
  ------------------
  |  Branch (8257:21): [True: 12.8M, False: 16.4k]
  ------------------
 8258|  12.8M|        struct m_config_option *co = m_config_get_co_index(mpctx->mconfig, n);
 8259|  12.8M|        mp_assert(co->name[0]);
  ------------------
  |  |   41|  12.8M|#define mp_assert assert
  ------------------
  |  Branch (8259:9): [True: 12.8M, False: 0]
  ------------------
 8260|  12.8M|        if (co->opt->flags & M_OPT_NOPROP)
  ------------------
  |  |  477|  12.8M|#define M_OPT_NOPROP            (UINT64_C(1) << 60)
  ------------------
  |  Branch (8260:13): [True: 459k, False: 12.4M]
  ------------------
 8261|   459k|            continue;
 8262|       |
 8263|  12.4M|        struct m_property prop = {
 8264|  12.4M|            .name = co->name,
 8265|  12.4M|            .call = mp_property_generic_option,
 8266|  12.4M|            .priv = co,
 8267|  12.4M|            .is_option = true,
 8268|  12.4M|        };
 8269|       |
 8270|  12.4M|        if (co->opt->type == &m_option_type_alias) {
  ------------------
  |  Branch (8270:13): [True: 377k, False: 12.0M]
  ------------------
 8271|   377k|            char buf[M_CONFIG_MAX_OPT_NAME_LEN];
 8272|   377k|            const char *alias = m_config_shadow_get_alias_from_opt(mpctx->mconfig->shadow, co->opt_id,
 8273|   377k|                                                                   buf, sizeof(buf));
 8274|   377k|            prop.priv = talloc_strdup(ctx, alias);
  ------------------
  |  |   50|   377k|#define talloc_strdup                   ta_xstrdup
  ------------------
 8275|       |
 8276|   377k|            prop.call = co->opt->deprecation_message ?
  ------------------
  |  Branch (8276:25): [True: 114k, False: 262k]
  ------------------
 8277|   262k|                            mp_property_deprecated_alias : mp_property_alias;
 8278|       |
 8279|       |            // Check whether this eventually arrives at a real option. If not,
 8280|       |            // it's some CLI special handling thing. For example, "nosound" is
 8281|       |            // mapped to "no-audio", which has CLI special-handling, and cannot
 8282|       |            // be set as property.
 8283|   377k|            struct m_config_option *co2 = co;
 8284|   754k|            while (co2 && co2->opt->type == &m_option_type_alias) {
  ------------------
  |  Branch (8284:20): [True: 754k, False: 0]
  |  Branch (8284:27): [True: 377k, False: 377k]
  ------------------
 8285|   377k|                const char *co2_alias = m_config_shadow_get_alias_from_opt(mpctx->mconfig->shadow, co2->opt_id,
 8286|   377k|                                                                           buf, sizeof(buf));
 8287|   377k|                co2 = m_config_get_co_raw(mpctx->mconfig, bstr0(co2_alias));
 8288|   377k|            }
 8289|   377k|            if (!co2)
  ------------------
  |  Branch (8289:17): [True: 0, False: 377k]
  ------------------
 8290|      0|                continue;
 8291|   377k|        }
 8292|       |
 8293|       |        // The option might be covered by a manual property already.
 8294|  12.4M|        if (bsearch(&prop.name, prop_names, num_base, sizeof(const char *), str_compare))
  ------------------
  |  Branch (8294:13): [True: 393k, False: 12.0M]
  ------------------
 8295|   393k|            continue;
 8296|       |
 8297|  12.0M|        props[count++] = prop;
 8298|  12.0M|    }
 8299|       |
 8300|  16.4k|    ctx->properties = (struct m_property_list){props, count};
 8301|  16.4k|    m_property_list_sort(&ctx->properties);
 8302|       |
 8303|  16.4k|    node_init(&ctx->mdata, MPV_FORMAT_NODE_ARRAY, NULL);
 8304|  16.4k|    talloc_steal(ctx, ctx->mdata.u.list);
  ------------------
  |  |   38|  16.4k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  16.4k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
 8305|       |
 8306|  16.4k|    node_init(&ctx->udata, MPV_FORMAT_NODE_MAP, NULL);
 8307|  16.4k|    talloc_steal(ctx, ctx->udata.u.list);
  ------------------
  |  |   38|  16.4k|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|  16.4k|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
 8308|  16.4k|    talloc_free(prop_names);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
 8309|  16.4k|}
handle_command_updates:
 8357|  16.8k|{
 8358|  16.8k|    struct command_ctx *ctx = mpctx->command_ctx;
 8359|       |
 8360|       |    // This is a bit messy: ao_hotplug wakes up the player, and then we have
 8361|       |    // to recheck the state. Then the client(s) will read the property.
 8362|  16.8k|    if (ctx->hotplug && ao_hotplug_check_update(ctx->hotplug))
  ------------------
  |  Branch (8362:9): [True: 10, False: 16.8k]
  |  Branch (8362:25): [True: 0, False: 10]
  ------------------
 8363|      0|        mp_notify_property(mpctx, "audio-device-list");
 8364|       |
 8365|       |    // Depends on polling demuxer wakeup callback notifications.
 8366|  16.8k|    cache_dump_poll(mpctx);
 8367|  16.8k|}
mp_notify:
 8390|  16.3k|{
 8391|       |    // The OSD can implicitly reference some properties.
 8392|  16.3k|    mpctx->osd_idle_update = true;
 8393|       |
 8394|  16.3k|    command_event(mpctx, event, arg);
 8395|       |
 8396|  16.3k|    mp_client_broadcast_event(mpctx, event, arg);
 8397|  16.3k|}
mp_option_change_callback:
 8429|  11.3k|{
 8430|  11.3k|    struct MPContext *mpctx = ctx;
 8431|  11.3k|    struct MPOpts *opts = mpctx->opts;
 8432|  11.3k|    void *opt_ptr = !co ? NULL : co->data; // NULL on start
  ------------------
  |  Branch (8432:21): [True: 11.3k, False: 0]
  ------------------
 8433|       |
 8434|  11.3k|    if (co)
  ------------------
  |  Branch (8434:9): [True: 0, False: 11.3k]
  ------------------
 8435|      0|        mp_notify_property(mpctx, co->name);
 8436|  11.3k|    if (opt_ptr == &opts->media_title)
  ------------------
  |  Branch (8436:9): [True: 0, False: 11.3k]
  ------------------
 8437|      0|        mp_notify(mpctx, MP_EVENT_METADATA_UPDATE, NULL);
 8438|       |
 8439|  11.3k|    if (self_update)
  ------------------
  |  Branch (8439:9): [True: 0, False: 11.3k]
  ------------------
 8440|      0|        return;
 8441|       |
 8442|       |    // Run these immediately.
 8443|  11.3k|    if (co && !co->coalesce) {
  ------------------
  |  Branch (8443:9): [True: 0, False: 11.3k]
  |  Branch (8443:15): [True: 0, False: 0]
  ------------------
 8444|      0|        struct mp_option_callback callback = {.co = co, .flags = flags};
 8445|      0|        mp_option_run_callback(mpctx, &callback);
 8446|      0|        return;
 8447|      0|    }
 8448|       |
 8449|       |    // Coalesce redundant updates and only keep the newest one.
 8450|  11.3k|    bool drop = false;
 8451|  11.3k|    for (int i = 0; i < mpctx->num_option_callbacks; i++) {
  ------------------
  |  Branch (8451:21): [True: 0, False: 11.3k]
  ------------------
 8452|      0|        if ((mpctx->option_callbacks[i].co && opt_ptr == mpctx->option_callbacks[i].co->data) ||
  ------------------
  |  Branch (8452:14): [True: 0, False: 0]
  |  Branch (8452:47): [True: 0, False: 0]
  ------------------
 8453|      0|            (flags && flags == mpctx->option_callbacks[i].flags))
  ------------------
  |  Branch (8453:14): [True: 0, False: 0]
  |  Branch (8453:23): [True: 0, False: 0]
  ------------------
 8454|      0|            drop = true;
 8455|      0|        if (!drop)
  ------------------
  |  Branch (8455:13): [True: 0, False: 0]
  ------------------
 8456|      0|            continue;
 8457|      0|        if (i < mpctx->num_option_callbacks - 1)
  ------------------
  |  Branch (8457:13): [True: 0, False: 0]
  ------------------
 8458|      0|            mpctx->option_callbacks[i] = mpctx->option_callbacks[i + 1];
 8459|      0|        if (i == mpctx->num_option_callbacks - 1) {
  ------------------
  |  Branch (8459:13): [True: 0, False: 0]
  ------------------
 8460|      0|            mpctx->option_callbacks[i].co = co;
 8461|      0|            mpctx->option_callbacks[i].flags = flags;
 8462|      0|        }
 8463|      0|    }
 8464|       |
 8465|  11.3k|    if (!drop) {
  ------------------
  |  Branch (8465:9): [True: 11.3k, False: 0]
  ------------------
 8466|  11.3k|        struct mp_option_callback callback = {.co = co, .flags = flags};
 8467|  11.3k|        MP_TARRAY_APPEND(mpctx, mpctx->option_callbacks, mpctx->num_option_callbacks, callback);
  ------------------
  |  |  105|  11.3k|    do {                                            \
  |  |  106|  11.3k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  11.3k|    do {                                            \
  |  |  |  |   97|  11.3k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  11.3k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  11.3k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  11.3k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 11.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|  11.3k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  11.3k|    do {                                                        \
  |  |  |  |  |  |   89|  11.3k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  11.3k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  11.3k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  11.3k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  11.3k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  11.3k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  11.3k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 11.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  11.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 11.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  11.3k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  11.3k|        (idxvar)++;                                 \
  |  |  109|  11.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 8468|  11.3k|    }
 8469|  11.3k|}
mp_option_run_callback:
 8472|  11.3k|{
 8473|  11.3k|    struct MPOpts *opts = mpctx->opts;
 8474|  11.3k|    struct m_config_option *co = callback->co;
 8475|  11.3k|    void *opt_ptr = co ? co->data : NULL;
  ------------------
  |  Branch (8475:21): [True: 0, False: 11.3k]
  ------------------
 8476|  11.3k|    uint64_t flags = callback->flags;
 8477|       |
 8478|  11.3k|    if (flags & UPDATE_TERM)
  ------------------
  |  |  442|  11.3k|#define UPDATE_TERM             (UINT64_C(1) << 0)   // terminal options
  ------------------
  |  Branch (8478:9): [True: 11.3k, False: 0]
  ------------------
 8479|  11.3k|        mp_update_logging(mpctx, false);
 8480|       |
 8481|  11.3k|    if (flags & (UPDATE_OSD | UPDATE_SUB_FILT | UPDATE_SUB_HARD)) {
  ------------------
  |  |  444|  11.3k|#define UPDATE_OSD              (UINT64_C(1) << 2)   // related to OSD rendering
  ------------------
                  if (flags & (UPDATE_OSD | UPDATE_SUB_FILT | UPDATE_SUB_HARD)) {
  ------------------
  |  |  443|  11.3k|#define UPDATE_SUB_FILT         (UINT64_C(1) << 1)   // subtitle filter options
  ------------------
                  if (flags & (UPDATE_OSD | UPDATE_SUB_FILT | UPDATE_SUB_HARD)) {
  ------------------
  |  |  455|  11.3k|#define UPDATE_SUB_HARD         (UINT64_C(1) << 13)  // subtitle opts. that need full reinit
  ------------------
  |  Branch (8481:9): [True: 11.3k, False: 0]
  ------------------
 8482|  34.1k|        for (int n = 0; n < num_ptracks[STREAM_SUB]; n++) {
  ------------------
  |  Branch (8482:25): [True: 22.7k, False: 11.3k]
  ------------------
 8483|  22.7k|            struct track *track = mpctx->current_track[n][STREAM_SUB];
 8484|  22.7k|            struct dec_sub *sub = track ? track->d_sub : NULL;
  ------------------
  |  Branch (8484:35): [True: 0, False: 22.7k]
  ------------------
 8485|  22.7k|            if (sub) {
  ------------------
  |  Branch (8485:17): [True: 0, False: 22.7k]
  ------------------
 8486|      0|                int ret = sub_control(sub, SD_CTRL_UPDATE_OPTS, &flags);
 8487|      0|                if (ret == CONTROL_OK && flags & (UPDATE_SUB_FILT | UPDATE_SUB_HARD)) {
  ------------------
  |  |   95|      0|#define CONTROL_OK 1
  ------------------
                              if (ret == CONTROL_OK && flags & (UPDATE_SUB_FILT | UPDATE_SUB_HARD)) {
  ------------------
  |  |  443|      0|#define UPDATE_SUB_FILT         (UINT64_C(1) << 1)   // subtitle filter options
  ------------------
                              if (ret == CONTROL_OK && flags & (UPDATE_SUB_FILT | UPDATE_SUB_HARD)) {
  ------------------
  |  |  455|      0|#define UPDATE_SUB_HARD         (UINT64_C(1) << 13)  // subtitle opts. that need full reinit
  ------------------
  |  Branch (8487:21): [True: 0, False: 0]
  |  Branch (8487:42): [True: 0, False: 0]
  ------------------
 8488|      0|                    sub_redecode_cached_packets(sub);
 8489|      0|                }
 8490|      0|            }
 8491|  22.7k|        }
 8492|       |        // For subs on a still image.
 8493|  11.3k|        redraw_subs(mpctx);
 8494|  11.3k|        osd_changed(mpctx->osd);
 8495|  11.3k|    }
 8496|       |
 8497|  11.3k|    if (flags & UPDATE_BUILTIN_SCRIPTS)
  ------------------
  |  |  445|  11.3k|#define UPDATE_BUILTIN_SCRIPTS  (UINT64_C(1) << 3)   // osc/ytdl/stats
  ------------------
  |  Branch (8497:9): [True: 11.3k, False: 0]
  ------------------
 8498|  11.3k|        mp_load_builtin_scripts(mpctx);
 8499|       |
 8500|  11.3k|    if (flags & UPDATE_IMGPAR) {
  ------------------
  |  |  446|  11.3k|#define UPDATE_IMGPAR           (UINT64_C(1) << 4)   // video image params overrides
  ------------------
  |  Branch (8500:9): [True: 11.3k, False: 0]
  ------------------
 8501|  11.3k|        struct track *track = mpctx->current_track[0][STREAM_VIDEO];
 8502|  11.3k|        if (track && track->dec) {
  ------------------
  |  Branch (8502:13): [True: 0, False: 11.3k]
  |  Branch (8502:22): [True: 0, False: 0]
  ------------------
 8503|      0|            mp_decoder_wrapper_reset_params(track->dec);
 8504|      0|            mp_force_video_refresh(mpctx);
 8505|      0|        }
 8506|  11.3k|    }
 8507|       |
 8508|  11.3k|    if (flags & UPDATE_INPUT)
  ------------------
  |  |  447|  11.3k|#define UPDATE_INPUT            (UINT64_C(1) << 5)   // mostly --input-* options
  ------------------
  |  Branch (8508:9): [True: 11.3k, False: 0]
  ------------------
 8509|  11.3k|        mp_input_update_opts(mpctx->input);
 8510|       |
 8511|  11.3k|    if (flags & UPDATE_CLIPBOARD)
  ------------------
  |  |  458|  11.3k|#define UPDATE_CLIPBOARD        (UINT64_C(1) << 17)  // reinit the clipboard
  ------------------
  |  Branch (8511:9): [True: 11.3k, False: 0]
  ------------------
 8512|  11.3k|        reinit_clipboard(mpctx);
 8513|       |
 8514|  11.3k|    if (opt_ptr == &opts->ipc_path || opt_ptr == &opts->ipc_client) {
  ------------------
  |  Branch (8514:9): [True: 0, False: 11.3k]
  |  Branch (8514:39): [True: 0, False: 11.3k]
  ------------------
 8515|      0|        mp_uninit_ipc(mpctx->ipc_ctx);
 8516|      0|        mpctx->ipc_ctx = mp_init_ipc(mpctx->clients, mpctx->global);
 8517|      0|    }
 8518|       |
 8519|  11.3k|    if (flags & UPDATE_VO && mpctx->video_out) {
  ------------------
  |  |  457|  22.7k|#define UPDATE_VO               (UINT64_C(1) << 16)  // reinit the VO
  ------------------
  |  Branch (8519:9): [True: 11.3k, False: 0]
  |  Branch (8519:30): [True: 0, False: 11.3k]
  ------------------
 8520|      0|        struct track *track = mpctx->current_track[0][STREAM_VIDEO];
 8521|      0|        struct mp_pin *filter_src = mpctx->vo_chain ? mpctx->vo_chain->filter_src : NULL;
  ------------------
  |  Branch (8521:37): [True: 0, False: 0]
  ------------------
 8522|      0|        uninit_video_out(mpctx);
 8523|      0|        handle_force_window(mpctx, true);
 8524|       |
 8525|      0|        if (filter_src) {
  ------------------
  |  Branch (8525:13): [True: 0, False: 0]
  ------------------
 8526|      0|            reinit_video_chain_src(mpctx, NULL);
 8527|      0|            if (mpctx->vo_chain) {
  ------------------
  |  Branch (8527:17): [True: 0, False: 0]
  ------------------
 8528|      0|                mpctx->vo_chain->filter_src = filter_src;
 8529|      0|                mp_pin_connect(mpctx->vo_chain->filter->f->pins[0], filter_src);
 8530|      0|            }
 8531|      0|        } else {
 8532|      0|            reinit_video_chain(mpctx);
 8533|      0|        }
 8534|       |
 8535|      0|        if (track || filter_src)
  ------------------
  |  Branch (8535:13): [True: 0, False: 0]
  |  Branch (8535:22): [True: 0, False: 0]
  ------------------
 8536|      0|            queue_seek(mpctx, MPSEEK_RELATIVE, 0.0, MPSEEK_EXACT, 0);
 8537|       |
 8538|      0|        mp_wakeup_core(mpctx);
 8539|      0|    }
 8540|       |
 8541|  11.3k|    if (flags & UPDATE_AUDIO)
  ------------------
  |  |  448|  11.3k|#define UPDATE_AUDIO            (UINT64_C(1) << 6)   // --audio-channels etc.
  ------------------
  |  Branch (8541:9): [True: 11.3k, False: 0]
  ------------------
 8542|  11.3k|        reload_audio_output(mpctx);
 8543|       |
 8544|  11.3k|    if (flags & UPDATE_PRIORITY)
  ------------------
  |  |  449|  11.3k|#define UPDATE_PRIORITY         (UINT64_C(1) << 7)   // --priority (Windows-only)
  ------------------
  |  Branch (8544:9): [True: 11.3k, False: 0]
  ------------------
 8545|  11.3k|        update_priority(mpctx);
 8546|       |
 8547|  11.3k|    if (flags & UPDATE_SCREENSAVER)
  ------------------
  |  |  450|  11.3k|#define UPDATE_SCREENSAVER      (UINT64_C(1) << 8)   // --stop-screensaver
  ------------------
  |  Branch (8547:9): [True: 11.3k, False: 0]
  ------------------
 8548|  11.3k|        update_screensaver_state(mpctx);
 8549|       |
 8550|  11.3k|    if (flags & UPDATE_VOL)
  ------------------
  |  |  451|  11.3k|#define UPDATE_VOL              (UINT64_C(1) << 9)   // softvol related options
  ------------------
  |  Branch (8550:9): [True: 11.3k, False: 0]
  ------------------
 8551|  11.3k|        audio_update_volume(mpctx);
 8552|       |
 8553|  11.3k|    if (flags & UPDATE_LAVFI_COMPLEX)
  ------------------
  |  |  452|  11.3k|#define UPDATE_LAVFI_COMPLEX    (UINT64_C(1) << 10)  // --lavfi-complex
  ------------------
  |  Branch (8553:9): [True: 11.3k, False: 0]
  ------------------
 8554|  11.3k|        update_lavfi_complex(mpctx);
 8555|       |
 8556|  11.3k|    if (flags & UPDATE_VIDEO) {
  ------------------
  |  |  456|  11.3k|#define UPDATE_VIDEO            (UINT64_C(1) << 15)  // force redraw if needed
  ------------------
  |  Branch (8556:9): [True: 11.3k, False: 0]
  ------------------
 8557|  11.3k|        if (mpctx->video_out) {
  ------------------
  |  Branch (8557:13): [True: 0, False: 11.3k]
  ------------------
 8558|      0|            vo_control(mpctx->video_out, VOCTRL_UPDATE_RENDER_OPTS, NULL);
 8559|      0|            mp_wakeup_core(mpctx);
 8560|      0|        }
 8561|  11.3k|    }
 8562|       |
 8563|  11.3k|    if (flags & UPDATE_HWDEC) {
  ------------------
  |  |  453|  11.3k|#define UPDATE_HWDEC            (UINT64_C(1) << 11)  // --hwdec
  ------------------
  |  Branch (8563:9): [True: 11.3k, False: 0]
  ------------------
 8564|  11.3k|        struct track *track = mpctx->current_track[0][STREAM_VIDEO];
 8565|  11.3k|        struct mp_decoder_wrapper *dec = track ? track->dec : NULL;
  ------------------
  |  Branch (8565:42): [True: 0, False: 11.3k]
  ------------------
 8566|  11.3k|        if (dec) {
  ------------------
  |  Branch (8566:13): [True: 0, False: 11.3k]
  ------------------
 8567|      0|            mp_decoder_wrapper_control(dec, VDCTRL_REINIT, NULL);
 8568|       |            // filter chain might not change (which normally triggers this), but
 8569|       |            // hwdec will.
 8570|      0|            mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL);
 8571|      0|            double last_pts = mpctx->video_pts;
 8572|      0|            if (last_pts != MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (8572:17): [True: 0, False: 0]
  ------------------
 8573|      0|                queue_seek(mpctx, MPSEEK_ABSOLUTE, last_pts, MPSEEK_EXACT, 0);
 8574|      0|        }
 8575|  11.3k|    }
 8576|       |
 8577|  11.3k|    if (flags & UPDATE_DVB_PROG) {
  ------------------
  |  |  454|  11.3k|#define UPDATE_DVB_PROG         (UINT64_C(1) << 12)  // some --dvbin-...
  ------------------
  |  Branch (8577:9): [True: 11.3k, False: 0]
  ------------------
 8578|  11.3k|        if (!mpctx->stop_play)
  ------------------
  |  Branch (8578:13): [True: 0, False: 11.3k]
  ------------------
 8579|      0|            mpctx->stop_play = PT_CURRENT_ENTRY;
 8580|  11.3k|    }
 8581|       |
 8582|  11.3k|    if (flags & UPDATE_DEMUXER)
  ------------------
  |  |  459|  11.3k|#define UPDATE_DEMUXER          (UINT64_C(1) << 18)  // invalidate --prefetch-playlist's data
  ------------------
  |  Branch (8582:9): [True: 11.3k, False: 0]
  ------------------
 8583|  11.3k|        mpctx->demuxer_changed = true;
 8584|       |
 8585|  11.3k|    if (flags & UPDATE_AD && mpctx->ao_chain) {
  ------------------
  |  |  460|  22.7k|#define UPDATE_AD               (UINT64_C(1) << 19)  // reinit audio chain and decoder
  ------------------
  |  Branch (8585:9): [True: 11.3k, False: 0]
  |  Branch (8585:30): [True: 0, False: 11.3k]
  ------------------
 8586|      0|        uninit_audio_chain(mpctx);
 8587|      0|        reinit_audio_chain(mpctx);
 8588|      0|    }
 8589|       |
 8590|  11.3k|    if (flags & UPDATE_VD && mpctx->vo_chain) {
  ------------------
  |  |  461|  22.7k|#define UPDATE_VD               (UINT64_C(1) << 20)  // reinit video chain and decoder
  ------------------
  |  Branch (8590:9): [True: 11.3k, False: 0]
  |  Branch (8590:30): [True: 0, False: 11.3k]
  ------------------
 8591|      0|        struct track *track = mpctx->current_track[0][STREAM_VIDEO];
 8592|      0|        uninit_video_chain(mpctx);
 8593|      0|        reinit_video_chain(mpctx);
 8594|      0|        if (track)
  ------------------
  |  Branch (8594:13): [True: 0, False: 0]
  ------------------
 8595|      0|            queue_seek(mpctx, MPSEEK_RELATIVE, 0.0, MPSEEK_EXACT, 0);
 8596|      0|    }
 8597|       |
 8598|  11.3k|    if (opt_ptr == &opts->vo->android_surface_size || opt_ptr == &opts->vo->d3d11_composition_size) {
  ------------------
  |  Branch (8598:9): [True: 0, False: 11.3k]
  |  Branch (8598:55): [True: 0, False: 11.3k]
  ------------------
 8599|      0|        if (mpctx->video_out)
  ------------------
  |  Branch (8599:13): [True: 0, False: 0]
  ------------------
 8600|      0|            vo_control(mpctx->video_out, VOCTRL_EXTERNAL_RESIZE, NULL);
 8601|      0|    }
 8602|       |
 8603|  11.3k|    if (opt_ptr == &opts->input_commands) {
  ------------------
  |  Branch (8603:9): [True: 0, False: 11.3k]
  ------------------
 8604|      0|        mpctx->command_ctx->command_opts_processed = false;
 8605|      0|        run_command_opts(mpctx);
 8606|      0|    }
 8607|       |
 8608|  11.3k|    if (opt_ptr == &opts->playback_speed || opt_ptr == &opts->playback_pitch ||
  ------------------
  |  Branch (8608:9): [True: 0, False: 11.3k]
  |  Branch (8608:45): [True: 0, False: 11.3k]
  ------------------
 8609|  11.3k|        opt_ptr == &opts->pitch_correction) {
  ------------------
  |  Branch (8609:9): [True: 0, False: 11.3k]
  ------------------
 8610|      0|        update_playback_speed(mpctx);
 8611|      0|        mp_wakeup_core(mpctx);
 8612|      0|    }
 8613|       |
 8614|  11.3k|    if (opt_ptr == &opts->play_dir) {
  ------------------
  |  Branch (8614:9): [True: 0, False: 11.3k]
  ------------------
 8615|      0|        if (mpctx->play_dir != opts->play_dir) {
  ------------------
  |  Branch (8615:13): [True: 0, False: 0]
  ------------------
 8616|       |            // The option must be set before we seek if we're at EOF.
 8617|      0|            if (mpctx->stop_play == AT_END_OF_FILE)
  ------------------
  |  Branch (8617:17): [True: 0, False: 0]
  ------------------
 8618|      0|                mpctx->play_dir = opts->play_dir;
 8619|      0|            queue_seek(mpctx, MPSEEK_ABSOLUTE, get_current_time(mpctx),
 8620|      0|                       MPSEEK_EXACT, 0);
 8621|      0|        }
 8622|      0|    }
 8623|       |
 8624|  11.3k|    if (opt_ptr == &opts->edition_id) {
  ------------------
  |  Branch (8624:9): [True: 0, False: 11.3k]
  ------------------
 8625|      0|        struct demuxer *demuxer = mpctx->demuxer;
 8626|      0|        if (mpctx->playback_initialized && demuxer && demuxer->num_editions > 0) {
  ------------------
  |  Branch (8626:13): [True: 0, False: 0]
  |  Branch (8626:44): [True: 0, False: 0]
  |  Branch (8626:55): [True: 0, False: 0]
  ------------------
 8627|      0|            if (opts->edition_id != demuxer->edition) {
  ------------------
  |  Branch (8627:17): [True: 0, False: 0]
  ------------------
 8628|      0|                if (demuxer->edition_is_track_mapping) {
  ------------------
  |  Branch (8628:21): [True: 0, False: 0]
  ------------------
 8629|      0|                    int new_ed = opts->edition_id;
 8630|      0|                    if (new_ed < 0 || new_ed >= demuxer->num_editions)
  ------------------
  |  Branch (8630:25): [True: 0, False: 0]
  |  Branch (8630:39): [True: 0, False: 0]
  ------------------
 8631|      0|                        new_ed = 0;
 8632|      0|                    demuxer->edition = new_ed;
 8633|      0|                    for (int t = 0; t < STREAM_TYPE_COUNT; t++) {
  ------------------
  |  Branch (8633:37): [True: 0, False: 0]
  ------------------
 8634|      0|                        for (int i = 0; i < num_ptracks[t]; i++) {
  ------------------
  |  Branch (8634:41): [True: 0, False: 0]
  ------------------
 8635|      0|                            struct track *sel = select_default_track(mpctx, i, t);
 8636|      0|                            if (sel != mpctx->current_track[i][t])
  ------------------
  |  Branch (8636:33): [True: 0, False: 0]
  ------------------
 8637|      0|                                mp_switch_track_n(mpctx, i, t, sel, 0);
 8638|      0|                        }
 8639|      0|                    }
 8640|      0|                    if (demuxer->ts_resets_possible) {
  ------------------
  |  Branch (8640:25): [True: 0, False: 0]
  ------------------
 8641|      0|                        reset_playback_state(mpctx);
 8642|      0|                        demux_flush(demuxer);
 8643|      0|                    }
 8644|      0|                    mp_notify_property(mpctx, "current-edition");
 8645|      0|                    print_track_list(mpctx,
 8646|      0|                        mp_tprintf(42, "Selected edition %d:", demuxer->edition));
  ------------------
  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  ------------------
 8647|      0|                } else if (disc_nav_get_stream(mpctx)) {
  ------------------
  |  Branch (8647:28): [True: 0, False: 0]
  ------------------
 8648|      0|                    unsigned new_title = opts->edition_id;
 8649|      0|                    stream_control(demuxer->stream,
 8650|      0|                                   STREAM_CTRL_SET_CURRENT_TITLE, &new_title);
 8651|      0|                } else {
 8652|      0|                    if (!mpctx->stop_play)
  ------------------
  |  Branch (8652:25): [True: 0, False: 0]
  ------------------
 8653|      0|                        mpctx->stop_play = PT_CURRENT_ENTRY;
 8654|      0|                }
 8655|      0|                mp_wakeup_core(mpctx);
 8656|      0|            }
 8657|      0|        }
 8658|      0|    }
 8659|       |
 8660|       |#if HAVE_LIBBLURAY
 8661|       |    if (opt_ptr == &opts->stream_bluray_opts->angle) {
 8662|       |        struct demuxer *demuxer = mpctx->demuxer;
 8663|       |        if (mpctx->playback_initialized && demuxer && demuxer->stream &&
 8664|       |                (!strcmp(demuxer->stream->info->name, "bd") ||
 8665|       |                 !strcmp(demuxer->stream->info->name, "bdmv/bluray"))) {
 8666|       |            int angle = opts->stream_bluray_opts->angle;
 8667|       |            stream_control(demuxer->stream, STREAM_CTRL_SET_ANGLE, &angle);
 8668|       |        }
 8669|       |    }
 8670|       |#endif
 8671|       |
 8672|       |#if HAVE_DVDA
 8673|       |    if (opt_ptr == &opts->dvda_opts->page) {
 8674|       |        struct demuxer *demuxer = mpctx->demuxer;
 8675|       |        if (mpctx->playback_initialized && demuxer && demuxer->stream &&
 8676|       |                (!strcmp(demuxer->stream->info->name, "dvda") ||
 8677|       |                 !strcmp(demuxer->stream->info->name, "ifo_dvda"))) {
 8678|       |            int page = opts->dvda_opts->page;
 8679|       |            stream_control(demuxer->stream, STREAM_CTRL_SET_STILL_PAGE, &page);
 8680|       |        }
 8681|       |    }
 8682|       |#endif
 8683|       |
 8684|  11.3k|    if (opt_ptr == &opts->pause)
  ------------------
  |  Branch (8684:9): [True: 0, False: 11.3k]
  ------------------
 8685|      0|        set_pause_state(mpctx, opts->pause);
 8686|       |
 8687|  11.3k|    if (opt_ptr == &opts->audio_delay) {
  ------------------
  |  Branch (8687:9): [True: 0, False: 11.3k]
  ------------------
 8688|      0|        if (mpctx->ao_chain) {
  ------------------
  |  Branch (8688:13): [True: 0, False: 0]
  ------------------
 8689|      0|            double change = mpctx->opts->audio_delay - mpctx->ao_chain->delay;
 8690|      0|            mpctx->delay += change;
 8691|      0|            mpctx->ao_chain->delayed_start_gap += change;
 8692|      0|            mpctx->ao_chain->delay = mpctx->opts->audio_delay;
 8693|      0|        }
 8694|      0|        mp_wakeup_core(mpctx);
 8695|      0|    }
 8696|       |
 8697|  11.3k|    if (opt_ptr == &opts->vo->window_scale)
  ------------------
  |  Branch (8697:9): [True: 0, False: 11.3k]
  ------------------
 8698|      0|        update_window_scale(mpctx);
 8699|       |
 8700|  11.3k|    if (opt_ptr == &opts->vo->hidpi_window_scale)
  ------------------
  |  Branch (8700:9): [True: 0, False: 11.3k]
  ------------------
 8701|      0|        update_hidpi_window_scale(mpctx, opts->vo->hidpi_window_scale);
 8702|       |
 8703|  11.3k|    if (opt_ptr == &opts->cursor_autohide_delay)
  ------------------
  |  Branch (8703:9): [True: 0, False: 11.3k]
  ------------------
 8704|      0|        mpctx->mouse_timer = 0;
 8705|       |
 8706|  11.3k|    if (opt_ptr == &opts->loop_file) {
  ------------------
  |  Branch (8706:9): [True: 0, False: 11.3k]
  ------------------
 8707|      0|        mpctx->remaining_file_loops = opts->loop_file;
 8708|      0|        mp_notify_property(mpctx, "remaining-file-loops");
 8709|      0|    }
 8710|       |
 8711|  11.3k|    if (opt_ptr == &opts->ab_loop[0] || opt_ptr == &opts->ab_loop[1] ||
  ------------------
  |  Branch (8711:9): [True: 0, False: 11.3k]
  |  Branch (8711:41): [True: 0, False: 11.3k]
  ------------------
 8712|  11.3k|        opt_ptr == &opts->ab_loop_count) {
  ------------------
  |  Branch (8712:9): [True: 0, False: 11.3k]
  ------------------
 8713|      0|        mpctx->remaining_ab_loops = opts->ab_loop_count;
 8714|      0|        mp_notify_property(mpctx, "remaining-ab-loops");
 8715|      0|    }
 8716|       |
 8717|  11.3k|    if (opt_ptr == &opts->ab_loop[0] || opt_ptr == &opts->ab_loop[1]) {
  ------------------
  |  Branch (8717:9): [True: 0, False: 11.3k]
  |  Branch (8717:41): [True: 0, False: 11.3k]
  ------------------
 8718|      0|        update_ab_loop_clip(mpctx);
 8719|       |        // Update if visible
 8720|      0|        set_osd_bar_chapters(mpctx, OSD_BAR_SEEK);
 8721|      0|        mp_wakeup_core(mpctx);
 8722|      0|    }
 8723|       |
 8724|  11.3k|    if (opt_ptr == &opts->vf_settings)
  ------------------
  |  Branch (8724:9): [True: 0, False: 11.3k]
  ------------------
 8725|      0|        set_filters(mpctx, STREAM_VIDEO, opts->vf_settings);
 8726|       |
 8727|  11.3k|    if (opt_ptr == &opts->af_settings)
  ------------------
  |  Branch (8727:9): [True: 0, False: 11.3k]
  ------------------
 8728|      0|        set_filters(mpctx, STREAM_AUDIO, opts->af_settings);
 8729|       |
 8730|  45.5k|    for (int type = 0; type < STREAM_TYPE_COUNT; type++) {
  ------------------
  |  Branch (8730:24): [True: 34.1k, False: 11.3k]
  ------------------
 8731|  79.7k|        for (int order = 0; order < num_ptracks[type]; order++) {
  ------------------
  |  Branch (8731:29): [True: 45.5k, False: 34.1k]
  ------------------
 8732|  45.5k|            if (opt_ptr == &opts->stream_id[order][type])
  ------------------
  |  Branch (8732:17): [True: 0, False: 45.5k]
  ------------------
 8733|      0|                update_track_switch(mpctx, order, type);
 8734|  45.5k|        }
 8735|  34.1k|    }
 8736|       |
 8737|  11.3k|    if (opt_ptr == &opts->vo->fullscreen && !opts->vo->fullscreen)
  ------------------
  |  Branch (8737:9): [True: 0, False: 11.3k]
  |  Branch (8737:45): [True: 0, False: 0]
  ------------------
 8738|      0|        mpctx->mouse_event_ts--; // Show mouse cursor
 8739|       |
 8740|  11.3k|    if (opt_ptr == &opts->vo->taskbar_progress)
  ------------------
  |  Branch (8740:9): [True: 0, False: 11.3k]
  ------------------
 8741|      0|        update_vo_playback_state(mpctx);
 8742|       |
 8743|  11.3k|    if (opt_ptr == &opts->force_vo)
  ------------------
  |  Branch (8743:9): [True: 0, False: 11.3k]
  ------------------
 8744|      0|        handle_force_window(mpctx, false);
 8745|       |
 8746|  11.3k|    if (opt_ptr == &opts->image_display_duration && mpctx->vo_chain
  ------------------
  |  Branch (8746:9): [True: 0, False: 11.3k]
  |  Branch (8746:53): [True: 0, False: 0]
  ------------------
 8747|      0|        && mpctx->vo_chain->is_sparse && !mpctx->ao_chain
  ------------------
  |  Branch (8747:12): [True: 0, False: 0]
  |  Branch (8747:42): [True: 0, False: 0]
  ------------------
 8748|      0|        && mpctx->video_status == STATUS_DRAINING)
  ------------------
  |  Branch (8748:12): [True: 0, False: 0]
  ------------------
 8749|      0|        mpctx->time_frame = opts->image_display_duration / opts->playback_speed;
 8750|  11.3k|}
command.c:is_property_set:
 5050|    955|{
 5051|    955|    switch (action) {
 5052|      0|    case M_PROPERTY_SET:
  ------------------
  |  Branch (5052:5): [True: 0, False: 955]
  ------------------
 5053|      0|    case M_PROPERTY_SWITCH:
  ------------------
  |  Branch (5053:5): [True: 0, False: 955]
  ------------------
 5054|      0|    case M_PROPERTY_SET_STRING:
  ------------------
  |  Branch (5054:5): [True: 0, False: 955]
  ------------------
 5055|      0|    case M_PROPERTY_SET_NODE:
  ------------------
  |  Branch (5055:5): [True: 0, False: 955]
  ------------------
 5056|      0|    case M_PROPERTY_MULTIPLY:
  ------------------
  |  Branch (5056:5): [True: 0, False: 955]
  ------------------
 5057|      0|        return true;
 5058|     43|    case M_PROPERTY_KEY_ACTION: {
  ------------------
  |  Branch (5058:5): [True: 43, False: 912]
  ------------------
 5059|     43|        struct m_property_action_arg *key = val;
 5060|     43|        return is_property_set(key->action, key->arg);
 5061|      0|    }
 5062|    912|    default:
  ------------------
  |  Branch (5062:5): [True: 912, False: 43]
  ------------------
 5063|       |        return false;
 5064|    955|    }
 5065|    955|}
command.c:expand_escaped_string:
 5107|  3.38k|{
 5108|  3.38k|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  3.38k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  3.38k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
 5109|  3.38k|    bstr strb = bstr0(str);
 5110|  3.38k|    bstr dst = {0};
 5111|  3.77k|    while (strb.len) {
  ------------------
  |  Branch (5111:12): [True: 3.00k, False: 770]
  ------------------
 5112|  3.00k|        if (!mp_append_escaped_string(tmp, &dst, &strb)) {
  ------------------
  |  Branch (5112:13): [True: 101, False: 2.90k]
  ------------------
 5113|    101|            talloc_free(tmp);
  ------------------
  |  |   47|    101|#define talloc_free                     ta_free
  ------------------
 5114|    101|            return talloc_strdup(NULL, "(broken escape sequences)");
  ------------------
  |  |   50|    101|#define talloc_strdup                   ta_xstrdup
  ------------------
 5115|    101|        }
 5116|       |        // pass " through literally
 5117|  2.90k|        if (!bstr_eatstart0(&strb, "\""))
  ------------------
  |  Branch (5117:13): [True: 2.51k, False: 390]
  ------------------
 5118|  2.51k|            break;
 5119|    390|        bstr_xappend(tmp, &dst, bstr0("\""));
 5120|    390|    }
 5121|  3.28k|    struct command_ctx *ctx = mpctx->command_ctx;
 5122|  3.28k|    char *r = m_properties_expand_string(&ctx->properties, dst.start, mpctx,
 5123|  3.28k|                                         print_action);
 5124|  3.28k|    talloc_free(tmp);
  ------------------
  |  |   47|  3.28k|#define talloc_free                     ta_free
  ------------------
 5125|  3.28k|    return r;
 5126|  3.38k|}
command.c:skip_n_lines:
  355|    498|{
  356|  2.92k|    while (text && lines > 0) {
  ------------------
  |  Branch (356:12): [True: 2.66k, False: 265]
  |  Branch (356:20): [True: 2.43k, False: 233]
  ------------------
  357|  2.43k|        char *next = strchr(text, '\n');
  358|  2.43k|        text = next ? next + 1 : NULL;
  ------------------
  |  Branch (358:16): [True: 2.16k, False: 265]
  ------------------
  359|  2.43k|        lines--;
  360|  2.43k|    }
  361|    498|    return text;
  362|    498|}
command.c:cache_dump_poll:
 7450|  16.8k|{
 7451|  16.8k|    struct command_ctx *ctx = mpctx->command_ctx;
 7452|  16.8k|    struct mp_cmd_ctx *cmd = ctx->cache_dump_cmd;
 7453|       |
 7454|  16.8k|    if (!cmd)
  ------------------
  |  Branch (7454:9): [True: 16.8k, False: 0]
  ------------------
 7455|  16.8k|        return;
 7456|       |
 7457|       |    // Can't close demuxer without stopping dumping.
 7458|      0|    mp_assert(mpctx->demuxer);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (7458:5): [True: 0, False: 0]
  ------------------
 7459|       |
 7460|      0|    if (mp_cancel_test(cmd->abort->cancel)) {
  ------------------
  |  Branch (7460:9): [True: 0, False: 0]
  ------------------
 7461|       |        // Synchronous abort. In particular, the dump command shall not report
 7462|       |        // completion to the user before the dump target file was closed.
 7463|      0|        demux_cache_dump_set(mpctx->demuxer, 0, 0, NULL);
 7464|      0|        mp_assert(demux_cache_dump_get_status(mpctx->demuxer) <= 0);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (7464:9): [True: 0, False: 0]
  ------------------
 7465|      0|    }
 7466|       |
 7467|      0|    int status = demux_cache_dump_get_status(mpctx->demuxer);
 7468|      0|    if (status <= 0) {
  ------------------
  |  Branch (7468:9): [True: 0, False: 0]
  ------------------
 7469|      0|        if (status < 0) {
  ------------------
  |  Branch (7469:13): [True: 0, False: 0]
  ------------------
 7470|      0|            mp_cmd_msg(cmd, MSGL_ERR, "Cache dumping stopped due to error.");
 7471|      0|            cmd->success = false;
 7472|      0|        } else {
 7473|      0|            mp_cmd_msg(cmd, MSGL_INFO, "Cache dumping successfully ended.");
 7474|      0|            cmd->success = true;
 7475|      0|        }
 7476|       |        ctx->cache_dump_cmd = NULL;
 7477|      0|        mp_cmd_ctx_complete(cmd);
 7478|      0|    }
 7479|      0|}
command.c:cmd_quit:
 6327|  11.3k|{
 6328|  11.3k|    struct mp_cmd_ctx *cmd = p;
 6329|  11.3k|    struct MPContext *mpctx = cmd->mpctx;
 6330|  11.3k|    bool write_watch_later = *(bool *)cmd->priv;
 6331|  11.3k|    if (write_watch_later || mpctx->opts->position_save_on_quit)
  ------------------
  |  Branch (6331:9): [True: 0, False: 11.3k]
  |  Branch (6331:30): [True: 1, False: 11.3k]
  ------------------
 6332|      1|        mp_write_watch_later_conf(mpctx);
 6333|  11.3k|    mpctx->stop_play = PT_QUIT;
 6334|  11.3k|    mpctx->quit_custom_rc = cmd->args[0].v.i;
 6335|       |    mpctx->has_quit_custom_rc = true;
 6336|  11.3k|    mp_wakeup_core(mpctx);
 6337|  11.3k|}
command.c:overlay_uninit:
 5652|  16.4k|{
 5653|  16.4k|    struct command_ctx *cmd = mpctx->command_ctx;
 5654|  16.4k|    if (!mpctx->osd)
  ------------------
  |  Branch (5654:9): [True: 0, False: 16.4k]
  ------------------
 5655|      0|        return;
 5656|  16.4k|    for (int id = 0; id < cmd->num_overlays; id++)
  ------------------
  |  Branch (5656:22): [True: 0, False: 16.4k]
  ------------------
 5657|      0|        replace_overlay(mpctx, id, &(struct overlay){0});
 5658|  16.4k|    osd_set_bitmaps(mpctx->osd, OSDTYPE_EXTERNAL2, NULL);
 5659|  49.2k|    for (int n = 0; n < 2; n++)
  ------------------
  |  Branch (5659:21): [True: 32.8k, False: 16.4k]
  ------------------
 5660|  32.8k|        mp_image_unrefp(&cmd->overlay_osd[n].packed);
 5661|  16.4k|}
command.c:mp_property_pid:
  517|     76|{
  518|       |    // 32 bit on linux/windows - which C99 `int' is not guaranteed to hold
  519|     76|    return m_property_int64_ro(action, arg, mp_getpid());
  ------------------
  |  |   28|     76|#define mp_getpid() getpid()
  ------------------
  520|     76|}
command.c:mp_property_playback_speed:
  464|    339|{
  465|    339|    MPContext *mpctx = ctx;
  466|    339|    if (action == M_PROPERTY_PRINT || action == M_PROPERTY_FIXED_LEN_PRINT) {
  ------------------
  |  Branch (466:9): [True: 69, False: 270]
  |  Branch (466:39): [True: 18, False: 252]
  ------------------
  467|     87|        *(char **)arg = mp_format_double(NULL, mpctx->opts->playback_speed, 2,
  468|     87|                                         false, false, action != M_PROPERTY_FIXED_LEN_PRINT);
  469|     87|        return M_PROPERTY_OK;
  470|     87|    }
  471|    252|    return mp_property_generic_option(mpctx, prop, action, arg);
  472|    339|}
command.c:mp_property_playback_pitch:
  477|    252|{
  478|    252|    MPContext *mpctx = ctx;
  479|    252|    if (action == M_PROPERTY_PRINT || action == M_PROPERTY_FIXED_LEN_PRINT) {
  ------------------
  |  Branch (479:9): [True: 25, False: 227]
  |  Branch (479:39): [True: 32, False: 195]
  ------------------
  480|     57|        *(char **)arg = mp_format_double(NULL, mpctx->opts->playback_pitch, 2,
  481|     57|                                         false, false, action != M_PROPERTY_FIXED_LEN_PRINT);
  482|     57|        return M_PROPERTY_OK;
  483|     57|    }
  484|    195|    return mp_property_generic_option(mpctx, prop, action, arg);
  485|    252|}
command.c:mp_property_display_sync_active:
  510|     34|{
  511|     34|    MPContext *mpctx = ctx;
  512|     34|    return m_property_bool_ro(action, arg, mpctx->display_sync_active);
  513|     34|}
command.c:mp_property_filename:
  534|     19|{
  535|     19|    MPContext *mpctx = ctx;
  536|     19|    if (!mpctx->filename)
  ------------------
  |  Branch (536:9): [True: 19, False: 0]
  ------------------
  537|     19|        return M_PROPERTY_UNAVAILABLE;
  538|      0|    const char *name = mpctx->demuxer ? mpctx->demuxer->server_filename : NULL;
  ------------------
  |  Branch (538:24): [True: 0, False: 0]
  ------------------
  539|      0|    char *filename = talloc_strdup(NULL, name ? name : mpctx->filename);
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (539:42): [True: 0, False: 0]
  ------------------
  540|      0|    char *f = filename;
  541|      0|    if (!name) {
  ------------------
  |  Branch (541:9): [True: 0, False: 0]
  ------------------
  542|      0|        if (mp_is_url(bstr0(filename)))
  ------------------
  |  Branch (542:13): [True: 0, False: 0]
  ------------------
  543|      0|            mp_url_unescape_inplace(filename);
  544|      0|        f = (char *)mp_basename(filename);
  545|      0|        if (!f[0])
  ------------------
  |  Branch (545:13): [True: 0, False: 0]
  ------------------
  546|      0|            f = filename;
  547|      0|    }
  548|      0|    if (action == M_PROPERTY_KEY_ACTION) {
  ------------------
  |  Branch (548:9): [True: 0, False: 0]
  ------------------
  549|      0|        struct m_property_action_arg *ka = arg;
  550|      0|        if (strcmp(ka->key, "no-ext") == 0) {
  ------------------
  |  Branch (550:13): [True: 0, False: 0]
  ------------------
  551|      0|            action = ka->action;
  552|      0|            arg = ka->arg;
  553|      0|            f = bstrto0(filename, mp_strip_ext(bstr0(f)));
  554|      0|        }
  555|      0|    }
  556|      0|    int r = m_property_strdup_ro(action, arg, f);
  557|      0|    talloc_free(filename);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  558|      0|    return r;
  559|     19|}
command.c:mp_property_env:
  563|    208|{
  564|    208|    switch (action) {
  ------------------
  |  Branch (564:13): [True: 121, False: 87]
  ------------------
  565|     50|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (565:5): [True: 50, False: 158]
  ------------------
  566|     50|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE};
  ------------------
  |  |  253|     50|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
  567|     50|        return M_PROPERTY_OK;
  568|     50|    case M_PROPERTY_GET:
  ------------------
  |  Branch (568:5): [True: 50, False: 158]
  ------------------
  569|     50|    case M_PROPERTY_GET_NODE: {
  ------------------
  |  Branch (569:5): [True: 0, False: 208]
  ------------------
  570|     50|        struct mpv_node node;
  571|     50|        node_init(&node, MPV_FORMAT_NODE_MAP, NULL);
  572|  1.75k|        for (char **env = environ; env && *env; env++) {
  ------------------
  |  Branch (572:36): [True: 1.75k, False: 0]
  |  Branch (572:43): [True: 1.70k, False: 50]
  ------------------
  573|  1.70k|            char *sep = strchr(*env, '=');
  574|  1.70k|            if (!sep)
  ------------------
  |  Branch (574:17): [True: 0, False: 1.70k]
  ------------------
  575|      0|                continue;
  576|  1.70k|            bstr key = { .start = *env, .len = sep - *env };
  577|  1.70k|            struct mpv_node *np = node_map_badd(&node, key, MPV_FORMAT_NONE);
  578|  1.70k|            np->format = MPV_FORMAT_STRING;
  579|  1.70k|            np->u.string = talloc_strdup(node.u.list, sep + 1);
  ------------------
  |  |   50|  1.70k|#define talloc_strdup                   ta_xstrdup
  ------------------
  580|  1.70k|        }
  581|     50|        *(struct mpv_node *)arg = node;
  582|     50|        return M_PROPERTY_OK;
  583|     50|    }
  584|     21|    case M_PROPERTY_KEY_ACTION: {
  ------------------
  |  Branch (584:5): [True: 21, False: 187]
  ------------------
  585|     21|        struct m_property_action_arg *ka = arg;
  586|     21|        char *val = getenv(ka->key);
  587|     21|        return m_property_strdup_ro(ka->action, ka->arg, val);
  588|     50|    }
  589|    208|    }
  590|     87|    return M_PROPERTY_NOT_IMPLEMENTED;
  591|    208|}
command.c:mp_property_stream_open_filename:
  595|     18|{
  596|     18|    MPContext *mpctx = ctx;
  597|     18|    if (!mpctx->stream_open_filename || !mpctx->playing)
  ------------------
  |  Branch (597:9): [True: 18, False: 0]
  |  Branch (597:41): [True: 0, False: 0]
  ------------------
  598|     18|        return M_PROPERTY_UNAVAILABLE;
  599|      0|    switch (action) {
  ------------------
  |  Branch (599:13): [True: 0, False: 0]
  ------------------
  600|      0|    case M_PROPERTY_SET: {
  ------------------
  |  Branch (600:5): [True: 0, False: 0]
  ------------------
  601|      0|        if (mpctx->demuxer)
  ------------------
  |  Branch (601:13): [True: 0, False: 0]
  ------------------
  602|      0|            return M_PROPERTY_ERROR;
  603|      0|        mpctx->stream_open_filename =
  604|      0|            talloc_strdup(mpctx->stream_open_filename, *(char **)arg);
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  605|      0|        mp_notify_property(mpctx, prop->name);
  606|      0|        return M_PROPERTY_OK;
  607|      0|    }
  608|      0|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (608:5): [True: 0, False: 0]
  ------------------
  609|      0|    case M_PROPERTY_GET:
  ------------------
  |  Branch (609:5): [True: 0, False: 0]
  ------------------
  610|      0|        return m_property_strdup_ro(action, arg, mpctx->stream_open_filename);
  611|      0|    }
  612|      0|    return M_PROPERTY_NOT_IMPLEMENTED;
  613|      0|}
command.c:mp_property_file_size:
  617|     33|{
  618|     33|    MPContext *mpctx = ctx;
  619|     33|    if (!mpctx->demuxer)
  ------------------
  |  Branch (619:9): [True: 33, False: 0]
  ------------------
  620|     33|        return M_PROPERTY_UNAVAILABLE;
  621|       |
  622|      0|    int64_t size = mpctx->demuxer->filesize;
  623|      0|    if (size < 0)
  ------------------
  |  Branch (623:9): [True: 0, False: 0]
  ------------------
  624|      0|        return M_PROPERTY_UNAVAILABLE;
  625|       |
  626|      0|    if (action == M_PROPERTY_PRINT) {
  ------------------
  |  Branch (626:9): [True: 0, False: 0]
  ------------------
  627|      0|        *(char **)arg = format_file_size(size);
  628|      0|        return M_PROPERTY_OK;
  629|      0|    }
  630|      0|    return m_property_int64_ro(action, arg, size);
  631|      0|}
command.c:mp_property_path:
  525|     18|{
  526|     18|    MPContext *mpctx = ctx;
  527|     18|    if (!mpctx->filename)
  ------------------
  |  Branch (527:9): [True: 18, False: 0]
  ------------------
  528|     18|        return M_PROPERTY_UNAVAILABLE;
  529|      0|    return m_property_strdup_ro(action, arg, mpctx->filename);
  530|     18|}
command.c:mp_property_media_title:
  635|     18|{
  636|     18|    MPContext *mpctx = ctx;
  637|     18|    const char *name = mp_find_non_filename_media_title(mpctx);
  638|     18|    if (name && name[0])
  ------------------
  |  Branch (638:9): [True: 0, False: 18]
  |  Branch (638:17): [True: 0, False: 0]
  ------------------
  639|      0|        return m_property_strdup_ro(action, arg, name);
  640|     18|    return mp_property_filename(ctx, prop, action, arg);
  641|     18|}
command.c:mp_property_stream_path:
  645|     19|{
  646|     19|    MPContext *mpctx = ctx;
  647|     19|    if (!mpctx->demuxer || !mpctx->demuxer->filename)
  ------------------
  |  Branch (647:9): [True: 19, False: 0]
  |  Branch (647:28): [True: 0, False: 0]
  ------------------
  648|     19|        return M_PROPERTY_UNAVAILABLE;
  649|      0|    return m_property_strdup_ro(action, arg, mpctx->demuxer->filename);
  650|     19|}
command.c:mp_property_demuxer:
  655|     18|{
  656|     18|    MPContext *mpctx = ctx;
  657|     18|    struct demuxer *demuxer = mpctx->demuxer;
  658|     18|    if (!demuxer)
  ------------------
  |  Branch (658:9): [True: 18, False: 0]
  ------------------
  659|     18|        return M_PROPERTY_UNAVAILABLE;
  660|      0|    return m_property_strdup_ro(action, arg, demuxer->desc->name);
  661|     18|}
command.c:mp_property_file_format:
  665|     16|{
  666|     16|    MPContext *mpctx = ctx;
  667|     16|    struct demuxer *demuxer = mpctx->demuxer;
  668|     16|    if (!demuxer)
  ------------------
  |  Branch (668:9): [True: 16, False: 0]
  ------------------
  669|     16|        return M_PROPERTY_UNAVAILABLE;
  670|      0|    const char *name = demuxer->filetype ? demuxer->filetype : demuxer->desc->name;
  ------------------
  |  Branch (670:24): [True: 0, False: 0]
  ------------------
  671|      0|    return m_property_strdup_ro(action, arg, name);
  672|     16|}
command.c:mp_property_stream_pos:
  676|     18|{
  677|     18|    MPContext *mpctx = ctx;
  678|     18|    struct demuxer *demuxer = mpctx->demuxer;
  679|     18|    if (!demuxer || demuxer->filepos < 0)
  ------------------
  |  Branch (679:9): [True: 18, False: 0]
  |  Branch (679:21): [True: 0, False: 0]
  ------------------
  680|     18|        return M_PROPERTY_UNAVAILABLE;
  681|      0|    return m_property_int64_ro(action, arg, demuxer->filepos);
  682|     18|}
command.c:mp_property_stream_end:
  687|     19|{
  688|     19|    return mp_property_file_size(ctx, prop, action, arg);
  689|     19|}
command.c:mp_property_duration:
  730|     18|{
  731|     18|    MPContext *mpctx = ctx;
  732|     18|    double len = get_time_length(mpctx);
  733|       |
  734|     18|    if (len < 0)
  ------------------
  |  Branch (734:9): [True: 18, False: 0]
  ------------------
  735|     18|        return M_PROPERTY_UNAVAILABLE;
  736|       |
  737|      0|    return property_time(action, arg, len);
  738|     18|}
command.c:property_time:
  694|     66|{
  695|     66|    if (time == MP_NOPTS_VALUE)
  ------------------
  |  |   39|     66|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (695:9): [True: 18, False: 48]
  ------------------
  696|     18|        return M_PROPERTY_UNAVAILABLE;
  697|       |
  698|     48|    const struct m_option time_type = {.type = CONF_TYPE_TIME};
  ------------------
  |  |  251|     48|#define CONF_TYPE_TIME          (&m_option_type_time)
  ------------------
  699|     48|    switch (action) {
  ------------------
  |  Branch (699:13): [True: 48, False: 0]
  ------------------
  700|      0|    case M_PROPERTY_GET:
  ------------------
  |  Branch (700:5): [True: 0, False: 48]
  ------------------
  701|      0|        *(double *)arg = time;
  702|      0|        return M_PROPERTY_OK;
  703|      0|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (703:5): [True: 0, False: 48]
  ------------------
  704|      0|        *(struct m_option *)arg = time_type;
  705|      0|        return M_PROPERTY_OK;
  706|     48|    case M_PROPERTY_KEY_ACTION: {
  ------------------
  |  Branch (706:5): [True: 48, False: 0]
  ------------------
  707|     48|        struct m_property_action_arg *ka = arg;
  708|       |
  709|     48|        if (strcmp(ka->key, "full") != 0)
  ------------------
  |  Branch (709:13): [True: 45, False: 3]
  ------------------
  710|     45|            return M_PROPERTY_UNKNOWN;
  711|       |
  712|      3|        switch (ka->action) {
  ------------------
  |  Branch (712:17): [True: 2, False: 1]
  ------------------
  713|      0|        case M_PROPERTY_GET:
  ------------------
  |  Branch (713:9): [True: 0, False: 3]
  ------------------
  714|      0|            *(double *)ka->arg = time;
  715|      0|            return M_PROPERTY_OK;
  716|      1|        case M_PROPERTY_PRINT:
  ------------------
  |  Branch (716:9): [True: 1, False: 2]
  ------------------
  717|      1|            *(char **)ka->arg = mp_format_time(time, true);
  718|      1|            return M_PROPERTY_OK;
  719|      1|        case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (719:9): [True: 1, False: 2]
  ------------------
  720|      1|            *(struct m_option *)ka->arg = time_type;
  721|      1|            return M_PROPERTY_OK;
  722|      3|        }
  723|      3|    }
  724|     48|    }
  725|      1|    return M_PROPERTY_NOT_IMPLEMENTED;
  726|     48|}
command.c:mp_property_avsync:
  742|     17|{
  743|     17|    MPContext *mpctx = ctx;
  744|     17|    if (!mpctx->ao_chain || !mpctx->vo_chain)
  ------------------
  |  Branch (744:9): [True: 17, False: 0]
  |  Branch (744:29): [True: 0, False: 0]
  ------------------
  745|     17|        return M_PROPERTY_UNAVAILABLE;
  746|      0|    if (action == M_PROPERTY_PRINT || action == M_PROPERTY_FIXED_LEN_PRINT) {
  ------------------
  |  Branch (746:9): [True: 0, False: 0]
  |  Branch (746:39): [True: 0, False: 0]
  ------------------
  747|      0|        *(char **)arg = mp_format_double(NULL, mpctx->last_av_difference, 5,
  748|      0|                                         true, false, action != M_PROPERTY_FIXED_LEN_PRINT);
  749|      0|        return M_PROPERTY_OK;
  750|      0|    }
  751|      0|    return m_property_double_ro(action, arg, mpctx->last_av_difference);
  752|      0|}
command.c:mp_property_total_avsync_change:
  756|     18|{
  757|     18|    MPContext *mpctx = ctx;
  758|     18|    if (!mpctx->ao_chain || !mpctx->vo_chain)
  ------------------
  |  Branch (758:9): [True: 18, False: 0]
  |  Branch (758:29): [True: 0, False: 0]
  ------------------
  759|     18|        return M_PROPERTY_UNAVAILABLE;
  760|      0|    if (mpctx->total_avsync_change == MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (760:9): [True: 0, False: 0]
  ------------------
  761|      0|        return M_PROPERTY_UNAVAILABLE;
  762|      0|    return m_property_double_ro(action, arg, mpctx->total_avsync_change);
  763|      0|}
command.c:mp_property_mistimed_frame_count:
  780|     18|{
  781|     18|    MPContext *mpctx = ctx;
  782|     18|    if (!mpctx->vo_chain || !mpctx->display_sync_active)
  ------------------
  |  Branch (782:9): [True: 18, False: 0]
  |  Branch (782:29): [True: 0, False: 0]
  ------------------
  783|     18|        return M_PROPERTY_UNAVAILABLE;
  784|       |
  785|      0|    return m_property_int_ro(action, arg, mpctx->mistimed_frames_total);
  786|     18|}
command.c:mp_property_display_resolution:
 2937|     18|{
 2938|     18|    MPContext *mpctx = ctx;
 2939|     18|    struct vo *vo = mpctx->video_out;
 2940|     18|    if (!vo)
  ------------------
  |  Branch (2940:9): [True: 18, False: 0]
  ------------------
 2941|     18|        return M_PROPERTY_UNAVAILABLE;
 2942|      0|    int res[2];
 2943|      0|    if (vo_control(vo, VOCTRL_GET_DISPLAY_RES, &res) <= 0)
  ------------------
  |  Branch (2943:9): [True: 0, False: 0]
  ------------------
 2944|      0|        return M_PROPERTY_UNAVAILABLE;
 2945|      0|    if (strcmp(prop->name, "display-width") == 0) {
  ------------------
  |  Branch (2945:9): [True: 0, False: 0]
  ------------------
 2946|      0|        return m_property_int_ro(action, arg, res[0]);
 2947|      0|    } else {
 2948|      0|        return m_property_int_ro(action, arg, res[1]);
 2949|      0|    }
 2950|      0|}
command.c:mp_property_frame_drop_dec:
  767|     11|{
  768|     11|    MPContext *mpctx = ctx;
  769|     11|    struct mp_decoder_wrapper *dec = mpctx->vo_chain && mpctx->vo_chain->track
  ------------------
  |  Branch (769:38): [True: 0, False: 11]
  |  Branch (769:57): [True: 0, False: 0]
  ------------------
  770|     11|        ? mpctx->vo_chain->track->dec : NULL;
  771|     11|    if (!dec)
  ------------------
  |  Branch (771:9): [True: 11, False: 0]
  ------------------
  772|     11|        return M_PROPERTY_UNAVAILABLE;
  773|       |
  774|      0|    return m_property_int_ro(action, arg,
  775|      0|                             mp_decoder_wrapper_get_frames_dropped(dec));
  776|     11|}
command.c:mp_property_frame_drop_vo:
  812|     10|{
  813|     10|    MPContext *mpctx = ctx;
  814|     10|    if (!mpctx->vo_chain)
  ------------------
  |  Branch (814:9): [True: 10, False: 0]
  ------------------
  815|     10|        return M_PROPERTY_UNAVAILABLE;
  816|       |
  817|      0|    return m_property_int_ro(action, arg, vo_get_drop_count(mpctx->video_out));
  818|     10|}
command.c:mp_property_vo_delayed_frame_count:
  822|     18|{
  823|     18|    MPContext *mpctx = ctx;
  824|     18|    if (!mpctx->vo_chain)
  ------------------
  |  Branch (824:9): [True: 18, False: 0]
  ------------------
  825|     18|        return M_PROPERTY_UNAVAILABLE;
  826|       |
  827|      0|    return m_property_int_ro(action, arg, vo_get_delayed_count(mpctx->video_out));
  828|     18|}
command.c:mp_property_percent_pos:
  850|     18|{
  851|     18|    MPContext *mpctx = ctx;
  852|     18|    if (!mpctx->playback_initialized)
  ------------------
  |  Branch (852:9): [True: 18, False: 0]
  ------------------
  853|     18|        return M_PROPERTY_UNAVAILABLE;
  854|       |
  855|      0|    switch (action) {
  ------------------
  |  Branch (855:13): [True: 0, False: 0]
  ------------------
  856|      0|    case M_PROPERTY_SET: {
  ------------------
  |  Branch (856:5): [True: 0, False: 0]
  ------------------
  857|      0|        double pos = *(double *)arg;
  858|      0|        queue_seek(mpctx, MPSEEK_FACTOR, pos / 100.0, MPSEEK_DEFAULT, 0);
  859|      0|        return M_PROPERTY_OK;
  860|      0|    }
  861|      0|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (861:5): [True: 0, False: 0]
  ------------------
  862|      0|        double pos = get_current_pos_ratio(mpctx, false) * 100.0;
  863|      0|        if (pos < 0)
  ------------------
  |  Branch (863:13): [True: 0, False: 0]
  ------------------
  864|      0|            return M_PROPERTY_UNAVAILABLE;
  865|      0|        *(double *)arg = pos;
  866|      0|        return M_PROPERTY_OK;
  867|      0|    }
  868|      0|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (868:5): [True: 0, False: 0]
  ------------------
  869|      0|        *(struct m_option *)arg = (struct m_option){
  870|      0|            .type = CONF_TYPE_DOUBLE,
  ------------------
  |  |  243|      0|#define CONF_TYPE_DOUBLE        (&m_option_type_double)
  ------------------
  871|      0|            .min = 0,
  872|      0|            .max = 100,
  873|      0|        };
  874|      0|        return M_PROPERTY_OK;
  875|      0|    case M_PROPERTY_PRINT: {
  ------------------
  |  Branch (875:5): [True: 0, False: 0]
  ------------------
  876|      0|        double pos = get_current_pos_ratio(mpctx, false);
  877|      0|        if (pos < 0)
  ------------------
  |  Branch (877:13): [True: 0, False: 0]
  ------------------
  878|      0|            return M_PROPERTY_UNAVAILABLE;
  879|      0|        *(char **)arg = talloc_asprintf(NULL, "%.f", pos * 100);
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  880|      0|        return M_PROPERTY_OK;
  881|      0|    }
  882|      0|    }
  883|      0|    return M_PROPERTY_NOT_IMPLEMENTED;
  884|      0|}
command.c:mp_property_time_pos:
  889|     18|{
  890|     18|    MPContext *mpctx = ctx;
  891|     18|    if (!mpctx->playback_initialized)
  ------------------
  |  Branch (891:9): [True: 18, False: 0]
  ------------------
  892|     18|        return M_PROPERTY_UNAVAILABLE;
  893|       |
  894|      0|    if (action == M_PROPERTY_SET) {
  ------------------
  |  Branch (894:9): [True: 0, False: 0]
  ------------------
  895|      0|        queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, MPSEEK_DEFAULT, 0);
  896|      0|        return M_PROPERTY_OK;
  897|      0|    }
  898|      0|    return property_time(action, arg, get_playback_time(mpctx));
  899|      0|}
command.c:mp_property_remaining:
  928|     18|{
  929|     18|    double remaining;
  930|     18|    if (!time_remaining(ctx, &remaining))
  ------------------
  |  Branch (930:9): [True: 18, False: 0]
  ------------------
  931|     18|        return M_PROPERTY_UNAVAILABLE;
  932|       |
  933|      0|    return property_time(action, arg, remaining);
  934|     18|}
command.c:time_remaining:
  914|     36|{
  915|     36|    double len = get_time_length(mpctx);
  916|     36|    double playback = get_playback_time(mpctx);
  917|       |
  918|     36|    if (playback == MP_NOPTS_VALUE || len <= 0)
  ------------------
  |  |   39|     72|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (918:9): [True: 36, False: 0]
  |  Branch (918:39): [True: 0, False: 0]
  ------------------
  919|     36|        return false;
  920|       |
  921|      0|    *remaining = len - playback;
  922|       |
  923|      0|    return len >= 0;
  924|     36|}
command.c:mp_property_audio_pts:
  904|     18|{
  905|     18|    MPContext *mpctx = ctx;
  906|     18|    if (!mpctx->playback_initialized || mpctx->audio_status < STATUS_PLAYING ||
  ------------------
  |  Branch (906:9): [True: 18, False: 0]
  |  Branch (906:41): [True: 0, False: 0]
  ------------------
  907|      0|        mpctx->audio_status >= STATUS_EOF)
  ------------------
  |  Branch (907:9): [True: 0, False: 0]
  ------------------
  908|     18|        return M_PROPERTY_UNAVAILABLE;
  909|       |
  910|      0|    return property_time(action, arg, playing_audio_pts(mpctx));
  911|     18|}
command.c:mp_property_playtime_remaining:
  938|     18|{
  939|     18|    MPContext *mpctx = ctx;
  940|     18|    double remaining;
  941|     18|    if (!time_remaining(mpctx, &remaining))
  ------------------
  |  Branch (941:9): [True: 18, False: 0]
  ------------------
  942|     18|        return M_PROPERTY_UNAVAILABLE;
  943|       |
  944|      0|    double speed = mpctx->video_speed;
  945|      0|    return property_time(action, arg, remaining / speed);
  946|     18|}
command.c:mp_property_remaining_file_loops:
  950|     66|{
  951|     66|    MPContext *mpctx = ctx;
  952|     66|    return m_property_int_ro(action, arg, mpctx->remaining_file_loops);
  953|     66|}
command.c:mp_property_remaining_ab_loops:
  957|     83|{
  958|     83|    MPContext *mpctx = ctx;
  959|     83|    return m_property_int_ro(action, arg, mpctx->remaining_ab_loops);
  960|     83|}
command.c:mp_property_chapter:
  965|     18|{
  966|     18|    MPContext *mpctx = ctx;
  967|     18|    if (!mpctx->playback_initialized)
  ------------------
  |  Branch (967:9): [True: 18, False: 0]
  ------------------
  968|     18|        return M_PROPERTY_UNAVAILABLE;
  969|       |
  970|      0|    int chapter = get_current_chapter(mpctx);
  971|      0|    int num = get_chapter_count(mpctx);
  972|      0|    if (chapter < -1)
  ------------------
  |  Branch (972:9): [True: 0, False: 0]
  ------------------
  973|      0|        return M_PROPERTY_UNAVAILABLE;
  974|       |
  975|      0|    switch (action) {
  ------------------
  |  Branch (975:13): [True: 0, False: 0]
  ------------------
  976|      0|    case M_PROPERTY_GET:
  ------------------
  |  Branch (976:5): [True: 0, False: 0]
  ------------------
  977|      0|        *(int *) arg = chapter;
  978|      0|        return M_PROPERTY_OK;
  979|      0|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (979:5): [True: 0, False: 0]
  ------------------
  980|      0|        *(struct m_option *)arg = (struct m_option){
  981|      0|            .type = CONF_TYPE_INT,
  ------------------
  |  |  240|      0|#define CONF_TYPE_INT           (&m_option_type_int)
  ------------------
  982|      0|            .min = -1,
  983|      0|            .max = num - 1,
  984|      0|        };
  985|      0|        return M_PROPERTY_OK;
  986|      0|    case M_PROPERTY_PRINT: {
  ------------------
  |  Branch (986:5): [True: 0, False: 0]
  ------------------
  987|      0|        *(char **) arg = chapter_display_name(mpctx, chapter);
  988|      0|        return M_PROPERTY_OK;
  989|      0|    }
  990|      0|    case M_PROPERTY_SWITCH:
  ------------------
  |  Branch (990:5): [True: 0, False: 0]
  ------------------
  991|      0|    case M_PROPERTY_SET: ;
  ------------------
  |  Branch (991:5): [True: 0, False: 0]
  ------------------
  992|      0|        mark_seek(mpctx);
  993|      0|        int step_all;
  994|      0|        if (action == M_PROPERTY_SWITCH) {
  ------------------
  |  Branch (994:13): [True: 0, False: 0]
  ------------------
  995|      0|            struct m_property_switch_arg *sarg = arg;
  996|      0|            step_all = lrint(sarg->inc);
  997|       |            // Check threshold for relative backward seeks
  998|      0|            if (mpctx->opts->chapter_seek_threshold >= 0 && step_all < 0) {
  ------------------
  |  Branch (998:17): [True: 0, False: 0]
  |  Branch (998:61): [True: 0, False: 0]
  ------------------
  999|      0|                double current_chapter_start =
 1000|      0|                    chapter_start_time(mpctx, chapter);
 1001|       |                // If we are far enough into a chapter, seek back to the
 1002|       |                // beginning of current chapter instead of previous one
 1003|      0|                if (current_chapter_start != MP_NOPTS_VALUE &&
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (1003:21): [True: 0, False: 0]
  ------------------
 1004|      0|                    get_current_time(mpctx) - current_chapter_start >
  ------------------
  |  Branch (1004:21): [True: 0, False: 0]
  ------------------
 1005|      0|                    mpctx->opts->chapter_seek_threshold)
 1006|      0|                {
 1007|      0|                    step_all++;
 1008|      0|                }
 1009|      0|            }
 1010|      0|        } else // Absolute set
 1011|      0|            step_all = *(int *)arg - chapter;
 1012|      0|        chapter += step_all;
 1013|      0|        if (chapter < 0) // avoid using -1 if first chapter starts at 0
  ------------------
  |  Branch (1013:13): [True: 0, False: 0]
  ------------------
 1014|      0|            chapter = (chapter_start_time(mpctx, 0) <= 0) ? 0 : -1;
  ------------------
  |  Branch (1014:23): [True: 0, False: 0]
  ------------------
 1015|      0|        if (chapter >= num && step_all > 0) {
  ------------------
  |  Branch (1015:13): [True: 0, False: 0]
  |  Branch (1015:31): [True: 0, False: 0]
  ------------------
 1016|      0|            if (mpctx->opts->keep_open) {
  ------------------
  |  Branch (1016:17): [True: 0, False: 0]
  ------------------
 1017|      0|                seek_to_last_frame(mpctx);
 1018|      0|            } else {
 1019|       |                // semi-broken file; ignore for user convenience
 1020|      0|                if (action == M_PROPERTY_SWITCH && num < 2)
  ------------------
  |  Branch (1020:21): [True: 0, False: 0]
  |  Branch (1020:52): [True: 0, False: 0]
  ------------------
 1021|      0|                    return M_PROPERTY_UNAVAILABLE;
 1022|      0|                if (!mpctx->stop_play)
  ------------------
  |  Branch (1022:21): [True: 0, False: 0]
  ------------------
 1023|      0|                    mpctx->stop_play = PT_NEXT_ENTRY;
 1024|      0|                mp_wakeup_core(mpctx);
 1025|      0|            }
 1026|      0|        } else {
 1027|      0|            double pts = chapter_start_time(mpctx, chapter);
 1028|      0|            if (pts != MP_NOPTS_VALUE) {
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (1028:17): [True: 0, False: 0]
  ------------------
 1029|      0|                queue_seek(mpctx, MPSEEK_CHAPTER, pts, MPSEEK_DEFAULT, 0);
 1030|      0|                mpctx->last_chapter_seek = chapter;
 1031|      0|                mpctx->last_chapter_flag = true;
 1032|      0|            }
 1033|      0|        }
 1034|      0|        return M_PROPERTY_OK;
 1035|      0|    }
 1036|      0|    return M_PROPERTY_NOT_IMPLEMENTED;
 1037|      0|}
command.c:mp_property_edition:
 1181|     18|{
 1182|     18|    MPContext *mpctx = ctx;
 1183|     18|    struct demuxer *demuxer = mpctx->demuxer;
 1184|     18|    char *name = NULL;
 1185|       |
 1186|     18|    if (!demuxer)
  ------------------
  |  Branch (1186:9): [True: 18, False: 0]
  ------------------
 1187|     18|        return mp_property_generic_option(mpctx, prop, action, arg);
 1188|       |
 1189|      0|    int ed = demuxer->edition;
 1190|       |
 1191|      0|    if (demuxer->num_editions <= 1)
  ------------------
  |  Branch (1191:9): [True: 0, False: 0]
  ------------------
 1192|      0|        return M_PROPERTY_UNAVAILABLE;
 1193|       |
 1194|      0|    switch (action) {
 1195|      0|    case M_PROPERTY_GET_CONSTRICTED_TYPE: {
  ------------------
  |  Branch (1195:5): [True: 0, False: 0]
  ------------------
 1196|      0|        *(struct m_option *)arg = (struct m_option){
 1197|      0|            .type = CONF_TYPE_INT,
  ------------------
  |  |  240|      0|#define CONF_TYPE_INT           (&m_option_type_int)
  ------------------
 1198|      0|            .min = 0,
 1199|      0|            .max = demuxer->num_editions - 1,
 1200|      0|        };
 1201|      0|        return M_PROPERTY_OK;
 1202|      0|    }
 1203|      0|    case M_PROPERTY_PRINT: {
  ------------------
  |  Branch (1203:5): [True: 0, False: 0]
  ------------------
 1204|      0|        if (ed < 0)
  ------------------
  |  Branch (1204:13): [True: 0, False: 0]
  ------------------
 1205|      0|            return M_PROPERTY_UNAVAILABLE;
 1206|      0|        name = mp_tags_get_str(demuxer->editions[ed].metadata, "title");
 1207|      0|        if (name) {
  ------------------
  |  Branch (1207:13): [True: 0, False: 0]
  ------------------
 1208|      0|            *(char **) arg = talloc_strdup(NULL, name);
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
 1209|      0|        } else {
 1210|      0|            *(char **) arg = talloc_asprintf(NULL, "%d", ed + 1);
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 1211|      0|        }
 1212|      0|        return M_PROPERTY_OK;
 1213|      0|    }
 1214|      0|    case M_PROPERTY_SET: {
  ------------------
  |  Branch (1214:5): [True: 0, False: 0]
  ------------------
 1215|       |        // For disc demuxers, jump the title directly, we sometimes need to
 1216|       |        // react even if the actual edition "value" doesn't change.
 1217|      0|        if (disc_nav_get_stream(mpctx)) {
  ------------------
  |  Branch (1217:13): [True: 0, False: 0]
  ------------------
 1218|      0|            int new_ed = *(int *)arg;
 1219|      0|            if (new_ed < 0 || new_ed >= demuxer->num_editions)
  ------------------
  |  Branch (1219:17): [True: 0, False: 0]
  |  Branch (1219:31): [True: 0, False: 0]
  ------------------
 1220|      0|                return M_PROPERTY_ERROR;
 1221|      0|            unsigned new_title = new_ed;
 1222|      0|            if (stream_control(demuxer->stream, STREAM_CTRL_SET_CURRENT_TITLE,
  ------------------
  |  Branch (1222:17): [True: 0, False: 0]
  ------------------
 1223|      0|                               &new_title) < 1)
 1224|      0|                return M_PROPERTY_ERROR;
 1225|      0|            mpctx->opts->edition_id = new_ed;
 1226|      0|            m_config_notify_change_opt_ptr(mpctx->mconfig,
 1227|      0|                                           &mpctx->opts->edition_id);
 1228|      0|            mp_notify_property(mpctx, "edition");
 1229|      0|            mp_wakeup_core(mpctx);
 1230|      0|            return M_PROPERTY_OK;
 1231|      0|        }
 1232|      0|        return mp_property_generic_option(mpctx, prop, action, arg);
 1233|      0|    }
 1234|      0|    default:
  ------------------
  |  Branch (1234:5): [True: 0, False: 0]
  ------------------
 1235|      0|        return mp_property_generic_option(mpctx, prop, action, arg);
 1236|      0|    }
 1237|      0|}
command.c:mp_property_current_edition:
 1158|     18|{
 1159|     18|    MPContext *mpctx = ctx;
 1160|     18|    struct demuxer *demuxer = mpctx->demuxer;
 1161|     18|    if (!demuxer || demuxer->num_editions <= 0)
  ------------------
  |  Branch (1161:9): [True: 18, False: 0]
  |  Branch (1161:21): [True: 0, False: 0]
  ------------------
 1162|     18|        return M_PROPERTY_UNAVAILABLE;
 1163|      0|    return m_property_int_ro(action, arg, demuxer->edition);
 1164|     18|}
command.c:mp_property_disc_menu_active:
 1168|     10|{
 1169|     10|    MPContext *mpctx = ctx;
 1170|     10|    struct stream *s = disc_nav_get_stream(mpctx);
 1171|     10|    if (!s)
  ------------------
  |  Branch (1171:9): [True: 10, False: 0]
  ------------------
 1172|     10|        return M_PROPERTY_UNAVAILABLE;
 1173|      0|    struct stream_nav_state st = {0};
 1174|      0|    if (stream_control(s, STREAM_CTRL_GET_NAV_STATE, &st) < 1)
  ------------------
  |  Branch (1174:9): [True: 0, False: 0]
  ------------------
 1175|      0|        return M_PROPERTY_UNAVAILABLE;
 1176|      0|    return m_property_bool_ro(action, arg, st.menu_active);
 1177|      0|}
command.c:mp_property_chapters:
 1311|     18|{
 1312|     18|    MPContext *mpctx = ctx;
 1313|     18|    if (!mpctx->playback_initialized)
  ------------------
  |  Branch (1313:9): [True: 18, False: 0]
  ------------------
 1314|     18|        return M_PROPERTY_UNAVAILABLE;
 1315|      0|    int count = get_chapter_count(mpctx);
 1316|      0|    return m_property_int_ro(action, arg, count);
 1317|     18|}
command.c:mp_property_editions:
 1321|     18|{
 1322|     18|    MPContext *mpctx = ctx;
 1323|     18|    struct demuxer *demuxer = mpctx->demuxer;
 1324|     18|    if (!demuxer)
  ------------------
  |  Branch (1324:9): [True: 18, False: 0]
  ------------------
 1325|     18|        return M_PROPERTY_UNAVAILABLE;
 1326|      0|    if (demuxer->num_editions <= 0)
  ------------------
  |  Branch (1326:9): [True: 0, False: 0]
  ------------------
 1327|      0|        return M_PROPERTY_UNAVAILABLE;
 1328|      0|    return m_property_int_ro(action, arg, demuxer->num_editions);
 1329|      0|}
command.c:mp_property_metadata:
 1429|     18|{
 1430|     18|    MPContext *mpctx = ctx;
 1431|     18|    struct demuxer *demuxer = mpctx->demuxer;
 1432|     18|    if (!demuxer)
  ------------------
  |  Branch (1432:9): [True: 18, False: 0]
  ------------------
 1433|     18|        return M_PROPERTY_UNAVAILABLE;
 1434|       |
 1435|      0|    return tag_property(action, arg, demuxer->metadata);
 1436|     18|}
command.c:mp_property_filtered_metadata:
 1440|     18|{
 1441|     18|    MPContext *mpctx = ctx;
 1442|     18|    if (!mpctx->filtered_tags)
  ------------------
  |  Branch (1442:9): [True: 18, False: 0]
  ------------------
 1443|     18|        return M_PROPERTY_UNAVAILABLE;
 1444|       |
 1445|      0|    return tag_property(action, arg, mpctx->filtered_tags);
 1446|     18|}
command.c:mp_property_chapter_metadata:
 1450|      1|{
 1451|      1|    MPContext *mpctx = ctx;
 1452|      1|    int chapter = get_current_chapter(mpctx);
 1453|      1|    if (chapter < 0)
  ------------------
  |  Branch (1453:9): [True: 1, False: 0]
  ------------------
 1454|      1|        return M_PROPERTY_UNAVAILABLE;
 1455|      0|    return tag_property(action, arg, mpctx->chapters[chapter].metadata);
 1456|      1|}
command.c:mp_property_filter_metadata:
 1460|     46|{
 1461|     46|    MPContext *mpctx = ctx;
 1462|     46|    const char *type = prop->priv;
 1463|       |
 1464|     46|    if (action == M_PROPERTY_KEY_ACTION) {
  ------------------
  |  Branch (1464:9): [True: 28, False: 18]
  ------------------
 1465|     28|        struct m_property_action_arg *ka = arg;
 1466|     28|        bstr key;
 1467|     28|        const char *rem;
 1468|     28|        m_property_split_path(ka->key, &key, &rem);
 1469|     28|        struct mp_tags *metadata = NULL;
 1470|     28|        struct mp_output_chain *chain = NULL;
 1471|     28|        if (strcmp(type, "vf") == 0) {
  ------------------
  |  Branch (1471:13): [True: 18, False: 10]
  ------------------
 1472|     18|            chain = mpctx->vo_chain ? mpctx->vo_chain->filter : NULL;
  ------------------
  |  Branch (1472:21): [True: 0, False: 18]
  ------------------
 1473|     18|        } else if (strcmp(type, "af") == 0) {
  ------------------
  |  Branch (1473:20): [True: 10, False: 0]
  ------------------
 1474|     10|            chain = mpctx->ao_chain ? mpctx->ao_chain->filter : NULL;
  ------------------
  |  Branch (1474:21): [True: 0, False: 10]
  ------------------
 1475|     10|        }
 1476|     28|        if (!chain)
  ------------------
  |  Branch (1476:13): [True: 28, False: 0]
  ------------------
 1477|     28|            return M_PROPERTY_UNAVAILABLE;
 1478|       |
 1479|      0|        int remaining = strlen(rem);
 1480|      0|        if (remaining || ka->action != M_PROPERTY_GET_TYPE) {
  ------------------
  |  Branch (1480:13): [True: 0, False: 0]
  |  Branch (1480:26): [True: 0, False: 0]
  ------------------
 1481|      0|            struct mp_filter_command cmd = {
 1482|      0|                .type = MP_FILTER_COMMAND_GET_META,
 1483|      0|                .res = &metadata,
 1484|      0|            };
 1485|      0|            mp_output_chain_command(chain, mp_tprintf(80, "%.*s", BSTR_P(key)),
  ------------------
  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (195:55): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1486|      0|                                    &cmd);
 1487|       |
 1488|      0|            if (!metadata)
  ------------------
  |  Branch (1488:17): [True: 0, False: 0]
  ------------------
 1489|      0|                return M_PROPERTY_ERROR;
 1490|      0|        }
 1491|       |
 1492|      0|        int res;
 1493|      0|        if (remaining) {
  ------------------
  |  Branch (1493:13): [True: 0, False: 0]
  ------------------
 1494|      0|            struct m_property_action_arg next_ka = *ka;
 1495|      0|            next_ka.key = rem;
 1496|      0|            res = tag_property(M_PROPERTY_KEY_ACTION, &next_ka, metadata);
 1497|      0|        } else {
 1498|      0|            res = tag_property(ka->action, ka->arg, metadata);
 1499|      0|        }
 1500|      0|        talloc_free(metadata);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 1501|      0|        return res;
 1502|      0|    }
 1503|     18|    return M_PROPERTY_NOT_IMPLEMENTED;
 1504|     46|}
command.c:mp_property_core_idle:
 1508|     81|{
 1509|     81|    MPContext *mpctx = ctx;
 1510|     81|    return m_property_bool_ro(action, arg, !mpctx->playback_active);
 1511|     81|}
command.c:mp_property_eof_reached:
 1545|     18|{
 1546|     18|    MPContext *mpctx = ctx;
 1547|     18|    if (!mpctx->playback_initialized)
  ------------------
  |  Branch (1547:9): [True: 18, False: 0]
  ------------------
 1548|     18|        return M_PROPERTY_UNAVAILABLE;
 1549|     18|    bool eof = mpctx->video_status == STATUS_EOF &&
  ------------------
  |  Branch (1549:16): [True: 0, False: 0]
  ------------------
 1550|      0|               mpctx->audio_status == STATUS_EOF;
  ------------------
  |  Branch (1550:16): [True: 0, False: 0]
  ------------------
 1551|      0|    return m_property_bool_ro(action, arg, eof);
 1552|     18|}
command.c:mp_property_seeking:
 1556|     18|{
 1557|     18|    MPContext *mpctx = ctx;
 1558|     18|    if (!mpctx->playback_initialized)
  ------------------
  |  Branch (1558:9): [True: 18, False: 0]
  ------------------
 1559|     18|        return M_PROPERTY_UNAVAILABLE;
 1560|      0|    return m_property_bool_ro(action, arg, !mpctx->restart_complete);
 1561|     18|}
command.c:mp_property_playback_abort:
 1565|     34|{
 1566|     34|    MPContext *mpctx = ctx;
 1567|     34|    return m_property_bool_ro(action, arg, !mpctx->playing || mpctx->stop_play);
  ------------------
  |  Branch (1567:44): [True: 34, False: 0]
  |  Branch (1567:63): [True: 0, False: 0]
  ------------------
 1568|     34|}
command.c:mp_property_cache_speed:
 1572|     18|{
 1573|     18|    MPContext *mpctx = ctx;
 1574|     18|    if (!mpctx->demuxer)
  ------------------
  |  Branch (1574:9): [True: 18, False: 0]
  ------------------
 1575|     18|        return M_PROPERTY_UNAVAILABLE;
 1576|       |
 1577|      0|    struct demux_reader_state s;
 1578|      0|    demux_get_reader_state(mpctx->demuxer, &s);
 1579|       |
 1580|      0|    uint64_t val = s.bytes_per_second;
 1581|       |
 1582|      0|    if (action == M_PROPERTY_PRINT) {
  ------------------
  |  Branch (1582:9): [True: 0, False: 0]
  ------------------
 1583|      0|        *(char **)arg = talloc_strdup_append(format_file_size(val), "/s");
  ------------------
  |  |   57|      0|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 1584|      0|        return M_PROPERTY_OK;
 1585|      0|    }
 1586|      0|    return m_property_int64_ro(action, arg, val);
 1587|      0|}
command.c:mp_property_demuxer_cache_time:
 1607|     19|{
 1608|     19|    MPContext *mpctx = ctx;
 1609|     19|    if (!mpctx->demuxer)
  ------------------
  |  Branch (1609:9): [True: 19, False: 0]
  ------------------
 1610|     19|        return M_PROPERTY_UNAVAILABLE;
 1611|       |
 1612|      0|    struct demux_reader_state s;
 1613|      0|    demux_get_reader_state(mpctx->demuxer, &s);
 1614|       |
 1615|      0|    if (s.ts_info.end == MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (1615:9): [True: 0, False: 0]
  ------------------
 1616|      0|        return M_PROPERTY_UNAVAILABLE;
 1617|       |
 1618|      0|    return m_property_double_ro(action, arg, s.ts_info.end);
 1619|      0|}
command.c:mp_property_demuxer_cache_idle:
 1623|     18|{
 1624|     18|    MPContext *mpctx = ctx;
 1625|     18|    if (!mpctx->demuxer)
  ------------------
  |  Branch (1625:9): [True: 18, False: 0]
  ------------------
 1626|     18|        return M_PROPERTY_UNAVAILABLE;
 1627|       |
 1628|      0|    struct demux_reader_state s;
 1629|      0|    demux_get_reader_state(mpctx->demuxer, &s);
 1630|       |
 1631|      0|    return m_property_bool_ro(action, arg, s.idle);
 1632|     18|}
command.c:mp_property_demuxer_start_time:
 1715|     10|{
 1716|     10|    MPContext *mpctx = ctx;
 1717|     10|    if (!mpctx->demuxer)
  ------------------
  |  Branch (1717:9): [True: 10, False: 0]
  ------------------
 1718|     10|        return M_PROPERTY_UNAVAILABLE;
 1719|       |
 1720|      0|    return m_property_double_ro(action, arg, mpctx->demuxer->start_time);
 1721|     10|}
command.c:mp_property_demuxer_cache_state:
 1636|     18|{
 1637|     18|    MPContext *mpctx = ctx;
 1638|     18|    if (!mpctx->demuxer)
  ------------------
  |  Branch (1638:9): [True: 18, False: 0]
  ------------------
 1639|     18|        return M_PROPERTY_UNAVAILABLE;
 1640|       |
 1641|      0|    if (action == M_PROPERTY_GET_TYPE) {
  ------------------
  |  Branch (1641:9): [True: 0, False: 0]
  ------------------
 1642|      0|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE};
  ------------------
  |  |  253|      0|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
 1643|      0|        return M_PROPERTY_OK;
 1644|      0|    }
 1645|      0|    if (action != M_PROPERTY_GET)
  ------------------
  |  Branch (1645:9): [True: 0, False: 0]
  ------------------
 1646|      0|        return M_PROPERTY_NOT_IMPLEMENTED;
 1647|       |
 1648|      0|    struct demux_reader_state s;
 1649|      0|    demux_get_reader_state(mpctx->demuxer, &s);
 1650|       |
 1651|      0|    struct mpv_node *r = (struct mpv_node *)arg;
 1652|      0|    node_init(r, MPV_FORMAT_NODE_MAP, NULL);
 1653|       |
 1654|      0|    if (s.ts_info.end != MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (1654:9): [True: 0, False: 0]
  ------------------
 1655|      0|        node_map_add_double(r, "cache-end", s.ts_info.end);
 1656|       |
 1657|      0|    if (s.ts_info.reader != MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (1657:9): [True: 0, False: 0]
  ------------------
 1658|      0|        node_map_add_double(r, "reader-pts", s.ts_info.reader);
 1659|       |
 1660|      0|    if (s.ts_info.duration >= 0)
  ------------------
  |  Branch (1660:9): [True: 0, False: 0]
  ------------------
 1661|      0|        node_map_add_double(r, "cache-duration", s.ts_info.duration);
 1662|       |
 1663|      0|    node_map_add_flag(r, "eof", s.eof);
 1664|      0|    node_map_add_flag(r, "underrun", s.underrun);
 1665|      0|    node_map_add_flag(r, "idle", s.idle);
 1666|      0|    node_map_add_int64(r, "total-bytes", s.total_bytes);
 1667|      0|    node_map_add_int64(r, "fw-bytes", s.fw_bytes);
 1668|      0|    if (s.file_cache_bytes >= 0)
  ------------------
  |  Branch (1668:9): [True: 0, False: 0]
  ------------------
 1669|      0|        node_map_add_int64(r, "file-cache-bytes", s.file_cache_bytes);
 1670|      0|    if (s.bytes_per_second > 0)
  ------------------
  |  Branch (1670:9): [True: 0, False: 0]
  ------------------
 1671|      0|        node_map_add_int64(r, "raw-input-rate", s.bytes_per_second);
 1672|      0|    if (s.seeking != MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (1672:9): [True: 0, False: 0]
  ------------------
 1673|      0|        node_map_add_double(r, "debug-seeking", s.seeking);
 1674|      0|    node_map_add_int64(r, "debug-low-level-seeks", s.low_level_seeks);
 1675|      0|    node_map_add_int64(r, "debug-byte-level-seeks", s.byte_level_seeks);
 1676|      0|    if (s.ts_last != MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (1676:9): [True: 0, False: 0]
  ------------------
 1677|      0|        node_map_add_double(r, "debug-ts-last", s.ts_last);
 1678|       |
 1679|      0|    struct mpv_node *stream_types =
 1680|      0|        node_map_add(r, "ts-per-stream", MPV_FORMAT_NODE_ARRAY);
 1681|      0|    for (int n = 0; n < STREAM_TYPE_COUNT; n++) {
  ------------------
  |  Branch (1681:21): [True: 0, False: 0]
  ------------------
 1682|      0|        struct demux_ctrl_ts_info ts = s.ts_per_stream[n];
 1683|      0|        if (ts.duration == -1)
  ------------------
  |  Branch (1683:13): [True: 0, False: 0]
  ------------------
 1684|      0|            continue;
 1685|       |
 1686|      0|        struct mpv_node *st = node_array_add(stream_types, MPV_FORMAT_NODE_MAP);
 1687|      0|        node_map_add_string(st, "type",
 1688|      0|            n == STREAM_VIDEO ? "video" :
  ------------------
  |  Branch (1688:13): [True: 0, False: 0]
  ------------------
 1689|      0|            n == STREAM_AUDIO ? "audio" :
  ------------------
  |  Branch (1689:13): [True: 0, False: 0]
  ------------------
 1690|      0|            n == STREAM_SUB ? "subtitle" : "unknown");
  ------------------
  |  Branch (1690:13): [True: 0, False: 0]
  ------------------
 1691|      0|        node_map_add_double(st, "cache-duration", ts.duration);
 1692|      0|        if (ts.reader != MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (1692:13): [True: 0, False: 0]
  ------------------
 1693|      0|            node_map_add_double(st, "reader-pts", ts.reader);
 1694|      0|        if (ts.end != MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (1694:13): [True: 0, False: 0]
  ------------------
 1695|      0|            node_map_add_double(st, "cache-end", ts.end);
 1696|      0|    }
 1697|       |
 1698|      0|    node_map_add_flag(r, "bof-cached", s.bof_cached);
 1699|      0|    node_map_add_flag(r, "eof-cached", s.eof_cached);
 1700|       |
 1701|      0|    struct mpv_node *ranges =
 1702|      0|        node_map_add(r, "seekable-ranges", MPV_FORMAT_NODE_ARRAY);
 1703|      0|    for (int n = s.num_seek_ranges - 1; n >= 0; n--) {
  ------------------
  |  Branch (1703:41): [True: 0, False: 0]
  ------------------
 1704|      0|        struct demux_seek_range *range = &s.seek_ranges[n];
 1705|      0|        struct mpv_node *sub = node_array_add(ranges, MPV_FORMAT_NODE_MAP);
 1706|      0|        node_map_add_double(sub, "start", range->start);
 1707|      0|        node_map_add_double(sub, "end", range->end);
 1708|      0|    }
 1709|       |
 1710|      0|    return M_PROPERTY_OK;
 1711|      0|}
command.c:mp_property_paused_for_cache:
 1725|     18|{
 1726|     18|    MPContext *mpctx = ctx;
 1727|     18|    if (!mpctx->playback_initialized)
  ------------------
  |  Branch (1727:9): [True: 18, False: 0]
  ------------------
 1728|     18|        return M_PROPERTY_UNAVAILABLE;
 1729|      0|    return m_property_bool_ro(action, arg, mpctx->paused_for_cache);
 1730|     18|}
command.c:mp_property_demuxer_is_network:
 1744|     18|{
 1745|     18|    MPContext *mpctx = ctx;
 1746|     18|    if (!mpctx->demuxer)
  ------------------
  |  Branch (1746:9): [True: 18, False: 0]
  ------------------
 1747|     18|        return M_PROPERTY_UNAVAILABLE;
 1748|       |
 1749|      0|    return m_property_bool_ro(action, arg, mpctx->demuxer->is_network);
 1750|     18|}
command.c:mp_property_clock:
 1755|     76|{
 1756|     76|    char outstr[6];
 1757|     76|    time_t t = time(NULL);
 1758|     76|    struct tm *tmp = localtime(&t);
 1759|       |
 1760|     76|    if ((tmp != NULL) && (strftime(outstr, sizeof(outstr), "%H:%M", tmp) == 5))
  ------------------
  |  Branch (1760:9): [True: 76, False: 0]
  |  Branch (1760:26): [True: 76, False: 0]
  ------------------
 1761|     76|        return m_property_strdup_ro(action, arg, outstr);
 1762|      0|    return M_PROPERTY_UNAVAILABLE;
 1763|     76|}
command.c:mp_property_seekable:
 1767|     18|{
 1768|     18|    MPContext *mpctx = ctx;
 1769|     18|    if (!mpctx->demuxer)
  ------------------
  |  Branch (1769:9): [True: 18, False: 0]
  ------------------
 1770|     18|        return M_PROPERTY_UNAVAILABLE;
 1771|      0|    return m_property_bool_ro(action, arg, mpctx->demuxer->seekable);
 1772|     18|}
command.c:mp_property_idle:
 1527|     66|{
 1528|     66|    MPContext *mpctx = ctx;
 1529|     66|    return m_property_bool_ro(action, arg, mpctx->stop_play == PT_STOP);
 1530|     66|}
command.c:mp_property_window_id:
 1534|     18|{
 1535|     18|    MPContext *mpctx = ctx;
 1536|     18|    struct vo *vo = mpctx->video_out;
 1537|     18|    int64_t wid;
 1538|     18|    if (!vo || vo_control(vo, VOCTRL_GET_WINDOW_ID, &wid) <= 0)
  ------------------
  |  Branch (1538:9): [True: 18, False: 0]
  |  Branch (1538:16): [True: 0, False: 0]
  ------------------
 1539|     18|        return M_PROPERTY_UNAVAILABLE;
 1540|      0|    return m_property_int64_ro(action, arg, wid);
 1541|     18|}
command.c:mp_property_vo_display_swapchain:
 2681|     18|{
 2682|     18|    MPContext *mpctx = ctx;
 2683|     18|    struct vo *vo = mpctx->video_out;
 2684|     18|    if (!vo)
  ------------------
  |  Branch (2684:9): [True: 18, False: 0]
  ------------------
 2685|     18|        return M_PROPERTY_UNAVAILABLE;
 2686|       |
 2687|      0|    void *swapchain_ptr = vo_get_display_swapchain(vo);
 2688|      0|    if (swapchain_ptr == NULL)
  ------------------
  |  Branch (2688:9): [True: 0, False: 0]
  ------------------
 2689|      0|        return M_PROPERTY_UNAVAILABLE;
 2690|       |
 2691|      0|    int64_t swapchain = (intptr_t)swapchain_ptr;
 2692|       |
 2693|      0|    return m_property_int64_ro(action, arg, swapchain);
 2694|      0|}
command.c:mp_property_player_operation_mode:
 3247|     28|{
 3248|     28|    MPContext *mpctx = ctx;
 3249|     28|    const struct m_opt_choice_alternatives mode_names[] = {{"cplayer", 0}, {"pseudo-gui", 1}};
 3250|     28|    return m_property_strdup_ro(action, arg, m_opt_choice_str(mode_names, mpctx->opts->operation_mode));
 3251|     28|}
command.c:mp_property_list_chapters:
 1119|    112|{
 1120|    112|    MPContext *mpctx = ctx;
 1121|    112|    int count = get_chapter_count(mpctx);
 1122|    112|    switch (action) {
  ------------------
  |  Branch (1122:13): [True: 36, False: 76]
  ------------------
 1123|     36|    case M_PROPERTY_PRINT:
  ------------------
  |  Branch (1123:5): [True: 36, False: 76]
  ------------------
 1124|     36|    case M_PROPERTY_PRINT_UNCUT: {
  ------------------
  |  Branch (1124:5): [True: 0, False: 112]
  ------------------
 1125|     36|        int cur = mpctx->playback_initialized ? get_current_chapter(mpctx) : -1;
  ------------------
  |  Branch (1125:19): [True: 0, False: 36]
  ------------------
 1126|     36|        char *res = NULL;
 1127|     36|        int n;
 1128|       |
 1129|     36|        if (count < 1) {
  ------------------
  |  Branch (1129:13): [True: 36, False: 0]
  ------------------
 1130|     36|            res = talloc_asprintf_append(res, "No chapters.");
  ------------------
  |  |   63|     36|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 1131|     36|        }
 1132|       |
 1133|     36|        for (n = 0; n < count; n++) {
  ------------------
  |  Branch (1133:21): [True: 0, False: 36]
  ------------------
 1134|      0|            if (n == cur)
  ------------------
  |  Branch (1134:17): [True: 0, False: 0]
  ------------------
 1135|      0|                res = append_selected_style(mpctx, res);
 1136|      0|            char *name = chapter_name(mpctx, n);
 1137|      0|            double t = chapter_start_time(mpctx, n);
 1138|      0|            char* time = mp_format_time(t, false);
 1139|      0|            res = talloc_asprintf_append(res, "%s  %s%s\n", time, name,
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 1140|      0|                                         n == cur ? get_style_reset(mpctx) : "");
  ------------------
  |  Branch (1140:42): [True: 0, False: 0]
  ------------------
 1141|      0|            talloc_free(time);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 1142|      0|        }
 1143|       |
 1144|     36|        *(char **)arg = count ? cut_osd_list(mpctx, action, "Chapters", res, cur)
  ------------------
  |  Branch (1144:25): [True: 0, False: 36]
  ------------------
 1145|     36|                              : res;
 1146|     36|        return M_PROPERTY_OK;
 1147|     36|    }
 1148|      0|    case M_PROPERTY_SET: {
  ------------------
  |  Branch (1148:5): [True: 0, False: 112]
  ------------------
 1149|      0|        struct mpv_node *given_chapters = arg;
 1150|      0|        return parse_node_chapters(mpctx, given_chapters);
 1151|     36|    }
 1152|    112|    }
 1153|     76|    return m_property_read_list(action, arg, count, get_chapter_entry, mpctx);
 1154|    112|}
command.c:cut_osd_list:
  388|    184|{
  389|    184|    int count = count_lines(text);
  390|    184|    if (!count)
  ------------------
  |  Branch (390:9): [True: 18, False: 166]
  ------------------
  391|     18|        return text;
  392|       |
  393|    166|    int max_lines;
  394|    166|    if (action == M_PROPERTY_PRINT_UNCUT) {
  ------------------
  |  Branch (394:9): [True: 0, False: 166]
  ------------------
  395|      0|        max_lines = count + 1;
  396|    166|    } else if (mpctx->video_out && mpctx->opts->video_osd) {
  ------------------
  |  Branch (396:16): [True: 0, False: 166]
  |  Branch (396:36): [True: 0, False: 0]
  ------------------
  397|      0|        int screen_h, font_h;
  398|      0|        osd_get_text_size(mpctx->osd, &screen_h, &font_h);
  399|      0|        max_lines = screen_h / MPMAX(font_h, 1);
  ------------------
  |  |   44|      0|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  400|    166|    } else {
  401|    166|        int w = -1;
  402|    166|        max_lines = 24;
  403|    166|        terminal_get_size(&w, &max_lines);
  404|       |        // Its lists are printed uncut, so this does not end up here again.
  405|    166|        char *msg = mp_expand_term_status_msg(mpctx);
  406|    166|        max_lines -= msg[0] ? count_lines(msg) : 1;
  ------------------
  |  Branch (406:22): [True: 0, False: 166]
  ------------------
  407|    166|        talloc_free(msg);
  ------------------
  |  |   47|    166|#define talloc_free                     ta_free
  ------------------
  408|    166|    }
  409|       |    // Subtract 1 for the header.
  410|    166|    max_lines--;
  411|       |
  412|    166|    char *new = talloc_asprintf(NULL, "%s [%d/%d]:\n", header, pos + 1, count);
  ------------------
  |  |   52|    166|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|    166|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
  413|    166|    if (max_lines > 0) {
  ------------------
  |  Branch (413:9): [True: 166, False: 0]
  ------------------
  414|    166|        int start = MPMIN(MPMAX(pos - max_lines / 2, 0), count - max_lines);
  ------------------
  |  |   45|    332|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 99, False: 67]
  |  |  |  Branch (45:23): [True: 0, False: 166]
  |  |  |  Branch (45:41): [True: 0, False: 67]
  |  |  ------------------
  ------------------
  415|    166|        char *head = skip_n_lines(text, start);
  416|    166|        char *tail = skip_n_lines(head, max_lines);
  417|    166|        new = talloc_asprintf_append_buffer(new, "%.*s",
  ------------------
  |  |   64|    166|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  ------------------
  418|    166|                                (int)(tail ? tail - head : strlen(head)), head);
  ------------------
  |  Branch (418:39): [True: 67, False: 99]
  ------------------
  419|    166|    }
  420|       |    // Strip the final newline to not print it in the terminal.
  421|    166|    new[strlen(new) - 1] = '\0';
  422|       |
  423|    166|    talloc_free(text);
  ------------------
  |  |   47|    166|#define talloc_free                     ta_free
  ------------------
  424|    166|    return new;
  425|    184|}
command.c:count_lines:
  365|    184|{
  366|    184|    if (!text[0])
  ------------------
  |  Branch (366:9): [True: 18, False: 166]
  ------------------
  367|     18|        return 0;
  368|       |
  369|    166|    int count = 0;
  370|  3.17k|    while (text) {
  ------------------
  |  Branch (370:12): [True: 3.17k, False: 0]
  ------------------
  371|  3.17k|        count++;
  372|  3.17k|        char *next = strchr(text, '\n');
  373|  3.17k|        if (!next || (next[0] == '\n' && !next[1]))
  ------------------
  |  Branch (373:13): [True: 0, False: 3.17k]
  |  Branch (373:23): [True: 3.17k, False: 0]
  |  Branch (373:42): [True: 166, False: 3.01k]
  ------------------
  374|    166|            break;
  375|  3.01k|        text = next + 1;
  376|  3.01k|    }
  377|    166|    return count;
  378|    184|}
command.c:mp_property_list_tracks:
 2309|    638|{
 2310|    638|    MPContext *mpctx = ctx;
 2311|    638|    if (action == M_PROPERTY_PRINT) {
  ------------------
  |  Branch (2311:9): [True: 35, False: 603]
  ------------------
 2312|     35|        char *res = talloc_strdup(NULL, "");
  ------------------
  |  |   50|     35|#define talloc_strdup                   ta_xstrdup
  ------------------
 2313|       |
 2314|     35|        int spacing = 0;
 2315|    140|        for (int type = 0; type < STREAM_TYPE_COUNT; type++) {
  ------------------
  |  Branch (2315:28): [True: 105, False: 35]
  ------------------
 2316|    105|            for (int n = 0; n < mpctx->num_tracks; n++) {
  ------------------
  |  Branch (2316:29): [True: 0, False: 105]
  ------------------
 2317|      0|                struct track *track = mpctx->tracks[n];
 2318|      0|                if (track->type != type)
  ------------------
  |  Branch (2318:21): [True: 0, False: 0]
  ------------------
 2319|      0|                    continue;
 2320|      0|                if (!track_is_visible(mpctx, track))
  ------------------
  |  Branch (2320:21): [True: 0, False: 0]
  ------------------
 2321|      0|                    continue;
 2322|      0|                res = talloc_asprintf_append(res, "%s%s: ",
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 2323|      0|                    spacing == 2 ? "\n\n" : spacing == 1 ? "\n" : "",
  ------------------
  |  Branch (2323:21): [True: 0, False: 0]
  |  Branch (2323:45): [True: 0, False: 0]
  ------------------
 2324|      0|                    track_type_name(track));
 2325|      0|                res = append_track_info(res, track);
 2326|      0|                spacing = 1;
 2327|      0|            }
 2328|    105|            if (spacing)
  ------------------
  |  Branch (2328:17): [True: 0, False: 105]
  ------------------
 2329|      0|                spacing = 2;
 2330|    105|        }
 2331|       |
 2332|     35|        struct demuxer *demuxer = mpctx->demuxer;
 2333|     35|        if (demuxer && demuxer->num_editions > 1) {
  ------------------
  |  Branch (2333:13): [True: 0, False: 35]
  |  Branch (2333:24): [True: 0, False: 0]
  ------------------
 2334|      0|            res = talloc_asprintf_append(res, "%sEdition: %d of %d",
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 2335|      0|                                         spacing == 2 ? "\n\n" : "",
  ------------------
  |  Branch (2335:42): [True: 0, False: 0]
  ------------------
 2336|      0|                                         demuxer->edition + 1,
 2337|      0|                                         demuxer->num_editions);
 2338|      0|        }
 2339|       |
 2340|     35|        *(char **)arg = res;
 2341|     35|        return M_PROPERTY_OK;
 2342|     35|    }
 2343|       |
 2344|    603|    if (action == M_PROPERTY_KEY_ACTION) {
  ------------------
  |  Branch (2344:9): [True: 470, False: 133]
  ------------------
 2345|    470|        struct m_property_action_arg *ka = arg;
 2346|       |
 2347|    470|        int type = -1;
 2348|    470|        if (!strcmp(ka->key, "video")) {
  ------------------
  |  Branch (2348:13): [True: 108, False: 362]
  ------------------
 2349|    108|            type = STREAM_VIDEO;
 2350|    362|        } else if (!strcmp(ka->key, "audio")) {
  ------------------
  |  Branch (2350:20): [True: 143, False: 219]
  ------------------
 2351|    143|            type = STREAM_AUDIO;
 2352|    219|        } else if (!strcmp(ka->key, "sub")) {
  ------------------
  |  Branch (2352:20): [True: 117, False: 102]
  ------------------
 2353|    117|            type = STREAM_SUB;
 2354|    117|        }
 2355|       |
 2356|    470|        if (type != -1) {
  ------------------
  |  Branch (2356:13): [True: 368, False: 102]
  ------------------
 2357|    368|            char *res;
 2358|       |
 2359|    368|            switch (ka->action) {
 2360|    111|                case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (2360:17): [True: 111, False: 257]
  ------------------
 2361|    111|                    *(struct m_option *)ka->arg = (struct m_option){.type = CONF_TYPE_STRING};
  ------------------
  |  |  244|    111|#define CONF_TYPE_STRING        (&m_option_type_string)
  ------------------
 2362|    111|                    return M_PROPERTY_OK;
 2363|     75|                case M_PROPERTY_PRINT:
  ------------------
  |  Branch (2363:17): [True: 75, False: 293]
  ------------------
 2364|     75|                    res = talloc_asprintf(NULL, "Available %s tracks:",
  ------------------
  |  |   52|     75|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|    150|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (127:62): [True: 39, False: 36]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2365|     75|                              type == STREAM_SUB ? "subtitle" : stream_type_name(type));
 2366|       |
 2367|     75|                    for (int n = 0; n < mpctx->num_tracks; n++) {
  ------------------
  |  Branch (2367:37): [True: 0, False: 75]
  ------------------
 2368|      0|                        struct track *track = mpctx->tracks[n];
 2369|      0|                        if (track->type == type && track_is_visible(mpctx, track)) {
  ------------------
  |  Branch (2369:29): [True: 0, False: 0]
  |  Branch (2369:52): [True: 0, False: 0]
  ------------------
 2370|      0|                            res = talloc_strdup_append(res, "\n");
  ------------------
  |  |   57|      0|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 2371|      0|                            res = append_track_info(res, track);
 2372|      0|                        }
 2373|      0|                    }
 2374|       |
 2375|     75|                    *(char **)ka->arg = res;
 2376|     75|                    return M_PROPERTY_OK;
 2377|    182|                default:
  ------------------
  |  Branch (2377:17): [True: 182, False: 186]
  ------------------
 2378|    182|                    return M_PROPERTY_NOT_IMPLEMENTED;
 2379|    368|            }
 2380|    368|        }
 2381|    470|    }
 2382|       |
 2383|    235|    int *map = talloc_array(NULL, int, mpctx->num_tracks);
  ------------------
  |  |   29|    235|#define talloc_array                    ta_xnew_array
  |  |  ------------------
  |  |  |  |  135|    235|#define ta_xnew_array(...)              ta_oom_g(ta_new_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|    235|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2384|    235|    int count = 0;
 2385|    235|    for (int n = 0; n < mpctx->num_tracks; n++) {
  ------------------
  |  Branch (2385:21): [True: 0, False: 235]
  ------------------
 2386|      0|        if (track_is_visible(mpctx, mpctx->tracks[n]))
  ------------------
  |  Branch (2386:13): [True: 0, False: 0]
  ------------------
 2387|      0|            map[count++] = n;
 2388|      0|    }
 2389|    235|    struct filtered_track_ctx ft = { .mpctx = mpctx, .map = map };
 2390|    235|    int r = m_property_read_list(action, arg, count, get_filtered_track_entry, &ft);
 2391|    235|    talloc_free(map);
  ------------------
  |  |   47|    235|#define talloc_free                     ta_free
  ------------------
 2392|    235|    return r;
 2393|    603|}
command.c:mp_property_current_tracks:
 2397|    194|{
 2398|    194|    MPContext *mpctx = ctx;
 2399|       |
 2400|    194|    if (action != M_PROPERTY_KEY_ACTION)
  ------------------
  |  Branch (2400:9): [True: 18, False: 176]
  ------------------
 2401|     18|        return M_PROPERTY_UNAVAILABLE;
 2402|       |
 2403|    176|    int type = -1;
 2404|    176|    int order = 0;
 2405|       |
 2406|    176|    struct m_property_action_arg *ka = arg;
 2407|    176|    bstr key;
 2408|    176|    const char *rem;
 2409|    176|    m_property_split_path(ka->key, &key, &rem);
 2410|       |
 2411|    176|    if (bstr_equals0(key, "video")) {
  ------------------
  |  Branch (2411:9): [True: 18, False: 158]
  ------------------
 2412|     18|        type = STREAM_VIDEO;
 2413|    158|    } else if (bstr_equals0(key, "audio")) {
  ------------------
  |  Branch (2413:16): [True: 29, False: 129]
  ------------------
 2414|     29|        type = STREAM_AUDIO;
 2415|    129|    } else if (bstr_equals0(key, "sub")) {
  ------------------
  |  Branch (2415:16): [True: 19, False: 110]
  ------------------
 2416|     19|        type = STREAM_SUB;
 2417|    110|    } else if (bstr_equals0(key, "sub2")) {
  ------------------
  |  Branch (2417:16): [True: 19, False: 91]
  ------------------
 2418|     19|        type = STREAM_SUB;
 2419|     19|        order = 1;
 2420|     19|    }
 2421|       |
 2422|    176|    if (type < 0)
  ------------------
  |  Branch (2422:9): [True: 91, False: 85]
  ------------------
 2423|     91|        return M_PROPERTY_UNKNOWN;
 2424|       |
 2425|     85|    struct track *t = mpctx->current_track[order][type];
 2426|       |
 2427|     85|    if (!t && mpctx->lavfi) {
  ------------------
  |  Branch (2427:9): [True: 85, False: 0]
  |  Branch (2427:15): [True: 0, False: 85]
  ------------------
 2428|      0|        for (int n = 0; n < mpctx->num_tracks; n++) {
  ------------------
  |  Branch (2428:25): [True: 0, False: 0]
  ------------------
 2429|      0|            if (mpctx->tracks[n]->type == type && mpctx->tracks[n]->selected) {
  ------------------
  |  Branch (2429:17): [True: 0, False: 0]
  |  Branch (2429:51): [True: 0, False: 0]
  ------------------
 2430|      0|                t = mpctx->tracks[n];
 2431|      0|                break;
 2432|      0|            }
 2433|      0|        }
 2434|      0|    }
 2435|       |
 2436|     85|    if (!t)
  ------------------
  |  Branch (2436:9): [True: 85, False: 0]
  ------------------
 2437|     85|        return M_PROPERTY_UNAVAILABLE;
 2438|       |
 2439|      0|    int index = -1;
 2440|      0|    int filtered_index = 0;
 2441|      0|    for (int n = 0; n < mpctx->num_tracks; n++) {
  ------------------
  |  Branch (2441:21): [True: 0, False: 0]
  ------------------
 2442|      0|        if (!track_is_visible(mpctx, mpctx->tracks[n]))
  ------------------
  |  Branch (2442:13): [True: 0, False: 0]
  ------------------
 2443|      0|            continue;
 2444|      0|        if (mpctx->tracks[n] == t) {
  ------------------
  |  Branch (2444:13): [True: 0, False: 0]
  ------------------
 2445|      0|            index = filtered_index;
 2446|      0|            break;
 2447|      0|        }
 2448|      0|        filtered_index++;
 2449|      0|    }
 2450|      0|    if (index < 0)
  ------------------
  |  Branch (2450:9): [True: 0, False: 0]
  ------------------
 2451|      0|        return M_PROPERTY_UNAVAILABLE;
 2452|       |
 2453|      0|    char *name = mp_tprintf(80, "track-list/%d%s%s", index, *rem ? "/" : "", rem);
  ------------------
  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (195:55): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2454|      0|    return mp_property_do(name, ka->action, ka->arg, ctx);
 2455|      0|}
command.c:mp_property_list_editions:
 1272|     18|{
 1273|     18|    MPContext *mpctx = ctx;
 1274|     18|    struct demuxer *demuxer = mpctx->demuxer;
 1275|     18|    if (!demuxer)
  ------------------
  |  Branch (1275:9): [True: 18, False: 0]
  ------------------
 1276|     18|        return M_PROPERTY_UNAVAILABLE;
 1277|       |
 1278|      0|    if (action == M_PROPERTY_PRINT) {
  ------------------
  |  Branch (1278:9): [True: 0, False: 0]
  ------------------
 1279|      0|        char *res = NULL;
 1280|       |
 1281|      0|        struct demux_edition *editions = demuxer->editions;
 1282|      0|        int num_editions = demuxer->num_editions;
 1283|      0|        int current = demuxer->edition;
 1284|       |
 1285|      0|        if (!num_editions)
  ------------------
  |  Branch (1285:13): [True: 0, False: 0]
  ------------------
 1286|      0|            res = talloc_asprintf_append(res, "No editions.");
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 1287|       |
 1288|      0|        for (int n = 0; n < num_editions; n++) {
  ------------------
  |  Branch (1288:25): [True: 0, False: 0]
  ------------------
 1289|      0|            struct demux_edition *ed = &editions[n];
 1290|       |
 1291|      0|            if (n == current)
  ------------------
  |  Branch (1291:17): [True: 0, False: 0]
  ------------------
 1292|      0|                res = append_selected_style(mpctx, res);
 1293|      0|            res = talloc_asprintf_append(res, "%d: ", n);
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 1294|      0|            char *title = mp_tags_get_str(ed->metadata, "title");
 1295|      0|            if (!title)
  ------------------
  |  Branch (1295:17): [True: 0, False: 0]
  ------------------
 1296|      0|                title = "unnamed";
 1297|      0|            res = talloc_asprintf_append(res, "'%s'%s\n", title,
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 1298|      0|                                         n == current ? get_style_reset(mpctx) : "");
  ------------------
  |  Branch (1298:42): [True: 0, False: 0]
  ------------------
 1299|      0|        }
 1300|       |
 1301|      0|        *(char **)arg = res;
 1302|      0|        return M_PROPERTY_OK;
 1303|      0|    }
 1304|      0|    return m_property_read_list(action, arg, demuxer->num_editions,
 1305|      0|                                get_edition_entry, mpctx);
 1306|      0|}
command.c:mp_property_playlist:
 3793|  2.29k|{
 3794|  2.29k|    MPContext *mpctx = ctx;
 3795|  2.29k|    if (action == M_PROPERTY_PRINT || action == M_PROPERTY_PRINT_UNCUT) {
  ------------------
  |  Branch (3795:9): [True: 184, False: 2.10k]
  |  Branch (3795:39): [True: 0, False: 2.10k]
  ------------------
 3796|    184|        struct playlist *pl = mpctx->playlist;
 3797|    184|        char *res = talloc_strdup(NULL, "");
  ------------------
  |  |   50|    184|#define talloc_strdup                   ta_xstrdup
  ------------------
 3798|       |
 3799|  3.36k|        for (int n = 0; n < pl->num_entries; n++) {
  ------------------
  |  Branch (3799:25): [True: 3.17k, False: 184]
  ------------------
 3800|  3.17k|            struct playlist_entry *e = pl->entries[n];
 3801|  3.17k|            if (pl->current == e)
  ------------------
  |  Branch (3801:17): [True: 0, False: 3.17k]
  ------------------
 3802|      0|                res = append_selected_style(mpctx, res);
 3803|  3.17k|            const char *reset = pl->current == e ? get_style_reset(mpctx) : "";
  ------------------
  |  Branch (3803:33): [True: 0, False: 3.17k]
  ------------------
 3804|  3.17k|            const char *p = e->title;
 3805|  3.17k|            if (!p || mpctx->opts->playlist_entry_name > 0) {
  ------------------
  |  Branch (3805:17): [True: 3.17k, False: 0]
  |  Branch (3805:23): [True: 0, False: 0]
  ------------------
 3806|  3.17k|                p = e->filename;
 3807|  3.17k|                if (!mp_is_url(bstr0(p))) {
  ------------------
  |  Branch (3807:21): [True: 2.64k, False: 535]
  ------------------
 3808|  2.64k|                    const char *s = mp_basename(e->filename);
 3809|  2.64k|                    if (s[0])
  ------------------
  |  Branch (3809:25): [True: 2.15k, False: 485]
  ------------------
 3810|  2.15k|                        p = s;
 3811|  2.64k|                }
 3812|  3.17k|            }
 3813|  3.17k|            if (!e->title || p == e->title || mpctx->opts->playlist_entry_name == 1) {
  ------------------
  |  Branch (3813:17): [True: 3.17k, False: 0]
  |  Branch (3813:30): [True: 0, False: 0]
  |  Branch (3813:47): [True: 0, False: 0]
  ------------------
 3814|  3.17k|                res = talloc_asprintf_append(res, "%s%s\n", p, reset);
  ------------------
  |  |   63|  3.17k|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 3815|  3.17k|            } else {
 3816|      0|                res = talloc_asprintf_append(res, "%s (%s)%s\n", e->title, p, reset);
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 3817|      0|            }
 3818|  3.17k|        }
 3819|       |
 3820|    184|        *(char **)arg = cut_osd_list(mpctx, action, "Playlist", res,
 3821|    184|                                     playlist_entry_to_index(pl, pl->current));
 3822|    184|        return M_PROPERTY_OK;
 3823|    184|    }
 3824|       |
 3825|  2.10k|    return m_property_read_list(action, arg, playlist_entry_count(mpctx->playlist),
 3826|  2.10k|                                do_playlist_entry, mpctx);
 3827|  2.29k|}
command.c:do_playlist_entry:
 3732|  9.64k|{
 3733|  9.64k|    struct MPContext *mpctx = ctx;
 3734|       |
 3735|  9.64k|    struct playlist_entry *e = playlist_entry_from_index(mpctx->playlist, item);
 3736|  9.64k|    if (!e)
  ------------------
  |  Branch (3736:9): [True: 0, False: 9.64k]
  ------------------
 3737|      0|        return M_PROPERTY_ERROR;
 3738|       |
 3739|  9.64k|    bool current = mpctx->playlist->current == e;
 3740|  9.64k|    bool playing = mpctx->playing == e;
 3741|  9.64k|    struct m_sub_property props[] = {
 3742|  9.64k|        {"filename",      SUB_PROP_STR(e->filename)},
  ------------------
  |  |  237|  9.64k|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|  9.64k|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 3743|  9.64k|        {"current",       SUB_PROP_BOOL(1), .unavailable = !current},
  ------------------
  |  |  243|  9.64k|    .type = {.type = CONF_TYPE_BOOL}, .value = {.bool_ = (f)}
  |  |  ------------------
  |  |  |  |  238|  9.64k|#define CONF_TYPE_BOOL          (&m_option_type_bool)
  |  |  ------------------
  ------------------
 3744|  9.64k|        {"playing",       SUB_PROP_BOOL(1), .unavailable = !playing},
  ------------------
  |  |  243|  9.64k|    .type = {.type = CONF_TYPE_BOOL}, .value = {.bool_ = (f)}
  |  |  ------------------
  |  |  |  |  238|  9.64k|#define CONF_TYPE_BOOL          (&m_option_type_bool)
  |  |  ------------------
  ------------------
 3745|  9.64k|        {"title",         SUB_PROP_STR(e->title), .unavailable = !e->title},
  ------------------
  |  |  237|  9.64k|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|  9.64k|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 3746|  9.64k|        {"id",            SUB_PROP_INT64(e->id)},
  ------------------
  |  |  235|  9.64k|    .type = {.type = CONF_TYPE_INT64}, .value = {.int64 = (i)}
  |  |  ------------------
  |  |  |  |  241|  9.64k|#define CONF_TYPE_INT64         (&m_option_type_int64)
  |  |  ------------------
  ------------------
 3747|  9.64k|        {"playlist-path", SUB_PROP_STR(e->playlist_path), .unavailable = !e->playlist_path},
  ------------------
  |  |  237|  9.64k|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|  9.64k|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 3748|  9.64k|        {0}
 3749|  9.64k|    };
 3750|       |
 3751|  9.64k|    if (action != M_PROPERTY_KEY_ACTION)
  ------------------
  |  Branch (3751:9): [True: 9.12k, False: 522]
  ------------------
 3752|  9.12k|        goto prop_get;
 3753|       |
 3754|    522|    struct m_property_action_arg *ka = arg;
 3755|    522|    if (strcmp(ka->key, "title") != 0)
  ------------------
  |  Branch (3755:9): [True: 319, False: 203]
  ------------------
 3756|    319|        goto prop_get;
 3757|       |
 3758|       |    // handle playlist/N/title writes
 3759|    203|    switch (ka->action) {
  ------------------
  |  Branch (3759:13): [True: 51, False: 152]
  ------------------
 3760|      0|    case M_PROPERTY_SET_NODE: {
  ------------------
  |  Branch (3760:5): [True: 0, False: 203]
  ------------------
 3761|      0|        return M_PROPERTY_NOT_IMPLEMENTED;
 3762|      0|    }
 3763|     51|    case M_PROPERTY_GET_TYPE: {
  ------------------
  |  Branch (3763:5): [True: 51, False: 152]
  ------------------
 3764|     51|        *(struct m_option *)ka->arg = (struct m_option){
 3765|     51|            .type = CONF_TYPE_STRING,
  ------------------
  |  |  244|     51|#define CONF_TYPE_STRING        (&m_option_type_string)
  ------------------
 3766|     51|        };
 3767|     51|        return M_PROPERTY_OK;
 3768|      0|    }
 3769|      0|    case M_PROPERTY_SET: {
  ------------------
  |  Branch (3769:5): [True: 0, False: 203]
  ------------------
 3770|      0|        talloc_replace(e, e->title, *(char **)ka->arg);
  ------------------
  |  |   54|      0|#define talloc_replace                  ta_replace
  |  |  ------------------
  |  |  |  |  106|      0|    do {                                                \
  |  |  |  |  107|      0|        if (!(str)) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  108|      0|            (str) = ta_xstrdup((ta_parent), (replace)); \
  |  |  |  |  109|      0|        } else {                                        \
  |  |  |  |  110|      0|            *(str) = '\0';                              \
  |  |  |  |  111|      0|            ta_xstrdup_append(&(str), (replace));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|      0|#define ta_xstrdup_append(...)          ta_oom_b(ta_strdup_append(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  112|      0|        }                                               \
  |  |  |  |  113|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (113:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3771|      0|        mp_notify_property(mpctx, "playlist");
 3772|      0|        return M_PROPERTY_OK;
 3773|      0|    }
 3774|    203|    }
 3775|       |
 3776|  9.59k|prop_get:
 3777|  9.59k|    return m_property_read_sub(props, action, arg);
 3778|    203|}
command.c:mp_property_playlist_path:
 3782|     18|{
 3783|     18|    MPContext *mpctx = ctx;
 3784|     18|    if (!mpctx->playlist->current)
  ------------------
  |  Branch (3784:9): [True: 18, False: 0]
  ------------------
 3785|     18|        return M_PROPERTY_UNAVAILABLE;
 3786|       |
 3787|      0|    struct playlist_entry *e = mpctx->playlist->current;
 3788|      0|    return m_property_strdup_ro(action, arg, e->playlist_path);
 3789|     18|}
command.c:mp_property_playlist_pos:
 3721|     78|{
 3722|     78|    return mp_property_playlist_pos_x(ctx, prop, action, arg, 0);
 3723|     78|}
command.c:mp_property_playlist_pos_x:
 3686|     78|{
 3687|     78|    MPContext *mpctx = ctx;
 3688|     78|    struct playlist *pl = mpctx->playlist;
 3689|       |
 3690|     78|    switch (action) {
  ------------------
  |  Branch (3690:13): [True: 54, False: 24]
  ------------------
 3691|     18|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (3691:5): [True: 18, False: 60]
  ------------------
 3692|     18|        int pos = playlist_entry_to_index(pl, pl->current);
 3693|     18|        *(int *)arg = pos < 0 ? -1 : pos + base;
  ------------------
  |  Branch (3693:23): [True: 18, False: 0]
  ------------------
 3694|     18|        return M_PROPERTY_OK;
 3695|      0|    }
 3696|      0|    case M_PROPERTY_SET: {
  ------------------
  |  Branch (3696:5): [True: 0, False: 78]
  ------------------
 3697|      0|        int pos = *(int *)arg - base;
 3698|      0|        if (pos >= 0 && playlist_entry_to_index(pl, pl->current) == pos)
  ------------------
  |  Branch (3698:13): [True: 0, False: 0]
  |  Branch (3698:25): [True: 0, False: 0]
  ------------------
 3699|      0|            return M_PROPERTY_OK;
 3700|      0|        mp_set_playlist_entry(mpctx, playlist_entry_from_index(pl, pos));
 3701|      0|        return M_PROPERTY_OK;
 3702|      0|    }
 3703|     18|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (3703:5): [True: 18, False: 60]
  ------------------
 3704|     18|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_INT};
  ------------------
  |  |  240|     18|#define CONF_TYPE_INT           (&m_option_type_int)
  ------------------
 3705|     18|        return M_PROPERTY_OK;
 3706|     18|    case M_PROPERTY_GET_CONSTRICTED_TYPE: {
  ------------------
  |  Branch (3706:5): [True: 18, False: 60]
  ------------------
 3707|     18|        struct m_option opt = {
 3708|     18|            .type = CONF_TYPE_INT,
  ------------------
  |  |  240|     18|#define CONF_TYPE_INT           (&m_option_type_int)
  ------------------
 3709|     18|            .min = base,
 3710|     18|            .max = playlist_entry_count(pl) - 1 + base,
 3711|     18|        };
 3712|     18|        *(struct m_option *)arg = opt;
 3713|     18|        return M_PROPERTY_OK;
 3714|      0|    }
 3715|     78|    }
 3716|     24|    return M_PROPERTY_NOT_IMPLEMENTED;
 3717|     78|}
command.c:mp_property_playlist_current_pos:
 3653|     82|{
 3654|     82|    MPContext *mpctx = ctx;
 3655|     82|    struct playlist *pl = mpctx->playlist;
 3656|       |
 3657|     82|    switch (action) {
  ------------------
  |  Branch (3657:13): [True: 42, False: 40]
  ------------------
 3658|     21|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (3658:5): [True: 21, False: 61]
  ------------------
 3659|     21|        *(int *)arg = playlist_entry_to_index(pl, pl->current);
 3660|     21|        return M_PROPERTY_OK;
 3661|      0|    }
 3662|      0|    case M_PROPERTY_SET: {
  ------------------
  |  Branch (3662:5): [True: 0, False: 82]
  ------------------
 3663|      0|        pl->current = playlist_entry_from_index(pl, *(int *)arg);
 3664|      0|        mp_notify(mpctx, MP_EVENT_CHANGE_PLAYLIST, NULL);
 3665|      0|        return M_PROPERTY_OK;
 3666|      0|    }
 3667|     21|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (3667:5): [True: 21, False: 61]
  ------------------
 3668|     21|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_INT};
  ------------------
  |  |  240|     21|#define CONF_TYPE_INT           (&m_option_type_int)
  ------------------
 3669|     21|        return M_PROPERTY_OK;
 3670|     82|    }
 3671|     40|    return M_PROPERTY_NOT_IMPLEMENTED;
 3672|     82|}
command.c:mp_property_playlist_playing_pos:
 3677|     64|{
 3678|     64|    MPContext *mpctx = ctx;
 3679|     64|    struct playlist *pl = mpctx->playlist;
 3680|     64|    return m_property_int_ro(action, arg,
 3681|     64|                             playlist_entry_to_index(pl, mpctx->playing));
 3682|     64|}
command.c:mp_property_mixer_active:
 1785|     66|{
 1786|     66|    MPContext *mpctx = ctx;
 1787|     66|    return m_property_bool_ro(action, arg, !!mpctx->ao);
 1788|     66|}
command.c:mp_property_volume:
 1793|    124|{
 1794|    124|    MPContext *mpctx = ctx;
 1795|    124|    struct MPOpts *opts = mpctx->opts;
 1796|       |
 1797|    124|    switch (action) {
  ------------------
  |  Branch (1797:13): [True: 78, False: 46]
  ------------------
 1798|     40|    case M_PROPERTY_GET_CONSTRICTED_TYPE:
  ------------------
  |  Branch (1798:5): [True: 40, False: 84]
  ------------------
 1799|     40|        *(struct m_option *)arg = (struct m_option){
 1800|     40|            .type = CONF_TYPE_FLOAT,
  ------------------
  |  |  242|     40|#define CONF_TYPE_FLOAT         (&m_option_type_float)
  ------------------
 1801|     40|            .min = 0,
 1802|     40|            .max = opts->softvol_max,
 1803|     40|        };
 1804|     40|        return M_PROPERTY_OK;
 1805|     38|    case M_PROPERTY_PRINT:
  ------------------
  |  Branch (1805:5): [True: 38, False: 86]
  ------------------
 1806|     38|        *(char **)arg = talloc_asprintf(NULL, "%.f", opts->softvol_volume);
  ------------------
  |  |   52|     38|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     38|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 1807|     38|        return M_PROPERTY_OK;
 1808|    124|    }
 1809|       |
 1810|     46|    return mp_property_generic_option(mpctx, prop, action, arg);
 1811|    124|}
command.c:mp_property_volume_gain:
 1815|    196|{
 1816|    196|    MPContext *mpctx = ctx;
 1817|    196|    struct MPOpts *opts = mpctx->opts;
 1818|       |
 1819|    196|    switch (action) {
  ------------------
  |  Branch (1819:13): [True: 73, False: 123]
  ------------------
 1820|     54|    case M_PROPERTY_GET_CONSTRICTED_TYPE:
  ------------------
  |  Branch (1820:5): [True: 54, False: 142]
  ------------------
 1821|     54|        *(struct m_option *)arg = (struct m_option){
 1822|     54|            .type = CONF_TYPE_FLOAT,
  ------------------
  |  |  242|     54|#define CONF_TYPE_FLOAT         (&m_option_type_float)
  ------------------
 1823|     54|            .min = opts->softvol_gain_min,
 1824|     54|            .max = opts->softvol_gain_max,
 1825|     54|        };
 1826|     54|        return M_PROPERTY_OK;
 1827|     19|    case M_PROPERTY_PRINT:
  ------------------
  |  Branch (1827:5): [True: 19, False: 177]
  ------------------
 1828|     19|        *(char **)arg = talloc_asprintf(NULL, "%.1f", opts->softvol_gain);
  ------------------
  |  |   52|     19|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     19|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 1829|     19|        return M_PROPERTY_OK;
 1830|    196|    }
 1831|       |
 1832|    123|    return mp_property_generic_option(mpctx, prop, action, arg);
 1833|    196|}
command.c:mp_property_ao_mute:
 1876|     18|{
 1877|     18|    MPContext *mpctx = ctx;
 1878|     18|    struct ao *ao = mpctx->ao;
 1879|     18|    if (!ao)
  ------------------
  |  Branch (1879:9): [True: 18, False: 0]
  ------------------
 1880|     18|        return M_PROPERTY_NOT_IMPLEMENTED;
 1881|       |
 1882|      0|    switch (action) {
  ------------------
  |  Branch (1882:13): [True: 0, False: 0]
  ------------------
 1883|      0|    case M_PROPERTY_SET: {
  ------------------
  |  Branch (1883:5): [True: 0, False: 0]
  ------------------
 1884|      0|        bool value = *(int *)arg;
 1885|      0|        if (ao_control(ao, AOCONTROL_SET_MUTE, &value) != CONTROL_OK)
  ------------------
  |  |   95|      0|#define CONTROL_OK 1
  ------------------
  |  Branch (1885:13): [True: 0, False: 0]
  ------------------
 1886|      0|            return M_PROPERTY_UNAVAILABLE;
 1887|      0|        return M_PROPERTY_OK;
 1888|      0|    }
 1889|      0|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (1889:5): [True: 0, False: 0]
  ------------------
 1890|      0|        bool value = false;
 1891|      0|        if (ao_control(ao, AOCONTROL_GET_MUTE, &value) != CONTROL_OK)
  ------------------
  |  |   95|      0|#define CONTROL_OK 1
  ------------------
  |  Branch (1891:13): [True: 0, False: 0]
  ------------------
 1892|      0|            return M_PROPERTY_UNAVAILABLE;
 1893|      0|        *(int *)arg = value;
 1894|      0|        return M_PROPERTY_OK;
 1895|      0|    }
 1896|      0|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (1896:5): [True: 0, False: 0]
  ------------------
 1897|      0|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_BOOL};
  ------------------
  |  |  238|      0|#define CONF_TYPE_BOOL          (&m_option_type_bool)
  ------------------
 1898|      0|        return M_PROPERTY_OK;
 1899|      0|    }
 1900|      0|    return M_PROPERTY_NOT_IMPLEMENTED;
 1901|      0|}
command.c:mp_property_audio_delay:
 1979|    151|{
 1980|    151|    MPContext *mpctx = ctx;
 1981|    151|    if (action == M_PROPERTY_PRINT) {
  ------------------
  |  Branch (1981:9): [True: 29, False: 122]
  ------------------
 1982|     29|        *(char **)arg = format_delay(mpctx->opts->audio_delay);
 1983|     29|        return M_PROPERTY_OK;
 1984|     29|    }
 1985|    122|    return mp_property_generic_option(mpctx, prop, action, arg);
 1986|    151|}
command.c:format_delay:
  428|     64|{
  429|     64|    char *str = mp_format_double(NULL, time * 1000, 6, false, false, true);
  430|     64|    return talloc_strdup_append(str, " ms");
  ------------------
  |  |   57|     64|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
  431|     64|}
command.c:mp_property_audio_params:
 2010|    109|{
 2011|    109|    MPContext *mpctx = ctx;
 2012|       |
 2013|    109|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 2014|    109|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (2014:9): [True: 72, False: 37]
  ------------------
 2015|     72|        return valid;
 2016|       |
 2017|     37|    return property_audiofmt(mpctx->ao_chain ?
  ------------------
  |  Branch (2017:30): [True: 0, False: 37]
  ------------------
 2018|      0|        mpctx->ao_chain->filter->input_aformat : NULL, action, arg);
 2019|    109|}
command.c:property_audiofmt:
 1989|     38|{
 1990|     38|    if (!fmt || !mp_aframe_config_is_valid(fmt))
  ------------------
  |  Branch (1990:9): [True: 38, False: 0]
  |  Branch (1990:17): [True: 0, False: 0]
  ------------------
 1991|     38|        return M_PROPERTY_UNAVAILABLE;
 1992|       |
 1993|      0|    struct mp_chmap chmap = {0};
 1994|      0|    mp_aframe_get_chmap(fmt, &chmap);
 1995|       |
 1996|      0|    struct m_sub_property props[] = {
 1997|      0|        {"samplerate",      SUB_PROP_INT(mp_aframe_get_rate(fmt))},
  ------------------
  |  |  233|      0|    .type = {.type = CONF_TYPE_INT}, .value = {.int_ = (i)}
  |  |  ------------------
  |  |  |  |  240|      0|#define CONF_TYPE_INT           (&m_option_type_int)
  |  |  ------------------
  ------------------
 1998|      0|        {"channel-count",   SUB_PROP_INT(chmap.num)},
  ------------------
  |  |  233|      0|    .type = {.type = CONF_TYPE_INT}, .value = {.int_ = (i)}
  |  |  ------------------
  |  |  |  |  240|      0|#define CONF_TYPE_INT           (&m_option_type_int)
  |  |  ------------------
  ------------------
 1999|      0|        {"channels",        SUB_PROP_STR(mp_chmap_to_str(&chmap))},
  ------------------
  |  |  237|      0|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|      0|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 2000|      0|        {"hr-channels",     SUB_PROP_STR(mp_chmap_to_str_hr(&chmap))},
  ------------------
  |  |  237|      0|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|      0|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 2001|      0|        {"format",          SUB_PROP_STR(af_fmt_to_str(mp_aframe_get_format(fmt)))},
  ------------------
  |  |  237|      0|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|      0|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 2002|      0|        {0}
 2003|      0|    };
 2004|       |
 2005|      0|    return m_property_read_sub(props, action, arg);
 2006|     38|}
command.c:mp_property_audio_out_params:
 2023|      3|{
 2024|      3|    MPContext *mpctx = ctx;
 2025|       |
 2026|      3|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 2027|      3|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (2027:9): [True: 2, False: 1]
  ------------------
 2028|      2|        return valid;
 2029|       |
 2030|      1|    struct mp_aframe *frame = NULL;
 2031|      1|    if (mpctx->ao) {
  ------------------
  |  Branch (2031:9): [True: 0, False: 1]
  ------------------
 2032|      0|        frame = mp_aframe_create();
 2033|      0|        int samplerate;
 2034|      0|        int format;
 2035|      0|        struct mp_chmap channels;
 2036|      0|        ao_get_format(mpctx->ao, &samplerate, &format, &channels);
 2037|      0|        mp_aframe_set_rate(frame, samplerate);
 2038|      0|        mp_aframe_set_format(frame, format);
 2039|      0|        mp_aframe_set_chmap(frame, &channels);
 2040|      0|    }
 2041|      1|    int r = property_audiofmt(frame, action, arg);
 2042|      1|    talloc_free(frame);
  ------------------
  |  |   47|      1|#define talloc_free                     ta_free
  ------------------
 2043|      1|    return r;
 2044|      3|}
command.c:mp_property_switch_track:
 2072|    907|{
 2073|    907|    MPContext *mpctx = ctx;
 2074|    907|    const int *def = prop->priv;
 2075|    907|    int order = def[0];
 2076|    907|    enum stream_type type = def[1];
 2077|       |
 2078|    907|    struct track *track = mpctx->current_track[order][type];
 2079|       |
 2080|    907|    switch (action) {
  ------------------
  |  Branch (2080:13): [True: 174, False: 733]
  ------------------
 2081|     76|    case M_PROPERTY_GET:
  ------------------
  |  Branch (2081:5): [True: 76, False: 831]
  ------------------
 2082|     76|        if (mpctx->playback_initialized) {
  ------------------
  |  Branch (2082:13): [True: 0, False: 76]
  ------------------
 2083|      0|            *(int *)arg = track ? track->user_tid : -2;
  ------------------
  |  Branch (2083:27): [True: 0, False: 0]
  ------------------
 2084|     76|        } else {
 2085|     76|            *(int *)arg = mpctx->opts->stream_id[order][type];
 2086|     76|        }
 2087|     76|        return M_PROPERTY_OK;
 2088|     98|    case M_PROPERTY_PRINT:
  ------------------
  |  Branch (2088:5): [True: 98, False: 809]
  ------------------
 2089|     98|        if (track) {
  ------------------
  |  Branch (2089:13): [True: 0, False: 98]
  ------------------
 2090|      0|            void *talloc_ctx = talloc_new(NULL);
  ------------------
  |  |   40|      0|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|      0|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
 2091|      0|            *(char **)arg = talloc_asprintf(NULL, "(%d) %s", track->user_tid,
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 2092|      0|                mp_format_track_metadata(talloc_ctx, track, true));
 2093|      0|            talloc_free(talloc_ctx);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 2094|     98|        } else {
 2095|     98|            const char *msg = "no";
 2096|     98|            if (!mpctx->playback_initialized &&
  ------------------
  |  Branch (2096:17): [True: 98, False: 0]
  ------------------
 2097|     98|                mpctx->opts->stream_id[order][type] == -1)
  ------------------
  |  Branch (2097:17): [True: 75, False: 23]
  ------------------
 2098|     75|                msg = "auto";
 2099|     98|            *(char **) arg = talloc_strdup(NULL, msg);
  ------------------
  |  |   50|     98|#define talloc_strdup                   ta_xstrdup
  ------------------
 2100|     98|        }
 2101|     98|        return M_PROPERTY_OK;
 2102|       |
 2103|      0|    case M_PROPERTY_SWITCH: {
  ------------------
  |  Branch (2103:5): [True: 0, False: 907]
  ------------------
 2104|      0|        if (mpctx->playback_initialized) {
  ------------------
  |  Branch (2104:13): [True: 0, False: 0]
  ------------------
 2105|      0|            struct m_property_switch_arg *sarg = arg;
 2106|      0|            do {
 2107|      0|                track = track_next(mpctx, type, sarg->inc >= 0 ? +1 : -1, track);
  ------------------
  |  Branch (2107:49): [True: 0, False: 0]
  ------------------
 2108|      0|                mp_switch_track_n(mpctx, order, type, track, FLAG_MARK_SELECTION);
  ------------------
  |  |  559|      0|#define FLAG_MARK_SELECTION 1
  ------------------
 2109|      0|            } while (mpctx->current_track[order][type] != track);
  ------------------
  |  Branch (2109:22): [True: 0, False: 0]
  ------------------
 2110|      0|            print_track_list(mpctx, "Track switched:");
 2111|      0|        } else {
 2112|       |            // Simply cycle between "no" and "auto". It's possible that this does
 2113|       |            // not always do what the user means, but keep the complexity low.
 2114|      0|            mark_track_selection(mpctx, order, type,
 2115|      0|                mpctx->opts->stream_id[order][type] == -1 ? -2 : -1);
  ------------------
  |  Branch (2115:17): [True: 0, False: 0]
  ------------------
 2116|      0|        }
 2117|      0|        return M_PROPERTY_OK;
 2118|      0|    }
 2119|    907|    }
 2120|    733|    return mp_property_generic_option(mpctx, prop, action, arg);
 2121|    907|}
command.c:mp_property_audio_device:
 1929|    172|{
 1930|    172|    struct MPContext *mpctx = ctx;
 1931|    172|    struct command_ctx *cmd = mpctx->command_ctx;
 1932|    172|    if (action == M_PROPERTY_PRINT) {
  ------------------
  |  Branch (1932:9): [True: 38, False: 134]
  ------------------
 1933|     38|        create_hotplug(mpctx);
 1934|       |
 1935|     38|        char *name = NULL;
 1936|     38|        if (mp_property_generic_option(mpctx, prop, M_PROPERTY_GET, &name) < 1)
  ------------------
  |  Branch (1936:13): [True: 0, False: 38]
  ------------------
 1937|      0|            name = NULL;
 1938|       |
 1939|     38|        struct ao_device_list *list = ao_hotplug_get_device_list(cmd->hotplug, mpctx->ao);
 1940|     38|        for (int n = 0; n < list->num_devices; n++) {
  ------------------
  |  Branch (1940:25): [True: 38, False: 0]
  ------------------
 1941|     38|            struct ao_device_desc *dev = &list->devices[n];
 1942|     38|            if (dev->name && name && strcmp(dev->name, name) == 0) {
  ------------------
  |  Branch (1942:17): [True: 38, False: 0]
  |  Branch (1942:30): [True: 38, False: 0]
  |  Branch (1942:38): [True: 38, False: 0]
  ------------------
 1943|     38|                *(char **)arg = talloc_strdup(NULL, dev->desc ? dev->desc : "?");
  ------------------
  |  |   50|     38|#define talloc_strdup                   ta_xstrdup
  ------------------
  |  Branch (1943:53): [True: 38, False: 0]
  ------------------
 1944|     38|                talloc_free(name);
  ------------------
  |  |   47|     38|#define talloc_free                     ta_free
  ------------------
 1945|     38|                return M_PROPERTY_OK;
 1946|     38|            }
 1947|     38|        }
 1948|       |
 1949|      0|        talloc_free(name);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 1950|      0|    }
 1951|    134|    return mp_property_generic_option(mpctx, prop, action, arg);
 1952|    172|}
command.c:create_hotplug:
 1918|    273|{
 1919|    273|    struct command_ctx *cmd = mpctx->command_ctx;
 1920|       |
 1921|    273|    if (!cmd->hotplug) {
  ------------------
  |  Branch (1921:9): [True: 27, False: 246]
  ------------------
 1922|     27|        cmd->hotplug = ao_hotplug_create(mpctx->global, mp_wakeup_core_cb,
 1923|     27|                                         mpctx);
 1924|     27|    }
 1925|    273|}
command.c:mp_property_audio_devices:
 1956|    235|{
 1957|    235|    struct MPContext *mpctx = ctx;
 1958|    235|    struct command_ctx *cmd = mpctx->command_ctx;
 1959|    235|    create_hotplug(mpctx);
 1960|       |
 1961|    235|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 1962|    235|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (1962:9): [True: 169, False: 66]
  ------------------
 1963|    169|        return valid;
 1964|       |
 1965|     66|    struct ao_device_list *list = ao_hotplug_get_device_list(cmd->hotplug, mpctx->ao);
 1966|     66|    return m_property_read_list(action, arg, list->num_devices,
 1967|     66|                                get_device_entry, list);
 1968|    235|}
command.c:get_device_entry:
 1904|     63|{
 1905|     63|    struct ao_device_list *list = ctx;
 1906|     63|    struct ao_device_desc *entry = &list->devices[item];
 1907|       |
 1908|     63|    struct m_sub_property props[] = {
 1909|     63|        {"name",        SUB_PROP_STR(entry->name)},
  ------------------
  |  |  237|     63|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|     63|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 1910|     63|        {"description", SUB_PROP_STR(entry->desc)},
  ------------------
  |  |  237|     63|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|     63|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 1911|     63|        {0}
 1912|     63|    };
 1913|       |
 1914|     63|    return m_property_read_sub(props, action, arg);
 1915|     63|}
command.c:mp_property_ao:
 1971|     18|{
 1972|     18|    MPContext *mpctx = ctx;
 1973|     18|    return m_property_strdup_ro(action, arg, mpctx->ao ? ao_get_name(mpctx->ao) : NULL);
  ------------------
  |  Branch (1973:46): [True: 0, False: 18]
  ------------------
 1974|     18|}
command.c:mp_property_tgt_imgparams:
 2714|     18|{
 2715|     18|    MPContext *mpctx = ctx;
 2716|     18|    struct vo *vo = mpctx->video_out;
 2717|     18|    if (!mpctx->video_out)
  ------------------
  |  Branch (2717:9): [True: 18, False: 0]
  ------------------
 2718|     18|        return M_PROPERTY_UNAVAILABLE;
 2719|       |
 2720|      0|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 2721|      0|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (2721:9): [True: 0, False: 0]
  ------------------
 2722|      0|        return valid;
 2723|       |
 2724|      0|    struct mp_image_params p = vo_get_target_params(vo);
 2725|      0|    return property_imgparams(&p, action, arg);
 2726|      0|}
command.c:mp_property_vo_imgparams:
 2698|     19|{
 2699|     19|    MPContext *mpctx = ctx;
 2700|     19|    struct vo *vo = mpctx->video_out;
 2701|     19|    if (!vo)
  ------------------
  |  Branch (2701:9): [True: 19, False: 0]
  ------------------
 2702|     19|        return M_PROPERTY_UNAVAILABLE;
 2703|       |
 2704|      0|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 2705|      0|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (2705:9): [True: 0, False: 0]
  ------------------
 2706|      0|        return valid;
 2707|       |
 2708|      0|    struct mp_image_params p = vo_get_current_params(vo);
 2709|      0|    return property_imgparams(&p, action, arg);
 2710|      0|}
command.c:mp_property_vd_imgparams:
 2749|     22|{
 2750|     22|    MPContext *mpctx = ctx;
 2751|     22|    struct vo_chain *vo_c = mpctx->vo_chain;
 2752|     22|    if (!vo_c)
  ------------------
  |  Branch (2752:9): [True: 22, False: 0]
  ------------------
 2753|     22|        return M_PROPERTY_UNAVAILABLE;
 2754|       |
 2755|      0|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 2756|      0|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (2756:9): [True: 0, False: 0]
  ------------------
 2757|      0|        return valid;
 2758|       |
 2759|      0|    struct track *track = mpctx->current_track[0][STREAM_VIDEO];
 2760|      0|    struct mp_codec_params *c =
 2761|      0|        track && track->stream ? track->stream->codec : NULL;
  ------------------
  |  Branch (2761:9): [True: 0, False: 0]
  |  Branch (2761:18): [True: 0, False: 0]
  ------------------
 2762|      0|    if (vo_c->filter->input_params.imgfmt) {
  ------------------
  |  Branch (2762:9): [True: 0, False: 0]
  ------------------
 2763|      0|        return property_imgparams(&vo_c->filter->input_params, action, arg);
 2764|      0|    } else if (c && c->disp_w && c->disp_h) {
  ------------------
  |  Branch (2764:16): [True: 0, False: 0]
  |  Branch (2764:21): [True: 0, False: 0]
  |  Branch (2764:34): [True: 0, False: 0]
  ------------------
 2765|       |        // Simplistic fallback for stupid scripts querying "width"/"height"
 2766|       |        // before the first frame is decoded.
 2767|      0|        struct m_sub_property props[] = {
 2768|      0|            {"w", SUB_PROP_INT(c->disp_w)},
  ------------------
  |  |  233|      0|    .type = {.type = CONF_TYPE_INT}, .value = {.int_ = (i)}
  |  |  ------------------
  |  |  |  |  240|      0|#define CONF_TYPE_INT           (&m_option_type_int)
  |  |  ------------------
  ------------------
 2769|      0|            {"h", SUB_PROP_INT(c->disp_h)},
  ------------------
  |  |  233|      0|    .type = {.type = CONF_TYPE_INT}, .value = {.int_ = (i)}
  |  |  ------------------
  |  |  |  |  240|      0|#define CONF_TYPE_INT           (&m_option_type_int)
  |  |  ------------------
  ------------------
 2770|      0|            {0}
 2771|      0|        };
 2772|      0|        return m_property_read_sub(props, action, arg);
 2773|      0|    }
 2774|      0|    return M_PROPERTY_UNAVAILABLE;
 2775|      0|}
command.c:get_frame_count:
 2487|     18|{
 2488|     18|    struct demuxer *demuxer = mpctx->demuxer;
 2489|     18|    if (!demuxer)
  ------------------
  |  Branch (2489:9): [True: 18, False: 0]
  ------------------
 2490|     18|        return -1;
 2491|      0|    if (!mpctx->vo_chain)
  ------------------
  |  Branch (2491:9): [True: 0, False: 0]
  ------------------
 2492|      0|        return -1;
 2493|      0|    double len = get_time_length(mpctx);
 2494|      0|    double fps = mpctx->vo_chain->filter->container_fps;
 2495|      0|    if (len < 0 || fps <= 0)
  ------------------
  |  Branch (2495:9): [True: 0, False: 0]
  |  Branch (2495:20): [True: 0, False: 0]
  ------------------
 2496|      0|        return 0;
 2497|       |
 2498|      0|    return len * fps;
 2499|      0|}
command.c:mp_property_vo_configured:
 3052|     34|{
 3053|     34|    MPContext *mpctx = ctx;
 3054|     34|    return m_property_bool_ro(action, arg,
 3055|     34|                        mpctx->video_out && mpctx->video_out->config_ok);
  ------------------
  |  Branch (3055:25): [True: 0, False: 34]
  |  Branch (3055:45): [True: 0, False: 0]
  ------------------
 3056|     34|}
command.c:mp_property_vo_passes:
 3089|     16|{
 3090|     16|    MPContext *mpctx = ctx;
 3091|     16|    if (!mpctx->video_out)
  ------------------
  |  Branch (3091:9): [True: 16, False: 0]
  ------------------
 3092|     16|        return M_PROPERTY_UNAVAILABLE;
 3093|       |
 3094|       |    // Return early, to avoid having to go through a completely unnecessary VOCTRL
 3095|      0|    switch (action) {
 3096|      0|    case M_PROPERTY_PRINT:
  ------------------
  |  Branch (3096:5): [True: 0, False: 0]
  ------------------
 3097|      0|    case M_PROPERTY_GET:
  ------------------
  |  Branch (3097:5): [True: 0, False: 0]
  ------------------
 3098|      0|        break;
 3099|      0|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (3099:5): [True: 0, False: 0]
  ------------------
 3100|      0|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE};
  ------------------
  |  |  253|      0|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
 3101|      0|        return M_PROPERTY_OK;
 3102|      0|    default:
  ------------------
  |  Branch (3102:5): [True: 0, False: 0]
  ------------------
 3103|      0|        return M_PROPERTY_NOT_IMPLEMENTED;
 3104|      0|    }
 3105|       |
 3106|      0|    struct voctrl_performance_data *data = talloc_ptrtype(NULL, data);
  ------------------
  |  |   34|      0|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|      0|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      0|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3107|      0|    if (vo_control(mpctx->video_out, VOCTRL_PERFORMANCE_DATA, data) <= 0) {
  ------------------
  |  Branch (3107:9): [True: 0, False: 0]
  ------------------
 3108|      0|        talloc_free(data);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 3109|      0|        return M_PROPERTY_UNAVAILABLE;
 3110|      0|    }
 3111|       |
 3112|      0|    switch (action) {
  ------------------
  |  Branch (3112:13): [True: 0, False: 0]
  ------------------
 3113|      0|    case M_PROPERTY_PRINT: {
  ------------------
  |  Branch (3113:5): [True: 0, False: 0]
  ------------------
 3114|      0|        char *res = NULL;
 3115|      0|        res = talloc_asprintf_append(res, "fresh:\n");
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 3116|      0|        res = asprint_perf(res, &data->fresh);
 3117|      0|        res = talloc_asprintf_append(res, "\nredraw:\n");
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 3118|      0|        res = asprint_perf(res, &data->redraw);
 3119|      0|        *(char **)arg = res;
 3120|      0|        break;
 3121|      0|    }
 3122|       |
 3123|      0|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (3123:5): [True: 0, False: 0]
  ------------------
 3124|      0|        struct mpv_node node;
 3125|      0|        node_init(&node, MPV_FORMAT_NODE_MAP, NULL);
 3126|      0|        struct mpv_node *fresh = node_map_add(&node, "fresh", MPV_FORMAT_NODE_ARRAY);
 3127|      0|        struct mpv_node *redraw = node_map_add(&node, "redraw", MPV_FORMAT_NODE_ARRAY);
 3128|      0|        get_frame_perf(fresh, &data->fresh);
 3129|      0|        get_frame_perf(redraw, &data->redraw);
 3130|      0|        *(struct mpv_node *)arg = node;
 3131|      0|        break;
 3132|      0|    }
 3133|      0|    }
 3134|       |
 3135|      0|    talloc_free(data);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 3136|      0|    return M_PROPERTY_OK;
 3137|      0|}
command.c:mp_property_perf_info:
 3141|    244|{
 3142|    244|    MPContext *mpctx = ctx;
 3143|       |
 3144|    244|    switch (action) {
  ------------------
  |  Branch (3144:13): [True: 122, False: 122]
  ------------------
 3145|     61|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (3145:5): [True: 61, False: 183]
  ------------------
 3146|     61|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE};
  ------------------
  |  |  253|     61|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
 3147|     61|        return M_PROPERTY_OK;
 3148|     61|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (3148:5): [True: 61, False: 183]
  ------------------
 3149|     61|        stats_global_query(mpctx->global, (struct mpv_node *)arg);
 3150|     61|        return M_PROPERTY_OK;
 3151|      0|    }
 3152|    244|    }
 3153|    122|    return M_PROPERTY_NOT_IMPLEMENTED;
 3154|    244|}
command.c:mp_property_vo:
 3157|     17|{
 3158|     17|    MPContext *mpctx = ctx;
 3159|     17|    return m_property_strdup_ro(action, arg, mpctx->video_out ?
  ------------------
  |  Branch (3159:46): [True: 0, False: 17]
  ------------------
 3160|      0|                                mpctx->video_out->driver->name : NULL);
 3161|     17|}
command.c:mp_property_gpu_context:
 3164|     19|{
 3165|     19|    MPContext *mpctx = ctx;
 3166|     19|    return m_property_strdup_ro(action, arg, mpctx->video_out ?
  ------------------
  |  Branch (3166:46): [True: 0, False: 19]
  ------------------
 3167|      0|                                mpctx->video_out->context_name : NULL);
 3168|     19|}
command.c:mp_property_fps:
 3395|     18|{
 3396|     18|    MPContext *mpctx = ctx;
 3397|     18|    float fps = mpctx->vo_chain ? mpctx->vo_chain->filter->container_fps : 0;
  ------------------
  |  Branch (3397:17): [True: 0, False: 18]
  ------------------
 3398|     18|    if (fps < 0.1 || !isfinite(fps))
  ------------------
  |  Branch (3398:9): [True: 18, False: 0]
  |  Branch (3398:22): [True: 0, False: 0]
  ------------------
 3399|     18|        return M_PROPERTY_UNAVAILABLE;
 3400|      0|    return m_property_float_ro(action, arg, fps);
 3401|     18|}
command.c:mp_property_video_aspect_override:
 3419|    225|{
 3420|    225|    MPContext *mpctx = ctx;
 3421|    225|    if (action == M_PROPERTY_PRINT) {
  ------------------
  |  Branch (3421:9): [True: 53, False: 172]
  ------------------
 3422|     53|        double aspect_ratio;
 3423|     53|        mp_property_generic_option(mpctx, prop, M_PROPERTY_GET, &aspect_ratio);
 3424|       |
 3425|     53|        if (doubles_equal(aspect_ratio, 2.35 / 1.0))
  ------------------
  |  | 3415|     53|#define doubles_equal(x, y) (fabs((x) - (y)) <= 0.001)
  |  |  ------------------
  |  |  |  Branch (3415:29): [True: 0, False: 53]
  |  |  ------------------
  ------------------
 3426|      0|            *(char **)arg = talloc_asprintf(NULL, "2.35:1");
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3427|     53|        else if (doubles_equal(aspect_ratio, 16.0 / 9.0))
  ------------------
  |  | 3415|     53|#define doubles_equal(x, y) (fabs((x) - (y)) <= 0.001)
  |  |  ------------------
  |  |  |  Branch (3415:29): [True: 0, False: 53]
  |  |  ------------------
  ------------------
 3428|      0|            *(char **)arg = talloc_asprintf(NULL, "16:9");
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3429|     53|        else if (doubles_equal(aspect_ratio, 16.0 / 10.0))
  ------------------
  |  | 3415|     53|#define doubles_equal(x, y) (fabs((x) - (y)) <= 0.001)
  |  |  ------------------
  |  |  |  Branch (3415:29): [True: 0, False: 53]
  |  |  ------------------
  ------------------
 3430|      0|            *(char **)arg = talloc_asprintf(NULL, "16:10");
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3431|     53|        else if (doubles_equal(aspect_ratio, 4.0 / 3.0))
  ------------------
  |  | 3415|     53|#define doubles_equal(x, y) (fabs((x) - (y)) <= 0.001)
  |  |  ------------------
  |  |  |  Branch (3415:29): [True: 0, False: 53]
  |  |  ------------------
  ------------------
 3432|      0|            *(char **)arg = talloc_asprintf(NULL, "4:3");
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3433|     53|        else if (aspect_ratio < 0.0)
  ------------------
  |  Branch (3433:18): [True: 35, False: 18]
  ------------------
 3434|     35|            *(char **)arg = talloc_asprintf(NULL, "Original");
  ------------------
  |  |   52|     35|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     35|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3435|     18|        else
 3436|     18|            *(char **)arg = talloc_asprintf(NULL, "%.3f", aspect_ratio);
  ------------------
  |  |   52|     18|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     18|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3437|       |
 3438|     53|        return M_PROPERTY_OK;
 3439|     53|    }
 3440|    172|    return mp_property_generic_option(mpctx, prop, action, arg);
 3441|    225|}
command.c:mp_property_hwdec_current:
 2459|     18|{
 2460|     18|    MPContext *mpctx = ctx;
 2461|     18|    struct track *track = mpctx->current_track[0][STREAM_VIDEO];
 2462|     18|    struct mp_decoder_wrapper *dec = track ? track->dec : NULL;
  ------------------
  |  Branch (2462:38): [True: 0, False: 18]
  ------------------
 2463|     18|    char *current = NULL;
 2464|       |
 2465|     18|    if (!dec || !mp_decoder_wrapper_control(dec, VDCTRL_GET_HWDEC, &current))
  ------------------
  |  Branch (2465:9): [True: 18, False: 0]
  |  Branch (2465:17): [True: 0, False: 0]
  ------------------
 2466|     18|        return M_PROPERTY_UNAVAILABLE;
 2467|       |
 2468|      0|    if (!current || !current[0])
  ------------------
  |  Branch (2468:9): [True: 0, False: 0]
  |  Branch (2468:21): [True: 0, False: 0]
  ------------------
 2469|      0|        current = "no";
 2470|      0|    return m_property_strdup_ro(action, arg, current);
 2471|     18|}
command.c:mp_property_hwdec_interop:
 2475|     18|{
 2476|     18|    MPContext *mpctx = ctx;
 2477|     18|    if (!mpctx->video_out || !mpctx->video_out->hwdec_devs)
  ------------------
  |  Branch (2477:9): [True: 18, False: 0]
  |  Branch (2477:30): [True: 0, False: 0]
  ------------------
 2478|     18|        return M_PROPERTY_UNAVAILABLE;
 2479|       |
 2480|      0|    char *names = hwdec_devices_get_names(mpctx->video_out->hwdec_devs);
 2481|      0|    int res = m_property_strdup_ro(action, arg, names);
 2482|      0|    talloc_free(names);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 2483|      0|    return res;
 2484|     18|}
command.c:mp_property_frame_count:
 2515|     18|{
 2516|     18|    MPContext *mpctx = ctx;
 2517|     18|    int frames = get_frame_count(mpctx);
 2518|     18|    if (frames < 0)
  ------------------
  |  Branch (2518:9): [True: 18, False: 0]
  ------------------
 2519|     18|        return M_PROPERTY_UNAVAILABLE;
 2520|       |
 2521|      0|    return m_property_int_ro(action, arg, frames);
 2522|     18|}
command.c:mp_property_osd_dim:
 3172|    576|{
 3173|    576|    MPContext *mpctx = ctx;
 3174|       |
 3175|    576|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 3176|    576|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (3176:9): [True: 107, False: 469]
  ------------------
 3177|    107|        return valid;
 3178|       |
 3179|    469|    struct mp_osd_res vo_res = osd_get_vo_res(mpctx->osd);
 3180|       |
 3181|    469|    if (!mpctx->video_out || !mpctx->video_out->config_ok)
  ------------------
  |  Branch (3181:9): [True: 469, False: 0]
  |  Branch (3181:30): [True: 0, False: 0]
  ------------------
 3182|    469|        vo_res = (struct mp_osd_res){0};
 3183|       |
 3184|    469|    double aspect = 1.0 * vo_res.w / MPMAX(vo_res.h, 1) /
  ------------------
  |  |   44|    469|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 469]
  |  |  ------------------
  ------------------
 3185|    469|                    (vo_res.display_par ? vo_res.display_par : 1);
  ------------------
  |  Branch (3185:22): [True: 0, False: 469]
  ------------------
 3186|       |
 3187|    469|    struct m_sub_property props[] = {
 3188|    469|        {"w",       SUB_PROP_INT(vo_res.w)},
  ------------------
  |  |  233|    469|    .type = {.type = CONF_TYPE_INT}, .value = {.int_ = (i)}
  |  |  ------------------
  |  |  |  |  240|    469|#define CONF_TYPE_INT           (&m_option_type_int)
  |  |  ------------------
  ------------------
 3189|    469|        {"h",       SUB_PROP_INT(vo_res.h)},
  ------------------
  |  |  233|    469|    .type = {.type = CONF_TYPE_INT}, .value = {.int_ = (i)}
  |  |  ------------------
  |  |  |  |  240|    469|#define CONF_TYPE_INT           (&m_option_type_int)
  |  |  ------------------
  ------------------
 3190|    469|        {"par",     SUB_PROP_DOUBLE(vo_res.display_par)},
  ------------------
  |  |  241|    469|    .type = {.type = CONF_TYPE_DOUBLE}, .value = {.double_ = (f)}
  |  |  ------------------
  |  |  |  |  243|    469|#define CONF_TYPE_DOUBLE        (&m_option_type_double)
  |  |  ------------------
  ------------------
 3191|    469|        {"aspect",  SUB_PROP_DOUBLE(aspect)},
  ------------------
  |  |  241|    469|    .type = {.type = CONF_TYPE_DOUBLE}, .value = {.double_ = (f)}
  |  |  ------------------
  |  |  |  |  243|    469|#define CONF_TYPE_DOUBLE        (&m_option_type_double)
  |  |  ------------------
  ------------------
 3192|    469|        {"mt",      SUB_PROP_INT(vo_res.mt)},
  ------------------
  |  |  233|    469|    .type = {.type = CONF_TYPE_INT}, .value = {.int_ = (i)}
  |  |  ------------------
  |  |  |  |  240|    469|#define CONF_TYPE_INT           (&m_option_type_int)
  |  |  ------------------
  ------------------
 3193|    469|        {"mb",      SUB_PROP_INT(vo_res.mb)},
  ------------------
  |  |  233|    469|    .type = {.type = CONF_TYPE_INT}, .value = {.int_ = (i)}
  |  |  ------------------
  |  |  |  |  240|    469|#define CONF_TYPE_INT           (&m_option_type_int)
  |  |  ------------------
  ------------------
 3194|    469|        {"ml",      SUB_PROP_INT(vo_res.ml)},
  ------------------
  |  |  233|    469|    .type = {.type = CONF_TYPE_INT}, .value = {.int_ = (i)}
  |  |  ------------------
  |  |  |  |  240|    469|#define CONF_TYPE_INT           (&m_option_type_int)
  |  |  ------------------
  ------------------
 3195|    469|        {"mr",      SUB_PROP_INT(vo_res.mr)},
  ------------------
  |  |  233|    469|    .type = {.type = CONF_TYPE_INT}, .value = {.int_ = (i)}
  |  |  ------------------
  |  |  |  |  240|    469|#define CONF_TYPE_INT           (&m_option_type_int)
  |  |  ------------------
  ------------------
 3196|    469|        {0}
 3197|    469|    };
 3198|       |
 3199|    469|    return m_property_read_sub(props, action, arg);
 3200|    576|}
command.c:mp_property_osd_sym:
 3204|     71|{
 3205|     71|    MPContext *mpctx = ctx;
 3206|     71|    char temp[20];
 3207|     71|    get_current_osd_sym(mpctx, temp, sizeof(temp));
 3208|     71|    return m_property_strdup_ro(action, arg, temp);
 3209|     71|}
command.c:mp_property_osd_ass:
 3213|     67|{
 3214|     67|    struct m_sub_property props[] = {
 3215|     67|        {"0",   SUB_PROP_STR(OSD_ASS_0)},
  ------------------
  |  |  237|     67|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|     67|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 3216|     67|        {"1",   SUB_PROP_STR(OSD_ASS_1)},
  ------------------
  |  |  237|     67|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|     67|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 3217|     67|        {0}
 3218|     67|    };
 3219|     67|    return m_property_read_sub(props, action, arg);
 3220|     67|}
command.c:mp_property_term_clip:
 3224|     64|{
 3225|     64|    return m_property_strdup_ro(action, arg, TERM_MSG_0);
  ------------------
  |  |   30|     64|#define TERM_MSG_0 TERM_MSG_ESCAPE "0"
  |  |  ------------------
  |  |  |  |   29|     64|#define TERM_MSG_ESCAPE "\xC2\x92" "t"
  |  |  ------------------
  ------------------
 3226|     64|}
command.c:mp_property_mouse_pos:
 3255|    242|{
 3256|    242|    MPContext *mpctx = ctx;
 3257|       |
 3258|    242|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 3259|    242|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (3259:9): [True: 163, False: 79]
  ------------------
 3260|    163|        return valid;
 3261|       |
 3262|     79|    int x, y, hover;
 3263|     79|    mp_input_get_mouse_pos(mpctx->input, &x, &y, &hover);
 3264|     79|    struct m_sub_property props[] = {
 3265|     79|        {"x",      SUB_PROP_INT64(x)},
  ------------------
  |  |  235|     79|    .type = {.type = CONF_TYPE_INT64}, .value = {.int64 = (i)}
  |  |  ------------------
  |  |  |  |  241|     79|#define CONF_TYPE_INT64         (&m_option_type_int64)
  |  |  ------------------
  ------------------
 3266|     79|        {"y",      SUB_PROP_INT64(y)},
  ------------------
  |  |  235|     79|    .type = {.type = CONF_TYPE_INT64}, .value = {.int64 = (i)}
  |  |  ------------------
  |  |  |  |  241|     79|#define CONF_TYPE_INT64         (&m_option_type_int64)
  |  |  ------------------
  ------------------
 3267|     79|        {"hover",  SUB_PROP_BOOL(!!hover)},
  ------------------
  |  |  243|     79|    .type = {.type = CONF_TYPE_BOOL}, .value = {.bool_ = (f)}
  |  |  ------------------
  |  |  |  |  238|     79|#define CONF_TYPE_BOOL          (&m_option_type_bool)
  |  |  ------------------
  ------------------
 3268|     79|        {0}
 3269|     79|    };
 3270|       |
 3271|     79|    return m_property_read_sub(props, action, arg);
 3272|    242|}
command.c:mp_property_touch_pos:
 3291|    150|{
 3292|    150|    MPContext *mpctx = ctx;
 3293|       |
 3294|    150|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 3295|    150|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (3295:9): [True: 100, False: 50]
  ------------------
 3296|    100|        return valid;
 3297|       |
 3298|     50|    int xs[MAX_TOUCH_POINTS], ys[MAX_TOUCH_POINTS], ids[MAX_TOUCH_POINTS];
 3299|     50|    int count = mp_input_get_touch_pos(mpctx->input, MAX_TOUCH_POINTS, xs, ys, ids);
  ------------------
  |  | 3288|     50|#define MAX_TOUCH_POINTS 10
  ------------------
 3300|     50|    const int *pos[3] = {xs, ys, ids};
 3301|     50|    return m_property_read_list(action, arg, MPMIN(MAX_TOUCH_POINTS, count),
  ------------------
  |  |   45|     50|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 50, False: 0]
  |  |  ------------------
  ------------------
 3302|     50|                                get_touch_pos, (void *)pos);
 3303|    150|}
command.c:mp_property_tablet_pos:
 3307|    122|{
 3308|    122|    MPContext *mpctx = ctx;
 3309|       |
 3310|    122|    switch (action) {
  ------------------
  |  Branch (3310:13): [True: 60, False: 62]
  ------------------
 3311|     30|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (3311:5): [True: 30, False: 92]
  ------------------
 3312|     30|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE};
  ------------------
  |  |  253|     30|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
 3313|     30|        return M_PROPERTY_OK;
 3314|       |
 3315|     30|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (3315:5): [True: 30, False: 92]
  ------------------
 3316|     30|        int xs, ys;
 3317|     30|        bool tool_in_proximity;
 3318|     30|        bool tool_down;
 3319|     30|        bool tool_stylus_btn1_pressed;
 3320|     30|        bool tool_stylus_btn2_pressed;
 3321|     30|        bool tool_stylus_btn3_pressed;
 3322|     30|        bool pad_focus;
 3323|     30|        bool pad_buttons_pressed[MP_MAX_TABLET_PAD_BUTTONS];
 3324|     30|        int pad_buttons;
 3325|     30|        mp_input_get_tablet_pos(mpctx->input, &xs, &ys, &tool_in_proximity, &tool_down,
 3326|     30|            &tool_stylus_btn1_pressed, &tool_stylus_btn2_pressed, &tool_stylus_btn3_pressed,
 3327|     30|            &pad_focus, pad_buttons_pressed, &pad_buttons);
 3328|       |
 3329|     30|        struct mpv_node node;
 3330|     30|        node_init(&node, MPV_FORMAT_NODE_MAP, NULL);
 3331|     30|        node_map_add_int64(&node, "x", xs);
 3332|     30|        node_map_add_int64(&node, "y", ys);
 3333|     30|        node_map_add_flag(&node, "tool-in-proximity", tool_in_proximity);
 3334|     30|        node_map_add_string(&node, "tool-tip", tool_down ? "down" : "up");
  ------------------
  |  Branch (3334:48): [True: 0, False: 30]
  ------------------
 3335|     30|        node_map_add_string(&node, "tool-stylus-btn1", tool_stylus_btn1_pressed ? "pressed" : "released");
  ------------------
  |  Branch (3335:56): [True: 0, False: 30]
  ------------------
 3336|     30|        node_map_add_string(&node, "tool-stylus-btn2", tool_stylus_btn2_pressed ? "pressed" : "released");
  ------------------
  |  Branch (3336:56): [True: 0, False: 30]
  ------------------
 3337|     30|        node_map_add_string(&node, "tool-stylus-btn3", tool_stylus_btn3_pressed ? "pressed" : "released");
  ------------------
  |  Branch (3337:56): [True: 0, False: 30]
  ------------------
 3338|     30|        node_map_add_flag(&node, "pad-focus", pad_focus);
 3339|       |
 3340|     30|        struct mpv_node *args = node_map_add(&node, "pad-btns", MPV_FORMAT_NODE_MAP);
 3341|     30|        for (int i = 0; i < pad_buttons; i++) {
  ------------------
  |  Branch (3341:25): [True: 0, False: 30]
  ------------------
 3342|      0|            char *name = mp_tprintf(2, "%d", i + 1);
  ------------------
  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  ------------------
 3343|      0|            node_map_add_string(args, name, pad_buttons_pressed[i] ? "pressed" : "released");
  ------------------
  |  Branch (3343:45): [True: 0, False: 0]
  ------------------
 3344|      0|        }
 3345|       |
 3346|     30|        *(struct mpv_node *)arg = node;
 3347|     30|        return M_PROPERTY_OK;
 3348|      0|    }
 3349|    122|    }
 3350|       |
 3351|     62|    return M_PROPERTY_NOT_IMPLEMENTED;
 3352|    122|}
command.c:mp_property_dropped_files:
 3356|     73|{
 3357|     73|    MPContext *mpctx = ctx;
 3358|       |
 3359|     73|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 3360|     73|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (3360:9): [True: 35, False: 38]
  ------------------
 3361|     35|        return valid;
 3362|       |
 3363|     38|    int64_t dnd_ts;
 3364|     38|    enum mp_dnd_action dnd_action;
 3365|     38|    char **dropped_files;
 3366|     38|    void *talloc_ctx = talloc_new(NULL);
  ------------------
  |  |   40|     38|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|     38|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3367|     38|    mp_input_get_dropped_files(mpctx->input, talloc_ctx, &dnd_ts,
 3368|     38|                               &dnd_action, &dropped_files);
 3369|     38|    int r = M_PROPERTY_UNAVAILABLE;
 3370|     38|    if (dnd_action == DND_NONE)
  ------------------
  |  Branch (3370:9): [True: 38, False: 0]
  ------------------
 3371|     38|        goto done;
 3372|       |
 3373|      0|    char *actionstr = dnd_action == DND_REPLACE ? "replace" :
  ------------------
  |  Branch (3373:23): [True: 0, False: 0]
  ------------------
 3374|      0|                      dnd_action == DND_APPEND ? "append" :
  ------------------
  |  Branch (3374:23): [True: 0, False: 0]
  ------------------
 3375|      0|                      dnd_action == DND_INSERT_NEXT ? "insert-next" :
  ------------------
  |  Branch (3375:23): [True: 0, False: 0]
  ------------------
 3376|      0|                      "none";
 3377|       |
 3378|      0|    struct m_sub_property props[] = {
 3379|      0|        {"time",   SUB_PROP_INT64(dnd_ts)},
  ------------------
  |  |  235|      0|    .type = {.type = CONF_TYPE_INT64}, .value = {.int64 = (i)}
  |  |  ------------------
  |  |  |  |  241|      0|#define CONF_TYPE_INT64         (&m_option_type_int64)
  |  |  ------------------
  ------------------
 3380|      0|        {"action", SUB_PROP_STR(actionstr)},
  ------------------
  |  |  237|      0|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|      0|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 3381|      0|        {"files",  SUB_PROP_STRING_LIST(dropped_files)},
  ------------------
  |  |  249|      0|    .type = {.type = CONF_TYPE_STRING_LIST}, .value = {.string_list = (l)}
  |  |  ------------------
  |  |  |  |  245|      0|#define CONF_TYPE_STRING_LIST   (&m_option_type_string_list)
  |  |  ------------------
  ------------------
 3382|      0|        {0}
 3383|      0|    };
 3384|       |
 3385|      0|    r = m_property_read_sub(props, action, arg);
 3386|       |
 3387|     38|done:
 3388|     38|    talloc_free(talloc_ctx);
  ------------------
  |  |   47|     38|#define talloc_free                     ta_free
  ------------------
 3389|     38|    return r;
 3390|      0|}
command.c:mp_property_sub_delay:
 3446|    111|{
 3447|    111|    MPContext *mpctx = ctx;
 3448|    111|    struct MPOpts *opts = mpctx->opts;
 3449|    111|    int track_ind = *(int *)prop->priv;
 3450|    111|    switch (action) {
  ------------------
  |  Branch (3450:13): [True: 35, False: 76]
  ------------------
 3451|     35|    case M_PROPERTY_PRINT:
  ------------------
  |  Branch (3451:5): [True: 35, False: 76]
  ------------------
 3452|     35|        *(char **)arg = format_delay(opts->subs_shared->sub_delay[track_ind]);
 3453|     35|        return M_PROPERTY_OK;
 3454|    111|    }
 3455|     76|    return mp_property_generic_option(mpctx, prop, action, arg);
 3456|    111|}
command.c:mp_property_sub_speed:
 3461|    174|{
 3462|    174|    MPContext *mpctx = ctx;
 3463|    174|    struct MPOpts *opts = mpctx->opts;
 3464|    174|    if (action == M_PROPERTY_PRINT) {
  ------------------
  |  Branch (3464:9): [True: 35, False: 139]
  ------------------
 3465|     35|        *(char **)arg =
 3466|     35|            talloc_asprintf(NULL, "%4.1f%%", 100 * opts->subs_rend->sub_speed);
  ------------------
  |  |   52|     35|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     35|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3467|     35|        return M_PROPERTY_OK;
 3468|     35|    }
 3469|    139|    return mp_property_generic_option(mpctx, prop, action, arg);
 3470|    174|}
command.c:mp_property_sub_pos:
 3474|    219|{
 3475|    219|    MPContext *mpctx = ctx;
 3476|    219|    struct MPOpts *opts = mpctx->opts;
 3477|    219|    int track_ind = *(int *)prop->priv;
 3478|    219|    if (action == M_PROPERTY_PRINT || action == M_PROPERTY_FIXED_LEN_PRINT) {
  ------------------
  |  Branch (3478:9): [True: 19, False: 200]
  |  Branch (3478:39): [True: 10, False: 190]
  ------------------
 3479|     29|        *(char **)arg = mp_format_double(NULL, opts->subs_shared->sub_pos[track_ind], 2,
 3480|     29|                                         false, true, action != M_PROPERTY_FIXED_LEN_PRINT);
 3481|     29|        return M_PROPERTY_OK;
 3482|     29|    }
 3483|    190|    return mp_property_generic_option(mpctx, prop, action, arg);
 3484|    219|}
command.c:mp_property_sub_text:
 3511|    100|{
 3512|    100|    MPContext *mpctx = ctx;
 3513|    100|    const int *def = prop->priv;
 3514|    100|    int sub_index = def[0];
 3515|    100|    int type = def[1];
 3516|       |
 3517|    100|    if (action == M_PROPERTY_KEY_ACTION) {
  ------------------
  |  Branch (3517:9): [True: 82, False: 18]
  ------------------
 3518|     82|        struct m_property_action_arg *ka = arg;
 3519|       |
 3520|     82|        if (!strcmp(ka->key, "ass"))
  ------------------
  |  Branch (3520:13): [True: 18, False: 64]
  ------------------
 3521|     18|            type = SD_TEXT_TYPE_ASS;
 3522|     64|        else if (!strcmp(ka->key, "ass-full"))
  ------------------
  |  Branch (3522:18): [True: 0, False: 64]
  ------------------
 3523|      0|            type = SD_TEXT_TYPE_ASS_FULL;
 3524|     64|        else
 3525|     64|            return M_PROPERTY_UNKNOWN;
 3526|       |
 3527|     18|        action = ka->action;
 3528|     18|        arg = ka->arg;
 3529|     18|    }
 3530|       |
 3531|     36|    struct track *track = mpctx->current_track[sub_index][STREAM_SUB];
 3532|     36|    struct dec_sub *sub = track ? track->d_sub : NULL;
  ------------------
  |  Branch (3532:27): [True: 0, False: 36]
  ------------------
 3533|     36|    double pts = mpctx->playback_pts;
 3534|     36|    if (!sub || pts == MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (3534:9): [True: 36, False: 0]
  |  Branch (3534:17): [True: 0, False: 0]
  ------------------
 3535|     36|        return M_PROPERTY_UNAVAILABLE;
 3536|       |
 3537|      0|    switch (action) {
  ------------------
  |  Branch (3537:13): [True: 0, False: 0]
  ------------------
 3538|      0|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (3538:5): [True: 0, False: 0]
  ------------------
 3539|      0|        char *text = sub_get_text(sub, pts, type);
 3540|      0|        if (!text)
  ------------------
  |  Branch (3540:13): [True: 0, False: 0]
  ------------------
 3541|      0|            text = talloc_strdup(NULL, "");
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
 3542|      0|        *(char **)arg = text;
 3543|      0|        return M_PROPERTY_OK;
 3544|      0|    }
 3545|      0|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (3545:5): [True: 0, False: 0]
  ------------------
 3546|      0|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING};
  ------------------
  |  |  244|      0|#define CONF_TYPE_STRING        (&m_option_type_string)
  ------------------
 3547|      0|        return M_PROPERTY_OK;
 3548|      0|    }
 3549|      0|    return M_PROPERTY_NOT_IMPLEMENTED;
 3550|      0|}
command.c:mp_property_sub_start:
 3568|     18|{
 3569|     18|    double start = get_times(ctx, prop, action, arg).start;
 3570|     18|    if (start == MP_NOPTS_VALUE)
  ------------------
  |  |   39|     18|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (3570:9): [True: 18, False: 0]
  ------------------
 3571|     18|        return M_PROPERTY_UNAVAILABLE;
 3572|      0|    return property_time(action, arg, start);
 3573|     18|}
command.c:get_times:
 3554|     28|{
 3555|     28|    struct sd_times res = { .start = MP_NOPTS_VALUE, .end = MP_NOPTS_VALUE };
  ------------------
  |  |   39|     28|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
                  struct sd_times res = { .start = MP_NOPTS_VALUE, .end = MP_NOPTS_VALUE };
  ------------------
  |  |   39|     28|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
 3556|     28|    MPContext *mpctx = ctx;
 3557|     28|    int track_ind = *(int *)prop->priv;
 3558|     28|    struct track *track = mpctx->current_track[track_ind][STREAM_SUB];
 3559|     28|    struct dec_sub *sub = track ? track->d_sub : NULL;
  ------------------
  |  Branch (3559:27): [True: 0, False: 28]
  ------------------
 3560|     28|    double pts = mpctx->playback_pts;
 3561|     28|    if (!sub || pts == MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (3561:9): [True: 28, False: 0]
  |  Branch (3561:17): [True: 0, False: 0]
  ------------------
 3562|     28|        return res;
 3563|      0|    return sub_get_times(sub, pts);
 3564|     28|}
command.c:mp_property_sub_end:
 3578|     10|{
 3579|     10|    double end = get_times(ctx, prop, action, arg).end;
 3580|     10|    if (end == MP_NOPTS_VALUE)
  ------------------
  |  |   39|     10|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (3580:9): [True: 10, False: 0]
  ------------------
 3581|     10|        return M_PROPERTY_UNAVAILABLE;
 3582|      0|    return property_time(action, arg, end);
 3583|     10|}
command.c:mp_property_sub_lines:
 3587|     18|{
 3588|     18|    MPContext *mpctx = ctx;
 3589|     18|    int sub_index = *(int *)prop->priv;
 3590|     18|    struct track *track = mpctx->current_track[sub_index][STREAM_SUB];
 3591|     18|    struct dec_sub *sub = track ? track->d_sub : NULL;
  ------------------
  |  Branch (3591:27): [True: 0, False: 18]
  ------------------
 3592|     18|    if (!sub)
  ------------------
  |  Branch (3592:9): [True: 18, False: 0]
  ------------------
 3593|     18|        return M_PROPERTY_UNAVAILABLE;
 3594|       |
 3595|      0|    switch (action) {
  ------------------
  |  Branch (3595:13): [True: 0, False: 0]
  ------------------
 3596|      0|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (3596:5): [True: 0, False: 0]
  ------------------
 3597|      0|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE};
  ------------------
  |  |  253|      0|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
 3598|      0|        return M_PROPERTY_OK;
 3599|      0|    case M_PROPERTY_GET:
  ------------------
  |  Branch (3599:5): [True: 0, False: 0]
  ------------------
 3600|      0|    case M_PROPERTY_GET_NODE: {
  ------------------
  |  Branch (3600:5): [True: 0, False: 0]
  ------------------
 3601|      0|        struct sub_lines *lines = sub_get_lines(sub);
 3602|      0|        if (!lines)
  ------------------
  |  Branch (3602:13): [True: 0, False: 0]
  ------------------
 3603|      0|            return M_PROPERTY_UNAVAILABLE;
 3604|       |
 3605|      0|        struct mpv_node *node = arg;
 3606|      0|        node_init(node, MPV_FORMAT_NODE_ARRAY, NULL);
 3607|      0|        for (int i = 0; i < lines->num_entries; i++) {
  ------------------
  |  Branch (3607:25): [True: 0, False: 0]
  ------------------
 3608|      0|            struct sub_line *line = &lines->entries[i];
 3609|      0|            struct mpv_node *entry = node_array_add(node, MPV_FORMAT_NODE_MAP);
 3610|      0|            node_map_add_string(entry, "text", line->text);
 3611|      0|            node_map_add_double(entry, "start", line->start);
 3612|      0|            if (line->end != MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (3612:17): [True: 0, False: 0]
  ------------------
 3613|      0|                node_map_add_double(entry, "end", line->end);
 3614|      0|        }
 3615|      0|        talloc_free(lines);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 3616|      0|        return M_PROPERTY_OK;
 3617|      0|    }
 3618|      0|    case M_PROPERTY_PRINT:
  ------------------
  |  Branch (3618:5): [True: 0, False: 0]
  ------------------
 3619|      0|    case M_PROPERTY_PRINT_UNCUT: {
  ------------------
  |  Branch (3619:5): [True: 0, False: 0]
  ------------------
 3620|      0|        struct sub_lines *lines = sub_get_lines(sub);
 3621|      0|        if (!lines)
  ------------------
  |  Branch (3621:13): [True: 0, False: 0]
  ------------------
 3622|      0|            return M_PROPERTY_UNAVAILABLE;
 3623|       |
 3624|      0|        char *res = talloc_strdup(NULL, "");
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
 3625|      0|        double time_pos = get_playback_time(mpctx);
 3626|      0|        int pos = 0;
 3627|       |
 3628|      0|        for (int i = 0; i < lines->num_entries; i++) {
  ------------------
  |  Branch (3628:25): [True: 0, False: 0]
  ------------------
 3629|      0|            struct sub_line *line = &lines->entries[i];
 3630|      0|            const char *reset = "";
 3631|       |
 3632|      0|            if (line->start <= time_pos && line->end > time_pos) {
  ------------------
  |  Branch (3632:17): [True: 0, False: 0]
  |  Branch (3632:44): [True: 0, False: 0]
  ------------------
 3633|      0|                res = append_selected_style(mpctx, res);
 3634|      0|                reset = get_style_reset(mpctx);
 3635|      0|            }
 3636|       |
 3637|      0|            res = talloc_asprintf_append(res, "%s%s\n", line->text, reset);
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 3638|       |
 3639|      0|            if (line->start <= time_pos && i)
  ------------------
  |  Branch (3639:17): [True: 0, False: 0]
  |  Branch (3639:44): [True: 0, False: 0]
  ------------------
 3640|      0|                pos += count_lines(lines->entries[i - 1].text);
 3641|      0|        }
 3642|       |
 3643|      0|        *(char **)arg = cut_osd_list(mpctx, action, "Subtitle lines", res, pos);
 3644|      0|        talloc_free(lines);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 3645|      0|        return M_PROPERTY_OK;
 3646|      0|    }
 3647|      0|    }
 3648|      0|    return M_PROPERTY_NOT_IMPLEMENTED;
 3649|      0|}
command.c:mp_property_vf:
 3863|    371|{
 3864|    371|    return property_filter(prop, action, arg, ctx, STREAM_VIDEO);
 3865|    371|}
command.c:property_filter:
 3851|    728|{
 3852|    728|    if (action == M_PROPERTY_PRINT) {
  ------------------
  |  Branch (3852:9): [True: 114, False: 614]
  ------------------
 3853|    114|        struct m_config_option *opt = m_config_get_co(mpctx->mconfig,
 3854|    114|                                                      bstr0(prop->name));
 3855|    114|        *(char **)arg = print_obj_osd_list(*(struct m_obj_settings **)opt->data);
 3856|    114|        return M_PROPERTY_OK;
 3857|    114|    }
 3858|    614|    return mp_property_generic_option(mpctx, prop, action, arg);
 3859|    728|}
command.c:print_obj_osd_list:
 3830|    114|{
 3831|    114|    char *res = NULL;
 3832|    190|    for (int n = 0; list && list[n].name; n++) {
  ------------------
  |  Branch (3832:21): [True: 152, False: 38]
  |  Branch (3832:29): [True: 76, False: 76]
  ------------------
 3833|     76|        res = talloc_asprintf_append(res, "%s [", list[n].name);
  ------------------
  |  |   63|     76|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 3834|    154|        for (int i = 0; list[n].attribs && list[n].attribs[i]; i += 2) {
  ------------------
  |  Branch (3834:25): [True: 121, False: 33]
  |  Branch (3834:44): [True: 78, False: 43]
  ------------------
 3835|     78|            res = talloc_asprintf_append(res, "%s%s=%s", i > 0 ? " " : "",
  ------------------
  |  |   63|     78|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
  |  Branch (3835:58): [True: 35, False: 43]
  ------------------
 3836|     78|                                         list[n].attribs[i],
 3837|     78|                                         list[n].attribs[i + 1]);
 3838|     78|        }
 3839|     76|        res = talloc_asprintf_append(res, "]");
  ------------------
  |  |   63|     76|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
 3840|     76|        if (!list[n].enabled)
  ------------------
  |  Branch (3840:13): [True: 12, False: 64]
  ------------------
 3841|     12|            res = talloc_strdup_append(res, " (disabled)");
  ------------------
  |  |   57|     12|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 3842|     76|        res = talloc_strdup_append(res, "\n");
  ------------------
  |  |   57|     76|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
 3843|     76|    }
 3844|    114|    if (!res)
  ------------------
  |  Branch (3844:9): [True: 39, False: 75]
  ------------------
 3845|     39|        res = talloc_strdup(NULL, "(empty)");
  ------------------
  |  |   50|     39|#define talloc_strdup                   ta_xstrdup
  ------------------
 3846|    114|    return res;
 3847|    114|}
command.c:mp_property_af:
 3869|    357|{
 3870|    357|    return property_filter(prop, action, arg, ctx, STREAM_AUDIO);
 3871|    357|}
command.c:mp_property_ab_loop:
 3875|    446|{
 3876|    446|    struct MPContext *mpctx = ctx;
 3877|    446|    if (action == M_PROPERTY_KEY_ACTION) {
  ------------------
  |  Branch (3877:9): [True: 66, False: 380]
  ------------------
 3878|     66|        double val;
 3879|     66|        if (mp_property_generic_option(mpctx, prop, M_PROPERTY_GET, &val) < 1)
  ------------------
  |  Branch (3879:13): [True: 0, False: 66]
  ------------------
 3880|      0|            return M_PROPERTY_ERROR;
 3881|       |
 3882|     66|        return property_time(action, arg, val);
 3883|     66|    }
 3884|    380|    return mp_property_generic_option(mpctx, prop, action, arg);
 3885|    446|}
command.c:mp_property_packet_bitrate:
 3889|     18|{
 3890|     18|    MPContext *mpctx = ctx;
 3891|     18|    int type = *(int *)prop->priv;
 3892|       |
 3893|     18|    struct demuxer *demuxer = NULL;
 3894|     18|    if (mpctx->current_track[0][type])
  ------------------
  |  Branch (3894:9): [True: 0, False: 18]
  ------------------
 3895|      0|        demuxer = mpctx->current_track[0][type]->demuxer;
 3896|     18|    if (!demuxer)
  ------------------
  |  Branch (3896:9): [True: 18, False: 0]
  ------------------
 3897|     18|        demuxer = mpctx->demuxer;
 3898|     18|    if (!demuxer)
  ------------------
  |  Branch (3898:9): [True: 18, False: 0]
  ------------------
 3899|     18|        return M_PROPERTY_UNAVAILABLE;
 3900|       |
 3901|      0|    double r[STREAM_TYPE_COUNT];
 3902|      0|    demux_get_bitrate_stats(demuxer, r);
 3903|      0|    if (r[type] < 0)
  ------------------
  |  Branch (3903:9): [True: 0, False: 0]
  ------------------
 3904|      0|        return M_PROPERTY_UNAVAILABLE;
 3905|       |
 3906|       |    // r[type] is in bytes/second -> bits
 3907|      0|    double rate = r[type] * 8;
 3908|       |
 3909|      0|    if (action == M_PROPERTY_PRINT) {
  ------------------
  |  Branch (3909:9): [True: 0, False: 0]
  ------------------
 3910|      0|        rate /= 1000;
 3911|      0|        if (rate < 1000) {
  ------------------
  |  Branch (3911:13): [True: 0, False: 0]
  ------------------
 3912|      0|            *(char **)arg = talloc_asprintf(NULL, "%.f kbps", rate);
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3913|      0|        } else {
 3914|      0|            *(char **)arg = talloc_asprintf(NULL, "%.3f Mbps", rate / 1000.0);
  ------------------
  |  |   52|      0|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      0|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
 3915|      0|        }
 3916|      0|        return M_PROPERTY_OK;
 3917|      0|    }
 3918|      0|    return m_property_int64_ro(action, arg, llrint(rate));
 3919|      0|}
command.c:mp_property_focused:
 3013|     18|{
 3014|     18|    MPContext *mpctx = ctx;
 3015|     18|    struct vo *vo = mpctx->video_out;
 3016|     18|    if (!vo)
  ------------------
  |  Branch (3016:9): [True: 18, False: 0]
  ------------------
 3017|     18|        return M_PROPERTY_UNAVAILABLE;
 3018|       |
 3019|     18|    bool focused;
 3020|      0|    if (vo_control(vo, VOCTRL_GET_FOCUSED, &focused) < 1)
  ------------------
  |  Branch (3020:9): [True: 0, False: 0]
  ------------------
 3021|      0|        return M_PROPERTY_UNAVAILABLE;
 3022|       |
 3023|      0|    return m_property_bool_ro(action, arg, focused);
 3024|      0|}
command.c:mp_property_display_fps:
 2894|     83|{
 2895|     83|    MPContext *mpctx = ctx;
 2896|     83|    double fps = mpctx->video_out ? vo_get_display_fps(mpctx->video_out) : 0;
  ------------------
  |  Branch (2896:18): [True: 0, False: 83]
  ------------------
 2897|     83|    switch (action) {
  ------------------
  |  Branch (2897:13): [True: 42, False: 41]
  ------------------
 2898|     21|    case M_PROPERTY_GET:
  ------------------
  |  Branch (2898:5): [True: 21, False: 62]
  ------------------
 2899|     21|        if (fps <= 0)
  ------------------
  |  Branch (2899:13): [True: 21, False: 0]
  ------------------
 2900|     21|            return M_PROPERTY_UNAVAILABLE;
 2901|      0|        return m_property_double_ro(action, arg, fps);
 2902|     21|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (2902:5): [True: 21, False: 62]
  ------------------
 2903|     21|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_DOUBLE};
  ------------------
  |  |  243|     21|#define CONF_TYPE_DOUBLE        (&m_option_type_double)
  ------------------
 2904|     21|        return M_PROPERTY_OK;
 2905|     83|    }
 2906|     41|    return M_PROPERTY_NOT_IMPLEMENTED;
 2907|     83|}
command.c:mp_property_estimated_display_fps:
 2911|     18|{
 2912|     18|    MPContext *mpctx = ctx;
 2913|     18|    struct vo *vo = mpctx->video_out;
 2914|     18|    if (!vo)
  ------------------
  |  Branch (2914:9): [True: 18, False: 0]
  ------------------
 2915|     18|        return M_PROPERTY_UNAVAILABLE;
 2916|      0|    double interval = vo_get_estimated_vsync_interval(vo) / 1e9;
 2917|      0|    if (interval <= 0)
  ------------------
  |  Branch (2917:9): [True: 0, False: 0]
  ------------------
 2918|      0|        return M_PROPERTY_UNAVAILABLE;
 2919|      0|    return m_property_double_ro(action, arg, 1.0 / interval);
 2920|      0|}
command.c:mp_property_vsync_jitter:
 2924|     18|{
 2925|     18|    MPContext *mpctx = ctx;
 2926|     18|    struct vo *vo = mpctx->video_out;
 2927|     18|    if (!vo)
  ------------------
  |  Branch (2927:9): [True: 18, False: 0]
  ------------------
 2928|     18|        return M_PROPERTY_UNAVAILABLE;
 2929|      0|    double stddev = vo_get_estimated_vsync_jitter(vo);
 2930|      0|    if (stddev < 0)
  ------------------
  |  Branch (2930:9): [True: 0, False: 0]
  ------------------
 2931|      0|        return M_PROPERTY_UNAVAILABLE;
 2932|      0|    return m_property_double_ro(action, arg, stddev);
 2933|      0|}
command.c:mp_property_hidpi_scale:
 2954|      1|{
 2955|      1|    MPContext *mpctx = ctx;
 2956|      1|    struct command_ctx *cmd = mpctx->command_ctx;
 2957|      1|    struct vo *vo = mpctx->video_out;
 2958|      1|    if (!vo)
  ------------------
  |  Branch (2958:9): [True: 1, False: 0]
  ------------------
 2959|      1|        return M_PROPERTY_UNAVAILABLE;
 2960|      0|    if (!cmd->cached_window_scale) {
  ------------------
  |  Branch (2960:9): [True: 0, False: 0]
  ------------------
 2961|      0|        double scale = 0;
 2962|      0|        if (vo_control(vo, VOCTRL_GET_HIDPI_SCALE, &scale) < 1 || !scale)
  ------------------
  |  Branch (2962:13): [True: 0, False: 0]
  |  Branch (2962:67): [True: 0, False: 0]
  ------------------
 2963|      0|            scale = -1;
 2964|      0|        cmd->cached_window_scale = scale;
 2965|      0|    }
 2966|      0|    if (cmd->cached_window_scale < 0)
  ------------------
  |  Branch (2966:9): [True: 0, False: 0]
  ------------------
 2967|      0|        return M_PROPERTY_UNAVAILABLE;
 2968|      0|    return m_property_double_ro(action, arg, cmd->cached_window_scale);
 2969|      0|}
command.c:mp_property_ambient_light:
 2993|     37|{
 2994|     37|    MPContext *mpctx = ctx;
 2995|     37|    if (!mpctx->als_state) {
  ------------------
  |  Branch (2995:9): [True: 12, False: 25]
  ------------------
 2996|     12|        mpctx->als_state = mp_als_create(mpctx, mpctx);
 2997|     12|    }
 2998|       |
 2999|     37|    double lux;
 3000|     37|    switch (mp_als_get_lux(mpctx->als_state, &lux)) {
 3001|      0|    case MP_ALS_STATUS_OK:
  ------------------
  |  Branch (3001:5): [True: 0, False: 37]
  ------------------
 3002|      0|        return m_property_double_ro(action, arg, lux);
 3003|     37|    case MP_ALS_STATUS_NODEVICE:
  ------------------
  |  Branch (3003:5): [True: 37, False: 0]
  ------------------
 3004|     37|        return M_PROPERTY_UNAVAILABLE;
 3005|      0|    case MP_ALS_STATUS_READFAILED:
  ------------------
  |  Branch (3005:5): [True: 0, False: 37]
  ------------------
 3006|      0|    default:
  ------------------
  |  Branch (3006:5): [True: 0, False: 37]
  ------------------
 3007|      0|        return M_PROPERTY_ERROR;
 3008|     37|    }
 3009|     37|}
command.c:mp_property_cwd:
 3923|     84|{
 3924|     84|    switch (action) {
  ------------------
  |  Branch (3924:13): [True: 40, False: 44]
  ------------------
 3925|     20|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (3925:5): [True: 20, False: 64]
  ------------------
 3926|     20|        char *cwd = mp_getcwd(NULL);
 3927|     20|        if (!cwd)
  ------------------
  |  Branch (3927:13): [True: 0, False: 20]
  ------------------
 3928|      0|            return M_PROPERTY_ERROR;
 3929|     20|        *(char **)arg = cwd;
 3930|     20|        return M_PROPERTY_OK;
 3931|     20|    }
 3932|     20|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (3932:5): [True: 20, False: 64]
  ------------------
 3933|     20|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING};
  ------------------
  |  |  244|     20|#define CONF_TYPE_STRING        (&m_option_type_string)
  ------------------
 3934|     20|        return M_PROPERTY_OK;
 3935|     84|    }
 3936|     44|    return M_PROPERTY_NOT_IMPLEMENTED;
 3937|     84|}
command.c:mp_property_protocols:
 3951|     89|{
 3952|     89|    switch (action) {
  ------------------
  |  Branch (3952:13): [True: 44, False: 45]
  ------------------
 3953|     22|    case M_PROPERTY_GET:
  ------------------
  |  Branch (3953:5): [True: 22, False: 67]
  ------------------
 3954|     22|        *(char ***)arg = stream_get_proto_list(false);
 3955|     22|        return M_PROPERTY_OK;
 3956|     22|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (3956:5): [True: 22, False: 67]
  ------------------
 3957|     22|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING_LIST};
  ------------------
  |  |  245|     22|#define CONF_TYPE_STRING_LIST   (&m_option_type_string_list)
  ------------------
 3958|     22|        return M_PROPERTY_OK;
 3959|     89|    }
 3960|     45|    return M_PROPERTY_NOT_IMPLEMENTED;
 3961|     89|}
command.c:mp_property_decoders:
 3994|  1.39k|{
 3995|  1.39k|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 3996|  1.39k|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (3996:9): [True: 638, False: 754]
  ------------------
 3997|    638|        return valid;
 3998|       |
 3999|    754|    struct mp_decoder_list *codecs = talloc_zero(NULL, struct mp_decoder_list);
  ------------------
  |  |   27|    754|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|    754|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|    754|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4000|    754|    struct mp_decoder_list *v = talloc_steal(codecs, video_decoder_list());
  ------------------
  |  |   38|    754|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|    754|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
 4001|    754|    struct mp_decoder_list *a = talloc_steal(codecs, audio_decoder_list());
  ------------------
  |  |   38|    754|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|    754|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
 4002|    754|    mp_append_decoders(codecs, v);
 4003|    754|    mp_append_decoders(codecs, a);
 4004|    754|    int r = m_property_read_list(action, arg, codecs->num_entries,
 4005|    754|                                 get_decoder_entry, codecs);
 4006|    754|    talloc_free(codecs);
  ------------------
  |  |   47|    754|#define talloc_free                     ta_free
  ------------------
 4007|    754|    return r;
 4008|  1.39k|}
command.c:get_decoder_entry:
 3978|   126k|{
 3979|   126k|    struct mp_decoder_list *codecs = ctx;
 3980|   126k|    struct mp_decoder_entry *c = &codecs->entries[item];
 3981|       |
 3982|   126k|    struct m_sub_property props[] = {
 3983|   126k|        {"codec",       SUB_PROP_STR(c->codec)},
  ------------------
  |  |  237|   126k|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|   126k|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 3984|   126k|        {"driver" ,     SUB_PROP_STR(c->decoder)},
  ------------------
  |  |  237|   126k|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|   126k|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 3985|   126k|        {"description", SUB_PROP_STR(c->desc)},
  ------------------
  |  |  237|   126k|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|   126k|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 3986|   126k|        {0}
 3987|   126k|    };
 3988|       |
 3989|   126k|    return m_property_read_sub(props, action, arg);
 3990|   126k|}
command.c:mp_property_encoders:
 4012|    166|{
 4013|    166|    int valid = m_property_read_sub_validate(ctx, prop, action, arg);
 4014|    166|    if (valid != M_PROPERTY_VALID)
  ------------------
  |  Branch (4014:9): [True: 120, False: 46]
  ------------------
 4015|    120|        return valid;
 4016|       |
 4017|     46|    struct mp_decoder_list *codecs = talloc_zero(NULL, struct mp_decoder_list);
  ------------------
  |  |   27|     46|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|     46|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|     46|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4018|     46|    mp_add_lavc_encoders(codecs);
 4019|     46|    int r = m_property_read_list(action, arg, codecs->num_entries,
 4020|     46|                                 get_decoder_entry, codecs);
 4021|     46|    talloc_free(codecs);
  ------------------
  |  |   47|     46|#define talloc_free                     ta_free
  ------------------
 4022|     46|    return r;
 4023|    166|}
command.c:mp_property_lavf_demuxers:
 4027|    205|{
 4028|    205|    switch (action) {
  ------------------
  |  Branch (4028:13): [True: 102, False: 103]
  ------------------
 4029|     51|    case M_PROPERTY_GET:
  ------------------
  |  Branch (4029:5): [True: 51, False: 154]
  ------------------
 4030|     51|        *(char ***)arg = mp_get_lavf_demuxers();
 4031|     51|        return M_PROPERTY_OK;
 4032|     51|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (4032:5): [True: 51, False: 154]
  ------------------
 4033|     51|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING_LIST};
  ------------------
  |  |  245|     51|#define CONF_TYPE_STRING_LIST   (&m_option_type_string_list)
  ------------------
 4034|     51|        return M_PROPERTY_OK;
 4035|    205|    }
 4036|    103|    return M_PROPERTY_NOT_IMPLEMENTED;
 4037|    205|}
command.c:mp_property_keylist:
 3965|    181|{
 3966|    181|    switch (action) {
  ------------------
  |  Branch (3966:13): [True: 90, False: 91]
  ------------------
 3967|     45|    case M_PROPERTY_GET:
  ------------------
  |  Branch (3967:5): [True: 45, False: 136]
  ------------------
 3968|     45|        *(char ***)arg = mp_get_key_list();
 3969|     45|        return M_PROPERTY_OK;
 3970|     45|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (3970:5): [True: 45, False: 136]
  ------------------
 3971|     45|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING_LIST};
  ------------------
  |  |  245|     45|#define CONF_TYPE_STRING_LIST   (&m_option_type_string_list)
  ------------------
 3972|     45|        return M_PROPERTY_OK;
 3973|    181|    }
 3974|     91|    return M_PROPERTY_NOT_IMPLEMENTED;
 3975|    181|}
command.c:mp_property_version:
 4041|     66|{
 4042|     66|    return m_property_strdup_ro(action, arg, mpv_version);
 4043|     66|}
command.c:mp_property_ffmpeg:
 4053|     64|{
 4054|     64|    return m_property_strdup_ro(action, arg, av_version_info());
 4055|     64|}
command.c:mp_property_libass_version:
 4059|     71|{
 4060|     71|    return m_property_int64_ro(action, arg, ass_library_version());
 4061|     71|}
command.c:mp_property_platform:
 4084|     98|{
 4085|     98|    return m_property_strdup_ro(action, arg, PLATFORM);
  ------------------
  |  |  284|     98|#define PLATFORM "linux"
  ------------------
 4086|     98|}
command.c:mp_property_options:
 4161|    368|{
 4162|    368|    MPContext *mpctx = ctx;
 4163|       |    return access_option_list(action, arg, false, mpctx);
 4164|    368|}
command.c:access_option_list:
 4144|    368|{
 4145|    368|    switch (action) {
  ------------------
  |  Branch (4145:13): [True: 250, False: 118]
  ------------------
 4146|     62|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (4146:5): [True: 62, False: 306]
  ------------------
 4147|     62|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING_LIST};
  ------------------
  |  |  245|     62|#define CONF_TYPE_STRING_LIST   (&m_option_type_string_list)
  ------------------
 4148|     62|        return M_PROPERTY_OK;
 4149|     62|    case M_PROPERTY_GET:
  ------------------
  |  Branch (4149:5): [True: 62, False: 306]
  ------------------
 4150|     62|        *(char ***)arg = m_config_list_options(NULL, mpctx->mconfig);
 4151|     62|        return M_PROPERTY_OK;
 4152|    126|    case M_PROPERTY_KEY_ACTION:
  ------------------
  |  Branch (4152:5): [True: 126, False: 242]
  ------------------
 4153|    126|        return access_options(arg, local, mpctx);
 4154|    368|    }
 4155|    118|    return M_PROPERTY_NOT_IMPLEMENTED;
 4156|    368|}
command.c:access_options:
 4116|    126|{
 4117|    126|    struct m_config_option *opt = m_config_get_co(mpctx->mconfig,
 4118|    126|                                                  bstr0(ka->key));
 4119|    126|    if (!opt)
  ------------------
  |  Branch (4119:9): [True: 26, False: 100]
  ------------------
 4120|     26|        return M_PROPERTY_UNKNOWN;
 4121|    100|    if (!opt->data)
  ------------------
  |  Branch (4121:9): [True: 18, False: 82]
  ------------------
 4122|     18|        return M_PROPERTY_UNAVAILABLE;
 4123|       |
 4124|     82|    switch (ka->action) {
  ------------------
  |  Branch (4124:13): [True: 42, False: 40]
  ------------------
 4125|     21|    case M_PROPERTY_GET:
  ------------------
  |  Branch (4125:5): [True: 21, False: 61]
  ------------------
 4126|     21|        m_option_copy(opt->opt, ka->arg, opt->data);
 4127|     21|        return M_PROPERTY_OK;
 4128|      0|    case M_PROPERTY_SET: {
  ------------------
  |  Branch (4128:5): [True: 0, False: 82]
  ------------------
 4129|      0|        if (local && !mpctx->playing)
  ------------------
  |  Branch (4129:13): [True: 0, False: 0]
  |  Branch (4129:22): [True: 0, False: 0]
  ------------------
 4130|      0|            return M_PROPERTY_ERROR;
 4131|      0|        int flags = local ? M_SETOPT_BACKUP : 0;
  ------------------
  |  Branch (4131:21): [True: 0, False: 0]
  ------------------
 4132|      0|        int r = m_config_set_option_raw(mpctx->mconfig, opt, ka->arg, flags);
 4133|      0|        mp_wakeup_core(mpctx);
 4134|      0|        return r < 0 ? M_PROPERTY_ERROR : M_PROPERTY_OK;
  ------------------
  |  Branch (4134:16): [True: 0, False: 0]
  ------------------
 4135|      0|    }
 4136|     21|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (4136:5): [True: 21, False: 61]
  ------------------
 4137|     21|        *(struct m_option *)ka->arg = *opt->opt;
 4138|     21|        return M_PROPERTY_OK;
 4139|     82|    }
 4140|     40|    return M_PROPERTY_NOT_IMPLEMENTED;
 4141|     82|}
command.c:mp_property_option_info:
 4175|    197|{
 4176|    197|    MPContext *mpctx = ctx;
 4177|    197|    switch (action) {
  ------------------
  |  Branch (4177:13): [True: 187, False: 10]
  ------------------
 4178|    187|    case M_PROPERTY_KEY_ACTION: {
  ------------------
  |  Branch (4178:5): [True: 187, False: 10]
  ------------------
 4179|    187|        struct m_property_action_arg *ka = arg;
 4180|    187|        bstr key;
 4181|    187|        const char *rem;
 4182|    187|        m_property_split_path(ka->key, &key, &rem);
 4183|    187|        struct m_config_option *co = m_config_get_co(mpctx->mconfig, key);
 4184|    187|        if (!co)
  ------------------
  |  Branch (4184:13): [True: 25, False: 162]
  ------------------
 4185|     25|            return M_PROPERTY_UNKNOWN;
 4186|    162|        const struct m_option *opt = co->opt;
 4187|       |
 4188|    162|        union m_option_value def = m_option_value_default;
 4189|    162|        const void *def_ptr = m_config_get_co_default(mpctx->mconfig, co);
 4190|    162|        bool has_default = def_ptr && opt->type->size > 0;
  ------------------
  |  Branch (4190:28): [True: 159, False: 3]
  |  Branch (4190:39): [True: 159, False: 0]
  ------------------
 4191|    162|        if (has_default)
  ------------------
  |  Branch (4191:13): [True: 159, False: 3]
  ------------------
 4192|    159|            memcpy(&def, def_ptr, opt->type->size);
 4193|       |
 4194|    162|        bool has_minmax = opt->min < opt->max &&
  ------------------
  |  Branch (4194:27): [True: 0, False: 162]
  ------------------
 4195|      0|            (opt->type->flags & M_OPT_TYPE_USES_RANGE);
  ------------------
  |  |  515|      0|#define M_OPT_TYPE_USES_RANGE           (1 << 2)
  ------------------
  |  Branch (4195:13): [True: 0, False: 0]
  ------------------
 4196|    162|        char **choices = NULL;
 4197|       |
 4198|    162|        if (opt->type == &m_option_type_choice) {
  ------------------
  |  Branch (4198:13): [True: 0, False: 162]
  ------------------
 4199|      0|            const struct m_opt_choice_alternatives *alt = opt->priv;
 4200|      0|            int num = 0;
 4201|      0|            for ( ; alt->name; alt++)
  ------------------
  |  Branch (4201:21): [True: 0, False: 0]
  ------------------
 4202|      0|                MP_TARRAY_APPEND(NULL, choices, num, alt->name);
  ------------------
  |  |  105|      0|    do {                                            \
  |  |  106|      0|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      0|    do {                                            \
  |  |  |  |   97|      0|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      0|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      0|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|      0|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      0|        (idxvar)++;                                 \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4203|      0|            MP_TARRAY_APPEND(NULL, choices, num, NULL);
  ------------------
  |  |  105|      0|    do {                                            \
  |  |  106|      0|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      0|    do {                                            \
  |  |  |  |   97|      0|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      0|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      0|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|      0|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      0|        (idxvar)++;                                 \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4204|      0|        }
 4205|    162|        if (opt->type == &m_option_type_obj_settings_list) {
  ------------------
  |  Branch (4205:13): [True: 9, False: 153]
  ------------------
 4206|      9|            const struct m_obj_list *objs = opt->priv;
 4207|      9|            int num = 0;
 4208|     81|            for (int n = 0; ; n++) {
 4209|     81|                struct m_obj_desc desc = {0};
 4210|     81|                if (!objs->get_desc(&desc, n))
  ------------------
  |  Branch (4210:21): [True: 9, False: 72]
  ------------------
 4211|      9|                    break;
 4212|     72|                MP_TARRAY_APPEND(NULL, choices, num, (char *)desc.name);
  ------------------
  |  |  105|     72|    do {                                            \
  |  |  106|     72|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|     72|    do {                                            \
  |  |  |  |   97|     72|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|     72|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|     72|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|     72|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 27, False: 45]
  |  |  |  |  ------------------
  |  |  |  |   99|     72|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|     27|    do {                                                        \
  |  |  |  |  |  |   89|     27|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|     27|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|     27|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|     27|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|     27|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|     27|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|     27|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 27]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|     72|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 72]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|     72|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|     72|        (idxvar)++;                                 \
  |  |  109|     72|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 72]
  |  |  ------------------
  ------------------
 4213|     72|            }
 4214|      9|            if (objs->get_lavfi_filters) {
  ------------------
  |  Branch (4214:17): [True: 0, False: 9]
  ------------------
 4215|      0|                const char **filters = objs->get_lavfi_filters(choices);
 4216|      0|                for (int n = 0; filters[n]; n++) {
  ------------------
  |  Branch (4216:33): [True: 0, False: 0]
  ------------------
 4217|      0|                    MP_TARRAY_APPEND(NULL, choices, num, (char *)filters[n]);
  ------------------
  |  |  105|      0|    do {                                            \
  |  |  106|      0|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      0|    do {                                            \
  |  |  |  |   97|      0|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      0|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      0|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|      0|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      0|        (idxvar)++;                                 \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4218|      0|                }
 4219|      0|            }
 4220|      9|            MP_TARRAY_APPEND(NULL, choices, num, NULL);
  ------------------
  |  |  105|      9|    do {                                            \
  |  |  106|      9|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      9|    do {                                            \
  |  |  |  |   97|      9|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      9|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      9|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      9|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 9]
  |  |  |  |  ------------------
  |  |  |  |   99|      9|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      9|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      9|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      9|        (idxvar)++;                                 \
  |  |  109|      9|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 9]
  |  |  ------------------
  ------------------
 4221|      9|        }
 4222|       |
 4223|    162|        struct m_sub_property props[] = {
 4224|    162|            {"name",                    SUB_PROP_STR(co->name)},
  ------------------
  |  |  237|    162|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|    162|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 4225|    162|            {"type",                    SUB_PROP_STR(opt->type->name)},
  ------------------
  |  |  237|    162|    .type = {.type = CONF_TYPE_STRING}, .value = {.string = (char *)(s)}
  |  |  ------------------
  |  |  |  |  244|    162|#define CONF_TYPE_STRING        (&m_option_type_string)
  |  |  ------------------
  ------------------
 4226|    162|            {"set-from-commandline",    SUB_PROP_BOOL(co->is_set_from_cmdline)},
  ------------------
  |  |  243|    162|    .type = {.type = CONF_TYPE_BOOL}, .value = {.bool_ = (f)}
  |  |  ------------------
  |  |  |  |  238|    162|#define CONF_TYPE_BOOL          (&m_option_type_bool)
  |  |  ------------------
  ------------------
 4227|    162|            {"set-locally",             SUB_PROP_BOOL(co->is_set_locally)},
  ------------------
  |  |  243|    162|    .type = {.type = CONF_TYPE_BOOL}, .value = {.bool_ = (f)}
  |  |  ------------------
  |  |  |  |  238|    162|#define CONF_TYPE_BOOL          (&m_option_type_bool)
  |  |  ------------------
  ------------------
 4228|    162|            {"expects-file",            SUB_PROP_BOOL(opt->flags & M_OPT_FILE)},
  ------------------
  |  |  243|    162|    .type = {.type = CONF_TYPE_BOOL}, .value = {.bool_ = (f)}
  |  |  ------------------
  |  |  |  |  238|    162|#define CONF_TYPE_BOOL          (&m_option_type_bool)
  |  |  ------------------
  ------------------
 4229|    162|            {"default-value",           *opt, def, .unavailable = !has_default},
 4230|    162|            {"min",                     SUB_PROP_DOUBLE(opt->min),
  ------------------
  |  |  241|    162|    .type = {.type = CONF_TYPE_DOUBLE}, .value = {.double_ = (f)}
  |  |  ------------------
  |  |  |  |  243|    162|#define CONF_TYPE_DOUBLE        (&m_option_type_double)
  |  |  ------------------
  ------------------
 4231|    162|             .unavailable = !(has_minmax && opt->min != DBL_MIN)},
  ------------------
  |  Branch (4231:31): [True: 0, False: 162]
  |  Branch (4231:45): [True: 0, False: 0]
  ------------------
 4232|    162|            {"max",                     SUB_PROP_DOUBLE(opt->max),
  ------------------
  |  |  241|    162|    .type = {.type = CONF_TYPE_DOUBLE}, .value = {.double_ = (f)}
  |  |  ------------------
  |  |  |  |  243|    162|#define CONF_TYPE_DOUBLE        (&m_option_type_double)
  |  |  ------------------
  ------------------
 4233|    162|             .unavailable = !(has_minmax && opt->max != DBL_MAX)},
  ------------------
  |  Branch (4233:31): [True: 0, False: 162]
  |  Branch (4233:45): [True: 0, False: 0]
  ------------------
 4234|    162|            {"choices",                 SUB_PROP_STRING_LIST(choices),
  ------------------
  |  |  249|    162|    .type = {.type = CONF_TYPE_STRING_LIST}, .value = {.string_list = (l)}
  |  |  ------------------
  |  |  |  |  245|    162|#define CONF_TYPE_STRING_LIST   (&m_option_type_string_list)
  |  |  ------------------
  ------------------
 4235|    162|             .unavailable = !choices},
 4236|    162|            {0}
 4237|    162|        };
 4238|       |
 4239|    162|        struct m_property_action_arg next_ka = *ka;
 4240|    162|        next_ka.key = rem;
 4241|    162|        int r = m_property_read_sub(props, M_PROPERTY_KEY_ACTION, &next_ka);
 4242|    162|        talloc_free(choices);
  ------------------
  |  |   47|    162|#define talloc_free                     ta_free
  ------------------
 4243|    162|        return r;
 4244|    187|    }
 4245|    197|    }
 4246|     10|    return M_PROPERTY_NOT_IMPLEMENTED;
 4247|    197|}
command.c:mp_property_list:
 4251|    233|{
 4252|    233|    struct MPContext *mpctx = ctx;
 4253|    233|    struct command_ctx *cmd = mpctx->command_ctx;
 4254|       |
 4255|    233|    switch (action) {
  ------------------
  |  Branch (4255:13): [True: 136, False: 97]
  ------------------
 4256|     68|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (4256:5): [True: 68, False: 165]
  ------------------
 4257|     68|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING_LIST};
  ------------------
  |  |  245|     68|#define CONF_TYPE_STRING_LIST   (&m_option_type_string_list)
  ------------------
 4258|     68|        return M_PROPERTY_OK;
 4259|     68|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (4259:5): [True: 68, False: 165]
  ------------------
 4260|     68|        char **list = NULL;
 4261|     68|        int num = 0;
 4262|  63.1k|        for (int n = 0; n < cmd->properties.num; n++) {
  ------------------
  |  Branch (4262:25): [True: 63.0k, False: 68]
  ------------------
 4263|  63.0k|            MP_TARRAY_APPEND(NULL, list, num,
  ------------------
  |  |  105|  63.0k|    do {                                            \
  |  |  106|  63.0k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  63.0k|    do {                                            \
  |  |  |  |   97|  63.0k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  63.0k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  63.0k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  63.0k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 612, False: 62.4k]
  |  |  |  |  ------------------
  |  |  |  |   99|  63.0k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|    612|    do {                                                        \
  |  |  |  |  |  |   89|    612|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|    612|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|    612|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|    612|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    612|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|    612|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|    612|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 612]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  63.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 63.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  63.0k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  63.0k|        (idxvar)++;                                 \
  |  |  109|  63.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 63.0k]
  |  |  ------------------
  ------------------
 4264|  63.0k|                             talloc_strdup(NULL, cmd->properties.props[n].name));
 4265|  63.0k|        }
 4266|     68|        MP_TARRAY_APPEND(NULL, list, num, NULL);
  ------------------
  |  |  105|     68|    do {                                            \
  |  |  106|     68|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|     68|    do {                                            \
  |  |  |  |   97|     68|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|     68|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|     68|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|     68|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  |  |   99|     68|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|     68|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|     68|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|     68|        (idxvar)++;                                 \
  |  |  109|     68|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 68]
  |  |  ------------------
  ------------------
 4267|     68|        *(char ***)arg = list;
 4268|     68|        return M_PROPERTY_OK;
 4269|      0|    }
 4270|    233|    }
 4271|     97|    return M_PROPERTY_NOT_IMPLEMENTED;
 4272|    233|}
command.c:mp_profile_list:
 4276|    245|{
 4277|    245|    MPContext *mpctx = ctx;
 4278|    245|    switch (action) {
  ------------------
  |  Branch (4278:13): [True: 122, False: 123]
  ------------------
 4279|     61|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (4279:5): [True: 61, False: 184]
  ------------------
 4280|     61|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE};
  ------------------
  |  |  253|     61|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
 4281|     61|        return M_PROPERTY_OK;
 4282|     61|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (4282:5): [True: 61, False: 184]
  ------------------
 4283|     61|        *(struct mpv_node *)arg = m_config_get_profiles(mpctx->mconfig);
 4284|     61|        return M_PROPERTY_OK;
 4285|      0|    }
 4286|    245|    }
 4287|    123|    return M_PROPERTY_NOT_IMPLEMENTED;
 4288|    245|}
command.c:mp_property_bindings:
 4353|    673|{
 4354|    673|    MPContext *mpctx = ctx;
 4355|    673|    switch (action) {
  ------------------
  |  Branch (4355:13): [True: 334, False: 339]
  ------------------
 4356|    167|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (4356:5): [True: 167, False: 506]
  ------------------
 4357|    167|        *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE};
  ------------------
  |  |  253|    167|#define CONF_TYPE_NODE          (&m_option_type_node)
  ------------------
 4358|    167|        return M_PROPERTY_OK;
 4359|    167|    case M_PROPERTY_GET: {
  ------------------
  |  Branch (4359:5): [True: 167, False: 506]
  ------------------
 4360|    167|        *(struct mpv_node *)arg = mp_input_get_bindings(mpctx->input);
 4361|    167|        return M_PROPERTY_OK;
 4362|      0|    }
 4363|    673|    }
 4364|    339|    return M_PROPERTY_NOT_IMPLEMENTED;
 4365|    673|}
command.c:mp_property_default_menu:
 4398|     93|{
 4399|     93|    switch (action) {
  ------------------
  |  Branch (4399:13): [True: 46, False: 47]
  ------------------
 4400|     23|        case M_PROPERTY_GET:
  ------------------
  |  Branch (4400:9): [True: 23, False: 70]
  ------------------
 4401|     23|            *(char **)arg = talloc_strdup(NULL,
  ------------------
  |  |   50|     23|#define talloc_strdup                   ta_xstrdup
  ------------------
 4402|     23|#include "etc/menu.conf.inc"
  ------------------
  |  |    1|       |// Generated from etc/menu.conf
  |  |    2|       |
  |  |    3|     23|"Pla&y\tcycle pause\t\thidden=not pause and not idle_active\tdisabled=idle_active\n"
  |  |    4|     23|"Pa&use\tcycle pause\t\thidden=idle_active or pause\n"
  |  |    5|     23|"&Stop\tstop\t\t\thidden=idle ~= true\t\t\t\t\t\tdisabled=idle_active\n"
  |  |    6|     23|"\n"
  |  |    7|     23|"Ope&n\n"
  |  |    8|     23|"\t&Clipboard\t\tupdate-clipboard text; loadfile \044{clipboard/text}; show-text '+ \044{clipboard/text}'\n"
  |  |    9|     23|"\t&History\t\tscript-binding select/select-watch-history\n"
  |  |   10|     23|"\t&Watch later\tscript-binding select/select-watch-later\n"
  |  |   11|     23|"&Playlist\t\044playlist\n"
  |  |   12|     23|"\n"
  |  |   13|     23|"&Tracks\t\044tracks\n"
  |  |   14|     23|"P&layback\n"
  |  |   15|     23|"\t&Display duration\thidden=not p[\"current-tracks/video/image\"] or p[\"current-tracks/audio\"]\n"
  |  |   16|     23|"\t\t1 second\t\tset image-display-duration 1\t\tchecked=image_display_duration == 1\n"
  |  |   17|     23|"\t\t2 seconds\t\tset image-display-duration 2\t\tchecked=image_display_duration == 2\n"
  |  |   18|     23|"\t\t5 seconds\t\tset image-display-duration 5\t\tchecked=image_display_duration == 5\n"
  |  |   19|     23|"\t\t10 seconds\t\tset image-display-duration 10\t\tchecked=image_display_duration == 10\n"
  |  |   20|     23|"\t\tInfinite\t\tset image-display-duration inf\t\tchecked=image_display_duration == math.huge\n"
  |  |   21|     23|"\tSp&eed\n"
  |  |   22|     23|"\t\t25%\t\tset speed 0.25\t\tchecked=speed == 0.25\n"
  |  |   23|     23|"\t\t50%\t\tset speed 0.50\t\tchecked=speed == 0.50\n"
  |  |   24|     23|"\t\t75%\t\tset speed 0.75\t\tchecked=speed == 0.75\n"
  |  |   25|     23|"\t\t&100%\tset speed 1\t\t\tchecked=speed == 1\n"
  |  |   26|     23|"\t\t1&25%\tset speed 1.25\t\tchecked=speed == 1.25\n"
  |  |   27|     23|"\t\t1&50%\tset speed 1.50\t\tchecked=speed == 1.50\n"
  |  |   28|     23|"\t\t1&75%\tset speed 1.75\t\tchecked=speed == 1.75\n"
  |  |   29|     23|"\t\t&200%\tset speed 2\t\t\tchecked=speed == 2\n"
  |  |   30|     23|"\t\t&400%\tset speed 4\t\t\tchecked=speed == 4\n"
  |  |   31|     23|"\t\t&800%\tset speed 8\t\t\tchecked=speed == 8\n"
  |  |   32|     23|"\n"
  |  |   33|     23|"\tSet/clear &A-B loop points\tab-loop\n"
  |  |   34|     23|"\t&Loop file\t\tcycle-values loop-file inf no\t\tchecked=loop_file == \"inf\"\n"
  |  |   35|     23|"\tL&oop playlist\tcycle-values loop-playlist inf no\tchecked=loop_playlist == \"inf\"\n"
  |  |   36|     23|"\n"
  |  |   37|     23|"\tSeek &10 seconds forward\tseek  10\thidden=p[\"current-tracks/video/image\"] and not p[\"current-tracks/audio\"]\n"
  |  |   38|     23|"\tSeek 1&0 seconds backward\tseek -10\thidden=p[\"current-tracks/video/image\"] and not p[\"current-tracks/audio\"]\n"
  |  |   39|     23|"\tSeek 10 &minutes forward\tseek  600\thidden=p[\"current-tracks/video/image\"] and not p[\"current-tracks/audio\"]\n"
  |  |   40|     23|"\tSeek 10 m&inutes backward\tseek -600\thidden=p[\"current-tracks/video/image\"] and not p[\"current-tracks/audio\"]\n"
  |  |   41|     23|"\n"
  |  |   42|     23|"\t&Reload\t\tset file-local-options/start \044{=time-pos}; playlist-play-index current yes; show-text \"Reloading current file...\"\n"
  |  |   43|     23|"\n"
  |  |   44|     23|"\t&Next file\t\tplaylist-next\tdisabled=playlist_count < 2\n"
  |  |   45|     23|"\t&Previous file\tplaylist-prev\tdisabled=playlist_count < 2\n"
  |  |   46|     23|"\n"
  |  |   47|     23|"\tN&ext sub-playlist\t\tplaylist-next-playlist\tdisabled=playlist_count < 2\n"
  |  |   48|     23|"\tP&revious sub-playlist\tplaylist-prev-playlist\tdisabled=playlist_count < 2\n"
  |  |   49|     23|"\n"
  |  |   50|     23|"\t&Shuffle\tplaylist-shuffle\n"
  |  |   51|     23|"\t&Unshuffle\tplaylist-unshuffle\n"
  |  |   52|     23|"&Chapters\t\t\t\044chapters\n"
  |  |   53|     23|"&Editions/Titles\t\044editions\n"
  |  |   54|     23|"\n"
  |  |   55|     23|"&Video\n"
  |  |   56|     23|"\t&Track\t\044video-tracks\n"
  |  |   57|     23|"\n"
  |  |   58|     23|"\t&Fill\t\tno-osd cycle-values panscan 0 1; no-osd set video-unscaled no; no-osd set video-zoom 0\t\tchecked=panscan == 1\n"
  |  |   59|     23|"\t&Stretch\tno-osd cycle keepaspect\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tchecked=not keepaspect\n"
  |  |   60|     23|"\t&Unscaled\tno-osd cycle-values video-unscaled yes no; no-osd set video-zoom 0; no-osd set panscan 0\tchecked=video_unscaled\n"
  |  |   61|     23|"\t&Zoom\n"
  |  |   62|     23|"\t\t&50%\tset video-zoom -1\tchecked=video_zoom == -1\n"
  |  |   63|     23|"\t\t&100%\tset video-zoom  0\tchecked=video_zoom == 0\n"
  |  |   64|     23|"\t\t&200%\tset video-zoom  1\tchecked=video_zoom == 1\n"
  |  |   65|     23|"\t&Aspect ratio\n"
  |  |   66|     23|"\t\t&16:9\t\tset video-aspect-override 16:9\t\tchecked=math.abs(video_aspect_override - 16/9) < 1e-12\n"
  |  |   67|     23|"\t\t&4:3\t\tset video-aspect-override 4:3\t\tchecked=math.abs(video_aspect_override - 4/3) < 1e-12\n"
  |  |   68|     23|"\t\t&2.35:1\t\tset video-aspect-override 2.35:1\tchecked=video_aspect_override == 2.35\n"
  |  |   69|     23|"\t\t&Default\tset video-aspect-override no\t\tchecked=video_aspect_override == -2\n"
  |  |   70|     23|"\t&Center\t\tno-osd set video-pan-x 0; no-osd set video-pan-y 0; no-osd set video-align-x 0; no-osd set video-align-y 0\t\tdisabled=video_pan_x == 0 and video_pan_y == 0 and video_align_x == 0 and video_align_y == 0\n"
  |  |   71|     23|"\n"
  |  |   72|     23|"\tRotate &clockwise\t\t\tcycle-values video-rotate 90 180 270 0\n"
  |  |   73|     23|"\tRotate c&ounterclockwise\tcycle-values video-rotate 270 180 90 0\n"
  |  |   74|     23|"\n"
  |  |   75|     23|"\t&Deband\t\t\tcycle deband\t\tchecked=deband\n"
  |  |   76|     23|"\tD&einterlace\tcycle deinterlace\tchecked=deinterlace_active\n"
  |  |   77|     23|"\n"
  |  |   78|     23|"\t&Screenshot\t\t\t\t\t\tscreenshot\t\t\tdisabled=not p[\"current-tracks/video\"]\n"
  |  |   79|     23|"\tScreenshot &without subtitles\tscreenshot video\tdisabled=not p[\"current-tracks/video\"]\n"
  |  |   80|     23|"&Audio\n"
  |  |   81|     23|"\t&Track\t\t\044audio-tracks\n"
  |  |   82|     23|"\t&Devices\t\044audio-devices\n"
  |  |   83|     23|"\t&Channels\n"
  |  |   84|     23|"\t\t&Auto\t\tset audio-channels auto-safe\tchecked=audio_channels == \"auto-safe\"\n"
  |  |   85|     23|"\t\t&Stereo\t\tset audio-channels stereo\t\tchecked=audio_channels == \"stereo\"\n"
  |  |   86|     23|"\t\t&Mono\t\tset audio-channels mono\t\t\tchecked=audio_channels == \"mono\"\n"
  |  |   87|     23|"\n"
  |  |   88|     23|"\tIncrease &volume\tadd volume  2\n"
  |  |   89|     23|"\tDecrease v&olume\tadd volume -2\n"
  |  |   90|     23|"\t&Mute\t\t\t\tcycle mute\t\tchecked=mute\n"
  |  |   91|     23|"\n"
  |  |   92|     23|"\tIncrease d&elay\t\tadd audio-delay  0.1\n"
  |  |   93|     23|"\tDecrease de&lay\t\tadd audio-delay -0.1\n"
  |  |   94|     23|"&Subtitle\n"
  |  |   95|     23|"\t&Track\t\t\044sub-tracks\n"
  |  |   96|     23|"\t&Visible\tcycle sub-visibility\tchecked=sub_visibility\n"
  |  |   97|     23|"\n"
  |  |   98|     23|"\tIncrease &delay\t\tadd sub-delay  0.1\n"
  |  |   99|     23|"\tDecrease d&elay\t\tadd sub-delay -0.1\n"
  |  |  100|     23|"\n"
  |  |  101|     23|"\tScale &up\t\tadd sub-scale  0.1\n"
  |  |  102|     23|"\tScale d&own\t\tadd sub-scale -0.1\n"
  |  |  103|     23|"\n"
  |  |  104|     23|"\t&Lines\tscript-binding select/select-subtitle-line\tdisabled=not sid or p[\"current-tracks/sub/codec\"] == \"dvb_subtitle\" or p[\"current-tracks/sub/codec\"] == \"dvd_subtitle\" or p[\"current-tracks/sub/codec\"] == \"hdmv_pgs_subtitle\"\n"
  |  |  105|     23|"\t&Secondary subtitle\n"
  |  |  106|     23|"\t\t&Track\t\t\044secondary-sub-tracks\n"
  |  |  107|     23|"\t\t&Visible\tcycle secondary-sub-visibility\tchecked=secondary_sub_visibility\n"
  |  |  108|     23|"\n"
  |  |  109|     23|"\t\tIncrease &delay\t\tadd secondary-sub-delay  0.1\n"
  |  |  110|     23|"\t\tDecrease d&elay\t\tadd secondary-sub-delay -0.1\n"
  |  |  111|     23|"\n"
  |  |  112|     23|"\t\t&Lines\tscript-binding select/select-secondary-subtitle-line\tdisabled=not secondary_sid or p[\"current-tracks/sub2/codec\"] == \"dvb_subtitle\" or p[\"current-tracks/sub2/codec\"] == \"dvd_subtitle\" or p[\"current-tracks/sub2/codec\"] == \"hdmv_pgs_subtitle\"\n"
  |  |  113|     23|"\n"
  |  |  114|     23|"&Window\n"
  |  |  115|     23|"\t&Fullscreen\t\tcycle fullscreen\tchecked=fullscreen\n"
  |  |  116|     23|"\t&Border\t\t\tcycle border\t\tchecked=border\n"
  |  |  117|     23|"\t&Title bar\t\tcycle title-bar\t\tchecked=title_bar\n"
  |  |  118|     23|"\t&Always on top\tcycle ontop\t\t\tchecked=ontop\n"
  |  |  119|     23|"\t&Window scale\n"
  |  |  120|     23|"\t\t50%\t\tset window-scale 0.5\tchecked=math.abs(get(\"current-window-scale\", 0) - 0.5) < 0.1\n"
  |  |  121|     23|"\t\t100%\tset window-scale 1\t\tchecked=math.abs(get(\"current-window-scale\", 0) - 1) < 0.1\n"
  |  |  122|     23|"\t\t200%\tset window-scale 2\t\tchecked=math.abs(get(\"current-window-scale\", 0) - 2) < 0.1\n"
  |  |  123|     23|"\t\t300%\tset window-scale 3\t\tchecked=math.abs(get(\"current-window-scale\", 0) - 3) < 0.1\n"
  |  |  124|     23|"\t&Screenshot window\tscreenshot window\n"
  |  |  125|     23|"V&iew\n"
  |  |  126|     23|"\t&Playback statistics\tscript-binding stats/display-page-1-toggle\n"
  |  |  127|     23|"\t&File information\t\tscript-binding stats/display-page-5-toggle\n"
  |  |  128|     23|"\t&Key bindings\t\t\tscript-binding stats/display-page-4-toggle\n"
  |  |  129|     23|"\t&Time OSD\t\t\t\tno-osd cycle-values osd-level 3 1\tchecked=osd_level == 3\n"
  |  |  130|     23|"\t&Cycle OSC visibility\tscript-binding osc/visibility\n"
  |  |  131|     23|"\t&OSC layout\n"
  |  |  132|     23|"\t\t&Bottom bar\t\t\tno-osd change-list script-opts append osc-layout=bottombar\n"
  |  |  133|     23|"\t\t&Top bar\t\t\tno-osd change-list script-opts append osc-layout=topbar\n"
  |  |  134|     23|"\t\t&Floating\t\t\tno-osd change-list script-opts append osc-layout=floating\n"
  |  |  135|     23|"\t\tB&ox\t\t\t\tno-osd change-list script-opts append osc-layout=box\n"
  |  |  136|     23|"\t\t&Slimbox\t\t\tno-osd change-list script-opts append osc-layout=slimbox\n"
  |  |  137|     23|"\t\tS&lim bottom bar\tno-osd change-list script-opts append osc-layout=slimbottombar\thidden=not p[\"current-tracks/video/image\"] or p[\"current-tracks/audio\"]\n"
  |  |  138|     23|"\t\tSl&im top bar\t\tno-osd change-list script-opts append osc-layout=slimtopbar\t\thidden=not p[\"current-tracks/video/image\"] or p[\"current-tracks/audio\"]\n"
  |  |  139|     23|"P&rofiles\t\044profiles\n"
  |  |  140|     23|"T&ools\n"
  |  |  141|     23|"\tCopy &path\t\tset clipboard/text \044{path}\t\t\tdisabled=idle_active\n"
  |  |  142|     23|"\tCopy &subtitle\tset clipboard/text \044{sub-text}\t\tdisabled=not sid or p[\"current-tracks/sub/codec\"] == \"dvd_subtitle\" or p[\"current-tracks/sub/codec\"] == \"hdmv_pgs_subtitle\"\n"
  |  |  143|     23|"\tCopy &title\t\tset clipboard/text \044{media-title}\tdisabled=idle_active\n"
  |  |  144|     23|"\n"
  |  |  145|     23|"\t&Hardware decoding\tcycle-values hwdec no auto\tchecked=hwdec_current and hwdec_current ~= \"no\"\tdisabled=p[\"current-tracks/video/image\"] ~= false\n"
  |  |  146|     23|"\t&Key bindings\t\tscript-binding select/select-binding\n"
  |  |  147|     23|"\tP&roperties\t\t\tscript-binding select/show-properties\n"
  |  |  148|     23|"\t&Console\t\t\tscript-binding commands/open\n"
  |  |  149|     23|"\n"
  |  |  150|     23|"\t&Edit config file\t\tscript-binding select/edit-config-file\n"
  |  |  151|     23|"\tEdit key &bindings\t\tscript-binding select/edit-input-conf\n"
  |  |  152|     23|"\n"
  |  |  153|     23|"\t&Online documentation\tscript-binding select/open-docs\n"
  |  |  154|     23|"\tS&upport\t\t\t\tscript-binding select/open-chat\n"
  |  |  155|     23|"\n"
  |  |  156|     23|"&Quit\t\t\t\t\tquit\n"
  |  |  157|     23|"Quit an&d save position\tquit-watch-later\thidden=save_position_on_quit\n"
  ------------------
 4403|     23|                );
 4404|     23|            return M_PROPERTY_OK;
 4405|     23|        case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (4405:9): [True: 23, False: 70]
  ------------------
 4406|     23|            *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING};
  ------------------
  |  |  244|     23|#define CONF_TYPE_STRING        (&m_option_type_string)
  ------------------
 4407|     23|            return M_PROPERTY_OK;
 4408|     93|    }
 4409|     47|    return M_PROPERTY_NOT_IMPLEMENTED;
 4410|     93|}
command.c:str_compare:
 8233|   114M|{
 8234|   114M|    return strcmp(*(const char **)a, *(const char **)b);
 8235|   114M|}
command.c:mp_property_generic_option:
  436|  4.43k|{
  437|  4.43k|    MPContext *mpctx = ctx;
  438|  4.43k|    struct m_config_option *opt = prop->is_option ? prop->priv :
  ------------------
  |  Branch (438:35): [True: 1.08k, False: 3.35k]
  ------------------
  439|  4.43k|                        m_config_get_co(mpctx->mconfig, bstr0(prop->name));
  440|  4.43k|    if (!opt)
  ------------------
  |  Branch (440:9): [True: 0, False: 4.43k]
  ------------------
  441|      0|        return M_PROPERTY_UNKNOWN;
  442|       |
  443|  4.43k|    switch (action) {
  ------------------
  |  Branch (443:13): [True: 2.48k, False: 1.94k]
  ------------------
  444|  1.66k|    case M_PROPERTY_GET_TYPE:
  ------------------
  |  Branch (444:5): [True: 1.66k, False: 2.77k]
  ------------------
  445|  1.66k|        *(struct m_option *)arg = *(opt->opt);
  446|  1.66k|        return M_PROPERTY_OK;
  447|    822|    case M_PROPERTY_GET:
  ------------------
  |  Branch (447:5): [True: 822, False: 3.61k]
  ------------------
  448|    822|        if (!opt->data)
  ------------------
  |  Branch (448:13): [True: 24, False: 798]
  ------------------
  449|     24|            return M_PROPERTY_NOT_IMPLEMENTED;
  450|    798|        m_option_copy(opt->opt, arg, opt->data);
  451|    798|        return M_PROPERTY_OK;
  452|      0|    case M_PROPERTY_SET:
  ------------------
  |  Branch (452:5): [True: 0, False: 4.43k]
  ------------------
  453|      0|        opt->coalesce = prop->coalesce;
  454|      0|        if (m_config_set_option_raw(mpctx->mconfig, opt, arg, 0) < 0)
  ------------------
  |  Branch (454:13): [True: 0, False: 0]
  ------------------
  455|      0|            return M_PROPERTY_ERROR;
  456|      0|        return M_PROPERTY_OK;
  457|  4.43k|    }
  458|  1.94k|    return M_PROPERTY_NOT_IMPLEMENTED;
  459|  4.43k|}
command.c:mp_property_deprecated_alias:
 4097|     77|{
 4098|     77|    MPContext *mpctx = ctx;
 4099|     77|    struct command_ctx *cmd = mpctx->command_ctx;
 4100|     77|    const char *real_property = prop->priv;
 4101|     77|    for (int n = 0; n < cmd->num_warned_deprecated; n++) {
  ------------------
  |  Branch (4101:21): [True: 69, False: 8]
  ------------------
 4102|     69|        if (strcmp(cmd->warned_deprecated[n], prop->name) == 0)
  ------------------
  |  Branch (4102:13): [True: 69, False: 0]
  ------------------
 4103|     69|            goto done;
 4104|     69|    }
 4105|      8|    MP_WARN(mpctx, "Warning: property '%s' was replaced with '%s' and "
  ------------------
  |  |   90|      8|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      8|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
 4106|      8|            "might be removed in the future.\n", prop->name, real_property);
 4107|      8|    MP_TARRAY_APPEND(cmd, cmd->warned_deprecated, cmd->num_warned_deprecated,
  ------------------
  |  |  105|      8|    do {                                            \
  |  |  106|      8|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      8|    do {                                            \
  |  |  |  |   97|      8|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      8|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      8|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      8|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 8, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|      8|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      8|    do {                                                        \
  |  |  |  |  |  |   89|      8|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      8|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      8|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      8|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      8|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      8|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      8|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 8]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      8|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      8|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      8|        (idxvar)++;                                 \
  |  |  109|      8|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 8]
  |  |  ------------------
  ------------------
 4108|      8|                     (char *)prop->name);
 4109|       |
 4110|     77|done:
 4111|     77|    return mp_property_do(real_property, action, arg, ctx);
 4112|      8|}
command.c:mp_property_alias:
 4090|    835|{
 4091|    835|    const char *real_property = prop->priv;
 4092|    835|    return mp_property_do(real_property, action, arg, ctx);
 4093|    835|}
command.c:command_event:
 8312|  16.3k|{
 8313|  16.3k|    struct command_ctx *ctx = mpctx->command_ctx;
 8314|       |
 8315|  16.3k|    if (event == MPV_EVENT_START_FILE) {
  ------------------
  |  Branch (8315:9): [True: 0, False: 16.3k]
  ------------------
 8316|      0|        ctx->last_seek_pts = MP_NOPTS_VALUE;
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
 8317|      0|        ctx->marked_pts = MP_NOPTS_VALUE;
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
 8318|      0|        ctx->marked_permanent = false;
 8319|      0|    }
 8320|       |
 8321|  16.3k|    if (event == MPV_EVENT_PLAYBACK_RESTART) {
  ------------------
  |  Branch (8321:9): [True: 0, False: 16.3k]
  ------------------
 8322|      0|        ctx->last_seek_time = mp_time_sec();
 8323|      0|        run_command_opts(mpctx);
 8324|      0|    }
 8325|       |
 8326|  16.3k|    if (event == MPV_EVENT_VIDEO_RECONFIG && ctx->hwdec_osd_mode) {
  ------------------
  |  Branch (8326:9): [True: 0, False: 16.3k]
  |  Branch (8326:46): [True: 0, False: 0]
  ------------------
 8327|      0|        show_property_osd(mpctx, "hwdec", ctx->hwdec_osd_mode);
 8328|      0|        ctx->hwdec_osd_mode = 0;
 8329|      0|    }
 8330|       |
 8331|  16.3k|    if (event == MPV_EVENT_IDLE)
  ------------------
  |  Branch (8331:9): [True: 0, False: 16.3k]
  ------------------
 8332|      0|        run_command_opts(mpctx);
 8333|       |
 8334|  16.3k|    if (event == MPV_EVENT_END_FILE)
  ------------------
  |  Branch (8334:9): [True: 0, False: 16.3k]
  ------------------
 8335|      0|        mp_msg_flush_status_line(mpctx->log, false);
 8336|       |
 8337|  16.3k|    if (event == MPV_EVENT_END_FILE || event == MPV_EVENT_FILE_LOADED) {
  ------------------
  |  Branch (8337:9): [True: 0, False: 16.3k]
  |  Branch (8337:40): [True: 0, False: 16.3k]
  ------------------
 8338|       |        // Update chapters - does nothing if something else is visible.
 8339|      0|        set_osd_bar_chapters(mpctx, OSD_BAR_SEEK);
 8340|      0|    }
 8341|  16.3k|    if (event == MP_EVENT_WIN_STATE2)
  ------------------
  |  Branch (8341:9): [True: 0, False: 16.3k]
  ------------------
 8342|      0|        ctx->cached_window_scale = 0;
 8343|       |
 8344|  16.3k|    if (event == MP_EVENT_METADATA_UPDATE) {
  ------------------
  |  Branch (8344:9): [True: 0, False: 16.3k]
  ------------------
 8345|      0|        struct playlist_entry *const pe = mpctx->playing;
 8346|      0|        if (pe && !pe->title) {
  ------------------
  |  Branch (8346:13): [True: 0, False: 0]
  |  Branch (8346:19): [True: 0, False: 0]
  ------------------
 8347|      0|            const char *const name = mp_find_non_filename_media_title(mpctx);
 8348|      0|            if (name && name[0]) {
  ------------------
  |  Branch (8348:17): [True: 0, False: 0]
  |  Branch (8348:25): [True: 0, False: 0]
  ------------------
 8349|      0|                pe->title = talloc_strdup(pe, name);
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
 8350|      0|                mp_notify_property(mpctx, "playlist");
 8351|      0|            }
 8352|      0|        }
 8353|      0|    }
 8354|  16.3k|}
command.c:update_priority:
 8400|  11.3k|{
 8401|       |#if HAVE_WIN32_DESKTOP
 8402|       |    struct MPOpts *opts = mpctx->opts;
 8403|       |    if (opts->w32_priority > 0)
 8404|       |        SetPriorityClass(GetCurrentProcess(), opts->w32_priority);
 8405|       |#endif
 8406|  11.3k|}

mp_parse_cfgfiles:
   69|  16.4k|{
   70|  16.4k|    struct MPOpts *opts = mpctx->opts;
   71|       |
   72|  16.4k|    mp_mk_user_dir(mpctx->global, "home", "");
   73|       |
   74|  16.4k|    char *p1 = mp_get_user_path(NULL, mpctx->global, "~~home/");
   75|  16.4k|    char *p2 = mp_get_user_path(NULL, mpctx->global, "~~old_home/");
   76|  16.4k|    if (strcmp(p1, p2) != 0 && mp_path_exists(p2)) {
  ------------------
  |  Branch (76:9): [True: 450, False: 15.9k]
  |  Branch (76:32): [True: 0, False: 450]
  ------------------
   77|      0|        MP_WARN(mpctx, "Warning, two config dirs found:\n   %s (main)\n"
  ------------------
  |  |   90|      0|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
   78|      0|                "   %s (bogus)\nYou should merge or delete the second one.\n",
   79|      0|                p1, p2);
   80|      0|    }
   81|  16.4k|    talloc_free(p1);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
   82|  16.4k|    talloc_free(p2);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
   83|       |
   84|  16.4k|    char *section = NULL;
   85|  16.4k|    bool encoding = opts->encode_opts->file && opts->encode_opts->file[0];
  ------------------
  |  Branch (85:21): [True: 461, False: 15.9k]
  |  Branch (85:48): [True: 395, False: 66]
  ------------------
   86|       |    // In encoding mode, we don't want to apply normal config options.
   87|       |    // So we "divert" normal options into a separate section, and the diverted
   88|       |    // section is never used - unless maybe it's explicitly referenced from an
   89|       |    // encoding profile.
   90|  16.4k|    if (encoding)
  ------------------
  |  Branch (90:9): [True: 395, False: 16.0k]
  ------------------
   91|    395|        section = "playback-default";
   92|       |
   93|  16.4k|    load_all_cfgfiles(mpctx, NULL, "encoding-profiles.conf");
   94|       |
   95|  16.4k|    load_all_cfgfiles(mpctx, section, "mpv.conf|config");
   96|       |
   97|  16.4k|    if (encoding) {
  ------------------
  |  Branch (97:9): [True: 395, False: 16.0k]
  ------------------
   98|    395|        m_config_set_profile(mpctx->mconfig, SECT_ENCODE, 0);
  ------------------
  |  |   66|    395|#define SECT_ENCODE "encoding"
  ------------------
   99|    395|        mp_input_enable_section(mpctx->input, "encode", MP_INPUT_EXCLUSIVE);
  100|    395|    }
  101|  16.4k|}
mp_get_playback_resume_dir:
  203|  36.1k|{
  204|  36.1k|    char *wl_dir = mpctx->opts->watch_later_dir;
  205|  36.1k|    if (wl_dir && wl_dir[0]) {
  ------------------
  |  Branch (205:9): [True: 10.2k, False: 25.9k]
  |  Branch (205:19): [True: 10.0k, False: 194]
  ------------------
  206|  10.0k|        wl_dir = mp_get_user_path(NULL, mpctx->global, wl_dir);
  207|  26.1k|    } else {
  208|  26.1k|        wl_dir = mp_find_user_file(NULL, mpctx->global, "state", MP_WATCH_LATER_CONF);
  ------------------
  |  |  174|  26.1k|#define MP_WATCH_LATER_CONF "watch_later"
  ------------------
  209|  26.1k|    }
  210|  36.1k|    return wl_dir;
  211|  36.1k|}
mp_write_watch_later_conf:
  300|      1|{
  301|      1|    struct playlist_entry *cur = mpctx->playing;
  302|      1|    char *conffile = NULL;
  303|       |
  304|      1|    if (!cur)
  ------------------
  |  Branch (304:9): [True: 1, False: 0]
  ------------------
  305|      1|        goto exit;
  306|       |
  307|      0|    struct demuxer *demux = mpctx->demuxer;
  308|       |
  309|      0|    conffile = mp_get_playback_resume_config_filename(mpctx, cur->filename);
  310|      0|    if (!conffile)
  ------------------
  |  Branch (310:9): [True: 0, False: 0]
  ------------------
  311|      0|        goto exit;
  312|       |
  313|      0|    char *wl_dir = mp_get_playback_resume_dir(mpctx);
  314|      0|    mp_mkdirp(wl_dir);
  315|      0|    talloc_free(wl_dir);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  316|       |
  317|      0|    MP_INFO(mpctx, "Saving state.\n");
  ------------------
  |  |   91|      0|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  318|       |
  319|      0|    bstr data = {0};
  320|      0|    write_filename(mpctx, conffile, &data, cur->filename);
  321|       |
  322|      0|    bool write_start = true;
  323|      0|    double pos = get_playback_time(mpctx);
  324|       |
  325|      0|    if ((demux && (!demux->seekable || demux->partially_seekable)) ||
  ------------------
  |  Branch (325:10): [True: 0, False: 0]
  |  Branch (325:20): [True: 0, False: 0]
  |  Branch (325:40): [True: 0, False: 0]
  ------------------
  326|      0|        pos == MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (326:9): [True: 0, False: 0]
  ------------------
  327|      0|    {
  328|      0|        write_start = false;
  329|      0|        MP_INFO(mpctx, "Not seekable, or time unknown - not saving position.\n");
  ------------------
  |  |   91|      0|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  330|      0|    }
  331|      0|    char **watch_later_options = mpctx->opts->watch_later_options;
  332|      0|    for (int i = 0; watch_later_options && watch_later_options[i]; i++) {
  ------------------
  |  Branch (332:21): [True: 0, False: 0]
  |  Branch (332:44): [True: 0, False: 0]
  ------------------
  333|      0|        char *pname = watch_later_options[i];
  334|       |        // Always save start if we have it in the array.
  335|      0|        if (write_start && strcmp(pname, "start") == 0) {
  ------------------
  |  Branch (335:13): [True: 0, False: 0]
  |  Branch (335:28): [True: 0, False: 0]
  ------------------
  336|      0|            bstr_xappend_asprintf(conffile, &data, "%s=%f\n", pname, pos);
  337|      0|            continue;
  338|      0|        }
  339|       |        // Only store it if it's different from the initial value.
  340|      0|        if (m_config_watch_later_backup_opt_changed(mpctx->mconfig, pname)) {
  ------------------
  |  Branch (340:13): [True: 0, False: 0]
  ------------------
  341|      0|            char *val = NULL;
  342|      0|            mp_property_do(pname, M_PROPERTY_GET_STRING, &val, mpctx);
  343|      0|            if (!val) {
  ------------------
  |  Branch (343:17): [True: 0, False: 0]
  ------------------
  344|      0|                MP_VERBOSE(mpctx, "Option %s unavailable while "
  ------------------
  |  |   92|      0|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  345|      0|                    "writing watch-later file\n", pname);
  346|      0|            } else if (needs_config_quoting(val)) {
  ------------------
  |  Branch (346:24): [True: 0, False: 0]
  ------------------
  347|       |                // e.g. '%6%STRING'
  348|      0|                bstr_xappend_asprintf(conffile, &data, "%s=%%%d%%%s\n", pname, (int)strlen(val), val);
  349|      0|            } else {
  350|      0|                bstr_xappend_asprintf(conffile, &data, "%s=%s\n", pname, val);
  351|      0|            }
  352|      0|            talloc_free(val);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  353|      0|        }
  354|      0|    }
  355|      0|    bool ok = mp_save_to_file(conffile, data.start, data.len);
  356|      0|    if (!ok) {
  ------------------
  |  Branch (356:9): [True: 0, False: 0]
  ------------------
  357|      0|        MP_WARN(mpctx, "Can't save state to %s\n", conffile);
  ------------------
  |  |   90|      0|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  358|      0|        goto exit;
  359|      0|    }
  360|       |
  361|      0|    if (mpctx->opts->position_check_mtime && !mp_is_url(bstr0(cur->filename)) &&
  ------------------
  |  Branch (361:9): [True: 0, False: 0]
  |  Branch (361:46): [True: 0, False: 0]
  ------------------
  362|      0|        !copy_mtime(cur->filename, conffile))
  ------------------
  |  Branch (362:9): [True: 0, False: 0]
  ------------------
  363|      0|    {
  364|      0|        MP_WARN(mpctx, "Can't copy mtime from %s to %s\n", cur->filename,
  ------------------
  |  |   90|      0|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  365|      0|                conffile);
  366|      0|    }
  367|       |
  368|      0|    write_redirects_for_parent_dirs(mpctx, cur->filename);
  369|       |
  370|       |    // Also write redirect entries for a playlist that mpv expanded if the
  371|       |    // current entry is a URL, this is mostly useful for playing multiple
  372|       |    // archives of images, e.g. with mpv 1.zip 2.zip and quit-watch-later
  373|       |    // on 2.zip, write redirect entries for 2.zip, not just for the archive://
  374|       |    // URL.
  375|      0|    if (cur->playlist_path && mp_is_url(bstr0(cur->filename))) {
  ------------------
  |  Branch (375:9): [True: 0, False: 0]
  |  Branch (375:31): [True: 0, False: 0]
  ------------------
  376|      0|        write_redirect(mpctx, cur->playlist_path);
  377|      0|        write_redirects_for_parent_dirs(mpctx, cur->playlist_path);
  378|      0|    }
  379|       |
  380|      1|exit:
  381|      1|    talloc_free(conffile);
  ------------------
  |  |   47|      1|#define talloc_free                     ta_free
  ------------------
  382|      1|}
mp_check_playlist_resume:
  449|  11.3k|{
  450|  11.3k|    if (!mpctx->opts->position_resume)
  ------------------
  |  Branch (450:9): [True: 296, False: 11.0k]
  ------------------
  451|    296|        return NULL;
  452|  47.2k|    for (int n = 0; n < playlist->num_entries; n++) {
  ------------------
  |  Branch (452:21): [True: 36.1k, False: 11.0k]
  ------------------
  453|  36.1k|        struct playlist_entry *e = playlist->entries[n];
  454|  36.1k|        char *conf = mp_get_playback_resume_config_filename(mpctx, e->filename);
  455|  36.1k|        bool exists = conf && mp_path_exists(conf);
  ------------------
  |  Branch (455:23): [True: 9.51k, False: 26.6k]
  |  Branch (455:31): [True: 0, False: 9.51k]
  ------------------
  456|  36.1k|        talloc_free(conf);
  ------------------
  |  |   47|  36.1k|#define talloc_free                     ta_free
  ------------------
  457|  36.1k|        if (exists)
  ------------------
  |  Branch (457:13): [True: 0, False: 36.1k]
  ------------------
  458|      0|            return e;
  459|  36.1k|    }
  460|  11.0k|    return NULL;
  461|  11.0k|}
configfiles.c:load_all_cfgfiles:
   58|  32.8k|{
   59|  32.8k|    char **cf = mp_find_all_config_files(NULL, mpctx->global, filename);
   60|  32.8k|    for (int i = 0; cf && cf[i]; i++)
  ------------------
  |  Branch (60:21): [True: 32.8k, False: 0]
  |  Branch (60:27): [True: 0, False: 32.8k]
  ------------------
   61|      0|        m_config_parse_config_file(mpctx->mconfig, mpctx->global, cf[i], section, 0);
   62|  32.8k|    talloc_free(cf);
  ------------------
  |  |   47|  32.8k|#define talloc_free                     ta_free
  ------------------
   63|  32.8k|}
configfiles.c:mp_get_playback_resume_config_filename:
  215|  36.1k|{
  216|  36.1k|    struct MPOpts *opts = mpctx->opts;
  217|  36.1k|    char *res = NULL;
  218|  36.1k|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  36.1k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  36.1k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  219|  36.1k|    if (opts->ignore_path_in_watch_later_config && !mp_is_url(bstr0(path)))
  ------------------
  |  Branch (219:9): [True: 619, False: 35.5k]
  |  Branch (219:52): [True: 421, False: 198]
  ------------------
  220|    421|        path = mp_basename(path);
  221|       |
  222|  36.1k|    bstr hashstr = mp_hash_to_bstr(tmp, path, strlen(path), "MD5");
  223|  36.1k|    char *wl_dir = mp_get_playback_resume_dir(mpctx);
  224|  36.1k|    if (wl_dir && wl_dir[0])
  ------------------
  |  Branch (224:9): [True: 12.4k, False: 23.6k]
  |  Branch (224:19): [True: 9.51k, False: 2.97k]
  ------------------
  225|  9.51k|        res = mp_path_join_bstr(NULL, bstr0(wl_dir), hashstr);
  226|  36.1k|    talloc_free(wl_dir);
  ------------------
  |  |   47|  36.1k|#define talloc_free                     ta_free
  ------------------
  227|  36.1k|    talloc_free(tmp);
  ------------------
  |  |   47|  36.1k|#define talloc_free                     ta_free
  ------------------
  228|  36.1k|    return res;
  229|  36.1k|}

disc_nav_destroy:
  113|  16.4k|{
  114|  16.4k|    if (!mpctx->disc_nav)
  ------------------
  |  Branch (114:9): [True: 16.4k, False: 0]
  ------------------
  115|  16.4k|        return;
  116|      0|    mp_image_unrefp(&mpctx->disc_nav->bd_image);
  117|       |    TA_FREEP(&mpctx->disc_nav);
  ------------------
  |  |   81|      0|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|      0|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 0]
  |  |  ------------------
  ------------------
  118|      0|}
disc_nav_get_stream:
  121|     10|{
  122|     10|    if (!mpctx->demuxer || !mpctx->demuxer->stream)
  ------------------
  |  Branch (122:9): [True: 10, False: 0]
  |  Branch (122:28): [True: 0, False: 0]
  ------------------
  123|     10|        return NULL;
  124|      0|    struct stream *s = mpctx->demuxer->stream;
  125|      0|    if (!s->info || !s->info->name)
  ------------------
  |  Branch (125:9): [True: 0, False: 0]
  |  Branch (125:21): [True: 0, False: 0]
  ------------------
  126|      0|        return NULL;
  127|      0|    const char *n = s->info->name;
  128|      0|    if (strcmp(n, "dvdnav") == 0 || strcmp(n, "ifo_dvdnav") == 0 ||
  ------------------
  |  Branch (128:9): [True: 0, False: 0]
  |  Branch (128:37): [True: 0, False: 0]
  ------------------
  129|      0|        strcmp(n, "bd") == 0 || strcmp(n, "bdmv/bluray") == 0)
  ------------------
  |  Branch (129:9): [True: 0, False: 0]
  |  Branch (129:33): [True: 0, False: 0]
  ------------------
  130|      0|    {
  131|      0|        return s;
  132|      0|    }
  133|      0|    return NULL;
  134|      0|}

prepare_playlist:
 1164|  11.3k|{
 1165|  11.3k|    struct MPOpts *opts = mpctx->opts;
 1166|  11.3k|    struct playlist_entry *entry = NULL;
 1167|       |
 1168|  11.3k|    if (overwrite_current)
  ------------------
  |  Branch (1168:9): [True: 0, False: 11.3k]
  ------------------
 1169|      0|        pl->current = NULL;
 1170|       |
 1171|  11.3k|    pl->playlist_completed = false;
 1172|  11.3k|    pl->playlist_started = false;
 1173|       |
 1174|  11.3k|    if (opts->playlist_pos >= 0) {
  ------------------
  |  Branch (1174:9): [True: 31, False: 11.3k]
  ------------------
 1175|     31|        entry = playlist_entry_from_index(pl, opts->playlist_pos);
 1176|     31|        pl->current = overwrite_current || entry ? entry : pl->current;
  ------------------
  |  Branch (1176:23): [True: 0, False: 31]
  |  Branch (1176:44): [True: 2, False: 29]
  ------------------
 1177|     31|    }
 1178|       |
 1179|  11.3k|    if (pl->playlist_dir)
  ------------------
  |  Branch (1179:9): [True: 0, False: 11.3k]
  ------------------
 1180|      0|        playlist_set_current(pl);
 1181|       |
 1182|  11.3k|    if (opts->shuffle)
  ------------------
  |  Branch (1182:9): [True: 29, False: 11.3k]
  ------------------
 1183|     29|        playlist_shuffle(pl);
 1184|       |
 1185|  11.3k|    if (opts->merge_files)
  ------------------
  |  Branch (1185:9): [True: 98, False: 11.2k]
  ------------------
 1186|     98|        merge_playlist_files(pl);
 1187|       |
 1188|  11.3k|    if (!pl->current || (!overwrite_current && !entry)) {
  ------------------
  |  Branch (1188:9): [True: 11.3k, False: 1]
  |  Branch (1188:26): [True: 1, False: 0]
  |  Branch (1188:48): [True: 0, False: 1]
  ------------------
 1189|  11.3k|        entry = mp_check_playlist_resume(mpctx, pl);
 1190|  11.3k|        pl->current = overwrite_current || entry ? entry : pl->current;
  ------------------
  |  Branch (1190:23): [True: 0, False: 11.3k]
  |  Branch (1190:44): [True: 0, False: 11.3k]
  ------------------
 1191|  11.3k|    }
 1192|       |
 1193|  11.3k|    if (!pl->current)
  ------------------
  |  Branch (1193:9): [True: 11.3k, False: 1]
  ------------------
 1194|  11.3k|        pl->current = playlist_get_first(pl);
 1195|  11.3k|}
update_lavfi_complex:
 1681|  11.3k|{
 1682|  11.3k|    if (mpctx->playback_initialized) {
  ------------------
  |  Branch (1682:9): [True: 0, False: 11.3k]
  ------------------
 1683|      0|        int r = reinit_complex_filters(mpctx, false);
 1684|      0|        if (r != 0)
  ------------------
  |  Branch (1684:13): [True: 0, False: 0]
  ------------------
 1685|      0|            issue_refresh_seek(mpctx, MPSEEK_EXACT);
 1686|      0|        if (r > 0)
  ------------------
  |  Branch (1686:13): [True: 0, False: 0]
  ------------------
 1687|      0|            update_vo_chain_el_pair(mpctx);
 1688|      0|    }
 1689|  11.3k|}
mp_play_files:
 2289|  11.3k|{
 2290|  11.3k|    stats_register_thread_cputime(mpctx->stats, "thread");
 2291|       |
 2292|       |    // Wait for all scripts to load before possibly starting playback.
 2293|  11.3k|    if (!mp_clients_all_initialized(mpctx)) {
  ------------------
  |  Branch (2293:9): [True: 212, False: 11.1k]
  ------------------
 2294|    212|        MP_VERBOSE(mpctx, "Waiting for scripts...\n");
  ------------------
  |  |   92|    212|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    212|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
 2295|    693|        while (!mp_clients_all_initialized(mpctx))
  ------------------
  |  Branch (2295:16): [True: 481, False: 212]
  ------------------
 2296|    481|            mp_idle(mpctx);
 2297|    212|        mp_wakeup_core(mpctx); // avoid lost wakeups during waiting
 2298|    212|        MP_VERBOSE(mpctx, "Done loading scripts.\n");
  ------------------
  |  |   92|    212|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    212|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
 2299|    212|    }
 2300|       |    // After above is finished; but even if it's skipped.
 2301|  11.3k|    mp_msg_set_early_logging(mpctx->global, false);
 2302|       |
 2303|  11.3k|    prepare_playlist(mpctx, mpctx->playlist, false);
 2304|       |
 2305|  11.3k|    for (;;) {
 2306|  11.3k|        idle_loop(mpctx);
 2307|       |
 2308|  11.3k|        if (mpctx->stop_play == PT_QUIT)
  ------------------
  |  Branch (2308:13): [True: 11.3k, False: 0]
  ------------------
 2309|  11.3k|            break;
 2310|       |
 2311|      0|        if (mpctx->playlist->current)
  ------------------
  |  Branch (2311:13): [True: 0, False: 0]
  ------------------
 2312|      0|            play_current_file(mpctx);
 2313|       |
 2314|      0|        if (mpctx->stop_play == PT_QUIT)
  ------------------
  |  Branch (2314:13): [True: 0, False: 0]
  ------------------
 2315|      0|            break;
 2316|       |
 2317|      0|        struct playlist_entry *new_entry = NULL;
 2318|      0|        if (mpctx->stop_play == PT_NEXT_ENTRY || mpctx->stop_play == PT_ERROR ||
  ------------------
  |  Branch (2318:13): [True: 0, False: 0]
  |  Branch (2318:50): [True: 0, False: 0]
  ------------------
 2319|      0|            mpctx->stop_play == AT_END_OF_FILE)
  ------------------
  |  Branch (2319:13): [True: 0, False: 0]
  ------------------
 2320|      0|        {
 2321|      0|            new_entry = mp_next_file(mpctx, +1, false, true);
 2322|      0|        } else if (mpctx->stop_play == PT_CURRENT_ENTRY) {
  ------------------
  |  Branch (2322:20): [True: 0, False: 0]
  ------------------
 2323|      0|            new_entry = mpctx->playlist->current;
 2324|      0|        }
 2325|       |
 2326|      0|        if (!new_entry)
  ------------------
  |  Branch (2326:13): [True: 0, False: 0]
  ------------------
 2327|      0|            mpctx->playlist->playlist_completed = true;
 2328|       |
 2329|      0|        mpctx->playlist->current = new_entry;
 2330|      0|        mpctx->playlist->current_was_replaced = false;
 2331|      0|        mpctx->stop_play = new_entry ? PT_NEXT_ENTRY : PT_STOP;
  ------------------
  |  Branch (2331:28): [True: 0, False: 0]
  ------------------
 2332|       |
 2333|      0|        if (!mpctx->playlist->current && mpctx->opts->player_idle_mode < 2)
  ------------------
  |  Branch (2333:13): [True: 0, False: 0]
  |  Branch (2333:42): [True: 0, False: 0]
  ------------------
 2334|      0|            break;
 2335|      0|    }
 2336|       |
 2337|  11.3k|    cancel_open(mpctx);
 2338|       |
 2339|  11.3k|    if (mpctx->encode_lavc_ctx) {
  ------------------
  |  Branch (2339:9): [True: 0, False: 11.3k]
  ------------------
 2340|       |        // Make sure all streams get finished.
 2341|      0|        uninit_audio_out(mpctx);
 2342|      0|        uninit_video_out(mpctx);
 2343|       |
 2344|      0|        if (!encode_lavc_free(mpctx->encode_lavc_ctx))
  ------------------
  |  Branch (2344:13): [True: 0, False: 0]
  ------------------
 2345|      0|            mpctx->files_errored += 1;
 2346|       |
 2347|       |        mpctx->encode_lavc_ctx = NULL;
 2348|      0|    }
 2349|  11.3k|}
loadfile.c:cancel_open:
 1334|  11.3k|{
 1335|  11.3k|    if (mpctx->open_cancel)
  ------------------
  |  Branch (1335:9): [True: 0, False: 11.3k]
  ------------------
 1336|      0|        mp_cancel_trigger(mpctx->open_cancel);
 1337|       |
 1338|  11.3k|    if (mpctx->open_active)
  ------------------
  |  Branch (1338:9): [True: 0, False: 11.3k]
  ------------------
 1339|      0|        mp_thread_join(mpctx->open_thread);
  ------------------
  |  |  215|      0|#define mp_thread_join(t)         pthread_join(t, NULL)
  ------------------
 1340|  11.3k|    mpctx->open_active = false;
 1341|       |
 1342|  11.3k|    if (mpctx->open_res_demuxer)
  ------------------
  |  Branch (1342:9): [True: 0, False: 11.3k]
  ------------------
 1343|      0|        demux_cancel_and_free(mpctx->open_res_demuxer);
 1344|  11.3k|    mpctx->open_res_demuxer = NULL;
 1345|       |
 1346|  11.3k|    TA_FREEP(&mpctx->open_cancel);
  ------------------
  |  |   81|  11.3k|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|  11.3k|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1347|  11.3k|    TA_FREEP(&mpctx->open_url);
  ------------------
  |  |   81|  11.3k|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|  11.3k|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1348|  11.3k|    TA_FREEP(&mpctx->open_format);
  ------------------
  |  |   81|  11.3k|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|  11.3k|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 11.3k]
  |  |  ------------------
  ------------------
 1349|       |
 1350|       |    atomic_store(&mpctx->open_done, false);
 1351|  11.3k|}

mp_update_logging:
  129|  27.7k|{
  130|  27.7k|    bool had_log_file = mp_msg_has_log_file(mpctx->global);
  131|       |
  132|  27.7k|    mp_msg_update_msglevels(mpctx->global, mpctx->opts);
  133|       |
  134|  27.7k|    bool enable = mpctx->opts->use_terminal;
  135|  27.7k|    bool enabled = cas_terminal_owner(mpctx, mpctx);
  136|  27.7k|    if (enable != enabled) {
  ------------------
  |  Branch (136:9): [True: 641, False: 27.1k]
  ------------------
  137|    641|        if (enable && cas_terminal_owner(NULL, mpctx)) {
  ------------------
  |  Branch (137:13): [True: 639, False: 2]
  |  Branch (137:23): [True: 639, False: 0]
  ------------------
  138|    639|            terminal_init();
  139|    639|            enabled = true;
  140|    639|        } else if (!enable) {
  ------------------
  |  Branch (140:20): [True: 2, False: 0]
  ------------------
  141|      2|            terminal_uninit();
  142|      2|            cas_terminal_owner(mpctx, NULL);
  143|      2|        }
  144|    641|    }
  145|       |
  146|  27.7k|    if (mp_msg_has_log_file(mpctx->global) && !had_log_file) {
  ------------------
  |  Branch (146:9): [True: 0, False: 27.7k]
  |  Branch (146:47): [True: 0, False: 0]
  ------------------
  147|       |        // for log-file=... in config files.
  148|       |        // we did flush earlier messages, but they were in a cyclic buffer, so
  149|       |        // the version might have been overwritten. ensure we have it.
  150|      0|        mp_print_version(mpctx->log, false);
  151|      0|    }
  152|       |
  153|  27.7k|    if (enabled && !preinit && mpctx->opts->consolecontrols)
  ------------------
  |  Branch (153:9): [True: 1.00k, False: 26.7k]
  |  Branch (153:20): [True: 363, False: 639]
  |  Branch (153:32): [True: 2, False: 361]
  ------------------
  154|      2|        terminal_setup_getch(mpctx->input);
  155|       |
  156|  27.7k|    if (enabled)
  ------------------
  |  Branch (156:9): [True: 1.00k, False: 26.7k]
  ------------------
  157|  1.00k|        mp_encoder_update_log(mpctx->global);
  158|  27.7k|}
mp_print_version:
  161|  17.2k|{
  162|  17.2k|    int v = always ? MSGL_INFO : MSGL_V;
  ------------------
  |  Branch (162:13): [True: 876, False: 16.4k]
  ------------------
  163|  17.2k|    mp_msg(log, v, "%s %s\n", mpv_version, mpv_copyright);
  164|  17.2k|    if (strcmp(mpv_builddate, "UNKNOWN"))
  ------------------
  |  Branch (164:9): [True: 17.2k, False: 0]
  ------------------
  165|  17.2k|        mp_msg(log, v, " built on %s\n", mpv_builddate);
  166|  17.2k|    mp_msg(log, v, "libplacebo version: %s\n", PL_VERSION);
  ------------------
  |  |   32|  17.2k|#define PL_VERSION (pl_version())
  ------------------
  167|  17.2k|    check_library_versions(log, v);
  168|       |    // Only in verbose mode.
  169|  17.2k|    if (!always) {
  ------------------
  |  Branch (169:9): [True: 16.4k, False: 876]
  ------------------
  170|  16.4k|        mp_msg(log, MSGL_V, "Configuration: " CONFIGURATION "\n");
  171|  16.4k|        mp_msg(log, MSGL_V, "List of enabled features: " FULLCONFIG "\n");
  172|       |        #ifdef NDEBUG
  173|       |            mp_msg(log, MSGL_V, "Built with NDEBUG.\n");
  174|       |        #endif
  175|  16.4k|    }
  176|  17.2k|}
mp_destroy:
  179|  16.4k|{
  180|  16.4k|    mp_shutdown_clients(mpctx);
  181|       |
  182|  16.4k|    mp_uninit_ipc(mpctx->ipc_ctx);
  183|  16.4k|    mpctx->ipc_ctx = NULL;
  184|       |
  185|  16.4k|    uninit_audio_out(mpctx);
  186|  16.4k|    uninit_video_out(mpctx);
  187|       |
  188|       |    // If it's still set here, it's an error.
  189|  16.4k|    encode_lavc_free(mpctx->encode_lavc_ctx);
  190|  16.4k|    mpctx->encode_lavc_ctx = NULL;
  191|       |
  192|  16.4k|    command_uninit(mpctx);
  193|  16.4k|    disc_nav_destroy(mpctx);
  194|       |
  195|  16.4k|    mp_clients_destroy(mpctx);
  196|       |
  197|  16.4k|    osd_free(mpctx->osd);
  198|       |
  199|       |#if HAVE_COCOA
  200|       |    cocoa_set_input_context(NULL);
  201|       |#endif
  202|       |
  203|  16.4k|    if (cas_terminal_owner(mpctx, mpctx)) {
  ------------------
  |  Branch (203:9): [True: 637, False: 15.7k]
  ------------------
  204|    637|        terminal_uninit();
  205|    637|        cas_terminal_owner(mpctx, NULL);
  206|    637|    }
  207|       |
  208|  16.4k|    mp_input_uninit(mpctx->input);
  209|  16.4k|    mp_clipboard_destroy(mpctx->clipboard);
  210|       |
  211|  16.4k|    uninit_libav(mpctx->global);
  212|       |
  213|  16.4k|    mp_msg_uninit(mpctx->global);
  214|  16.4k|    mp_assert(!mpctx->num_abort_list);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (214:5): [True: 16.4k, False: 0]
  ------------------
  215|  16.4k|    talloc_free(mpctx->abort_list);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  216|  16.4k|    mp_mutex_destroy(&mpctx->abort_lock);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
  217|  16.4k|    talloc_free(mpctx->mconfig); // destroy before dispatch
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  218|  16.4k|    talloc_free(mpctx);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  219|  16.4k|}
mp_create:
  261|  16.4k|{
  262|  16.4k|    if (!check_locale()) {
  ------------------
  |  Branch (262:9): [True: 0, False: 16.4k]
  ------------------
  263|       |        // Normally, we never print anything (except if the "terminal" option
  264|       |        // is enabled), so this is an exception.
  265|      0|        fprintf(stderr, "Non-C locale detected. This is not supported.\n"
  266|      0|                        "Call 'setlocale(LC_NUMERIC, \"C\");' in your code.\n");
  267|      0|        return NULL;
  268|      0|    }
  269|       |
  270|  16.4k|    char *enable_talloc = getenv("MPV_LEAK_REPORT");
  271|  16.4k|    if (enable_talloc && strcmp(enable_talloc, "1") == 0)
  ------------------
  |  Branch (271:9): [True: 0, False: 16.4k]
  |  Branch (271:26): [True: 0, False: 0]
  ------------------
  272|      0|        talloc_enable_leak_report();
  ------------------
  |  |   42|      0|#define talloc_enable_leak_report       ta_enable_leak_report
  ------------------
  273|       |
  274|  16.4k|    mp_time_init();
  275|       |
  276|  16.4k|    struct MPContext *mpctx = talloc(NULL, MPContext);
  ------------------
  |  |   26|  16.4k|#define talloc                          ta_xnew
  |  |  ------------------
  |  |  |  |  133|  16.4k|#define ta_xnew(...)                    ta_oom_g(ta_new(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  277|  16.4k|    *mpctx = (struct MPContext){
  278|  16.4k|        .last_chapter = -2,
  279|  16.4k|        .term_osd_contents = talloc_strdup(mpctx, ""),
  ------------------
  |  |   50|  16.4k|#define talloc_strdup                   ta_xstrdup
  ------------------
  280|  16.4k|        .osd_progbar = { .type = -1 },
  281|  16.4k|        .playlist = talloc_zero(mpctx, struct playlist),
  ------------------
  |  |   27|  16.4k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  16.4k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  282|  16.4k|        .dispatch = mp_dispatch_create(mpctx),
  283|  16.4k|        .playback_abort = mp_cancel_new(mpctx),
  284|  16.4k|        .thread_pool = mp_thread_pool_create(mpctx, 0, 1, 30),
  285|  16.4k|        .stop_play = PT_NEXT_ENTRY,
  286|  16.4k|        .play_dir = 1,
  287|  16.4k|    };
  288|       |
  289|  16.4k|    mp_mutex_init(&mpctx->abort_lock);
  290|       |
  291|  16.4k|    mpctx->global = talloc_zero(mpctx, struct mpv_global);
  ------------------
  |  |   27|  16.4k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  16.4k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  292|       |
  293|  16.4k|    demux_packet_pool_init(mpctx->global);
  294|  16.4k|    stats_global_init(mpctx->global);
  295|       |#if HAVE_LIBCURL
  296|       |    mp_curl_global_init(mpctx->global);
  297|       |#endif
  298|       |
  299|       |    // Nothing must call mp_msg*() and related before this
  300|  16.4k|    mp_msg_init(mpctx->global);
  301|  16.4k|    mpctx->log = mp_log_new(mpctx, mpctx->global->log, "!cplayer");
  302|  16.4k|    mpctx->statusline = mp_log_new(mpctx, mpctx->log, "!statusline");
  303|       |
  304|  16.4k|    mpctx->stats = stats_ctx_create(mpctx, mpctx->global, "main");
  305|       |
  306|       |    // Create the config context and register the options
  307|  16.4k|    mpctx->mconfig = m_config_new(mpctx, mpctx->log, &mp_opt_root);
  308|  16.4k|    mpctx->opts = mpctx->mconfig->optstruct;
  309|  16.4k|    mpctx->global->config = mpctx->mconfig->shadow;
  310|  16.4k|    mpctx->mconfig->includefunc = cfg_include;
  311|  16.4k|    mpctx->mconfig->includefunc_ctx = mpctx;
  312|  16.4k|    mpctx->mconfig->use_profiles = true;
  313|  16.4k|    mpctx->mconfig->is_toplevel = true;
  314|  16.4k|    mpctx->mconfig->global = mpctx->global;
  315|  16.4k|    m_config_parse(mpctx->mconfig, "", bstr0(def_config), NULL, 0);
  316|       |
  317|  16.4k|    mpctx->input = mp_input_init(mpctx->global, mp_wakeup_core_cb, mpctx);
  318|  16.4k|    clipboard_init(mpctx);
  319|  16.4k|    screenshot_init(mpctx);
  320|  16.4k|    command_init(mpctx);
  321|  16.4k|    init_libav(mpctx->global);
  322|  16.4k|    mp_clients_init(mpctx);
  323|  16.4k|    mpctx->osd = osd_create(mpctx->global);
  324|       |
  325|       |#if HAVE_COCOA
  326|       |    cocoa_set_input_context(mpctx->input);
  327|       |#endif
  328|       |
  329|  16.4k|    char *verbose_env = getenv("MPV_VERBOSE");
  330|  16.4k|    if (verbose_env)
  ------------------
  |  Branch (330:9): [True: 0, False: 16.4k]
  ------------------
  331|      0|        mpctx->opts->verbose = strtol(verbose_env, NULL, 10);
  332|       |
  333|  16.4k|    mp_cancel_trigger(mpctx->playback_abort);
  334|       |
  335|  16.4k|    return mpctx;
  336|  16.4k|}
mp_initialize:
  344|  16.4k|{
  345|  16.4k|    struct MPOpts *opts = mpctx->opts;
  346|       |
  347|  16.4k|    mp_assert(!mpctx->initialized);
  ------------------
  |  |   41|  16.4k|#define mp_assert assert
  ------------------
  |  Branch (347:5): [True: 16.4k, False: 0]
  ------------------
  348|       |
  349|       |    // Preparse the command line, so we can init the terminal early.
  350|  16.4k|    if (options) {
  ------------------
  |  Branch (350:9): [True: 16.4k, False: 0]
  ------------------
  351|  16.4k|        m_config_preparse_command_line(mpctx->mconfig, mpctx->global,
  352|  16.4k|                                       &opts->verbose, options);
  353|  16.4k|    }
  354|       |
  355|  16.4k|    mp_init_paths(mpctx->global, opts);
  356|  16.4k|    mp_msg_set_early_logging(mpctx->global, true);
  357|  16.4k|    mp_update_logging(mpctx, true);
  358|       |
  359|  16.4k|    if (options) {
  ------------------
  |  Branch (359:9): [True: 16.4k, False: 0]
  ------------------
  360|  16.4k|        MP_VERBOSE(mpctx, "Command line options:");
  ------------------
  |  |   92|  16.4k|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  16.4k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  361|   207k|        for (int i = 0; options[i]; i++)
  ------------------
  |  Branch (361:25): [True: 191k, False: 16.4k]
  ------------------
  362|   191k|            MP_VERBOSE(mpctx, " '%s'", options[i]);
  ------------------
  |  |   92|   191k|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|   191k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  363|  16.4k|        MP_VERBOSE(mpctx, "\n");
  ------------------
  |  |   92|  16.4k|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  16.4k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  364|  16.4k|    }
  365|       |
  366|  16.4k|    mp_print_version(mpctx->log, false);
  367|       |
  368|  16.4k|    mp_parse_cfgfiles(mpctx);
  369|       |
  370|  16.4k|    if (options) {
  ------------------
  |  Branch (370:9): [True: 16.4k, False: 0]
  ------------------
  371|  16.4k|        int r = m_config_parse_mp_command_line(mpctx->mconfig, mpctx->playlist,
  372|  16.4k|                                               mpctx->global, options);
  373|  16.4k|        if (r < 0)
  ------------------
  |  Branch (373:13): [True: 5.00k, False: 11.3k]
  ------------------
  374|  5.00k|            return r == M_OPT_EXIT ? 1 : -1;
  ------------------
  |  |  545|  5.00k|#define M_OPT_EXIT              -6
  ------------------
  |  Branch (374:20): [True: 407, False: 4.60k]
  ------------------
  375|  16.4k|    }
  376|       |
  377|  11.3k|    if (opts->operation_mode == 1) {
  ------------------
  |  Branch (377:9): [True: 3, False: 11.3k]
  ------------------
  378|      3|        m_config_set_profile(mpctx->mconfig, "builtin-pseudo-gui",
  379|      3|                             M_SETOPT_NO_OVERWRITE);
  380|      3|        m_config_set_profile(mpctx->mconfig, "pseudo-gui", 0);
  381|      3|    }
  382|       |
  383|       |    // Backup the default settings, which should not be stored in the resume
  384|       |    // config files. This explicitly includes values set by config files and
  385|       |    // the command line.
  386|  11.3k|    m_config_backup_watch_later_opts(mpctx->mconfig);
  387|       |
  388|  11.3k|    mp_input_load_config(mpctx->input);
  389|       |
  390|       |    // From this point on, all mpctx members are initialized.
  391|  11.3k|    mpctx->initialized = true;
  392|  11.3k|    mpctx->mconfig->option_change_callback = mp_option_change_callback;
  393|  11.3k|    mpctx->mconfig->option_change_callback_ctx = mpctx;
  394|  11.3k|    m_config_set_update_dispatch_queue(mpctx->mconfig, mpctx->dispatch);
  395|       |    // Run all update handlers.
  396|  11.3k|    mp_option_change_callback(mpctx, NULL, UPDATE_OPTS_MASK, false);
  ------------------
  |  |  465|  11.3k|#define UPDATE_OPTS_MASK        ((UPDATE_OPT_LAST << 1) - 1)
  |  |  ------------------
  |  |  |  |  462|  11.3k|#define UPDATE_OPT_LAST         (UINT64_C(1) << 20)
  |  |  ------------------
  ------------------
  397|  11.3k|    handle_option_callbacks(mpctx);
  398|       |
  399|  11.3k|    if (handle_help_options(mpctx))
  ------------------
  |  Branch (399:9): [True: 68, False: 11.3k]
  ------------------
  400|     68|        return 1; // help
  401|       |
  402|       |#if HAVE_WIN32_DESKTOP
  403|       |    if (mp_w32_handle_register(mpctx))
  404|       |        return 1; // register/unregister
  405|       |#endif
  406|       |
  407|  11.3k|    check_library_versions(mp_null_log, 0);
  408|       |
  409|  11.3k|    if (!mpctx->playlist->num_entries && !opts->player_idle_mode &&
  ------------------
  |  Branch (409:9): [True: 7.80k, False: 3.52k]
  |  Branch (409:42): [True: 3, False: 7.80k]
  ------------------
  410|      3|        options)
  ------------------
  |  Branch (410:9): [True: 3, False: 0]
  ------------------
  411|      3|    {
  412|       |        // nothing to play
  413|      3|        mp_print_version(mpctx->log, true);
  414|      3|        MP_INFO(mpctx, "%s", mp_help_text);
  ------------------
  |  |   91|      3|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      3|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  415|      3|        return 1;
  416|      3|    }
  417|       |
  418|  11.3k|    MP_STATS(mpctx, "start init");
  ------------------
  |  |   99|  11.3k|#define MP_STATS(obj, ...)      MP_MSG(obj, MSGL_STATS, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  11.3k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  419|       |
  420|       |#if HAVE_COCOA
  421|       |    mpv_handle *ctx = mp_new_client(mpctx->clients, "mac");
  422|       |    cocoa_set_mpv_handle(ctx);
  423|       |#endif
  424|       |
  425|       |#if HAVE_WIN32_SMTC
  426|       |    mp_smtc_init(mp_new_weak_client(mpctx->clients, "SystemMediaTransportControls"));
  427|       |#endif
  428|       |
  429|  11.3k|    mp_dnd_init(mp_new_weak_client(mpctx->clients, "dnd"));
  430|       |
  431|  11.3k|    mpctx->ipc_ctx = mp_init_ipc(mpctx->clients, mpctx->global);
  432|       |
  433|  11.3k|    if (opts->encode_opts->file && opts->encode_opts->file[0]) {
  ------------------
  |  Branch (433:9): [True: 320, False: 11.0k]
  |  Branch (433:36): [True: 279, False: 41]
  ------------------
  434|    279|        mpctx->encode_lavc_ctx = encode_lavc_init(mpctx->global);
  435|    279|        if(!mpctx->encode_lavc_ctx) {
  ------------------
  |  Branch (435:12): [True: 279, False: 0]
  ------------------
  436|    279|            MP_INFO(mpctx, "Encoding initialization failed.\n");
  ------------------
  |  |   91|    279|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    279|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  437|    279|            return -1;
  438|    279|        }
  439|    279|    }
  440|       |
  441|  11.0k|    mp_load_scripts(mpctx);
  442|       |
  443|  11.0k|    if (opts->force_vo == 2 && handle_force_window(mpctx, false) < 0)
  ------------------
  |  Branch (443:9): [True: 0, False: 11.0k]
  |  Branch (443:32): [True: 0, False: 0]
  ------------------
  444|      0|        return -1;
  445|       |
  446|       |    // Needed to properly enter _initial_ idle mode if playlist empty.
  447|  11.0k|    if (mpctx->opts->player_idle_mode && !mpctx->playlist->num_entries)
  ------------------
  |  Branch (447:9): [True: 11.0k, False: 3]
  |  Branch (447:42): [True: 7.58k, False: 3.45k]
  ------------------
  448|  7.58k|        mpctx->stop_play = PT_STOP;
  449|       |
  450|  11.0k|    MP_STATS(mpctx, "end init");
  ------------------
  |  |   99|  11.0k|#define MP_STATS(obj, ...)      MP_MSG(obj, MSGL_STATS, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  11.0k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  451|       |
  452|  11.0k|    return 0;
  453|  11.0k|}
main.c:cas_terminal_owner:
  119|  45.4k|{
  120|  45.4k|    mp_mutex_lock(&terminal_owner_lock);
  ------------------
  |  |  134|  45.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  121|  45.4k|    bool r = terminal_owner == old;
  122|  45.4k|    if (r)
  ------------------
  |  Branch (122:9): [True: 2.27k, False: 43.2k]
  ------------------
  123|  2.27k|        terminal_owner = new;
  124|  45.4k|    mp_mutex_unlock(&terminal_owner_lock);
  ------------------
  |  |  136|  45.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  125|  45.4k|    return r;
  126|  45.4k|}
main.c:check_locale:
  255|  16.4k|{
  256|  16.4k|    char *name = setlocale(LC_NUMERIC, NULL);
  257|  16.4k|    return !name || strcmp(name, "C") == 0 || strcmp(name, "C.UTF-8") == 0;
  ------------------
  |  Branch (257:12): [True: 0, False: 16.4k]
  |  Branch (257:21): [True: 16.4k, False: 0]
  |  Branch (257:47): [True: 0, False: 0]
  ------------------
  258|  16.4k|}
main.c:handle_help_options:
  222|  11.3k|{
  223|  11.3k|    struct MPOpts *opts = mpctx->opts;
  224|  11.3k|    struct mp_log *log = mpctx->log;
  225|  11.3k|    if (opts->ao_opts->audio_device &&
  ------------------
  |  Branch (225:9): [True: 11.3k, False: 0]
  ------------------
  226|  11.3k|        strcmp(opts->ao_opts->audio_device, "help") == 0)
  ------------------
  |  Branch (226:9): [True: 0, False: 11.3k]
  ------------------
  227|      0|    {
  228|      0|        ao_print_devices(mpctx->global, log, mpctx->ao);
  229|      0|        return true;
  230|      0|    }
  231|  11.3k|    if (opts->property_print_help) {
  ------------------
  |  Branch (231:9): [True: 4, False: 11.3k]
  ------------------
  232|      4|        property_print_help(mpctx);
  233|      4|        return true;
  234|      4|    }
  235|  11.3k|    if (encode_lavc_showhelp(log, opts->encode_opts))
  ------------------
  |  Branch (235:9): [True: 64, False: 11.3k]
  ------------------
  236|     64|        return true;
  237|  11.3k|    return false;
  238|  11.3k|}

update_vo_playback_state:
  192|  16.3k|{
  193|  16.3k|    if (mpctx->video_out && mpctx->video_out->config_ok) {
  ------------------
  |  Branch (193:9): [True: 0, False: 16.3k]
  |  Branch (193:29): [True: 0, False: 0]
  ------------------
  194|      0|        struct voctrl_playback_state oldstate = mpctx->vo_playback_state;
  195|      0|        double pos = get_current_pos_ratio(mpctx, false);
  196|      0|        struct voctrl_playback_state newstate = {
  197|      0|            .taskbar_progress = mpctx->opts->vo->taskbar_progress && pos >= 0,
  ------------------
  |  Branch (197:33): [True: 0, False: 0]
  |  Branch (197:70): [True: 0, False: 0]
  ------------------
  198|      0|            .playing = mpctx->playing,
  199|      0|            .paused = mpctx->paused,
  200|      0|            .position = pos > 0 ? lrint(pos * UINT8_MAX) : 0,
  ------------------
  |  Branch (200:25): [True: 0, False: 0]
  ------------------
  201|      0|        };
  202|       |
  203|      0|        bool state_changed = oldstate.taskbar_progress != newstate.taskbar_progress ||
  ------------------
  |  Branch (203:30): [True: 0, False: 0]
  ------------------
  204|      0|                             oldstate.playing != newstate.playing ||
  ------------------
  |  Branch (204:30): [True: 0, False: 0]
  ------------------
  205|      0|                             oldstate.paused != newstate.paused;
  ------------------
  |  Branch (205:30): [True: 0, False: 0]
  ------------------
  206|      0|        if (state_changed || oldstate.position != newstate.position) {
  ------------------
  |  Branch (206:13): [True: 0, False: 0]
  |  Branch (206:30): [True: 0, False: 0]
  ------------------
  207|       |            // Don't update progress bar if it was and still is hidden
  208|      0|            if ((oldstate.playing && oldstate.taskbar_progress) ||
  ------------------
  |  Branch (208:18): [True: 0, False: 0]
  |  Branch (208:38): [True: 0, False: 0]
  ------------------
  209|      0|                (newstate.playing && newstate.taskbar_progress))
  ------------------
  |  Branch (209:18): [True: 0, False: 0]
  |  Branch (209:38): [True: 0, False: 0]
  ------------------
  210|      0|            {
  211|       |                // Rate-limit progress-only updates. The win32 backend forwards
  212|       |                // these to the shell (explorer.exe), we don't want to spam it
  213|       |                // too much to avoid performance issues, when stealing cpu time
  214|       |                // from the shell thread. In normal playback, this doesn't update
  215|       |                // at all, but in live streams the duration can change, even on
  216|       |                // every frame.
  217|      0|                int64_t now = mp_time_ns();
  218|      0|                int64_t elapsed = now - mpctx->vo_playback_state_time;
  219|      0|                if (!state_changed && elapsed < MP_TIME_MS_TO_NS(1000))
  ------------------
  |  |   72|      0|#define MP_TIME_MS_TO_NS(ms) ((ms) * INT64_C(1000000))
  ------------------
  |  Branch (219:21): [True: 0, False: 0]
  |  Branch (219:39): [True: 0, False: 0]
  ------------------
  220|      0|                    return;
  221|      0|                mpctx->vo_playback_state_time = now;
  222|      0|                vo_control_async(mpctx->video_out,
  223|      0|                                 VOCTRL_UPDATE_PLAYBACK_STATE, &newstate);
  224|      0|            }
  225|      0|            mpctx->vo_playback_state = newstate;
  226|      0|        }
  227|  16.3k|    } else {
  228|  16.3k|        mpctx->vo_playback_state = (struct voctrl_playback_state){ 0 };
  229|  16.3k|    }
  230|  16.3k|}
update_window_title:
  233|  16.3k|{
  234|  16.3k|    if (!mpctx->video_out && !mpctx->ao) {
  ------------------
  |  Branch (234:9): [True: 16.3k, False: 0]
  |  Branch (234:30): [True: 16.3k, False: 0]
  ------------------
  235|  16.3k|        talloc_free(mpctx->last_window_title);
  ------------------
  |  |   47|  16.3k|#define talloc_free                     ta_free
  ------------------
  236|  16.3k|        mpctx->last_window_title = NULL;
  237|  16.3k|        return;
  238|  16.3k|    }
  239|      0|    char *title = mp_property_expand_string(mpctx, mpctx->opts->wintitle);
  240|      0|    if (!mpctx->last_window_title || force ||
  ------------------
  |  Branch (240:9): [True: 0, False: 0]
  |  Branch (240:38): [True: 0, False: 0]
  ------------------
  241|      0|        strcmp(title, mpctx->last_window_title) != 0)
  ------------------
  |  Branch (241:9): [True: 0, False: 0]
  ------------------
  242|      0|    {
  243|      0|        talloc_free(mpctx->last_window_title);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  244|      0|        mpctx->last_window_title = talloc_steal(mpctx, title);
  ------------------
  |  |   38|      0|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|      0|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
  245|       |
  246|      0|        if (mpctx->video_out)
  ------------------
  |  Branch (246:13): [True: 0, False: 0]
  ------------------
  247|      0|            vo_control(mpctx->video_out, VOCTRL_UPDATE_WINDOW_TITLE, title);
  248|       |
  249|      0|        if (mpctx->ao) {
  ------------------
  |  Branch (249:13): [True: 0, False: 0]
  ------------------
  250|      0|            ao_control(mpctx->ao, AOCONTROL_UPDATE_STREAM_TITLE, title);
  251|      0|        }
  252|      0|    } else {
  253|      0|        talloc_free(title);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  254|      0|    }
  255|      0|}
merge_playlist_files:
  352|     98|{
  353|     98|    if (!pl->num_entries)
  ------------------
  |  Branch (353:9): [True: 1, False: 97]
  ------------------
  354|      1|        return;
  355|     97|    char *edl = talloc_strdup(NULL, "edl://");
  ------------------
  |  |   50|     97|#define talloc_strdup                   ta_xstrdup
  ------------------
  356|  11.2k|    for (int n = 0; n < pl->num_entries; n++) {
  ------------------
  |  Branch (356:21): [True: 11.1k, False: 97]
  ------------------
  357|  11.1k|        struct playlist_entry *e = pl->entries[n];
  358|  11.1k|        if (n)
  ------------------
  |  Branch (358:13): [True: 11.0k, False: 97]
  ------------------
  359|  11.0k|            edl = talloc_strdup_append_buffer(edl, ";");
  ------------------
  |  |   58|  11.0k|#define talloc_strdup_append_buffer     ta_talloc_strdup_append_buffer
  ------------------
  360|       |        // Escape if needed
  361|  11.1k|        if (e->filename[strcspn(e->filename, "=%,;\n")] ||
  ------------------
  |  Branch (361:13): [True: 2.97k, False: 8.16k]
  |  Branch (361:13): [True: 2.97k, False: 8.16k]
  ------------------
  362|  8.16k|            bstr_strip(bstr0(e->filename)).len != strlen(e->filename))
  ------------------
  |  Branch (362:13): [True: 0, False: 8.16k]
  ------------------
  363|  2.97k|        {
  364|       |            // %length%
  365|  2.97k|            edl = talloc_asprintf_append_buffer(edl, "%%%zd%%", strlen(e->filename));
  ------------------
  |  |   64|  2.97k|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  ------------------
  366|  2.97k|        }
  367|  11.1k|        edl = talloc_strdup_append_buffer(edl, e->filename);
  ------------------
  |  |   58|  11.1k|#define talloc_strdup_append_buffer     ta_talloc_strdup_append_buffer
  ------------------
  368|  11.1k|    }
  369|     97|    playlist_clear(pl);
  370|     97|    playlist_append_file(pl, edl);
  371|     97|    talloc_free(edl);
  ------------------
  |  |   47|     97|#define talloc_free                     ta_free
  ------------------
  372|     97|}
mp_find_non_filename_media_title:
  435|     18|{
  436|     18|    const char *name = mpctx->opts->media_title;
  437|     18|    if (name && name[0])
  ------------------
  |  Branch (437:9): [True: 0, False: 18]
  |  Branch (437:17): [True: 0, False: 0]
  ------------------
  438|      0|        return name;
  439|     18|    if (mpctx->demuxer) {
  ------------------
  |  Branch (439:9): [True: 0, False: 18]
  ------------------
  440|      0|        name = mp_tags_get_str(mpctx->demuxer->metadata, "service_name");
  441|      0|        if (name && name[0])
  ------------------
  |  Branch (441:13): [True: 0, False: 0]
  |  Branch (441:21): [True: 0, False: 0]
  ------------------
  442|      0|            return name;
  443|      0|        name = mp_tags_get_str(mpctx->demuxer->metadata, "title");
  444|      0|        if (name && name[0])
  ------------------
  |  Branch (444:13): [True: 0, False: 0]
  |  Branch (444:21): [True: 0, False: 0]
  ------------------
  445|      0|            return name;
  446|      0|        name = mp_tags_get_str(mpctx->demuxer->metadata, "icy-title");
  447|      0|        if (name && name[0])
  ------------------
  |  Branch (447:13): [True: 0, False: 0]
  |  Branch (447:21): [True: 0, False: 0]
  ------------------
  448|      0|            return name;
  449|      0|    }
  450|     18|    if (mpctx->playing && mpctx->playing->title)
  ------------------
  |  Branch (450:9): [True: 0, False: 18]
  |  Branch (450:27): [True: 0, False: 0]
  ------------------
  451|      0|        return mpctx->playing->title;
  452|     18|    if (mpctx->demuxer && mpctx->demuxer->server_filename)
  ------------------
  |  Branch (452:9): [True: 0, False: 18]
  |  Branch (452:27): [True: 0, False: 0]
  ------------------
  453|      0|        return mpctx->demuxer->server_filename;
  454|     18|    return NULL;
  455|     18|}

get_current_osd_sym:
  421|     73|{
  422|     73|    int sym = mpctx->osd_function;
  423|     73|    if (!sym) {
  ------------------
  |  Branch (423:9): [True: 73, False: 0]
  ------------------
  424|     73|        if (is_busy(mpctx) || (mpctx->paused_for_cache && !mpctx->opts->pause)) {
  ------------------
  |  Branch (424:13): [True: 73, False: 0]
  |  Branch (424:32): [True: 0, False: 0]
  |  Branch (424:59): [True: 0, False: 0]
  ------------------
  425|     73|            sym = OSD_CLOCK;
  426|     73|        } else if (mpctx->paused || mpctx->step_frames) {
  ------------------
  |  Branch (426:20): [True: 0, False: 0]
  |  Branch (426:37): [True: 0, False: 0]
  ------------------
  427|      0|            sym = OSD_PAUSE;
  428|      0|        } else if (mpctx->play_dir < 0 ) {
  ------------------
  |  Branch (428:20): [True: 0, False: 0]
  ------------------
  429|      0|            sym = OSD_REV;
  430|      0|        } else {
  431|      0|            sym = OSD_PLAY;
  432|      0|        }
  433|     73|    }
  434|     73|    osd_get_function_sym(buf, buf_size, sym);
  435|     73|}
update_osd_msg:
  503|  16.8k|{
  504|  16.8k|    struct MPOpts *opts = mpctx->opts;
  505|  16.8k|    struct osd_state *osd = mpctx->osd;
  506|       |
  507|  16.8k|    double now = mp_time_sec();
  508|       |
  509|  16.8k|    if (!mpctx->osd_force_update) {
  ------------------
  |  Branch (509:9): [True: 16.8k, False: 0]
  ------------------
  510|       |        // Assume nothing is going on at all.
  511|  16.8k|        if (!mpctx->osd_idle_update)
  ------------------
  |  Branch (511:13): [True: 505, False: 16.3k]
  ------------------
  512|    505|            return;
  513|       |
  514|  16.3k|        double delay = 0.050; // update the OSD at most this often
  515|  16.3k|        double diff = now - mpctx->osd_last_update;
  516|  16.3k|        if (diff < delay) {
  ------------------
  |  Branch (516:13): [True: 0, False: 16.3k]
  ------------------
  517|      0|            mp_set_timeout(mpctx, delay - diff);
  518|      0|            return;
  519|      0|        }
  520|  16.3k|    }
  521|  16.3k|    mpctx->osd_force_update = false;
  522|  16.3k|    mpctx->osd_idle_update = false;
  523|  16.3k|    mpctx->osd_last_update = now;
  524|       |
  525|  16.3k|    if (mpctx->osd_visible) {
  ------------------
  |  Branch (525:9): [True: 0, False: 16.3k]
  ------------------
  526|      0|        double sleep = mpctx->osd_visible - now;
  527|      0|        if (sleep > 0) {
  ------------------
  |  Branch (527:13): [True: 0, False: 0]
  ------------------
  528|      0|            mp_set_timeout(mpctx, sleep);
  529|      0|            mpctx->osd_idle_update = true;
  530|      0|        } else {
  531|      0|            mpctx->osd_visible = 0;
  532|      0|            mpctx->osd_progbar.type = -1; // disable
  533|      0|            osd_set_progbar(mpctx->osd, &mpctx->osd_progbar);
  534|      0|        }
  535|      0|    }
  536|       |
  537|  16.3k|    if (mpctx->osd_function_visible) {
  ------------------
  |  Branch (537:9): [True: 0, False: 16.3k]
  ------------------
  538|      0|        double sleep = mpctx->osd_function_visible - now;
  539|      0|        if (sleep > 0) {
  ------------------
  |  Branch (539:13): [True: 0, False: 0]
  ------------------
  540|      0|            mp_set_timeout(mpctx, sleep);
  541|      0|            mpctx->osd_idle_update = true;
  542|      0|        } else {
  543|      0|            mpctx->osd_function_visible = 0;
  544|      0|            mpctx->osd_function = 0;
  545|      0|        }
  546|      0|    }
  547|       |
  548|  16.3k|    if (mpctx->osd_msg_next_duration > 0) {
  ------------------
  |  Branch (548:9): [True: 0, False: 16.3k]
  ------------------
  549|       |        // This is done to avoid cutting the OSD message short if slow commands
  550|       |        // are executed between setting the OSD message and showing it.
  551|      0|        mpctx->osd_msg_visible = now + mpctx->osd_msg_next_duration;
  552|      0|        mpctx->osd_msg_next_duration = 0;
  553|      0|    }
  554|       |
  555|  16.3k|    if (mpctx->osd_msg_visible) {
  ------------------
  |  Branch (555:9): [True: 0, False: 16.3k]
  ------------------
  556|      0|        double sleep = mpctx->osd_msg_visible - now;
  557|      0|        if (sleep > 0) {
  ------------------
  |  Branch (557:13): [True: 0, False: 0]
  ------------------
  558|      0|            mp_set_timeout(mpctx, sleep);
  559|      0|            mpctx->osd_idle_update = true;
  560|      0|        } else {
  561|      0|            talloc_free(mpctx->osd_msg_text);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  562|      0|            mpctx->osd_msg_text = NULL;
  563|      0|            mpctx->osd_msg_visible = 0;
  564|      0|            mpctx->osd_show_pos = false;
  565|      0|        }
  566|      0|    }
  567|       |
  568|  16.3k|    add_seek_osd_messages(mpctx);
  569|       |
  570|  16.3k|    if (mpctx->osd_progbar.type == OSD_BAR_SEEK) {
  ------------------
  |  Branch (570:9): [True: 0, False: 16.3k]
  ------------------
  571|      0|        double pos = get_current_pos_ratio(mpctx, false);
  572|      0|        update_osd_bar(mpctx, OSD_BAR_SEEK, 0, 1, MPCLAMP(pos, 0, 1));
  ------------------
  |  |   46|      0|#define MPCLAMP(a, min, max) (((a) < (min)) ? (min) : (((a) > (max)) ? (max) : (a)))
  |  |  ------------------
  |  |  |  Branch (46:31): [True: 0, False: 0]
  |  |  |  Branch (46:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  573|      0|    }
  574|       |
  575|  16.3k|    term_osd_set_text_lazy(mpctx, mpctx->osd_msg_text);
  576|  16.3k|    term_osd_print_status_lazy(mpctx);
  577|  16.3k|    term_osd_update(mpctx);
  578|       |
  579|  16.3k|    if (!opts->video_osd)
  ------------------
  |  Branch (579:9): [True: 1, False: 16.3k]
  ------------------
  580|      1|        return;
  581|       |
  582|  16.3k|    int osd_level = opts->osd_level;
  583|  16.3k|    if (mpctx->osd_show_pos)
  ------------------
  |  Branch (583:9): [True: 0, False: 16.3k]
  ------------------
  584|      0|        osd_level = 3;
  585|       |
  586|  16.3k|    char *text = NULL;
  587|  16.3k|    sadd_osd_status(&text, mpctx, osd_level);
  588|  16.3k|    if (mpctx->osd_msg_text && mpctx->osd_msg_text[0]) {
  ------------------
  |  Branch (588:9): [True: 0, False: 16.3k]
  |  Branch (588:32): [True: 0, False: 0]
  ------------------
  589|      0|        text = talloc_asprintf_append(text, "%s%s", text ? "\n" : "",
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
  |  Branch (589:53): [True: 0, False: 0]
  ------------------
  590|      0|                                      mpctx->osd_msg_text);
  591|      0|    }
  592|  16.3k|    osd_set_text(osd, text);
  593|  16.3k|    talloc_free(text);
  ------------------
  |  |   47|  16.3k|#define talloc_free                     ta_free
  ------------------
  594|  16.3k|}
osd.c:term_osd_update:
   76|  16.3k|{
   77|  16.3k|    int num_parts = 0;
   78|  16.3k|    char *parts[4] = {0};
   79|       |
   80|  16.3k|    if (!mpctx->opts->use_terminal)
  ------------------
  |  Branch (80:9): [True: 15.7k, False: 638]
  ------------------
   81|  15.7k|        return;
   82|       |
   83|    638|    if (!term_osd_empty(mpctx->term_osd_subs[0]))
  ------------------
  |  Branch (83:9): [True: 0, False: 638]
  ------------------
   84|      0|        parts[num_parts++] = mpctx->term_osd_subs[0];
   85|    638|    if (!term_osd_empty(mpctx->term_osd_subs[1]))
  ------------------
  |  Branch (85:9): [True: 0, False: 638]
  ------------------
   86|      0|        parts[num_parts++] = mpctx->term_osd_subs[1];
   87|    638|    if (!term_osd_empty(mpctx->term_osd_text))
  ------------------
  |  Branch (87:9): [True: 0, False: 638]
  ------------------
   88|      0|        parts[num_parts++] = mpctx->term_osd_text;
   89|    638|    if (!term_osd_empty(mpctx->term_osd_status))
  ------------------
  |  Branch (89:9): [True: 0, False: 638]
  ------------------
   90|      0|        parts[num_parts++] = mpctx->term_osd_status;
   91|       |
   92|    638|    char *s = join_lines(mpctx, parts, num_parts);
   93|       |
   94|    638|    if (strcmp(mpctx->term_osd_contents, s) == 0 &&
  ------------------
  |  Branch (94:9): [True: 638, False: 0]
  ------------------
   95|    638|        mp_msg_has_status_line(mpctx->global))
  ------------------
  |  Branch (95:9): [True: 0, False: 638]
  ------------------
   96|      0|    {
   97|      0|        talloc_free(s);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
   98|    638|    } else {
   99|    638|        talloc_free(mpctx->term_osd_contents);
  ------------------
  |  |   47|    638|#define talloc_free                     ta_free
  ------------------
  100|    638|        mpctx->term_osd_contents = s;
  101|    638|        mp_msg(mpctx->statusline, MSGL_STATUS, "%s", s);
  102|    638|    }
  103|    638|}
osd.c:term_osd_empty:
   71|  2.55k|{
   72|  2.55k|    return !text || !text[0] || !strcmp(text, TERM_MSG_0);
  ------------------
  |  |   30|      0|#define TERM_MSG_0 TERM_MSG_ESCAPE "0"
  |  |  ------------------
  |  |  |  |   29|      0|#define TERM_MSG_ESCAPE "\xC2\x92" "t"
  |  |  ------------------
  ------------------
  |  Branch (72:12): [True: 1.27k, False: 1.27k]
  |  Branch (72:21): [True: 1.27k, False: 0]
  |  Branch (72:33): [True: 0, False: 0]
  ------------------
   73|  2.55k|}
osd.c:join_lines:
   63|    638|{
   64|    638|    char *res = talloc_strdup(ta_ctx, "");
  ------------------
  |  |   50|    638|#define talloc_strdup                   ta_xstrdup
  ------------------
   65|    638|    for (int n = 0; n < num_parts; n++)
  ------------------
  |  Branch (65:21): [True: 0, False: 638]
  ------------------
   66|      0|        res = talloc_asprintf_append(res, "%s%s", n ? "\n" : "", parts[n]);
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
  |  Branch (66:51): [True: 0, False: 0]
  ------------------
   67|    638|    return res;
   68|    638|}
osd.c:is_busy:
  176|     73|{
  177|     73|    return !mpctx->restart_complete && mp_time_sec() - mpctx->start_timestamp > 0.3;
  ------------------
  |  Branch (177:12): [True: 73, False: 0]
  |  Branch (177:40): [True: 73, False: 0]
  ------------------
  178|     73|}
osd.c:add_seek_osd_messages:
  472|  16.3k|{
  473|  16.3k|    if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_BAR) {
  ------------------
  |  Branch (473:9): [True: 0, False: 16.3k]
  ------------------
  474|      0|        double pos = get_current_pos_ratio(mpctx, false);
  475|      0|        set_osd_bar(mpctx, OSD_BAR_SEEK, 0, 1, 0, MPCLAMP(pos, 0, 1));
  ------------------
  |  |   46|      0|#define MPCLAMP(a, min, max) (((a) < (min)) ? (min) : (((a) > (max)) ? (max) : (a)))
  |  |  ------------------
  |  |  |  Branch (46:31): [True: 0, False: 0]
  |  |  |  Branch (46:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  476|      0|        set_osd_bar_chapters(mpctx, OSD_BAR_SEEK);
  477|      0|    }
  478|  16.3k|    if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_TEXT) {
  ------------------
  |  Branch (478:9): [True: 0, False: 16.3k]
  ------------------
  479|       |        // Never in term-osd mode
  480|      0|        bool video_osd = mpctx->video_out && mpctx->opts->video_osd;
  ------------------
  |  Branch (480:26): [True: 0, False: 0]
  |  Branch (480:46): [True: 0, False: 0]
  ------------------
  481|      0|        if (video_osd && mpctx->opts->term_osd != 1) {
  ------------------
  |  Branch (481:13): [True: 0, False: 0]
  |  Branch (481:26): [True: 0, False: 0]
  ------------------
  482|      0|            if (set_osd_msg(mpctx, 1, mpctx->opts->osd_duration, ""))
  ------------------
  |  Branch (482:17): [True: 0, False: 0]
  ------------------
  483|      0|                mpctx->osd_show_pos = true;
  484|      0|        }
  485|      0|    }
  486|  16.3k|    if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_CHAPTER_TEXT) {
  ------------------
  |  Branch (486:9): [True: 0, False: 16.3k]
  ------------------
  487|      0|        char *chapter = chapter_display_name(mpctx, get_current_chapter(mpctx));
  488|      0|        set_osd_msg(mpctx, 1, mpctx->opts->osd_duration,
  489|      0|                     "Chapter: %s", chapter);
  490|      0|        talloc_free(chapter);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  491|      0|    }
  492|  16.3k|    if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_CURRENT_FILE) {
  ------------------
  |  Branch (492:9): [True: 0, False: 16.3k]
  ------------------
  493|      0|        if (mpctx->filename) {
  ------------------
  |  Branch (493:13): [True: 0, False: 0]
  ------------------
  494|      0|            set_osd_msg(mpctx, 1, mpctx->opts->osd_duration, "%s",
  495|      0|                        mpctx->filename);
  496|      0|        }
  497|      0|    }
  498|  16.3k|    mpctx->add_osd_seek_info = 0;
  499|  16.3k|}
osd.c:term_osd_set_text_lazy:
  139|  16.3k|{
  140|  16.3k|    bool video_osd = mpctx->video_out && mpctx->opts->video_osd;
  ------------------
  |  Branch (140:22): [True: 0, False: 16.3k]
  |  Branch (140:42): [True: 0, False: 0]
  ------------------
  141|  16.3k|    if ((video_osd && mpctx->opts->term_osd != 1) || !text)
  ------------------
  |  Branch (141:10): [True: 0, False: 16.3k]
  |  Branch (141:23): [True: 0, False: 0]
  |  Branch (141:54): [True: 16.3k, False: 0]
  ------------------
  142|  16.3k|        text = ""; // disable
  143|  16.3k|    talloc_replace(mpctx, mpctx->term_osd_text, text);
  ------------------
  |  |   54|  16.3k|#define talloc_replace                  ta_replace
  |  |  ------------------
  |  |  |  |  106|  16.3k|    do {                                                \
  |  |  |  |  107|  16.3k|        if (!(str)) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:13): [True: 16.3k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  108|  16.3k|            (str) = ta_xstrdup((ta_parent), (replace)); \
  |  |  |  |  109|  16.3k|        } else {                                        \
  |  |  |  |  110|      0|            *(str) = '\0';                              \
  |  |  |  |  111|      0|            ta_xstrdup_append(&(str), (replace));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|      0|#define ta_xstrdup_append(...)          ta_oom_b(ta_strdup_append(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  112|      0|        }                                               \
  |  |  |  |  113|  16.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (113:14): [Folded, False: 16.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  144|  16.3k|}
osd.c:term_osd_print_status_lazy:
  281|  16.3k|{
  282|  16.3k|    struct MPOpts *opts = mpctx->opts;
  283|       |
  284|  16.3k|    term_osd_update_title(mpctx);
  285|  16.3k|    update_window_title(mpctx, false);
  286|  16.3k|    update_vo_playback_state(mpctx);
  287|       |
  288|  16.3k|    if (!opts->use_terminal)
  ------------------
  |  Branch (288:9): [True: 15.7k, False: 638]
  ------------------
  289|  15.7k|        return;
  290|       |
  291|    638|    if (opts->quiet || !mpctx->playback_initialized || !mpctx->playing_msg_shown)
  ------------------
  |  Branch (291:9): [True: 1, False: 637]
  |  Branch (291:24): [True: 637, False: 0]
  |  Branch (291:56): [True: 0, False: 0]
  ------------------
  292|    638|    {
  293|    638|        if (!mpctx->playing)
  ------------------
  |  Branch (293:13): [True: 638, False: 0]
  ------------------
  294|    638|            term_osd_set_status_lazy(mpctx, "");
  295|    638|        return;
  296|    638|    }
  297|       |
  298|      0|    char *line = get_term_status_msg(mpctx);
  299|       |
  300|      0|    if (opts->term_osd_bar) {
  ------------------
  |  Branch (300:9): [True: 0, False: 0]
  ------------------
  301|      0|        saddf(&line, "\n");
  ------------------
  |  |   47|      0|#define saddf(var, ...) (*(var) = talloc_asprintf_append((*var), __VA_ARGS__))
  |  |  ------------------
  |  |  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  |  |  ------------------
  ------------------
  302|      0|        int w = 80, h = 24;
  303|      0|        terminal_get_size(&w, &h);
  304|      0|        add_term_osd_bar(mpctx, &line, w);
  305|      0|    }
  306|       |
  307|      0|    term_osd_set_status_lazy(mpctx, line);
  308|      0|    talloc_free(line);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  309|      0|}
osd.c:term_osd_update_title:
  106|  16.3k|{
  107|  16.3k|    if (!mpctx->opts->use_terminal)
  ------------------
  |  Branch (107:9): [True: 15.7k, False: 638]
  ------------------
  108|  15.7k|        return;
  109|       |
  110|    638|    char *s = mp_property_expand_escaped_string(mpctx, mpctx->opts->term_title);
  111|    638|    bstr title = bstr0(s);
  112|    638|    mp_msg_sanitize(&title, false);
  113|    638|    if (bstr_equals(title, bstr0(mpctx->term_osd_title))) {
  ------------------
  |  Branch (113:9): [True: 594, False: 44]
  ------------------
  114|    594|        talloc_free(s);
  ------------------
  |  |   47|    594|#define talloc_free                     ta_free
  ------------------
  115|    594|        return;
  116|    594|    }
  117|       |
  118|     44|    mp_msg_set_term_title(mpctx->statusline, s);
  119|     44|    mpctx->term_osd_title = talloc_steal(mpctx, s);
  ------------------
  |  |   38|     44|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|     44|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
  120|     44|}
osd.c:term_osd_set_status_lazy:
  147|    638|{
  148|    638|    talloc_replace(mpctx, mpctx->term_osd_status, text);
  ------------------
  |  |   54|    638|#define talloc_replace                  ta_replace
  |  |  ------------------
  |  |  |  |  106|    638|    do {                                                \
  |  |  |  |  107|    638|        if (!(str)) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (107:13): [True: 638, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  108|    638|            (str) = ta_xstrdup((ta_parent), (replace)); \
  |  |  |  |  109|    638|        } else {                                        \
  |  |  |  |  110|      0|            *(str) = '\0';                              \
  |  |  |  |  111|      0|            ta_xstrdup_append(&(str), (replace));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|      0|#define ta_xstrdup_append(...)          ta_oom_b(ta_strdup_append(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  112|      0|        }                                               \
  |  |  |  |  113|    638|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (113:14): [Folded, False: 638]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  149|    638|}
osd.c:sadd_hhmmssff:
   51|      3|{
   52|      3|    char *s = mp_format_time(time, fractions);
   53|      3|    *buf = talloc_strdup_append(*buf, s);
  ------------------
  |  |   57|      3|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
   54|      3|    talloc_free(s);
  ------------------
  |  |   47|      3|#define talloc_free                     ta_free
  ------------------
   55|      3|}
osd.c:sadd_percentage:
   57|      1|static void sadd_percentage(char **buf, double ratio) {
   58|      1|    if (ratio >= 0)
  ------------------
  |  Branch (58:9): [True: 0, False: 1]
  ------------------
   59|      0|        *buf = talloc_asprintf_append(*buf, " (%.f%%)", ratio * 100);
  ------------------
  |  |   63|      0|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
   60|      1|}
osd.c:sadd_osd_status:
  438|  16.3k|{
  439|  16.3k|    mp_assert(level >= 0 && level <= 3);
  ------------------
  |  |   41|  16.3k|#define mp_assert assert
  ------------------
  |  Branch (439:5): [True: 16.3k, False: 0]
  |  Branch (439:5): [True: 16.3k, False: 0]
  ------------------
  440|  16.3k|    if (level == 0)
  ------------------
  |  Branch (440:9): [True: 1, False: 16.3k]
  ------------------
  441|      1|        return;
  442|  16.3k|    char *msg = mpctx->opts->osd_msg[level - 1];
  443|       |
  444|  16.3k|    if (msg && msg[0]) {
  ------------------
  |  Branch (444:9): [True: 2.58k, False: 13.8k]
  |  Branch (444:16): [True: 2.58k, False: 1]
  ------------------
  445|  2.58k|        char *text = mp_property_expand_escaped_string(mpctx, msg);
  446|  2.58k|        *buffer = talloc_strdup_append(*buffer, text);
  ------------------
  |  |   57|  2.58k|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
  447|  2.58k|        talloc_free(text);
  ------------------
  |  |   47|  2.58k|#define talloc_free                     ta_free
  ------------------
  448|  13.8k|    } else if (level >= 2) {
  ------------------
  |  Branch (448:16): [True: 2, False: 13.7k]
  ------------------
  449|      2|        bool fractions = mpctx->opts->osd_fractions;
  450|      2|        char sym[10];
  451|      2|        get_current_osd_sym(mpctx, sym, sizeof(sym));
  452|      2|        saddf(buffer, "%s ", sym);
  ------------------
  |  |   47|      2|#define saddf(var, ...) (*(var) = talloc_asprintf_append((*var), __VA_ARGS__))
  |  |  ------------------
  |  |  |  |   63|      2|#define talloc_asprintf_append          ta_talloc_asprintf_append
  |  |  ------------------
  ------------------
  453|      2|        char *custom_msg = mpctx->opts->osd_status_msg;
  454|      2|        if (custom_msg && level == 3) {
  ------------------
  |  Branch (454:13): [True: 0, False: 2]
  |  Branch (454:27): [True: 0, False: 0]
  ------------------
  455|      0|            char *text = mp_property_expand_escaped_string(mpctx, custom_msg);
  456|      0|            *buffer = talloc_strdup_append(*buffer, text);
  ------------------
  |  |   57|      0|#define talloc_strdup_append            ta_talloc_strdup_append
  ------------------
  457|      0|            talloc_free(text);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  458|      2|        } else {
  459|      2|            sadd_hhmmssff(buffer, get_playback_time(mpctx), fractions);
  460|      2|            if (level == 3) {
  ------------------
  |  Branch (460:17): [True: 1, False: 1]
  ------------------
  461|      1|                saddf(buffer, " / ");
  ------------------
  |  |   47|      1|#define saddf(var, ...) (*(var) = talloc_asprintf_append((*var), __VA_ARGS__))
  |  |  ------------------
  |  |  |  |   63|      1|#define talloc_asprintf_append          ta_talloc_asprintf_append
  |  |  ------------------
  ------------------
  462|      1|                sadd_hhmmssff(buffer, get_time_length(mpctx), fractions);
  463|       |                sadd_percentage(buffer, get_current_pos_ratio(mpctx, false));
  464|      1|            }
  465|      2|        }
  466|      2|    }
  467|  16.3k|}

mp_wait_events:
   55|  33.9k|{
   56|  33.9k|    mp_client_send_property_changes(mpctx);
   57|       |
   58|  33.9k|    stats_event(mpctx->stats, "iterations");
   59|       |
   60|  33.9k|    bool sleeping = mpctx->sleeptime > 0;
   61|  33.9k|    if (sleeping)
  ------------------
  |  Branch (61:9): [True: 17.5k, False: 16.4k]
  ------------------
   62|  33.9k|        MP_STATS(mpctx, "start sleep");
  ------------------
  |  |   99|  17.5k|#define MP_STATS(obj, ...)      MP_MSG(obj, MSGL_STATS, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  17.5k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
   63|       |
   64|  33.9k|    mp_dispatch_queue_process(mpctx->dispatch, mpctx->sleeptime);
   65|       |
   66|  33.9k|    mpctx->sleeptime = INFINITY;
   67|       |
   68|  33.9k|    if (sleeping)
  ------------------
  |  Branch (68:9): [True: 17.5k, False: 16.4k]
  ------------------
   69|  33.9k|        MP_STATS(mpctx, "end sleep");
  ------------------
  |  |   99|  17.5k|#define MP_STATS(obj, ...)      MP_MSG(obj, MSGL_STATS, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  17.5k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
   70|  33.9k|}
mp_set_timeout:
   76|  33.9k|{
   77|  33.9k|    if (mpctx->sleeptime > sleeptime) {
  ------------------
  |  Branch (77:9): [True: 17.0k, False: 16.8k]
  ------------------
   78|  17.0k|        mpctx->sleeptime = sleeptime;
   79|  17.0k|        int64_t abstime = mp_time_ns_add(mp_time_ns(), sleeptime);
   80|  17.0k|        mp_dispatch_adjust_timeout(mpctx->dispatch, abstime);
   81|  17.0k|    }
   82|  33.9k|}
mp_wakeup_core:
   88|  77.9k|{
   89|  77.9k|    mp_dispatch_interrupt(mpctx->dispatch);
   90|  77.9k|}
handle_option_callbacks:
  128|  28.2k|{
  129|  39.6k|    for (int i = 0; i < mpctx->num_option_callbacks; i++)
  ------------------
  |  Branch (129:21): [True: 11.3k, False: 28.2k]
  ------------------
  130|  11.3k|        mp_option_run_callback(mpctx, &mpctx->option_callbacks[i]);
  131|  28.2k|    mpctx->num_option_callbacks = 0;
  132|  28.2k|}
update_screensaver_state:
  207|  11.3k|{
  208|  11.3k|    if (!mpctx->video_out)
  ------------------
  |  Branch (208:9): [True: 11.3k, False: 0]
  ------------------
  209|  11.3k|        return;
  210|       |
  211|  11.3k|    bool saver_state = (!mpctx->playback_active || !mpctx->opts->stop_screensaver) &&
  ------------------
  |  Branch (211:25): [True: 0, False: 0]
  |  Branch (211:52): [True: 0, False: 0]
  ------------------
  212|      0|                       mpctx->opts->stop_screensaver != 2;
  ------------------
  |  Branch (212:24): [True: 0, False: 0]
  ------------------
  213|      0|    vo_control_async(mpctx->video_out, saver_state ? VOCTRL_RESTORE_SCREENSAVER
  ------------------
  |  Branch (213:40): [True: 0, False: 0]
  ------------------
  214|      0|                                                   : VOCTRL_KILL_SCREENSAVER, NULL);
  215|      0|}
get_time_length:
  531|     55|{
  532|     55|    struct demuxer *demuxer = mpctx->demuxer;
  533|     55|    return demuxer && demuxer->duration >= 0 ? demuxer->duration : MP_NOPTS_VALUE;
  ------------------
  |  |   39|     55|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (533:12): [True: 0, False: 55]
  |  Branch (533:23): [True: 0, False: 0]
  ------------------
  534|     55|}
get_current_time:
  551|     38|{
  552|     38|    if (!mpctx->demuxer)
  ------------------
  |  Branch (552:9): [True: 38, False: 0]
  ------------------
  553|     38|        return MP_NOPTS_VALUE;
  ------------------
  |  |   39|     38|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  554|      0|    if (mpctx->playback_pts != MP_NOPTS_VALUE)
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (554:9): [True: 0, False: 0]
  ------------------
  555|      0|        return mpctx->playback_pts * mpctx->play_dir;
  556|      0|    return mpctx->last_seek_pts;
  557|      0|}
get_playback_time:
  560|     38|{
  561|     38|    double cur = get_current_time(mpctx);
  562|       |    // During seeking, the time corresponds to the last seek time - apply some
  563|       |    // cosmetics to it.
  564|     38|    if (cur != MP_NOPTS_VALUE && mpctx->playback_pts == MP_NOPTS_VALUE) {
  ------------------
  |  |   39|     76|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
                  if (cur != MP_NOPTS_VALUE && mpctx->playback_pts == MP_NOPTS_VALUE) {
  ------------------
  |  |   39|      0|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (564:9): [True: 0, False: 38]
  |  Branch (564:34): [True: 0, False: 0]
  ------------------
  565|      0|        double length = get_time_length(mpctx);
  566|      0|        if (length >= 0)
  ------------------
  |  Branch (566:13): [True: 0, False: 0]
  ------------------
  567|      0|            cur = MPCLAMP(cur, 0, length);
  ------------------
  |  |   46|      0|#define MPCLAMP(a, min, max) (((a) < (min)) ? (min) : (((a) > (max)) ? (max) : (a)))
  |  |  ------------------
  |  |  |  Branch (46:31): [True: 0, False: 0]
  |  |  |  Branch (46:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  568|      0|    }
  569|       |    // Force to 0 if this is not MP_NOPTS_VALUE.
  570|     38|    if (cur != MP_NOPTS_VALUE && cur < 0)
  ------------------
  |  |   39|     76|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  |  Branch (570:9): [True: 0, False: 38]
  |  Branch (570:34): [True: 0, False: 0]
  ------------------
  571|      0|        cur = 0.0;
  572|     38|    return cur;
  573|     38|}
get_current_pos_ratio:
  577|      1|{
  578|      1|    struct demuxer *demuxer = mpctx->demuxer;
  579|      1|    if (!demuxer)
  ------------------
  |  Branch (579:9): [True: 1, False: 0]
  ------------------
  580|      1|        return -1;
  581|      0|    double ret = -1;
  582|      0|    double start = 0;
  583|      0|    double len = get_time_length(mpctx);
  584|      0|    if (use_range) {
  ------------------
  |  Branch (584:9): [True: 0, False: 0]
  ------------------
  585|      0|        double startpos = get_play_start_pts(mpctx);
  586|      0|        double endpos = get_play_end_pts(mpctx);
  587|      0|        if (endpos > MPMAX(0, len))
  ------------------
  |  |   44|      0|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (587:13): [True: 0, False: 0]
  ------------------
  588|      0|            endpos = MPMAX(0, len);
  ------------------
  |  |   44|      0|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  589|      0|        if (endpos < startpos)
  ------------------
  |  Branch (589:13): [True: 0, False: 0]
  ------------------
  590|      0|            endpos = startpos;
  591|      0|        start = startpos;
  592|      0|        len = endpos - startpos;
  593|      0|    }
  594|      0|    double pos = get_current_time(mpctx);
  595|      0|    if (len > 0)
  ------------------
  |  Branch (595:9): [True: 0, False: 0]
  ------------------
  596|      0|        ret = MPCLAMP((pos - start) / len, 0, 1);
  ------------------
  |  |   46|      0|#define MPCLAMP(a, min, max) (((a) < (min)) ? (min) : (((a) > (max)) ? (max) : (a)))
  |  |  ------------------
  |  |  |  Branch (46:31): [True: 0, False: 0]
  |  |  |  Branch (46:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  597|      0|    if (ret < 0) {
  ------------------
  |  Branch (597:9): [True: 0, False: 0]
  ------------------
  598|      0|        int64_t size = demuxer->filesize;
  599|      0|        if (size > 0 && demuxer->filepos >= 0)
  ------------------
  |  Branch (599:13): [True: 0, False: 0]
  |  Branch (599:25): [True: 0, False: 0]
  ------------------
  600|      0|            ret = MPCLAMP(demuxer->filepos / (double)size, 0, 1);
  ------------------
  |  |   46|      0|#define MPCLAMP(a, min, max) (((a) < (min)) ? (min) : (((a) > (max)) ? (max) : (a)))
  |  |  ------------------
  |  |  |  Branch (46:31): [True: 0, False: 0]
  |  |  |  Branch (46:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  601|      0|    }
  602|      0|    if (use_range) {
  ------------------
  |  Branch (602:9): [True: 0, False: 0]
  ------------------
  603|      0|        if (mpctx->opts->play_frames > 0)
  ------------------
  |  Branch (603:13): [True: 0, False: 0]
  ------------------
  604|      0|            ret = MPMAX(ret, 1.0 -
  ------------------
  |  |   44|      0|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  605|      0|                    mpctx->max_frames / (double) mpctx->opts->play_frames);
  606|      0|    }
  607|      0|    return ret;
  608|      1|}
get_current_chapter:
  612|      1|{
  613|      1|    if (!mpctx->num_chapters)
  ------------------
  |  Branch (613:9): [True: 1, False: 0]
  ------------------
  614|      1|        return -2;
  615|      0|    double current_pts = get_current_time(mpctx);
  616|      0|    int i;
  617|      0|    for (i = 0; i < mpctx->num_chapters; i++)
  ------------------
  |  Branch (617:17): [True: 0, False: 0]
  ------------------
  618|      0|        if (current_pts < mpctx->chapters[i].pts)
  ------------------
  |  Branch (618:13): [True: 0, False: 0]
  ------------------
  619|      0|            break;
  620|      0|    return mpctx->last_chapter_flag ?
  ------------------
  |  Branch (620:12): [True: 0, False: 0]
  ------------------
  621|      0|        mpctx->last_chapter_seek : MPMAX(mpctx->last_chapter_seek, i - 1);
  ------------------
  |  |   44|      0|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  622|      1|}
get_chapter_count:
  662|    112|{
  663|    112|    return mpctx->num_chapters;
  664|    112|}
mp_idle:
 1401|  16.8k|{
 1402|  16.8k|    handle_dummy_ticks(mpctx);
 1403|  16.8k|    handle_clipboard_updates(mpctx);
 1404|  16.8k|    mp_wait_events(mpctx);
 1405|  16.8k|    mp_process_input(mpctx);
 1406|  16.8k|    handle_option_callbacks(mpctx);
 1407|  16.8k|    handle_command_updates(mpctx);
 1408|  16.8k|    handle_update_cache(mpctx);
 1409|  16.8k|    handle_cursor_autohide(mpctx);
 1410|  16.8k|    handle_vo_events(mpctx);
 1411|  16.8k|    update_osd_msg(mpctx);
 1412|  16.8k|    handle_osd_redraw(mpctx);
 1413|  16.8k|}
idle_loop:
 1417|  11.3k|{
 1418|       |    // ================= idle loop (STOP state) =========================
 1419|  11.3k|    bool need_reinit = true;
 1420|  11.3k|    while (mpctx->opts->player_idle_mode && mpctx->stop_play == PT_STOP) {
  ------------------
  |  Branch (1420:12): [True: 11.3k, False: 7]
  |  Branch (1420:45): [True: 0, False: 11.3k]
  ------------------
 1421|      0|        if (need_reinit) {
  ------------------
  |  Branch (1421:13): [True: 0, False: 0]
  ------------------
 1422|      0|            uninit_audio_out(mpctx);
 1423|      0|            handle_force_window(mpctx, true);
 1424|      0|            mp_wakeup_core(mpctx);
 1425|      0|            mp_notify(mpctx, MPV_EVENT_IDLE, NULL);
 1426|      0|            demux_packet_pool_clear(demux_packet_pool_get(mpctx->global));
 1427|       |            need_reinit = false;
 1428|      0|        }
 1429|      0|        mp_idle(mpctx);
 1430|      0|    }
 1431|  11.3k|}
playloop.c:handle_cursor_autohide:
  850|  16.8k|{
  851|  16.8k|    struct MPOpts *opts = mpctx->opts;
  852|  16.8k|    struct vo *vo = mpctx->video_out;
  853|       |
  854|  16.8k|    if (!vo)
  ------------------
  |  Branch (854:9): [True: 16.8k, False: 0]
  ------------------
  855|  16.8k|        return;
  856|       |
  857|  16.8k|    bool mouse_cursor_visible = mpctx->mouse_cursor_visible;
  858|      0|    double now = mp_time_sec();
  859|       |
  860|      0|    unsigned mouse_event_ts = mp_input_get_mouse_event_counter(mpctx->input);
  861|      0|    if (mpctx->mouse_event_ts != mouse_event_ts) {
  ------------------
  |  Branch (861:9): [True: 0, False: 0]
  ------------------
  862|      0|        mpctx->mouse_event_ts = mouse_event_ts;
  863|      0|        mpctx->mouse_timer = now + opts->cursor_autohide_delay / 1000.0;
  864|      0|        mouse_cursor_visible = true;
  865|      0|    }
  866|       |
  867|      0|    if (mpctx->mouse_timer > now) {
  ------------------
  |  Branch (867:9): [True: 0, False: 0]
  ------------------
  868|      0|        mp_set_timeout(mpctx, mpctx->mouse_timer - now);
  869|      0|    } else {
  870|      0|        mouse_cursor_visible = false;
  871|      0|    }
  872|       |
  873|      0|    if (opts->cursor_autohide_delay == -1)
  ------------------
  |  Branch (873:9): [True: 0, False: 0]
  ------------------
  874|      0|        mouse_cursor_visible = true;
  875|       |
  876|      0|    if (opts->cursor_autohide_delay == -2)
  ------------------
  |  Branch (876:9): [True: 0, False: 0]
  ------------------
  877|      0|        mouse_cursor_visible = false;
  878|       |
  879|      0|    if (opts->cursor_autohide_fs && !opts->vo->fullscreen)
  ------------------
  |  Branch (879:9): [True: 0, False: 0]
  |  Branch (879:37): [True: 0, False: 0]
  ------------------
  880|      0|        mouse_cursor_visible = true;
  881|       |
  882|      0|    if (mouse_cursor_visible != mpctx->mouse_cursor_visible)
  ------------------
  |  Branch (882:9): [True: 0, False: 0]
  ------------------
  883|      0|        vo_control(vo, VOCTRL_SET_CURSOR_VISIBILITY, &mouse_cursor_visible);
  884|      0|    mpctx->mouse_cursor_visible = mouse_cursor_visible;
  885|      0|}
playloop.c:handle_vo_events:
  888|  16.8k|{
  889|  16.8k|    struct vo *vo = mpctx->video_out;
  890|  16.8k|    int events = vo ? vo_query_and_reset_events(vo, VO_EVENTS_USER) : 0;
  ------------------
  |  Branch (890:18): [True: 0, False: 16.8k]
  ------------------
  891|  16.8k|    if (events & VO_EVENT_RESIZE)
  ------------------
  |  Branch (891:9): [True: 0, False: 16.8k]
  ------------------
  892|      0|        mp_notify(mpctx, MP_EVENT_WIN_RESIZE, NULL);
  893|  16.8k|    if (events & VO_EVENT_WIN_STATE)
  ------------------
  |  Branch (893:9): [True: 0, False: 16.8k]
  ------------------
  894|      0|        mp_notify(mpctx, MP_EVENT_WIN_STATE, NULL);
  895|  16.8k|    if (events & VO_EVENT_DPI)
  ------------------
  |  Branch (895:9): [True: 0, False: 16.8k]
  ------------------
  896|      0|        mp_notify(mpctx, MP_EVENT_WIN_STATE2, NULL);
  897|  16.8k|    if (events & VO_EVENT_FOCUS)
  ------------------
  |  Branch (897:9): [True: 0, False: 16.8k]
  ------------------
  898|      0|        mp_notify(mpctx, MP_EVENT_FOCUS, NULL);
  899|  16.8k|    if (events & VO_EVENT_AMBIENT_LIGHTING_CHANGED)
  ------------------
  |  Branch (899:9): [True: 0, False: 16.8k]
  ------------------
  900|      0|        mp_notify(mpctx, MP_EVENT_AMBIENT_LIGHTING_CHANGED, NULL);
  901|  16.8k|    if (events & VO_EVENT_PRESENTATION_DELAY)
  ------------------
  |  Branch (901:9): [True: 0, False: 16.8k]
  ------------------
  902|      0|        mp_notify(mpctx, MP_EVENT_PRESENTATION_DELAY, NULL);
  903|  16.8k|}
playloop.c:handle_dummy_ticks:
 1121|  16.8k|{
 1122|  16.8k|    if ((mpctx->video_status != STATUS_PLAYING &&
  ------------------
  |  Branch (1122:10): [True: 16.8k, False: 0]
  ------------------
 1123|  16.8k|         mpctx->video_status != STATUS_DRAINING) ||
  ------------------
  |  Branch (1123:10): [True: 16.8k, False: 0]
  ------------------
 1124|      0|         mpctx->paused)
  ------------------
  |  Branch (1124:10): [True: 0, False: 0]
  ------------------
 1125|  16.8k|    {
 1126|  16.8k|        if (mp_time_sec() - mpctx->last_idle_tick > 0.050) {
  ------------------
  |  Branch (1126:13): [True: 16.3k, False: 505]
  ------------------
 1127|  16.3k|            mpctx->last_idle_tick = mp_time_sec();
 1128|       |            mp_notify(mpctx, MPV_EVENT_TICK, NULL);
 1129|  16.3k|        }
 1130|  16.8k|    }
 1131|  16.8k|}
playloop.c:handle_clipboard_updates:
 1323|  16.8k|{
 1324|  16.8k|    if (mp_clipboard_data_changed(mpctx->clipboard))
  ------------------
  |  Branch (1324:9): [True: 0, False: 16.8k]
  ------------------
 1325|      0|        mp_notify_property(mpctx, "clipboard");
 1326|  16.8k|}
playloop.c:handle_osd_redraw:
  679|  16.8k|{
  680|  16.8k|    if (!mpctx->video_out || !mpctx->video_out->config_ok || (mpctx->playing && mpctx->stop_play))
  ------------------
  |  Branch (680:9): [True: 16.8k, False: 0]
  |  Branch (680:30): [True: 0, False: 0]
  |  Branch (680:63): [True: 0, False: 0]
  |  Branch (680:81): [True: 0, False: 0]
  ------------------
  681|  16.8k|        return;
  682|       |    // If we're playing normally, let OSD be redrawn naturally as part of
  683|       |    // video display.
  684|      0|    if (!mpctx->paused) {
  ------------------
  |  Branch (684:9): [True: 0, False: 0]
  ------------------
  685|      0|        if (mpctx->sleeptime < 0.1 && mpctx->video_status == STATUS_PLAYING)
  ------------------
  |  Branch (685:13): [True: 0, False: 0]
  |  Branch (685:39): [True: 0, False: 0]
  ------------------
  686|      0|            return;
  687|      0|    }
  688|       |    // Don't redraw immediately during a seek (makes it significantly slower).
  689|      0|    bool use_video = mpctx->vo_chain && !mpctx->vo_chain->is_sparse;
  ------------------
  |  Branch (689:22): [True: 0, False: 0]
  |  Branch (689:41): [True: 0, False: 0]
  ------------------
  690|      0|    if (use_video && mp_time_sec() - mpctx->start_timestamp < 0.1) {
  ------------------
  |  Branch (690:9): [True: 0, False: 0]
  |  Branch (690:22): [True: 0, False: 0]
  ------------------
  691|      0|        mp_set_timeout(mpctx, 0.1);
  692|      0|        return;
  693|      0|    }
  694|      0|    bool want_redraw = osd_query_and_reset_want_redraw(mpctx->osd) ||
  ------------------
  |  Branch (694:24): [True: 0, False: 0]
  ------------------
  695|      0|                       vo_want_redraw(mpctx->video_out);
  ------------------
  |  Branch (695:24): [True: 0, False: 0]
  ------------------
  696|      0|    if (!want_redraw)
  ------------------
  |  Branch (696:9): [True: 0, False: 0]
  ------------------
  697|      0|        return;
  698|      0|    vo_redraw(mpctx->video_out);
  699|      0|}
playloop.c:handle_update_cache:
  715|  16.8k|{
  716|  16.8k|    bool force_update = false;
  717|  16.8k|    struct MPOpts *opts = mpctx->opts;
  718|       |
  719|  16.8k|    if (!mpctx->demuxer || mpctx->encode_lavc_ctx) {
  ------------------
  |  Branch (719:9): [True: 16.8k, False: 0]
  |  Branch (719:28): [True: 0, False: 0]
  ------------------
  720|  16.8k|        clear_underruns(mpctx);
  721|  16.8k|        return;
  722|  16.8k|    }
  723|       |
  724|      0|    double now = mp_time_sec();
  725|       |
  726|      0|    struct demux_reader_state s;
  727|      0|    demux_get_reader_state(mpctx->demuxer, &s);
  728|       |
  729|      0|    mpctx->demux_underrun |= s.underrun;
  730|       |
  731|      0|    int cache_buffer = 100;
  732|      0|    bool use_pause_on_low_cache = opts->cache_pause && mpctx->play_dir > 0;
  ------------------
  |  Branch (732:35): [True: 0, False: 0]
  |  Branch (732:56): [True: 0, False: 0]
  ------------------
  733|       |
  734|      0|    if (!mpctx->restart_complete) {
  ------------------
  |  Branch (734:9): [True: 0, False: 0]
  ------------------
  735|       |        // Audio or video is restarting, and initial buffering is enabled. Make
  736|       |        // sure we actually restart them in paused mode, so no audio gets
  737|       |        // dropped and video technically doesn't start yet.
  738|      0|        use_pause_on_low_cache &= opts->cache_pause_initial &&
  ------------------
  |  Branch (738:35): [True: 0, False: 0]
  ------------------
  739|      0|                                    (mpctx->video_status == STATUS_READY ||
  ------------------
  |  Branch (739:38): [True: 0, False: 0]
  ------------------
  740|      0|                                     mpctx->audio_status == STATUS_READY);
  ------------------
  |  Branch (740:38): [True: 0, False: 0]
  ------------------
  741|      0|    }
  742|       |
  743|      0|    bool is_low = use_pause_on_low_cache && !s.idle &&
  ------------------
  |  Branch (743:19): [True: 0, False: 0]
  |  Branch (743:45): [True: 0, False: 0]
  ------------------
  744|      0|                  s.ts_info.duration < opts->cache_pause_wait;
  ------------------
  |  Branch (744:19): [True: 0, False: 0]
  ------------------
  745|       |
  746|       |    // Enter buffering state only if there actually was an underrun (or if
  747|       |    // initial caching before playback restart is used).
  748|      0|    bool need_wait = is_low;
  749|      0|    if (is_low && !mpctx->paused_for_cache && mpctx->restart_complete) {
  ------------------
  |  Branch (749:9): [True: 0, False: 0]
  |  Branch (749:19): [True: 0, False: 0]
  |  Branch (749:47): [True: 0, False: 0]
  ------------------
  750|       |        // Wait only if an output underrun was registered. (Or if there is no
  751|       |        // underrun detection.)
  752|      0|        bool output_underrun = false;
  753|       |
  754|      0|        if (mpctx->ao_chain)
  ------------------
  |  Branch (754:13): [True: 0, False: 0]
  ------------------
  755|      0|            output_underrun |= mpctx->ao_chain->underrun;
  756|      0|        if (mpctx->vo_chain)
  ------------------
  |  Branch (756:13): [True: 0, False: 0]
  ------------------
  757|      0|            output_underrun |= mpctx->vo_chain->underrun;
  758|       |
  759|       |        // Output underruns could be sporadic (unrelated to demuxer buffer state
  760|       |        // and for example caused by slow decoding), so use a past demuxer
  761|       |        // underrun as indication that the underrun was possibly due to a
  762|       |        // demuxer underrun.
  763|      0|        need_wait = mpctx->demux_underrun && output_underrun;
  ------------------
  |  Branch (763:21): [True: 0, False: 0]
  |  Branch (763:46): [True: 0, False: 0]
  ------------------
  764|      0|    }
  765|       |
  766|       |    // Let the underrun flag "stick" around until the cache has fully recovered.
  767|       |    // See logic where demux_underrun is used.
  768|      0|    if (!is_low)
  ------------------
  |  Branch (768:9): [True: 0, False: 0]
  ------------------
  769|      0|        mpctx->demux_underrun = false;
  770|       |
  771|      0|    if (mpctx->paused_for_cache != need_wait) {
  ------------------
  |  Branch (771:9): [True: 0, False: 0]
  ------------------
  772|      0|        mpctx->paused_for_cache = need_wait;
  773|      0|        update_internal_pause_state(mpctx);
  774|      0|        force_update = true;
  775|      0|        if (mpctx->paused_for_cache)
  ------------------
  |  Branch (775:13): [True: 0, False: 0]
  ------------------
  776|      0|            mpctx->cache_stop_time = now;
  777|      0|    }
  778|       |
  779|      0|    if (!mpctx->paused_for_cache)
  ------------------
  |  Branch (779:9): [True: 0, False: 0]
  ------------------
  780|      0|        clear_underruns(mpctx);
  781|       |
  782|      0|    if (mpctx->paused_for_cache) {
  ------------------
  |  Branch (782:9): [True: 0, False: 0]
  ------------------
  783|      0|        cache_buffer =
  784|      0|            100 * MPCLAMP(s.ts_info.duration / opts->cache_pause_wait, 0, 0.99);
  ------------------
  |  |   46|      0|#define MPCLAMP(a, min, max) (((a) < (min)) ? (min) : (((a) > (max)) ? (max) : (a)))
  |  |  ------------------
  |  |  |  Branch (46:31): [True: 0, False: 0]
  |  |  |  Branch (46:56): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  785|      0|        mp_set_timeout(mpctx, 0.2);
  786|      0|    }
  787|       |
  788|       |    // Also update cache properties.
  789|      0|    bool busy = !s.idle;
  790|      0|    if (fabs(mpctx->cache_update_pts - mpctx->playback_pts) >= 1.0)
  ------------------
  |  Branch (790:9): [True: 0, False: 0]
  ------------------
  791|      0|        busy = true;
  792|      0|    if (busy || mpctx->next_cache_update > 0) {
  ------------------
  |  Branch (792:9): [True: 0, False: 0]
  |  Branch (792:17): [True: 0, False: 0]
  ------------------
  793|      0|        if (mpctx->next_cache_update <= now) {
  ------------------
  |  Branch (793:13): [True: 0, False: 0]
  ------------------
  794|      0|            mpctx->next_cache_update = busy ? now + 0.25 : 0;
  ------------------
  |  Branch (794:40): [True: 0, False: 0]
  ------------------
  795|      0|            force_update = true;
  796|      0|        }
  797|      0|        if (mpctx->next_cache_update > 0)
  ------------------
  |  Branch (797:13): [True: 0, False: 0]
  ------------------
  798|      0|            mp_set_timeout(mpctx, mpctx->next_cache_update - now);
  799|      0|    }
  800|       |
  801|      0|    if (mpctx->cache_buffer != cache_buffer) {
  ------------------
  |  Branch (801:9): [True: 0, False: 0]
  ------------------
  802|      0|        if ((mpctx->cache_buffer == 100) != (cache_buffer == 100)) {
  ------------------
  |  Branch (802:13): [True: 0, False: 0]
  ------------------
  803|      0|            if (cache_buffer < 100) {
  ------------------
  |  Branch (803:17): [True: 0, False: 0]
  ------------------
  804|      0|                MP_VERBOSE(mpctx, "Enter buffering (buffer went from %d%% -> %d%%) [%fs].\n",
  ------------------
  |  |   92|      0|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  805|      0|                           mpctx->cache_buffer, cache_buffer, s.ts_info.duration);
  806|      0|            } else {
  807|      0|                double t = now - mpctx->cache_stop_time;
  808|      0|                MP_VERBOSE(mpctx, "End buffering (waited %f secs) [%fs].\n",
  ------------------
  |  |   92|      0|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  809|      0|                           t, s.ts_info.duration);
  810|      0|            }
  811|      0|        } else {
  812|      0|            MP_VERBOSE(mpctx, "Still buffering (buffer went from %d%% -> %d%%) [%fs].\n",
  ------------------
  |  |   92|      0|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  813|      0|                       mpctx->cache_buffer, cache_buffer, s.ts_info.duration);
  814|      0|        }
  815|      0|        mpctx->cache_buffer = cache_buffer;
  816|      0|        force_update = true;
  817|      0|    }
  818|       |
  819|      0|    if (s.eof && !busy)
  ------------------
  |  Branch (819:9): [True: 0, False: 0]
  |  Branch (819:18): [True: 0, False: 0]
  ------------------
  820|      0|        prefetch_next(mpctx);
  821|       |
  822|      0|    if (force_update) {
  ------------------
  |  Branch (822:9): [True: 0, False: 0]
  ------------------
  823|      0|        mpctx->cache_update_pts = mpctx->playback_pts;
  824|       |        mp_notify(mpctx, MP_EVENT_CACHE_UPDATE, NULL);
  825|      0|    }
  826|      0|}
playloop.c:clear_underruns:
  702|  16.8k|{
  703|  16.8k|    if (mpctx->ao_chain && mpctx->ao_chain->underrun) {
  ------------------
  |  Branch (703:9): [True: 0, False: 16.8k]
  |  Branch (703:28): [True: 0, False: 0]
  ------------------
  704|      0|        mpctx->ao_chain->underrun = false;
  705|      0|        mp_wakeup_core(mpctx);
  706|      0|    }
  707|       |
  708|  16.8k|    if (mpctx->vo_chain && mpctx->vo_chain->underrun) {
  ------------------
  |  Branch (708:9): [True: 0, False: 16.8k]
  |  Branch (708:28): [True: 0, False: 0]
  ------------------
  709|       |        mpctx->vo_chain->underrun = false;
  710|      0|        mp_wakeup_core(mpctx);
  711|      0|    }
  712|  16.8k|}
playloop.c:mp_process_input:
  111|  16.8k|{
  112|  16.8k|    bool notify = false;
  113|  16.8k|    for (;;) {
  114|  16.8k|        mp_cmd_t *cmd = mp_input_read_cmd(mpctx->input);
  115|  16.8k|        if (!cmd)
  ------------------
  |  Branch (115:13): [True: 16.8k, False: 0]
  ------------------
  116|  16.8k|            break;
  117|      0|        if (cmd->notify_event)
  ------------------
  |  Branch (117:13): [True: 0, False: 0]
  ------------------
  118|      0|            notify = true;
  119|      0|        run_command(mpctx, cmd, NULL, NULL, NULL);
  120|      0|    }
  121|  16.8k|    mp_set_timeout(mpctx, mp_input_get_delay(mpctx->input));
  122|  16.8k|    if (notify)
  ------------------
  |  Branch (122:9): [True: 0, False: 16.8k]
  ------------------
  123|      0|        mp_notify(mpctx, MP_EVENT_INPUT_PROCESSED, NULL);
  124|  16.8k|}

screenshot_init:
   64|  16.4k|{
   65|  16.4k|    mpctx->screenshot_ctx = talloc(mpctx, screenshot_ctx);
  ------------------
  |  |   26|  16.4k|#define talloc                          ta_xnew
  |  |  ------------------
  |  |  |  |  133|  16.4k|#define ta_xnew(...)                    ta_oom_g(ta_new(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   66|  16.4k|    *mpctx->screenshot_ctx = (screenshot_ctx) {
   67|  16.4k|        .mpctx = mpctx,
   68|  16.4k|        .frameno = 1,
   69|  16.4k|        .log = mp_log_new(mpctx, mpctx->log, "screenshot")
   70|  16.4k|    };
   71|  16.4k|}

mp_load_user_script:
  203|  6.39k|{
  204|  6.39k|    char *path = mp_get_user_path(NULL, mpctx->global, fname);
  205|  6.39k|    int64_t ret = mp_load_script(mpctx, path);
  206|  6.39k|    talloc_free(path);
  ------------------
  |  |   47|  6.39k|#define talloc_free                     ta_free
  ------------------
  207|  6.39k|    return ret;
  208|  6.39k|}
mp_load_builtin_scripts:
  262|  11.3k|{
  263|  11.3k|    load_builtin_script(mpctx, 0, mpctx->opts->lua_load_osc, "@osc.lua");
  264|  11.3k|    load_builtin_script(mpctx, 1, mpctx->opts->lua_load_ytdl, "@ytdl_hook.lua");
  265|  11.3k|    load_builtin_script(mpctx, 2, mpctx->opts->lua_load_stats, "@stats.lua");
  266|  11.3k|    load_builtin_script(mpctx, 3, mpctx->opts->lua_load_console, "@console.lua");
  267|  11.3k|    load_builtin_script(mpctx, 4, mpctx->opts->lua_load_auto_profiles,
  268|  11.3k|                        "@auto_profiles.lua");
  269|  11.3k|    load_builtin_script(mpctx, 5, mpctx->opts->lua_load_select, "@select.lua");
  270|  11.3k|    load_builtin_script(mpctx, 6, mpctx->opts->lua_load_positioning, "@positioning.lua");
  271|  11.3k|    load_builtin_script(mpctx, 7, mpctx->opts->lua_load_commands, "@commands.lua");
  272|       |
  273|       |    // select.lua uses context_menu.lua in D3D11 exclusive fullscreen.
  274|  11.3k|    struct m_config_option *co = m_config_get_co(mpctx->mconfig, bstr0("d3d11-exclusive-fs"));
  275|  11.3k|    bool context_menu = mpctx->opts->lua_load_context_menu || (co && *(bool *)co->data);
  ------------------
  |  Branch (275:25): [True: 0, False: 11.3k]
  |  Branch (275:64): [True: 0, False: 11.3k]
  |  Branch (275:70): [True: 0, False: 0]
  ------------------
  276|  11.3k|    load_builtin_script(mpctx, 8, context_menu, "@context_menu.lua");
  277|  11.3k|}
mp_load_scripts:
  280|  11.0k|{
  281|  11.0k|    bool ok = true;
  282|       |
  283|       |    // Load scripts from options
  284|  11.0k|    char **files = mpctx->opts->script_files;
  285|  17.6k|    for (int n = 0; files && files[n]; n++) {
  ------------------
  |  Branch (285:21): [True: 7.31k, False: 10.2k]
  |  Branch (285:30): [True: 6.56k, False: 749]
  ------------------
  286|  6.56k|        if (files[n][0])
  ------------------
  |  Branch (286:13): [True: 6.39k, False: 170]
  ------------------
  287|  6.39k|            ok &= mp_load_user_script(mpctx, files[n]) >= 0;
  288|  6.56k|    }
  289|  11.0k|    if (!mpctx->opts->auto_load_scripts)
  ------------------
  |  Branch (289:9): [True: 1, False: 11.0k]
  ------------------
  290|      1|        return ok;
  291|       |
  292|       |    // Load all scripts
  293|  11.0k|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  11.0k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  11.0k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  294|  11.0k|    char **scriptsdir = mp_find_all_config_files(tmp, mpctx->global, "scripts");
  295|  11.0k|    for (int i = 0; scriptsdir && scriptsdir[i]; i++) {
  ------------------
  |  Branch (295:21): [True: 11.0k, False: 0]
  |  Branch (295:35): [True: 0, False: 11.0k]
  ------------------
  296|      0|        files = list_script_files(tmp, scriptsdir[i]);
  297|      0|        for (int n = 0; files && files[n]; n++)
  ------------------
  |  Branch (297:25): [True: 0, False: 0]
  |  Branch (297:34): [True: 0, False: 0]
  ------------------
  298|      0|            ok &= mp_load_script(mpctx, files[n]) >= 0;
  299|      0|    }
  300|  11.0k|    talloc_free(tmp);
  ------------------
  |  |   47|  11.0k|#define talloc_free                     ta_free
  ------------------
  301|       |
  302|  11.0k|    return ok;
  303|  11.0k|}
scripting.c:mp_load_script:
  106|  6.39k|{
  107|  6.39k|    bstr ext = mp_get_ext(bstr0(fname));
  108|  6.39k|    if (bstrcasecmp0(ext, "disable") == 0)
  ------------------
  |  Branch (108:9): [True: 66, False: 6.33k]
  ------------------
  109|     66|        return 0;
  110|       |
  111|  6.33k|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|  6.33k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  6.33k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  112|       |
  113|  6.33k|    const char *path = NULL;
  114|  6.33k|    const char *script_name = NULL;
  115|  6.33k|    const struct mp_scripting *backend = NULL;
  116|       |
  117|  6.33k|    struct stat s;
  118|  6.33k|    if (!stat(fname, &s) && S_ISDIR(s.st_mode)) {
  ------------------
  |  Branch (118:9): [True: 466, False: 5.86k]
  |  Branch (118:29): [True: 390, False: 76]
  ------------------
  119|    390|        path = fname;
  120|    390|        fname = NULL;
  121|       |
  122|  1.17k|        for (int n = 0; scripting_backends[n]; n++) {
  ------------------
  |  Branch (122:25): [True: 780, False: 390]
  ------------------
  123|    780|            const struct mp_scripting *b = scripting_backends[n];
  124|    780|            char *filename = mp_tprintf(80, "main.%s", b->file_ext);
  ------------------
  |  |  195|    780|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  ------------------
  125|    780|            fname = mp_path_join(tmp, path, filename);
  126|    780|            if (!stat(fname, &s) && S_ISREG(s.st_mode)) {
  ------------------
  |  Branch (126:17): [True: 0, False: 780]
  |  Branch (126:37): [True: 0, False: 0]
  ------------------
  127|      0|                backend = b;
  128|      0|                break;
  129|      0|            }
  130|    780|            talloc_free((void *)fname);
  ------------------
  |  |   47|    780|#define talloc_free                     ta_free
  ------------------
  131|    780|            fname = NULL;
  132|    780|        }
  133|       |
  134|    390|        if (!fname) {
  ------------------
  |  Branch (134:13): [True: 390, False: 0]
  ------------------
  135|    390|            MP_ERR(mpctx, "Cannot find main.* for any supported scripting "
  ------------------
  |  |   89|    390|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    390|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  136|    390|                   "backend in: %s\n", path);
  137|    390|            talloc_free(tmp);
  ------------------
  |  |   47|    390|#define talloc_free                     ta_free
  ------------------
  138|    390|            return -1;
  139|    390|        }
  140|       |
  141|      0|        char *path_dup = talloc_strdup(tmp, path);
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  142|      0|        mp_path_strip_trailing_separator(path_dup);
  143|      0|        script_name = mp_basename(path_dup);
  144|  5.94k|    } else {
  145|  12.0k|        for (int n = 0; scripting_backends[n]; n++) {
  ------------------
  |  Branch (145:25): [True: 9.98k, False: 2.02k]
  ------------------
  146|  9.98k|            const struct mp_scripting *b = scripting_backends[n];
  147|  9.98k|            if (bstrcasecmp0(ext, b->file_ext) == 0) {
  ------------------
  |  Branch (147:17): [True: 3.91k, False: 6.06k]
  ------------------
  148|  3.91k|                backend = b;
  149|  3.91k|                break;
  150|  3.91k|            }
  151|  9.98k|        }
  152|  5.94k|        script_name = script_name_from_filename(tmp, fname);
  153|  5.94k|    }
  154|       |
  155|  5.94k|    if (!backend) {
  ------------------
  |  Branch (155:9): [True: 2.02k, False: 3.91k]
  ------------------
  156|  2.02k|        MP_ERR(mpctx, "Can't load unknown script: %s\n", fname);
  ------------------
  |  |   89|  2.02k|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  2.02k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  157|  2.02k|        talloc_free(tmp);
  ------------------
  |  |   47|  2.02k|#define talloc_free                     ta_free
  ------------------
  158|  2.02k|        return -1;
  159|  2.02k|    }
  160|       |
  161|  3.91k|    struct mp_script_args *arg = talloc_ptrtype(NULL, arg);
  ------------------
  |  |   34|  3.91k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  3.91k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  3.91k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  162|  3.91k|    *arg = (struct mp_script_args){
  163|  3.91k|        .mpctx = mpctx,
  164|  3.91k|        .filename = talloc_strdup(arg, fname),
  ------------------
  |  |   50|  3.91k|#define talloc_strdup                   ta_xstrdup
  ------------------
  165|  3.91k|        .path = talloc_strdup(arg, path),
  ------------------
  |  |   50|  3.91k|#define talloc_strdup                   ta_xstrdup
  ------------------
  166|  3.91k|        .backend = backend,
  167|       |        // Create the client before creating the thread; otherwise a race
  168|       |        // condition could happen, where MPContext is destroyed while the
  169|       |        // thread tries to create the client.
  170|  3.91k|        .client = mp_new_weak_client(mpctx->clients, script_name),
  171|  3.91k|    };
  172|       |
  173|  3.91k|    talloc_free(tmp);
  ------------------
  |  |   47|  3.91k|#define talloc_free                     ta_free
  ------------------
  174|  3.91k|    fname = NULL; // might have been freed so don't touch anymore
  175|       |
  176|  3.91k|    if (!arg->client) {
  ------------------
  |  Branch (176:9): [True: 66, False: 3.85k]
  ------------------
  177|     66|        MP_ERR(mpctx, "Failed to create client for script: %s\n", arg->filename);
  ------------------
  |  |   89|     66|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     66|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  178|     66|        talloc_free(arg);
  ------------------
  |  |   47|     66|#define talloc_free                     ta_free
  ------------------
  179|     66|        return -1;
  180|     66|    }
  181|       |
  182|  3.85k|    arg->log = mp_client_get_log(arg->client);
  183|  3.85k|    int64_t id = mpv_client_id(arg->client);
  184|       |
  185|  3.85k|    MP_DBG(arg, "Loading %s script %s...\n", backend->name, arg->filename);
  ------------------
  |  |   93|  3.85k|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  3.85k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  186|       |
  187|  3.85k|    if (backend->no_thread) {
  ------------------
  |  Branch (187:9): [True: 1.95k, False: 1.89k]
  ------------------
  188|  1.95k|        run_script(arg);
  189|  1.95k|    } else {
  190|  1.89k|        mp_thread thread;
  191|  1.89k|        if (mp_thread_create(&thread, script_thread, arg)) {
  ------------------
  |  |  214|  1.89k|#define mp_thread_create(t, f, a) pthread_create(t, NULL, f, a)
  |  |  ------------------
  |  |  |  Branch (214:35): [True: 0, False: 1.89k]
  |  |  ------------------
  ------------------
  192|      0|            mpv_destroy(arg->client);
  193|      0|            talloc_free(arg);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  194|      0|            return -1;
  195|      0|        }
  196|  1.89k|        mp_thread_detach(thread);
  ------------------
  |  |  216|  1.89k|#define mp_thread_detach          pthread_detach
  ------------------
  197|  1.89k|    }
  198|       |
  199|  3.85k|    return id;
  200|  3.85k|}
scripting.c:script_name_from_filename:
   62|  5.94k|{
   63|  5.94k|    fname = mp_basename(fname);
   64|  5.94k|    if (fname[0] == '@')
  ------------------
  |  Branch (64:9): [True: 240, False: 5.70k]
  ------------------
   65|    240|        fname += 1;
   66|  5.94k|    char *name = talloc_strdup(talloc_ctx, fname);
  ------------------
  |  |   50|  5.94k|#define talloc_strdup                   ta_xstrdup
  ------------------
   67|       |    // Drop file extension
   68|  5.94k|    char *dot = strrchr(name, '.');
   69|  5.94k|    if (dot)
  ------------------
  |  Branch (69:9): [True: 4.60k, False: 1.33k]
  ------------------
   70|  4.60k|        *dot = '\0';
   71|       |    // Turn it into a safe identifier - this is used with e.g. dispatching
   72|       |    // input via: "send scriptname ..."
   73|  26.9k|    for (int n = 0; name[n]; n++) {
  ------------------
  |  Branch (73:21): [True: 21.0k, False: 5.94k]
  ------------------
   74|  21.0k|        char c = name[n];
   75|  21.0k|        if (!(c >= 'A' && c <= 'Z') && !(c >= 'a' && c <= 'z') &&
  ------------------
  |  Branch (75:15): [True: 11.4k, False: 9.58k]
  |  Branch (75:27): [True: 2.03k, False: 9.39k]
  |  Branch (75:42): [True: 9.01k, False: 9.96k]
  |  Branch (75:54): [True: 8.50k, False: 503]
  ------------------
   76|  10.4k|            !(c >= '0' && c <= '9'))
  ------------------
  |  Branch (76:15): [True: 3.01k, False: 7.45k]
  |  Branch (76:27): [True: 1.49k, False: 1.51k]
  ------------------
   77|  8.97k|            name[n] = '_';
   78|  21.0k|    }
   79|  5.94k|    return talloc_asprintf(talloc_ctx, "%s", name);
  ------------------
  |  |   52|  5.94k|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|  5.94k|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
   80|  5.94k|}
scripting.c:run_script:
   83|  3.85k|{
   84|  3.85k|    char *name = talloc_asprintf(NULL, "%s/%s", arg->backend->name,
  ------------------
  |  |   52|  3.85k|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|  3.85k|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  ------------------
  ------------------
   85|  3.85k|                                 mpv_client_name(arg->client));
   86|  3.85k|    mp_thread_set_name(name);
   87|  3.85k|    talloc_free(name);
  ------------------
  |  |   47|  3.85k|#define talloc_free                     ta_free
  ------------------
   88|       |
   89|  3.85k|    if (arg->backend->load(arg) < 0)
  ------------------
  |  Branch (89:9): [True: 3.85k, False: 0]
  ------------------
   90|  3.85k|        MP_ERR(arg, "Could not load %s script %s\n", arg->backend->name, arg->filename);
  ------------------
  |  |   89|  3.85k|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  3.85k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
   91|       |
   92|  3.85k|    mpv_handle *client = arg->client;
   93|  3.85k|    talloc_free(arg);
  ------------------
  |  |   47|  3.85k|#define talloc_free                     ta_free
  ------------------
   94|  3.85k|    mpv_destroy(client);
   95|  3.85k|}
scripting.c:script_thread:
   98|  1.89k|{
   99|  1.89k|    struct mp_script_args *arg = p;
  100|  1.89k|    run_script(arg);
  101|       |
  102|       |    MP_THREAD_RETURN();
  ------------------
  |  |  212|  1.89k|#define MP_THREAD_RETURN() return NULL
  ------------------
  103|  1.89k|}
scripting.c:load_builtin_script:
  242|   102k|{
  243|   102k|    mp_assert(slot < MP_ARRAY_SIZE(mpctx->builtin_script_ids));
  ------------------
  |  |   41|   102k|#define mp_assert assert
  ------------------
  |  Branch (243:5): [True: 102k, False: 0]
  ------------------
  244|   102k|    int64_t *pid = &mpctx->builtin_script_ids[slot];
  245|   102k|    if (*pid > 0 && !mp_client_id_exists(mpctx, *pid)) {
  ------------------
  |  Branch (245:9): [True: 0, False: 102k]
  |  Branch (245:21): [True: 0, False: 0]
  ------------------
  246|      0|        MP_DBG(mpctx, "Client for script %s is no longer alive. Marking as unloaded.\n", fname);
  ------------------
  |  |   93|      0|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  247|      0|        *pid = 0; // died
  248|      0|    }
  249|   102k|    if ((*pid > 0) != enable) {
  ------------------
  |  Branch (249:9): [True: 0, False: 102k]
  ------------------
  250|      0|        if (enable) {
  ------------------
  |  Branch (250:13): [True: 0, False: 0]
  ------------------
  251|      0|            *pid = mp_load_script(mpctx, fname);
  252|      0|        } else {
  253|      0|            char *name = mp_tprintf(22, "@%"PRIi64, *pid);
  ------------------
  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  ------------------
  254|      0|            MP_DBG(mpctx, "Unloading script %s (disabled by option)\n", fname);
  ------------------
  |  |   93|      0|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  255|      0|            mp_client_send_event(mpctx, name, 0, MPV_EVENT_SHUTDOWN, NULL);
  256|       |            // note: there is no synchronization of script exit
  257|      0|        }
  258|      0|    }
  259|   102k|}
scripting.c:load_cplugin:
  386|  1.89k|{
  387|  1.89k|    void *lib = dlopen(args->filename, RTLD_NOW | RTLD_LOCAL);
  388|  1.89k|    if (!lib)
  ------------------
  |  Branch (388:9): [True: 1.89k, False: 0]
  ------------------
  389|  1.89k|        goto error;
  390|       |    // Note: once loaded, we never unload, as unloading the libraries linked to
  391|       |    //       the plugin can cause random serious problems.
  392|      0|    mpv_open_cplugin sym = (mpv_open_cplugin)dlsym(lib, MPV_DLOPEN_FN);
  ------------------
  |  |  311|      0|#define MPV_DLOPEN_FN "mpv_open_cplugin"
  ------------------
  393|      0|    if (!sym)
  ------------------
  |  Branch (393:9): [True: 0, False: 0]
  ------------------
  394|      0|        goto error;
  395|       |
  396|      0|    init_sym_table(args, lib);
  397|       |
  398|      0|    return sym(args->client) ? -1 : 0;
  ------------------
  |  Branch (398:12): [True: 0, False: 0]
  ------------------
  399|  1.89k|error: ;
  400|  1.89k|    char *err = dlerror();
  401|  1.89k|    if (err)
  ------------------
  |  Branch (401:9): [True: 1.89k, False: 0]
  ------------------
  402|  1.89k|        MP_ERR(args, "C plugin error: '%s'\n", err);
  ------------------
  |  |   89|  1.89k|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  1.89k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  403|  1.89k|    return -1;
  404|      0|}
scripting.c:load_run:
  419|  1.95k|{
  420|       |    // The arg->client object might die and with it args->log, so duplicate it.
  421|  1.95k|    args->log = mp_log_new(args, args->log, NULL);
  422|       |
  423|  1.95k|    int fds[2];
  424|  1.95k|    if (!mp_ipc_start_anon_client(args->mpctx->ipc_ctx, args->client, fds))
  ------------------
  |  Branch (424:9): [True: 0, False: 1.95k]
  ------------------
  425|      0|        return -1;
  426|  1.95k|    args->client = NULL; // ownership lost
  427|       |
  428|  1.95k|    char *fdopt = fds[1] >= 0 ? mp_tprintf(80, "--mpv-ipc-fd=%d:%d", fds[0], fds[1])
  ------------------
  |  |  195|      0|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  ------------------
  |  Branch (428:19): [True: 0, False: 1.95k]
  ------------------
  429|  1.95k|                              : mp_tprintf(80, "--mpv-ipc-fd=%d", fds[0]);
  ------------------
  |  |  195|  1.95k|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  ------------------
  430|       |
  431|  1.95k|    struct mp_subprocess_opts opts = {
  432|  1.95k|        .exe = (char *)args->filename,
  433|  1.95k|        .args = (char *[]){(char *)args->filename, fdopt, NULL},
  434|  1.95k|        .fds = {
  435|       |            // Keep terminal stuff
  436|  1.95k|            {.fd = 0, .src_fd = 0,},
  437|  1.95k|            {.fd = 1, .src_fd = 1,},
  438|  1.95k|            {.fd = 2, .src_fd = 2,},
  439|       |            // Just hope these don't step over each other (e.g. fds[1] could be
  440|       |            // below 4, if the std FDs are missing).
  441|  1.95k|            {.fd = fds[0], .src_fd = fds[0], },
  442|  1.95k|            {.fd = fds[1], .src_fd = fds[1], },
  443|  1.95k|        },
  444|  1.95k|        .num_fds = fds[1] >= 0 ? 5 : 4,
  ------------------
  |  Branch (444:20): [True: 0, False: 1.95k]
  ------------------
  445|  1.95k|        .detach = true,
  446|  1.95k|    };
  447|  1.95k|    struct mp_subprocess_result res;
  448|  1.95k|    mp_subprocess(args->log, &opts, &res);
  449|       |
  450|       |    // Closing these will (probably) make the client exit, if it really died.
  451|  1.95k|    close(fds[0]);
  452|  1.95k|    if (fds[1] >= 0)
  ------------------
  |  Branch (452:9): [True: 0, False: 1.95k]
  ------------------
  453|      0|        close(fds[1]);
  454|       |
  455|  1.95k|    return res.error;
  456|  1.95k|}

redraw_subs:
   57|  11.3k|{
   58|  34.1k|    for (int n = 0; n < num_ptracks[STREAM_SUB]; n++) {
  ------------------
  |  Branch (58:21): [True: 22.7k, False: 11.3k]
  ------------------
   59|  22.7k|        if (mpctx->current_track[n][STREAM_SUB] &&
  ------------------
  |  Branch (59:13): [True: 0, False: 22.7k]
  ------------------
   60|      0|            mpctx->current_track[n][STREAM_SUB]->d_sub)
  ------------------
  |  Branch (60:13): [True: 0, False: 0]
  ------------------
   61|      0|        {
   62|       |            mpctx->current_track[n][STREAM_SUB]->redraw_subs = true;
   63|      0|        }
   64|  22.7k|    }
   65|  11.3k|}

uninit_video_out:
  131|  16.4k|{
  132|  16.4k|    uninit_video_chain(mpctx);
  133|  16.4k|    if (mpctx->video_out) {
  ------------------
  |  Branch (133:9): [True: 0, False: 16.4k]
  ------------------
  134|      0|        vo_destroy(mpctx->video_out);
  135|      0|        mpctx->video_out = NULL;
  136|       |        mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL);
  137|      0|    }
  138|  16.4k|}
uninit_video_chain:
  164|  16.4k|{
  165|  16.4k|    if (mpctx->vo_chain) {
  ------------------
  |  Branch (165:9): [True: 0, False: 16.4k]
  ------------------
  166|      0|        reset_video_state(mpctx);
  167|      0|        vo_chain_uninit(mpctx->vo_chain);
  168|      0|        mpctx->vo_chain = NULL;
  169|       |
  170|      0|        mpctx->video_status = STATUS_EOF;
  171|       |
  172|       |        mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL);
  173|      0|    }
  174|  16.4k|}

cookies_lavf:
  121|      1|{
  122|      1|    void *tmp = talloc_new(NULL);
  ------------------
  |  |   40|      1|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|      1|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  123|      1|    struct cookie_list_type *list = NULL;
  124|      1|    if (file && file[0])
  ------------------
  |  Branch (124:9): [True: 0, False: 1]
  |  Branch (124:17): [True: 0, False: 0]
  ------------------
  125|      0|        list = load_cookies_from(tmp, global, log, file);
  126|       |
  127|      1|    char *res = talloc_strdup(talloc_ctx, "");
  ------------------
  |  |   50|      1|#define talloc_strdup                   ta_xstrdup
  ------------------
  128|       |
  129|      1|    while (list) {
  ------------------
  |  Branch (129:12): [True: 0, False: 1]
  ------------------
  130|      0|        res = talloc_asprintf_append_buffer(res,
  ------------------
  |  |   64|      0|#define talloc_asprintf_append_buffer   ta_talloc_asprintf_append_buffer
  ------------------
  131|      0|                    "%s=%s; path=%s; domain=%s; %s\n", list->name, list->value,
  132|      0|                    list->path, list->domain, list->secure ? "secure" : "");
  ------------------
  |  Branch (132:47): [True: 0, False: 0]
  ------------------
  133|      0|        list = list->next;
  134|      0|    }
  135|       |
  136|      1|    talloc_free(tmp);
  ------------------
  |  |   47|      1|#define talloc_free                     ta_free
  ------------------
  137|      1|    return res;
  138|      1|}

mp_url_unescape_inplace:
  152|    631|{
  153|  5.65k|    for (int len = strlen(url), i = 0, o = 0; i <= len;) {
  ------------------
  |  Branch (153:47): [True: 5.02k, False: 631]
  ------------------
  154|  5.02k|        if ((url[i] != '%') || (i > len - 3)) {  // %NN can't start after len-3
  ------------------
  |  Branch (154:13): [True: 2.69k, False: 2.33k]
  |  Branch (154:32): [True: 198, False: 2.13k]
  ------------------
  155|  2.89k|            url[o++] = url[i++];
  156|  2.89k|            continue;
  157|  2.89k|        }
  158|       |
  159|  2.13k|        int msd = hex2dec(url[i + 1]),
  160|  2.13k|            lsd = hex2dec(url[i + 2]);
  161|       |
  162|  2.13k|        if (msd >= 0 && lsd >= 0) {
  ------------------
  |  Branch (162:13): [True: 1.03k, False: 1.09k]
  |  Branch (162:25): [True: 513, False: 525]
  ------------------
  163|    513|            url[o++] = 16 * msd + lsd;
  164|    513|            i += 3;
  165|  1.62k|        } else {
  166|  1.62k|            url[o++] = url[i++];
  167|  1.62k|            url[o++] = url[i++];
  168|  1.62k|            url[o++] = url[i++];
  169|  1.62k|        }
  170|  2.13k|    }
  171|    631|}
mp_url_escape:
  196|     37|{
  197|     37|    char *rv = talloc_size(talloc_ctx, strlen(url) * 3 + 1);
  ------------------
  |  |   43|     37|#define talloc_size                     ta_xalloc_size
  |  |  ------------------
  |  |  |  |  120|     37|#define ta_xalloc_size(...)             ta_oom_p(ta_alloc_size(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|     37|#define ta_alloc_size(...)      ta_dbg_set_loc(ta_alloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   43|     37|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   38|     37|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   37|     37|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  198|     37|    char *out = rv;
  199|     37|    bool negate = ok && ok[0] == '~';
  ------------------
  |  Branch (199:19): [True: 37, False: 0]
  |  Branch (199:25): [True: 0, False: 37]
  ------------------
  200|       |
  201|  3.94k|    for (char c; (c = *url); url++) {
  ------------------
  |  Branch (201:18): [True: 3.90k, False: 37]
  ------------------
  202|  3.90k|        bool as_is = negate ? !strchr(ok + 1, c)
  ------------------
  |  Branch (202:22): [True: 0, False: 3.90k]
  ------------------
  203|  3.90k|                            : (strchr(url_default_ok, c) || (ok && strchr(ok, c)));
  ------------------
  |  Branch (203:32): [True: 2.25k, False: 1.65k]
  |  Branch (203:62): [True: 1.65k, False: 0]
  |  Branch (203:68): [True: 474, False: 1.17k]
  ------------------
  204|  3.90k|        if (as_is) {
  ------------------
  |  Branch (204:13): [True: 2.73k, False: 1.17k]
  ------------------
  205|  2.73k|            *out++ = c;
  206|  2.73k|        } else {
  207|  1.17k|            unsigned char v = c;
  208|  1.17k|            *out++ = '%';
  209|  1.17k|            *out++ = hex_digits[v / 16];
  210|  1.17k|            *out++ = hex_digits[v % 16];
  211|  1.17k|        }
  212|  3.90k|    }
  213|       |
  214|     37|    *out = 0;
  215|     37|    return rv;
  216|     37|}
stream_create_with_args:
  444|  3.33k|{
  445|  3.33k|    mp_assert(args->url);
  ------------------
  |  |   41|  3.33k|#define mp_assert assert
  ------------------
  |  Branch (445:5): [True: 3.33k, False: 0]
  ------------------
  446|       |
  447|  3.33k|    int r = STREAM_NO_MATCH;
  ------------------
  |  |   65|  3.33k|#define STREAM_NO_MATCH -2
  ------------------
  448|  3.33k|    *ret = NULL;
  449|       |
  450|       |    // Open stream proper
  451|  3.33k|    if (args->sinfo) {
  ------------------
  |  Branch (451:9): [True: 0, False: 3.33k]
  ------------------
  452|      0|        r = stream_create_instance(args->sinfo, args, ret);
  453|  3.33k|    } else {
  454|  35.8k|        for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) {
  ------------------
  |  |   49|  35.8k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (454:25): [True: 35.7k, False: 62]
  ------------------
  455|  35.7k|            r = stream_create_instance(stream_list[i], args, ret);
  456|  35.7k|            if (r == STREAM_OK)
  ------------------
  |  |   68|  35.7k|#define STREAM_OK    1
  ------------------
  |  Branch (456:17): [True: 1.41k, False: 34.3k]
  ------------------
  457|  1.41k|                break;
  458|  34.3k|            if (r == STREAM_NO_MATCH || r == STREAM_UNSUPPORTED)
  ------------------
  |  |   65|  68.6k|#define STREAM_NO_MATCH -2
  ------------------
                          if (r == STREAM_NO_MATCH || r == STREAM_UNSUPPORTED)
  ------------------
  |  |   66|  3.96k|#define STREAM_UNSUPPORTED -1
  ------------------
  |  Branch (458:17): [True: 30.3k, False: 3.96k]
  |  Branch (458:41): [True: 2.10k, False: 1.85k]
  ------------------
  459|  32.4k|                continue;
  460|  1.85k|            if (r == STREAM_UNSAFE)
  ------------------
  |  |   64|  1.85k|#define STREAM_UNSAFE -3
  ------------------
  |  Branch (460:17): [True: 0, False: 1.85k]
  ------------------
  461|      0|                continue;
  462|  1.85k|            break;
  463|  1.85k|        }
  464|  3.33k|    }
  465|       |
  466|  3.33k|    if (!*ret && !(args->flags & STREAM_SILENT) && !mp_cancel_test(args->cancel))
  ------------------
  |  |   44|  1.92k|#define STREAM_SILENT             (1 << 1)
  ------------------
  |  Branch (466:9): [True: 1.92k, False: 1.41k]
  |  Branch (466:18): [True: 1.92k, False: 0]
  |  Branch (466:52): [True: 1.92k, False: 0]
  ------------------
  467|  1.92k|    {
  468|  1.92k|        struct mp_log *log = mp_log_new(NULL, args->global->log, "!stream");
  469|       |
  470|  1.92k|        if (r == STREAM_UNSAFE) {
  ------------------
  |  |   64|  1.92k|#define STREAM_UNSAFE -3
  ------------------
  |  Branch (470:13): [True: 0, False: 1.92k]
  ------------------
  471|      0|            mp_err(log, "\nRefusing to load potentially unsafe URL from a playlist.\n"
  ------------------
  |  |   76|      0|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
  472|      0|                   "Use the --load-unsafe-playlists option to load it anyway.\n\n");
  473|  1.92k|        } else if (r == STREAM_NO_MATCH || r == STREAM_UNSUPPORTED) {
  ------------------
  |  |   65|  3.84k|#define STREAM_NO_MATCH -2
  ------------------
                      } else if (r == STREAM_NO_MATCH || r == STREAM_UNSUPPORTED) {
  ------------------
  |  |   66|  1.85k|#define STREAM_UNSUPPORTED -1
  ------------------
  |  Branch (473:20): [True: 62, False: 1.85k]
  |  Branch (473:44): [True: 0, False: 1.85k]
  ------------------
  474|     62|            mp_err(log, "No protocol handler found to open URL %s\n", args->url);
  ------------------
  |  |   76|     62|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
  475|     62|            mp_err(log, "The protocol is either unsupported, or was disabled "
  ------------------
  |  |   76|     62|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
  476|     62|                        "at compile-time.\n");
  477|  1.85k|        } else {
  478|  1.85k|            mp_err(log, "Failed to open %s.\n", args->url);
  ------------------
  |  |   76|  1.85k|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
  479|  1.85k|        }
  480|       |
  481|  1.92k|        talloc_free(log);
  ------------------
  |  |   47|  1.92k|#define talloc_free                     ta_free
  ------------------
  482|  1.92k|    }
  483|       |
  484|  3.33k|    return r;
  485|  3.33k|}
stream_create:
  489|  3.33k|{
  490|  3.33k|    struct stream_open_args args = {
  491|  3.33k|        .global = global,
  492|  3.33k|        .cancel = c,
  493|  3.33k|        .flags = flags,
  494|  3.33k|        .url = url,
  495|  3.33k|    };
  496|  3.33k|    struct stream *s;
  497|  3.33k|    stream_create_with_args(&args, &s);
  498|  3.33k|    return s;
  499|  3.33k|}
stream_read_partial:
  616|  2.30k|{
  617|  2.30k|    mp_assert(s->buf_cur <= s->buf_end);
  ------------------
  |  |   41|  2.30k|#define mp_assert assert
  ------------------
  |  Branch (617:5): [True: 2.30k, False: 0]
  ------------------
  618|  2.30k|    mp_assert(buf_size >= 0);
  ------------------
  |  |   41|  2.30k|#define mp_assert assert
  ------------------
  |  Branch (618:5): [True: 2.30k, False: 0]
  ------------------
  619|  2.30k|    if (s->buf_cur == s->buf_end && buf_size > 0) {
  ------------------
  |  Branch (619:9): [True: 2.27k, False: 22]
  |  Branch (619:37): [True: 2.27k, False: 0]
  ------------------
  620|  2.27k|        if (buf_size > (s->buffer_mask + 1) / 2) {
  ------------------
  |  Branch (620:13): [True: 115, False: 2.16k]
  ------------------
  621|       |            // Direct read if the buffer is too small anyway.
  622|    115|            stream_drop_buffers(s);
  623|    115|            return stream_read_unbuffered(s, buf, buf_size);
  624|    115|        }
  625|  2.16k|        stream_read_more(s, 1);
  626|  2.16k|    }
  627|  2.18k|    int res = ring_copy(s, buf, buf_size, s->buf_cur);
  628|  2.18k|    s->buf_cur += res;
  629|  2.18k|    return res;
  630|  2.30k|}
stream_read:
  640|  1.28k|{
  641|  1.28k|    int len = total;
  642|  2.32k|    while (len > 0) {
  ------------------
  |  Branch (642:12): [True: 2.30k, False: 24]
  ------------------
  643|  2.30k|        int read = stream_read_partial(s, mem, len);
  644|  2.30k|        if (read <= 0)
  ------------------
  |  Branch (644:13): [True: 1.26k, False: 1.03k]
  ------------------
  645|  1.26k|            break; // EOF
  646|  1.03k|        mem = (char *)mem + read;
  647|  1.03k|        len -= read;
  648|  1.03k|    }
  649|  1.28k|    total -= len;
  650|  1.28k|    return total;
  651|  1.28k|}
stream_drop_buffers:
  708|    115|{
  709|    115|    s->pos = stream_tell(s);
  710|    115|    s->buf_start = s->buf_cur = s->buf_end = 0;
  711|    115|    s->eof = 0;
  712|    115|    stream_resize_buffer(s, 0, 0);
  713|    115|}
stream_get_size:
  810|  1.41k|{
  811|  1.41k|    return s->get_size ? s->get_size(s) : -1;
  ------------------
  |  Branch (811:12): [True: 1.40k, False: 9]
  ------------------
  812|  1.41k|}
free_stream:
  815|  3.33k|{
  816|  3.33k|    if (!s)
  ------------------
  |  Branch (816:9): [True: 1.92k, False: 1.41k]
  ------------------
  817|  1.92k|        return;
  818|       |
  819|  1.41k|    if (s->close)
  ------------------
  |  Branch (819:9): [True: 526, False: 891]
  ------------------
  820|    526|        s->close(s);
  821|  1.41k|    talloc_free(s);
  ------------------
  |  |   47|  1.41k|#define talloc_free                     ta_free
  ------------------
  822|  1.41k|}
stream_read_complete:
  854|  1.41k|{
  855|  1.41k|    if (max_size < 0 || max_size > STREAM_MAX_READ_SIZE)
  ------------------
  |  |   36|  1.41k|#define STREAM_MAX_READ_SIZE (INT_MAX - 1)
  ------------------
  |  Branch (855:9): [True: 0, False: 1.41k]
  |  Branch (855:25): [True: 0, False: 1.41k]
  ------------------
  856|      0|        abort();
  857|  1.41k|    if (s->is_directory)
  ------------------
  |  Branch (857:9): [True: 0, False: 1.41k]
  ------------------
  858|      0|        return (struct bstr){NULL, 0};
  859|       |
  860|  1.41k|    int bufsize;
  861|  1.41k|    int total_read = 0;
  862|  1.41k|    int padding = 1;
  863|  1.41k|    char *buf = NULL;
  864|  1.41k|    int64_t size = stream_get_size(s) - stream_tell(s);
  865|  1.41k|    if (size > max_size && !s->allow_partial_read)
  ------------------
  |  Branch (865:9): [True: 155, False: 1.26k]
  |  Branch (865:28): [True: 155, False: 0]
  ------------------
  866|    155|        return (struct bstr){NULL, 0};
  867|  1.26k|    if (size > 0)
  ------------------
  |  Branch (867:9): [True: 1.12k, False: 137]
  ------------------
  868|  1.12k|        bufsize = size + padding;
  869|    137|    else
  870|    137|        bufsize = 1000;
  871|  1.26k|    if (s->allow_partial_read)
  ------------------
  |  Branch (871:9): [True: 0, False: 1.26k]
  ------------------
  872|      0|        bufsize = MPMIN(bufsize, max_size + padding);
  ------------------
  |  |   45|      0|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  873|  1.28k|    while (1) {
  ------------------
  |  Branch (873:12): [True: 1.28k, Folded]
  ------------------
  874|  1.28k|        buf = talloc_realloc_size(talloc_ctx, buf, bufsize);
  ------------------
  |  |   39|  1.28k|#define talloc_realloc_size             ta_xrealloc_size
  |  |  ------------------
  |  |  |  |  158|  1.28k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.28k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|  1.28k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|  1.28k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  875|  1.28k|        int readsize = stream_read(s, buf + total_read, bufsize - total_read);
  876|  1.28k|        total_read += readsize;
  877|  1.28k|        if (total_read >= max_size && s->allow_partial_read) {
  ------------------
  |  Branch (877:13): [True: 0, False: 1.28k]
  |  Branch (877:39): [True: 0, False: 0]
  ------------------
  878|      0|            total_read = max_size;
  879|      0|            break;
  880|      0|        }
  881|  1.28k|        if (total_read < bufsize)
  ------------------
  |  Branch (881:13): [True: 1.26k, False: 24]
  ------------------
  882|  1.26k|            break;
  883|     24|        if (bufsize > max_size) {
  ------------------
  |  Branch (883:13): [True: 0, False: 24]
  ------------------
  884|      0|            talloc_free(buf);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  885|      0|            return (struct bstr){NULL, 0};
  886|      0|        }
  887|     24|        bufsize = MPMIN(bufsize + (bufsize >> 1), max_size + padding);
  ------------------
  |  |   45|     24|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 24]
  |  |  ------------------
  ------------------
  888|     24|    }
  889|  1.26k|    buf = talloc_realloc_size(talloc_ctx, buf, total_read + padding);
  ------------------
  |  |   39|  1.26k|#define talloc_realloc_size             ta_xrealloc_size
  |  |  ------------------
  |  |  |  |  158|  1.26k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.26k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|  1.26k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|  1.26k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  890|  1.26k|    memset(&buf[total_read], 0, padding);
  891|  1.26k|    return (struct bstr){buf, total_read};
  892|  1.26k|}
stream_read_file2:
  903|  3.33k|{
  904|  3.33k|    struct bstr res = {0};
  905|  3.33k|    stream_t *s = stream_create(filename, flags, NULL, global);
  906|  3.33k|    if (s) {
  ------------------
  |  Branch (906:9): [True: 1.41k, False: 1.92k]
  ------------------
  907|  1.41k|        if (s->is_directory)
  ------------------
  |  Branch (907:13): [True: 0, False: 1.41k]
  ------------------
  908|      0|            mp_err(s->log, "Failed to open %s (not a file).\n", filename);
  ------------------
  |  |   76|      0|#define mp_err(log, ...)        mp_msg(log, MSGL_ERR, __VA_ARGS__)
  ------------------
  909|  1.41k|        else
  910|  1.41k|            res = stream_read_complete(s, talloc_ctx, max_size);
  911|  1.41k|    }
  912|  3.33k|    free_stream(s);
  913|  3.33k|    return res;
  914|  3.33k|}
stream_get_proto_list:
  917|  2.61k|{
  918|  2.61k|    char **list = NULL;
  919|  2.61k|    int num = 0;
  920|  41.7k|    for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) {
  ------------------
  |  |   49|  41.7k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (920:21): [True: 39.1k, False: 2.61k]
  ------------------
  921|  39.1k|        const stream_info_t *stream_info = stream_list[i];
  922|  39.1k|        if (safe_only && (stream_info->stream_origin & STREAM_ORIGIN_UNSAFE))
  ------------------
  |  |   50|      0|#define STREAM_ORIGIN_UNSAFE      (4 << 2) // from a grotesque source
  ------------------
  |  Branch (922:13): [True: 0, False: 39.1k]
  |  Branch (922:26): [True: 0, False: 0]
  ------------------
  923|      0|            continue;
  924|       |
  925|  39.1k|        char **get_protocols = stream_info->get_protocols ? stream_info->get_protocols() : NULL;
  ------------------
  |  Branch (925:32): [True: 5.22k, False: 33.9k]
  ------------------
  926|  39.1k|        char **protocols = get_protocols ? get_protocols : (char **)stream_info->protocols;
  ------------------
  |  Branch (926:28): [True: 5.22k, False: 33.9k]
  ------------------
  927|       |
  928|   117k|        for (int j = 0; protocols && protocols[j]; j++) {
  ------------------
  |  Branch (928:25): [True: 114k, False: 2.61k]
  |  Branch (928:38): [True: 78.3k, False: 36.5k]
  ------------------
  929|  78.3k|            if (*protocols[j] == '\0')
  ------------------
  |  Branch (929:17): [True: 2.61k, False: 75.6k]
  ------------------
  930|  2.61k|                continue;
  931|       |
  932|  75.6k|            MP_TARRAY_APPEND(NULL, list, num, talloc_strdup(list, protocols[j]));
  ------------------
  |  |  105|  75.6k|    do {                                            \
  |  |  106|  75.6k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  75.6k|    do {                                            \
  |  |  |  |   97|  75.6k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  75.6k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  75.6k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  75.6k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 10.4k, False: 65.2k]
  |  |  |  |  ------------------
  |  |  |  |   99|  75.6k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  10.4k|    do {                                                        \
  |  |  |  |  |  |   89|  10.4k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  10.4k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  10.4k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  10.4k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  10.4k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  10.4k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  10.4k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 10.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  75.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 75.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  75.6k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  75.6k|        (idxvar)++;                                 \
  |  |  109|  75.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 75.6k]
  |  |  ------------------
  ------------------
  933|  75.6k|        }
  934|       |
  935|  39.1k|        talloc_free(get_protocols);
  ------------------
  |  |   47|  39.1k|#define talloc_free                     ta_free
  ------------------
  936|  39.1k|    }
  937|  2.61k|    MP_TARRAY_APPEND(NULL, list, num, NULL);
  ------------------
  |  |  105|  2.61k|    do {                                            \
  |  |  106|  2.61k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  2.61k|    do {                                            \
  |  |  |  |   97|  2.61k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  2.61k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  2.61k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  2.61k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 2.61k]
  |  |  |  |  ------------------
  |  |  |  |   99|  2.61k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  2.61k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 2.61k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  2.61k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  2.61k|        (idxvar)++;                                 \
  |  |  109|  2.61k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 2.61k]
  |  |  ------------------
  ------------------
  938|  2.61k|    return list;
  939|  2.61k|}
stream_print_proto_list:
  942|  2.58k|{
  943|  2.58k|    int count = 0;
  944|       |
  945|  2.58k|    mp_info(log, "Protocols:\n\n");
  ------------------
  |  |   78|  2.58k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  946|  2.58k|    char **list = stream_get_proto_list(false);
  947|  77.6k|    for (int i = 0; list[i]; i++) {
  ------------------
  |  Branch (947:21): [True: 75.0k, False: 2.58k]
  ------------------
  948|  75.0k|        mp_info(log, " %s://\n", list[i]);
  ------------------
  |  |   78|  75.0k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  949|  75.0k|        count++;
  950|  75.0k|    }
  951|  2.58k|    talloc_free(list);
  ------------------
  |  |   47|  2.58k|#define talloc_free                     ta_free
  ------------------
  952|  2.58k|    mp_info(log, "\nTotal: %d protocols\n", count);
  ------------------
  |  |   78|  2.58k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  953|  2.58k|}
stream.c:hex2dec:
  140|  4.27k|{
  141|  4.27k|    if (c >= '0' && c <= '9')
  ------------------
  |  Branch (141:9): [True: 3.04k, False: 1.22k]
  |  Branch (141:21): [True: 508, False: 2.53k]
  ------------------
  142|    508|        return c - '0';
  143|  3.76k|    if (c >= 'A' && c <= 'F')
  ------------------
  |  Branch (143:9): [True: 2.52k, False: 1.23k]
  |  Branch (143:21): [True: 506, False: 2.01k]
  ------------------
  144|    506|        return 10 + c - 'A';
  145|  3.25k|    if (c >= 'a' && c <= 'f')
  ------------------
  |  Branch (145:9): [True: 1.83k, False: 1.41k]
  |  Branch (145:21): [True: 976, False: 861]
  ------------------
  146|    976|        return 10 + c - 'a';
  147|  2.28k|    return -1;
  148|  3.25k|}
stream.c:stream_create_instance:
  337|  35.7k|{
  338|  35.7k|    const char *url = args->url;
  339|  35.7k|    int flags = args->flags;
  340|       |
  341|  35.7k|    *ret = NULL;
  342|       |
  343|  35.7k|    const char *path = url;
  344|       |
  345|  35.7k|    if (flags & STREAM_LOCAL_FS_ONLY) {
  ------------------
  |  |   54|  35.7k|#define STREAM_LOCAL_FS_ONLY      (1 << 5) // stream_file only, no URLs
  ------------------
  |  Branch (345:9): [True: 0, False: 35.7k]
  ------------------
  346|      0|        if (!sinfo->local_fs)
  ------------------
  |  Branch (346:13): [True: 0, False: 0]
  ------------------
  347|      0|            return STREAM_NO_MATCH;
  ------------------
  |  |   65|      0|#define STREAM_NO_MATCH -2
  ------------------
  348|  35.7k|    } else {
  349|  35.7k|        char **get_protocols = sinfo->get_protocols ? sinfo->get_protocols() : NULL;
  ------------------
  |  Branch (349:32): [True: 4.09k, False: 31.6k]
  ------------------
  350|  35.7k|        char **protocols = get_protocols ? get_protocols : (char **)sinfo->protocols;
  ------------------
  |  Branch (350:28): [True: 4.09k, False: 31.6k]
  ------------------
  351|       |
  352|  85.9k|        for (int n = 0; protocols && protocols[n]; n++) {
  ------------------
  |  Branch (352:25): [True: 83.8k, False: 2.10k]
  |  Branch (352:38): [True: 53.5k, False: 30.3k]
  ------------------
  353|  53.5k|            path = match_proto(url, protocols[n]);
  354|  53.5k|            if (path)
  ------------------
  |  Branch (354:17): [True: 3.27k, False: 50.2k]
  ------------------
  355|  3.27k|                break;
  356|  53.5k|        }
  357|       |
  358|  35.7k|        talloc_free(get_protocols);
  ------------------
  |  |   47|  35.7k|#define talloc_free                     ta_free
  ------------------
  359|       |
  360|  35.7k|        if (!path)
  ------------------
  |  Branch (360:13): [True: 30.3k, False: 5.38k]
  ------------------
  361|  30.3k|            return STREAM_NO_MATCH;
  ------------------
  |  |   65|  30.3k|#define STREAM_NO_MATCH -2
  ------------------
  362|  35.7k|    }
  363|       |
  364|  5.38k|    stream_t *s = talloc_zero(NULL, stream_t);
  ------------------
  |  |   27|  5.38k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  5.38k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  5.38k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  365|  5.38k|    s->global = args->global;
  366|  5.38k|    struct stream_opts *opts = mp_get_config_group(s, s->global, &stream_conf);
  367|  5.38k|    if (flags & STREAM_SILENT) {
  ------------------
  |  |   44|  5.38k|#define STREAM_SILENT             (1 << 1)
  ------------------
  |  Branch (367:9): [True: 0, False: 5.38k]
  ------------------
  368|      0|        s->log = mp_null_log;
  369|  5.38k|    } else {
  370|  5.38k|        s->log = mp_log_new(s, s->global->log, sinfo->name);
  371|  5.38k|    }
  372|  5.38k|    s->info = sinfo;
  373|  5.38k|    s->autoprobed = !args->sinfo;
  374|  5.38k|    s->cancel = args->cancel;
  375|  5.38k|    s->url = talloc_strdup(s, url);
  ------------------
  |  |   50|  5.38k|#define talloc_strdup                   ta_xstrdup
  ------------------
  376|  5.38k|    s->path = talloc_strdup(s, path);
  ------------------
  |  |   50|  5.38k|#define talloc_strdup                   ta_xstrdup
  ------------------
  377|  5.38k|    s->mode = flags & (STREAM_READ | STREAM_WRITE);
  ------------------
  |  |   41|  5.38k|#define STREAM_READ               0
  ------------------
                  s->mode = flags & (STREAM_READ | STREAM_WRITE);
  ------------------
  |  |   42|  5.38k|#define STREAM_WRITE              (1 << 0)
  ------------------
  378|  5.38k|    s->requested_buffer_size = opts->buffer_size;
  379|  5.38k|    s->allow_partial_read = flags & STREAM_ALLOW_PARTIAL_READ;
  ------------------
  |  |   56|  5.38k|#define STREAM_ALLOW_PARTIAL_READ (1 << 7) // allows partial read with stream_read_file()
  ------------------
  380|       |
  381|  5.38k|    if (flags & STREAM_LESS_NOISE)
  ------------------
  |  |   55|  5.38k|#define STREAM_LESS_NOISE         (1 << 6) // try to log errors only
  ------------------
  |  Branch (381:9): [True: 0, False: 5.38k]
  ------------------
  382|      0|        mp_msg_set_max_level(s->log, MSGL_WARN);
  383|       |
  384|  5.38k|    struct demux_opts *demux_opts = mp_get_config_group(s, s->global, &demux_conf);
  385|  5.38k|    s->access_references = demux_opts->access_references;
  386|  5.38k|    talloc_free(demux_opts);
  ------------------
  |  |   47|  5.38k|#define talloc_free                     ta_free
  ------------------
  387|       |
  388|  5.38k|    MP_VERBOSE(s, "Opening %s\n", url);
  ------------------
  |  |   92|  5.38k|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  5.38k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  389|       |
  390|  5.38k|    if (strlen(url) > INT_MAX / 8) {
  ------------------
  |  Branch (390:9): [True: 0, False: 5.38k]
  ------------------
  391|      0|        MP_ERR(s, "URL too large.\n");
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  392|      0|        talloc_free(s);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  393|      0|        return STREAM_ERROR;
  ------------------
  |  |   67|      0|#define STREAM_ERROR 0
  ------------------
  394|      0|    }
  395|       |
  396|  5.38k|    if ((s->mode & STREAM_WRITE) && !sinfo->can_write) {
  ------------------
  |  |   42|  5.38k|#define STREAM_WRITE              (1 << 0)
  ------------------
  |  Branch (396:9): [True: 0, False: 5.38k]
  |  Branch (396:37): [True: 0, False: 0]
  ------------------
  397|      0|        MP_DBG(s, "No write access implemented.\n");
  ------------------
  |  |   93|      0|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  398|      0|        talloc_free(s);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  399|      0|        return STREAM_NO_MATCH;
  ------------------
  |  |   65|      0|#define STREAM_NO_MATCH -2
  ------------------
  400|      0|    }
  401|       |
  402|  5.38k|    s->stream_origin = flags & STREAM_ORIGIN_MASK; // pass through by default
  ------------------
  |  |   52|  5.38k|#define STREAM_ORIGIN_MASK        (7 << 2) // for extracting origin value from flags
  ------------------
  403|  5.38k|    if (opts->load_unsafe_playlists) {
  ------------------
  |  Branch (403:9): [True: 3, False: 5.38k]
  ------------------
  404|      3|        s->stream_origin = STREAM_ORIGIN_DIRECT;
  ------------------
  |  |   47|      3|#define STREAM_ORIGIN_DIRECT      (1 << 2) // passed from cmdline or loadfile
  ------------------
  405|  5.38k|    } else if (sinfo->stream_origin) {
  ------------------
  |  Branch (405:16): [True: 4.45k, False: 931]
  ------------------
  406|  4.45k|        s->stream_origin = check_origin(s->stream_origin, sinfo->stream_origin);
  407|  4.45k|    }
  408|       |
  409|  5.38k|    if (!s->stream_origin) {
  ------------------
  |  Branch (409:9): [True: 0, False: 5.38k]
  ------------------
  410|      0|        talloc_free(s);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
  411|      0|        return STREAM_UNSAFE;
  ------------------
  |  |   64|      0|#define STREAM_UNSAFE -3
  ------------------
  412|      0|    }
  413|       |
  414|  5.38k|    int r = STREAM_UNSUPPORTED;
  ------------------
  |  |   66|  5.38k|#define STREAM_UNSUPPORTED -1
  ------------------
  415|  5.38k|    if (sinfo->open2) {
  ------------------
  |  Branch (415:9): [True: 1.22k, False: 4.16k]
  ------------------
  416|  1.22k|        r = sinfo->open2(s, args);
  417|  4.16k|    } else if (!args->special_arg) {
  ------------------
  |  Branch (417:16): [True: 4.16k, False: 0]
  ------------------
  418|  4.16k|        r = (sinfo->open)(s);
  419|  4.16k|    }
  420|  5.38k|    if (r != STREAM_OK) {
  ------------------
  |  |   68|  5.38k|#define STREAM_OK    1
  ------------------
  |  Branch (420:9): [True: 3.96k, False: 1.41k]
  ------------------
  421|  3.96k|        talloc_free(s);
  ------------------
  |  |   47|  3.96k|#define talloc_free                     ta_free
  ------------------
  422|  3.96k|        return r;
  423|  3.96k|    }
  424|       |
  425|  1.41k|    if (!stream_resize_buffer(s, 0, 0)) {
  ------------------
  |  Branch (425:9): [True: 0, False: 1.41k]
  ------------------
  426|      0|        free_stream(s);
  427|      0|        return STREAM_ERROR;
  ------------------
  |  |   67|      0|#define STREAM_ERROR 0
  ------------------
  428|      0|    }
  429|       |
  430|  1.41k|    mp_assert(s->seekable == !!s->seek);
  ------------------
  |  |   41|  1.41k|#define mp_assert assert
  ------------------
  |  Branch (430:5): [True: 1.41k, False: 0]
  ------------------
  431|       |
  432|  1.41k|    if (s->mime_type)
  ------------------
  |  Branch (432:9): [True: 0, False: 1.41k]
  ------------------
  433|  1.41k|        MP_VERBOSE(s, "Mime-type: '%s'\n", s->mime_type);
  ------------------
  |  |   92|      0|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  434|  1.41k|    if (s->server_filename)
  ------------------
  |  Branch (434:9): [True: 0, False: 1.41k]
  ------------------
  435|  1.41k|        MP_VERBOSE(s, "Server filename: '%s'\n", s->server_filename);
  ------------------
  |  |   92|      0|#define MP_VERBOSE(obj, ...)    MP_MSG(obj, MSGL_V, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  436|       |
  437|  1.41k|    MP_DBG(s, "Stream opened successfully.\n");
  ------------------
  |  |   93|  1.41k|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  1.41k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  438|       |
  439|  1.41k|    *ret = s;
  440|  1.41k|    return STREAM_OK;
  ------------------
  |  |   68|  1.41k|#define STREAM_OK    1
  ------------------
  441|  1.41k|}
stream.c:match_proto:
  219|  53.5k|{
  220|  53.5k|    int l = strlen(proto);
  221|  53.5k|    if (l > 0) {
  ------------------
  |  Branch (221:9): [True: 51.0k, False: 2.41k]
  ------------------
  222|  51.0k|        if (strncasecmp(url, proto, l) == 0 && strncmp("://", url + l, 3) == 0)
  ------------------
  |  Branch (222:13): [True: 3.13k, False: 47.9k]
  |  Branch (222:48): [True: 3.02k, False: 112]
  ------------------
  223|  3.02k|            return url + l + 3;
  224|  51.0k|    } else if (!mp_is_url(bstr0(url))) {
  ------------------
  |  Branch (224:16): [True: 250, False: 2.16k]
  ------------------
  225|    250|        return url; // pure filenames
  226|    250|    }
  227|  50.2k|    return NULL;
  228|  53.5k|}
stream.c:check_origin:
  234|  4.45k|{
  235|  4.45k|    switch (src) {
  ------------------
  |  Branch (235:13): [True: 4.45k, False: 0]
  ------------------
  236|  4.45k|    case STREAM_ORIGIN_DIRECT:
  ------------------
  |  |   47|  4.45k|#define STREAM_ORIGIN_DIRECT      (1 << 2) // passed from cmdline or loadfile
  ------------------
  |  Branch (236:5): [True: 4.45k, False: 0]
  ------------------
  237|  4.45k|    case STREAM_ORIGIN_UNSAFE:
  ------------------
  |  |   50|  4.45k|#define STREAM_ORIGIN_UNSAFE      (4 << 2) // from a grotesque source
  ------------------
  |  Branch (237:5): [True: 0, False: 4.45k]
  ------------------
  238|       |        // Allow anything, but constrain it to the new origin.
  239|  4.45k|        return new;
  240|      0|    case STREAM_ORIGIN_FS:
  ------------------
  |  |   48|      0|#define STREAM_ORIGIN_FS          (2 << 2) // referenced from playlist on unix FS
  ------------------
  |  Branch (240:5): [True: 0, False: 4.45k]
  ------------------
  241|       |        // From unix FS, allow all but unsafe.
  242|      0|        if (new == STREAM_ORIGIN_FS || new == STREAM_ORIGIN_NET)
  ------------------
  |  |   48|      0|#define STREAM_ORIGIN_FS          (2 << 2) // referenced from playlist on unix FS
  ------------------
                      if (new == STREAM_ORIGIN_FS || new == STREAM_ORIGIN_NET)
  ------------------
  |  |   49|      0|#define STREAM_ORIGIN_NET         (3 << 2) // referenced from playlist on network
  ------------------
  |  Branch (242:13): [True: 0, False: 0]
  |  Branch (242:40): [True: 0, False: 0]
  ------------------
  243|      0|            return new;
  244|      0|        break;
  245|      0|    case STREAM_ORIGIN_NET:
  ------------------
  |  |   49|      0|#define STREAM_ORIGIN_NET         (3 << 2) // referenced from playlist on network
  ------------------
  |  Branch (245:5): [True: 0, False: 4.45k]
  ------------------
  246|       |        // Allow only other network links.
  247|      0|        if (new == STREAM_ORIGIN_NET)
  ------------------
  |  |   49|      0|#define STREAM_ORIGIN_NET         (3 << 2) // referenced from playlist on network
  ------------------
  |  Branch (247:13): [True: 0, False: 0]
  ------------------
  248|      0|            return new;
  249|      0|        break;
  250|  4.45k|    }
  251|      0|    return 0;
  252|  4.45k|}
stream.c:stream_read_unbuffered:
  517|  2.27k|{
  518|  2.27k|    mp_assert(len >= 0);
  ------------------
  |  |   41|  2.27k|#define mp_assert assert
  ------------------
  |  Branch (518:5): [True: 2.27k, False: 0]
  ------------------
  519|  2.27k|    if (len <= 0)
  ------------------
  |  Branch (519:9): [True: 0, False: 2.27k]
  ------------------
  520|      0|        return 0;
  521|       |
  522|  2.27k|    int res = 0;
  523|       |    // we will retry even if we already reached EOF previously.
  524|  2.27k|    if (s->fill_buffer && !mp_cancel_test(s->cancel))
  ------------------
  |  Branch (524:9): [True: 2.26k, False: 9]
  |  Branch (524:27): [True: 2.26k, False: 0]
  ------------------
  525|  2.26k|        res = s->fill_buffer(s, buf, len);
  526|  2.27k|    if (res <= 0) {
  ------------------
  |  Branch (526:9): [True: 1.26k, False: 1.01k]
  ------------------
  527|  1.26k|        s->eof = 1;
  528|  1.26k|        return 0;
  529|  1.26k|    }
  530|  1.01k|    mp_assert(res <= len);
  ------------------
  |  |   41|  1.01k|#define mp_assert assert
  ------------------
  |  Branch (530:5): [True: 1.01k, False: 0]
  ------------------
  531|       |    // When reading succeeded we are obviously not at eof.
  532|  1.01k|    s->eof = 0;
  533|  1.01k|    s->pos += res;
  534|  1.01k|    s->total_unbuffered_read_bytes += res;
  535|  1.01k|    return res;
  536|  1.01k|}
stream.c:stream_read_more:
  543|  2.16k|{
  544|  2.16k|    mp_assert(forward >= 0);
  ------------------
  |  |   41|  2.16k|#define mp_assert assert
  ------------------
  |  Branch (544:5): [True: 2.16k, False: 0]
  ------------------
  545|       |
  546|  2.16k|    int forward_avail = s->buf_end - s->buf_cur;
  547|  2.16k|    if (forward_avail >= forward)
  ------------------
  |  Branch (547:9): [True: 0, False: 2.16k]
  ------------------
  548|      0|        return false;
  549|       |
  550|       |    // Avoid that many small reads will lead to many low-level read calls.
  551|  2.16k|    forward = MPMAX(forward, s->requested_buffer_size / 2);
  ------------------
  |  |   44|  2.16k|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 2.16k]
  |  |  ------------------
  ------------------
  552|  2.16k|    mp_assert(forward_avail < forward);
  ------------------
  |  |   41|  2.16k|#define mp_assert assert
  ------------------
  |  Branch (552:5): [True: 2.16k, False: 0]
  ------------------
  553|       |
  554|       |    // Keep guaranteed seek-back.
  555|  2.16k|    int buf_old = MPMIN(s->buf_cur - s->buf_start, s->requested_buffer_size / 2);
  ------------------
  |  |   45|  2.16k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 2.16k]
  |  |  ------------------
  ------------------
  556|       |
  557|       |    // Never shrink the buffer here. That's stream_drop_buffers()'s job. Otherwise
  558|       |    // data fetched by earlier larger reads (e.g. demuxer probing) would be
  559|       |    // discarded, forcing redundant re-reads on backward seeks.
  560|  2.16k|    int new_size = MPMAX(buf_old + forward, s->buffer_mask + 1);
  ------------------
  |  |   44|  2.16k|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 2.16k]
  |  |  ------------------
  ------------------
  561|       |
  562|  2.16k|    if (!stream_resize_buffer(s, buf_old + forward_avail, new_size))
  ------------------
  |  Branch (562:9): [True: 0, False: 2.16k]
  ------------------
  563|      0|        return false;
  564|       |
  565|  2.16k|    int buf_alloc = s->buffer_mask + 1;
  566|       |
  567|  2.16k|    mp_assert(s->buf_start <= s->buf_cur);
  ------------------
  |  |   41|  2.16k|#define mp_assert assert
  ------------------
  |  Branch (567:5): [True: 2.16k, False: 0]
  ------------------
  568|  2.16k|    mp_assert(s->buf_cur <= s->buf_end);
  ------------------
  |  |   41|  2.16k|#define mp_assert assert
  ------------------
  |  Branch (568:5): [True: 2.16k, False: 0]
  ------------------
  569|  2.16k|    mp_assert(s->buf_cur < buf_alloc * 2);
  ------------------
  |  |   41|  2.16k|#define mp_assert assert
  ------------------
  |  Branch (569:5): [True: 2.16k, False: 0]
  ------------------
  570|  2.16k|    mp_assert(s->buf_end < buf_alloc * 2);
  ------------------
  |  |   41|  2.16k|#define mp_assert assert
  ------------------
  |  Branch (570:5): [True: 2.16k, False: 0]
  ------------------
  571|  2.16k|    mp_assert(s->buf_start < buf_alloc);
  ------------------
  |  |   41|  2.16k|#define mp_assert assert
  ------------------
  |  Branch (571:5): [True: 2.16k, False: 0]
  ------------------
  572|       |
  573|       |    // Note: read as much as possible, even if forward is much smaller. Do
  574|       |    // this because the stream buffer is supposed to set an approx. minimum
  575|       |    // read size on it.
  576|  2.16k|    int read = buf_alloc - (buf_old + forward_avail); // free buffer past end
  577|       |
  578|  2.16k|    int pos = s->buf_end & s->buffer_mask;
  579|  2.16k|    read = MPMIN(read, buf_alloc - pos);
  ------------------
  |  |   45|  2.16k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 2.16k]
  |  |  ------------------
  ------------------
  580|       |
  581|       |    // Note: if wrap-around happens, we need to make two calls. This may
  582|       |    // affect latency (e.g. waiting for new data on a socket), so do only
  583|       |    // 1 read call always.
  584|  2.16k|    read = stream_read_unbuffered(s, &s->buffer[pos], read);
  585|       |
  586|  2.16k|    s->buf_end += read;
  587|       |
  588|       |    // May have overwritten old data.
  589|  2.16k|    if (s->buf_end - s->buf_start >= buf_alloc) {
  ------------------
  |  Branch (589:9): [True: 0, False: 2.16k]
  ------------------
  590|      0|        mp_assert(s->buf_end >= buf_alloc);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (590:9): [True: 0, False: 0]
  ------------------
  591|       |
  592|      0|        s->buf_start = s->buf_end - buf_alloc;
  593|       |
  594|      0|        mp_assert(s->buf_start <= s->buf_cur);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (594:9): [True: 0, False: 0]
  ------------------
  595|      0|        mp_assert(s->buf_cur <= s->buf_end);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (595:9): [True: 0, False: 0]
  ------------------
  596|       |
  597|      0|        if (s->buf_start >= buf_alloc) {
  ------------------
  |  Branch (597:13): [True: 0, False: 0]
  ------------------
  598|      0|            s->buf_start -= buf_alloc;
  599|      0|            s->buf_cur -= buf_alloc;
  600|      0|            s->buf_end -= buf_alloc;
  601|      0|        }
  602|      0|    }
  603|       |
  604|       |    // Must not have overwritten guaranteed old data.
  605|  2.16k|    mp_assert(s->buf_cur - s->buf_start >= buf_old);
  ------------------
  |  |   41|  2.16k|#define mp_assert assert
  ------------------
  |  Branch (605:5): [True: 2.16k, False: 0]
  ------------------
  606|       |
  607|  2.16k|    if (s->buf_cur < s->buf_end)
  ------------------
  |  Branch (607:9): [True: 947, False: 1.21k]
  ------------------
  608|    947|        s->eof = 0;
  609|       |
  610|  2.16k|    return !!read;
  611|  2.16k|}
stream.c:ring_copy:
  260|  2.18k|{
  261|  2.18k|    mp_assert(len >= 0);
  ------------------
  |  |   41|  2.18k|#define mp_assert assert
  ------------------
  |  Branch (261:5): [True: 2.18k, False: 0]
  ------------------
  262|       |
  263|  2.18k|    if (pos < s->buf_start || pos > s->buf_end)
  ------------------
  |  Branch (263:9): [True: 0, False: 2.18k]
  |  Branch (263:31): [True: 0, False: 2.18k]
  ------------------
  264|      0|        return 0;
  265|       |
  266|  2.18k|    int copied = 0;
  267|  2.18k|    len = MPMIN(len, s->buf_end - pos);
  ------------------
  |  |   45|  2.18k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 2.16k, False: 24]
  |  |  ------------------
  ------------------
  268|       |
  269|  2.18k|    if (len && pos <= s->buffer_mask) {
  ------------------
  |  Branch (269:9): [True: 969, False: 1.21k]
  |  Branch (269:16): [True: 969, False: 0]
  ------------------
  270|    969|        int copy = MPMIN(len, s->buffer_mask + 1 - pos);
  ------------------
  |  |   45|    969|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 969]
  |  |  ------------------
  ------------------
  271|    969|        memcpy(dst, &s->buffer[pos], copy);
  272|    969|        copied += copy;
  273|    969|        len -= copy;
  274|    969|        pos += copy;
  275|    969|    }
  276|       |
  277|  2.18k|    if (len) {
  ------------------
  |  Branch (277:9): [True: 0, False: 2.18k]
  ------------------
  278|      0|        memcpy((char *)dst + copied, &s->buffer[pos & s->buffer_mask], len);
  279|      0|        copied += len;
  280|      0|    }
  281|       |
  282|  2.18k|    return copied;
  283|  2.18k|}
stream.c:stream_resize_buffer:
  293|  3.69k|{
  294|  3.69k|    mp_assert(keep >= s->buf_end - s->buf_cur);
  ------------------
  |  |   41|  3.69k|#define mp_assert assert
  ------------------
  |  Branch (294:5): [True: 3.69k, False: 0]
  ------------------
  295|  3.69k|    mp_assert(keep <= new);
  ------------------
  |  |   41|  3.69k|#define mp_assert assert
  ------------------
  |  Branch (295:5): [True: 3.69k, False: 0]
  ------------------
  296|       |
  297|  3.69k|    new = MPMAX(new, s->requested_buffer_size);
  ------------------
  |  |   44|  3.69k|#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (44:22): [True: 0, False: 3.69k]
  |  |  ------------------
  ------------------
  298|  3.69k|    new = MPMIN(new, STREAM_MAX_BUFFER_SIZE);
  ------------------
  |  |   45|  3.69k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 0, False: 3.69k]
  |  |  ------------------
  ------------------
  299|  3.69k|    new = mp_round_next_power_of_2(new);
  300|       |
  301|  3.69k|    mp_assert(keep <= new); // can't fail (if old buffer size was valid)
  ------------------
  |  |   41|  3.69k|#define mp_assert assert
  ------------------
  |  Branch (301:5): [True: 3.69k, False: 0]
  ------------------
  302|       |
  303|  3.69k|    if (new == s->buffer_mask + 1)
  ------------------
  |  Branch (303:9): [True: 2.27k, False: 1.41k]
  ------------------
  304|  2.27k|        return true;
  305|       |
  306|  1.41k|    int old_pos = s->buf_cur - s->buf_start;
  307|  1.41k|    int old_used_len = s->buf_end - s->buf_start;
  308|  1.41k|    int skip = old_used_len > new ? old_used_len - new : 0;
  ------------------
  |  Branch (308:16): [True: 0, False: 1.41k]
  ------------------
  309|       |
  310|  1.41k|    MP_DBG(s, "resize stream to %d bytes, drop %d bytes\n", new, skip);
  ------------------
  |  |   93|  1.41k|#define MP_DBG(obj, ...)        MP_MSG(obj, MSGL_DEBUG, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|  1.41k|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  311|       |
  312|  1.41k|    void *nbuf = ta_alloc_size(s, new);
  ------------------
  |  |  153|  1.41k|#define ta_alloc_size(...)      ta_dbg_set_loc(ta_alloc_size(__VA_ARGS__), TA_LOC)
  |  |  ------------------
  |  |  |  |   43|  1.41k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   38|  1.41k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   37|  1.41k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  313|  1.41k|    if (!nbuf)
  ------------------
  |  Branch (313:9): [True: 0, False: 1.41k]
  ------------------
  314|      0|        return false; // oom; tolerate it, caller needs to check if required
  315|       |
  316|  1.41k|    int new_len = 0;
  317|  1.41k|    if (s->buffer)
  ------------------
  |  Branch (317:9): [True: 0, False: 1.41k]
  ------------------
  318|      0|        new_len = ring_copy(s, nbuf, new, s->buf_start + skip);
  319|  1.41k|    mp_assert(new_len == old_used_len - skip);
  ------------------
  |  |   41|  1.41k|#define mp_assert assert
  ------------------
  |  Branch (319:5): [True: 1.41k, False: 0]
  ------------------
  320|  1.41k|    mp_assert(old_pos >= skip); // "keep" too low
  ------------------
  |  |   41|  1.41k|#define mp_assert assert
  ------------------
  |  Branch (320:5): [True: 1.41k, False: 0]
  ------------------
  321|  1.41k|    mp_assert(old_pos - skip <= new_len);
  ------------------
  |  |   41|  1.41k|#define mp_assert assert
  ------------------
  |  Branch (321:5): [True: 1.41k, False: 0]
  ------------------
  322|  1.41k|    s->buf_start = 0;
  323|  1.41k|    s->buf_cur = old_pos - skip;
  324|  1.41k|    s->buf_end = new_len;
  325|       |
  326|  1.41k|    ta_free(s->buffer);
  327|       |
  328|  1.41k|    s->buffer = nbuf;
  329|  1.41k|    s->buffer_mask = new - 1;
  330|       |
  331|       |    return true;
  332|  1.41k|}

stream.c:stream_tell:
  389|  1.53k|{
  390|  1.53k|    return s->pos + s->buf_cur - s->buf_end;
  391|  1.53k|}

stream_aes_ctr.c:open2:
  142|     19|{
  143|     19|    struct priv *p = talloc_zero(stream, struct priv);
  ------------------
  |  |   27|     19|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|     19|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|     19|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  144|     19|    talloc_set_destructor(p, priv_destructor);
  ------------------
  |  |   41|     19|#define talloc_set_destructor           ta_set_destructor
  ------------------
  145|     19|    stream->priv = p;
  146|       |
  147|     19|    stream->fill_buffer = fill_buffer;
  148|     19|    stream->get_size = get_size;
  149|     19|    stream->close = s_close;
  150|       |
  151|     19|    int parse_ret = parse_url(stream);
  152|     19|    if (parse_ret != STREAM_OK)
  ------------------
  |  |   68|     19|#define STREAM_OK    1
  ------------------
  |  Branch (152:9): [True: 19, False: 0]
  ------------------
  153|     19|        return parse_ret;
  154|       |
  155|      0|    struct stream_open_args args2 = *args;
  156|      0|    args2.url = stream->path;
  157|      0|    int inner_ret = stream_create_with_args(&args2, &p->inner);
  158|      0|    if (inner_ret != STREAM_OK)
  ------------------
  |  |   68|      0|#define STREAM_OK    1
  ------------------
  |  Branch (158:9): [True: 0, False: 0]
  ------------------
  159|      0|        return inner_ret;
  160|       |
  161|      0|    if (p->inner->is_directory) {
  ------------------
  |  Branch (161:9): [True: 0, False: 0]
  ------------------
  162|      0|        MP_FATAL(stream, "Inner stream '%s' is a directory\n", p->inner->url);
  ------------------
  |  |   88|      0|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  163|      0|        free_stream(p->inner);
  164|      0|        return STREAM_ERROR;
  ------------------
  |  |   67|      0|#define STREAM_ERROR 0
  ------------------
  165|      0|    }
  166|       |
  167|      0|    if (p->inner->seekable) {
  ------------------
  |  Branch (167:9): [True: 0, False: 0]
  ------------------
  168|      0|        stream->seek = seek;
  169|      0|        stream->seekable = true;
  170|      0|    }
  171|      0|    stream->fast_skip = p->inner->fast_skip;
  172|      0|    stream->streaming = p->inner->streaming;
  173|      0|    stream->is_network = p->inner->is_network;
  174|      0|    stream->stream_origin = p->inner->stream_origin;
  175|       |
  176|      0|    return STREAM_OK;
  ------------------
  |  |   68|      0|#define STREAM_OK    1
  ------------------
  177|      0|}
stream_aes_ctr.c:priv_destructor:
   40|     19|{
   41|     19|    struct priv *p = ptr;
   42|     19|    av_free(p->aes);
   43|     19|}
stream_aes_ctr.c:parse_url:
  106|     19|{
  107|     19|    struct priv *p = stream->priv;
  108|       |
  109|     19|    struct bstr params, inner_url;
  110|     19|    if (!bstr_split_tok(bstr0(stream->path), "@", &params, &inner_url) ||
  ------------------
  |  Branch (110:9): [True: 1, False: 18]
  ------------------
  111|     18|        !inner_url.len)
  ------------------
  |  Branch (111:9): [True: 1, False: 17]
  ------------------
  112|      2|    {
  113|      2|        MP_ERR(stream, "Expected aes-ctr://key:iv@URL: '%s'\n", stream->url);
  ------------------
  |  |   89|      2|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      2|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  114|      2|        return STREAM_ERROR;
  ------------------
  |  |   67|      2|#define STREAM_ERROR 0
  ------------------
  115|      2|    }
  116|       |
  117|     17|    struct bstr key, iv;
  118|     17|    bstr_split_tok(params, ":", &key, &iv);
  119|     17|    if ((key.len != 32 && key.len != 48 && key.len != 64) ||
  ------------------
  |  Branch (119:10): [True: 16, False: 1]
  |  Branch (119:27): [True: 15, False: 1]
  |  Branch (119:44): [True: 14, False: 1]
  ------------------
  120|      3|        !bstr_decode_hex(stream, key, &key))
  ------------------
  |  Branch (120:9): [True: 3, False: 0]
  ------------------
  121|     17|    {
  122|     17|        MP_ERR(stream, "The key must have 32, 48 or 64 hex digits: '%s'\n",
  ------------------
  |  |   89|     17|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     17|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  123|     17|               stream->url);
  124|     17|        return STREAM_ERROR;
  ------------------
  |  |   67|     17|#define STREAM_ERROR 0
  ------------------
  125|     17|    }
  126|      0|    if (iv.len != 2 * BLOCKSIZE || !bstr_decode_hex(stream, iv, &iv)) {
  ------------------
  |  |   29|      0|#define BLOCKSIZE 16
  ------------------
  |  Branch (126:9): [True: 0, False: 0]
  |  Branch (126:36): [True: 0, False: 0]
  ------------------
  127|      0|        MP_ERR(stream, "The IV must have 32 hex digits: '%s'\n", stream->url);
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  128|      0|        return STREAM_ERROR;
  ------------------
  |  |   67|      0|#define STREAM_ERROR 0
  ------------------
  129|      0|    }
  130|       |
  131|      0|    p->aes = av_aes_alloc();
  132|      0|    if (!p->aes || av_aes_init(p->aes, key.start, key.len * 8, 0) < 0)
  ------------------
  |  Branch (132:9): [True: 0, False: 0]
  |  Branch (132:20): [True: 0, False: 0]
  ------------------
  133|      0|        return STREAM_ERROR;
  ------------------
  |  |   67|      0|#define STREAM_ERROR 0
  ------------------
  134|      0|    memcpy(p->iv, iv.start, BLOCKSIZE);
  ------------------
  |  |   29|      0|#define BLOCKSIZE 16
  ------------------
  135|       |
  136|      0|    stream->path = bstrto0(stream, inner_url);
  137|       |
  138|      0|    return STREAM_OK;
  ------------------
  |  |   68|      0|#define STREAM_OK    1
  ------------------
  139|      0|}

stream_avdevice.c:open_f:
   21|      2|{
   22|      2|    stream->demuxer = "lavf";
   23|       |
   24|      2|    return STREAM_OK;
  ------------------
  |  |   68|      2|#define STREAM_OK    1
  ------------------
   25|      2|}

stream_bstr_open2:
   48|    882|{
   49|    882|    s->fill_buffer = bs_fill_buffer;
   50|    882|    s->seek = bs_seek;
   51|    882|    s->seekable = true;
   52|    882|    s->get_size = bs_get_size;
   53|       |
   54|    882|    struct priv *p = talloc_zero(s, struct priv);
  ------------------
  |  |   27|    882|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|    882|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|    882|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   55|    882|    s->priv = p;
   56|       |
   57|    882|    ta_set_parent(data.start, p);
   58|    882|    p->data = data;
   59|       |
   60|    882|    return STREAM_OK;
  ------------------
  |  |   68|    882|#define STREAM_OK    1
  ------------------
   61|    882|}
stream_bstr.c:bs_fill_buffer:
   26|  1.76k|{
   27|  1.76k|    struct priv *p = s->priv;
   28|  1.76k|    bstr data = p->data;
   29|  1.76k|    if (s->pos < 0 || s->pos > data.len)
  ------------------
  |  Branch (29:9): [True: 0, False: 1.76k]
  |  Branch (29:23): [True: 0, False: 1.76k]
  ------------------
   30|      0|        return 0;
   31|  1.76k|    len = MPMIN(len, data.len - s->pos);
  ------------------
  |  |   45|  1.76k|#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (45:22): [True: 1.76k, False: 0]
  |  |  ------------------
  ------------------
   32|  1.76k|    memcpy(buffer, data.start + s->pos, len);
   33|  1.76k|    return len;
   34|  1.76k|}
stream_bstr.c:bs_get_size:
   42|    882|{
   43|    882|    struct priv *p = s->priv;
   44|    882|    return p->data.len;
   45|    882|}

stream_cb.c:open_cb:
   55|  2.10k|{
   56|  2.10k|    struct priv *p = talloc_ptrtype(stream, p);
  ------------------
  |  |   34|  2.10k|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|  2.10k|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  2.10k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   57|  2.10k|    stream->priv = p;
   58|       |
   59|  2.10k|    bstr bproto = mp_split_proto(bstr0(stream->url), NULL);
   60|  2.10k|    char *proto = bstrto0(stream, bproto);
   61|       |
   62|  2.10k|    void *user_data;
   63|  2.10k|    mpv_stream_cb_open_ro_fn open_fn;
   64|       |
   65|  2.10k|    if (!mp_streamcb_lookup(stream->global, proto, &user_data, &open_fn))
  ------------------
  |  Branch (65:9): [True: 2.10k, False: 0]
  ------------------
   66|  2.10k|        return STREAM_UNSUPPORTED;
  ------------------
  |  |   66|  2.10k|#define STREAM_UNSUPPORTED -1
  ------------------
   67|       |
   68|      0|    mpv_stream_cb_info info = {0};
   69|       |
   70|      0|    int r = open_fn(user_data, stream->url, &info);
   71|      0|    if (r < 0) {
  ------------------
  |  Branch (71:9): [True: 0, False: 0]
  ------------------
   72|      0|        if (r != MPV_ERROR_LOADING_FAILED)
  ------------------
  |  Branch (72:13): [True: 0, False: 0]
  ------------------
   73|      0|            MP_WARN(stream, "unknown error from user callback\n");
  ------------------
  |  |   90|      0|#define MP_WARN(obj, ...)       MP_MSG(obj, MSGL_WARN, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
   74|      0|        return STREAM_ERROR;
  ------------------
  |  |   67|      0|#define STREAM_ERROR 0
  ------------------
   75|      0|    }
   76|       |
   77|      0|    if (!info.read_fn || !info.close_fn) {
  ------------------
  |  Branch (77:9): [True: 0, False: 0]
  |  Branch (77:26): [True: 0, False: 0]
  ------------------
   78|      0|        MP_FATAL(stream, "required read_fn or close_fn callbacks not set.\n");
  ------------------
  |  |   88|      0|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
   79|      0|        return STREAM_ERROR;
  ------------------
  |  |   67|      0|#define STREAM_ERROR 0
  ------------------
   80|      0|    }
   81|       |
   82|      0|    p->info = info;
   83|       |
   84|      0|    if (p->info.seek_fn && p->info.seek_fn(p->info.cookie, 0) >= 0) {
  ------------------
  |  Branch (84:9): [True: 0, False: 0]
  |  Branch (84:28): [True: 0, False: 0]
  ------------------
   85|      0|        stream->seek = seek;
   86|      0|        stream->seekable = true;
   87|      0|    }
   88|      0|    stream->fast_skip = true;
   89|      0|    stream->fill_buffer = fill_buffer;
   90|      0|    stream->get_size = get_size;
   91|      0|    stream->close = s_close;
   92|       |
   93|      0|    if (p->info.cancel_fn && stream->cancel) {
  ------------------
  |  Branch (93:9): [True: 0, False: 0]
  |  Branch (93:30): [True: 0, False: 0]
  ------------------
   94|      0|        p->cancel = mp_cancel_new(p);
   95|      0|        mp_cancel_set_parent(p->cancel, stream->cancel);
   96|      0|        mp_cancel_set_cb(p->cancel, p->info.cancel_fn, p->info.cookie);
   97|      0|    }
   98|       |
   99|      0|    return STREAM_OK;
  ------------------
  |  |   68|      0|#define STREAM_OK    1
  ------------------
  100|      0|}

dvb_get_state:
 1047|      3|{
 1048|      3|    dvb_priv_t *priv = stream->priv;
 1049|      3|    if (global_dvb_state)
  ------------------
  |  Branch (1049:9): [True: 0, False: 3]
  ------------------
 1050|      0|        return global_dvb_state;
 1051|       |
 1052|      3|    struct mp_log *log = stream->log;
 1053|      3|    struct mpv_global *global = stream->global;
 1054|       |
 1055|      3|    dvb_state_t *state = talloc_zero(NULL, dvb_state_t);
  ------------------
  |  |   27|      3|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|      3|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      3|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1056|      3|    state->switching_channel = false;
 1057|      3|    state->is_on = false;
 1058|      3|    state->stream_used = true;
 1059|      3|    state->fe_fd = state->dvr_fd = -1;
 1060|       |
 1061|     51|    for (unsigned int i = 0; i < MAX_ADAPTERS; i++) {
  ------------------
  |  |   27|     51|#define MAX_ADAPTERS 16
  ------------------
  |  Branch (1061:30): [True: 48, False: 3]
  ------------------
 1062|     48|        dvb_channels_list_t *list = NULL;
 1063|     48|        unsigned int delsys_mask[MAX_FRONTENDS];
 1064|    432|        for (unsigned int f = 0; f < MAX_FRONTENDS; f++) {
  ------------------
  |  |   28|    432|#define MAX_FRONTENDS 8
  ------------------
  |  Branch (1064:34): [True: 384, False: 48]
  ------------------
 1065|    384|            char filename[100];
 1066|    384|            snprintf(filename, sizeof(filename), "/dev/dvb/adapter%u/frontend%u", i, f);
 1067|    384|            int fd = open(filename, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
  ------------------
  |  |  269|    384|#define open(...) mp_open(__VA_ARGS__)
  ------------------
 1068|    384|            if (fd < 0)
  ------------------
  |  Branch (1068:17): [True: 384, False: 0]
  ------------------
 1069|    384|                continue;
 1070|       |
 1071|      0|            delsys_mask[f] = dvb_get_tuner_delsys_mask(fd, log);
 1072|      0|            delsys_mask[f] &= DELSYS_SUPP_MASK; /* Filter unsupported delivery systems. */
  ------------------
  |  |  126|      0|    (                                                                   \
  |  |  127|      0|        DELSYS_BIT(SYS_DVBC_ANNEX_A) |                                  \
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  |  |  128|      0|        DELSYS_BIT(SYS_DVBT) |                                          \
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  |  |  129|      0|        DELSYS_BIT(SYS_DVBS) |                                          \
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  |  |  130|      0|        DELSYS_BIT(SYS_DVBS2) |                                         \
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  |  |  131|      0|        DELSYS_BIT(SYS_ATSC) |                                          \
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  |  |  132|      0|        DELSYS_BIT(SYS_DVBC_ANNEX_B) |                                  \
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  |  |  133|      0|        DELSYS_BIT(SYS_DVBT2) |                                         \
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  |  |  134|      0|        DELSYS_BIT(SYS_ISDBT) |                                         \
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  |  |  135|      0|        DELSYS_BIT(SYS_DVBC_ANNEX_C)                                    \
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  |  |  136|      0|    )
  ------------------
 1073|      0|            close(fd);
 1074|      0|            if (delsys_mask[f] == 0) {
  ------------------
  |  Branch (1074:17): [True: 0, False: 0]
  ------------------
 1075|      0|                mp_verbose(log, "Frontend device %s has no supported delivery systems.\n",
  ------------------
  |  |   79|      0|#define mp_verbose(log, ...)    mp_msg(log, MSGL_V, __VA_ARGS__)
  ------------------
 1076|      0|                       filename);
 1077|      0|                continue; /* Skip tuner. */
 1078|      0|            }
 1079|       |
 1080|       |            /* Create channel list for adapter. */
 1081|      0|            for (unsigned int delsys = 0; delsys < SYS_DVB__COUNT__; delsys++) {
  ------------------
  |  |  113|      0|#define SYS_DVB__COUNT__            (SYS_DVBC_ANNEX_C + 1)
  ------------------
  |  Branch (1081:43): [True: 0, False: 0]
  ------------------
 1082|      0|                if (!DELSYS_IS_SET(delsys_mask[f], delsys))
  ------------------
  |  |  122|      0|    (0 != ((__mask) & DELSYS_BIT((__bit))))
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  ------------------
  |  Branch (1082:21): [True: 0, False: 0]
  ------------------
 1083|      0|                    continue; /* Skip unsupported. */
 1084|       |
 1085|      0|                mp_verbose(log, "Searching channel list for delivery system %s\n", get_dvb_delsys(delsys));
  ------------------
  |  |   79|      0|#define mp_verbose(log, ...)    mp_msg(log, MSGL_V, __VA_ARGS__)
  ------------------
 1086|      0|                const char *conf_file_name;
 1087|      0|                switch (delsys) {
 1088|      0|                case SYS_DVBC_ANNEX_A:
  ------------------
  |  Branch (1088:17): [True: 0, False: 0]
  ------------------
 1089|      0|                case SYS_DVBC_ANNEX_C:
  ------------------
  |  Branch (1089:17): [True: 0, False: 0]
  ------------------
 1090|      0|                    conf_file_name = "channels.conf.cbl";
 1091|      0|                    break;
 1092|      0|                case SYS_ATSC:
  ------------------
  |  Branch (1092:17): [True: 0, False: 0]
  ------------------
 1093|      0|                    conf_file_name = "channels.conf.atsc";
 1094|      0|                    break;
 1095|      0|                case SYS_DVBT:
  ------------------
  |  Branch (1095:17): [True: 0, False: 0]
  ------------------
 1096|      0|                    if (DELSYS_IS_SET(delsys_mask[f], SYS_DVBT2)) {
  ------------------
  |  |  122|      0|    (0 != ((__mask) & DELSYS_BIT((__bit))))
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  |  |  |  Branch (122:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1097|       |                        // only if ter1 is present, interpret as DVB-T, else will be loaded as DVB-T2
 1098|      0|                        conf_file_name = "channels.conf.ter1";
 1099|      0|                    } else {
 1100|      0|                        conf_file_name = "channels.conf.ter";
 1101|      0|                    }
 1102|      0|                    break;
 1103|      0|                case SYS_DVBT2:
  ------------------
  |  Branch (1103:17): [True: 0, False: 0]
  ------------------
 1104|      0|                    conf_file_name = "channels.conf.ter";
 1105|      0|                    break;
 1106|      0|                case SYS_ISDBT:
  ------------------
  |  Branch (1106:17): [True: 0, False: 0]
  ------------------
 1107|      0|                    conf_file_name = "channels.conf.isdbt";
 1108|      0|                    break;
 1109|      0|                case SYS_DVBS:
  ------------------
  |  Branch (1109:17): [True: 0, False: 0]
  ------------------
 1110|      0|                    if (DELSYS_IS_SET(delsys_mask[f], SYS_DVBS2)) {
  ------------------
  |  |  122|      0|    (0 != ((__mask) & DELSYS_BIT((__bit))))
  |  |  ------------------
  |  |  |  |  116|      0|#define DELSYS_BIT(__bit)        (((unsigned int)1) << (__bit))
  |  |  ------------------
  |  |  |  Branch (122:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1111|       |                        // only if sat1 is present, interpret as DVB-S, else will be loaded as DVB-S2
 1112|      0|                        conf_file_name = "channels.conf.sat1";
 1113|      0|                    } else {
 1114|      0|                        conf_file_name = "channels.conf.sat";
 1115|      0|                    }
 1116|      0|                    break;
 1117|      0|                case SYS_DVBS2:
  ------------------
  |  Branch (1117:17): [True: 0, False: 0]
  ------------------
 1118|      0|                    conf_file_name = "channels.conf.sat";
 1119|      0|                    break;
 1120|      0|                default:
  ------------------
  |  Branch (1120:17): [True: 0, False: 0]
  ------------------
 1121|      0|                    continue;
 1122|      0|                }
 1123|       |
 1124|      0|                void *talloc_ctx = talloc_new(NULL);
  ------------------
  |  |   40|      0|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|      0|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
 1125|      0|                char *conf_file;
 1126|      0|                if (priv->opts->cfg_file && priv->opts->cfg_file[0]) {
  ------------------
  |  Branch (1126:21): [True: 0, False: 0]
  |  Branch (1126:45): [True: 0, False: 0]
  ------------------
 1127|      0|                    conf_file = mp_get_user_path(talloc_ctx, global, priv->opts->cfg_file);
 1128|      0|                } else {
 1129|      0|                    conf_file = mp_find_config_file(talloc_ctx, global, conf_file_name);
 1130|      0|                    if (conf_file) {
  ------------------
  |  Branch (1130:25): [True: 0, False: 0]
  ------------------
 1131|      0|                        mp_verbose(log, "Ignoring other channels.conf files.\n");
  ------------------
  |  |   79|      0|#define mp_verbose(log, ...)    mp_msg(log, MSGL_V, __VA_ARGS__)
  ------------------
 1132|      0|                    } else {
 1133|      0|                        conf_file = mp_find_config_file(talloc_ctx, global,
 1134|      0|                                        "channels.conf");
 1135|      0|                    }
 1136|      0|                }
 1137|       |
 1138|      0|                list = dvb_get_channels(log, list, priv->opts->cfg_full_transponder,
 1139|      0|                                        conf_file, f, delsys, delsys_mask[f]);
 1140|      0|                talloc_free(talloc_ctx);
  ------------------
  |  |   47|      0|#define talloc_free                     ta_free
  ------------------
 1141|      0|            }
 1142|      0|        }
 1143|       |        /* Add adapter with non zero channel list. */
 1144|     48|        if (!list)
  ------------------
  |  Branch (1144:13): [True: 48, False: 0]
  ------------------
 1145|     48|            continue;
 1146|       |
 1147|      0|        dvb_adapter_config_t tmp = {
 1148|      0|            .devno = i,
 1149|      0|            .list = talloc_steal(state, list),
  ------------------
  |  |   38|      0|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|      0|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
 1150|      0|        };
 1151|      0|        memcpy(&tmp.delsys_mask, delsys_mask, sizeof(delsys_mask));
 1152|       |
 1153|      0|        MP_TARRAY_APPEND(state, state->adapters, state->adapters_count, tmp);
  ------------------
  |  |  105|      0|    do {                                            \
  |  |  106|      0|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      0|    do {                                            \
  |  |  |  |   97|      0|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      0|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      0|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|      0|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      0|        (idxvar)++;                                 \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1154|       |
 1155|      0|        mp_verbose(log, "Added adapter with channels to state list, now %d.\n",
  ------------------
  |  |   79|      0|#define mp_verbose(log, ...)    mp_msg(log, MSGL_V, __VA_ARGS__)
  ------------------
 1156|      0|                   state->adapters_count);
 1157|      0|    }
 1158|       |
 1159|      3|    if (state->adapters_count == 0)
  ------------------
  |  Branch (1159:9): [True: 3, False: 0]
  ------------------
 1160|      3|        TA_FREEP(&state);
  ------------------
  |  |   81|      3|#define TA_FREEP(pctx) do {talloc_free(*(pctx)); *(pctx) = NULL;} while(0)
  |  |  ------------------
  |  |  |  |   47|      3|#define talloc_free                     ta_free
  |  |  ------------------
  |  |  |  Branch (81:73): [Folded, False: 3]
  |  |  ------------------
  ------------------
 1161|       |
 1162|      3|    global_dvb_state = state;
 1163|      3|    return state;
 1164|      3|}
stream_dvb.c:dvb_open:
  923|      3|{
  924|      3|    dvb_priv_t *priv = NULL;
  925|       |
  926|      3|    mp_mutex_lock(&global_dvb_state_lock);
  ------------------
  |  |  134|      3|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  927|      3|    if (global_dvb_state && global_dvb_state->stream_used) {
  ------------------
  |  Branch (927:9): [True: 0, False: 3]
  |  Branch (927:29): [True: 0, False: 0]
  ------------------
  928|      0|        MP_ERR(stream, "DVB stream already in use, only one DVB stream can exist at a time!\n");
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  929|      0|        mp_mutex_unlock(&global_dvb_state_lock);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  930|      0|        goto err_out;
  931|      0|    }
  932|       |
  933|       |    // Need to re-get config in any case, not part of global state.
  934|      3|    stream->priv = talloc_zero(stream, dvb_priv_t);
  ------------------
  |  |   27|      3|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|      3|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      3|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  935|      3|    priv = stream->priv;
  936|      3|    priv->opts_cache = m_config_cache_alloc(stream, stream->global, &stream_dvb_conf);
  937|      3|    priv->opts = priv->opts_cache->opts;
  938|       |
  939|      3|    dvb_state_t *state = dvb_get_state(stream);
  940|       |
  941|      3|    priv->state = state;
  942|      3|    priv->log = stream->log;
  943|      3|    if (!state) {
  ------------------
  |  Branch (943:9): [True: 3, False: 0]
  ------------------
  944|      3|        MP_ERR(stream, "DVB configuration is empty\n");
  ------------------
  |  |   89|      3|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      3|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  945|      3|        mp_mutex_unlock(&global_dvb_state_lock);
  ------------------
  |  |  136|      3|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  946|      3|        goto err_out;
  947|      3|    }
  948|       |
  949|      0|    if (!dvb_parse_path(stream)) {
  ------------------
  |  Branch (949:9): [True: 0, False: 0]
  ------------------
  950|      0|        mp_mutex_unlock(&global_dvb_state_lock);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  951|      0|        goto err_out;
  952|      0|    }
  953|       |
  954|      0|    state->stream_used = true;
  955|      0|    mp_mutex_unlock(&global_dvb_state_lock);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  956|       |
  957|      0|    if (!state->is_on) {
  ------------------
  |  Branch (957:9): [True: 0, False: 0]
  ------------------
  958|       |        // State could be already initialized, for example, we just did a channel switch.
  959|       |        // The following setup only has to be done once.
  960|       |
  961|      0|        state->cur_frontend = -1;
  962|       |
  963|      0|        if (!dvb_streaming_start(stream, priv->prog))
  ------------------
  |  Branch (963:13): [True: 0, False: 0]
  ------------------
  964|      0|            goto err_out;
  965|      0|    }
  966|       |
  967|      0|    stream->fill_buffer = dvb_streaming_read;
  968|      0|    stream->close = dvbin_close;
  969|      0|    stream->control = dvbin_stream_control;
  970|      0|    stream->streaming = true;
  971|      0|    stream->demuxer = "lavf";
  972|      0|    stream->lavf_type = "mpegts";
  973|       |
  974|      0|    return STREAM_OK;
  ------------------
  |  |   68|      0|#define STREAM_OK    1
  ------------------
  975|       |
  976|      3|err_out:
  977|      3|    talloc_free(priv);
  ------------------
  |  |   47|      3|#define talloc_free                     ta_free
  ------------------
  978|      3|    stream->priv = NULL;
  979|      3|    return STREAM_ERROR;
  ------------------
  |  |   67|      3|#define STREAM_ERROR 0
  ------------------
  980|      0|}

stream_edl.c:s_open:
    7|      1|{
    8|      1|    stream->demuxer = "edl";
    9|       |
   10|      1|    return STREAM_OK;
  ------------------
  |  |   68|      1|#define STREAM_OK    1
  ------------------
   11|      1|}

stream_env.c:open2:
   24|      1|{
   25|      1|    bstr data = bstr0(stream->url);
   26|      1|    bstr_eatstart0(&data, "env://");
   27|       |
   28|      1|    char *name = bstrdup0(stream, data);
   29|      1|    char *val = getenv(name);
   30|      1|    talloc_free(name);
  ------------------
  |  |   47|      1|#define talloc_free                     ta_free
  ------------------
   31|       |
   32|      1|    if (!val) {
  ------------------
  |  Branch (32:9): [True: 1, False: 0]
  ------------------
   33|      1|        MP_FATAL(stream, "Could not read from environment variable '%.*s'\n",
  ------------------
  |  |   88|      1|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      2|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (86:57): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   34|      1|                 BSTR_P(data));
   35|      1|        return STREAM_ERROR;
  ------------------
  |  |   67|      1|#define STREAM_ERROR 0
  ------------------
   36|      1|    }
   37|       |
   38|      0|    data = bstrdup(stream, bstr0(val));
   39|      0|    return stream_bstr_open2(stream, args, data);
   40|      1|}

mp_file_url_to_filename:
  176|  55.3k|{
  177|  55.3k|    bstr proto = mp_split_proto(url, &url);
  178|  55.3k|    if (bstrcasecmp0(proto, "file") != 0)
  ------------------
  |  Branch (178:9): [True: 54.6k, False: 631]
  ------------------
  179|  54.6k|        return NULL;
  180|    631|    char *filename = bstrto0(talloc_ctx, url);
  181|    631|    mp_url_unescape_inplace(filename);
  182|       |#if HAVE_DOS_PATHS
  183|       |    // extract '/' from '/x:/path'
  184|       |    if (filename[0] == '/' && filename[1] && filename[2] == ':')
  185|       |        memmove(filename, filename + 1, strlen(filename)); // including \0
  186|       |#endif
  187|    631|    return filename;
  188|  55.3k|}
stream_file.c:open_f:
  277|    291|{
  278|    291|    struct priv *p = talloc_ptrtype(stream, p);
  ------------------
  |  |   34|    291|#define talloc_ptrtype                  ta_xnew_ptrtype
  |  |  ------------------
  |  |  |  |  138|    291|#define ta_xnew_ptrtype(...)            ta_oom_g(ta_new_ptrtype(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|    291|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  279|    291|    *p = (struct priv) {
  280|    291|        .fd = -1,
  281|    291|    };
  282|    291|    stream->priv = p;
  283|    291|    stream->is_local_fs = true;
  284|       |
  285|    291|    bool strict_fs = args->flags & STREAM_LOCAL_FS_ONLY;
  ------------------
  |  |   54|    291|#define STREAM_LOCAL_FS_ONLY      (1 << 5) // stream_file only, no URLs
  ------------------
  286|    291|    bool write = stream->mode == STREAM_WRITE;
  ------------------
  |  |   42|    291|#define STREAM_WRITE              (1 << 0)
  ------------------
  287|    291|    int m = O_CLOEXEC | (write ? O_RDWR | O_CREAT | O_TRUNC : O_RDONLY);
  ------------------
  |  Branch (287:26): [True: 0, False: 291]
  ------------------
  288|       |
  289|    291|    char *filename = stream->path;
  290|    291|    char *url = "";
  291|    291|    if (!strict_fs) {
  ------------------
  |  Branch (291:9): [True: 291, False: 0]
  ------------------
  292|    291|        char *fn = mp_file_url_to_filename(stream, bstr0(stream->url));
  293|    291|        if (fn)
  ------------------
  |  Branch (293:13): [True: 1, False: 290]
  ------------------
  294|      1|            filename = stream->path = fn;
  295|    291|        url = stream->url;
  296|    291|    }
  297|       |
  298|    291|    bool is_fdclose = strncmp(url, "fdclose://", 10) == 0;
  299|    291|    if (strncmp(url, "fd://", 5) == 0 || is_fdclose) {
  ------------------
  |  Branch (299:9): [True: 37, False: 254]
  |  Branch (299:42): [True: 2, False: 252]
  ------------------
  300|     39|        stream->is_local_fs = false;
  301|     39|        char *begin = strstr(stream->url, "://") + 3, *end = NULL;
  302|     39|        p->fd = strtol(begin, &end, 0);
  303|     39|        if (end == begin || end[0] || p->fd < 0) {
  ------------------
  |  Branch (303:13): [True: 2, False: 37]
  |  Branch (303:29): [True: 2, False: 35]
  |  Branch (303:39): [True: 29, False: 6]
  ------------------
  304|     33|            MP_ERR(stream, "Invalid FD number: %s\n", stream->url);
  ------------------
  |  |   89|     33|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     33|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  305|     33|            return STREAM_ERROR;
  ------------------
  |  |   67|     33|#define STREAM_ERROR 0
  ------------------
  306|     33|        }
  307|      6|#ifdef F_SETFD
  308|      6|        if (fcntl(p->fd, F_GETFD) == -1) {
  ------------------
  |  Branch (308:13): [True: 3, False: 3]
  ------------------
  309|      3|            MP_ERR(stream, "Invalid FD: %d\n", p->fd);
  ------------------
  |  |   89|      3|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      3|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  310|      3|            return STREAM_ERROR;
  ------------------
  |  |   67|      3|#define STREAM_ERROR 0
  ------------------
  311|      3|        }
  312|      3|#endif
  313|      3|        if (is_fdclose)
  ------------------
  |  Branch (313:13): [True: 1, False: 2]
  ------------------
  314|      1|            p->close = true;
  315|    252|    } else if (!strict_fs && !strcmp(filename, "-")) {
  ------------------
  |  Branch (315:16): [True: 252, False: 0]
  |  Branch (315:30): [True: 2, False: 250]
  ------------------
  316|      2|        stream->is_local_fs = false;
  317|      2|        if (!write) {
  ------------------
  |  Branch (317:13): [True: 2, False: 0]
  ------------------
  318|      2|            MP_INFO(stream, "Reading from stdin...\n");
  ------------------
  |  |   91|      2|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      2|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  319|      2|            p->fd = 0;
  320|      2|        } else {
  321|      0|            MP_INFO(stream, "Writing to stdout...\n");
  ------------------
  |  |   91|      0|#define MP_INFO(obj, ...)       MP_MSG(obj, MSGL_INFO, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  322|      0|            p->fd = 1;
  323|      0|        }
  324|    250|    } else {
  325|    250|        if (bstr_startswith0(bstr0(stream->url), "appending://"))
  ------------------
  |  Branch (325:13): [True: 1, False: 249]
  ------------------
  326|      1|            p->appending = true;
  327|       |
  328|    250|        mode_t openmode = S_IRUSR | S_IWUSR;
  329|    250|#ifndef __MINGW32__
  330|    250|        openmode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
  331|    250|        if (!write)
  ------------------
  |  Branch (331:13): [True: 250, False: 0]
  ------------------
  332|    250|            m |= O_NONBLOCK;
  333|    250|#endif
  334|    250|        p->fd = open(filename, m | O_BINARY, openmode);
  ------------------
  |  |  269|    250|#define open(...) mp_open(__VA_ARGS__)
  ------------------
  335|    250|        if (p->fd < 0) {
  ------------------
  |  Branch (335:13): [True: 244, False: 6]
  ------------------
  336|    244|            MP_ERR(stream, "Cannot open file '%s': %s\n",
  ------------------
  |  |   89|    244|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    244|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  337|    244|                   filename, mp_strerror(errno));
  338|    244|            return STREAM_ERROR;
  ------------------
  |  |   67|    244|#define STREAM_ERROR 0
  ------------------
  339|    244|        }
  340|      6|        p->close = true;
  341|      6|    }
  342|       |
  343|     11|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  344|     11|    if (is_fdclose)
  ------------------
  |  Branch (344:9): [True: 1, False: 10]
  ------------------
  345|      1|        p->close = false;
  346|     11|    if (p->fd != 42) {
  ------------------
  |  Branch (346:9): [True: 11, False: 0]
  ------------------
  347|     11|        s_close(stream);
  348|     11|        return STREAM_ERROR;
  ------------------
  |  |   67|     11|#define STREAM_ERROR 0
  ------------------
  349|     11|    }
  350|      0|#endif
  351|       |
  352|      0|    struct stat st;
  353|      0|    bool is_sock_or_fifo = false;
  354|      0|    if (fstat(p->fd, &st) == 0) {
  ------------------
  |  Branch (354:9): [True: 0, False: 0]
  ------------------
  355|      0|        if (S_ISDIR(st.st_mode)) {
  ------------------
  |  Branch (355:13): [True: 0, False: 0]
  ------------------
  356|      0|            stream->is_directory = true;
  357|      0|        } else if (S_ISREG(st.st_mode)) {
  ------------------
  |  Branch (357:20): [True: 0, False: 0]
  ------------------
  358|      0|            p->regular_file = true;
  359|      0|            stream->is_regular = true;
  360|      0|#ifndef _WIN32
  361|       |            // O_NONBLOCK has weird semantics on file locks; remove it.
  362|      0|            int val = fcntl(p->fd, F_GETFL) & ~(unsigned)O_NONBLOCK;
  363|      0|            fcntl(p->fd, F_SETFL, val);
  364|      0|#endif
  365|      0|        } else {
  366|      0|#ifndef __MINGW32__
  367|      0|            is_sock_or_fifo = S_ISSOCK(st.st_mode) || S_ISFIFO(st.st_mode);
  ------------------
  |  Branch (367:31): [True: 0, False: 0]
  |  Branch (367:55): [True: 0, False: 0]
  ------------------
  368|      0|#endif
  369|      0|            p->use_poll = true;
  370|      0|        }
  371|      0|    }
  372|       |
  373|       |#ifdef _WIN32
  374|       |    setmode(p->fd, O_BINARY);
  375|       |#endif
  376|       |
  377|      0|    off_t len = lseek(p->fd, 0, SEEK_END);
  378|      0|    lseek(p->fd, 0, SEEK_SET);
  379|      0|    if (len != (off_t)-1) {
  ------------------
  |  Branch (379:9): [True: 0, False: 0]
  ------------------
  380|      0|        stream->seek = seek;
  381|      0|        stream->seekable = true;
  382|      0|    }
  383|       |
  384|      0|    stream->fast_skip = true;
  385|      0|    stream->fill_buffer = fill_buffer;
  386|      0|    stream->write_buffer = write_buffer;
  387|      0|    stream->get_size = get_size;
  388|      0|    stream->close = s_close;
  389|       |
  390|      0|    if (is_sock_or_fifo || check_stream_network(p->fd)) {
  ------------------
  |  Branch (390:9): [True: 0, False: 0]
  |  Branch (390:28): [True: 0, False: 0]
  ------------------
  391|      0|        stream->streaming = true;
  392|       |#if HAVE_COCOA
  393|       |        if (fcntl(p->fd, F_RDAHEAD, 0) < 0) {
  394|       |            MP_VERBOSE(stream, "Cannot disable read ahead on file '%s': %s\n",
  395|       |                       filename, mp_strerror(errno));
  396|       |        }
  397|       |#endif
  398|      0|    }
  399|       |
  400|      0|    p->orig_size = get_size(stream);
  401|       |
  402|      0|    p->cancel = mp_cancel_new(p);
  403|      0|    if (stream->cancel)
  ------------------
  |  Branch (403:9): [True: 0, False: 0]
  ------------------
  404|      0|        mp_cancel_set_parent(p->cancel, stream->cancel);
  405|       |
  406|      0|    return STREAM_OK;
  ------------------
  |  |   68|      0|#define STREAM_OK    1
  ------------------
  407|     11|}
stream_file.c:s_close:
  168|     11|{
  169|     11|    struct priv *p = s->priv;
  170|     11|    if (p->close)
  ------------------
  |  Branch (170:9): [True: 6, False: 5]
  ------------------
  171|      6|        close(p->fd);
  172|     11|}

mp_setup_av_network_options:
  158|  2.04k|{
  159|  2.04k|    void *temp = talloc_new(NULL);
  ------------------
  |  |   40|  2.04k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  2.04k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  160|  2.04k|    struct mp_network_opts *opts =
  161|  2.04k|        mp_get_config_group(temp, global, &mp_network_conf);
  162|       |
  163|       |    // HTTP specific options (other protocols ignore them)
  164|  2.04k|    if (opts->useragent)
  ------------------
  |  Branch (164:9): [True: 2.04k, False: 0]
  ------------------
  165|  2.04k|        av_dict_set(dict, "user_agent", opts->useragent, 0);
  166|  2.04k|    if (opts->cookies_enabled) {
  ------------------
  |  Branch (166:9): [True: 1, False: 2.04k]
  ------------------
  167|      1|        char *file = opts->cookies_file;
  168|      1|        if (file && file[0])
  ------------------
  |  Branch (168:13): [True: 0, False: 1]
  |  Branch (168:21): [True: 0, False: 0]
  ------------------
  169|      0|            file = mp_get_user_path(temp, global, file);
  170|      1|        char *cookies = cookies_lavf(temp, global, log, file);
  171|      1|        if (cookies && cookies[0])
  ------------------
  |  Branch (171:13): [True: 1, False: 0]
  |  Branch (171:24): [True: 0, False: 1]
  ------------------
  172|      0|            av_dict_set(dict, "cookies", cookies, 0);
  173|      1|    }
  174|  2.04k|    av_dict_set(dict, "tls_verify", opts->tls_verify ? "1" : "0", 0);
  ------------------
  |  Branch (174:37): [True: 2.04k, False: 0]
  ------------------
  175|  2.04k|    if (opts->tls_ca_file) {
  ------------------
  |  Branch (175:9): [True: 1, False: 2.04k]
  ------------------
  176|      1|        char *file = mp_get_user_path(temp, global, opts->tls_ca_file);
  177|      1|        av_dict_set(dict, "ca_file", file, 0);
  178|      1|    }
  179|  2.04k|    if (opts->tls_cert_file) {
  ------------------
  |  Branch (179:9): [True: 0, False: 2.04k]
  ------------------
  180|      0|        char *file = mp_get_user_path(temp, global, opts->tls_cert_file);
  181|      0|        av_dict_set(dict, "cert_file", file, 0);
  182|      0|    }
  183|  2.04k|    if (opts->tls_key_file) {
  ------------------
  |  Branch (183:9): [True: 1, False: 2.04k]
  ------------------
  184|      1|        char *file = mp_get_user_path(temp, global, opts->tls_key_file);
  185|      1|        av_dict_set(dict, "key_file", file, 0);
  186|      1|    }
  187|  2.04k|    char *cust_headers = talloc_strdup(temp, "");
  ------------------
  |  |   50|  2.04k|#define talloc_strdup                   ta_xstrdup
  ------------------
  188|  2.04k|    if (opts->referrer) {
  ------------------
  |  Branch (188:9): [True: 1, False: 2.04k]
  ------------------
  189|      1|        cust_headers = talloc_asprintf_append(cust_headers, "Referer: %s\r\n",
  ------------------
  |  |   63|      1|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
  190|      1|                                              opts->referrer);
  191|      1|    }
  192|  2.04k|    if (opts->http_header_fields) {
  ------------------
  |  Branch (192:9): [True: 22, False: 2.02k]
  ------------------
  193|    220|        for (int n = 0; opts->http_header_fields[n]; n++) {
  ------------------
  |  Branch (193:25): [True: 198, False: 22]
  ------------------
  194|    198|            cust_headers = talloc_asprintf_append(cust_headers, "%s\r\n",
  ------------------
  |  |   63|    198|#define talloc_asprintf_append          ta_talloc_asprintf_append
  ------------------
  195|    198|                                                  opts->http_header_fields[n]);
  196|    198|        }
  197|     22|    }
  198|  2.04k|    if (strlen(cust_headers))
  ------------------
  |  Branch (198:9): [True: 23, False: 2.01k]
  ------------------
  199|     23|        av_dict_set(dict, "headers", cust_headers, 0);
  200|  2.04k|    av_dict_set(dict, "icy", "1", 0);
  201|       |    // So far, every known protocol uses microseconds for this
  202|       |    // Except rtsp.
  203|  2.04k|    if (opts->timeout > 0) {
  ------------------
  |  Branch (203:9): [True: 2.04k, False: 0]
  ------------------
  204|  2.04k|        if (target_fmt && strcmp(target_fmt, "rtsp") == 0) {
  ------------------
  |  Branch (204:13): [True: 0, False: 2.04k]
  |  Branch (204:27): [True: 0, False: 0]
  ------------------
  205|      0|            mp_verbose(log, "Broken FFmpeg RTSP API => not setting timeout.\n");
  ------------------
  |  |   79|      0|#define mp_verbose(log, ...)    mp_msg(log, MSGL_V, __VA_ARGS__)
  ------------------
  206|  2.04k|        } else {
  207|  2.04k|            char buf[80];
  208|  2.04k|            snprintf(buf, sizeof(buf), "%lld", (long long)(opts->timeout * 1e6));
  209|  2.04k|            av_dict_set(dict, "timeout", buf, 0);
  210|  2.04k|        }
  211|  2.04k|    }
  212|  2.04k|    if (opts->http_proxy && opts->http_proxy[0])
  ------------------
  |  Branch (212:9): [True: 1, False: 2.04k]
  |  Branch (212:29): [True: 1, False: 0]
  ------------------
  213|      1|        av_dict_set(dict, "http_proxy", opts->http_proxy, 0);
  214|       |
  215|  2.04k|    struct stream_lavf_opts *lavf_opts =
  216|  2.04k|        mp_get_config_group(temp, global, &stream_lavf_conf);
  217|  2.04k|    mp_set_avdict(dict, lavf_opts->avopts);
  218|       |
  219|  2.04k|    talloc_free(temp);
  ------------------
  |  |   47|  2.04k|#define talloc_free                     ta_free
  ------------------
  220|  2.04k|}
stream_lavf.c:open_f:
  332|  2.04k|{
  333|  2.04k|    AVIOContext *avio = NULL;
  334|  2.04k|    int res = STREAM_ERROR;
  ------------------
  |  |   67|  2.04k|#define STREAM_ERROR 0
  ------------------
  335|  2.04k|    AVDictionary *dict = NULL;
  336|  2.04k|    void *temp = talloc_new(NULL);
  ------------------
  |  |   40|  2.04k|#define talloc_new                      ta_xnew_context
  |  |  ------------------
  |  |  |  |  122|  2.04k|#define ta_xnew_context(...)            ta_oom_p(ta_new_context(__VA_ARGS__))
  |  |  ------------------
  ------------------
  337|       |
  338|  2.04k|    stream->seek = NULL;
  339|  2.04k|    stream->seekable = false;
  340|       |
  341|  2.04k|    int flags = stream->mode == STREAM_WRITE ? AVIO_FLAG_WRITE : AVIO_FLAG_READ;
  ------------------
  |  |   42|  2.04k|#define STREAM_WRITE              (1 << 0)
  ------------------
  |  Branch (341:17): [True: 0, False: 2.04k]
  ------------------
  342|  2.04k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  343|  2.04k|    if (flags & AVIO_FLAG_WRITE)
  ------------------
  |  Branch (343:9): [True: 0, False: 2.04k]
  ------------------
  344|      0|        goto out;
  345|  2.04k|#endif
  346|       |
  347|  2.04k|    const char *filename = stream->url;
  348|  2.04k|    if (!filename) {
  ------------------
  |  Branch (348:9): [True: 0, False: 2.04k]
  ------------------
  349|      0|        MP_ERR(stream, "No URL\n");
  ------------------
  |  |   89|      0|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|      0|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  350|      0|        goto out;
  351|      0|    }
  352|  6.13k|    for (int i = 0; i < MP_ARRAY_SIZE(prefix); i++)
  ------------------
  |  |   49|  6.13k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (352:21): [True: 4.09k, False: 2.04k]
  ------------------
  353|  4.09k|        if (!strncmp(filename, prefix[i], strlen(prefix[i])))
  ------------------
  |  Branch (353:13): [True: 222, False: 3.86k]
  ------------------
  354|    222|            filename += strlen(prefix[i]);
  355|       |    // URLs that libavformat handles in a demuxer rather than in a protocol.
  356|       |    // The demuxer opens the URL itself, so there is no stream layer and
  357|       |    // demux_lavf does all the real work.
  358|  2.04k|    char *lavf_demuxer = NULL;
  359|  2.04k|    if (!strncmp(filename, "rtsp:", 5) || !strncmp(filename, "rtsps:", 6)) {
  ------------------
  |  Branch (359:9): [True: 1, False: 2.04k]
  |  Branch (359:43): [True: 1, False: 2.04k]
  ------------------
  360|      2|        lavf_demuxer = "rtsp";
  361|  2.04k|    } else if (!strncmp(filename, "rtp:", 4)) {
  ------------------
  |  Branch (361:16): [True: 1, False: 2.04k]
  ------------------
  362|      1|        lavf_demuxer = "rtp";
  363|      1|    }
  364|  2.04k|    if (lavf_demuxer) {
  ------------------
  |  Branch (364:9): [True: 3, False: 2.04k]
  ------------------
  365|      3|        stream->demuxer = "lavf";
  366|      3|        stream->lavf_type = lavf_demuxer;
  367|      3|        stream->streaming = true;
  368|      3|        if (stream->info->stream_origin == STREAM_ORIGIN_NET)
  ------------------
  |  |   49|      3|#define STREAM_ORIGIN_NET         (3 << 2) // referenced from playlist on network
  ------------------
  |  Branch (368:13): [True: 0, False: 3]
  ------------------
  369|      0|            stream->is_network = true;
  370|      3|        talloc_free(temp);
  ------------------
  |  |   47|      3|#define talloc_free                     ta_free
  ------------------
  371|      3|        return STREAM_OK;
  ------------------
  |  |   68|      3|#define STREAM_OK    1
  ------------------
  372|      3|    }
  373|       |
  374|       |    // Replace "mms://" with "mmsh://", so that most mms:// URLs just work.
  375|       |    // Replace "dav://" or "webdav://" with "http://" and "davs://" or "webdavs://" with "https://"
  376|  2.04k|    bstr b_filename = bstr0(filename);
  377|  2.04k|    if (bstr_eatstart0(&b_filename, "mms://") ||
  ------------------
  |  Branch (377:9): [True: 18, False: 2.02k]
  ------------------
  378|  2.02k|        bstr_eatstart0(&b_filename, "mmshttp://"))
  ------------------
  |  Branch (378:9): [True: 1, False: 2.02k]
  ------------------
  379|     19|    {
  380|     19|        filename = talloc_asprintf(temp, "mmsh://%.*s", BSTR_P(b_filename));
  ------------------
  |  |   52|     19|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     38|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (127:62): [True: 19, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  381|  2.02k|    } else if (bstr_eatstart0(&b_filename, "dav://") || bstr_eatstart0(&b_filename, "webdav://"))
  ------------------
  |  Branch (381:16): [True: 14, False: 2.00k]
  |  Branch (381:57): [True: 1, False: 2.00k]
  ------------------
  382|     15|    {
  383|     15|        filename = talloc_asprintf(temp, "http://%.*s", BSTR_P(b_filename));
  ------------------
  |  |   52|     15|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|     30|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (127:62): [True: 15, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  384|  2.00k|    } else if (bstr_eatstart0(&b_filename, "davs://") || bstr_eatstart0(&b_filename, "webdavs://"))
  ------------------
  |  Branch (384:16): [True: 2, False: 2.00k]
  |  Branch (384:58): [True: 1, False: 2.00k]
  ------------------
  385|      3|    {
  386|      3|        filename = talloc_asprintf(temp, "https://%.*s", BSTR_P(b_filename));
  ------------------
  |  |   52|      3|#define talloc_asprintf                 ta_xasprintf
  |  |  ------------------
  |  |  |  |  127|      6|#define ta_xasprintf(...)               ta_oom_s(ta_asprintf(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (127:62): [True: 3, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  387|      3|    }
  388|       |
  389|  2.04k|    av_dict_set(&dict, "reconnect", "1", 0);
  390|  2.04k|    av_dict_set(&dict, "reconnect_delay_max", "7", 0);
  391|       |
  392|  2.04k|    mp_setup_av_network_options(&dict, NULL, stream->global, stream->log);
  393|       |
  394|  2.04k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  395|  2.04k|    av_dict_set(&dict, "protocol_blacklist", "fd,pipe", 0);
  396|  2.04k|#endif
  397|       |
  398|  2.04k|    AVIOInterruptCB cb = {
  399|  2.04k|        .callback = interrupt_cb,
  400|  2.04k|        .opaque = stream,
  401|  2.04k|    };
  402|       |
  403|  2.04k|    filename = normalize_url(stream, filename);
  404|       |
  405|  2.04k|    if (strncmp(filename, "rtmp", 4) == 0) {
  ------------------
  |  Branch (405:9): [True: 2, False: 2.04k]
  ------------------
  406|      2|        stream->demuxer = "lavf";
  407|      2|        stream->lavf_type = "flv";
  408|       |        // Setting timeout enables listen mode - force it to disabled.
  409|      2|        av_dict_set(&dict, "timeout", "0", 0);
  410|      2|    }
  411|       |
  412|  2.04k|    int err = avio_open2(&avio, filename, flags, &cb, &dict);
  413|  2.04k|    if (err < 0) {
  ------------------
  |  Branch (413:9): [True: 1.51k, False: 526]
  ------------------
  414|  1.51k|        if (err == AVERROR_PROTOCOL_NOT_FOUND)
  ------------------
  |  Branch (414:13): [True: 127, False: 1.38k]
  ------------------
  415|  1.51k|            MP_ERR(stream, "Protocol not found. Make sure"
  ------------------
  |  |   89|    127|#define MP_ERR(obj, ...)        MP_MSG(obj, MSGL_ERR, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|    127|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
  416|  1.51k|                   " FFmpeg is compiled with networking support.\n");
  417|  1.51k|        goto out;
  418|  1.51k|    }
  419|       |
  420|    526|    mp_avdict_print_unset(stream->log, MSGL_V, dict);
  421|       |
  422|    526|    if (avio->av_class) {
  ------------------
  |  Branch (422:9): [True: 526, False: 0]
  ------------------
  423|    526|        uint8_t *mt = NULL;
  424|    526|        if (av_opt_get(avio, "mime_type", AV_OPT_SEARCH_CHILDREN, &mt) >= 0) {
  ------------------
  |  Branch (424:13): [True: 0, False: 526]
  ------------------
  425|      0|            stream->mime_type = talloc_strdup(stream, mt);
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  426|      0|            av_free(mt);
  427|      0|        }
  428|    526|        uint8_t *location = NULL;
  429|    526|        if (av_opt_get(avio, "location", AV_OPT_SEARCH_CHILDREN, &location) >= 0) {
  ------------------
  |  Branch (429:13): [True: 0, False: 526]
  ------------------
  430|      0|            if (*location)
  ------------------
  |  Branch (430:17): [True: 0, False: 0]
  ------------------
  431|      0|                stream->effective_url = talloc_strdup(stream, location);
  ------------------
  |  |   50|      0|#define talloc_strdup                   ta_xstrdup
  ------------------
  432|      0|            av_free(location);
  433|      0|        }
  434|    526|    }
  435|       |
  436|    526|    stream->priv = avio;
  437|    526|    stream->seekable = avio->seekable & AVIO_SEEKABLE_NORMAL;
  438|    526|    stream->seek = stream->seekable ? seek : NULL;
  ------------------
  |  Branch (438:20): [True: 526, False: 0]
  ------------------
  439|    526|    stream->fill_buffer = fill_buffer;
  440|    526|    stream->write_buffer = write_buffer;
  441|    526|    stream->get_size = get_size;
  442|    526|    stream->control = control;
  443|    526|    stream->close = close_f;
  444|       |    // enable cache (should be avoided for files, but no way to detect this)
  445|    526|    stream->streaming = true;
  446|    526|    if (stream->info->stream_origin == STREAM_ORIGIN_NET)
  ------------------
  |  |   49|    526|#define STREAM_ORIGIN_NET         (3 << 2) // referenced from playlist on network
  ------------------
  |  Branch (446:9): [True: 107, False: 419]
  ------------------
  447|    107|        stream->is_network = true;
  448|    526|    res = STREAM_OK;
  ------------------
  |  |   68|    526|#define STREAM_OK    1
  ------------------
  449|       |
  450|  2.04k|out:
  451|  2.04k|    av_dict_free(&dict);
  452|  2.04k|    talloc_free(temp);
  ------------------
  |  |   47|  2.04k|#define talloc_free                     ta_free
  ------------------
  453|  2.04k|    return res;
  454|    526|}
stream_lavf.c:interrupt_cb:
  149|  5.25k|{
  150|  5.25k|    struct stream *stream = ctx;
  151|  5.25k|    return mp_cancel_test(stream->cancel);
  152|  5.25k|}
stream_lavf.c:normalize_url:
  320|  2.04k|{
  321|  2.04k|    bstr proto = mp_split_proto(bstr0(filename), NULL);
  322|  12.1k|    for (int n = 0; http_like[n]; n++) {
  ------------------
  |  Branch (322:21): [True: 10.1k, False: 2.00k]
  ------------------
  323|  10.1k|        if (bstr_equals0(proto, http_like[n]))
  ------------------
  |  Branch (323:13): [True: 37, False: 10.0k]
  ------------------
  324|       |            // Escape everything but reserved characters.
  325|       |            // Also don't double-scape, so include '%'.
  326|     37|            return mp_url_escape(ta_parent, filename, ":/?#[]@!$&'()*+,;=%");
  327|  10.1k|    }
  328|  2.00k|    return (char *)filename;
  329|  2.04k|}
stream_lavf.c:fill_buffer:
   58|    506|{
   59|    506|    AVIOContext *avio = s->priv;
   60|    506|    int r = avio_read_partial(avio, buffer, max_len);
   61|    506|    return (r <= 0) ? -1 : r;
  ------------------
  |  Branch (61:12): [True: 371, False: 135]
  ------------------
   62|    506|}
stream_lavf.c:get_size:
   84|    526|{
   85|    526|    AVIOContext *avio = s->priv;
   86|    526|    return avio_size(avio);
   87|    526|}
stream_lavf.c:close_f:
   90|    526|{
   91|    526|    AVIOContext *avio = stream->priv;
   92|       |    /* NOTE: As of 2011 write streams must be manually flushed before close.
   93|       |     * Currently write_buffer() always flushes them after writing.
   94|       |     * avio_close() could return an error, but we have no way to return that
   95|       |     * with the current stream API.
   96|       |     */
   97|    526|    if (avio)
  ------------------
  |  Branch (97:9): [True: 526, False: 0]
  ------------------
   98|    526|        avio_close(avio);
   99|    526|}
stream_lavf.c:get_safe_protocols:
  250|  9.31k|{
  251|  9.31k|    int num = 0;
  252|  9.31k|    char **protocols = NULL;
  253|  9.31k|    char **ffmpeg_demuxers = mp_get_lavf_demuxers();
  254|  9.31k|    char **ffmpeg_protos = mp_get_lavf_protocols();
  255|       |
  256|   111k|    for (int i = 0; ffmpeg_protos[i]; i++) {
  ------------------
  |  Branch (256:21): [True: 102k, False: 9.31k]
  ------------------
  257|  1.96M|        for (int j = 0; safe_protos[j]; j++) {
  ------------------
  |  Branch (257:25): [True: 1.87M, False: 93.1k]
  ------------------
  258|  1.87M|            if (strcmp(ffmpeg_protos[i], safe_protos[j][0]) != 0)
  ------------------
  |  Branch (258:17): [True: 1.86M, False: 9.31k]
  ------------------
  259|  1.86M|                continue;
  260|  18.6k|            for (int k = 0; safe_protos[j][k]; k++)
  ------------------
  |  Branch (260:29): [True: 9.31k, False: 9.31k]
  ------------------
  261|  9.31k|                MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, safe_protos[j][k]));
  ------------------
  |  |  105|  18.6k|    do {                                            \
  |  |  106|  9.31k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  9.31k|    do {                                            \
  |  |  |  |   97|  9.31k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  9.31k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  9.31k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  9.31k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 9.31k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|  9.31k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  9.31k|    do {                                                        \
  |  |  |  |  |  |   89|  9.31k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  9.31k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  9.31k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  9.31k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  9.31k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  9.31k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  9.31k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 9.31k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  9.31k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 9.31k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  9.31k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  9.31k|        (idxvar)++;                                 \
  |  |  109|  9.31k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 9.31k]
  |  |  ------------------
  ------------------
  262|  9.31k|            break;
  263|  1.87M|        }
  264|   102k|    }
  265|       |
  266|       |    // rtsp is a demuxer not protocol in ffmpeg so it is handled separately
  267|  3.40M|    for (int i = 0; ffmpeg_demuxers[i]; i++) {
  ------------------
  |  Branch (267:21): [True: 3.39M, False: 9.31k]
  ------------------
  268|  3.39M|        if (strcmp("rtsp", ffmpeg_demuxers[i]) == 0) {
  ------------------
  |  Branch (268:13): [True: 0, False: 3.39M]
  ------------------
  269|      0|            MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, "rtsp"));
  ------------------
  |  |  105|      0|    do {                                            \
  |  |  106|      0|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      0|    do {                                            \
  |  |  |  |   97|      0|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      0|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      0|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|      0|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      0|        (idxvar)++;                                 \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  270|      0|            MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, "rtsps"));
  ------------------
  |  |  105|      0|    do {                                            \
  |  |  106|      0|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      0|    do {                                            \
  |  |  |  |   97|      0|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      0|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      0|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      0|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   99|      0|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      0|        (idxvar)++;                                 \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  271|      0|            break;
  272|      0|        }
  273|  3.39M|    }
  274|       |
  275|  9.31k|    MP_TARRAY_APPEND(NULL, protocols, num, NULL);
  ------------------
  |  |  105|  9.31k|    do {                                            \
  |  |  106|  9.31k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  9.31k|    do {                                            \
  |  |  |  |   97|  9.31k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  9.31k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  9.31k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  9.31k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 9.31k]
  |  |  |  |  ------------------
  |  |  |  |   99|  9.31k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  9.31k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 9.31k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  9.31k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  9.31k|        (idxvar)++;                                 \
  |  |  109|  9.31k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 9.31k]
  |  |  ------------------
  ------------------
  276|       |
  277|  9.31k|    talloc_free(ffmpeg_demuxers);
  ------------------
  |  |   47|  9.31k|#define talloc_free                     ta_free
  ------------------
  278|  9.31k|    talloc_free(ffmpeg_protos);
  ------------------
  |  |   47|  9.31k|#define talloc_free                     ta_free
  ------------------
  279|       |
  280|  9.31k|    return protocols;
  281|  9.31k|}
stream_lavf.c:get_unsafe_protocols:
  284|  4.59k|{
  285|  4.59k|    int num = 0;
  286|  4.59k|    char **protocols = NULL;
  287|  4.59k|    char **safe_protocols = get_safe_protocols();
  288|  4.59k|    char **ffmpeg_protos = mp_get_lavf_protocols();
  289|       |
  290|  55.1k|    for (int i = 0; ffmpeg_protos[i]; i++) {
  ------------------
  |  Branch (290:21): [True: 50.5k, False: 4.59k]
  ------------------
  291|  50.5k|        bool safe_protocol = false;
  292|  96.4k|        for (int j = 0; safe_protocols[j]; j++) {
  ------------------
  |  Branch (292:25): [True: 50.5k, False: 45.9k]
  ------------------
  293|  50.5k|            if (strcmp(ffmpeg_protos[i], safe_protocols[j]) == 0) {
  ------------------
  |  Branch (293:17): [True: 4.59k, False: 45.9k]
  ------------------
  294|  4.59k|                safe_protocol = true;
  295|  4.59k|                break;
  296|  4.59k|            }
  297|  50.5k|        }
  298|       |        // Skip to avoid name conflict with builtin mpv protocol.
  299|  50.5k|        if (strcmp(ffmpeg_protos[i], "bluray") == 0 || strcmp(ffmpeg_protos[i], "dvd") == 0)
  ------------------
  |  Branch (299:13): [True: 0, False: 50.5k]
  |  Branch (299:56): [True: 0, False: 50.5k]
  ------------------
  300|      0|            continue;
  301|       |
  302|  50.5k|        if (!safe_protocol)
  ------------------
  |  Branch (302:13): [True: 45.9k, False: 4.59k]
  ------------------
  303|  45.9k|            MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, ffmpeg_protos[i]));
  ------------------
  |  |  105|  45.9k|    do {                                            \
  |  |  106|  45.9k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  45.9k|    do {                                            \
  |  |  |  |   97|  45.9k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  45.9k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  45.9k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  45.9k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 13.7k, False: 32.1k]
  |  |  |  |  ------------------
  |  |  |  |   99|  45.9k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  13.7k|    do {                                                        \
  |  |  |  |  |  |   89|  13.7k|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|  13.7k|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  13.7k|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|  13.7k|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  13.7k|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|  13.7k|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|  13.7k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 13.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  45.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 45.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  45.9k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  45.9k|        (idxvar)++;                                 \
  |  |  109|  45.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 45.9k]
  |  |  ------------------
  ------------------
  304|  50.5k|    }
  305|       |
  306|  4.59k|    MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, "ffmpeg"));
  ------------------
  |  |  105|  4.59k|    do {                                            \
  |  |  106|  4.59k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  4.59k|    do {                                            \
  |  |  |  |   97|  4.59k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  4.59k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  4.59k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  4.59k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 4.59k]
  |  |  |  |  ------------------
  |  |  |  |   99|  4.59k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  4.59k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 4.59k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  4.59k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  4.59k|        (idxvar)++;                                 \
  |  |  109|  4.59k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 4.59k]
  |  |  ------------------
  ------------------
  307|  4.59k|    MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, "lavf"));
  ------------------
  |  |  105|  4.59k|    do {                                            \
  |  |  106|  4.59k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  4.59k|    do {                                            \
  |  |  |  |   97|  4.59k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  4.59k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  4.59k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  4.59k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 4.59k]
  |  |  |  |  ------------------
  |  |  |  |   99|  4.59k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  4.59k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 4.59k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  4.59k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  4.59k|        (idxvar)++;                                 \
  |  |  109|  4.59k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 4.59k]
  |  |  ------------------
  ------------------
  308|       |
  309|  4.59k|    MP_TARRAY_APPEND(NULL, protocols, num, NULL);
  ------------------
  |  |  105|  4.59k|    do {                                            \
  |  |  106|  4.59k|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|  4.59k|    do {                                            \
  |  |  |  |   97|  4.59k|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|  4.59k|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|  4.59k|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|  4.59k|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 0, False: 4.59k]
  |  |  |  |  ------------------
  |  |  |  |   99|  4.59k|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|    do {                                                        \
  |  |  |  |  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|  4.59k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 4.59k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|  4.59k|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|  4.59k|        (idxvar)++;                                 \
  |  |  109|  4.59k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 4.59k]
  |  |  ------------------
  ------------------
  310|       |
  311|  4.59k|    talloc_free(ffmpeg_protos);
  ------------------
  |  |   47|  4.59k|#define talloc_free                     ta_free
  ------------------
  312|  4.59k|    talloc_free(safe_protocols);
  ------------------
  |  |   47|  4.59k|#define talloc_free                     ta_free
  ------------------
  313|  4.59k|    return protocols;
  314|  4.59k|}

stream_memory.c:open2:
   22|    911|{
   23|       |    // Initial data
   24|    911|    bstr data = bstr0(stream->url);
   25|    911|    bool use_hex = bstr_eatstart0(&data, "hex://");
   26|    911|    if (!use_hex)
  ------------------
  |  Branch (26:9): [True: 21, False: 890]
  ------------------
   27|     21|        bstr_eatstart0(&data, "memory://");
   28|       |
   29|    911|    if (args->special_arg)
  ------------------
  |  Branch (29:9): [True: 0, False: 911]
  ------------------
   30|      0|        data = *(bstr *)args->special_arg;
   31|       |
   32|    911|    data = bstrdup(stream, data);
   33|       |
   34|    911|    if (use_hex && !bstr_decode_hex(stream, data, &data)) {
  ------------------
  |  Branch (34:9): [True: 890, False: 21]
  |  Branch (34:20): [True: 29, False: 861]
  ------------------
   35|     29|        MP_FATAL(stream, "Invalid data.\n");
  ------------------
  |  |   88|     29|#define MP_FATAL(obj, ...)      MP_MSG(obj, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  |   86|     29|#define MP_MSG(obj, lev, ...)   mp_msg((obj)->log, lev, __VA_ARGS__)
  |  |  ------------------
  ------------------
   36|     29|        return STREAM_ERROR;
  ------------------
  |  |   67|     29|#define STREAM_ERROR 0
  ------------------
   37|     29|    }
   38|       |
   39|    882|    return stream_bstr_open2(stream, args, data);
   40|    911|}

stream_mf.c:mf_stream_open:
   30|      1|{
   31|      1|    stream->demuxer = "mf";
   32|       |
   33|      1|    return STREAM_OK;
  ------------------
  |  |   68|      1|#define STREAM_OK    1
  ------------------
   34|      1|}

stream_mpv.c:open_mpv:
   24|      1|{
   25|      1|    st->demuxer = "mpv";
   26|      1|    return STREAM_OK;
  ------------------
  |  |   68|      1|#define STREAM_OK    1
  ------------------
   27|      1|}

stream_null.c:open_s:
   26|      1|{
   27|      1|    return 1;
   28|      1|}

osd_create:
  159|  16.4k|{
  160|  16.4k|    static_assert(MAX_OSD_PARTS >= OSDTYPE_COUNT, "");
  161|       |
  162|  16.4k|    struct osd_state *osd = talloc_zero(NULL, struct osd_state);
  ------------------
  |  |   27|  16.4k|#define talloc_zero                     ta_xznew
  |  |  ------------------
  |  |  |  |  134|  16.4k|#define ta_xznew(...)                   ta_oom_g(ta_znew(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  16.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  163|  16.4k|    *osd = (struct osd_state) {
  164|  16.4k|        .opts_cache = m_config_cache_alloc(osd, global, &mp_osd_render_sub_opts),
  165|  16.4k|        .global = global,
  166|  16.4k|        .log = mp_log_new(osd, global->log, "osd"),
  167|  16.4k|        .force_video_pts = MP_NOPTS_VALUE,
  ------------------
  |  |   39|  16.4k|#define MP_NOPTS_VALUE (-0x1p+63)
  ------------------
  168|  16.4k|        .stats = stats_ctx_create(osd, global, "osd"),
  169|  16.4k|    };
  170|  16.4k|    mp_mutex_init(&osd->lock);
  171|  16.4k|    osd->opts = osd->opts_cache->opts;
  172|       |
  173|   114k|    for (int n = 0; n < MAX_OSD_PARTS; n++) {
  ------------------
  |  |  127|   114k|#define MAX_OSD_PARTS 6
  ------------------
  |  Branch (173:21): [True: 98.4k, False: 16.4k]
  ------------------
  174|  98.4k|        struct osd_object *obj = talloc(osd, struct osd_object);
  ------------------
  |  |   26|  98.4k|#define talloc                          ta_xnew
  |  |  ------------------
  |  |  |  |  133|  98.4k|#define ta_xnew(...)                    ta_oom_g(ta_new(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|  98.4k|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  175|  98.4k|        *obj = (struct osd_object) {
  176|  98.4k|            .type = n,
  177|  98.4k|            .text = talloc_strdup(obj, ""),
  ------------------
  |  |   50|  98.4k|#define talloc_strdup                   ta_xstrdup
  ------------------
  178|  98.4k|            .progbar_state = {.type = -1},
  179|  98.4k|            .vo_change_id = 1,
  180|  98.4k|        };
  181|  98.4k|        osd->objs[n] = obj;
  182|  98.4k|    }
  183|       |
  184|  16.4k|    osd->objs[OSDTYPE_SUB]->is_sub = true;
  185|  16.4k|    osd->objs[OSDTYPE_SUB2]->is_sub = true;
  186|       |
  187|  16.4k|    return osd;
  188|  16.4k|}
osd_free:
  191|  16.4k|{
  192|  16.4k|    if (!osd)
  ------------------
  |  Branch (192:9): [True: 0, False: 16.4k]
  ------------------
  193|      0|        return;
  194|  16.4k|    osd_destroy_backend(osd);
  195|  16.4k|    talloc_free(osd->objs[OSDTYPE_EXTERNAL2]->image_overlay);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  196|  16.4k|    talloc_free(osd->objs[OSDTYPE_DISC_MENU]->image_overlay);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  197|  16.4k|    mp_mutex_destroy(&osd->lock);
  ------------------
  |  |  133|  16.4k|#define mp_mutex_destroy    pthread_mutex_destroy
  ------------------
  198|  16.4k|    talloc_free(osd);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  199|  16.4k|}
osd_set_text:
  202|  16.3k|{
  203|  16.3k|    mp_mutex_lock(&osd->lock);
  ------------------
  |  |  134|  16.3k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  204|  16.3k|    struct osd_object *osd_obj = osd->objs[OSDTYPE_OSD];
  205|  16.3k|    if (!text)
  ------------------
  |  Branch (205:9): [True: 13.8k, False: 2.58k]
  ------------------
  206|  13.8k|        text = "";
  207|  16.3k|    if (strcmp(osd_obj->text, text) != 0) {
  ------------------
  |  Branch (207:9): [True: 2.43k, False: 13.9k]
  ------------------
  208|  2.43k|        talloc_free(osd_obj->text);
  ------------------
  |  |   47|  2.43k|#define talloc_free                     ta_free
  ------------------
  209|  2.43k|        osd_obj->text = talloc_strdup(osd_obj, text);
  ------------------
  |  |   50|  2.43k|#define talloc_strdup                   ta_xstrdup
  ------------------
  210|  2.43k|        osd_obj->osd_changed = true;
  211|  2.43k|        osd->want_redraw_notification = true;
  212|  2.43k|    }
  213|  16.3k|    mp_mutex_unlock(&osd->lock);
  ------------------
  |  |  136|  16.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  214|  16.3k|}
osd_set_bitmaps:
  279|  16.4k|{
  280|  16.4k|    mp_mutex_lock(&osd->lock);
  ------------------
  |  |  134|  16.4k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  281|  16.4k|    struct osd_object *obj = osd->objs[type];
  282|  16.4k|    talloc_free(obj->image_overlay);
  ------------------
  |  |   47|  16.4k|#define talloc_free                     ta_free
  ------------------
  283|  16.4k|    obj->image_overlay = sub_bitmaps_copy(NULL, imgs);
  284|  16.4k|    obj->vo_change_id += 1;
  285|  16.4k|    osd->want_redraw_notification = true;
  286|  16.4k|    mp_mutex_unlock(&osd->lock);
  ------------------
  |  |  136|  16.4k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  287|  16.4k|}
osd_changed:
  508|  11.3k|{
  509|  11.3k|    mp_mutex_lock(&osd->lock);
  ------------------
  |  |  134|  11.3k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  510|  11.3k|    osd->objs[OSDTYPE_OSD]->osd_changed = true;
  511|  11.3k|    osd->want_redraw_notification = true;
  512|       |    // Done here for a lack of a better place.
  513|  11.3k|    m_config_cache_update(osd->opts_cache);
  514|  11.3k|    mp_mutex_unlock(&osd->lock);
  ------------------
  |  |  136|  11.3k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  515|  11.3k|}
osd_get_vo_res:
  527|    469|{
  528|    469|    mp_mutex_lock(&osd->lock);
  ------------------
  |  |  134|    469|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  529|       |    // Any OSDTYPE is fine; but it mustn't be a subtitle one (can have lower res.)
  530|    469|    struct mp_osd_res res = osd->objs[OSDTYPE_OSD]->vo_res;
  531|    469|    mp_mutex_unlock(&osd->lock);
  ------------------
  |  |  136|    469|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  532|    469|    return res;
  533|    469|}
sub_bitmaps_copy:
  585|  16.4k|{
  586|  16.4k|    if (!in || !in->num_parts)
  ------------------
  |  Branch (586:9): [True: 16.4k, False: 0]
  |  Branch (586:16): [True: 0, False: 0]
  ------------------
  587|  16.4k|        return NULL;
  588|       |
  589|      0|    struct sub_bitmaps *res = talloc(NULL, struct sub_bitmaps);
  ------------------
  |  |   26|      0|#define talloc                          ta_xnew
  |  |  ------------------
  |  |  |  |  133|      0|#define ta_xnew(...)                    ta_oom_g(ta_new(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      0|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  590|      0|    *res = *in;
  591|       |
  592|       |    // Note: the p_cache thing is a lie and unused.
  593|       |
  594|       |    // The bitmaps being refcounted is essential for performance, and for
  595|       |    // not invalidating in->parts[*].bitmap pointers.
  596|      0|    mp_assert(in->packed && in->packed->bufs[0]);
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (596:5): [True: 0, False: 0]
  |  Branch (596:5): [True: 0, False: 0]
  ------------------
  597|       |
  598|      0|    res->packed = mp_image_new_ref(res->packed);
  599|      0|    talloc_steal(res, res->packed);
  ------------------
  |  |   38|      0|#define talloc_steal                    ta_steal
  |  |  ------------------
  |  |  |  |  100|      0|#define ta_steal(ta_parent, ptr) (TA_TYPEOF(ptr))ta_steal_(ta_parent, ptr)
  |  |  ------------------
  ------------------
  600|       |
  601|      0|    res->parts = NULL;
  602|      0|    MP_RESIZE_ARRAY(res, res->parts, res->num_parts);
  ------------------
  |  |   88|      0|    do {                                                        \
  |  |   89|      0|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  ------------------
  |  |  |  |  158|      0|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   38|      0|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   37|      0|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   90|      0|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |   91|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (91:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  603|      0|    memcpy(res->parts, in->parts, sizeof(res->parts[0]) * res->num_parts);
  604|       |
  605|      0|    return res;
  606|      0|}

osd_destroy_backend:
   86|  16.4k|{
   87|   114k|    for (int n = 0; n < MAX_OSD_PARTS; n++) {
  ------------------
  |  |  127|   114k|#define MAX_OSD_PARTS 6
  ------------------
  |  Branch (87:21): [True: 98.4k, False: 16.4k]
  ------------------
   88|  98.4k|        struct osd_object *obj = osd->objs[n];
   89|  98.4k|        destroy_ass_renderer(&obj->ass);
   90|  98.4k|        for (int i = 0; i < obj->num_externals; i++)
  ------------------
  |  Branch (90:25): [True: 0, False: 98.4k]
  ------------------
   91|      0|            destroy_external(obj->externals[i]);
   92|  98.4k|        obj->num_externals = 0;
   93|  98.4k|    }
   94|  16.4k|}
osd_get_function_sym:
  197|     73|{
  198|     73|    snprintf(buffer, buffer_size, OSD_CODEPOINTS_ESCAPE "%c", osd_function);
  ------------------
  |  |  132|     73|#define OSD_CODEPOINTS_ESCAPE "\xC2\x91"
  ------------------
  199|     73|}
osd_set_external_remove_owner:
  648|  31.5k|{
  649|  31.5k|    mp_mutex_lock(&osd->lock);
  ------------------
  |  |  134|  31.5k|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  650|  31.5k|    struct osd_object *obj = osd->objs[OSDTYPE_EXTERNAL];
  651|  31.5k|    for (int n = obj->num_externals - 1; n >= 0; n--) {
  ------------------
  |  Branch (651:42): [True: 0, False: 31.5k]
  ------------------
  652|      0|        struct osd_external *e = obj->externals[n];
  653|      0|        if (e->ov.owner == owner) {
  ------------------
  |  Branch (653:13): [True: 0, False: 0]
  ------------------
  654|      0|            destroy_external(e);
  655|      0|            MP_TARRAY_REMOVE_AT(obj->externals, obj->num_externals, n);
  ------------------
  |  |  143|      0|    do {                                            \
  |  |  144|      0|        size_t at_ = (at);                          \
  |  |  145|      0|        assert(at_ < (idxvar));                     \
  |  |  146|      0|        memmove((p) + at_, (p) + at_ + 1,           \
  |  |  147|      0|                ((idxvar) - at_ - 1) * sizeof((p)[0])); \
  |  |  148|      0|        (idxvar)--;                                 \
  |  |  149|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (149:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (655:13): [True: 0, False: 0]
  ------------------
  656|      0|            obj->changed = true;
  657|      0|            osd->want_redraw_notification = true;
  658|      0|        }
  659|      0|    }
  660|  31.5k|    mp_mutex_unlock(&osd->lock);
  ------------------
  |  |  136|  31.5k|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  661|  31.5k|}
osd_libass.c:destroy_ass_renderer:
   65|  98.4k|{
   66|  98.4k|    if (ass->track)
  ------------------
  |  Branch (66:9): [True: 0, False: 98.4k]
  ------------------
   67|      0|        ass_free_track(ass->track);
   68|  98.4k|    ass->track = NULL;
   69|  98.4k|    if (ass->render)
  ------------------
  |  Branch (69:9): [True: 0, False: 98.4k]
  ------------------
   70|      0|        ass_renderer_done(ass->render);
   71|  98.4k|    ass->render = NULL;
   72|  98.4k|    if (ass->library)
  ------------------
  |  Branch (72:9): [True: 0, False: 98.4k]
  ------------------
   73|      0|        ass_library_done(ass->library);
   74|  98.4k|    ass->library = NULL;
   75|  98.4k|    talloc_free(ass->log);
  ------------------
  |  |   47|  98.4k|#define talloc_free                     ta_free
  ------------------
   76|       |    ass->log = NULL;
   77|  98.4k|}

ta_set_parent:
   88|   169M|{
   89|   169M|    struct ta_header *ch = get_header(ptr);
   90|   169M|    if (!ch)
  ------------------
  |  Branch (90:9): [True: 27.8k, False: 169M]
  ------------------
   91|  27.8k|        return;
   92|   169M|    struct ta_header *new_parent = get_header(ta_parent);
   93|       |    // Unlink from previous parent
   94|   169M|    if (ch->prev)
  ------------------
  |  Branch (94:9): [True: 73.4k, False: 169M]
  ------------------
   95|  73.4k|        ch->prev->next = ch->next;
   96|   169M|    if (ch->next)
  ------------------
  |  Branch (96:9): [True: 26.5M, False: 143M]
  ------------------
   97|  26.5M|        ch->next->prev = ch->prev;
   98|       |    // If ch was the first child, change child link of old parent
   99|   169M|    if (ch->parent) {
  ------------------
  |  Branch (99:9): [True: 37.6M, False: 132M]
  ------------------
  100|  37.6M|        assert(ch->parent->child == ch);
  ------------------
  |  Branch (100:9): [True: 37.6M, False: 18.4E]
  ------------------
  101|  37.6M|        ch->parent->child = ch->next;
  102|  37.6M|        if (ch->parent->child) {
  ------------------
  |  Branch (102:13): [True: 26.5M, False: 11.1M]
  ------------------
  103|  26.5M|            assert(!ch->parent->child->parent);
  ------------------
  |  Branch (103:13): [True: 26.5M, False: 18.4E]
  ------------------
  104|  26.5M|            ch->parent->child->parent = ch->parent;
  105|  26.5M|        }
  106|  37.6M|    }
  107|   169M|    ch->next = ch->prev = ch->parent = NULL;
  108|       |    // Link to new parent - insert at start of list (LIFO destructor order)
  109|   169M|    if (new_parent) {
  ------------------
  |  Branch (109:9): [True: 37.6M, False: 132M]
  ------------------
  110|  37.6M|        ch->next = new_parent->child;
  111|  37.6M|        if (ch->next) {
  ------------------
  |  Branch (111:13): [True: 26.5M, False: 11.1M]
  ------------------
  112|  26.5M|            ch->next->prev = ch;
  113|       |            ch->next->parent = NULL;
  114|  26.5M|        }
  115|  37.6M|        new_parent->child = ch;
  116|  37.6M|        ch->parent = new_parent;
  117|  37.6M|    }
  118|   169M|}
ta_alloc_size:
  136|  53.0M|{
  137|  53.0M|    if (size >= MAX_ALLOC)
  ------------------
  |  |   66|  53.0M|#define MAX_ALLOC (((size_t)-1) - sizeof(union aligned_header))
  ------------------
  |  Branch (137:9): [True: 0, False: 53.0M]
  ------------------
  138|      0|        return NULL;
  139|  53.0M|    struct ta_header *h = malloc(sizeof(union aligned_header) + size);
  140|  53.0M|    if (!h)
  ------------------
  |  Branch (140:9): [True: 0, False: 53.0M]
  ------------------
  141|      0|        return NULL;
  142|  53.0M|    *h = (struct ta_header) {.size = size};
  143|  53.0M|    ta_dbg_add(h);
  144|  53.0M|    void *ptr = PTR_FROM_HEADER(h);
  ------------------
  |  |   64|  53.0M|#define PTR_FROM_HEADER(h) ((void *)((union aligned_header *)(h) + 1))
  ------------------
  145|  53.0M|    ta_set_parent(ptr, ta_parent);
  146|  53.0M|    return ptr;
  147|  53.0M|}
ta_zalloc_size:
  153|  11.7M|{
  154|  11.7M|    if (size >= MAX_ALLOC)
  ------------------
  |  |   66|  11.7M|#define MAX_ALLOC (((size_t)-1) - sizeof(union aligned_header))
  ------------------
  |  Branch (154:9): [True: 0, False: 11.7M]
  ------------------
  155|      0|        return NULL;
  156|  11.7M|    struct ta_header *h = calloc(1, sizeof(union aligned_header) + size);
  157|  11.7M|    if (!h)
  ------------------
  |  Branch (157:9): [True: 0, False: 11.7M]
  ------------------
  158|      0|        return NULL;
  159|  11.7M|    *h = (struct ta_header) {.size = size};
  160|  11.7M|    ta_dbg_add(h);
  161|  11.7M|    void *ptr = PTR_FROM_HEADER(h);
  ------------------
  |  |   64|  11.7M|#define PTR_FROM_HEADER(h) ((void *)((union aligned_header *)(h) + 1))
  ------------------
  162|  11.7M|    ta_set_parent(ptr, ta_parent);
  163|  11.7M|    return ptr;
  164|  11.7M|}
ta_realloc_size:
  179|  43.9M|{
  180|  43.9M|    if (size >= MAX_ALLOC)
  ------------------
  |  |   66|  43.9M|#define MAX_ALLOC (((size_t)-1) - sizeof(union aligned_header))
  ------------------
  |  Branch (180:9): [True: 0, False: 43.9M]
  ------------------
  181|      0|        return NULL;
  182|  43.9M|    if (!size) {
  ------------------
  |  Branch (182:9): [True: 0, False: 43.9M]
  ------------------
  183|      0|        ta_free(ptr);
  184|      0|        return NULL;
  185|      0|    }
  186|  43.9M|    if (!ptr)
  ------------------
  |  Branch (186:9): [True: 41.2M, False: 2.71M]
  ------------------
  187|  41.2M|        return ta_alloc_size(ta_parent, size);
  188|  2.71M|    struct ta_header *h = get_header(ptr);
  189|  2.71M|    struct ta_header *old_h = h;
  190|  2.71M|    if (h->size == size)
  ------------------
  |  Branch (190:9): [True: 884, False: 2.71M]
  ------------------
  191|    884|        return ptr;
  192|  2.71M|    ta_dbg_remove(h);
  193|  2.71M|    h = realloc(h, sizeof(union aligned_header) + size);
  194|  18.4E|    ta_dbg_add(h ? h : old_h);
  ------------------
  |  Branch (194:16): [True: 2.71M, False: 18.4E]
  ------------------
  195|  2.71M|    if (!h)
  ------------------
  |  Branch (195:9): [True: 0, False: 2.71M]
  ------------------
  196|      0|        return NULL;
  197|  2.71M|    h->size = size;
  198|  2.71M|    if (h != old_h) {
  ------------------
  |  Branch (198:9): [True: 1.58M, False: 1.13M]
  ------------------
  199|       |        // Relink parent
  200|  1.58M|        if (h->parent)
  ------------------
  |  Branch (200:13): [True: 136k, False: 1.44M]
  ------------------
  201|   136k|            h->parent->child = h;
  202|       |        // Relink siblings
  203|  1.58M|        if (h->next)
  ------------------
  |  Branch (203:13): [True: 955k, False: 627k]
  ------------------
  204|   955k|            h->next->prev = h;
  205|  1.58M|        if (h->prev)
  ------------------
  |  Branch (205:13): [True: 1.15M, False: 422k]
  ------------------
  206|  1.15M|            h->prev->next = h;
  207|       |        // Relink children
  208|  1.58M|        if (h->child)
  ------------------
  |  Branch (208:13): [True: 74.0k, False: 1.50M]
  ------------------
  209|  74.0k|            h->child->parent = h;
  210|  1.58M|    }
  211|  2.71M|    return PTR_FROM_HEADER(h);
  ------------------
  |  |   64|  2.71M|#define PTR_FROM_HEADER(h) ((void *)((union aligned_header *)(h) + 1))
  ------------------
  212|  2.71M|}
ta_get_size:
  219|   112M|{
  220|   112M|    struct ta_header *h = get_header(ptr);
  221|   112M|    return h ? h->size : 0;
  ------------------
  |  Branch (221:12): [True: 31.0M, False: 81.2M]
  ------------------
  222|   112M|}
ta_free_children:
  228|  66.3M|{
  229|  66.3M|    struct ta_header *h = get_header(ptr);
  230|   103M|    while (h && h->child)
  ------------------
  |  Branch (230:12): [True: 103M, False: 36]
  |  Branch (230:17): [True: 37.4M, False: 66.3M]
  ------------------
  231|  37.4M|        ta_free(PTR_FROM_HEADER(h->child));
  ------------------
  |  |   64|  37.4M|#define PTR_FROM_HEADER(h) ((void *)((union aligned_header *)(h) + 1))
  ------------------
  232|  66.3M|}
ta_free:
  237|  68.4M|{
  238|  68.4M|    struct ta_header *h = get_header(ptr);
  239|  68.4M|    if (!h)
  ------------------
  |  Branch (239:9): [True: 3.70M, False: 64.7M]
  ------------------
  240|  3.70M|        return;
  241|  64.7M|    if (h->destructor)
  ------------------
  |  Branch (241:9): [True: 9.03M, False: 55.6M]
  ------------------
  242|  9.03M|        h->destructor(ptr);
  243|  64.7M|    ta_free_children(ptr);
  244|       |    ta_set_parent(ptr, NULL);
  245|  64.7M|    ta_dbg_remove(h);
  246|  64.7M|    free(h);
  247|  64.7M|}
ta_set_destructor:
  260|  9.03M|{
  261|  9.03M|    struct ta_header *h = get_header(ptr);
  262|  9.03M|    if (h)
  ------------------
  |  Branch (262:9): [True: 9.03M, False: 0]
  ------------------
  263|  9.03M|        h->destructor = destructor;
  264|  9.03M|}
ta_dbg_set_loc:
  379|  67.1M|{
  380|  67.1M|    struct ta_header *h = get_header(ptr);
  381|  67.1M|    if (h)
  ------------------
  |  Branch (381:9): [True: 67.0M, False: 112k]
  ------------------
  382|  67.0M|        h->name = loc;
  383|  67.1M|    return ptr;
  384|  67.1M|}
ta_dbg_mark_as_string:
  389|  41.1M|{
  390|       |    // Specially handled by leak report code.
  391|  41.1M|    return ta_dbg_set_loc(ptr, &allocation_is_string);
  392|  41.1M|}
ta.c:get_header:
   73|   666M|{
   74|   666M|    struct ta_header *h = ptr ? PTR_TO_HEADER(ptr) : NULL;
  ------------------
  |  |   63|   448M|#define PTR_TO_HEADER(ptr) (&((union aligned_header *)(ptr) - 1)->ta)
  ------------------
  |  Branch (74:27): [True: 448M, False: 217M]
  ------------------
   75|   666M|    ta_dbg_check_header(h);
   76|   666M|    return h;
   77|   666M|}
ta.c:ta_dbg_check_header:
  289|   733M|{
  290|   733M|    if (h) {
  ------------------
  |  Branch (290:9): [True: 516M, False: 217M]
  ------------------
  291|   516M|        assert(h->canary == CANARY);
  ------------------
  |  Branch (291:9): [True: 516M, False: 18.4E]
  ------------------
  292|   516M|        if (h->parent) {
  ------------------
  |  Branch (292:13): [True: 149M, False: 366M]
  ------------------
  293|   149M|            assert(!h->prev);
  ------------------
  |  Branch (293:13): [True: 149M, False: 1]
  ------------------
  294|   149M|            assert(h->parent->child == h);
  ------------------
  |  Branch (294:13): [True: 149M, False: 18.4E]
  ------------------
  295|   149M|        }
  296|   516M|    }
  297|   733M|}
ta.c:ta_dbg_add:
  276|  67.4M|{
  277|  67.4M|    h->canary = CANARY;
  ------------------
  |  |   50|  67.4M|#define CANARY 0xD3ADB3EF
  ------------------
  278|  67.4M|    if (enable_leak_check) {
  ------------------
  |  Branch (278:9): [True: 0, False: 67.4M]
  ------------------
  279|      0|        mp_mutex_lock(&ta_dbg_mutex);
  ------------------
  |  |  134|      0|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  280|      0|        h->leak_next = &leak_node;
  281|      0|        h->leak_prev = leak_node.leak_prev;
  282|      0|        leak_node.leak_prev->leak_next = h;
  283|      0|        leak_node.leak_prev = h;
  284|      0|        mp_mutex_unlock(&ta_dbg_mutex);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  285|      0|    }
  286|  67.4M|}
ta.c:ta_dbg_remove:
  300|  67.4M|{
  301|  67.4M|    ta_dbg_check_header(h);
  302|  67.4M|    if (h->leak_next) { // assume checking for !=NULL invariant ok without lock
  ------------------
  |  Branch (302:9): [True: 0, False: 67.4M]
  ------------------
  303|      0|        mp_mutex_lock(&ta_dbg_mutex);
  ------------------
  |  |  134|      0|#define mp_mutex_lock       pthread_mutex_lock
  ------------------
  304|      0|        h->leak_next->leak_prev = h->leak_prev;
  305|      0|        h->leak_prev->leak_next = h->leak_next;
  306|      0|        mp_mutex_unlock(&ta_dbg_mutex);
  ------------------
  |  |  136|      0|#define mp_mutex_unlock     pthread_mutex_unlock
  ------------------
  307|       |        h->leak_next = h->leak_prev = NULL;
  308|      0|    }
  309|  67.4M|    h->canary = 0;
  310|  67.4M|}

ao.c:ta_oom_p:
  162|     54|{
  163|     54|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 54]
  ------------------
  164|      0|        abort();
  165|     54|    return p;
  166|     54|}
msg.c:ta_oom_p:
  162|  1.33M|{
  163|  1.33M|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 1.33M]
  ------------------
  164|      0|        abort();
  165|  1.33M|    return p;
  166|  1.33M|}
msg.c:ta_oom_s:
  175|   121k|{
  176|   121k|    if (!s)
  ------------------
  |  Branch (176:9): [True: 0, False: 121k]
  ------------------
  177|      0|        abort();
  178|   121k|    return s;
  179|   121k|}
playlist.c:ta_oom_p:
  162|  55.0k|{
  163|  55.0k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 55.0k]
  ------------------
  164|      0|        abort();
  165|  55.0k|    return p;
  166|  55.0k|}
stats.c:ta_oom_p:
  162|  60.6k|{
  163|  60.6k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 60.6k]
  ------------------
  164|      0|        abort();
  165|  60.6k|    return p;
  166|  60.6k|}
stats.c:ta_oom_s:
  175|  11.4k|{
  176|  11.4k|    if (!s)
  ------------------
  |  Branch (176:9): [True: 0, False: 11.4k]
  ------------------
  177|      0|        abort();
  178|  11.4k|    return s;
  179|  11.4k|}
packet_pool.c:ta_oom_p:
  162|  16.4k|{
  163|  16.4k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 16.4k]
  ------------------
  164|      0|        abort();
  165|  16.4k|    return p;
  166|  16.4k|}
f_decoder_wrapper.c:ta_oom_p:
  162|  1.53k|{
  163|  1.53k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 1.53k]
  ------------------
  164|      0|        abort();
  165|  1.53k|    return p;
  166|  1.53k|}
cmd.c:ta_oom_p:
  162|  77.1k|{
  163|  77.1k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 77.1k]
  ------------------
  164|      0|        abort();
  165|  77.1k|    return p;
  166|  77.1k|}
input.c:ta_oom_s:
  175|  59.3k|{
  176|  59.3k|    if (!s)
  ------------------
  |  Branch (176:9): [True: 0, False: 59.3k]
  ------------------
  177|      0|        abort();
  178|  59.3k|    return s;
  179|  59.3k|}
input.c:ta_oom_p:
  162|  79.9k|{
  163|  79.9k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 79.9k]
  ------------------
  164|      0|        abort();
  165|  79.9k|    return p;
  166|  79.9k|}
bstr.c:ta_oom_p:
  162|    893|{
  163|    893|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 893]
  ------------------
  164|      0|        abort();
  165|    893|    return p;
  166|    893|}
dispatch.c:ta_oom_p:
  162|  16.4k|{
  163|  16.4k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 16.4k]
  ------------------
  164|      0|        abort();
  165|  16.4k|    return p;
  166|  16.4k|}
node.c:ta_oom_p:
  162|  50.7k|{
  163|  50.7k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 50.7k]
  ------------------
  164|      0|        abort();
  165|  50.7k|    return p;
  166|  50.7k|}
path_utils.c:ta_oom_s:
  175|  64.3k|{
  176|  64.3k|    if (!s)
  ------------------
  |  Branch (176:9): [True: 0, False: 64.3k]
  ------------------
  177|      0|        abort();
  178|  64.3k|    return s;
  179|  64.3k|}
path_utils.c:ta_oom_p:
  162|  50.4k|{
  163|  50.4k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 50.4k]
  ------------------
  164|      0|        abort();
  165|  50.4k|    return p;
  166|  50.4k|}
thread_pool.c:ta_oom_p:
  162|  16.4k|{
  163|  16.4k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 16.4k]
  ------------------
  164|      0|        abort();
  165|  16.4k|    return p;
  166|  16.4k|}
thread_tools.c:ta_oom_p:
  162|  16.4k|{
  163|  16.4k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 16.4k]
  ------------------
  164|      0|        abort();
  165|  16.4k|    return p;
  166|  16.4k|}
m_config_core.c:ta_oom_p:
  162|  2.55M|{
  163|  2.55M|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 2.55M]
  ------------------
  164|      0|        abort();
  165|  2.55M|    return p;
  166|  2.55M|}
m_config_frontend.c:ta_oom_p:
  162|  17.0M|{
  163|  17.0M|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 17.0M]
  ------------------
  164|      0|        abort();
  165|  17.0M|    return p;
  166|  17.0M|}
m_option.c:ta_oom_s:
  175|  4.91k|{
  176|  4.91k|    if (!s)
  ------------------
  |  Branch (176:9): [True: 0, False: 4.91k]
  ------------------
  177|      0|        abort();
  178|  4.91k|    return s;
  179|  4.91k|}
m_option.c:ta_oom_p:
  162|  1.21M|{
  163|  1.21M|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 1.21M]
  ------------------
  164|      0|        abort();
  165|  1.21M|    return p;
  166|  1.21M|}
m_option.c:ta_oom_b:
  169|  8.79k|{
  170|  8.79k|    if (!b)
  ------------------
  |  Branch (170:9): [True: 0, False: 8.79k]
  ------------------
  171|      0|        abort();
  172|  8.79k|}
m_property.c:ta_oom_p:
  162|  64.6k|{
  163|  64.6k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 64.6k]
  ------------------
  164|      0|        abort();
  165|  64.6k|    return p;
  166|  64.6k|}
m_property.c:ta_oom_b:
  169|   286k|{
  170|   286k|    if (!b)
  ------------------
  |  Branch (170:9): [True: 0, False: 286k]
  ------------------
  171|      0|        abort();
  172|   286k|}
parse_commandline.c:ta_oom_p:
  162|  54.9k|{
  163|  54.9k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 54.9k]
  ------------------
  164|      0|        abort();
  165|  54.9k|    return p;
  166|  54.9k|}
parse_configfile.c:ta_oom_p:
  162|  16.4k|{
  163|  16.4k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 16.4k]
  ------------------
  164|      0|        abort();
  165|  16.4k|    return p;
  166|  16.4k|}
path.c:ta_oom_p:
  162|   143k|{
  163|   143k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 143k]
  ------------------
  164|      0|        abort();
  165|   143k|    return p;
  166|   143k|}
client.c:ta_oom_p:
  162|   111k|{
  163|   111k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 111k]
  ------------------
  164|      0|        abort();
  165|   111k|    return p;
  166|   111k|}
command.c:ta_oom_p:
  162|  65.0k|{
  163|  65.0k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 65.0k]
  ------------------
  164|      0|        abort();
  165|  65.0k|    return p;
  166|  65.0k|}
command.c:ta_oom_s:
  175|    386|{
  176|    386|    if (!s)
  ------------------
  |  Branch (176:9): [True: 0, False: 386]
  ------------------
  177|      0|        abort();
  178|    386|    return s;
  179|    386|}
configfiles.c:ta_oom_p:
  162|  36.1k|{
  163|  36.1k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 36.1k]
  ------------------
  164|      0|        abort();
  165|  36.1k|    return p;
  166|  36.1k|}
main.c:ta_oom_p:
  162|  49.2k|{
  163|  49.2k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 49.2k]
  ------------------
  164|      0|        abort();
  165|  49.2k|    return p;
  166|  49.2k|}
osd.c:ta_oom_p:
  162|   114k|{
  163|   114k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 114k]
  ------------------
  164|      0|        abort();
  165|   114k|    return p;
  166|   114k|}
screenshot.c:ta_oom_p:
  162|  16.4k|{
  163|  16.4k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 16.4k]
  ------------------
  164|      0|        abort();
  165|  16.4k|    return p;
  166|  16.4k|}
scripting.c:ta_oom_s:
  175|  9.79k|{
  176|  9.79k|    if (!s)
  ------------------
  |  Branch (176:9): [True: 0, False: 9.79k]
  ------------------
  177|      0|        abort();
  178|  9.79k|    return s;
  179|  9.79k|}
scripting.c:ta_oom_p:
  162|  21.2k|{
  163|  21.2k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 21.2k]
  ------------------
  164|      0|        abort();
  165|  21.2k|    return p;
  166|  21.2k|}
clipboard.c:ta_oom_p:
  162|  16.4k|{
  163|  16.4k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 16.4k]
  ------------------
  164|      0|        abort();
  165|  16.4k|    return p;
  166|  16.4k|}
clipboard-vo.c:ta_oom_p:
  162|  11.3k|{
  163|  11.3k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 11.3k]
  ------------------
  164|      0|        abort();
  165|  11.3k|    return p;
  166|  11.3k|}
cookies.c:ta_oom_p:
  162|      1|{
  163|      1|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 1]
  ------------------
  164|      0|        abort();
  165|      1|    return p;
  166|      1|}
stream.c:ta_oom_p:
  162|  5.42k|{
  163|  5.42k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 5.42k]
  ------------------
  164|      0|        abort();
  165|  5.42k|    return p;
  166|  5.42k|}
stream_aes_ctr.c:ta_oom_p:
  162|     19|{
  163|     19|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 19]
  ------------------
  164|      0|        abort();
  165|     19|    return p;
  166|     19|}
stream_cb.c:ta_oom_p:
  162|  2.10k|{
  163|  2.10k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 2.10k]
  ------------------
  164|      0|        abort();
  165|  2.10k|    return p;
  166|  2.10k|}
stream_file.c:ta_oom_p:
  162|    291|{
  163|    291|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 291]
  ------------------
  164|      0|        abort();
  165|    291|    return p;
  166|    291|}
stream_lavf.c:ta_oom_p:
  162|  4.08k|{
  163|  4.08k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 4.08k]
  ------------------
  164|      0|        abort();
  165|  4.08k|    return p;
  166|  4.08k|}
stream_lavf.c:ta_oom_s:
  175|     37|{
  176|     37|    if (!s)
  ------------------
  |  Branch (176:9): [True: 0, False: 37]
  ------------------
  177|      0|        abort();
  178|     37|    return s;
  179|     37|}
stream_bstr.c:ta_oom_p:
  162|    882|{
  163|    882|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 882]
  ------------------
  164|      0|        abort();
  165|    882|    return p;
  166|    882|}
img_format.c:ta_oom_p:
  162|      1|{
  163|      1|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 1]
  ------------------
  164|      0|        abort();
  165|      1|    return p;
  166|      1|}
ta_talloc.c:ta_oom_b:
  169|   653k|{
  170|   653k|    if (!b)
  ------------------
  |  Branch (170:9): [True: 0, False: 653k]
  ------------------
  171|      0|        abort();
  172|   653k|}
ta_utils.c:ta_oom_b:
  169|  47.8M|{
  170|  47.8M|    if (!b)
  ------------------
  |  Branch (170:9): [True: 0, False: 47.8M]
  ------------------
  171|      0|        abort();
  172|  47.8M|}
ipc-unix.c:ta_oom_p:
  162|  13.2k|{
  163|  13.2k|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 13.2k]
  ------------------
  164|      0|        abort();
  165|  13.2k|    return p;
  166|  13.2k|}
ipc-unix.c:ta_oom_s:
  175|  1.95k|{
  176|  1.95k|    if (!s)
  ------------------
  |  Branch (176:9): [True: 0, False: 1.95k]
  ------------------
  177|      0|        abort();
  178|  1.95k|    return s;
  179|  1.95k|}
als-linux.c:ta_oom_p:
  162|     12|{
  163|     12|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 12]
  ------------------
  164|      0|        abort();
  165|     12|    return p;
  166|     12|}
stream_dvb.c:ta_oom_p:
  162|      6|{
  163|      6|    if (!p)
  ------------------
  |  Branch (163:9): [True: 0, False: 6]
  ------------------
  164|      0|        abort();
  165|      6|    return p;
  166|      6|}

ta_talloc_strdup_append:
   24|  5.37k|{
   25|  5.37k|    ta_xstrdup_append(&s, a);
  ------------------
  |  |  123|  5.37k|#define ta_xstrdup_append(...)          ta_oom_b(ta_strdup_append(__VA_ARGS__))
  ------------------
   26|  5.37k|    return s;
   27|  5.37k|}
ta_talloc_strdup_append_buffer:
   30|   336k|{
   31|   336k|    ta_xstrdup_append_buffer(&s, a);
  ------------------
  |  |  124|   336k|#define ta_xstrdup_append_buffer(...)   ta_oom_b(ta_strdup_append_buffer(__VA_ARGS__))
  ------------------
   32|   336k|    return s;
   33|   336k|}
ta_talloc_strndup_append_buffer:
   42|   304k|{
   43|   304k|    ta_xstrndup_append_buffer(&s, a, n);
  ------------------
  |  |  126|   304k|#define ta_xstrndup_append_buffer(...)  ta_oom_b(ta_strndup_append_buffer(__VA_ARGS__))
  ------------------
   44|   304k|    return s;
   45|   304k|}
ta_talloc_vasprintf_append:
   48|  4.05k|{
   49|  4.05k|    ta_xvasprintf_append(&s, fmt, ap);
  ------------------
  |  |  130|  4.05k|#define ta_xvasprintf_append(...)       ta_oom_b(ta_vasprintf_append(__VA_ARGS__))
  ------------------
   50|  4.05k|    return s;
   51|  4.05k|}
ta_talloc_vasprintf_append_buffer:
   54|  3.35k|{
   55|  3.35k|    ta_xvasprintf_append_buffer(&s, fmt, ap);
  ------------------
  |  |  132|  3.35k|#define ta_xvasprintf_append_buffer(...) ta_oom_b(ta_vasprintf_append_buffer(__VA_ARGS__))
  ------------------
   56|  3.35k|    return s;
   57|  3.35k|}
ta_talloc_asprintf_append:
   60|  4.05k|{
   61|  4.05k|    char *res;
   62|  4.05k|    va_list ap;
   63|  4.05k|    va_start(ap, fmt);
   64|  4.05k|    res = talloc_vasprintf_append(s, fmt, ap);
  ------------------
  |  |   61|  4.05k|#define talloc_vasprintf_append         ta_talloc_vasprintf_append
  ------------------
   65|       |    va_end(ap);
   66|  4.05k|    return res;
   67|  4.05k|}
ta_talloc_asprintf_append_buffer:
   70|  3.35k|{
   71|  3.35k|    char *res;
   72|  3.35k|    va_list ap;
   73|  3.35k|    va_start(ap, fmt);
   74|  3.35k|    res = talloc_vasprintf_append_buffer(s, fmt, ap);
  ------------------
  |  |   62|  3.35k|#define talloc_vasprintf_append_buffer  ta_talloc_vasprintf_append_buffer
  ------------------
   75|       |    va_end(ap);
   76|  3.35k|    return res;
   77|  3.35k|}

ta_calc_array_size:
   30|  3.94M|{
   31|  3.94M|    if (count > (((size_t)-1) / element_size))
  ------------------
  |  Branch (31:9): [True: 0, False: 3.94M]
  ------------------
   32|      0|        return (size_t)-1;
   33|  3.94M|    return element_size * count;
   34|  3.94M|}
ta_calc_prealloc_elems:
   41|  1.44M|{
   42|  1.44M|    if (nextidx >= ((size_t)-1) / 2 - 1)
  ------------------
  |  Branch (42:9): [True: 0, False: 1.44M]
  ------------------
   43|      0|        return (size_t)-1;
   44|  1.44M|    return (nextidx + 1) * 2;
   45|  1.44M|}
ta_new_context:
   50|   355k|{
   51|   355k|    return ta_alloc_size(ta_parent, 0);
   52|   355k|}
ta_steal_:
   58|   320k|{
   59|   320k|    ta_set_parent(ptr, ta_parent);
   60|   320k|    return ptr;
   61|   320k|}
ta_memdup:
   66|   290k|{
   67|   290k|    if (!ptr) {
  ------------------
  |  Branch (67:9): [True: 112k, False: 178k]
  ------------------
   68|   112k|        assert(!size);
  ------------------
  |  Branch (68:9): [True: 112k, False: 0]
  ------------------
   69|   112k|        return NULL;
   70|   112k|    }
   71|   178k|    void *res = ta_alloc_size(ta_parent, size);
   72|   178k|    if (!res)
  ------------------
  |  Branch (72:9): [True: 0, False: 178k]
  ------------------
   73|      0|        return NULL;
   74|   178k|    memcpy(res, ptr, size);
   75|   178k|    return res;
   76|   178k|}
ta_strdup:
  113|  40.6M|{
  114|  40.6M|    return ta_strndup(ta_parent, str, str ? strlen(str) : 0);
  ------------------
  |  Branch (114:39): [True: 35.9M, False: 4.74M]
  ------------------
  115|  40.6M|}
ta_strndup:
  123|  44.6M|{
  124|  44.6M|    if (!str)
  ------------------
  |  Branch (124:9): [True: 4.80M, False: 39.8M]
  ------------------
  125|  4.80M|        return NULL;
  126|  39.8M|    char *new = NULL;
  127|  39.8M|    strndup_append_at(&new, 0, str, n);
  128|  39.8M|    ta_set_parent(new, ta_parent);
  129|  39.8M|    return new;
  130|  44.6M|}
ta_strdup_append:
  137|  14.1k|{
  138|  14.1k|    return strndup_append_at(str, *str ? strlen(*str) : 0, a, (size_t)-1);
  ------------------
  |  Branch (138:35): [True: 11.5k, False: 2.58k]
  ------------------
  139|  14.1k|}
ta_strdup_append_buffer:
  145|   336k|{
  146|   336k|    size_t size = ta_get_size(*str);
  147|   336k|    if (size > 0)
  ------------------
  |  Branch (147:9): [True: 336k, False: 0]
  ------------------
  148|   336k|        size -= 1;
  149|   336k|    return strndup_append_at(str, size, a, (size_t)-1);
  150|   336k|}
ta_strndup_append_buffer:
  164|   304k|{
  165|   304k|    size_t size = ta_get_size(*str);
  166|   304k|    if (size > 0)
  ------------------
  |  Branch (166:9): [True: 304k, False: 0]
  ------------------
  167|   304k|        size -= 1;
  168|   304k|    return strndup_append_at(str, size, a, n);
  169|   304k|}
ta_asprintf:
  204|   273k|{
  205|   273k|    char *res;
  206|   273k|    va_list ap;
  207|   273k|    va_start(ap, fmt);
  208|   273k|    res = ta_vasprintf(ta_parent, fmt, ap);
  209|       |    va_end(ap);
  210|   273k|    return res;
  211|   273k|}
ta_vasprintf:
  214|   273k|{
  215|   273k|    char *res = NULL;
  216|   273k|    ta_vasprintf_append_at(&res, 0, fmt, ap);
  217|   273k|    ta_set_parent(res, ta_parent);
  218|   273k|    if (!res) {
  ------------------
  |  Branch (218:9): [True: 0, False: 273k]
  ------------------
  219|      0|        ta_free(res);
  220|      0|        return NULL;
  221|      0|    }
  222|   273k|    return res;
  223|   273k|}
ta_asprintf_append:
  230|   286k|{
  231|   286k|    bool res;
  232|   286k|    va_list ap;
  233|   286k|    va_start(ap, fmt);
  234|   286k|    res = ta_vasprintf_append(str, fmt, ap);
  235|       |    va_end(ap);
  236|   286k|    return res;
  237|   286k|}
ta_vasprintf_append:
  240|   290k|{
  241|   290k|    return ta_vasprintf_append_at(str, *str ? strlen(*str) : 0, fmt, ap);
  ------------------
  |  Branch (241:40): [True: 218k, False: 71.9k]
  ------------------
  242|   290k|}
ta_vasprintf_append_buffer:
  262|  3.35k|{
  263|  3.35k|    size_t size = ta_get_size(*str);
  264|  3.35k|    if (size > 0)
  ------------------
  |  Branch (264:9): [True: 3.35k, False: 0]
  ------------------
  265|  3.35k|        size -= 1;
  266|  3.35k|    return ta_vasprintf_append_at(str, size, fmt, ap);
  267|  3.35k|}
ta_xmemdup:
  270|   289k|{
  271|   289k|    void *new = ta_memdup(ta_parent, ptr, size);
  272|   289k|    ta_oom_b(new || !ptr);
  ------------------
  |  Branch (272:14): [True: 177k, False: 112k]
  |  Branch (272:21): [True: 112k, False: 0]
  ------------------
  273|   289k|    return new;
  274|   289k|}
ta_xrealloc_size:
  277|  2.84M|{
  278|  2.84M|    ptr = ta_realloc_size(ta_parent, ptr, size);
  279|  2.84M|    ta_oom_b(ptr || !size);
  ------------------
  |  Branch (279:14): [True: 2.84M, False: 0]
  |  Branch (279:21): [True: 0, False: 0]
  ------------------
  280|  2.84M|    return ptr;
  281|  2.84M|}
ta_xstrdup:
  284|  40.6M|{
  285|  40.6M|    char *res = ta_strdup(ta_parent, str);
  286|  40.6M|    ta_oom_b(res || !str);
  ------------------
  |  Branch (286:14): [True: 35.9M, False: 4.74M]
  |  Branch (286:21): [True: 4.74M, False: 0]
  ------------------
  287|  40.6M|    return res;
  288|  40.6M|}
ta_xstrndup:
  291|  4.02M|{
  292|  4.02M|    char *res = ta_strndup(ta_parent, str, n);
  293|  4.02M|    ta_oom_b(res || !str);
  ------------------
  |  Branch (293:14): [True: 3.96M, False: 64.7k]
  |  Branch (293:21): [True: 64.7k, False: 0]
  ------------------
  294|  4.02M|    return res;
  295|  4.02M|}
ta_utils.c:strndup_append_at:
   82|  40.5M|{
   83|  40.5M|    assert(ta_get_size(*str) >= at);
  ------------------
  |  Branch (83:5): [True: 40.5M, False: 18.4E]
  ------------------
   84|       |
   85|  40.5M|    if (!*str && !append)
  ------------------
  |  Branch (85:9): [True: 39.8M, False: 652k]
  |  Branch (85:18): [True: 0, False: 39.8M]
  ------------------
   86|      0|        return true; // stays NULL, but not an OOM condition
   87|       |
   88|  18.4E|    size_t real_len = append ? strnlen(append, append_len) : 0;
  ------------------
  |  Branch (88:23): [True: 40.5M, False: 18.4E]
  ------------------
   89|  40.5M|    if (append_len > real_len)
  ------------------
  |  Branch (89:9): [True: 355k, False: 40.1M]
  ------------------
   90|   355k|        append_len = real_len;
   91|       |
   92|  40.5M|    if (ta_get_size(*str) < at + append_len + 1) {
  ------------------
  |  Branch (92:9): [True: 40.5M, False: 8.97k]
  ------------------
   93|  40.5M|        char *t = ta_realloc_size(NULL, *str, at + append_len + 1);
   94|  40.5M|        if (!t)
  ------------------
  |  Branch (94:13): [True: 0, False: 40.5M]
  ------------------
   95|      0|            return false;
   96|  40.5M|        *str = t;
   97|  40.5M|    }
   98|       |
   99|  40.5M|    if (append_len)
  ------------------
  |  Branch (99:9): [True: 40.1M, False: 415k]
  ------------------
  100|  40.1M|        memcpy(*str + at, append, append_len);
  101|       |
  102|  40.5M|    (*str)[at + append_len] = '\0';
  103|       |
  104|  40.5M|    ta_dbg_mark_as_string(*str);
  105|       |
  106|       |    return true;
  107|  40.5M|}
ta_utils.c:ta_vasprintf_append_at:
  174|   567k|{
  175|   567k|    assert(ta_get_size(*str) >= at);
  ------------------
  |  Branch (175:5): [True: 567k, False: 0]
  ------------------
  176|       |
  177|   567k|    int size;
  178|   567k|    va_list copy;
  179|   567k|    va_copy(copy, ap);
  180|   567k|    char c;
  181|   567k|    size = vsnprintf(&c, 1, fmt, copy);
  182|   567k|    va_end(copy);
  183|       |
  184|   567k|    if (size < 0)
  ------------------
  |  Branch (184:9): [True: 0, False: 567k]
  ------------------
  185|      0|        return false;
  186|       |
  187|   567k|    if (ta_get_size(*str) < at + size + 1) {
  ------------------
  |  Branch (187:9): [True: 567k, False: 1]
  ------------------
  188|   567k|        char *t = ta_realloc_size(NULL, *str, at + size + 1);
  189|   567k|        if (!t)
  ------------------
  |  Branch (189:13): [True: 0, False: 567k]
  ------------------
  190|      0|            return false;
  191|   567k|        *str = t;
  192|   567k|    }
  193|   567k|    vsnprintf(*str + at, size + 1, fmt, ap);
  194|       |
  195|   567k|    ta_dbg_mark_as_string(*str);
  196|       |
  197|       |    return true;
  198|   567k|}

mp_parse_raw_primaries:
  566|    139|{
  567|    139|    if (!str)
  ------------------
  |  Branch (567:9): [True: 0, False: 139]
  ------------------
  568|      0|        return M_OPT_INVALID;
  ------------------
  |  |  535|      0|#define M_OPT_INVALID           -3
  ------------------
  569|       |
  570|    139|    if (!*str)
  ------------------
  |  Branch (570:9): [True: 1, False: 138]
  ------------------
  571|      1|        return M_OPT_MISSING_PARAM;
  ------------------
  |  |  532|      1|#define M_OPT_MISSING_PARAM     -2
  ------------------
  572|       |
  573|       |    // Comma-separated CIE xy values: Rx,Ry,Gx,Gy,Bx,By,Wx,Wy
  574|    138|    struct pl_raw_primaries prim;
  575|    138|    if (sscanf(str, "%f,%f,%f,%f,%f,%f,%f,%f",
  ------------------
  |  Branch (575:9): [True: 0, False: 138]
  ------------------
  576|    138|            &prim.red.x, &prim.red.y, &prim.green.x, &prim.green.y,
  577|    138|            &prim.blue.x, &prim.blue.y, &prim.white.x, &prim.white.y) == 8)
  578|      0|    {
  579|      0|        if (!pl_primaries_valid(&prim))
  ------------------
  |  Branch (579:13): [True: 0, False: 0]
  ------------------
  580|      0|            return M_OPT_OUT_OF_RANGE;
  ------------------
  |  |  539|      0|#define M_OPT_OUT_OF_RANGE      -4
  ------------------
  581|      0|        *out = prim;
  582|      0|        return 1;
  583|      0|    }
  584|       |
  585|    138|    const m_option_t choice_opt = {
  586|    138|        .priv = (void *)pl_csp_prim_names,
  587|    138|    };
  588|       |
  589|    138|    int prim_choice;
  590|    138|    int ret = m_option_type_choice.parse(log, &choice_opt, bstr0("target-gamut"),
  591|    138|                                         bstr0(str), &prim_choice);
  592|    138|    if (ret >= 0) {
  ------------------
  |  Branch (592:9): [True: 135, False: 3]
  ------------------
  593|    135|        if (!prim_choice)
  ------------------
  |  Branch (593:13): [True: 69, False: 66]
  ------------------
  594|     69|            return 0;
  595|     66|        *out = *pl_raw_primaries_get(prim_choice);
  596|     66|    } else if (ret != M_OPT_MISSING_PARAM) {
  ------------------
  |  |  532|      3|#define M_OPT_MISSING_PARAM     -2
  ------------------
  |  Branch (596:16): [True: 3, False: 0]
  ------------------
  597|      3|        mp_info(log, "    Rx,Ry,Gx,Gy,Bx,By,Wx,Wy (custom CIE xy primaries)\n");
  ------------------
  |  |   78|      3|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  598|      3|    }
  599|       |
  600|     69|    return ret;
  601|    138|}

vd_lavc.c:hwdec_opt_help:
  657|      1|{
  658|      1|    struct hwdec_info *hwdecs = NULL;
  659|      1|    int num_hwdecs = 0;
  660|      1|    add_all_hwdec_methods(&hwdecs, &num_hwdecs);
  661|       |
  662|      1|    mp_info(log, "Valid values (with alternative full names):\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  663|       |
  664|     10|    for (int n = 0; n < num_hwdecs; n++) {
  ------------------
  |  Branch (664:21): [True: 9, False: 1]
  ------------------
  665|      9|        struct hwdec_info *hwdec = &hwdecs[n];
  666|       |
  667|      9|        mp_info(log, "  %s (%s)\n", hwdec->method_name, hwdec->name);
  ------------------
  |  |   78|      9|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  668|      9|    }
  669|       |
  670|      1|    talloc_free(hwdecs);
  ------------------
  |  |   47|      1|#define talloc_free                     ta_free
  ------------------
  671|       |
  672|      1|    mp_info(log, "  auto (yes '')\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  673|      1|    mp_info(log, "  no\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  674|      1|    mp_info(log, "  auto-safe\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  675|      1|    mp_info(log, "  auto-copy\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  676|      1|    mp_info(log, "  auto-unsafe\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  677|      1|    mp_info(log, "  auto-copy-safe\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  678|      1|    mp_info(log, "  auto-copy-unsafe\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  679|       |
  680|      1|    return M_OPT_EXIT;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
  681|      1|}
vd_lavc.c:add_all_hwdec_methods:
  346|      1|{
  347|      1|    const AVCodec *codec = NULL;
  348|      1|    void *iter = NULL;
  349|    502|    while (1) {
  ------------------
  |  Branch (349:12): [True: 502, Folded]
  ------------------
  350|    502|        codec = av_codec_iterate(&iter);
  351|    502|        if (!codec)
  ------------------
  |  Branch (351:13): [True: 1, False: 501]
  ------------------
  352|      1|            break;
  353|    501|        if (codec->type != AVMEDIA_TYPE_VIDEO || !av_codec_is_decoder(codec))
  ------------------
  |  Branch (353:13): [True: 245, False: 256]
  |  Branch (353:50): [True: 0, False: 256]
  ------------------
  354|    245|            continue;
  355|       |
  356|    256|        struct hwdec_info info_template = {
  357|    256|            .pix_fmt = AV_PIX_FMT_NONE,
  358|    256|            .codec = codec,
  359|    256|        };
  360|       |
  361|    256|        const char *wrapper = NULL;
  362|    256|        if (codec->capabilities & (AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_HYBRID))
  ------------------
  |  Branch (362:13): [True: 9, False: 247]
  ------------------
  363|      9|            wrapper = codec->wrapper_name;
  364|       |
  365|       |        // A decoder can provide multiple methods. In particular, hwaccels
  366|       |        // provide various methods (e.g. native h264 with vaapi & d3d11), but
  367|       |        // even wrapper decoders could provide multiple methods.
  368|    256|        bool found_any = false;
  369|    256|        for (int n = 0; ; n++) {
  370|    256|            const AVCodecHWConfig *cfg = avcodec_get_hw_config(codec, n);
  371|    256|            if (!cfg)
  ------------------
  |  Branch (371:17): [True: 256, False: 0]
  ------------------
  372|    256|                break;
  373|       |
  374|      0|            if ((cfg->methods & AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX) ||
  ------------------
  |  Branch (374:17): [True: 0, False: 0]
  ------------------
  375|      0|                (cfg->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX))
  ------------------
  |  Branch (375:17): [True: 0, False: 0]
  ------------------
  376|      0|            {
  377|      0|                struct hwdec_info info = info_template;
  378|      0|                info.lavc_device = cfg->device_type;
  379|      0|                info.pix_fmt = cfg->pix_fmt;
  380|       |
  381|      0|                const char *name = av_hwdevice_get_type_name(cfg->device_type);
  382|      0|                mp_assert(name); // API violation by libavcodec
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (382:17): [True: 0, False: 0]
  ------------------
  383|       |
  384|       |                // nvdec hwaccels and the cuvid full decoder clash with their
  385|       |                // naming, so fix it here; we also prefer nvdec for the hwaccel.
  386|      0|                if (strcmp(name, "cuda") == 0 && !wrapper)
  ------------------
  |  Branch (386:21): [True: 0, False: 0]
  |  Branch (386:50): [True: 0, False: 0]
  ------------------
  387|      0|                    name = "nvdec";
  388|       |
  389|      0|                snprintf(info.method_name, sizeof(info.method_name), "%s", name);
  390|       |
  391|       |                // Usually we want to prefer using hw_frames_ctx for true
  392|       |                // hwaccels only, but we actually don't have any way to detect
  393|       |                // those, so always use hw_frames_ctx if offered.
  394|      0|                if (cfg->methods & AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX) {
  ------------------
  |  Branch (394:21): [True: 0, False: 0]
  ------------------
  395|      0|                    info.use_hw_frames = true;
  396|      0|                } else {
  397|      0|                    info.use_hw_device = true;
  398|      0|                }
  399|       |
  400|       |                // Direct variant.
  401|      0|                add_hwdec_item(infos, num_infos, info);
  402|       |
  403|       |                // Copy variant.
  404|      0|                info.copying = true;
  405|      0|                if (cfg->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX) {
  ------------------
  |  Branch (405:21): [True: 0, False: 0]
  ------------------
  406|      0|                    info.use_hw_frames = false;
  407|      0|                    info.use_hw_device = true;
  408|      0|                }
  409|      0|                add_hwdec_item(infos, num_infos, info);
  410|       |
  411|      0|                found_any = true;
  412|      0|            } else if (cfg->methods & AV_CODEC_HW_CONFIG_METHOD_INTERNAL) {
  ------------------
  |  Branch (412:24): [True: 0, False: 0]
  ------------------
  413|      0|                struct hwdec_info info = info_template;
  414|      0|                info.pix_fmt = cfg->pix_fmt;
  415|       |
  416|      0|                const char *name = wrapper;
  417|      0|                if (!name)
  ------------------
  |  Branch (417:21): [True: 0, False: 0]
  ------------------
  418|      0|                    name = av_get_pix_fmt_name(info.pix_fmt);
  419|      0|                mp_assert(name); // API violation by libavcodec
  ------------------
  |  |   41|      0|#define mp_assert assert
  ------------------
  |  Branch (419:17): [True: 0, False: 0]
  ------------------
  420|       |
  421|      0|                snprintf(info.method_name, sizeof(info.method_name), "%s", name);
  422|       |
  423|       |                // Direct variant.
  424|      0|                add_hwdec_item(infos, num_infos, info);
  425|       |
  426|       |                // Copy variant.
  427|      0|                info.copying = true;
  428|      0|                info.pix_fmt = AV_PIX_FMT_NONE; // trust it can do sw output
  429|      0|                add_hwdec_item(infos, num_infos, info);
  430|       |
  431|      0|                found_any = true;
  432|      0|            }
  433|      0|        }
  434|       |
  435|    256|        if (!found_any && wrapper) {
  ------------------
  |  Branch (435:13): [True: 256, False: 0]
  |  Branch (435:27): [True: 9, False: 247]
  ------------------
  436|       |            // We _know_ there's something supported here, usually outputting
  437|       |            // sw surfaces. E.g. mediacodec (before hw_device_ctx support).
  438|       |
  439|      9|            struct hwdec_info info = info_template;
  440|      9|            info.copying = true; // probably
  441|       |
  442|      9|            snprintf(info.method_name, sizeof(info.method_name), "%s", wrapper);
  443|      9|            add_hwdec_item(infos, num_infos, info);
  444|      9|        }
  445|    256|    }
  446|       |
  447|      1|    qsort(*infos, *num_infos, sizeof(struct hwdec_info), hwdec_compare);
  448|      1|}
vd_lavc.c:add_hwdec_item:
  321|      9|{
  322|      9|    if (info.copying)
  ------------------
  |  Branch (322:9): [True: 9, False: 0]
  ------------------
  323|      9|        mp_snprintf_cat(info.method_name, sizeof(info.method_name), "-copy");
  324|       |
  325|       |    // (Including the codec name in case this is a wrapper looks pretty dumb,
  326|       |    // but better not have them clash with hwaccels and others.)
  327|      9|    snprintf(info.name, sizeof(info.name), "%s-%s",
  328|      9|             info.codec->name, info.method_name);
  329|       |
  330|      9|    info.rank = *num_infos;
  331|      9|    info.auto_pos = INT_MAX;
  332|       |
  333|    171|    for (int x = 0; hwdec_autoprobe_info[x].method_name; x++) {
  ------------------
  |  Branch (333:21): [True: 162, False: 9]
  ------------------
  334|    162|        const struct autoprobe_info *entry = &hwdec_autoprobe_info[x];
  335|    162|        if (strcmp(entry->method_name, info.method_name) == 0) {
  ------------------
  |  Branch (335:13): [True: 0, False: 162]
  ------------------
  336|      0|            info.flags |= entry->flags;
  337|      0|            if (info.flags & HWDEC_FLAG_AUTO)
  ------------------
  |  Branch (337:17): [True: 0, False: 0]
  ------------------
  338|      0|                info.auto_pos = x;
  339|      0|        }
  340|    162|    }
  341|       |
  342|      9|    MP_TARRAY_APPEND(NULL, *infos, *num_infos, info);
  ------------------
  |  |  105|      9|    do {                                            \
  |  |  106|      9|        MP_TARRAY_GROW(ctx, p, idxvar);             \
  |  |  ------------------
  |  |  |  |   96|      9|    do {                                            \
  |  |  |  |   97|      9|        size_t nextidx_ = (nextidx);                \
  |  |  |  |   98|      9|        if (nextidx_ >= MP_TALLOC_AVAIL(p))         \
  |  |  |  |  ------------------
  |  |  |  |  |  |   84|      9|#define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0]))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   45|      9|#define talloc_get_size                 ta_get_size
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (98:13): [True: 3, False: 6]
  |  |  |  |  ------------------
  |  |  |  |   99|      9|            MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      3|    do {                                                        \
  |  |  |  |  |  |   89|      3|        (p) = ta_xrealloc_size(ctx, p,                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  158|      3|#define ta_xrealloc_size(...)   ta_dbg_set_loc(ta_xrealloc_size(__VA_ARGS__), TA_LOC)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|      3|#define TA_LOC __FILE__ ":" TA_STRINGIFY(__LINE__)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   38|      3|#define TA_STRINGIFY(x) TA_STRINGIFY_(x)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      3|#define TA_STRINGIFY_(x) # x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   90|      3|                    ta_calc_array_size(sizeof((p)[0]), count)); \
  |  |  |  |  |  |   91|      3|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (91:14): [Folded, False: 3]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  100|      9|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:14): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      9|        (p)[(idxvar)] = (__VA_ARGS__);              \
  |  |  108|      9|        (idxvar)++;                                 \
  |  |  109|      9|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 9]
  |  |  ------------------
  ------------------
  343|      9|}
vd_lavc.c:hwdec_compare:
  295|     13|{
  296|     13|    struct hwdec_info *h1 = (void *)p1;
  297|     13|    struct hwdec_info *h2 = (void *)p2;
  298|       |
  299|     13|    if (h1 == h2)
  ------------------
  |  Branch (299:9): [True: 0, False: 13]
  ------------------
  300|      0|        return 0;
  301|       |
  302|       |    // Strictly put non-preferred hwdecs to the end of the list.
  303|     13|    if ((h1->auto_pos == INT_MAX) != (h2->auto_pos == INT_MAX))
  ------------------
  |  Branch (303:9): [True: 0, False: 13]
  ------------------
  304|      0|        return h1->auto_pos == INT_MAX ? 1 : -1;
  ------------------
  |  Branch (304:16): [True: 0, False: 0]
  ------------------
  305|       |    // List non-copying entries first, so --hwdec=auto takes them.
  306|     13|    if (h1->copying != h2->copying)
  ------------------
  |  Branch (306:9): [True: 0, False: 13]
  ------------------
  307|      0|        return h1->copying ? 1 : -1;
  ------------------
  |  Branch (307:16): [True: 0, False: 0]
  ------------------
  308|       |    // Order by autoprobe preference order.
  309|     13|    if (h1->auto_pos != h2->auto_pos)
  ------------------
  |  Branch (309:9): [True: 0, False: 13]
  ------------------
  310|      0|        return h1->auto_pos > h2->auto_pos ? 1 : -1;
  ------------------
  |  Branch (310:16): [True: 0, False: 0]
  ------------------
  311|       |    // Put hwdecs without hw_device_ctx last
  312|     13|    if ((!!h1->lavc_device) != (!!h2->lavc_device))
  ------------------
  |  Branch (312:9): [True: 0, False: 13]
  ------------------
  313|      0|        return h1->lavc_device ? -1 : 1;
  ------------------
  |  Branch (313:16): [True: 0, False: 0]
  ------------------
  314|       |    // Fallback sort order to make sorting stable.
  315|     13|    return h1->rank > h2->rank ? 1 :-1;
  ------------------
  |  Branch (315:12): [True: 0, False: 13]
  ------------------
  316|     13|}
vd_lavc.c:add_decoders:
 1550|    755|{
 1551|    755|    mp_add_lavc_decoders(list, AVMEDIA_TYPE_VIDEO);
 1552|    755|}

imgfmt2pixfmt:
   76|    534|{
   77|    534|    if (fmt == IMGFMT_NONE)
  ------------------
  |  Branch (77:9): [True: 0, False: 534]
  ------------------
   78|      0|        return AV_PIX_FMT_NONE;
   79|       |
   80|    534|    if (fmt >= IMGFMT_AVPIXFMT_START && fmt < IMGFMT_AVPIXFMT_END) {
  ------------------
  |  Branch (80:9): [True: 501, False: 33]
  |  Branch (80:41): [True: 500, False: 1]
  ------------------
   81|    500|        enum AVPixelFormat pixfmt = fmt - IMGFMT_AVPIXFMT_START;
   82|       |        // Avoid duplicate format - each format must be unique.
   83|    500|        int mpfmt = pixfmt2imgfmt(pixfmt);
   84|    500|        if (mpfmt == fmt && av_pix_fmt_desc_get(pixfmt))
  ------------------
  |  Branch (84:13): [True: 235, False: 265]
  |  Branch (84:29): [True: 235, False: 0]
  ------------------
   85|    235|            return pixfmt;
   86|    265|        return AV_PIX_FMT_NONE;
   87|    500|    }
   88|       |
   89|    653|    for (int i = 0; conversion_map[i].fmt; i++) {
  ------------------
  |  Branch (89:21): [True: 650, False: 3]
  ------------------
   90|    650|        if (conversion_map[i].fmt == fmt)
  ------------------
  |  Branch (90:13): [True: 31, False: 619]
  ------------------
   91|     31|            return conversion_map[i].pix_fmt;
   92|    650|    }
   93|      3|    return AV_PIX_FMT_NONE;
   94|     34|}
pixfmt2imgfmt:
   97|  2.34k|{
   98|  2.34k|    if (pix_fmt == AV_PIX_FMT_NONE)
  ------------------
  |  Branch (98:9): [True: 1.03k, False: 1.31k]
  ------------------
   99|  1.03k|        return IMGFMT_NONE;
  100|       |
  101|  36.6k|    for (int i = 0; conversion_map[i].pix_fmt != AV_PIX_FMT_NONE; i++) {
  ------------------
  |  Branch (101:21): [True: 35.7k, False: 896]
  ------------------
  102|  35.7k|        if (conversion_map[i].pix_fmt == pix_fmt)
  ------------------
  |  Branch (102:13): [True: 417, False: 35.3k]
  ------------------
  103|    417|            return conversion_map[i].fmt;
  104|  35.7k|    }
  105|       |
  106|    896|    int generic = IMGFMT_AVPIXFMT_START + pix_fmt;
  107|    896|    if (generic < IMGFMT_AVPIXFMT_END && av_pix_fmt_desc_get(pix_fmt))
  ------------------
  |  Branch (107:9): [True: 896, False: 0]
  |  Branch (107:42): [True: 666, False: 230]
  ------------------
  108|    666|        return generic;
  109|       |
  110|    230|    return 0;
  111|    896|}

mp_imgfmt_name_list:
  135|      1|{
  136|      1|    int count = IMGFMT_END - IMGFMT_START;
  137|      1|    char **list = talloc_zero_array(NULL, char *, count + 1);
  ------------------
  |  |   30|      1|#define talloc_zero_array               ta_xznew_array
  |  |  ------------------
  |  |  |  |  136|      1|#define ta_xznew_array(...)             ta_oom_g(ta_znew_array(__VA_ARGS__))
  |  |  |  |  ------------------
  |  |  |  |  |  |  182|      1|#define ta_oom_g(ptr) (TA_TYPEOF(ptr))ta_oom_p(ptr)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  138|      1|    int num = 0;
  139|    560|    for (int n = IMGFMT_START; n < IMGFMT_END; n++) {
  ------------------
  |  Branch (139:32): [True: 559, False: 1]
  ------------------
  140|    559|        const char *name = mp_imgfmt_to_name(n);
  ------------------
  |  |  333|    559|#define mp_imgfmt_to_name(fmt) mp_imgfmt_to_name_buf((char[16]){0}, 16, (fmt))
  ------------------
  141|    559|        if (strcmp(name, "unknown") != 0)
  ------------------
  |  Branch (141:13): [True: 291, False: 268]
  ------------------
  142|    291|            list[num++] = talloc_strdup(list, name);
  ------------------
  |  |   50|    291|#define talloc_strdup                   ta_xstrdup
  ------------------
  143|    559|    }
  144|      1|    return list;
  145|      1|}
mp_imgfmt_from_name:
  148|  1.94k|{
  149|  1.94k|    if (bstr_equals0(name, "none"))
  ------------------
  |  Branch (149:9): [True: 1, False: 1.94k]
  ------------------
  150|      1|        return 0;
  151|  1.94k|    static const struct { bstr old, new; } deprecated_fmt_names[] = {
  152|  1.94k|        {bstr0_lit("rgb30"), bstr0_lit("x2rgb10")},
  ------------------
  |  |   59|  1.94k|#define bstr0_lit(s) {(unsigned char *)(s), sizeof("" s) - 1}
  ------------------
                      {bstr0_lit("rgb30"), bstr0_lit("x2rgb10")},
  ------------------
  |  |   59|  1.94k|#define bstr0_lit(s) {(unsigned char *)(s), sizeof("" s) - 1}
  ------------------
  153|  1.94k|    };
  154|  3.82k|    for (int n = 0; n < MP_ARRAY_SIZE(deprecated_fmt_names); n++) {
  ------------------
  |  |   49|  3.82k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (154:21): [True: 1.94k, False: 1.88k]
  ------------------
  155|  1.94k|        if (bstr_equals(name, deprecated_fmt_names[n].old)) {
  ------------------
  |  Branch (155:13): [True: 67, False: 1.88k]
  ------------------
  156|     67|            name = deprecated_fmt_names[n].new;
  157|     67|            break;
  158|     67|        }
  159|  1.94k|    }
  160|  51.0k|    for (int n = 0; n < MP_ARRAY_SIZE(mp_imgfmt_list); n++) {
  ------------------
  |  |   49|  51.0k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (160:21): [True: 49.1k, False: 1.84k]
  ------------------
  161|  49.1k|        const struct mp_imgfmt_entry *p = &mp_imgfmt_list[n];
  162|  49.1k|        if (p->name && bstr_equals0(name, p->name))
  ------------------
  |  Branch (162:13): [True: 47.2k, False: 1.94k]
  |  Branch (162:24): [True: 101, False: 47.1k]
  ------------------
  163|    101|            return IMGFMT_CUST_BASE + n;
  164|  49.1k|    }
  165|  1.84k|    return pixfmt2imgfmt(av_get_pix_fmt(mp_tprintf(80, "%.*s", BSTR_P(name))));
  ------------------
  |  |  195|  3.69k|    mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (195:55): [True: 1.84k, False: 0]
  |  |  ------------------
  ------------------
  166|  1.94k|}
mp_imgfmt_to_name_buf:
  169|    559|{
  170|    559|    const struct mp_imgfmt_entry *p = get_mp_desc(fmt);
  171|    559|    const char *name = p ? p->name : NULL;
  ------------------
  |  Branch (171:24): [True: 25, False: 534]
  ------------------
  172|    559|    if (!name) {
  ------------------
  |  Branch (172:9): [True: 534, False: 25]
  ------------------
  173|    534|        const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(imgfmt2pixfmt(fmt));
  174|    534|        if (pixdesc)
  ------------------
  |  Branch (174:13): [True: 266, False: 268]
  ------------------
  175|    266|            name = pixdesc->name;
  176|    534|    }
  177|    559|    if (!name)
  ------------------
  |  Branch (177:9): [True: 268, False: 291]
  ------------------
  178|    268|        name = "unknown";
  179|    559|    snprintf(buf, buf_size, "%s", name);
  180|    559|    int len = strlen(buf);
  181|    559|    if (len > 2 && buf[len - 2] == MP_SELECT_LE_BE('l', 'b') && buf[len - 1] == 'e')
  ------------------
  |  |   38|  1.11k|#define MP_SELECT_LE_BE(LE, BE) LE
  ------------------
  |  Branch (181:9): [True: 558, False: 1]
  |  Branch (181:20): [True: 102, False: 456]
  |  Branch (181:65): [True: 99, False: 3]
  ------------------
  182|     99|        buf[len - 2] = '\0';
  183|    559|    return buf;
  184|    559|}
img_format.c:get_mp_desc:
  124|    559|{
  125|    559|    if (imgfmt < IMGFMT_CUST_BASE)
  ------------------
  |  Branch (125:9): [True: 30, False: 529]
  ------------------
  126|     30|        return NULL;
  127|    529|    int index = imgfmt - IMGFMT_CUST_BASE;
  128|    529|    if (index >= MP_ARRAY_SIZE(mp_imgfmt_list))
  ------------------
  |  |   49|    529|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (128:9): [True: 503, False: 26]
  ------------------
  129|    503|        return NULL;
  130|     26|    const struct mp_imgfmt_entry *e = &mp_imgfmt_list[index];
  131|     26|    return e->name ? e : NULL;
  ------------------
  |  Branch (131:12): [True: 25, False: 1]
  ------------------
  132|    529|}

mp_image_unrefp:
  488|  32.8k|{
  489|  32.8k|    talloc_free(*p_img);
  ------------------
  |  |   47|  32.8k|#define talloc_free                     ta_free
  ------------------
  490|       |    *p_img = NULL;
  491|  32.8k|}

context.c:get_desc:
  147|  32.9k|{
  148|  32.9k|    if (index >= MP_ARRAY_SIZE(contexts))
  ------------------
  |  |   49|  32.9k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (148:9): [True: 16.4k, False: 16.5k]
  ------------------
  149|  16.4k|        return false;
  150|  16.5k|    const struct ra_ctx_fns *ctx = contexts[index];
  151|  16.5k|    *dst = (struct m_obj_desc) {
  152|  16.5k|        .name = ctx->name,
  153|  16.5k|        .description = ctx->description,
  154|  16.5k|    };
  155|       |    return true;
  156|  32.9k|}
context.c:check_unknown_entry:
  159|     18|{
  160|       |    return false;
  161|     18|}
context.c:get_type_desc:
  173|  32.9k|{
  174|  32.9k|    int api_index = 0;
  175|       |
  176|  49.3k|    for (int i = 0; i < MP_ARRAY_SIZE(contexts); i++) {
  ------------------
  |  |   49|  49.3k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (176:21): [True: 32.9k, False: 16.4k]
  ------------------
  177|  32.9k|        if (i && strcmp(contexts[i - 1]->type, contexts[i]->type))
  ------------------
  |  Branch (177:13): [True: 0, False: 32.9k]
  |  Branch (177:18): [True: 0, False: 0]
  ------------------
  178|      0|            api_index++;
  179|       |
  180|  32.9k|        if (api_index == index) {
  ------------------
  |  Branch (180:13): [True: 16.5k, False: 16.4k]
  ------------------
  181|  16.5k|            *dst = (struct m_obj_desc) {
  182|  16.5k|                .name = contexts[i]->type,
  183|  16.5k|                .description = "",
  184|  16.5k|            };
  185|  16.5k|            return true;
  186|  16.5k|        }
  187|  32.9k|    }
  188|       |
  189|  16.4k|    return false;
  190|  32.9k|}
context.c:print_context_apis:
  193|      1|{
  194|      1|    mp_info(log, "Available GPU APIs and contexts:\n");
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  195|      2|    for (int n = 0; n < MP_ARRAY_SIZE(contexts); n++) {
  ------------------
  |  |   49|      2|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (195:21): [True: 1, False: 1]
  ------------------
  196|      1|        mp_info(log, "  %s %s\n", contexts[n]->type, contexts[n]->name);
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  197|      1|    }
  198|      1|}

mp_find_error_diffusion_kernel:
   50|    220|{
   51|    220|    if (!name)
  ------------------
  |  Branch (51:9): [True: 0, False: 220]
  ------------------
   52|      0|        return NULL;
   53|    220|    for (const struct error_diffusion_kernel *k = mp_error_diffusion_kernels;
   54|  2.11k|         k->name;
  ------------------
  |  Branch (54:10): [True: 1.98k, False: 122]
  ------------------
   55|  1.98k|         k++) {
   56|  1.98k|        if (strcmp(k->name, name) == 0)
  ------------------
  |  Branch (56:13): [True: 98, False: 1.89k]
  ------------------
   57|     98|            return k;
   58|  1.98k|    }
   59|    122|    return NULL;
   60|    220|}

ra_hwdec_validate_opt:
  228|    335|{
  229|       |    return ra_hwdec_validate_opt_full(log, true, opt, name, value);
  230|    335|}
ra_hwdec_validate_drivers_only_opt:
  235|     75|{
  236|       |    return ra_hwdec_validate_opt_full(log, false, opt, name, value);
  237|     75|}
hwdec.c:ra_hwdec_validate_opt_full:
  195|    410|{
  196|    410|    struct bstr param = bstr0(*value);
  197|    410|    bool help = bstr_equals0(param, "help");
  198|    410|    if (help)
  ------------------
  |  Branch (198:9): [True: 2, False: 408]
  ------------------
  199|      2|        mp_info(log, "Available hwdecs:\n");
  ------------------
  |  |   78|      2|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  200|    410|    for (int n = 0; ra_hwdec_drivers[n]; n++) {
  ------------------
  |  Branch (200:21): [True: 0, False: 410]
  ------------------
  201|      0|        const struct ra_hwdec_driver *drv = ra_hwdec_drivers[n];
  202|      0|        if (help) {
  ------------------
  |  Branch (202:13): [True: 0, False: 0]
  ------------------
  203|      0|            mp_info(log, "    %s\n", drv->name);
  ------------------
  |  |   78|      0|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  204|      0|        } else if (bstr_equals0(param, drv->name)) {
  ------------------
  |  Branch (204:20): [True: 0, False: 0]
  ------------------
  205|      0|            return 1;
  206|      0|        }
  207|      0|    }
  208|    410|    if (help) {
  ------------------
  |  Branch (208:9): [True: 2, False: 408]
  ------------------
  209|      2|        if (include_modes) {
  ------------------
  |  Branch (209:13): [True: 1, False: 1]
  ------------------
  210|      1|            mp_info(log, "    auto (behavior depends on context)\n"
  ------------------
  |  |   78|      1|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
  211|      1|                        "    all (load all hwdecs)\n"
  212|      1|                        "    no (do not load any and block loading on demand)\n");
  213|      1|        }
  214|      2|        return M_OPT_EXIT;
  ------------------
  |  |  545|      2|#define M_OPT_EXIT              -6
  ------------------
  215|      2|    }
  216|    408|    if (!param.len)
  ------------------
  |  Branch (216:9): [True: 135, False: 273]
  ------------------
  217|    135|        return 1; // "" is treated specially
  218|    273|    if (include_modes &&
  ------------------
  |  Branch (218:9): [True: 268, False: 5]
  ------------------
  219|    268|       (bstr_equals0(param, "all") || bstr_equals0(param, "auto") ||
  ------------------
  |  Branch (219:9): [True: 67, False: 201]
  |  Branch (219:39): [True: 72, False: 129]
  ------------------
  220|    129|        bstr_equals0(param, "no")))
  ------------------
  |  Branch (220:9): [True: 102, False: 27]
  ------------------
  221|    241|        return 1;
  222|     32|    mp_fatal(log, "No hwdec backend named '%.*s' found!\n", BSTR_P(param));
  ------------------
  |  |   75|     64|#define mp_fatal(log, ...)      mp_msg(log, MSGL_FATAL, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (75:57): [True: 32, False: 0]
  |  |  ------------------
  ------------------
  223|     32|    return M_OPT_INVALID;
  ------------------
  |  |  535|     32|#define M_OPT_INVALID           -3
  ------------------
  224|    273|}

lcms.c:validate_3dlut_size_opt:
  494|     51|{
  495|     51|    int p1, p2, p3;
  496|     51|    return gl_parse_3dlut_size(*value, &p1, &p2, &p3) ? 0 : M_OPT_INVALID;
  ------------------
  |  |  535|     27|#define M_OPT_INVALID           -3
  ------------------
  |  Branch (496:12): [True: 24, False: 27]
  ------------------
  497|     51|}

lcms.c:gl_parse_3dlut_size:
   46|     51|{
   47|     51|    if (!arg)
  ------------------
  |  Branch (47:9): [True: 0, False: 51]
  ------------------
   48|      0|        return false;
   49|     51|    if (!strcmp(arg, "auto")) {
  ------------------
  |  Branch (49:9): [True: 24, False: 27]
  ------------------
   50|     24|        *p1 = *p2 = *p3 = 0;
   51|     24|        return true;
   52|     24|    }
   53|     27|    if (sscanf(arg, "%dx%dx%d", p1, p2, p3) != 3)
  ------------------
  |  Branch (53:9): [True: 27, False: 0]
  ------------------
   54|     27|        return false;
   55|      0|    for (int n = 0; n < 3; n++) {
  ------------------
  |  Branch (55:21): [True: 0, False: 0]
  ------------------
   56|      0|        int s = ((int[]) { *p1, *p2, *p3 })[n];
   57|      0|        if (s < 2 || s > 512)
  ------------------
  |  Branch (57:13): [True: 0, False: 0]
  |  Branch (57:22): [True: 0, False: 0]
  ------------------
   58|      0|            return false;
   59|      0|    }
   60|      0|    return true;
   61|      0|}

video.c:validate_target_gamut:
 4437|    139|{
 4438|    139|    struct pl_raw_primaries tmp;
 4439|    139|    return mp_parse_raw_primaries(log, *value, &tmp);
 4440|    139|}
video.c:validate_error_diffusion_opt:
 4413|    221|{
 4414|    221|    struct bstr param = bstr0(*value);
 4415|    221|    char s[32] = {0};
 4416|    221|    int r = 1;
 4417|    221|    if (bstr_equals0(param, "help")) {
  ------------------
  |  Branch (4417:9): [True: 1, False: 220]
  ------------------
 4418|      1|        r = M_OPT_EXIT;
  ------------------
  |  |  545|      1|#define M_OPT_EXIT              -6
  ------------------
 4419|    220|    } else {
 4420|    220|        snprintf(s, sizeof(s), "%.*s", BSTR_P(param));
  ------------------
  |  |  307|    220|#define BSTR_P(bstr) (int)((bstr).len), ((bstr).start ? (char*)(bstr).start : "")
  |  |  ------------------
  |  |  |  Branch (307:42): [True: 220, False: 0]
  |  |  ------------------
  ------------------
 4421|    220|        const struct error_diffusion_kernel *k = mp_find_error_diffusion_kernel(s);
 4422|    220|        if (!k)
  ------------------
  |  Branch (4422:13): [True: 122, False: 98]
  ------------------
 4423|    122|            r = M_OPT_INVALID;
  ------------------
  |  |  535|    122|#define M_OPT_INVALID           -3
  ------------------
 4424|    220|    }
 4425|    221|    if (r < 1) {
  ------------------
  |  Branch (4425:9): [True: 123, False: 98]
  ------------------
 4426|    123|        mp_info(log, "Available error diffusion kernels:\n");
  ------------------
  |  |   78|    123|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 4427|  1.35k|        for (int n = 0; mp_error_diffusion_kernels[n].name; n++)
  ------------------
  |  Branch (4427:25): [True: 1.23k, False: 123]
  ------------------
 4428|  1.23k|            mp_info(log, "    %s\n", mp_error_diffusion_kernels[n].name);
  ------------------
  |  |   78|  1.23k|#define mp_info(log, ...)       mp_msg(log, MSGL_INFO, __VA_ARGS__)
  ------------------
 4429|    123|        if (s[0])
  ------------------
  |  Branch (4429:13): [True: 121, False: 2]
  ------------------
 4430|    121|            mp_fatal(log, "No error diffusion kernel named '%s' found!\n", s);
  ------------------
  |  |   75|    121|#define mp_fatal(log, ...)      mp_msg(log, MSGL_FATAL, __VA_ARGS__)
  ------------------
 4431|    123|    }
 4432|    221|    return r;
 4433|    221|}

vo.c:get_desc:
  224|   530k|{
  225|   530k|    if (index >= MP_ARRAY_SIZE(video_out_drivers))
  ------------------
  |  |   49|   530k|#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
  ------------------
  |  Branch (225:9): [True: 41.8k, False: 488k]
  ------------------
  226|  41.8k|        return false;
  227|   488k|    const struct vo_driver *vo = video_out_drivers[index];
  228|   488k|    *dst = (struct m_obj_desc) {
  229|   488k|        .name = vo->name,
  230|   488k|        .description = vo->description,
  231|   488k|        .priv_size = vo->priv_size,
  232|   488k|        .priv_defaults = vo->priv_defaults,
  233|   488k|        .options = vo->options,
  234|   488k|        .options_prefix = vo->options_prefix,
  235|   488k|        .global_opts = vo->global_opts,
  236|   488k|        .hidden = vo->encode,
  237|   488k|        .p = vo,
  238|   488k|    };
  239|       |    return true;
  240|   530k|}

