Coverage Report

Created: 2025-12-10 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/mpv/demux/demux_mpv.c
Line
Count
Source
1
/*
2
 * This file is part of mpv.
3
 *
4
 * mpv is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2.1 of the License, or (at your option) any later version.
8
 *
9
 * mpv is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
15
 * License along with mpv.  If not, see <http://www.gnu.org/licenses/>.
16
 */
17
18
#include "demux.h"
19
20
#include <common/playlist.h>
21
#include <stream/stream.h>
22
23
static int open_mpv(struct demuxer *demuxer, enum demux_check check)
24
55.8k
{
25
55.8k
    if (check != DEMUX_CHECK_REQUEST)
26
55.7k
        return -1;
27
28
92
    struct stream *s = demuxer->stream;
29
92
    if (!s->info || strcmp(s->info->name, "mpv"))
30
1
        return -1;
31
32
91
    demuxer->playlist = talloc_zero(demuxer, struct playlist);
33
91
    mp_url_unescape_inplace(s->path);
34
91
    playlist_append_file(demuxer->playlist, s->path);
35
91
    playlist_set_stream_flags(demuxer->playlist, demuxer->stream_origin);
36
91
    demuxer->fully_read = true;
37
91
    demux_close_stream(demuxer);
38
39
91
    return 0;
40
92
}
41
42
const struct demuxer_desc demuxer_desc_mpv = {
43
    .name = "mpv",
44
    .desc = "mpv protocol",
45
    .open = open_mpv,
46
};