summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-20 21:08:10 +0100
committerwm4 <wm4@nowhere>2015-02-20 21:08:10 +0100
commit6c1355be967751b194504ed73b053846fbae5fa9 (patch)
tree078c7a52448a2e47fb32e8ed56e67ccf8805acec /player/loadfile.c
parent44411674ebb764adeb806040d24700bc4cc493cc (diff)
downloadmpv-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 'player/loadfile.c')
-rw-r--r--player/loadfile.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index 0d7b732f69..c6f0c137be 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -75,10 +75,8 @@ static void close_unused_demuxers(struct MPContext *mpctx)
goto skip;
}
- struct stream *s = d->stream;
uninit_stream_sub_decoders(d);
- free_demuxer(d);
- free_stream(s);
+ free_demuxer_and_stream(d);
MP_TARRAY_REMOVE_AT(mpctx->sources, mpctx->num_sources, i);
skip:;
@@ -723,10 +721,8 @@ struct track *mp_add_external_file(struct MPContext *mpctx, char *filename,
}
}
if (!first) {
- free_demuxer(demuxer);
- free_stream(stream);
- MP_WARN(mpctx, "No streams added from file %s.\n",
- disp_filename);
+ free_demuxer_and_stream(demuxer);
+ MP_WARN(mpctx, "No streams added from file %s.\n", disp_filename);
goto err_out;
}
@@ -736,8 +732,7 @@ struct track *mp_add_external_file(struct MPContext *mpctx, char *filename,
return first;
err_out:
- MP_ERR(mpctx, "Can not open external file %s.\n",
- disp_filename);
+ MP_ERR(mpctx, "Can not open external file %s.\n", disp_filename);
return false;
}