diff options
Diffstat (limited to 'src/video_out/video_out_raw.c')
-rw-r--r-- | src/video_out/video_out_raw.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/video_out/video_out_raw.c b/src/video_out/video_out_raw.c index 99e2c0004..f3afb4aaa 100644 --- a/src/video_out/video_out_raw.c +++ b/src/video_out/video_out_raw.c @@ -278,10 +278,14 @@ static void raw_frame_dispose (vo_frame_t *vo_img) frame->yuv2rgb->dispose (frame->yuv2rgb); - free (frame->chunk[0]); - free (frame->chunk[1]); - free (frame->chunk[2]); - free (frame->chunk[3]); + if ( frame->chunk[0] ) + free (frame->chunk[0]); + if ( frame->chunk[1] ) + free (frame->chunk[1]); + if ( frame->chunk[2] ) + free (frame->chunk[2]); + if ( frame->chunk[3] ) + free (frame->chunk[3]); free (frame); } @@ -297,6 +301,9 @@ static vo_frame_t *raw_alloc_frame (vo_driver_t *this_gen) if (!frame) return NULL; + frame->chunk[0] = frame->chunk[1] = frame->chunk[2] = frame->chunk[3] = NULL; + frame->width = frame->height = frame->format = frame->flags = 0; + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -330,13 +337,16 @@ static void raw_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge || (frame->flags != flags)) { /* lprintf ("updating frame to %d x %d (ratio=%g, format=%08x)\n", width, height, ratio, format); */ - flags &= VO_BOTH_FIELDS; - /* (re-) allocate render space */ - free (frame->chunk[0]); - free (frame->chunk[1]); - free (frame->chunk[2]); - free (frame->chunk[3]); + if ( frame->chunk[0] ) + free (frame->chunk[0]); + if ( frame->chunk[1] ) + free (frame->chunk[1]); + if ( frame->chunk[2] ) + free (frame->chunk[2]); + if ( frame->chunk[3] ) + free (frame->chunk[3]); + frame->chunk[0] = frame->chunk[1] = frame->chunk[2] = frame->chunk[3] = NULL; if (format == XINE_IMGFMT_YV12) { frame->vo_frame.pitches[0] = 8*((width + 7) / 8); @@ -355,7 +365,7 @@ static void raw_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge (void **) &frame->chunk[3]); /* set up colorspace converter */ - switch (flags) { + switch (flags & VO_BOTH_FIELDS) { case VO_TOP_FIELD: case VO_BOTTOM_FIELD: frame->yuv2rgb->configure (frame->yuv2rgb, @@ -382,6 +392,7 @@ static void raw_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge frame->width = width; frame->height = height; frame->format = format; + frame->flags = flags; raw_frame_field ((vo_frame_t *)frame, flags); } |