From 7e9fd9351c21071e288d38a103bb5f8482b2b871 Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 16 Feb 2009 20:58:13 +0000 Subject: Add support for VDPAU video out, including hardware decoding. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28617 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_ffmpeg.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index c026ccfc37..a6c9d3716b 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -232,6 +232,8 @@ static int init(sh_video_t *sh){ if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ) ctx->do_dr1=1; + if (lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) + ctx->do_dr1=1; ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64; ctx->ip_count= ctx->b_count= 0; @@ -239,6 +241,13 @@ static int init(sh_video_t *sh){ ctx->avctx = avcodec_alloc_context(); avctx = ctx->avctx; +#if CONFIG_VDPAU + if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){ + avctx->get_format = get_format; + avctx->draw_horiz_band = draw_slice; + avctx->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD; + } +#endif /* CONFIG_VDPAU */ #if CONFIG_XVMC if(lavc_codec->capabilities & CODEC_CAP_HWACCEL){ @@ -545,7 +554,7 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ return avctx->get_buffer(avctx, pic); } - if (IMGFMT_IS_XVMC(ctx->best_csp)) { + if (IMGFMT_IS_XVMC(ctx->best_csp) || IMGFMT_IS_VDPAU(ctx->best_csp)) { type = MP_IMGTYPE_NUMBERED | (0xffff << 16); } else if (!pic->buffer_hints) { @@ -575,6 +584,9 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ avctx->draw_horiz_band= draw_slice; } else avctx->draw_horiz_band= NULL; + if(IMGFMT_IS_VDPAU(mpi->imgfmt)) { + avctx->draw_horiz_band= draw_slice; + } #if CONFIG_XVMC if(IMGFMT_IS_XVMC(mpi->imgfmt)) { struct xvmc_pix_fmt *render = mpi->priv; //same as data[2] @@ -879,7 +891,7 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){ return mpi; } -#if CONFIG_XVMC +#if CONFIG_XVMC || CONFIG_VDPAU static enum PixelFormat get_format(struct AVCodecContext *avctx, const enum PixelFormat *fmt){ enum PixelFormat selected_format = fmt[0]; @@ -889,7 +901,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx, for(i=0;fmt[i]!=PIX_FMT_NONE;i++){ imgfmt = pixfmt2imgfmt(fmt[i]); - if(!IMGFMT_IS_XVMC(imgfmt)) continue; + if(!IMGFMT_IS_XVMC(imgfmt) && !IMGFMT_IS_VDPAU(imgfmt)) continue; mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt, i); if(init_vo(sh, fmt[i]) >= 0) { selected_format = fmt[i]; @@ -897,7 +909,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx, } } imgfmt = pixfmt2imgfmt(selected_format); - if(IMGFMT_IS_XVMC(imgfmt)) { + if(IMGFMT_IS_XVMC(imgfmt) || IMGFMT_IS_VDPAU(imgfmt)) { vd_ffmpeg_ctx *ctx = sh->context; avctx->get_buffer= get_buffer; avctx->release_buffer= release_buffer; -- cgit v1.2.3 From 288f25d8d9130e7515e854d2e65654b8667fb319 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Mon, 16 Feb 2009 23:56:19 +0000 Subject: Fix #endif comment. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28619 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_ffmpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index a6c9d3716b..a857c57a9d 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -922,4 +922,4 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx, return selected_format; } -#endif /* CONFIG_XVMC */ +#endif /* CONFIG_XVMC || CONFIG_VDPAU */ -- cgit v1.2.3 From 53067187b85ef66e7c472517cc308fe0ff29afae Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 17 Feb 2009 03:15:10 +0000 Subject: Move FFmpeg #includes below all others so that they do not override system functions and cause the warning: In file included from libmpcodecs/vf_fspp.c:57: libmpcodecs/mp_image.h: In function 'new_mp_image': libmpcodecs/mp_image.h:214: warning: implicit declaration of function 'please_use_av_malloc' libmpcodecs/mp_image.h: In function 'free_mp_image': libmpcodecs/mp_image.h:226: warning: implicit declaration of function 'please_use_av_free' git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28623 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_fspp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c index cf3aac3768..7d5ea52e14 100644 --- a/libmpcodecs/vf_fspp.c +++ b/libmpcodecs/vf_fspp.c @@ -43,12 +43,6 @@ #include "mp_msg.h" #include "cpudetect.h" -#include "libavutil/internal.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/mem.h" -#include "libavcodec/avcodec.h" -#include "libavcodec/dsputil.h" - #ifdef HAVE_MALLOC_H #include #endif @@ -58,6 +52,12 @@ #include "vf.h" #include "libvo/fastmemcpy.h" +#include "libavutil/internal.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/mem.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/dsputil.h" + #undef free #undef malloc -- cgit v1.2.3 From b14c70b8f5e6a7baf3cc4af16750e5cc85d4dcd4 Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 17 Feb 2009 03:20:40 +0000 Subject: Use FFmpeg instead of MPlayer MANGLE macro, they are equivalent in this particular case. Avoids the warning: In file included from libmpcodecs/vf_fspp.c:693: ./mangle.h:34:1: warning: "MANGLE" redefined In file included from libmpcodecs/vf_fspp.c:46: ./libavutil/internal.h:113:1: warning: this is the location of the previous definition git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28624 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_fspp.c | 1 - 1 file changed, 1 deletion(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c index 7d5ea52e14..aef35ec835 100644 --- a/libmpcodecs/vf_fspp.c +++ b/libmpcodecs/vf_fspp.c @@ -690,7 +690,6 @@ const vf_info_t vf_info_fspp = { //Specific spp's dct, idct and threshold functions //I'd prefer to have them in the separate file. -#include "mangle.h" //#define MANGLE(a) #a //typedef int16_t DCTELEM; //! only int16_t -- cgit v1.2.3 From be8c67909b4bb6bedf014706a53abef10ddb5a52 Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 17 Feb 2009 11:16:19 +0000 Subject: Convert HAVE_MALLOC_H into a 0/1 definition, fixes the warning: mem.c:32:5: warning: "HAVE_MALLOC_H" is not defined git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28629 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/dec_audio.c | 2 +- libmpcodecs/dec_video.c | 2 +- libmpcodecs/mp_image.c | 2 +- libmpcodecs/vd.c | 2 +- libmpcodecs/vf.c | 2 +- libmpcodecs/vf_boxblur.c | 2 +- libmpcodecs/vf_delogo.c | 2 +- libmpcodecs/vf_denoise3d.c | 2 +- libmpcodecs/vf_fspp.c | 2 +- libmpcodecs/vf_hqdn3d.c | 2 +- libmpcodecs/vf_il.c | 2 +- libmpcodecs/vf_kerndeint.c | 2 +- libmpcodecs/vf_mcdeint.c | 2 +- libmpcodecs/vf_noise.c | 2 +- libmpcodecs/vf_ow.c | 2 +- libmpcodecs/vf_perspective.c | 2 +- libmpcodecs/vf_pp.c | 2 +- libmpcodecs/vf_pp7.c | 2 +- libmpcodecs/vf_qp.c | 2 +- libmpcodecs/vf_sab.c | 2 +- libmpcodecs/vf_screenshot.c | 2 +- libmpcodecs/vf_smartblur.c | 2 +- libmpcodecs/vf_spp.c | 2 +- libmpcodecs/vf_swapuv.c | 2 +- libmpcodecs/vf_unsharp.c | 2 +- libmpcodecs/vf_uspp.c | 2 +- libmpcodecs/vf_yadif.c | 2 +- 27 files changed, 27 insertions(+), 27 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/dec_audio.c b/libmpcodecs/dec_audio.c index 947b47bbfc..79073d03e3 100644 --- a/libmpcodecs/dec_audio.c +++ b/libmpcodecs/dec_audio.c @@ -19,7 +19,7 @@ #include "libaf/af.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index 59c67b83db..f158d7eddf 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -2,7 +2,7 @@ #include "config.h" #include -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif #include diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c index 809acce221..fd1b3c3997 100644 --- a/libmpcodecs/mp_image.c +++ b/libmpcodecs/mp_image.c @@ -5,7 +5,7 @@ #include #include -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index 67f6b3e7e0..3f9241766d 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -6,7 +6,7 @@ #include "mp_msg.h" #include "help_mp.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index 2371b0fdff..632e4381a9 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -3,7 +3,7 @@ #include #include "config.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_boxblur.c b/libmpcodecs/vf_boxblur.c index b27b1a6d01..f322619104 100644 --- a/libmpcodecs/vf_boxblur.c +++ b/libmpcodecs/vf_boxblur.c @@ -27,7 +27,7 @@ #include "config.h" #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_delogo.c b/libmpcodecs/vf_delogo.c index 2afa0afc33..3ab2ab5f8f 100644 --- a/libmpcodecs/vf_delogo.c +++ b/libmpcodecs/vf_delogo.c @@ -30,7 +30,7 @@ #include "mp_msg.h" #include "cpudetect.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_denoise3d.c b/libmpcodecs/vf_denoise3d.c index 090f89674a..6899045611 100644 --- a/libmpcodecs/vf_denoise3d.c +++ b/libmpcodecs/vf_denoise3d.c @@ -27,7 +27,7 @@ #include "config.h" #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c index aef35ec835..5acdfb3602 100644 --- a/libmpcodecs/vf_fspp.c +++ b/libmpcodecs/vf_fspp.c @@ -43,7 +43,7 @@ #include "mp_msg.h" #include "cpudetect.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_hqdn3d.c b/libmpcodecs/vf_hqdn3d.c index 4e737d73ec..e0b6f78bb1 100644 --- a/libmpcodecs/vf_hqdn3d.c +++ b/libmpcodecs/vf_hqdn3d.c @@ -27,7 +27,7 @@ #include "config.h" #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_il.c b/libmpcodecs/vf_il.c index 63626aa469..cd6ba0490b 100644 --- a/libmpcodecs/vf_il.c +++ b/libmpcodecs/vf_il.c @@ -27,7 +27,7 @@ #include "config.h" #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_kerndeint.c b/libmpcodecs/vf_kerndeint.c index 9fa0df255b..ac51acfb3b 100644 --- a/libmpcodecs/vf_kerndeint.c +++ b/libmpcodecs/vf_kerndeint.c @@ -28,7 +28,7 @@ #include "config.h" #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_mcdeint.c b/libmpcodecs/vf_mcdeint.c index 81b70f58d7..aae4872537 100644 --- a/libmpcodecs/vf_mcdeint.c +++ b/libmpcodecs/vf_mcdeint.c @@ -65,7 +65,7 @@ Known Issues: #undef free #undef malloc -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_noise.c b/libmpcodecs/vf_noise.c index 4704e8fa1b..eabfd5c16a 100644 --- a/libmpcodecs/vf_noise.c +++ b/libmpcodecs/vf_noise.c @@ -28,7 +28,7 @@ #include "mp_msg.h" #include "cpudetect.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_ow.c b/libmpcodecs/vf_ow.c index 8c1f8f1c48..59c4e22852 100644 --- a/libmpcodecs/vf_ow.c +++ b/libmpcodecs/vf_ow.c @@ -36,7 +36,7 @@ #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_perspective.c b/libmpcodecs/vf_perspective.c index 8ef90d9b5a..714763c7cc 100644 --- a/libmpcodecs/vf_perspective.c +++ b/libmpcodecs/vf_perspective.c @@ -28,7 +28,7 @@ #include "config.h" #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c index c538ee17f4..3566853770 100644 --- a/libmpcodecs/vf_pp.c +++ b/libmpcodecs/vf_pp.c @@ -8,7 +8,7 @@ #include "mp_msg.h" #include "cpudetect.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_pp7.c b/libmpcodecs/vf_pp7.c index 88b9d9261d..e986765416 100644 --- a/libmpcodecs/vf_pp7.c +++ b/libmpcodecs/vf_pp7.c @@ -30,7 +30,7 @@ #include "mp_msg.h" #include "cpudetect.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_qp.c b/libmpcodecs/vf_qp.c index bbce77e5b0..8a345a9f03 100644 --- a/libmpcodecs/vf_qp.c +++ b/libmpcodecs/vf_qp.c @@ -36,7 +36,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/eval.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_sab.c b/libmpcodecs/vf_sab.c index 676b4bf4b0..c78f8ea9ec 100644 --- a/libmpcodecs/vf_sab.c +++ b/libmpcodecs/vf_sab.c @@ -27,7 +27,7 @@ #include "config.h" #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_screenshot.c b/libmpcodecs/vf_screenshot.c index 9d6b48d5bf..b8c6c0a1b5 100644 --- a/libmpcodecs/vf_screenshot.c +++ b/libmpcodecs/vf_screenshot.c @@ -2,7 +2,7 @@ #include #include -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif #include diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c index 1ca1cbac26..7003f75c95 100644 --- a/libmpcodecs/vf_smartblur.c +++ b/libmpcodecs/vf_smartblur.c @@ -27,7 +27,7 @@ #include "config.h" #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c index f1071bf5d6..ebce63601f 100644 --- a/libmpcodecs/vf_spp.c +++ b/libmpcodecs/vf_spp.c @@ -46,7 +46,7 @@ #undef free #undef malloc -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_swapuv.c b/libmpcodecs/vf_swapuv.c index f9a65ae6b1..db32686c40 100644 --- a/libmpcodecs/vf_swapuv.c +++ b/libmpcodecs/vf_swapuv.c @@ -27,7 +27,7 @@ #include "config.h" #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_unsharp.c b/libmpcodecs/vf_unsharp.c index d5deebfafb..fcbbbaf0f4 100644 --- a/libmpcodecs/vf_unsharp.c +++ b/libmpcodecs/vf_unsharp.c @@ -28,7 +28,7 @@ #include "mp_msg.h" #include "cpudetect.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_uspp.c b/libmpcodecs/vf_uspp.c index a5882ffeca..57186698c7 100644 --- a/libmpcodecs/vf_uspp.c +++ b/libmpcodecs/vf_uspp.c @@ -32,7 +32,7 @@ #include "libavcodec/avcodec.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c index 5a36b3caea..d834784147 100644 --- a/libmpcodecs/vf_yadif.c +++ b/libmpcodecs/vf_yadif.c @@ -29,7 +29,7 @@ #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include #endif -- cgit v1.2.3 From 687655ff2f2c64593f713ea666cc85a47b6c332b Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 17 Feb 2009 11:29:43 +0000 Subject: cosmetics: Remove stray empty lines. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28630 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_ffmpeg.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index a857c57a9d..abff4aff7f 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -249,7 +249,6 @@ static int init(sh_video_t *sh){ } #endif /* CONFIG_VDPAU */ #if CONFIG_XVMC - if(lavc_codec->capabilities & CODEC_CAP_HWACCEL){ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedCodec); assert(ctx->do_dr1);//these are must to! @@ -921,5 +920,4 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx, } return selected_format; } - #endif /* CONFIG_XVMC || CONFIG_VDPAU */ -- cgit v1.2.3 From 8e5edec13eabc42923bc119f435566145955c124 Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 17 Feb 2009 16:40:50 +0000 Subject: Set avctx->opaque already at init instead of decode so it can be used in get_format and get_buffer would not crash if called during avcodec_open. Patch by Gwenole Beauchesne [gbeauchesne splitted-desktop com] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28636 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_ffmpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index abff4aff7f..d8a7060434 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -240,6 +240,7 @@ static int init(sh_video_t *sh){ ctx->pic = avcodec_alloc_frame(); ctx->avctx = avcodec_alloc_context(); avctx = ctx->avctx; + avctx->opaque = sh; #if CONFIG_VDPAU if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){ @@ -744,7 +745,6 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){ //ffmpeg interlace (mpeg2) bug have been fixed. no need of -noslices if (!dr1) avctx->draw_horiz_band=NULL; - avctx->opaque=sh; if(ctx->vo_initialized && !(flags&3) && !dr1){ mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE | (ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0), -- cgit v1.2.3 From bdfef5ff392daf50ea5943608554b9c47e402b2a Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 17 Feb 2009 18:59:47 +0000 Subject: Print an error and return NULL in vf_get_image if we try to allocate a format with bpp == 0, since this can not work. This way at least we crash earlier and print an error message. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28637 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index 632e4381a9..ad72f304d3 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -320,7 +320,6 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, // keep buffer allocation status & color flags only: // mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT); mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS; - mpi->flags |= MP_IMGFLAG_IN_USE; // accept restrictions & draw_slice flags only: mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK); if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; @@ -347,6 +346,11 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, if(!(mpi->flags&MP_IMGFLAG_DIRECT)){ // non-direct and not yet allocated image. allocate it! + if (!mpi->bpp) { // no way we can allocate this + mp_msg(MSGT_DECVIDEO, MSGL_FATAL, + "vf_get_image: Tried to allocate a format that can not be allocated!\n"); + return NULL; + } // check if codec prefer aligned stride: if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){ @@ -427,6 +431,7 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, mpi->qscale = NULL; } + mpi->flags |= MP_IMGFLAG_IN_USE; // printf("\rVF_MPI: %p %p %p %d %d %d \n", // mpi->planes[0],mpi->planes[1],mpi->planes[2], // mpi->stride[0],mpi->stride[1],mpi->stride[2]); -- cgit v1.2.3 From 4f9a9ae44f21fad6bdc8b9f27744ffd397de8963 Mon Sep 17 00:00:00 2001 From: reimar Date: Tue, 17 Feb 2009 19:01:29 +0000 Subject: Make it possible for mpcodecs_get_image to return NULL as the documentation says it should instead of crashing. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28638 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index 3f9241766d..4ebb01e179 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -341,7 +341,7 @@ csp_again: // Note: buffer allocation may be moved to mpcodecs_config_vo() later... mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h){ mp_image_t* mpi=vf_get_image(sh->vfilter,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h); - mpi->x=mpi->y=0; + if (mpi) mpi->x=mpi->y=0; return mpi; } -- cgit v1.2.3