From db8cdc73e38c3490389212d94ae9b92dfddd5975 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sat, 28 Jan 2012 13:41:36 +0200 Subject: Update Libav API uses Change various code to use the latest Libav API. The libavcodec error_recognition setting has been removed and replaced with different semantics. I removed the "--lavdopts=er=" option accordingly, as I don't think it's widely enough used to be worth attempting to emulate the old option semantics using the new API. A new option with the new semantics can be added later if needed. Libav dropped APIs that were necessary with all Libav versions until quite recently (like setting avctx->age), and it would thus not be possible to keep compatibility with previous Libav versions without adding workarounds. The new APIs also had some bugs/limitations in the recent Libav release 0.8, and it would not work fully (at least some avcodec options would not be set correctly). Because of those issues, this commit makes no attempt to maintain compatibility with anything but the latest Libav git head. Hopefully the required fixes and improvements will be included in a following Libav point release. --- sub/av_sub.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sub') 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); -- cgit v1.2.3 From fc6a9e4a3e0278e1a1f5c0bf570667306f716fed Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 1 Feb 2012 20:01:16 +0200 Subject: build: switch to libavutil bswap.h and intreadwrite.h Remove the private bswap and intreadwrite.h implementations and use libavutil headers instead. Originally these headers weren't publicly installed by libavutil at all. That already changed in 2010, but the pure C bswap version in installed headers was very inefficient. That was recently (2011-12) improved and now using the public bswap version probably shouldn't cause noticeable performance problems, at least if using a new enough compiler. --- sub/spudec.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sub') diff --git a/sub/spudec.c b/sub/spudec.c index 48e219a930..a871aa3cd9 100644 --- a/sub/spudec.c +++ b/sub/spudec.c @@ -27,9 +27,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "config.h" -#include "mp_msg.h" - #include #include #include @@ -37,12 +34,17 @@ #include #include #include + +#include +#include +#include + +#include "config.h" +#include "mp_msg.h" + #include "libvo/video_out.h" #include "spudec.h" #include "vobsub.h" -#include "libavutil/avutil.h" -#include "ffmpeg_files/intreadwrite.h" -#include "libswscale/swscale.h" #include "mpcommon.h" /* Valid values for spu_aamode: -- cgit v1.2.3