summaryrefslogtreecommitdiffstats
path: root/core/mplayer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-15 20:22:41 +0100
committerwm4 <wm4@nowhere>2012-11-16 21:21:15 +0100
commitdd7dc2ee3d060d77dbafb3182127eb1a59c2d79f (patch)
tree0cb31fc3cd28975a11faf161f2eac6a8d1f7e7fb /core/mplayer.c
parent25a098fe78ad2aee0ad7e18f8d4326e5cd29aeb1 (diff)
downloadmpv-dd7dc2ee3d060d77dbafb3182127eb1a59c2d79f.tar.bz2
mpv-dd7dc2ee3d060d77dbafb3182127eb1a59c2d79f.tar.xz
subreader: replace sub_free() by talloc destructor
Makes it less annoying to free the sub_data.
Diffstat (limited to 'core/mplayer.c')
-rw-r--r--core/mplayer.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index d632bf5615..560733e6ab 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -530,10 +530,7 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask)
if (mask & INITIALIZED_DEMUXER) {
mpctx->initialized_flags &= ~INITIALIZED_DEMUXER;
for (int i = 0; i < mpctx->num_tracks; i++) {
- struct track *track = mpctx->tracks[i];
- sub_free(track->subdata);
- talloc_free(track->sh_sub);
- talloc_free(track);
+ talloc_free(mpctx->tracks[i]);
}
mpctx->num_tracks = 0;
for (int t = 0; t < STREAM_TYPE_COUNT; t++)
@@ -965,7 +962,7 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps,
subd = sub_read_file(filename, fps, &mpctx->opts);
if (subd) {
asst = mp_ass_read_subdata(mpctx->ass_library, opts, subd, fps);
- sub_free(subd);
+ talloc_free(subd);
subd = NULL;
}
}
@@ -989,8 +986,8 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps,
.user_tid = find_new_tid(mpctx, STREAM_SUB),
.demuxer_id = -1,
.is_external = true,
- .sh_sub = sh,
- .subdata = subd,
+ .sh_sub = talloc_steal(track, sh),
+ .subdata = talloc_steal(track, subd),
};
MP_TARRAY_APPEND(mpctx, mpctx->tracks, mpctx->num_tracks, track);
}