[MPlayer-cvslog] r37454 - in trunk: etc/codecs.conf fmt-conversion.c libmpcodecs/img_format.h libmpcodecs/vd_ffmpeg.c libvo/vo_vdpau.c

rtogni subversion at mplayerhq.hu
Sun Aug 23 22:38:07 CEST 2015


Author: rtogni
Date: Sun Aug 23 22:38:07 2015
New Revision: 37454

Log:
Remove last traces of old ffmpeg vdpau api

Main patch by Philip Langdale  philipl overt org
Small changes and codecs.conf by me

Modified:
   trunk/etc/codecs.conf
   trunk/fmt-conversion.c
   trunk/libmpcodecs/img_format.h
   trunk/libmpcodecs/vd_ffmpeg.c
   trunk/libvo/vo_vdpau.c

Modified: trunk/etc/codecs.conf
==============================================================================
--- trunk/etc/codecs.conf	Sun Aug 23 22:32:50 2015	(r37453)
+++ trunk/etc/codecs.conf	Sun Aug 23 22:38:07 2015	(r37454)
@@ -564,39 +564,6 @@ videocodec ffmpeg12vdpau
   out VDPAU_MPEG1
   out VDPAU_MPEG2
 
-videocodec ffmpeg12vdpauold
-  info "FFmpeg MPEG-1/2 (VDPAU)"
-  status working
-  format 0x10000001  ; MPEG-1
-  format 0x10000002  ; MPEG-2
-  fourcc mpg1,mpg2,MPG2
-  fourcc PIM1        ; Pinnacle hardware-MPEG-1
-  fourcc PIM2        ; Pinnacle hardware-MPEG-2
-  fourcc "DVR "
-  fourcc hdv2
-  fourcc MPEG
-  fourcc hdv1
-  fourcc hdv3        ; HDV 1080i50
-  fourcc hdv5        ; HDV  720p25
-  fourcc mx5p        ; MPEG IMX 625/50 (50 Mb/s)
-  fourcc hdv6,hdv7,hdv8
-  fourcc xdv1,xdv2,xdv3
-  fourcc xdv4,xdv5,xdv6
-  fourcc xdv7,xdv8,xdv9
-  fourcc xdva,xdvb,xdvc
-  fourcc xdvd,xdve,xdvf
-  fourcc mx5n,mx4n,mx4p
-  fourcc mx3n,mx3p
-  fourcc AVmp
-  fourcc mp2v,mpgv
-  fourcc LMP2 ; Lead mpeg2 in avi
-  fourcc m2v1,m1v1
-  fourcc "m1v "
-  driver ffmpeg
-  dll "mpegvideo_vdpau"
-  out VDPAU_MPEG1
-  out VDPAU_MPEG2
-
 videocodec ffmpeg2crystalhd
   info "FFmpeg MPEG-2 (CrystalHD)"
   status working
@@ -1310,14 +1277,6 @@ videocodec ffwmv3vdpau
   dll wmv3
   out VDPAU_WMV3
 
-videocodec ffwmv3vdpauold
-  info "FFmpeg WMV3/WMV9 (VDPAU)"
-  status buggy
-  fourcc WMV3,wmv3
-  driver ffmpeg
-  dll wmv3_vdpau
-  out VDPAU_WMV3
-
 videocodec ffwmv3crystalhd
   info "FFmpeg WMV3/WMV9 (CrystalHD)"
   status buggy
@@ -1344,15 +1303,6 @@ videocodec ffvc1vdpau
   dll vc1
   out VDPAU_VC1
 
-videocodec ffvc1vdpauold
-  info "FFmpeg WVC1 (VDPAU)"
-  status buggy
-  fourcc WVC1,wvc1,WMVA
-  fourcc vc-1,VC-1
-  driver ffmpeg
-  dll vc1_vdpau
-  out VDPAU_VC1
-
 videocodec ffvc1crystalhd
   info "FFmpeg WVC1 (CrystalHD)"
   status buggy
@@ -1453,26 +1403,6 @@ videocodec ffh264vdpau
   dll h264
   out VDPAU_H264
 
-videocodec ffh264vdpauold
-  info "FFmpeg H.264 (VDPAU)"
-  status working
-  fourcc H264,h264
-  fourcc X264,x264
-  fourcc avc1,AVC1
-  fourcc davc,DAVC
-  fourcc ai1p,ai1q,ai12,ai13
-  fourcc ai15,ai16
-  fourcc ai5p,ai5q,ai52,ai53
-  fourcc ai55,ai56
-  fourcc x3eV
-  fourcc Q264,V264
-  fourcc GAVC,UMSV
-  fourcc rv64 ; Radvision
-  format 0x10000005
-  driver ffmpeg
-  dll h264_vdpau
-  out VDPAU_H264
-
 videocodec ffh264crystalhd
   info "FFmpeg H.264 (CrystalHD)"
   status working
