Web lists-archives.com

[MPlayer-dev-eng] [PATCH 4/5] vo xv: Limit output formats to what the vo actually supports




Assumes the format IDs (FourCCs in this case) are the same in MPlayer
and Xvideo.

That assumption is nothing new, but it was never checked if in case
of a match, we actually supported that image format in vo xv.

Signed-off-by: Alexander Strasser <eclipse7@xxxxxxx>
---
 libvo/vo_xv.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index ebce39a6b..3febbf748 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -396,7 +396,8 @@ static int draw_slice(uint8_t * image[], int stride[], int w, int h,
     switch (image_format) {
     case IMGFMT_YV12:
         idx_p1 = 2; idx_p2 = 1;
-    default:
+    case IMGFMT_I420:
+    case IMGFMT_IYUV:
         x /= 2;
         y /= 2;
         w /= 2;
@@ -484,7 +485,8 @@ static uint32_t get_image(mp_image_t * mpi)
         switch (image_format) {
         case IMGFMT_YV12:
             idx_p1 = 2; idx_p2 = 1;
-        default:
+        case IMGFMT_I420:
+        case IMGFMT_IYUV:
             mpi->planes[1] =
                 xvimage[current_buf]->data +
                 xvimage[current_buf]->offsets[idx_p1];
@@ -503,10 +505,25 @@ static uint32_t get_image(mp_image_t * mpi)
     return VO_FALSE;
 }
 
+static int is_supported_format(uint32_t format)
+{
+    switch (format) {
+    case IMGFMT_YV12:
+    case IMGFMT_I420:
+    case IMGFMT_IYUV:
+        return 1;
+    default:
+        return 0;
+    }
+}
+
 static int query_format(uint32_t format)
 {
     uint32_t i;
     int flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_ACCEPT_STRIDE;       // FIXME! check for DOWN
+    if (!is_supported_format(format)) {
+        return 0;
+    }
 
     /* check image formats */
     for (i = 0; i < formats; i++)
-- 
2.11.0
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng