[MPlayer-dev-eng] [PATCH] add VDPAU IMGFMTs

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Feb 12 18:52:05 CET 2009


Hello,
this is part of the extremely work-in-progress vdpau branch at
http://natsuki.mplayerhq.hu/~reimar/MPlayer.git/
It adds the IMGFMTs needed, and only those (so that there is a 1:1
correspondence to the lavc ones, not split by profile).
The profile handling, if necessary, should be done in the vo, since
there would also be the code that can probe which profiles are
officially supported by the device, and decide if it should try playing
with a lower profile (betting on luck) or give up or whatever.
It _might_ make it harder to do a software fallback, but it seems like a
not-so-good idea to me to design for that yet since it IMO is unclear
how a well-designed fallback solution would work - e.g. it should also
take into account the maximum number of reference frames, which is not
coded into the IMGFMT either.
I can understand if you do not like this piecemeal approach to get this
in, tell me if so, but I currently can't think of a better/faster way to get this
in.

Greetings,
Reimar Döffinger
-------------- next part --------------
diff --git a/codec-cfg.c b/codec-cfg.c
index 221c88d..bb09f10 100644
--- a/codec-cfg.c
+++ b/codec-cfg.c
@@ -182,6 +182,12 @@ static int add_to_format(char *s, char *alias,unsigned int *fourcc, unsigned int
 		{"IDCT_MPEG2",IMGFMT_XVMC_IDCT_MPEG2},
 		{"MOCO_MPEG2",IMGFMT_XVMC_MOCO_MPEG2},
 
+		{"VDPAU_MPEG1",IMGFMT_VDPAU_MPEG1},
+		{"VDPAU_MPEG2",IMGFMT_VDPAU_MPEG2},
+		{"VDPAU_H264",IMGFMT_VDPAU_H264},
+		{"VDPAU_WMV3",IMGFMT_VDPAU_WMV3},
+		{"VDPAU_VC1",IMGFMT_VDPAU_VC1},
+
 		{NULL,    0}
 	};
 
diff --git a/etc/codecs.conf b/etc/codecs.conf
index 8c58497..a269adb 100644
--- a/etc/codecs.conf
+++ b/etc/codecs.conf
@@ -272,6 +272,33 @@ videocodec ffmpeg12mc
   out IDCT_MPEG2
   out MOCO_MPEG2
 
+videocodec ffmpeg12vdpau
+  info "FFmpeg MPEG-1/2 (VDPAU)"
+  status working
+  format 0x10000001  ; MPEG-1
+  format 0x10000002  ; MPEG-2
+  fourcc mpg1,mpg2,MPG2
+  fourcc "DVR "
+  fourcc hdv1
+  fourcc hdv2
+  fourcc PIM1        ; Pinnacle hardware-MPEG-1
+  fourcc VCR2
+  fourcc MPEG
+  fourcc hdv3        ; HDV 1080i50
+  fourcc hdv5        ; HDV  720p25
+  fourcc mx5p        ; MPEG IMX 625/50 (50 Mb/s)
+  fourcc MMES,mmes   ; matrox mpeg2 in avi
+  fourcc hdv6,hdv7,hdv8
+  fourcc xdv1,xdv2,xdv3
+  fourcc xdv4,xdv5,xdv6
+  fourcc xdv7,xdv8,xdv9
+  fourcc xdva,xdvb,xdvc
+  fourcc xdvd,xdve,xdvf
+  driver ffmpeg
+  dll "mpegvideo_vdpau"
+  out VDPAU_MPEG1
+  out VDPAU_MPEG2
+
 ; we have only native open source codecs for these:
 
 videocodec ffnuv
@@ -771,6 +798,14 @@ videocodec ffwmv3
   dll wmv3
   out YV12,I420,IYUV
 
+videocodec ffwmv3vdpau
+  info "FFmpeg WMV3/WMV9 (VDPAU)"
+  status working
+  fourcc WMV3,wmv3
+  driver ffmpeg
+  dll wmv3_vdpau
+  out VDPAU_WMV3
+
 videocodec ffvc1
   info "FFmpeg WVC1"
   status buggy
