summaryrefslogtreecommitdiff
path: root/src/video_out
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2008-06-20 16:38:25 +0100
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2008-06-20 16:38:25 +0100
commit3ce0de86ad429962ab581b9af762aa5dc9d3f156 (patch)
tree4640aaa3ece95b03f3ee7ef74e5162005347753a /src/video_out
parent17c9a01cbafd5ff0e6645f96f8ac084fbf239e4d (diff)
parentf3974e74f2f1548bf07604fddfa60cf75b2fda57 (diff)
downloadxine-lib-3ce0de86ad429962ab581b9af762aa5dc9d3f156.tar.gz
xine-lib-3ce0de86ad429962ab581b9af762aa5dc9d3f156.tar.bz2
Merge the avutil branch; port the "raw" video output plugin.
--HG-- rename : src/combined/ffmpeg/ff_dvaudio_decoder.c => src/audio_dec/ff_dvaudio_decoder.c rename : src/combined/ffmpeg/ffmpeg_encoder.c => src/dxr3/ffmpeg_encoder.c
Diffstat (limited to 'src/video_out')
-rw-r--r--src/video_out/Makefile.am56
-rw-r--r--src/video_out/video_out_aa.c23
-rw-r--r--src/video_out/video_out_caca.c27
-rw-r--r--src/video_out/video_out_fb.c39
-rw-r--r--src/video_out/video_out_opengl.c32
-rw-r--r--src/video_out/video_out_raw.c34
-rw-r--r--src/video_out/video_out_xcbshm.c35
-rw-r--r--src/video_out/video_out_xshm.c35
-rw-r--r--src/video_out/yuv2rgb.c5
-rw-r--r--src/video_out/yuv2rgb_mmx.c4
10 files changed, 123 insertions, 167 deletions
diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am
index ac89ea5db..671e9f0ca 100644
--- a/src/video_out/Makefile.am
+++ b/src/video_out/Makefile.am
@@ -88,6 +88,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) \
$(pgx64_module) $(pgx32_module)\
@@ -105,18 +111,17 @@ xineplug_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \
xineplug_vo_out_raw.la \
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 = $(XINE_LIB) $(MLIB_LIBS) $(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 = $(XINE_LIB) $(MLIB_LIBS) $(X_LIBS) $(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 $(XINE_LIB) $(X_LIBS) $(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 = $(XINE_LIB) $(XV_LIBS) $(X_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL)
@@ -131,11 +136,10 @@ xineplug_vo_out_xxmc_la_SOURCES = $(X11OSD) video_out_xxmc.c\
xineplug_vo_out_xxmc_la_LIBADD = $(XINE_LIB) $(XXMC_LIBS) $(XV_LIBS) $(X_LIBS) $(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 = $(XINE_LIB) $(MLIB_LIBS) $(OPENGL_LIBS) \
- $(GLUT_LIBS) $(GLU_LIBS) $(X_LIBS) $(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) \
+ $(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_pgx64_la_SOURCES = video_out_pgx64.c
xineplug_vo_out_pgx64_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL)
@@ -156,18 +160,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 = $(XINE_LIB) $(AALIB_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL)
-xineplug_vo_out_aa_la_CFLAGS = $(AM_CFLAGS) $(AALIB_CFLAGS)
+xineplug_vo_out_aa_la_LIBADD = $(XINE_LIB) $(AALIB_LIBS) $(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 = $(XINE_LIB) $(CACA_LIBS) $(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 $(XINE_LIB) $(CACA_LIBS) $(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 = $(XINE_LIB) $(MLIB_LIBS) $(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)
@@ -185,16 +187,16 @@ 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 = $(XINE_LIB) $(DIRECTX_VIDEO_LIBS) $(PTHREAD_LIBS)
+xineplug_vo_out_directx_la_SOURCES = video_out_directx.c
+xineplug_vo_out_directx_la_LIBADD = libyuv2rgb.la $(XINE_LIB) $(DIRECTX_VIDEO_LIBS) $(PTHREAD_LIBS)
xineplug_vo_out_directx_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIRECTX_CPPFLAGS)
xineplug_vo_out_none_la_SOURCES = video_out_none.c
xineplug_vo_out_none_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL)
-xineplug_vo_out_raw_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c video_out_raw.c
-xineplug_vo_out_raw_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL)
-xineplug_vo_out_raw_la_CFLAGS = $(VISIBILITY_FLAG)
+xineplug_vo_out_raw_la_SOURCES = video_out_raw.c
+xineplug_vo_out_raw_la_LIBADD = libyuv2rgb.la $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS)
+xineplug_vo_out_raw_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS)
xineplug_vo_out_macosx_la_SOURCES = video_out_macosx.m
xineplug_vo_out_macosx_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS)
diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c
index 8dd6fbf56..7c021a090 100644
--- a/src/video_out/video_out_aa.c
+++ b/src/video_out/video_out_aa.c
@@ -35,6 +35,8 @@
#include <sys/mman.h>
#include <sys/time.h>
+#include <mem.h>
+
#include <aalib.h>
#include "xine.h"
@@ -51,7 +53,6 @@ typedef struct aa_frame_s {
vo_frame_t vo_frame;
int width, height;
- uint8_t *mem[3];
double ratio;
@@ -87,9 +88,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 +130,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 +143,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 2beb9ba6b..60552764f 100644
--- a/src/video_out/video_out_caca.c
+++ b/src/video_out/video_out_caca.c
@@ -37,6 +37,8 @@
#include <cucul.h>
#include <caca.h>
+#include <mem.h>
+
#include "xine.h"
#include <xine/video_out.h>
#include <xine/xine_internal.h>
@@ -54,7 +56,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 +95,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 +145,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 +168,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 0ba17ae8b..107d2a133 100644
--- a/src/video_out/video_out_fb.c
+++ b/src/video_out/video_out_fb.c
@@ -68,6 +68,8 @@
#include <pthread.h>
#include <netinet/in.h>
+#include <mem.h>
+
#include <linux/fb.h>
#include <linux/kd.h>
#include <linux/vt.h>
@@ -92,8 +94,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 +324,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 +348,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 de5510c2d..9656f9551 100644
--- a/src/video_out/video_out_opengl.c
+++ b/src/video_out/video_out_opengl.c
@@ -47,6 +47,8 @@
#include <ctype.h>
#include <pthread.h>
+#include <mem.h>
+
/* defines for debugging extensions only */
/* #define GL_GLEXT_LEGACY */
#include <GL/gl.h>
@@ -140,7 +142,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 */
@@ -1268,10 +1269,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);
}
@@ -1349,26 +1350,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_raw.c b/src/video_out/video_out_raw.c
index 4ff68b164..227331f2f 100644
--- a/src/video_out/video_out_raw.c
+++ b/src/video_out/video_out_raw.c
@@ -54,14 +54,13 @@
#include "yuv2rgb.h"
#include <xine/xineutils.h>
-
+#include <mem.h>
typedef struct {
vo_frame_t vo_frame;
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 */
@@ -278,10 +277,10 @@ 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]);
+ 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);
}
@@ -333,26 +332,25 @@ static void raw_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge
flags &= VO_BOTH_FIELDS;
/* (re-) allocate render space */
- 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);
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->vo_frame.base[1] = NULL;
+ frame->vo_frame.base[2] = NULL;
}
- 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_xcbshm.c b/src/video_out/video_out_xcbshm.c
index 1c347952c..509412eb6 100644
--- a/src/video_out/video_out_xcbshm.c
+++ b/src/video_out/video_out_xcbshm.c
@@ -50,6 +50,8 @@
#include <pthread.h>
#include <netinet/in.h>
+#include <mem.h>
+
#define LOG_MODULE "video_out_xcbshm"
#define LOG_VERBOSE
/*
@@ -76,8 +78,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 +287,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 +437,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 +450,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 3578ebc64..54cac9d46 100644
--- a/src/video_out/video_out_xshm.c
+++ b/src/video_out/video_out_xshm.c
@@ -51,6 +51,8 @@
#include <pthread.h>
#include <netinet/in.h>
+#include <mem.h>
+
#define LOG_MODULE "video_out_xshm"
#define LOG_VERBOSE
/*
@@ -80,8 +82,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 +380,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 +530,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 +546,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 2f40b468c..7def639a4 100644
--- a/src/video_out/yuv2rgb.c
+++ b/src/video_out/yuv2rgb.c
@@ -31,6 +31,8 @@
#include <string.h>
#include <inttypes.h>
+#include <mem.h>
+
#include "yuv2rgb.h"
#define LOG_MODULE "yuv2rgb"
@@ -3182,7 +3184,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 +3205,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 1835efe68..52a683d30 100644
--- a/src/video_out/yuv2rgb_mmx.c
+++ b/src/video_out/yuv2rgb_mmx.c
@@ -31,6 +31,8 @@
#include <string.h>
#include <inttypes.h>
+#include <mem.h>
+
#include "yuv2rgb.h"
#include <xine/xineutils.h>
@@ -70,7 +72,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 ) {