diff options
Diffstat (limited to 'src/video_out')
-rw-r--r-- | src/video_out/Makefile.am | 50 | ||||
-rw-r--r-- | src/video_out/video_out_aa.c | 24 | ||||
-rw-r--r-- | src/video_out/video_out_caca.c | 28 | ||||
-rw-r--r-- | src/video_out/video_out_fb.c | 40 | ||||
-rw-r--r-- | src/video_out/video_out_opengl.c | 33 | ||||
-rw-r--r-- | src/video_out/video_out_syncfb.c | 4 | ||||
-rw-r--r-- | src/video_out/video_out_xcbshm.c | 36 | ||||
-rw-r--r-- | src/video_out/video_out_xshm.c | 36 | ||||
-rw-r--r-- | src/video_out/yuv2rgb.c | 6 | ||||
-rw-r--r-- | src/video_out/yuv2rgb_mmx.c | 5 |
10 files changed, 112 insertions, 150 deletions
diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index c2ea443e0..126a7a1c3 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -91,6 +91,12 @@ if ENABLE_MACOSX_VIDEO macosx_module = xineplug_vo_out_macosx.la endif +noinst_LTLIBRARIES = libyuv2rgb.la + +libyuv2rgb_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c +libyuv2rgb_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) $(AVUTIL_CFLAGS) +libyuv2rgb_la_LIBADD = $(XINE_LIB) $(MLIB_LIBS) $(AVUTIL_LIBS) + xineplug_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ $(opengl_module) \ $(syncfb_module) \ @@ -108,18 +114,17 @@ xineplug_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ $(xcbxv_module) \ xineplug_vo_out_none.la -xineplug_vo_out_xcbshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c video_out_xcbshm.c $(XCBOSD) -xineplug_vo_out_xcbshm_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS) $(LTLIBINTL) -xineplug_vo_out_xcbshm_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) $(XCB_CFLAGS) $(XCBSHM_CFLAGS) +xineplug_vo_out_xcbshm_la_SOURCES = video_out_xcbshm.c $(XCBOSD) +xineplug_vo_out_xcbshm_la_LIBADD = libyuv2rgb.la $(XINE_LIB) $(PTHREAD_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_xcbshm_la_CFLAGS = $(AM_CFLAGS) $(XCB_CFLAGS) $(XCBSHM_CFLAGS) $(AVUTIL_CFLAGS) xineplug_vo_out_xcbxv_la_SOURCES = video_out_xcbxv.c $(XCBOSD) xineplug_vo_out_xcbxv_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(XCBXV_LIBS) $(XCB_LIBS) xineplug_vo_out_xcbxv_la_CFLAGS = $(AM_CFLAGS) $(XCB_CFLAGS) $(XCBXV_CFLAGS) -xineplug_vo_out_xshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ - video_out_xshm.c $(X11OSD) -xineplug_vo_out_xshm_la_LIBADD = $(MLIB_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_vo_out_xshm_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing +xineplug_vo_out_xshm_la_SOURCES = video_out_xshm.c $(X11OSD) +xineplug_vo_out_xshm_la_LIBADD = libyuv2rgb.la $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_xshm_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(AVUTIL_CFLAGS) -fno-strict-aliasing xineplug_vo_out_xv_la_SOURCES = $(X11OSD) video_out_xv.c xineplug_vo_out_xv_la_LIBADD = $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) @@ -134,11 +139,10 @@ xineplug_vo_out_xxmc_la_SOURCES = $(X11OSD) video_out_xxmc.c\ xineplug_vo_out_xxmc_la_LIBADD = $(XXMC_LIBS) $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_xxmc_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing -xineplug_vo_out_opengl_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ - video_out_opengl.c myglext.h $(X11OSD) -xineplug_vo_out_opengl_la_LIBADD = $(MLIB_LIBS) $(OPENGL_LIBS) $(GLUT_LIBS) \ - $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) -xineplug_vo_out_opengl_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing +xineplug_vo_out_opengl_la_SOURCES = video_out_opengl.c myglext.h $(X11OSD) +xineplug_vo_out_opengl_la_LIBADD = libyuv2rgb.la $(OPENGL_LIBS) $(GLUT_LIBS) \ + $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_opengl_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(AVUTIL_CFLAGS) -fno-strict-aliasing xineplug_vo_out_syncfb_la_SOURCES = video_out_syncfb.c xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) @@ -162,18 +166,16 @@ xineplug_vo_out_vidix_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/contrib/vid xineplug_vo_out_aa_la_SOURCES = video_out_aa.c -xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_vo_out_aa_la_CFLAGS = $(AM_CFLAGS) $(AALIB_CFLAGS) +xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_aa_la_CFLAGS = $(AM_CFLAGS) $(AALIB_CFLAGS) $(AVUTIL_CFLAGS) -xineplug_vo_out_caca_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ - video_out_caca.c -xineplug_vo_out_caca_la_LIBADD = $(CACA_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_vo_out_caca_la_CFLAGS = $(AM_CFLAGS) $(CACA_CFLAGS) +xineplug_vo_out_caca_la_SOURCES = video_out_caca.c +xineplug_vo_out_caca_la_LIBADD = libyuv2rgb.la $(CACA_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_caca_la_CFLAGS = $(AM_CFLAGS) $(CACA_CFLAGS) $(AVUTIL_CFLAGS) -xineplug_vo_out_fb_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ - video_out_fb.c -xineplug_vo_out_fb_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_vo_out_fb_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) +xineplug_vo_out_fb_la_SOURCES = video_out_fb.c +xineplug_vo_out_fb_la_LIBADD = libyuv2rgb.la $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_fb_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS) xineplug_vo_out_directfb_la_SOURCES = video_out_directfb.c xineplug_vo_out_directfb_la_LIBADD = $(XINE_LIB) $(DIRECTFB_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) @@ -191,8 +193,8 @@ xineplug_vo_out_stk_la_SOURCES = video_out_stk.c xineplug_vo_out_stk_la_LIBADD = $(XINE_LIB) $(LIBSTK_LIBS) $(PTHREAD_LIBS) xineplug_vo_out_stk_la_CFLAGS = $(AM_CFLAGS) $(LIBSTK_CFLAGS) -xineplug_vo_out_directx_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c video_out_directx.c -xineplug_vo_out_directx_la_LIBADD = $(DIRECTX_VIDEO_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) +xineplug_vo_out_directx_la_SOURCES = video_out_directx.c +xineplug_vo_out_directx_la_LIBADD = libyuv2rgb.la $(DIRECTX_VIDEO_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_vo_out_directx_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIRECTX_CPPFLAGS) xineplug_vo_out_none_la_SOURCES = video_out_none.c diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c index bcbe2477e..b30e3c496 100644 --- a/src/video_out/video_out_aa.c +++ b/src/video_out/video_out_aa.c @@ -35,6 +35,9 @@ #include <sys/mman.h> #include <sys/time.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #include <aalib.h> #include "xine.h" @@ -51,7 +54,6 @@ typedef struct aa_frame_s { vo_frame_t vo_frame; int width, height; - uint8_t *mem[3]; double ratio; @@ -87,9 +89,9 @@ static uint32_t aa_get_capabilities (vo_driver_t *this) { static void aa_dispose_frame (vo_frame_t *vo_img) { aa_frame_t *frame = (aa_frame_t *)vo_img; - free (frame->mem[0]); - free (frame->mem[1]); - free (frame->mem[2]); + av_free (frame->vo_frame.base[0]); + av_free (frame->vo_frame.base[1]); + av_free (frame->vo_frame.base[2]); free (frame); } @@ -129,9 +131,9 @@ static void aa_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { - free (frame->mem[0]); frame->mem[0] = NULL; - free (frame->mem[1]); frame->mem[1] = NULL; - free (frame->mem[2]); frame->mem[2] = NULL; + av_freep (&frame->vo_frame.base[0]); + av_freep (&frame->vo_frame.base[1]); + av_freep (&frame->vo_frame.base[2]); frame->width = width; frame->height = height; @@ -142,15 +144,15 @@ static void aa_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, 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->mem[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[1] * ((height+1)/2), (void**) &frame->mem[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[2] * ((height+1)/2), (void**) &frame->mem[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)); /* printf ("allocated yuv memory for %d x %d image\n", width, height); */ } else if (format == XINE_IMGFMT_YUY2) { 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->mem[0]); + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); } else { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "alert! unsupported image format %04x\n", format); _x_abort(); diff --git a/src/video_out/video_out_caca.c b/src/video_out/video_out_caca.c index 231befcdb..f98733098 100644 --- a/src/video_out/video_out_caca.c +++ b/src/video_out/video_out_caca.c @@ -37,6 +37,9 @@ #include <cucul.h> #include <caca.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #include "xine.h" #include "video_out.h" #include "xine_internal.h" @@ -54,7 +57,6 @@ typedef struct caca_frame_s { cucul_dither_t *pixmap_s; /* pixmap info structure */ uint8_t *pixmap_d; /* pixmap data */ int width, height; - uint8_t *mem[3]; int format; /* XINE_IMGFMT_* flags */ @@ -94,9 +96,9 @@ static uint32_t caca_get_capabilities (vo_driver_t *this) { static void caca_dispose_frame (vo_frame_t *vo_img) { caca_frame_t *frame = (caca_frame_t *)vo_img; - free (frame->mem[0]); - free (frame->mem[1]); - free (frame->mem[2]); + av_free (frame->vo_frame.base[0]); + av_free (frame->vo_frame.base[1]); + av_free (frame->vo_frame.base[2]); free (frame->pixmap_d); if (frame->pixmap_s) @@ -144,9 +146,9 @@ static void caca_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { - free (frame->mem[0]); frame->mem[0] = NULL; - free (frame->mem[1]); frame->mem[1] = NULL; - free (frame->mem[2]); frame->mem[2] = NULL; + av_freep (&frame->vo_frame.base[0]); + av_freep (&frame->vo_frame.base[1]); + av_freep (&frame->vo_frame.base[2]); free (frame->pixmap_d); frame->pixmap_d = NULL; @@ -167,19 +169,15 @@ static void caca_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, 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->mem[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned(16, - frame->vo_frame.pitches[1] * ((height+1)/2), (void**) &frame->mem[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned(16, - frame->vo_frame.pitches[2] * ((height+1)/2), (void**) &frame->mem[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)); frame->yuv2rgb->configure (frame->yuv2rgb, width, height, frame->vo_frame.pitches[0], frame->vo_frame.pitches[1], width, height, width * 4); } else if (format == XINE_IMGFMT_YUY2) { 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->mem[0]); + frame->vo_frame.base[0] = av_mallocz(frame->vo_frame.pitches[0] * height); frame->yuv2rgb->configure (frame->yuv2rgb, width, height, frame->vo_frame.pitches[0], frame->vo_frame.pitches[0], width, height, width * 4); diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 859959455..f07cb9c23 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -68,6 +68,9 @@ #include <pthread.h> #include <netinet/in.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #include <linux/fb.h> #include <linux/kd.h> #include <linux/vt.h> @@ -92,8 +95,6 @@ typedef struct fb_frame_s vo_scale_t sc; - uint8_t *chunk[3]; /* mem alloc by xmalloc_aligned */ - yuv2rgb_t *yuv2rgb; /* yuv2rgb converter for this frame */ uint8_t *rgb_dst; int yuv_stride; @@ -324,10 +325,9 @@ static void setup_colorspace_converter(fb_frame_t *frame, int flags) static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, uint32_t width, uint32_t height, int format) { - free(frame->chunk[0]); - free(frame->chunk[1]); - free(frame->chunk[2]); - memset(frame->chunk, 0, sizeof(frame->chunk[0])*3); + av_freep(&frame->vo_frame.base[0]); + av_freep(&frame->vo_frame.base[1]); + av_freep(&frame->vo_frame.base[2]); if(this->use_zero_copy) { @@ -349,35 +349,15 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, 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); } } diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index 04413eb80..e47ab97fd 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.c @@ -47,6 +47,9 @@ #include <ctype.h> #include <pthread.h> +/* libavutil from FFmpeg */ +#include <mem.h> + /* defines for debugging extensions only */ /* #define GL_GLEXT_LEGACY */ #include <GL/gl.h> @@ -140,7 +143,6 @@ typedef struct { int width, height, format, flags; double ratio; - uint8_t *chunk[4]; /* mem alloc by xmalloc_aligned */ uint8_t *rgb, *rgb_dst; yuv2rgb_t *yuv2rgb; /* yuv2rgb converter set up for this frame */ @@ -1269,10 +1271,10 @@ static void opengl_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]); + av_free (frame->vo_frame.base[0]); + av_free (frame->vo_frame.base[1]); + av_free (frame->vo_frame.base[2]); + av_free (frame->rgb); free (frame); } @@ -1350,26 +1352,23 @@ static void opengl_update_frame_format (vo_driver_t *this_gen, XLockDisplay (this->display); /* (re-) allocate render space */ - free (frame->chunk[0]); - free (frame->chunk[1]); - free (frame->chunk[2]); - free (frame->chunk[3]); + av_freep(&frame->vo_frame.base[0]); + av_freep(&frame->vo_frame.base[1]); + av_freep(&frame->vo_frame.base[2]); + av_freep(&frame->rgb); if (format == XINE_IMGFMT_YV12) { 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); } - frame->rgb = xine_xmalloc_aligned (16, BYTES_PER_PIXEL*width*height, - (void **) &frame->chunk[3]); + frame->rgb = av_mallocz(BYTES_PER_PIXEL*width*height); /* set up colorspace converter */ switch (flags) { diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index 013695c46..c8373df28 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.c @@ -525,9 +525,6 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, switch(format) { case XINE_IMGFMT_YV12: -/* frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame_size, (void **)&frame->data_mem[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned(16, frame_size/4, (void **)&frame->data_mem[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned(16, frame_size/4, (void **)&frame->data_mem[2]);*/ 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); @@ -536,7 +533,6 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, frame->vo_frame.base[2] = malloc(frame->vo_frame.pitches[2] * ((height+1)/2)); break; case XINE_IMGFMT_YUY2: -/* frame->vo_frame.base[0] = xine_xmalloc_aligned(16, (frame_size*2), (void **)&frame->data_mem[0]);*/ frame->vo_frame.pitches[0] = 8*((width + 3) / 4); frame->vo_frame.base[0] = malloc(frame->vo_frame.pitches[0] * height); frame->vo_frame.base[1] = NULL; diff --git a/src/video_out/video_out_xcbshm.c b/src/video_out/video_out_xcbshm.c index c6ad9e2f1..9881e7888 100644 --- a/src/video_out/video_out_xcbshm.c +++ b/src/video_out/video_out_xcbshm.c @@ -50,6 +50,9 @@ #include <pthread.h> #include <netinet/in.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #define LOG_MODULE "video_out_xcbshm" #define LOG_VERBOSE /* @@ -76,8 +79,6 @@ typedef struct { int bytes_per_line; xcb_shm_seg_t shmseg; - uint8_t *chunk[3]; /* mem alloc by xmalloc_aligned */ - yuv2rgb_t *yuv2rgb; /* yuv2rgb converter set up for this frame */ uint8_t *rgb_dst; @@ -287,9 +288,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); } @@ -437,18 +438,9 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, dispose_ximage(this, frame); - 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]); } create_ximage(this, frame, frame->sc.output_width, frame->sc.output_height); @@ -459,14 +451,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", 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", diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c index 0ca6537a7..99afed05f 100644 --- a/src/video_out/yuv2rgb.c +++ b/src/video_out/yuv2rgb.c @@ -31,6 +31,9 @@ #include <string.h> #include <inttypes.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #include "yuv2rgb.h" #define LOG_MODULE "yuv2rgb" @@ -3182,7 +3185,7 @@ static yuv2rgb_t *yuv2rgb_create_converter (yuv2rgb_factory_t *factory) { static void yuv2rgb_factory_dispose (yuv2rgb_factory_t *this) { free (this->table_base); - free (this->table_mmx_base); + av_free(this->table_mmx); free (this); } @@ -3203,7 +3206,6 @@ yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, this->matrix_coefficients = 6; this->table_base = NULL; this->table_mmx = NULL; - this->table_mmx_base = NULL; yuv2rgb_set_csc_levels (this, 0, 128, 128); diff --git a/src/video_out/yuv2rgb_mmx.c b/src/video_out/yuv2rgb_mmx.c index 20a9b5a00..3d834d672 100644 --- a/src/video_out/yuv2rgb_mmx.c +++ b/src/video_out/yuv2rgb_mmx.c @@ -31,6 +31,9 @@ #include <string.h> #include <inttypes.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #include "yuv2rgb.h" #include "xineutils.h" @@ -70,7 +73,7 @@ void mmx_yuv2rgb_set_csc_levels(yuv2rgb_factory_t *this, /* 'table_mmx' is 64bit aligned for better performance */ if (this->table_mmx == NULL) { - this->table_mmx = xine_xmalloc_aligned (8, sizeof(mmx_csc_t), &this->table_mmx_base); + this->table_mmx = av_mallocz(sizeof(mmx_csc_t)); } if( brightness <= 16 ) { |