@@ -780,6 +815,14 @@ videocodec ffvc1
   dll vc1
   out YV12,I420,IYUV
 
+videocodec ffvc1vdpau
+  info "FFmpeg WVC1 (VDPAU)"
+  status working
+  fourcc WVC1,wvc1
+  driver ffmpeg
+  dll vc1_vdpau
+  out VDPAU_VC1
+
 videocodec ffh264
   info "FFmpeg H.264"
   status working
@@ -792,6 +835,18 @@ videocodec ffh264
   dll h264
   out YV12,I420,IYUV
 
+videocodec ffh264vdpau
+  info "FFmpeg H.264 (VDPAU)"
+  status working
+  fourcc H264,h264
+  fourcc X264,x264
+  fourcc avc1,AVC1
+  fourcc davc,DAVC
+  format 0x10000005
+  driver ffmpeg
+  dll h264_vdpau
+  out VDPAU_H264
+
 videocodec ffsvq3
   info "FFmpeg Sorenson Video v3 (SVQ3)"
   status working
diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c
index 30df239..789e473 100644
--- a/libmpcodecs/img_format.c
+++ b/libmpcodecs/img_format.c
@@ -67,6 +67,11 @@ const char *vo_format_name(int format)
 	case IMGFMT_ZRMJPEGIB: return "Zoran MJPEG bottom field first";
 	case IMGFMT_XVMC_MOCO_MPEG2: return "MPEG1/2 Motion Compensation";
 	case IMGFMT_XVMC_IDCT_MPEG2: return "MPEG1/2 Motion Compensation and IDCT";
+	case IMGFMT_VDPAU_MPEG1: return "MPEG1 VDPAU acceleration";
+	case IMGFMT_VDPAU_MPEG2: return "MPEG2 VDPAU acceleration";
+	case IMGFMT_VDPAU_H264: return "H.264 VDPAU acceleration";
+	case IMGFMT_VDPAU_WMV3: return "WMV3 VDPAU acceleration";
+	case IMGFMT_VDPAU_VC1: return "VC1 VDPAU acceleration";
     }
     snprintf(unknown_format,20,"Unknown 0x%04x",format);
     return unknown_format;
diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h
index c15269b..3922fdc 100644
--- a/libmpcodecs/img_format.h
+++ b/libmpcodecs/img_format.h
@@ -107,6 +107,16 @@
 #define IMGFMT_XVMC_MOCO_MPEG2 (IMGFMT_XVMC|0x02)
 #define IMGFMT_XVMC_IDCT_MPEG2 (IMGFMT_XVMC|0x82)
 
+// VDPAU specific format.
+#define IMGFMT_VDPAU               0x1DC80000
+#define IMGFMT_VDPAU_MASK          0xFFFF0000
+#define IMGFMT_IS_VDPAU(fmt)       (((fmt)&IMGFMT_VDPAU_MASK)==IMGFMT_VDPAU)
+#define IMGFMT_VDPAU_MPEG1         (IMGFMT_VDPAU|0x01)
+#define IMGFMT_VDPAU_MPEG2         (IMGFMT_VDPAU|0x02)
+#define IMGFMT_VDPAU_H264          (IMGFMT_VDPAU|0x03)
+#define IMGFMT_VDPAU_WMV3          (IMGFMT_VDPAU|0x04)
+#define IMGFMT_VDPAU_VC1           (IMGFMT_VDPAU|0x05)
+
 typedef struct {
     void* data;
     int size;
diff --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h
index 512f83e..8da733a 100644
--- a/libmpcodecs/mp_image.h
+++ b/libmpcodecs/mp_image.h
@@ -113,6 +113,10 @@ static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
 	mpi->bpp=0;
 	return;
     }
+    if(IMGFMT_IS_VDPAU(out_fmt)){
+        mpi->bpp=0;
+        return;
+    }
     if(IMGFMT_IS_XVMC(out_fmt)){
 	mpi->bpp=0;
 	return;


More information about the MPlayer-dev-eng mailing list