diff options
Diffstat (limited to 'libmpcodecs')
-rw-r--r-- | libmpcodecs/dec_audio.c | 2 | ||||
-rw-r--r-- | libmpcodecs/dec_video.c | 2 | ||||
-rw-r--r-- | libmpcodecs/mp_image.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vd.c | 3 | ||||
-rw-r--r-- | libmpcodecs/vd_ffmpeg.c | 26 | ||||
-rw-r--r-- | libmpcodecs/vf.c | 9 | ||||
-rw-r--r-- | libmpcodecs/vf_boxblur.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_delogo.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_denoise3d.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_fspp.c | 15 | ||||
-rw-r--r-- | libmpcodecs/vf_hqdn3d.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_il.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_kerndeint.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_mcdeint.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_noise.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_ow.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_perspective.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_pp.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_pp7.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_qp.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_sab.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_screenshot.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_smartblur.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_spp.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_swapuv.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_unsharp.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_uspp.c | 2 | ||||
-rw-r--r-- | libmpcodecs/vf_yadif.c | 2 |
28 files changed, 58 insertions, 43 deletions
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 <malloc.h> #endif diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index 49ee002bf4..7faf2ac396 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -2,7 +2,7 @@ #include "options.h" #include <stdio.h> -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include <malloc.h> #endif #include <stdlib.h> 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 <stdlib.h> #include <string.h> -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include <malloc.h> #endif diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index 86b9f0c511..22bdddc909 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -336,7 +336,8 @@ mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, 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; } diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 9e3aae2d08..c70da3a9f3 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -215,15 +215,24 @@ 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; 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){ + 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){ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedCodec); assert(ctx->do_dr1);//these are must to! @@ -529,7 +538,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) { @@ -559,6 +568,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] @@ -718,7 +730,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), @@ -864,7 +875,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]; @@ -874,7 +885,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]; @@ -882,7 +893,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; @@ -894,5 +905,4 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx, } return selected_format; } - -#endif /* CONFIG_XVMC */ +#endif /* CONFIG_XVMC || CONFIG_VDPAU */ diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c index c2b88b5584..445e631c21 100644 --- a/libmpcodecs/vf.c +++ b/libmpcodecs/vf.c @@ -3,7 +3,7 @@ #include <string.h> #include "config.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include <malloc.h> #endif @@ -319,7 +319,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; @@ -346,6 +345,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){ @@ -426,6 +430,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]); diff --git a/libmpcodecs/vf_boxblur.c b/libmpcodecs/vf_boxblur.c index bad900f45c..58d6c42f18 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_delogo.c b/libmpcodecs/vf_delogo.c index 666a5b8690..c9ce73c9cd 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_denoise3d.c b/libmpcodecs/vf_denoise3d.c index 12bf22f5a2..7451715012 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c index 5ba6188d15..a72699d2d2 100644 --- a/libmpcodecs/vf_fspp.c +++ b/libmpcodecs/vf_fspp.c @@ -43,13 +43,7 @@ #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 +#if HAVE_MALLOC_H #include <malloc.h> #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 @@ -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 diff --git a/libmpcodecs/vf_hqdn3d.c b/libmpcodecs/vf_hqdn3d.c index 4764c32077..cfd491503b 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_il.c b/libmpcodecs/vf_il.c index 089b14684e..b37c50a66c 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_kerndeint.c b/libmpcodecs/vf_kerndeint.c index cdc26883eb..f90f430315 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_mcdeint.c b/libmpcodecs/vf_mcdeint.c index 6983aa5163..1c589847aa 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_noise.c b/libmpcodecs/vf_noise.c index aab612c2b8..f797121973 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_ow.c b/libmpcodecs/vf_ow.c index 74f546b082..d2717e130a 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_perspective.c b/libmpcodecs/vf_perspective.c index fd7fe4885d..e99c8dbf6e 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c index c910595c4a..1012112660 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_pp7.c b/libmpcodecs/vf_pp7.c index 31d6d653b4..fed2b83fae 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_qp.c b/libmpcodecs/vf_qp.c index 98aeab7535..4287ed66bc 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_sab.c b/libmpcodecs/vf_sab.c index 61a5a7bc32..5074e45b3e 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_screenshot.c b/libmpcodecs/vf_screenshot.c index 8471285345..cded6ad1dd 100644 --- a/libmpcodecs/vf_screenshot.c +++ b/libmpcodecs/vf_screenshot.c @@ -2,7 +2,7 @@ #include <stdio.h> #include <stdlib.h> -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include <malloc.h> #endif #include <string.h> diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c index 82265416cc..78ab70a6ce 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c index aa18534966..a18df801a3 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_swapuv.c b/libmpcodecs/vf_swapuv.c index d466e2154e..e25e744daf 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_unsharp.c b/libmpcodecs/vf_unsharp.c index 9f2a7d4b98..d4db10248a 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_uspp.c b/libmpcodecs/vf_uspp.c index a0fca1503b..e1e6a443c4 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 <malloc.h> #endif diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c index 6f324dc4fa..828ca29dd7 100644 --- a/libmpcodecs/vf_yadif.c +++ b/libmpcodecs/vf_yadif.c @@ -30,7 +30,7 @@ #include "mp_msg.h" -#ifdef HAVE_MALLOC_H +#if HAVE_MALLOC_H #include <malloc.h> #endif |