@@ -1616,42 +1546,6 @@ videocodec ffodivxvdpau
   dll mpeg4
   out VDPAU_MPEG4
 
-videocodec ffodivxvdpauold
-  info "FFmpeg MPEG-4,DIVX-4/5 (VDPAU)"
-  status working
-  fourcc FMP4,fmp4
-  fourcc DIVX,divx
-  fourcc DIV1,div1 divx
-  fourcc MP4S,mp4s ; ISO MPEG-4 Video V1
-  fourcc M4S2,m4s2
-  fourcc xvid,XVID,XviD,XVIX
-  fourcc DX50,dx50,BLZ0 DX50
-  fourcc mp4v,MP4V
-  format 0x4
-  fourcc UMP4
-  fourcc RMP4
-  fourcc 3IV2,3iv2  ; 3ivx Delta 4
-  fourcc DXGM
-  fourcc SEDG ; diskless camcorder Samsung Miniket VP-M110
-  fourcc SMP4,smp4 ; Samsung SMP4 video codec
-  fourcc VIDM ; vidm 4.01 codec
-  format 0x10000004  ; mpeg 4 es
-  fourcc m4cc,M4CC
-  fourcc hdx4,HDX4
-  fourcc FVFW,fvfw
-  fourcc FFDS
-  fourcc DCOD,MVXM,EM4A,PM4V
-  fourcc M4T3,DMK2,DIGI,INMC
-  fourcc EPHV,SN40,WAWV
-  fourcc uldx,ULDX,VSPX
-  fourcc SIPP ; Samsung SHR-6040
-  fourcc DreX,DM4V,LMP4,DP02
-  fourcc QMP4
-  fourcc DYM4
-  driver ffmpeg
-  dll mpeg4_vdpau
-  out VDPAU_MPEG4
-
 videocodec ffodivxcrystalhd
   info "FFmpeg MPEG-4,DIVX-4/5 (CrystalHD)"
   status working

