diff options
-rw-r--r-- | contrib/ffmpeg/module.defs | 2 | ||||
-rw-r--r-- | libhb/decavcodec.c | 5 | ||||
-rw-r--r-- | libhb/decmpeg2.c | 5 | ||||
-rw-r--r-- | libhb/hb.c | 43 | ||||
-rw-r--r-- | libhb/hbffmpeg.h | 4 | ||||
-rw-r--r-- | libhb/render.c | 4 |
6 files changed, 50 insertions, 13 deletions
diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs index bca90571f..9222b8ccc 100644 --- a/contrib/ffmpeg/module.defs +++ b/contrib/ffmpeg/module.defs @@ -1,7 +1,7 @@ $(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,BZIP2 FAAD2 ZLIB)) $(eval $(call import.CONTRIB.defs,FFMPEG)) -FFMPEG.FETCH.url = http://download.m0k.org/handbrake/contrib/ffmpeg-r25082.tar.bz2 +FFMPEG.FETCH.url = http://download.m0k.org/handbrake/contrib/ffmpeg-r25374.tar.bz2 FFMPEG.CONFIGURE.deps = FFMPEG.CONFIGURE.env = diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index bbdd4d668..019f595b1 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -510,10 +510,9 @@ static hb_buffer_t *copy_frame( hb_work_private_t *pv, AVFrame *frame ) if ( ! pv->sws_context ) { - pv->sws_context = sws_getContext( context->width, context->height, context->pix_fmt, + pv->sws_context = hb_sws_get_context( context->width, context->height, context->pix_fmt, w, h, PIX_FMT_YUV420P, - SWS_LANCZOS|SWS_ACCURATE_RND, - NULL, NULL, NULL ); + SWS_LANCZOS|SWS_ACCURATE_RND); } sws_scale( pv->sws_context, frame->data, frame->linesize, 0, h, dstpic.data, dstpic.linesize ); diff --git a/libhb/decmpeg2.c b/libhb/decmpeg2.c index 63f2ebb40..3beef06d1 100644 --- a/libhb/decmpeg2.c +++ b/libhb/decmpeg2.c @@ -291,10 +291,9 @@ static hb_buffer_t *hb_copy_frame( hb_job_t *job, int width, int height, memcpy( in.data[1], u, src_wh >> 2 ); memcpy( in.data[2], v, src_wh >> 2 ); } - struct SwsContext *context = sws_getContext( width, height, pixfmt, + struct SwsContext *context = hb_sws_get_context( width, height, pixfmt, dst_w, dst_h, PIX_FMT_YUV420P, - SWS_LANCZOS|SWS_ACCURATE_RND, - NULL, NULL, NULL ); + SWS_LANCZOS|SWS_ACCURATE_RND); sws_scale( context, in.data, in.linesize, 0, height, out.data, out.linesize ); sws_freeContext( context ); diff --git a/libhb/hb.c b/libhb/hb.c index e26c8e659..49f1cb9e6 100644 --- a/libhb/hb.c +++ b/libhb/hb.c @@ -91,6 +91,41 @@ int hb_av_find_stream_info(AVFormatContext *ic) return ret; } +struct SwsContext* +hb_sws_get_context(int srcW, int srcH, enum PixelFormat srcFormat, + int dstW, int dstH, enum PixelFormat dstFormat, + int flags) +{ + struct SwsContext * ctx; + +#if 0 + // sws_getContext is being depricated. But it appears that + // the new method isn't quite wrung out yet. So when it is + // this code should be fixed up and enabled. + ctx = sws_alloc_context(); + if ( ctx ) + { + av_set_int(ctx, "srcw", srcW); + av_set_int(ctx, "srch", srcH); + av_set_int(ctx, "src_format", srcFormat); + av_set_int(ctx, "dstw", dstW); + av_set_int(ctx, "dsth", dstH); + av_set_int(ctx, "dst_format", dstFormat); + av_set_int(ctx, "sws_flags", flags); + + if (sws_init_context(ctx, NULL, NULL) < 0) { + fprintf(stderr, "Cannot initialize resampling context\n"); + sws_freeContext(ctx); + ctx = NULL; + } + } +#else + ctx = sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, + flags, NULL, NULL, NULL); +#endif + return ctx; +} + int hb_avcodec_close(AVCodecContext *avctx) { int ret; @@ -665,11 +700,11 @@ void hb_get_preview( hb_handle_t * h, hb_title_t * title, int picture, } // Get scaling context - context = sws_getContext(title->width - (job->crop[2] + job->crop[3]), + context = hb_sws_get_context(title->width - (job->crop[2] + job->crop[3]), title->height - (job->crop[0] + job->crop[1]), PIX_FMT_YUV420P, job->width, job->height, PIX_FMT_YUV420P, - swsflags, NULL, NULL, NULL); + swsflags); // Scale sws_scale(context, @@ -681,9 +716,9 @@ void hb_get_preview( hb_handle_t * h, hb_title_t * title, int picture, sws_freeContext( context ); // Get preview context - context = sws_getContext(rgb_width, job->height, PIX_FMT_YUV420P, + context = hb_sws_get_context(rgb_width, job->height, PIX_FMT_YUV420P, rgb_width, job->height, PIX_FMT_RGB32, - swsflags, NULL, NULL, NULL); + swsflags); // Create preview sws_scale(context, diff --git a/libhb/hbffmpeg.h b/libhb/hbffmpeg.h index 8a7dc90fe..9953aa7ba 100644 --- a/libhb/hbffmpeg.h +++ b/libhb/hbffmpeg.h @@ -11,3 +11,7 @@ int hb_avcodec_open( AVCodecContext *, struct AVCodec * ); int hb_avcodec_close( AVCodecContext * ); int hb_av_find_stream_info(AVFormatContext *ic); int hb_ff_layout_xlat(int64_t ff_layout, int channels); +struct SwsContext* +hb_sws_get_context(int srcW, int srcH, enum PixelFormat srcFormat, + int dstW, int dstH, enum PixelFormat dstFormat, + int flags); diff --git a/libhb/render.c b/libhb/render.c index 98bc7fea3..8c7e9a2d8 100644 --- a/libhb/render.c +++ b/libhb/render.c @@ -721,11 +721,11 @@ int renderInit( hb_work_object_t * w, hb_job_t * job ) if( job->crop[0] || job->crop[1] || job->crop[2] || job->crop[3] || job->width != title->width || job->height != title->height ) { - pv->context = sws_getContext(title->width - (job->crop[2] + job->crop[3]), + pv->context = hb_sws_get_context(title->width - (job->crop[2] + job->crop[3]), title->height - (job->crop[0] + job->crop[1]), PIX_FMT_YUV420P, job->width, job->height, PIX_FMT_YUV420P, - swsflags, NULL, NULL, NULL); + swsflags); } /* Setup FIFO queue for subtitle cache */ |