Index: libvo/video_out.c =================================================================== --- libvo/video_out.c (.../mplayer-orig-rev23698) (revision 111) +++ libvo/video_out.c (.../mplayer-sources) (revision 111) @@ -84,6 +84,7 @@ extern vo_functions_t video_out_zr; extern vo_functions_t video_out_zr2; extern vo_functions_t video_out_bl; +extern vo_functions_t video_out_metaleds; extern vo_functions_t video_out_syncfb; extern vo_functions_t video_out_fbdev; extern vo_functions_t video_out_fbdev2; @@ -225,6 +226,9 @@ #ifdef HAVE_BL &video_out_bl, #endif +#ifdef HAVE_METALEDS + &video_out_metaleds, +#endif #ifdef HAVE_VESA &video_out_vesa, #endif Index: libvo/vo_metaleds.c =================================================================== --- libvo/vo_metaleds.c (.../mplayer-orig-rev23698) (revision 0) +++ libvo/vo_metaleds.c (.../mplayer-sources) (revision 111) @@ -0,0 +1,154 @@ +/* + * vo_metaleds.c - convert video output to the MetaLEDs streaming protocol + * + * Copyright (c) 2007 Clifford Wolf + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include + +#include "config.h" + +#include "mplayer.h" +#include "video_out.h" +#include "video_out_internal.h" +#include "mp_msg.h" +#include "m_option.h" + +#include "../../libmetaleds/libmetaleds.h" + +static vo_info_t info = +{ + "MetaLEDs driver: http://metalab.at/wiki/MetaLEDs", + "metaleds", + "Clifford Wolf ", + "" +}; + +LIBVO_EXTERN (metaleds) + +/* Engine state as simple global variables + */ +static int width, height; +static unsigned char *image; +metaleds_frame_p frame; + +/* Parse argument string and open the output file. + */ +static int preinit(const char *arg) +{ + if (!arg || !arg[0] || metaleds_init(arg) < 0) { + mp_msg(MSGT_VO, MSGL_ERR, "MetaLEDs initialization error.\n"); + mp_msg(MSGT_VO, MSGL_ERR, + "---\n" + "metaleds: Usage examples:\n" + "mplayer -vf scale -zoom -x 72 -y 48 -vo metaleds:sim:72:48 pr0n.mp4\n" + "mplayer -vf scale -zoom -x 72 -y 48 -vo metaleds:fio:/dev/lp0:72:48 pr0n.mp4\n" + "mplayer -vf scale -zoom -x 72 -y 48 -vo metaleds:net:10.20.30.40:6000:72:48 pr0n.mp4\n" + "---\n"); + return 1; + } + + frame = metaleds_malloc(); + + return 0; +} + +/* Configure the mplayer engine. We only want data in YV12 format. + */ +static int control(uint32_t request, void *data, ...) +{ + if (request == VOCTRL_QUERY_FORMAT) { + uint32_t format = *((uint32_t*)data); + if (format == IMGFMT_YV12) + return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW; + return 0; + } + return VO_NOTIMPL; +} + +/* Initialize/update width and height as well as the image buffer + */ +static int config(uint32_t width_arg, uint32_t height_arg, uint32_t d_width, + uint32_t d_height, uint32_t flags, char *title, uint32_t format) +{ + width = width_arg; + height = height_arg; + + image = realloc(image, width*height*3); + memset(image, 0, width*height*3); + + return 0; +} + +/* We have got new data. Lets just copy it to the image buffer. + */ +static int draw_slice(uint8_t *srcimg[], int stride[], + int wf, int hf, int xf, int yf) +{ + uint8_t *dst = image, *src=srcimg[0]; + int i; + + for (i = 0; i < hf; i++) { + memcpy(dst, src, wf); + src += stride[0]; + dst += width; + } + + return 0; +} + +/* We have got a new frame. Simply dump current image to output. + * (We are using the 1st channel only because this is grayscale in YV12.) + */ +static void flip_page(void) +{ + int buf_idx = 0; + int x, y; + + for (y=0; y