summaryrefslogtreecommitdiff
path: root/src/video_out/video_out_caca.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_out/video_out_caca.c')
-rw-r--r--src/video_out/video_out_caca.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/video_out/video_out_caca.c b/src/video_out/video_out_caca.c
index 866eabcd8..65ebf707e 100644
--- a/src/video_out/video_out_caca.c
+++ b/src/video_out/video_out_caca.c
@@ -120,7 +120,7 @@ static vo_frame_t *caca_alloc_frame(vo_driver_t *this_gen) {
caca_driver_t *this = (caca_driver_t*) this_gen;
caca_frame_t *frame;
- frame = (caca_frame_t *) xine_xmalloc (sizeof (caca_frame_t));
+ frame = calloc(1, sizeof (caca_frame_t));
if (!frame)
return NULL;
@@ -276,9 +276,10 @@ static int caca_redraw_needed (vo_driver_t *this_gen) {
static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) {
caca_class_t *class = (caca_class_t *) class_gen;
+ caca_display_t *dp = (caca_display_t *)visual_gen;
caca_driver_t *this;
- this = (caca_driver_t*) xine_xmalloc (sizeof (caca_driver_t));
+ this = calloc(1, sizeof (caca_driver_t));
this->config = class->config;
this->xine = class->xine;
@@ -300,8 +301,13 @@ 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);
- this->cv = cucul_create_canvas(0, 0);
- this->dp = caca_create_display(this->cv);
+ if (dp) {
+ this->cv = caca_get_canvas(dp);
+ this->dp = dp;
+ } else {
+ this->cv = cucul_create_canvas(0, 0);
+ this->dp = caca_create_display(this->cv);
+ }
caca_refresh_display(this->dp);
return &this->vo_driver;
@@ -322,7 +328,7 @@ static void dispose_class (video_driver_class_t *this_gen) {
static void *init_class (xine_t *xine, void *visual_gen) {
caca_class_t *this;
- this = (caca_class_t *) xine_xmalloc(sizeof(caca_class_t));
+ this = calloc(1, sizeof(caca_class_t));
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;