[MPlayer-dev-eng] [RFC] allow vos to not support draw_slice

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Feb 17 14:43:42 CET 2009


Hello,
for some vos like (unfortunately) VDPAU, implementing draw_slices
would just add complexity and an extra buffer since the API lacks
functions to do a partial upload of frame data.
Thus this patch adds VOCAP_NOSLICES, that when returned by query_format
will disable slice rendering.
Note that this is called VOCAP_NOSLICES on purpose, since filters just
set their draw_slice function to NULL to achieve this, thus this flag
is only for vos.
-------------- next part --------------
Index: libmpcodecs/vf_vo.c
===================================================================
--- libmpcodecs/vf_vo.c	(revision 28630)
+++ libmpcodecs/vf_vo.c	(working copy)
@@ -32,6 +32,7 @@
 #define video_out (vf->priv->vo)
 
 static int query_format(struct vf_instance_s* vf, unsigned int fmt); /* forward declaration */
+static void draw_slice(struct vf_instance_s* vf, unsigned char** src, int* stride, int w,int h, int x, int y);
 
 static int config(struct vf_instance_s* vf,
         int width, int height, int d_width, int d_height,
@@ -61,6 +62,7 @@
 
     // save vo's stride capability for the wanted colorspace:
     vf->default_caps=query_format(vf,outfmt);
+    vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice;
 
     if(config_video_out(video_out,width,height,d_width,d_height,flags,"MPlayer",outfmt))
 	return 0;
Index: libmpcodecs/vfcap.h
===================================================================
--- libmpcodecs/vfcap.h	(revision 28630)
+++ libmpcodecs/vfcap.h	(working copy)
@@ -33,5 +33,7 @@
 #define VFCAP_EOSD 0x2000
 // filter will draw EOSD at screen resolution (without scaling)
 #define VFCAP_EOSD_UNSCALED 0x4000
+// used by libvo and vf_vo, indicates the VO does not support draw_slice for this format
+#define VOCAP_NOSLICES 0x8000
 
 #endif /* MPLAYER_VFCAP_H */
Index: libvo/vo_vdpau.c
===================================================================
--- libvo/vo_vdpau.c	(revision 28633)
+++ libvo/vo_vdpau.c	(working copy)
@@ -654,14 +654,16 @@
 
 static int query_format(uint32_t format)
 {
+    int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD;
     switch (format) {
         case IMGFMT_YV12:
+            return default_flags | VOCAP_NOSLICES;
         case IMGFMT_VDPAU_MPEG1:
         case IMGFMT_VDPAU_MPEG2:
         case IMGFMT_VDPAU_H264:
         case IMGFMT_VDPAU_WMV3:
         case IMGFMT_VDPAU_VC1:
-            return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD;
+            return default_flags;
     }
     return 0;
 }


More information about the MPlayer-dev-eng mailing list