diff options
Diffstat (limited to 'src/video_out/video_out_xshm.c')
-rw-r--r-- | src/video_out/video_out_xshm.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index ddcdb677c..41a93cdad 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -51,6 +51,9 @@ #include <pthread.h> #include <netinet/in.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #define LOG_MODULE "video_out_xshm" #define LOG_VERBOSE /* @@ -80,8 +83,6 @@ typedef struct { XImage *image; XShmSegmentInfo shminfo; - uint8_t *chunk[3]; /* mem alloc by xmalloc_aligned */ - yuv2rgb_t *yuv2rgb; /* yuv2rgb converter set up for this frame */ uint8_t *rgb_dst; @@ -380,9 +381,9 @@ static void xshm_frame_dispose (vo_frame_t *vo_img) { frame->yuv2rgb->dispose (frame->yuv2rgb); - free (frame->chunk[0]); - free (frame->chunk[1]); - free (frame->chunk[2]); + av_free (frame->vo_frame.base[0]); + av_free (frame->vo_frame.base[1]); + av_free (frame->vo_frame.base[2]); free (frame); } @@ -530,18 +531,9 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, dispose_ximage (this, &frame->shminfo, frame->image); - if (frame->chunk[0]){ - free (frame->chunk[0]); - frame->chunk[0] = NULL; - } - if (frame->chunk[1]) { - free (frame->chunk[1]); - frame->chunk[1] = NULL; - } - if (frame->chunk[2]) { - free (frame->chunk[2]); - frame->chunk[2] = NULL; - } + av_freep(&frame->vo_frame.base[0]); + av_freep(&frame->vo_frame.base[1]); + av_freep(&frame->vo_frame.base[2]); frame->image = NULL; } @@ -555,14 +547,12 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[1] * ((height+1)/2), (void **) &frame->chunk[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[2] * ((height+1)/2), (void **) &frame->chunk[2]); + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); + frame->vo_frame.base[1] = av_mallocz(frame->vo_frame.pitches[1] * ((height+1)/2)); + frame->vo_frame.base[2] = av_mallocz(frame->vo_frame.pitches[2] * ((height+1)/2)); } else { frame->vo_frame.pitches[0] = 8*((width + 3) / 4); - frame->vo_frame.base[0] = xine_xmalloc_aligned (16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); - frame->chunk[1] = NULL; - frame->chunk[2] = NULL; + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); } lprintf ("stripe out_ht=%i, deliv_ht=%i\n", |