diff options
author | wm4 <wm4@nowhere> | 2015-02-20 21:08:10 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-02-20 21:08:10 +0100 |
commit | 6c1355be967751b194504ed73b053846fbae5fa9 (patch) | |
tree | 078c7a52448a2e47fb32e8ed56e67ccf8805acec /demux/demux.c | |
parent | 44411674ebb764adeb806040d24700bc4cc493cc (diff) | |
download | mpv-6c1355be967751b194504ed73b053846fbae5fa9.tar.bz2 mpv-6c1355be967751b194504ed73b053846fbae5fa9.tar.xz |
demux: add free_demuxer_and_stream() function
Although their lifetimes are conceptually different, it happens often
that a demuxer is destroyed together with its stream.
Diffstat (limited to 'demux/demux.c')
-rw-r--r-- | demux/demux.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/demux/demux.c b/demux/demux.c index 8af76daa1f..b10b0d6f45 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -245,6 +245,15 @@ void free_demuxer(demuxer_t *demuxer) talloc_free(demuxer); } +void free_demuxer_and_stream(struct demuxer *demuxer) +{ + if (!demuxer) + return; + struct stream *s = demuxer->stream; + free_demuxer(demuxer); + free_stream(s); +} + // Start the demuxer thread, which reads ahead packets on its own. void demux_start_thread(struct demuxer *demuxer) { |