mirror of
https://github.com/mpv-player/mpv
synced 2024-11-14 22:48:35 +01:00
demux: make demux_open() private
I always wanted to get rid of this, because it makes the ownership rules for the stream pointer really awkward. demux_edl.c was the only remaining user of this. Replace it with a semi-clever idea: the init segment shit can be used to pass the "file" contents as memory block, and "memory://" itself provides an empty stream. I have no idea if this actually works, because I didn't immediately find a test stream (would have to be some youtube DASH shit).
This commit is contained in:
parent
5c7ecad93a
commit
b1c202c12f
@ -2438,8 +2438,9 @@ static const int d_force[] = {DEMUX_CHECK_FORCE, -1};
|
||||
// If params->does_not_own_stream==false, this does _not_ free the stream if
|
||||
// opening fails. But if it succeeds, a later demux_free() call will free the
|
||||
// stream.
|
||||
struct demuxer *demux_open(struct stream *stream, struct demuxer_params *params,
|
||||
struct mpv_global *global)
|
||||
static struct demuxer *demux_open(struct stream *stream,
|
||||
struct demuxer_params *params,
|
||||
struct mpv_global *global)
|
||||
{
|
||||
const int *check_levels = d_normal;
|
||||
const struct demuxer_desc *check_desc = NULL;
|
||||
|
@ -262,9 +262,6 @@ int demux_get_num_stream(struct demuxer *demuxer);
|
||||
struct sh_stream *demux_alloc_sh_stream(enum stream_type type);
|
||||
void demux_add_sh_stream(struct demuxer *demuxer, struct sh_stream *sh);
|
||||
|
||||
struct demuxer *demux_open(struct stream *stream, struct demuxer_params *params,
|
||||
struct mpv_global *global);
|
||||
|
||||
struct mp_cancel;
|
||||
struct demuxer *demux_open_url(const char *url,
|
||||
struct demuxer_params *params,
|
||||
|
@ -237,10 +237,12 @@ static void build_timeline(struct timeline *tl, struct tl_parts *parts)
|
||||
MP_ERR(tl, "Could not read init fragment.\n");
|
||||
goto error;
|
||||
}
|
||||
s = open_memory_stream(tl->init_fragment.start, tl->init_fragment.len);
|
||||
tl->track_layout = demux_open(s, NULL, tl->global);
|
||||
struct demuxer_params params = {
|
||||
.init_fragment = tl->init_fragment,
|
||||
};
|
||||
tl->track_layout = demux_open_url("memory://", ¶ms, tl->cancel,
|
||||
tl->global);
|
||||
if (!tl->track_layout) {
|
||||
free_stream(s);
|
||||
MP_ERR(tl, "Could not demux init fragment.\n");
|
||||
goto error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user