2010-01-30 22:26:47 +00:00
|
|
|
/*
|
2015-04-13 07:36:54 +00:00
|
|
|
* This file is part of mpv.
|
2010-01-30 22:26:47 +00:00
|
|
|
*
|
stream: change license to LGPL
All relevant authors have agreed.
There are two exceptions, patches by authors who could not be reached.
This commit tries to remove their copyright.
a0f08fbe: messes with the seeking code corner cases. The EOF flag logic
was changed at some point, and always had a flaky history (see e.g.
347cf972 50274ca3 70411f27 5999efb9 0d5e6084 ff08d0c3 2e2f77e3 de5566f0
9554a844, all which happened after that patch, MPlayer ones without that
patch). I claim that all of the copyright the patch might have added is
gone. Except the message in stream_seek(), which this commit removes.
The other code removed/changed in stream_seek() is probably not from
that patch, but it doesn't hurt to be sure, and also makes it more
readable. (It might change the behavior so that sometimes the eof flag
is set after a seek, but it doesn't matter here.)
2aa6acd9: it looks like the seek_forward() modified by this patch was
later moved to stream.c and renamed to stream_skip_read() in a790f2133.
(Looking closer at it, it was actually modified again a bunch of times,
fixing the logic.) I rewrote it in this commit. The code ended up rather
similar, which probably could lead to doubts whether this was done
properly, but I guess the reader of this will just have to believe me. I
knew what stream_skip_read() was supposed to do (which was reinforced
when I tried to replace it on the caller side), without reading the
pre-existing code in detail. I had to "relearn" the logic how buf_pos
and bug_len work - it was actually easy to see from stream_read_char()
how to skip the data, essentially by generalizing its logic from 1 byte
to N bytes. From the old code I only "used" the fact that it's obviously
a while(len>0) look, that has to call stream_fill_buffer repeatedly to
make progress. At first I actually didn't use stream_fill_buffer_by(),
but the variant without _by, but readded it when I checked why the old
code used it (see cd7ec016e7). This has to be good enough. In the end,
it's hard to argue that this could be implemented in a way not using
such a loop.
Other than this, I could add the usual remarks about how this code was
not modularized in the past, and how stream.c contained DVD code, and
how this was later modularized, moving the copyright to other files, and
so on. Also, if someone wrote a stream module, and was not asked about
LGPL relicensing, we don't consider the entry in stream_list[]
copyrightable.
2017-06-19 14:07:42 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2010-01-30 22:26:47 +00:00
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is distributed in the hope that it will be useful,
|
2010-01-30 22:26:47 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
stream: change license to LGPL
All relevant authors have agreed.
There are two exceptions, patches by authors who could not be reached.
This commit tries to remove their copyright.
a0f08fbe: messes with the seeking code corner cases. The EOF flag logic
was changed at some point, and always had a flaky history (see e.g.
347cf972 50274ca3 70411f27 5999efb9 0d5e6084 ff08d0c3 2e2f77e3 de5566f0
9554a844, all which happened after that patch, MPlayer ones without that
patch). I claim that all of the copyright the patch might have added is
gone. Except the message in stream_seek(), which this commit removes.
The other code removed/changed in stream_seek() is probably not from
that patch, but it doesn't hurt to be sure, and also makes it more
readable. (It might change the behavior so that sometimes the eof flag
is set after a seek, but it doesn't matter here.)
2aa6acd9: it looks like the seek_forward() modified by this patch was
later moved to stream.c and renamed to stream_skip_read() in a790f2133.
(Looking closer at it, it was actually modified again a bunch of times,
fixing the logic.) I rewrote it in this commit. The code ended up rather
similar, which probably could lead to doubts whether this was done
properly, but I guess the reader of this will just have to believe me. I
knew what stream_skip_read() was supposed to do (which was reinforced
when I tried to replace it on the caller side), without reading the
pre-existing code in detail. I had to "relearn" the logic how buf_pos
and bug_len work - it was actually easy to see from stream_read_char()
how to skip the data, essentially by generalizing its logic from 1 byte
to N bytes. From the old code I only "used" the fact that it's obviously
a while(len>0) look, that has to call stream_fill_buffer repeatedly to
make progress. At first I actually didn't use stream_fill_buffer_by(),
but the variant without _by, but readded it when I checked why the old
code used it (see cd7ec016e7). This has to be good enough. In the end,
it's hard to argue that this could be implemented in a way not using
such a loop.
Other than this, I could add the usual remarks about how this code was
not modularized in the past, and how stream.c contained DVD code, and
how this was later modularized, moving the copyright to other files, and
so on. Also, if someone wrote a stream module, and was not asked about
LGPL relicensing, we don't consider the entry in stream_list[]
copyrightable.
2017-06-19 14:07:42 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
2010-01-30 22:26:47 +00:00
|
|
|
*
|
stream: change license to LGPL
All relevant authors have agreed.
There are two exceptions, patches by authors who could not be reached.
This commit tries to remove their copyright.
a0f08fbe: messes with the seeking code corner cases. The EOF flag logic
was changed at some point, and always had a flaky history (see e.g.
347cf972 50274ca3 70411f27 5999efb9 0d5e6084 ff08d0c3 2e2f77e3 de5566f0
9554a844, all which happened after that patch, MPlayer ones without that
patch). I claim that all of the copyright the patch might have added is
gone. Except the message in stream_seek(), which this commit removes.
The other code removed/changed in stream_seek() is probably not from
that patch, but it doesn't hurt to be sure, and also makes it more
readable. (It might change the behavior so that sometimes the eof flag
is set after a seek, but it doesn't matter here.)
2aa6acd9: it looks like the seek_forward() modified by this patch was
later moved to stream.c and renamed to stream_skip_read() in a790f2133.
(Looking closer at it, it was actually modified again a bunch of times,
fixing the logic.) I rewrote it in this commit. The code ended up rather
similar, which probably could lead to doubts whether this was done
properly, but I guess the reader of this will just have to believe me. I
knew what stream_skip_read() was supposed to do (which was reinforced
when I tried to replace it on the caller side), without reading the
pre-existing code in detail. I had to "relearn" the logic how buf_pos
and bug_len work - it was actually easy to see from stream_read_char()
how to skip the data, essentially by generalizing its logic from 1 byte
to N bytes. From the old code I only "used" the fact that it's obviously
a while(len>0) look, that has to call stream_fill_buffer repeatedly to
make progress. At first I actually didn't use stream_fill_buffer_by(),
but the variant without _by, but readded it when I checked why the old
code used it (see cd7ec016e7). This has to be good enough. In the end,
it's hard to argue that this could be implemented in a way not using
such a loop.
Other than this, I could add the usual remarks about how this code was
not modularized in the past, and how stream.c contained DVD code, and
how this was later modularized, moving the copyright to other files, and
so on. Also, if someone wrote a stream module, and was not asked about
LGPL relicensing, we don't consider the entry in stream_list[]
copyrightable.
2017-06-19 14:07:42 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2010-01-30 22:26:47 +00:00
|
|
|
*/
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_STREAM_H
|
|
|
|
#define MPLAYER_STREAM_H
|
2001-04-22 16:56:20 +00:00
|
|
|
|
2013-12-17 01:39:45 +00:00
|
|
|
#include "common/msg.h"
|
2012-11-17 17:12:13 +00:00
|
|
|
#include <stdbool.h>
|
2010-11-02 01:17:41 +00:00
|
|
|
#include <stdio.h>
|
2002-09-15 22:38:01 +00:00
|
|
|
#include <string.h>
|
2002-01-07 09:22:01 +00:00
|
|
|
#include <inttypes.h>
|
2002-03-23 21:52:13 +00:00
|
|
|
#include <sys/types.h>
|
2010-03-06 07:24:41 +00:00
|
|
|
#include <fcntl.h>
|
|
|
|
|
2014-08-29 10:09:04 +00:00
|
|
|
#include "misc/bstr.h"
|
2011-02-25 16:10:00 +00:00
|
|
|
|
2002-09-15 22:38:01 +00:00
|
|
|
#define STREAM_BUFFER_SIZE 2048
|
|
|
|
|
2013-06-06 18:39:53 +00:00
|
|
|
// stream->mode
|
2003-04-02 16:25:07 +00:00
|
|
|
#define STREAM_READ 0
|
|
|
|
#define STREAM_WRITE 1
|
2013-06-06 18:39:53 +00:00
|
|
|
|
2013-08-25 20:50:16 +00:00
|
|
|
// flags for stream_open_ext (this includes STREAM_READ and STREAM_WRITE)
|
2014-08-31 17:49:39 +00:00
|
|
|
#define STREAM_SAFE_ONLY 4
|
2014-08-31 22:12:47 +00:00
|
|
|
#define STREAM_NETWORK_ONLY 8
|
2019-06-19 14:48:46 +00:00
|
|
|
#define STREAM_SILENT 16
|
2013-08-25 20:50:16 +00:00
|
|
|
|
2014-08-31 17:49:39 +00:00
|
|
|
#define STREAM_UNSAFE -3
|
2013-08-25 20:50:16 +00:00
|
|
|
#define STREAM_NO_MATCH -2
|
2007-08-28 22:38:45 +00:00
|
|
|
#define STREAM_UNSUPPORTED -1
|
2003-04-02 16:25:07 +00:00
|
|
|
#define STREAM_ERROR 0
|
|
|
|
#define STREAM_OK 1
|
|
|
|
|
2013-10-02 19:19:16 +00:00
|
|
|
enum stream_ctrl {
|
2014-12-13 19:25:31 +00:00
|
|
|
STREAM_CTRL_GET_SIZE = 1,
|
|
|
|
|
|
|
|
// Certain network protocols
|
|
|
|
STREAM_CTRL_AVSEEK,
|
|
|
|
STREAM_CTRL_HAS_AVSEEK,
|
|
|
|
STREAM_CTRL_GET_METADATA,
|
|
|
|
|
2019-10-02 22:22:18 +00:00
|
|
|
// Optical discs (internal interface between streams and demux_disc)
|
|
|
|
STREAM_CTRL_GET_TIME_LENGTH,
|
|
|
|
STREAM_CTRL_GET_DVD_INFO,
|
|
|
|
STREAM_CTRL_GET_DISC_NAME,
|
|
|
|
STREAM_CTRL_GET_NUM_CHAPTERS,
|
|
|
|
STREAM_CTRL_GET_CURRENT_TIME,
|
|
|
|
STREAM_CTRL_GET_CHAPTER_TIME,
|
|
|
|
STREAM_CTRL_SEEK_TO_TIME,
|
|
|
|
STREAM_CTRL_GET_ASPECT_RATIO,
|
|
|
|
STREAM_CTRL_GET_NUM_ANGLES,
|
|
|
|
STREAM_CTRL_GET_ANGLE,
|
|
|
|
STREAM_CTRL_SET_ANGLE,
|
|
|
|
STREAM_CTRL_GET_NUM_TITLES,
|
|
|
|
STREAM_CTRL_GET_TITLE_LENGTH, // double* (in: title number, out: len)
|
|
|
|
STREAM_CTRL_GET_LANG,
|
|
|
|
STREAM_CTRL_GET_CURRENT_TITLE,
|
|
|
|
STREAM_CTRL_SET_CURRENT_TITLE,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct stream_lang_req {
|
|
|
|
int type; // STREAM_AUDIO, STREAM_SUB
|
|
|
|
int id;
|
|
|
|
char name[50];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct stream_dvd_info_req {
|
|
|
|
unsigned int palette[16];
|
|
|
|
int num_subs;
|
2013-10-02 19:19:16 +00:00
|
|
|
};
|
2003-04-02 16:25:07 +00:00
|
|
|
|
2014-07-30 00:21:35 +00:00
|
|
|
// for STREAM_CTRL_AVSEEK
|
|
|
|
struct stream_avseek {
|
|
|
|
int stream_index;
|
|
|
|
int64_t timestamp;
|
|
|
|
int flags;
|
|
|
|
};
|
|
|
|
|
2008-04-24 02:49:44 +00:00
|
|
|
struct stream;
|
2019-09-28 22:45:41 +00:00
|
|
|
struct stream_open_args;
|
2003-04-02 16:25:07 +00:00
|
|
|
typedef struct stream_info_st {
|
2013-01-24 16:43:07 +00:00
|
|
|
const char *name;
|
2013-06-06 18:39:53 +00:00
|
|
|
// opts is set from ->opts
|
2014-05-24 12:06:13 +00:00
|
|
|
int (*open)(struct stream *st);
|
2019-06-19 14:48:46 +00:00
|
|
|
// Alternative to open(). Only either open() or open2() can be set.
|
2019-09-28 22:45:41 +00:00
|
|
|
int (*open2)(struct stream *st, struct stream_open_args *args);
|
2014-06-10 21:56:05 +00:00
|
|
|
const char *const *protocols;
|
2014-08-31 22:12:47 +00:00
|
|
|
bool can_write; // correctly checks for READ/WRITE modes
|
|
|
|
bool is_safe; // opening is no security issue, even with remote provided URLs
|
|
|
|
bool is_network; // used to restrict remote playlist entries to remote URLs
|
2003-04-02 16:25:07 +00:00
|
|
|
} stream_info_t;
|
|
|
|
|
2008-04-24 02:49:44 +00:00
|
|
|
typedef struct stream {
|
2013-08-02 15:02:34 +00:00
|
|
|
const struct stream_info_st *info;
|
|
|
|
|
2013-01-24 16:43:07 +00:00
|
|
|
// Read
|
|
|
|
int (*fill_buffer)(struct stream *s, char *buffer, int max_len);
|
|
|
|
// Write
|
|
|
|
int (*write_buffer)(struct stream *s, char *buffer, int len);
|
|
|
|
// Seek
|
|
|
|
int (*seek)(struct stream *s, int64_t pos);
|
|
|
|
// Control
|
|
|
|
int (*control)(struct stream *s, int cmd, void *arg);
|
|
|
|
// Close
|
|
|
|
void (*close)(struct stream *s);
|
|
|
|
|
2013-05-25 13:03:30 +00:00
|
|
|
int read_chunk; // maximum amount of data to read at once to limit latency
|
2013-01-24 16:43:07 +00:00
|
|
|
unsigned int buf_pos, buf_len;
|
2014-05-24 12:04:09 +00:00
|
|
|
int64_t pos;
|
2013-01-24 16:43:07 +00:00
|
|
|
int eof;
|
|
|
|
int mode; //STREAM_READ or STREAM_WRITE
|
|
|
|
void *priv; // used for DVD, TV, RTSP etc
|
2013-08-02 15:02:34 +00:00
|
|
|
char *url; // filename/url (possibly including protocol prefix)
|
|
|
|
char *path; // filename (url without protocol prefix)
|
2013-01-24 16:43:07 +00:00
|
|
|
char *mime_type; // when HTTP streaming is used
|
2013-07-11 19:10:42 +00:00
|
|
|
char *demuxer; // request demuxer to be used
|
2013-01-24 16:43:07 +00:00
|
|
|
char *lavf_type; // name of expected demuxer type for lavf
|
2015-02-06 20:32:44 +00:00
|
|
|
bool streaming : 1; // known to be a network stream if true
|
2014-05-24 12:04:09 +00:00
|
|
|
bool seekable : 1; // presence of general byte seeking support
|
|
|
|
bool fast_skip : 1; // consider stream fast enough to fw-seek by skipping
|
2014-08-31 22:12:47 +00:00
|
|
|
bool is_network : 1; // original stream_info_t.is_network flag
|
2017-02-02 17:24:27 +00:00
|
|
|
bool is_local_file : 1; // from the filesystem
|
|
|
|
bool is_directory : 1; // directory on the filesystem
|
2016-12-04 22:15:31 +00:00
|
|
|
bool access_references : 1; // open other streams
|
2013-12-21 19:36:45 +00:00
|
|
|
struct mp_log *log;
|
|
|
|
struct mpv_global *global;
|
2013-05-11 20:19:33 +00:00
|
|
|
|
stream: redo playback abort handling
This mechanism originates from MPlayer's way of dealing with blocking
network, but it's still useful. On opening and closing, mpv waits for
network synchronously, and also some obscure commands and use-cases can
lead to such blocking. In these situations, the stream is asynchronously
forced to stop by "interrupting" it.
The old design interrupting I/O was a bit broken: polling with a
callback, instead of actively interrupting it. Change the direction of
this. There is no callback anymore, and the player calls
mp_cancel_trigger() to force the stream to return.
libavformat (via stream_lavf.c) has the old broken design, and fixing it
would require fixing libavformat, which won't happen so quickly. So we
have to keep that part. But everything above the stream layer is
prepared for a better design, and more sophisticated methods than
mp_cancel_test() could be easily introduced.
There's still one problem: commands are still run in the central
playback loop, which we assume can block on I/O in the worst case.
That's not a problem yet, because we simply mark some commands as being
able to stop playback of the current file ("quit" etc.), so input.c
could abort playback as soon as such a command is queued. But there are
also commands abort playback only conditionally, and the logic for that
is in the playback core and thus "unreachable". For example,
"playlist_next" aborts playback only if there's a next file. We don't
want it to always abort playback.
As a quite ugly hack, abort playback only if at least 2 abort commands
are queued - this pretty much happens only if the core is frozen and
doesn't react to input.
2014-09-13 12:23:08 +00:00
|
|
|
struct mp_cancel *cancel; // cancellation notification
|
|
|
|
|
2018-09-01 11:04:45 +00:00
|
|
|
// Read statistic for fill_buffer calls. All bytes read by fill_buffer() are
|
|
|
|
// added to this. The user can reset this as needed.
|
|
|
|
uint64_t total_unbuffered_read_bytes;
|
|
|
|
|
2018-10-02 17:57:01 +00:00
|
|
|
uint8_t *buffer;
|
|
|
|
|
|
|
|
int buffer_alloc;
|
|
|
|
uint8_t buffer_inline[STREAM_BUFFER_SIZE];
|
2001-04-22 16:56:20 +00:00
|
|
|
} stream_t;
|
|
|
|
|
2008-08-12 09:49:37 +00:00
|
|
|
int stream_fill_buffer(stream_t *s);
|
2010-02-21 23:30:34 +00:00
|
|
|
|
2006-12-18 20:50:31 +00:00
|
|
|
int stream_write_buffer(stream_t *s, unsigned char *buf, int len);
|
2001-07-31 23:18:16 +00:00
|
|
|
|
2013-01-24 16:43:07 +00:00
|
|
|
inline static int stream_read_char(stream_t *s)
|
|
|
|
{
|
|
|
|
return (s->buf_pos < s->buf_len) ? s->buffer[s->buf_pos++] :
|
cache: make the stream cache a proper stream that wraps other streams
Before this commit, the cache was franken-hacked on top of the stream
API. You had to use special functions (like cache_stream_fill_buffer()
instead of stream_fill_buffer()), which would access the stream in a
cached manner.
The whole idea about the previous design was that the cache runs in a
thread or in a forked process, while the cache awa functions made sure
the stream instance looked consistent to the user. If you used the
normal functions instead of the special ones while the cache was
running, you were out of luck.
Make it a bit more reasonable by turning the cache into a stream on its
own. This makes it behave exactly like a normal stream. The stream
callbacks call into the original (uncached) stream to do work. No
special cache functions or redirections are needed. The only different
thing about cache streams is that they are created by special functions,
instead of being part of the auto_open_streams[] array.
To make things simpler, remove the threading implementation, which was
messed into the code. The threading code could perhaps be kept, but I
don't really want to have to worry about this special case. A proper
threaded implementation will be added later.
Remove the cache enabling code from stream_radio.c. Since enabling the
cache involves replacing the old stream with a new one, the code as-is
can't be kept. It would be easily possible to enable the cache by
requesting a cache size (which is also much simpler). But nobody uses
stream_radio.c and I can't even test this thing, and the cache is
probably not really important for it either.
2013-05-24 16:49:09 +00:00
|
|
|
(stream_fill_buffer(s) ? s->buffer[s->buf_pos++] : -256);
|
2001-04-22 16:56:20 +00:00
|
|
|
}
|
|
|
|
|
2013-08-25 18:40:21 +00:00
|
|
|
int stream_skip_bom(struct stream *s);
|
2006-03-16 14:42:51 +00:00
|
|
|
|
2013-01-24 16:43:07 +00:00
|
|
|
inline static int stream_eof(stream_t *s)
|
|
|
|
{
|
|
|
|
return s->eof;
|
2001-04-22 16:56:20 +00:00
|
|
|
}
|
|
|
|
|
2013-01-24 16:43:07 +00:00
|
|
|
inline static int64_t stream_tell(stream_t *s)
|
|
|
|
{
|
|
|
|
return s->pos + s->buf_pos - s->buf_len;
|
2001-04-22 16:56:20 +00:00
|
|
|
}
|
|
|
|
|
2015-02-06 20:15:21 +00:00
|
|
|
bool stream_skip(stream_t *s, int64_t len);
|
|
|
|
bool stream_seek(stream_t *s, int64_t pos);
|
2013-05-24 09:56:49 +00:00
|
|
|
int stream_read(stream_t *s, char *mem, int total);
|
2013-05-27 19:53:40 +00:00
|
|
|
int stream_read_partial(stream_t *s, char *buf, int buf_size);
|
2013-06-21 19:06:36 +00:00
|
|
|
struct bstr stream_peek(stream_t *s, int len);
|
2019-10-26 14:41:46 +00:00
|
|
|
struct bstr stream_peek_buffer(stream_t *s);
|
2013-12-13 23:51:00 +00:00
|
|
|
void stream_drop_buffers(stream_t *s);
|
2015-08-17 22:10:54 +00:00
|
|
|
int64_t stream_get_size(stream_t *s);
|
2001-04-22 16:56:20 +00:00
|
|
|
|
2013-12-21 19:36:45 +00:00
|
|
|
struct mpv_global;
|
2013-06-11 10:16:42 +00:00
|
|
|
|
2011-02-25 16:10:00 +00:00
|
|
|
struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
|
2013-06-11 10:16:42 +00:00
|
|
|
int max_size);
|
2015-03-27 12:27:40 +00:00
|
|
|
struct bstr stream_read_file(const char *filename, void *talloc_ctx,
|
|
|
|
struct mpv_global *global, int max_size);
|
2006-03-01 21:56:30 +00:00
|
|
|
int stream_control(stream_t *s, int cmd, void *arg);
|
2001-04-22 16:56:20 +00:00
|
|
|
void free_stream(stream_t *s);
|
2019-09-28 22:45:41 +00:00
|
|
|
|
|
|
|
struct stream_open_args {
|
|
|
|
struct mpv_global *global;
|
|
|
|
struct mp_cancel *cancel; // aborting stream access (used directly)
|
|
|
|
const char *url;
|
|
|
|
int flags; // STREAM_READ etc.
|
|
|
|
const stream_info_t *sinfo; // NULL = autoprobe, otherwise force stream impl.
|
|
|
|
void *special_arg; // specific to impl., use only with sinfo
|
|
|
|
};
|
|
|
|
|
|
|
|
int stream_create_with_args(struct stream_open_args *args, struct stream **ret);
|
stream: redo playback abort handling
This mechanism originates from MPlayer's way of dealing with blocking
network, but it's still useful. On opening and closing, mpv waits for
network synchronously, and also some obscure commands and use-cases can
lead to such blocking. In these situations, the stream is asynchronously
forced to stop by "interrupting" it.
The old design interrupting I/O was a bit broken: polling with a
callback, instead of actively interrupting it. Change the direction of
this. There is no callback anymore, and the player calls
mp_cancel_trigger() to force the stream to return.
libavformat (via stream_lavf.c) has the old broken design, and fixing it
would require fixing libavformat, which won't happen so quickly. So we
have to keep that part. But everything above the stream layer is
prepared for a better design, and more sophisticated methods than
mp_cancel_test() could be easily introduced.
There's still one problem: commands are still run in the central
playback loop, which we assume can block on I/O in the worst case.
That's not a problem yet, because we simply mark some commands as being
able to stop playback of the current file ("quit" etc.), so input.c
could abort playback as soon as such a command is queued. But there are
also commands abort playback only conditionally, and the logic for that
is in the playback core and thus "unreachable". For example,
"playlist_next" aborts playback only if there's a next file. We don't
want it to always abort playback.
As a quite ugly hack, abort playback only if at least 2 abort commands
are queued - this pretty much happens only if the core is frozen and
doesn't react to input.
2014-09-13 12:23:08 +00:00
|
|
|
struct stream *stream_create(const char *url, int flags,
|
|
|
|
struct mp_cancel *c, struct mpv_global *global);
|
2013-12-21 19:36:45 +00:00
|
|
|
struct stream *stream_open(const char *filename, struct mpv_global *global);
|
|
|
|
stream_t *open_output_stream(const char *filename, struct mpv_global *global);
|
2011-02-10 10:15:21 +00:00
|
|
|
|
2013-08-02 15:03:30 +00:00
|
|
|
void mp_url_unescape_inplace(char *buf);
|
2013-08-25 20:58:29 +00:00
|
|
|
char *mp_url_escape(void *talloc_ctx, const char *s, const char *ok);
|
2013-08-02 15:03:30 +00:00
|
|
|
|
2019-06-19 14:48:46 +00:00
|
|
|
// stream_memory.c
|
|
|
|
struct stream *stream_memory_open(struct mpv_global *global, void *data, int len);
|
|
|
|
|
2019-06-19 17:24:01 +00:00
|
|
|
// stream_concat.c
|
|
|
|
struct stream *stream_concat_open(struct mpv_global *global, struct mp_cancel *c,
|
|
|
|
struct stream **streams, int num_streams);
|
|
|
|
|
2014-01-08 20:46:42 +00:00
|
|
|
// stream_file.c
|
|
|
|
char *mp_file_url_to_filename(void *talloc_ctx, bstr url);
|
2014-09-25 21:38:23 +00:00
|
|
|
char *mp_file_get_path(void *talloc_ctx, bstr url);
|
2014-01-08 20:46:42 +00:00
|
|
|
|
2014-10-14 19:01:30 +00:00
|
|
|
// stream_lavf.c
|
|
|
|
struct AVDictionary;
|
|
|
|
void mp_setup_av_network_options(struct AVDictionary **dict,
|
|
|
|
struct mpv_global *global,
|
2016-09-06 18:09:56 +00:00
|
|
|
struct mp_log *log);
|
2014-10-14 19:01:30 +00:00
|
|
|
|
2014-06-30 10:49:01 +00:00
|
|
|
void stream_print_proto_list(struct mp_log *log);
|
2015-05-23 13:26:55 +00:00
|
|
|
char **stream_get_proto_list(void);
|
2016-08-07 16:10:05 +00:00
|
|
|
bool stream_has_proto(const char *proto);
|
2014-06-30 10:49:01 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_STREAM_H */
|