diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-12 12:31:40 +0100 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-12 12:31:40 +0100 |
commit | 2e3f351aab6f653313d113f0d2ec0374c2d7aee4 (patch) | |
tree | d2243a5002904e2467767cdc92ac54522aa03a93 | |
parent | 3999004c72e12aa3f718ae08c1fec5d50753af65 (diff) | |
download | xine-lib-2e3f351aab6f653313d113f0d2ec0374c2d7aee4.tar.gz xine-lib-2e3f351aab6f653313d113f0d2ec0374c2d7aee4.tar.bz2 |
Replace usage of xine_xmalloc_aligned() with av_mallocz() from libavutil, link plugins needing it to libavutil.
-rw-r--r-- | src/demuxers/Makefile.am | 8 | ||||
-rw-r--r-- | src/demuxers/demux_mpeg_block.c | 26 | ||||
-rw-r--r-- | src/demuxers/demux_mpeg_pes.c | 26 | ||||
-rw-r--r-- | src/dxr3/Makefile.am | 4 | ||||
-rw-r--r-- | src/dxr3/dxr3_mpeg_encoders.c | 11 | ||||
-rw-r--r-- | src/dxr3/video_out_dxr3.c | 23 | ||||
-rw-r--r-- | src/libffmpeg/ffmpeg_encoder.c | 5 | ||||
-rw-r--r-- | src/libmpeg2/Makefile.am | 5 | ||||
-rw-r--r-- | src/libmpeg2/decode.c | 24 | ||||
-rw-r--r-- | src/post/planar/Makefile.am | 4 | ||||
-rw-r--r-- | src/post/planar/noise.c | 9 | ||||
-rw-r--r-- | src/video_out/Makefile.am | 30 | ||||
-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_xcbshm.c | 36 | ||||
-rw-r--r-- | src/video_out/video_out_xshm.c | 36 |
18 files changed, 168 insertions, 204 deletions
diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index 4ad252d46..7e4f1db3a 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -59,7 +59,9 @@ xineplug_dmx_avi_la_SOURCES = demux_avi.c xineplug_dmx_avi_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) xineplug_dmx_mpeg_block_la_SOURCES = demux_mpeg_block.c -xineplug_dmx_mpeg_block_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) +xineplug_dmx_mpeg_block_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS) +xineplug_dmx_mpeg_block_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_dmx_mpeg_block_la_DEPS = $(AVUTIL_DEPS) xineplug_dmx_mpeg_la_SOURCES = demux_mpeg.c xineplug_dmx_mpeg_la_LIBADD = $(XINE_LIB) @@ -68,7 +70,9 @@ xineplug_dmx_mpeg_elem_la_SOURCES = demux_elem.c xineplug_dmx_mpeg_elem_la_LIBADD = $(XINE_LIB) xineplug_dmx_mpeg_pes_la_SOURCES = demux_mpeg_pes.c -xineplug_dmx_mpeg_pes_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) +xineplug_dmx_mpeg_pes_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS) +xineplug_dmx_mpeg_pes_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_dmx_mpeg_pes_la_DEPS = $(AVUTIL_DEPS) xineplug_dmx_mpeg_ts_la_SOURCES = demux_ts.c xineplug_dmx_mpeg_ts_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS) diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 32638129d..a5cf4b5e5 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.c @@ -31,6 +31,9 @@ #include <unistd.h> #include <string.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #define LOG_MODULE "demux_mpeg_block" #define LOG_VERBOSE /* @@ -70,7 +73,6 @@ typedef struct demux_mpeg_block_s { char cur_mrl[256]; uint8_t *scratch; - void *scratch_base; int64_t nav_last_end_pts; int64_t nav_last_start_pts; @@ -1176,7 +1178,7 @@ static void demux_mpeg_block_dispose (demux_plugin_t *this_gen) { demux_mpeg_block_t *this = (demux_mpeg_block_t *) this_gen; - free (this->scratch_base); + av_free (this->scratch); free (this); } @@ -1385,7 +1387,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->demux_plugin.get_optional_data = demux_mpeg_block_get_optional_data; this->demux_plugin.demux_class = class_gen; - this->scratch = xine_xmalloc_aligned (512, 4096, &this->scratch_base); + this->scratch = av_mallocz(4096); this->status = DEMUX_FINISHED; lprintf ("open_plugin:detection_method=%d\n", @@ -1397,7 +1399,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str /* use demux_mpeg for non-block devices */ if (!(input->get_capabilities(input) & INPUT_CAP_BLOCK)) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1411,7 +1413,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->blocksize = demux_mpeg_detect_blocksize( this, input ); if (!this->blocksize) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1424,7 +1426,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str || (this->scratch[2] != 0x01) || (this->scratch[3] != 0xba)) { lprintf("open_plugin:scratch failed\n"); - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1432,7 +1434,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str /* if it's a file then make sure it's mpeg-2 */ if ( !input->get_blocksize(input) && ((this->scratch[4]>>4) != 4) ) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1446,7 +1448,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; } } - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1467,7 +1469,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str ending = strrchr(mrl, '.'); if (!ending) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1477,7 +1479,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->blocksize = 2048; demux_mpeg_block_accept_input(this, input); } else { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1495,7 +1497,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->blocksize = demux_mpeg_detect_blocksize( this, input ); if (!this->blocksize) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1505,7 +1507,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; default: - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index 423da5e24..63db6bfc2 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -35,6 +35,9 @@ #include <unistd.h> #include <string.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #define LOG_MODULE "demux_mpeg_pes" #define LOG_VERBOSE /* @@ -73,7 +76,6 @@ typedef struct demux_mpeg_pes_s { char cur_mrl[256]; uint8_t *scratch; - void *scratch_base; int64_t nav_last_end_pts; int64_t nav_last_start_pts; @@ -1441,7 +1443,7 @@ static void demux_mpeg_pes_dispose (demux_plugin_t *this_gen) { demux_mpeg_pes_t *this = (demux_mpeg_pes_t *) this_gen; - free (this->scratch_base); + av_free (this->scratch); free (this); } @@ -1627,7 +1629,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->demux_plugin.get_optional_data = demux_mpeg_pes_get_optional_data; this->demux_plugin.demux_class = class_gen; - this->scratch = xine_xmalloc_aligned (512, 4096, &this->scratch_base); + this->scratch = av_mallocz(4096); this->status = DEMUX_FINISHED; /* Don't start demuxing stream until we see a program_stream_pack_header */ /* We need to system header in order to identify is the stream is mpeg1 or mpeg2. */ @@ -1646,7 +1648,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str /* use demux_mpeg_block for block devices */ if ((input->get_capabilities(input) & INPUT_CAP_BLOCK)) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1662,7 +1664,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str || (this->preview_data[2] != 0x01) ) { lprintf("open_plugin:preview_data failed\n"); - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1673,7 +1675,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case 0xbd ... 0xbe: break; default: - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1695,7 +1697,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str || (this->scratch[2] != 0x01) ) { lprintf("open_plugin:scratch failed\n"); - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1706,7 +1708,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case 0xbd ... 0xbe: break; default: - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1720,7 +1722,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str } } - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1731,7 +1733,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str const char *const ending = strrchr(mrl, '.'); if (!ending) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1739,7 +1741,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str if (strncasecmp(ending, ".MPEG", 5) && strncasecmp (ending, ".vdr", 4) && strncasecmp (ending, ".mpg", 4)) { - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } @@ -1753,7 +1755,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str break; default: - free (this->scratch_base); + av_free (this->scratch); free (this); return NULL; } diff --git a/src/dxr3/Makefile.am b/src/dxr3/Makefile.am index f53a2d081..d494f5470 100644 --- a/src/dxr3/Makefile.am +++ b/src/dxr3/Makefile.am @@ -43,4 +43,6 @@ xineplug_vo_out_dxr3_la_SOURCES = \ dxr3_scr.c \ video_out_dxr3.c -xineplug_vo_out_dxr3_la_LIBADD = $(link_fame) $(link_rte) $(link_x_libs) $(XINE_LIB) $(LTLIBINTL) $(DYNAMIC_LD_LIBS) -lm +xineplug_vo_out_dxr3_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS) +xineplug_vo_out_dxr3_la_LIBADD = $(link_fame) $(link_rte) $(link_x_libs) $(XINE_LIB) $(LTLIBINTL) $(DYNAMIC_LD_LIBS) $(AVUTIL_LIBS) -lm +xineplug_vo_out_dxr3_la_DEPS = $(AVUTIL_DEPS)
\ No newline at end of file diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c index 0c59b0b93..97971ebbc 100644 --- a/src/dxr3/dxr3_mpeg_encoders.c +++ b/src/dxr3/dxr3_mpeg_encoders.c @@ -44,6 +44,9 @@ #include <math.h> #include <unistd.h> +/* libavutil from FFmpeg */ +#include <mem.h> + #define LOG_MODULE "dxr3_mpeg_encoder" /* #define LOG_VERBOSE */ /* #define LOG */ @@ -99,7 +102,7 @@ typedef struct { char *buffer; /* temporary buffer for mpeg data */ /* temporary buffer for YUY2->YV12 conversion */ uint8_t *out[3]; /* aligned buffer for YV12 data */ - uint8_t *buf; /* unaligned YV12 buffer */ + uint8_t *buf; /* base address of YV12 buffer */ } fame_data_t; /* helper function */ @@ -337,8 +340,7 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) fame_parameters_t init_fp = FAME_PARAMETERS_INITIALIZER; double fps; - if (this->buf) free(this->buf); - this->buf = 0; + av_freep(&this->buf); this->out[0] = this->out[1] = this->out[2] = 0; /* if YUY2 and dimensions changed, we need to re-allocate the @@ -346,8 +348,7 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { int image_size = frame->vo_frame.width * frame->oheight; - this->out[0] = xine_xmalloc_aligned(16, image_size * 3/2, - (void *)&this->buf); + this->out[0] = this->buf = av_mallocz(image_size * 3/2); this->out[1] = this->out[0] + image_size; this->out[2] = this->out[1] + image_size/4; diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c index 73eb133e1..535b27232 100644 --- a/src/dxr3/video_out_dxr3.c +++ b/src/dxr3/video_out_dxr3.c @@ -587,7 +587,7 @@ static void dxr3_frame_dispose(vo_frame_t *frame_gen) { dxr3_frame_t *frame = (dxr3_frame_t *)frame_gen; - if (frame->mem) free(frame->mem); + av_free(frame->mem); pthread_mutex_destroy(&frame_gen->mutex); free(frame); } @@ -627,12 +627,9 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge frame->aspect = XINE_VO_ASPECT_ANAMORPHIC; frame->pan_scan = flags & VO_PAN_SCAN_FLAG; - if (frame->mem) { - free(frame->mem); - frame->mem = NULL; - frame->real_base[0] = frame->real_base[1] = frame->real_base[2] = NULL; - frame_gen->base[0] = frame_gen->base[1] = frame_gen->base[2] = NULL; - } + av_freep(&frame->mem); + frame->real_base[0] = frame->real_base[1] = frame->real_base[2] = NULL; + frame_gen->base[0] = frame_gen->base[1] = frame_gen->base[2] = NULL; return; } @@ -717,10 +714,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge /* if dimensions changed, we need to re-allocate frame memory */ if ((frame->vo_frame.width != width) || (frame->vo_frame.height != height) || (frame->oheight != oheight) || (frame->vo_frame.format != format)) { - if (frame->mem) { - free (frame->mem); - frame->mem = NULL; - } + av_freep(&frame->mem); if (format == XINE_IMGFMT_YUY2) { int i, image_size; @@ -731,8 +725,7 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge /* planar format, only base[0] */ /* add one extra line for field swap stuff */ - frame->real_base[0] = xine_xmalloc_aligned(16, image_size + frame->vo_frame.pitches[0], - &frame->mem); + frame->real_base[0] = frame->mem = av_mallocz(image_size + frame->vo_frame.pitches[0]); /* don't use first line */ frame->real_base[0] += frame->vo_frame.pitches[0]; @@ -759,8 +752,8 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge image_size_v = frame->vo_frame.pitches[2] * ((oheight + 1) / 2); /* add one extra line for field swap stuff */ - frame->real_base[0] = xine_xmalloc_aligned(16, image_size_y + frame->vo_frame.pitches[0] + - image_size_u + image_size_v, &frame->mem); + frame->real_base[0] = frame->mem = av_mallocz(image_size_y + frame->vo_frame.pitches[0] + + image_size_u + image_size_v); /* don't use first line */ frame->real_base[0] += frame->vo_frame.pitches[0]; diff --git a/src/libffmpeg/ffmpeg_encoder.c b/src/libffmpeg/ffmpeg_encoder.c index 7fe65c7fa..f7401f6ab 100644 --- a/src/libffmpeg/ffmpeg_encoder.c +++ b/src/libffmpeg/ffmpeg_encoder.c @@ -61,7 +61,7 @@ typedef struct lavc_data_s { uint8_t *ffmpeg_buffer; /* lavc buffer */ AVFrame *picture; /* picture to be encoded */ uint8_t *out[3]; /* aligned buffer for YV12 data */ - uint8_t *buf; /* unaligned YV12 buffer */ + uint8_t *buf; /* base address of YV12 buffer */ } lavc_data_t; @@ -108,8 +108,7 @@ static int lavc_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { int image_size = frame->vo_frame.pitches[0] * frame->oheight; - this->out[0] = xine_xmalloc_aligned(16, image_size * 3/2, - (void *)&this->buf); + this->out[0] = this->buf = av_mallocz(image_size * 3/2); this->out[1] = this->out[0] + image_size; this->out[2] = this->out[1] + image_size/4; diff --git a/src/libmpeg2/Makefile.am b/src/libmpeg2/Makefile.am index d772f0e09..1cf18c325 100644 --- a/src/libmpeg2/Makefile.am +++ b/src/libmpeg2/Makefile.am @@ -28,5 +28,6 @@ xineplug_decode_mpeg2_la_SOURCES = \ xine_mpeg2_decoder.c \ libmpeg2_accel.c -xineplug_decode_mpeg2_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) -lm -xineplug_decode_mpeg2_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) +xineplug_decode_mpeg2_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(AVUTIL_LIBS) -lm +xineplug_decode_mpeg2_la_DEPS = $(AVUTIL_DEPS) +xineplug_decode_mpeg2_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) $(AVUTIL_CFLAGS) diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 58f34ccbc..839289b59 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -37,6 +37,9 @@ #define LOG */ +/* libavutil from FFmpeg */ +#include <mem.h> + #include "xine_internal.h" #include "video_out.h" #include "mpeg2.h" @@ -69,11 +72,9 @@ void mpeg2_init (mpeg2dec_t * mpeg2dec, } if( !mpeg2dec->chunk_buffer ) - mpeg2dec->chunk_buffer = xine_xmalloc_aligned (16, BUFFER_SIZE + 4, - &mpeg2dec->chunk_base); + mpeg2dec->chunk_buffer = av_mallocz(BUFFER_SIZE + 4); if( !mpeg2dec->picture ) - mpeg2dec->picture = xine_xmalloc_aligned (16, sizeof (picture_t), - &mpeg2dec->picture_base); + mpeg2dec->picture = av_mallocz(sizeof(picture_t)); mpeg2dec->shift = 0xffffff00; mpeg2dec->new_sequence = 0; @@ -91,8 +92,6 @@ void mpeg2_init (mpeg2dec_t * mpeg2dec, mpeg2dec->afd_value_seen = XINE_VIDEO_AFD_NOT_PRESENT; mpeg2dec->afd_value_reported = (XINE_VIDEO_AFD_NOT_PRESENT - 1); - memset (mpeg2dec->picture, 0, sizeof (picture_t)); - /* initialize substructures */ mpeg2_header_state_init (mpeg2dec->picture); @@ -866,16 +865,9 @@ void mpeg2_close (mpeg2dec_t * mpeg2dec) picture->backward_reference_frame = NULL; } - if ( mpeg2dec->chunk_buffer ) { - free (mpeg2dec->chunk_base); - mpeg2dec->chunk_buffer = NULL; - } - - if ( mpeg2dec->picture ) { - free (mpeg2dec->picture_base); - mpeg2dec->picture = NULL; - } - + av_freep(&mpeg2dec->chunk_buffer); + av_freep(&mpeg2dec->picture_base); + if ( mpeg2dec->cc_dec) { /* dispose the closed caption decoder */ mpeg2dec->cc_dec->dispose(mpeg2dec->cc_dec); diff --git a/src/post/planar/Makefile.am b/src/post/planar/Makefile.am index 26aeec3b3..68a3953bf 100644 --- a/src/post/planar/Makefile.am +++ b/src/post/planar/Makefile.am @@ -9,7 +9,9 @@ $(top_builddir)/contrib/ffmpeg/libpostproc/libpostproc.a: noinst_LTLIBRARIES = libpost_planar_asm.la libpost_planar_asm_la_SOURCES = eq.c eq2.c noise.c -libpost_planar_asm_la_CFLAGS = $(O1_CFLAGS) -fomit-frame-pointer $(AM_CFLAGS) +libpost_planar_asm_la_CFLAGS = $(O1_CFLAGS) -fomit-frame-pointer $(AM_CFLAGS) $(AVUTIL_CFLAGS) +libpost_planar_asm_la_LIBADD = $(AVUTIL_LIBS) +libpost_planar_asm_la_DEPS = $(AVUTIL_DEPS) xinepost_LTLIBRARIES = xineplug_post_planar.la xineplug_post_planar_la_SOURCES = planar.c invert.c expand.c fill.c boxblur.c \ diff --git a/src/post/planar/noise.c b/src/post/planar/noise.c index 8c04f2e72..6ca1ec967 100644 --- a/src/post/planar/noise.c +++ b/src/post/planar/noise.c @@ -27,6 +27,8 @@ #include <math.h> #include <pthread.h> +/* libavutil from FFmpeg */ +#include <mem.h> #ifdef ARCH_X86_64 # define REG_a "rax" @@ -55,7 +57,6 @@ typedef struct noise_param_t { shiftptr; int8_t *noise, *prev_shift[MAX_RES][3]; - void *base; } noise_param_t; static int nonTempRandShift[MAX_RES]= {-1}; @@ -72,9 +73,8 @@ static int8_t *initNoise(noise_param_t *fp){ int pattern= fp->pattern; int8_t *noise; int i, j; - void *base; - noise = xine_xmalloc_aligned(16, MAX_NOISE*sizeof(int8_t), &base); + noise = av_mallocz(MAX_NOISE*sizeof(int8_t)); srand(123457); for(i=0,j=0; i<MAX_NOISE; i++,j++) @@ -130,7 +130,6 @@ static int8_t *initNoise(noise_param_t *fp){ } fp->noise= noise; - fp->base = base; fp->shiftptr= 0; return noise; } @@ -537,6 +536,8 @@ static void noise_dispose(post_plugin_t *this_gen) if (_x_post_dispose(this_gen)) { pthread_mutex_destroy(&this->lock); + av_free(this->params[0].noise); + av_free(this->params[1].noise); free(this); } } diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 38f8f3761..aff164494 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -116,16 +116,18 @@ xineplug_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ xineplug_vo_out_none.la 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) -xineplug_vo_out_xcbshm_la_CFLAGS = $(AM_CFLAGS) $(XCB_CFLAGS) $(XCBSHM_CFLAGS) +xineplug_vo_out_xcbshm_la_LIBADD = libyuv2rgb.la $(XINE_LIB) $(PTHREAD_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_xcbshm_la_DEPENDENCIES = $(AVUTIL_DEPS) +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 = video_out_xshm.c $(X11OSD) -xineplug_vo_out_xshm_la_LIBADD = libyuv2rgb.la $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_vo_out_xshm_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) -fno-strict-aliasing +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_xshm_la_DEPENDENCIES = $(AVUTIL_DEPS) 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) @@ -142,8 +144,9 @@ xineplug_vo_out_xxmc_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(XV_CFLAGS) -fno-stri 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) -xineplug_vo_out_opengl_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) -fno-strict-aliasing + $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_opengl_la_DEPENDENCIES = $(AVUTIL_DEPS) +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) @@ -167,16 +170,19 @@ 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_DEPENDENCIES = $(AVUTIL_DEPS) +xineplug_vo_out_aa_la_CFLAGS = $(AM_CFLAGS) $(AALIB_CFLAGS) $(AVUTIL_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) -xineplug_vo_out_caca_la_CFLAGS = $(AM_CFLAGS) $(CACA_CFLAGS) +xineplug_vo_out_caca_la_LIBADD = libyuv2rgb.la $(CACA_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_caca_la_DEPENDENCIES = $(AVUTIL_DEPS) +xineplug_vo_out_caca_la_CFLAGS = $(AM_CFLAGS) $(CACA_CFLAGS) $(AVUTIL_CFLAGS) xineplug_vo_out_fb_la_SOURCES = video_out_fb.c -xineplug_vo_out_fb_la_LIBADD = libyuv2rgb.la $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) -xineplug_vo_out_fb_la_CFLAGS = $(AM_CFLAGS) +xineplug_vo_out_fb_la_LIBADD = libyuv2rgb.la $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) $(AVUTIL_LIBS) +xineplug_vo_out_fb_la_DEPENDENCIES = $(AVUTIL_DEPS) +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) diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c index 035e2d98b..1a362fdd1 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 559efbd6c..41c20bd45 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 08663ae61..b0a36ab04 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 54696f452..f19027698 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_xcbshm.c b/src/video_out/video_out_xcbshm.c index 5de8a4fd3..084ae5e0a 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 40986899a..42190bc4a 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", |