diff options
author | wm4 <wm4@nowhere> | 2019-05-17 18:52:22 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-09-19 20:37:04 +0200 |
commit | 287166b02e284051b6839ba7747e1e1f63364b05 (patch) | |
tree | a7beafa6de6a080c311debaa7214532420d81e7c /demux/demux.c | |
parent | d9cc13f3118acea4314a13b8472f1f37e1c04805 (diff) | |
download | mpv-287166b02e284051b6839ba7747e1e1f63364b05.tar.bz2 mpv-287166b02e284051b6839ba7747e1e1f63364b05.tar.xz |
sub: remove only user of demux_read_packet()
There are 3 packet reading functions in the demux API, which all
function completely differently. One of them, demux_read_packet(), has
only 1 caller, which is in dec_sub.c. Change this caller to use
demux_read_packet_async() instead. Since it really wants to do a
blocking call, setup some proper waiting. This uses mp_dispatch_queue,
because even though it's overkill, it needs the least code.
In practice, waiting actually never happens. This code is only called on
code paths where everything is already read into memory (libavformat's
subtitle demuxers simply behave this way). It's still a bit of a
"coincidence", so implement it properly anyway.
If suubtitle decoder init fails, we still need to unset the demuxer
wakeup callback. Add a sub_destroy() call to the failure path. This also
happens to fix a missed pthread_mutex_destroy() call (in practice this
was a nop, or a memory leak on BSDs).
Diffstat (limited to 'demux/demux.c')
-rw-r--r-- | demux/demux.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/demux/demux.c b/demux/demux.c index e5d7ad27d9..2fbafa9a15 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -1930,7 +1930,7 @@ static struct demux_packet *dequeue_packet(struct demux_stream *ds) // Read a packet from the given stream. The returned packet belongs to the // caller, who has to free it with talloc_free(). Might block. Returns NULL // on EOF. -struct demux_packet *demux_read_packet(struct sh_stream *sh) +static struct demux_packet *demux_read_packet(struct sh_stream *sh) { struct demux_stream *ds = sh ? sh->ds : NULL; if (!ds) |