[MPlayer-cvslog] r35143 - in trunk/sub: osd.c osd.h
reimar
subversion at mplayerhq.hu
Sun Sep 2 23:17:03 CEST 2012
Author: reimar
Date: Sun Sep 2 23:17:03 2012
New Revision: 35143
Log:
Add helper function to reduce code duplication for selecting
correct OSD drawing function.
Modified:
trunk/sub/osd.c
trunk/sub/osd.h
Modified: trunk/sub/osd.c
==============================================================================
--- trunk/sub/osd.c Sat Sep 1 18:54:53 2012 (r35142)
+++ trunk/sub/osd.c Sun Sep 2 23:17:03 2012 (r35143)
@@ -27,6 +27,8 @@
#include "osd.h"
#include "mp_msg.h"
#include <inttypes.h>
+#include <stdlib.h>
+#include "libmpcodecs/img_format.h"
#include "cpudetect.h"
#if ARCH_X86
@@ -426,3 +428,34 @@ void vo_draw_alpha_rgb16(int w,int h, un
}
return;
}
+
+vo_draw_alpha_func vo_get_draw_alpha(unsigned fmt) {
+ if (IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt)) {
+ switch (IMGFMT_RGB_DEPTH(fmt))
+ {
+ case 12:
+ return vo_draw_alpha_rgb12;
+ case 15:
+ return vo_draw_alpha_rgb15;
+ case 16:
+ return vo_draw_alpha_rgb16;
+ case 24:
+ return vo_draw_alpha_rgb24;
+ case 32:
+ return vo_draw_alpha_rgb32;
+ }
+ return NULL;
+ }
+ switch (fmt) {
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+ return vo_draw_alpha_yv12;
+ case IMGFMT_YUY2:
+ case IMGFMT_YVYU:
+ return vo_draw_alpha_yuy2;
+ case IMGFMT_UYVY:
+ return vo_draw_alpha_uyvy;
+ }
+ return NULL;
+}
Modified: trunk/sub/osd.h
==============================================================================
--- trunk/sub/osd.h Sat Sep 1 18:54:53 2012 (r35142)
+++ trunk/sub/osd.h Sun Sep 2 23:17:03 2012 (r35143)
@@ -24,6 +24,9 @@
void vo_draw_alpha_init(void); // build tables
+typedef void (*vo_draw_alpha_func)(int, int, unsigned char *, unsigned char *, int, unsigned char *, int);
+vo_draw_alpha_func vo_get_draw_alpha(unsigned fmt);
+
void vo_draw_alpha_yv12(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride);
void vo_draw_alpha_yuy2(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride);
void vo_draw_alpha_uyvy(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride);
More information about the MPlayer-cvslog
mailing list