summaryrefslogtreecommitdiffstats
path: root/sub/av_sub.c
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-03-05 22:24:57 +0100
committerwm4 <wm4@mplayer2.org>2012-03-05 22:24:57 +0100
commit8dc0743571630a08fd40fa88aa09b12b4ce65bf2 (patch)
treee1c4465768635d77954b5fd21ae726444ee4f48a /sub/av_sub.c
parentaebdf4f153438497b9310bd1417b5216f07e043b (diff)
parentafecdb681bed81b5df0ed18a300c68be603dfdf9 (diff)
downloadmpv-8dc0743571630a08fd40fa88aa09b12b4ce65bf2.tar.bz2
mpv-8dc0743571630a08fd40fa88aa09b12b4ce65bf2.tar.xz
Merge remote-tracking branch 'origin/master' into my_master
Conflicts: mplayer.c screenshot.c
Diffstat (limited to 'sub/av_sub.c')
-rw-r--r--sub/av_sub.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sub/av_sub.c b/sub/av_sub.c
index 0d8c14db60..3a9e1b4f26 100644
--- a/sub/av_sub.c
+++ b/sub/av_sub.c
@@ -63,9 +63,14 @@ int decode_avsub(struct sh_sub *sh, uint8_t *data, int size,
pkt.convergence_duration = duration * 1000;
if (!ctx) {
AVCodec *sub_codec;
- ctx = avcodec_alloc_context();
sub_codec = avcodec_find_decoder(cid);
- if (!ctx || !sub_codec || avcodec_open(ctx, sub_codec) < 0) {
+ if (!sub_codec)
+ goto error;
+ ctx = avcodec_alloc_context3(sub_codec);
+ if (!ctx)
+ goto error;
+ if (avcodec_open2(ctx, sub_codec, NULL) < 0) {
+ error:
mp_msg(MSGT_SUBREADER, MSGL_FATAL,
"Could not open subtitle decoder\n");
av_freep(&ctx);