[MPlayer-cvslog] r36445 - in trunk: fmt-conversion.c libmpcodecs/vd_ffmpeg.c

reimar subversion at mplayerhq.hu
Sun Sep 15 13:29:03 CEST 2013


Author: reimar
Date: Sun Sep 15 13:29:03 2013
New Revision: 36445

Log:
Restore support for old-style VDPAU.

It doesn't work exactly the same way, so testing that I did
not introduce regressions is highly welcome.
To test, change in etc/codecs.conf e.g.
dll h264
back to
dll h264_vdpau.

Modified:
   trunk/fmt-conversion.c
   trunk/libmpcodecs/vd_ffmpeg.c

Modified: trunk/fmt-conversion.c
==============================================================================
--- trunk/fmt-conversion.c	Sat Sep 14 12:57:24 2013	(r36444)
+++ trunk/fmt-conversion.c	Sun Sep 15 13:29:03 2013	(r36445)
@@ -137,6 +137,12 @@ static const struct {
 
     { IMGFMT_XVMC_MOCO_MPEG2, AV_PIX_FMT_XVMC_MPEG2_MC },
     { IMGFMT_XVMC_IDCT_MPEG2, AV_PIX_FMT_XVMC_MPEG2_IDCT },
+    { IMGFMT_VDPAU_MPEG1,     AV_PIX_FMT_VDPAU_MPEG1 },
+    { IMGFMT_VDPAU_MPEG2,     AV_PIX_FMT_VDPAU_MPEG2 },
+    { IMGFMT_VDPAU_H264,      AV_PIX_FMT_VDPAU_H264 },
+    { IMGFMT_VDPAU_WMV3,      AV_PIX_FMT_VDPAU_WMV3 },
+    { IMGFMT_VDPAU_VC1,       AV_PIX_FMT_VDPAU_VC1 },
+    { IMGFMT_VDPAU_MPEG4,     AV_PIX_FMT_VDPAU_MPEG4 },
     { 0,                      AV_PIX_FMT_NONE }
 };
 

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Sat Sep 14 12:57:24 2013	(r36444)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Sun Sep 15 13:29:03 2013	(r36445)
@@ -88,6 +88,7 @@ typedef struct {
     int b_count;
     AVRational last_sample_aspect_ratio;
     int palette_sent;
+    int use_hwaccel;
 } vd_ffmpeg_ctx;
 
 #include "m_option.h"
@@ -282,20 +283,21 @@ static void set_dr_slice_settings(struct
 static void set_format_params(struct AVCodecContext *avctx,
                               enum AVPixelFormat fmt)
 {
+    sh_video_t *sh     = avctx->opaque;
+    vd_ffmpeg_ctx *ctx = sh->context;
     int imgfmt;
     if (fmt == PIX_FMT_NONE)
         return;
+    ctx->use_hwaccel = fmt == AV_PIX_FMT_VDPAU;
     imgfmt = pixfmt2imgfmt2(fmt, avctx->codec_id);
     if (IMGFMT_IS_HWACCEL(imgfmt)) {
-        sh_video_t *sh     = avctx->opaque;
-        vd_ffmpeg_ctx *ctx = sh->context;
         ctx->do_dr1    = 1;
         ctx->nonref_dr = 0;
         avctx->get_buffer      = get_buffer;
         avctx->release_buffer  = release_buffer;
         avctx->reget_buffer    = get_buffer;
         mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedMPEG2);
-        if (IMGFMT_IS_VDPAU(imgfmt)) {
+        if (ctx->use_hwaccel) {
             avctx->draw_horiz_band = NULL;
             avctx->slice_flags = 0;
             ctx->do_slices = 0;
@@ -526,16 +528,22 @@ static void draw_slice(struct AVCodecCon
                         int y, int type, int height){
     mp_image_t *mpi = src->opaque;
     sh_video_t *sh = s->opaque;
+    vd_ffmpeg_ctx *ctx = sh->context;
     uint8_t *source[MP_MAX_PLANES]= {src->data[0] + offset[0], src->data[1] + offset[1], src->data[2] + offset[2]};
     int strides[MP_MAX_PLANES] = {src->linesize[0], src->linesize[1], src->linesize[2]};
     if (!src->data[0]) {
         mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "BUG in FFmpeg, draw_slice called with NULL pointer!\n");
         return;
     }
-    if (mpi && IMGFMT_IS_VDPAU(mpi->imgfmt)) {
+    if (mpi && ctx->use_hwaccel) {
         mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "BUG in FFmpeg, draw_slice called for VDPAU!\n");
         return;
     }
+    if (IMGFMT_IS_VDPAU(mpi->imgfmt)) {
+        struct vdpau_render_state *render = mpi->priv;
+        vdpau_render_wrapper(s, src, &render->info, render->bitstream_buffers_used, render->bitstream_buffers);
+        return;
+    }
     if (height < 0)
     {
         int i;
@@ -704,7 +712,7 @@ static int get_buffer(AVCodecContext *av
         avctx->draw_horiz_band= draw_slice;
     }
 #if CONFIG_VDPAU
-    if (IMGFMT_IS_VDPAU(mpi->imgfmt)) {
+    if (ctx->use_hwaccel) {
         struct vdpau_render_state *render = mpi->priv;
         AVVDPAUContext *vdpc;
         avctx->draw_horiz_band= NULL;


More information about the MPlayer-cvslog mailing list