summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_out/video_out_caca.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/video_out/video_out_caca.c b/src/video_out/video_out_caca.c
index d1e33fa4b..ad482af8d 100644
--- a/src/video_out/video_out_caca.c
+++ b/src/video_out/video_out_caca.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_caca.c,v 1.8 2006/07/10 22:08:44 dgp85 Exp $
+ * $Id: video_out_caca.c,v 1.9 2006/09/14 00:44:19 dgp85 Exp $
*
* video_out_caca.c, Color AsCii Art output plugin for xine
*
@@ -37,7 +37,7 @@
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/time.h>
-
+#include <cucul.h>
#include <caca.h>
#include "xine.h"
@@ -54,7 +54,7 @@ typedef struct caca_frame_s {
vo_frame_t vo_frame;
- struct caca_bitmap *pixmap_s; /* pixmap info structure */
+ cucul_dither_t *pixmap_s; /* pixmap info structure */
uint8_t *pixmap_d; /* pixmap data */
int width, height;
uint8_t *mem[3];
@@ -74,6 +74,9 @@ typedef struct {
yuv2rgb_factory_t *yuv2rgb_factory;
+ cucul_canvas_t *cv;
+ caca_display_t *dp;
+
} caca_driver_t;
typedef struct {
@@ -104,7 +107,7 @@ static void caca_dispose_frame (vo_frame_t *vo_img) {
if (frame->pixmap_d)
free (frame->pixmap_d);
if (frame->pixmap_s)
- caca_free_bitmap (frame->pixmap_s);
+ cucul_free_dither (frame->pixmap_s);
frame->yuv2rgb->dispose (frame->yuv2rgb);
@@ -166,7 +169,7 @@ static void caca_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img,
frame->pixmap_d = NULL;
}
if (frame->pixmap_s) {
- caca_free_bitmap (frame->pixmap_s);
+ cucul_free_dither (frame->pixmap_s);
frame->pixmap_s = NULL;
}
@@ -175,7 +178,7 @@ static void caca_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img,
frame->format = format;
frame->pixmap_d = (uint8_t *) xine_xmalloc (height * width * 4);
- frame->pixmap_s = caca_create_bitmap (32, width, height, width * 4,
+ frame->pixmap_s = cucul_create_dither (32, width, height, width * 4,
0xff0000, 0xff00, 0xff, 0);
if (format == XINE_IMGFMT_YV12) {
@@ -208,7 +211,7 @@ static void caca_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img,
static void caca_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
/* caca_driver_t *this = (caca_driver_t*) this_gen; */
caca_frame_t *frame = (caca_frame_t *) frame_gen;
-
+ caca_driver_t *this = (caca_driver_t*) this_gen;
if (frame->format == XINE_IMGFMT_YV12) {
frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->pixmap_d,
frame->vo_frame.base[0],
@@ -221,9 +224,9 @@ static void caca_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
frame->vo_frame.free (&frame->vo_frame);
- caca_draw_bitmap(0, 0, caca_get_width()-1, caca_get_height()-1,
+ cucul_dither_bitmap(this->cv, 0, 0, cucul_get_canvas_width(this->cv)-1, cucul_get_canvas_height(this->cv)-1,
frame->pixmap_s, frame->pixmap_d);
- caca_refresh ();
+ caca_refresh_display (this->dp);
}
static int caca_get_property (vo_driver_t *this_gen, int property) {
@@ -265,8 +268,9 @@ static void caca_get_property_min_max (vo_driver_t *this_gen,
static void caca_dispose_driver (vo_driver_t *this_gen) {
caca_driver_t *this = (caca_driver_t*) this_gen;
this->yuv2rgb_factory->dispose (this->yuv2rgb_factory);
+ caca_free_display(this->dp);
+ cucul_free_canvas(this->cv);
- caca_end();
}
static int caca_redraw_needed (vo_driver_t *this_gen) {
@@ -299,9 +303,10 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
this->yuv2rgb_factory = yuv2rgb_factory_init(MODE_32_RGB, 0, NULL);
this->yuv2rgb_factory->set_csc_levels(this->yuv2rgb_factory, 0, 128, 128);
- caca_init();
- caca_refresh();
+ this->cv = cucul_create_canvas(0, 0);
+ this->dp = caca_create_display(this->cv);
+ caca_refresh_display(this->dp);
return &this->vo_driver;
}