summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-10 05:49:12 +0100
committerwm4 <wm4@nowhere>2013-01-13 17:39:32 +0100
commit1c412169aca2f0ad38380b0c89f2485e6a256766 (patch)
tree56961e04c136c54401ce43cd4fd91306e800b5a3 /video
parent4570a04a17a88c822383b850dc7539ea854860d0 (diff)
downloadmpv-1c412169aca2f0ad38380b0c89f2485e6a256766.tar.bz2
mpv-1c412169aca2f0ad38380b0c89f2485e6a256766.tar.xz
vo_caca: accept any stride for output image
Similar to previous commit.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_caca.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/video/out/vo_caca.c b/video/out/vo_caca.c
index 43d1de44cd..a334b4ab02 100644
--- a/video/out/vo_caca.c
+++ b/video/out/vo_caca.c
@@ -39,6 +39,7 @@
#include "sub/sub.h"
#include "video/mp_image.h"
#include "video/vfcap.h"
+#include "video/memcpy_pic.h"
#include "core/input/keycodes.h"
#include "core/input/input.h"
@@ -49,6 +50,7 @@
static caca_canvas_t *canvas;
static caca_display_t *display;
static caca_dither_t *dither = NULL;
+static uint8_t *dither_buffer = NULL;
static const char *dither_antialias = "default";
static const char *dither_charset = "default";
static const char *dither_color = "default";
@@ -132,6 +134,7 @@ static int resize(void)
screen_h = caca_get_canvas_height(canvas);
caca_free_dither(dither);
+ talloc_free(dither_buffer);
dither = caca_create_dither(bpp, image_width, image_height,
depth * image_width,
@@ -140,6 +143,8 @@ static int resize(void)
mp_msg(MSGT_VO, MSGL_FATAL, "vo_caca: caca_create_dither failed!\n");
return ENOSYS;
}
+ dither_buffer =
+ talloc_array(NULL, uint8_t, depth * image_width * image_height);
/* Default libcaca features */
caca_set_dither_antialias(dither, dither_antialias);
@@ -166,9 +171,9 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
static void draw_image(struct vo *vo, mp_image_t *mpi)
{
- assert(mpi->stride[0] == image_width * 3);
- caca_dither_bitmap(canvas, 0, 0, screen_w, screen_h, dither,
- mpi->planes[0]);
+ memcpy_pic(dither_buffer, mpi->planes[0], image_width * depth, image_height,
+ image_width * depth, mpi->stride[0]);
+ caca_dither_bitmap(canvas, 0, 0, screen_w, screen_h, dither, dither_buffer);
}
static void flip_page(struct vo *vo)
@@ -312,6 +317,8 @@ static void uninit(struct vo *vo)
{
caca_free_dither(dither);
dither = NULL;
+ talloc_free(dither_buffer);
+ dither_buffer = NULL;
caca_free_display(display);
caca_free_canvas(canvas);
}