diff options
Diffstat (limited to 'src/dxr3')
-rw-r--r-- | src/dxr3/Makefile.am | 3 | ||||
-rw-r--r-- | src/dxr3/dxr3_mpeg_encoders.c | 11 | ||||
-rw-r--r-- | src/dxr3/video_out_dxr3.c | 23 |
3 files changed, 16 insertions, 21 deletions
diff --git a/src/dxr3/Makefile.am b/src/dxr3/Makefile.am index f53a2d081..692e82c84 100644 --- a/src/dxr3/Makefile.am +++ b/src/dxr3/Makefile.am @@ -43,4 +43,5 @@ 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 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 b073e6f63..a421644d4 100644 --- a/src/dxr3/video_out_dxr3.c +++ b/src/dxr3/video_out_dxr3.c @@ -575,7 +575,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); } @@ -615,12 +615,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; } @@ -705,10 +702,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; @@ -719,8 +713,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]; @@ -747,8 +740,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]; |