Modified: trunk/fmt-conversion.c
==============================================================================
--- trunk/fmt-conversion.c	Sun Aug 23 22:32:50 2015	(r37453)
+++ trunk/fmt-conversion.c	Sun Aug 23 22:38:07 2015	(r37454)
@@ -137,12 +137,6 @@ static const struct {
     { IMGFMT_444P,       AV_PIX_FMT_YUVJ444P },
     { IMGFMT_440P,       AV_PIX_FMT_YUVJ440P },
     { IMGFMT_XVMC_IDCT_MPEG2, AV_PIX_FMT_XVMC },
-    { 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/img_format.h
==============================================================================
--- trunk/libmpcodecs/img_format.h	Sun Aug 23 22:32:50 2015	(r37453)
+++ trunk/libmpcodecs/img_format.h	Sun Aug 23 22:38:07 2015	(r37454)
@@ -20,6 +20,9 @@
 #define MPLAYER_IMG_FORMAT_H
 
 #include "config.h"
+#ifdef CONFIG_VDPAU
+#include <vdpau/vdpau.h>
+#endif
 
 /* RGB/BGR Formats */
 
@@ -302,7 +305,7 @@ typedef struct {
 } vo_mpegpes_t;
 
 struct vdpau_frame_data {
-    struct vdpau_render_state *render_state;
+    VdpVideoSurface surface;
     const void *info;
     unsigned bitstream_buffers_used;
     const void *bitstream_buffers;

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Sun Aug 23 22:32:50 2015	(r37453)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Sun Aug 23 22:38:07 2015	(r37454)
@@ -90,7 +90,7 @@ typedef struct {
     int b_count;
     AVRational last_sample_aspect_ratio;
     int palette_sent;
-    int use_hwaccel;
+    int use_vdpau;
 } vd_ffmpeg_ctx;
 
 #include "m_option.h"
@@ -216,7 +216,7 @@ static int vdpau_render_wrapper(AVCodecC
     sh_video_t *sh = s->opaque;
     struct vdpau_frame_data data;
     uint8_t *planes[4] = {(void *)&data};
-    data.render_state = mpi->priv;
+    data.surface = (VdpVideoSurface)mpi->priv;
     data.info = info;
     data.bitstream_buffers_used = count;
     data.bitstream_buffers = buffers;
@@ -294,10 +294,10 @@ static void set_format_params(struct AVC
     int imgfmt;
     if (fmt == AV_PIX_FMT_NONE)
         return;
-    ctx->use_hwaccel = fmt == AV_PIX_FMT_VDPAU;
+    ctx->use_vdpau = fmt == AV_PIX_FMT_VDPAU;
     imgfmt = pixfmt2imgfmt2(fmt, avctx->codec_id);
 #if CONFIG_VDPAU
-    if (!ctx->use_hwaccel) {
+    if (!ctx->use_vdpau) {
         av_freep(&avctx->hwaccel_context);
     } else {
         AVVDPAUContext *vdpc = avctx->hwaccel_context;
@@ -315,7 +315,7 @@ static void set_format_params(struct AVC
         mp_msg(MSGT_DECVIDEO, MSGL_V, IMGFMT_IS_XVMC(imgfmt) ?
                MSGTR_MPCODECS_XVMCAcceleratedMPEG2 :
                "[VD_FFMPEG] VDPAU accelerated decoding\n");
-        if (ctx->use_hwaccel) {
+        if (ctx->use_vdpau) {
             avctx->draw_horiz_band = NULL;
             avctx->slice_flags = 0;
             ctx->do_slices = 0;
@@ -555,17 +555,10 @@ static void draw_slice(struct AVCodecCon
         mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "BUG in FFmpeg, draw_slice called with NULL pointer!\n");
         return;
     }
-    if (mpi && ctx->use_hwaccel) {
+    if (mpi && ctx->use_vdpau) {
         mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "BUG in FFmpeg, draw_slice called for VDPAU!\n");
         return;
     }
-#if CONFIG_VDPAU
-    if (mpi && 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;
-    }
-#endif
     if (height < 0)
     {
         int i;
@@ -762,14 +755,11 @@ static int get_buffer(AVCodecContext *av
         avctx->draw_horiz_band= draw_slice;
     } else
         avctx->draw_horiz_band= NULL;
-    if(IMGFMT_IS_HWACCEL(mpi->imgfmt)) {
-        avctx->draw_horiz_band= draw_slice;
-    }
 #if CONFIG_VDPAU
-    if (ctx->use_hwaccel) {
-        struct vdpau_render_state *render = mpi->priv;
+    if (ctx->use_vdpau) {
+        VdpVideoSurface surface = (VdpVideoSurface)mpi->priv;
         avctx->draw_horiz_band= NULL;
-        mpi->planes[3] = render->surface;
+        mpi->planes[3] = surface;
     }
 #endif
 #if CONFIG_XVMC
@@ -784,6 +774,7 @@ static int get_buffer(AVCodecContext *av
             mp_msg(MSGT_DECVIDEO, MSGL_DBG5, "vd_ffmpeg::get_buffer (xvmc render=%p)\n", render);
         assert(render != 0);
         assert(render->xvmc_id == AV_XVMC_ID);
+        avctx->draw_horiz_band= draw_slice;
     }
 #endif
 
@@ -1131,10 +1122,6 @@ static enum AVPixelFormat get_format(str
             if (fmt[i] == ctx->pix_fmt) return ctx->pix_fmt;
 
     for(i=0;fmt[i]!=AV_PIX_FMT_NONE;i++){
-        // it is incorrect of FFmpeg to even offer these, filter them out
-        if(!(avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
-           (fmt[i] == AV_PIX_FMT_VDPAU_MPEG1 || fmt[i] == AV_PIX_FMT_VDPAU_MPEG2))
-            continue;
         imgfmt = pixfmt2imgfmt2(fmt[i], avctx->codec_id);
         if(!IMGFMT_IS_HWACCEL(imgfmt) || !is_in_format_list(sh, imgfmt)) continue;
         mp_msg(MSGT_DECVIDEO, MSGL_V, MSGTR_MPCODECS_TryingPixfmt, i);

Modified: trunk/libvo/vo_vdpau.c
==============================================================================
--- trunk/libvo/vo_vdpau.c	Sun Aug 23 22:32:50 2015	(r37453)
+++ trunk/libvo/vo_vdpau.c	Sun Aug 23 22:38:07 2015	(r37454)
@@ -174,7 +174,7 @@ static VdpRect
 static VdpRect                            out_rect_vid;
 static int                                border_l, border_r, border_t, border_b;
 
-static struct vdpau_render_state          surface_render[MAX_VIDEO_SURFACES];
+static VdpVideoSurface                    surface_render[MAX_VIDEO_SURFACES];
 static int                                surface_num;
 static int                                vid_surface_num;
 static uint32_t                           vid_width, vid_height;
@@ -251,7 +251,7 @@ static void video_to_output_surface(void
         return;
 
     if (deint < 2 || deint_surfaces[0] == VDP_INVALID_HANDLE)
-        push_deint_surface(surface_render[vid_surface_num].surface);
+        push_deint_surface(surface_render[vid_surface_num]);
 
     for (i = 0; i <= !!(deint > 1); i++) {
         int field = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME;
@@ -274,12 +274,12 @@ static void video_to_output_surface(void
         vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0,
                                         field, 2, deint_surfaces + 1,
                                         deint_surfaces[0],
-                                        1, &surface_render[vid_surface_num].surface,
+                                        1, &surface_render[vid_surface_num],
                                         &src_rect_vid,
                                         output_surface,
                                         NULL, &out_rect_vid, 0, NULL);
         CHECK_ST_WARNING("Error when calling vdp_video_mixer_render")
-        push_deint_surface(surface_render[vid_surface_num].surface);
+        push_deint_surface(surface_render[vid_surface_num]);
     }
 }
 
@@ -579,11 +579,11 @@ static void free_video_specific(void)
     }
 
     for (i = 0; i < MAX_VIDEO_SURFACES; i++) {
-        if (surface_render[i].surface != VDP_INVALID_HANDLE) {
-          vdp_st = vdp_video_surface_destroy(surface_render[i].surface);
+        if (surface_render[i] != VDP_INVALID_HANDLE) {
+          vdp_st = vdp_video_surface_destroy(surface_render[i]);
           CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy")
         }
-        surface_render[i].surface = VDP_INVALID_HANDLE;
+        surface_render[i] = VDP_INVALID_HANDLE;
     }
 
     if (video_mixer != VDP_INVALID_HANDLE) {
@@ -620,7 +620,7 @@ static int create_vdp_decoder(uint32_t f
     case IMGFMT_VDPAU_MPEG4:
         vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP;
         break;
-#ifdef VDP_DECODER_PROFILE_HEVC_MAIN;
+#ifdef VDP_DECODER_PROFILE_HEVC_MAIN
     case IMGFMT_VDPAU_HEVC:
         vdp_decoder_profile = VDP_DECODER_PROFILE_HEVC_MAIN;
         mp_msg(MSGT_VO, MSGL_V, "[vdpau] Creating HEVC hardware decoder for %d reference frames.\n", max_refs);
@@ -647,7 +647,7 @@ static void mark_vdpau_objects_uninitial
     int i;
 
     for (i = 0; i < MAX_VIDEO_SURFACES; i++)
-        surface_render[i].surface = VDP_INVALID_HANDLE;
+        surface_render[i] = VDP_INVALID_HANDLE;
     vdp_flip_queue  = VDP_INVALID_HANDLE;
     vdp_flip_target = VDP_INVALID_HANDLE;
     for (i = 0; i <= NUM_OUTPUT_SURFACES; i++)
@@ -1015,7 +1015,7 @@ static void flip_page(void)
 {
     VdpStatus vdp_st;
     mp_msg(MSGT_VO, MSGL_DBG2, "\nFLIP_PAGE VID:%u -> OUT:%u\n",
-           surface_render[vid_surface_num].surface, output_surfaces[surface_num]);
+           surface_render[vid_surface_num], output_surfaces[surface_num]);
 
     if (handle_preemption() < 0)
         return;
@@ -1055,34 +1055,45 @@ static int draw_slice(uint8_t *image[],
         && !create_vdp_decoder(image_format, vid_width, vid_height, max_refs))
         return VO_FALSE;
 
-    vdp_st = vdp_decoder_render(decoder, rndr->render_state->surface, rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers);
+    vdp_st = vdp_decoder_render(decoder, rndr->surface, rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers);
     CHECK_ST_WARNING("Failed VDPAU decoder rendering");
     return VO_TRUE;
 }
 
+static int get_surface_idx(VdpVideoSurface surface)
+{
+    int i;
+    for (i = 0; i < MAX_VIDEO_SURFACES; i++) {
+      if (surface == surface_render[i]) {
+          return i;
+      }
+    }
+    mp_msg(MSGT_VO, MSGL_FATAL, "Unknown VdpVideoSurface %u!\n", surface);
+    return -1;
+}
 
-static struct vdpau_render_state *get_surface(int number)
+static VdpVideoSurface get_surface(int number)
 {
     if (number >= MAX_VIDEO_SURFACES)
-        return NULL;
-    if (surface_render[number].surface == VDP_INVALID_HANDLE) {
+        return VDP_INVALID_HANDLE;
+    if (surface_render[number] == VDP_INVALID_HANDLE) {
         VdpStatus vdp_st;
         vdp_st = vdp_video_surface_create(vdp_device, vdp_chroma_type,
                                           vid_width, vid_height,
-                                          &surface_render[number].surface);
+                                          &surface_render[number]);
         CHECK_ST_WARNING("Error when calling vdp_video_surface_create")
         if (vdp_st != VDP_STATUS_OK)
-            return NULL;
+            return VDP_INVALID_HANDLE;
     }
-    mp_msg(MSGT_VO, MSGL_DBG2, "VID CREATE: %u\n", surface_render[number].surface);
-    return &surface_render[number];
+    mp_msg(MSGT_VO, MSGL_DBG2, "VID CREATE: %u\n", surface_render[number]);
+    return surface_render[number];
 }
 
 static uint32_t draw_image(mp_image_t *mpi)
 {
     if (IMGFMT_IS_VDPAU(image_format)) {
-        struct vdpau_render_state *rndr = mpi->priv;
-        vid_surface_num = rndr - surface_render;
+        VdpVideoSurface surface = (VdpVideoSurface)mpi->priv;
+        vid_surface_num = get_surface_idx(surface);
         mpi->usage_count++;
         if (deint_mpi[1])
             deint_mpi[1]->usage_count--;
@@ -1098,12 +1109,12 @@ static uint32_t draw_image(mp_image_t *m
     } else if (!(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)) {
         VdpStatus vdp_st;
         void *destdata[3] = {mpi->planes[0], mpi->planes[2], mpi->planes[1]};
-        struct vdpau_render_state *rndr = get_surface(deint_counter);
+        VdpVideoSurface surface = get_surface(deint_counter);
         deint_counter = (deint_counter + 1) % 3;
-        vid_surface_num = rndr - surface_render;
+        vid_surface_num = get_surface_idx(surface);
         if (image_format == IMGFMT_NV12)
             destdata[1] = destdata[2];
-        vdp_st = vdp_video_surface_put_bits_y_cb_cr(rndr->surface,
+        vdp_st = vdp_video_surface_put_bits_y_cb_cr(surface,
                                                     vdp_pixel_format,
                                                     (const void *const*)destdata,
                                                     mpi->stride); // pitch
@@ -1120,7 +1131,7 @@ static uint32_t draw_image(mp_image_t *m
 
 static uint32_t get_image(mp_image_t *mpi)
 {
-    struct vdpau_render_state *rndr;
+    VdpVideoSurface surface;
 
     // no dr for non-decoding for now
     if (!IMGFMT_IS_VDPAU(image_format))
@@ -1128,8 +1139,8 @@ static uint32_t get_image(mp_image_t *mp
     if (mpi->type != MP_IMGTYPE_NUMBERED)
         return VO_FALSE;
 
-    rndr = get_surface(mpi->number);
-    if (!rndr) {
+    surface = get_surface(mpi->number);
+    if (surface == VDP_INVALID_HANDLE) {
         mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] no surfaces available in get_image\n");
         // TODO: this probably breaks things forever, provide a dummy buffer?
         return VO_FALSE;
@@ -1138,9 +1149,9 @@ static uint32_t get_image(mp_image_t *mp
     mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = 0;
     mpi->planes[0] = mpi->planes[1] = mpi->planes[2] = NULL;
     // hack to get around a check and to avoid a special-case in vd_ffmpeg.c
-    mpi->planes[0] = (void *)rndr;
+    mpi->planes[0] = (void *)(uintptr_t)surface;
     mpi->num_planes = 1;
-    mpi->priv = rndr;
+    mpi->priv = (void *)(uintptr_t)surface;
     return VO_TRUE;
 }
 
@@ -1214,18 +1225,10 @@ static void DestroyVdpauObjects(void)
 
 static void uninit(void)
 {
-    int i;
-
     if (!vo_config_count)
         return;
     visible_buf = 0;
 
-    for (i = 0; i < MAX_VIDEO_SURFACES; i++) {
-        // Allocated in ff_vdpau_add_data_chunk()
-        av_freep(&surface_render[i].bitstream_buffers);
-        surface_render[i].bitstream_buffers_allocated = 0;
-    }
-
     /* Destroy all vdpau objects */
     DestroyVdpauObjects();
 


More information about the MPlayer-cvslog mailing list