summaryrefslogtreecommitdiff
path: root/src/video_out/video_out_aa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_out/video_out_aa.c')
-rw-r--r--src/video_out/video_out_aa.c66
1 files changed, 23 insertions, 43 deletions
diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c
index 2f20bd7c0..1af250162 100644
--- a/src/video_out/video_out_aa.c
+++ b/src/video_out/video_out_aa.c
@@ -35,12 +35,18 @@
#include <sys/mman.h>
#include <sys/time.h>
+#ifdef HAVE_FFMPEG_AVUTIL_H
+# include <mem.h>
+#else
+# include <libavutil/mem.h>
+#endif
+
#include <aalib.h>
#include "xine.h"
-#include "video_out.h"
-#include "xine_internal.h"
-#include "xineutils.h"
+#include <xine/video_out.h>
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
/*
* global variables
@@ -51,7 +57,6 @@ typedef struct aa_frame_s {
vo_frame_t vo_frame;
int width, height;
- uint8_t *mem[3];
double ratio;
@@ -87,12 +92,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;
- if (frame->mem[0])
- free (frame->mem[0]);
- if (frame->mem[1])
- free (frame->mem[1]);
- if (frame->mem[2])
- 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);
}
@@ -132,19 +134,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)) {
- if (frame->mem[0]) {
- free (frame->mem[0]);
- frame->mem[0] = NULL;
- }
- if (frame->mem[1]) {
- free (frame->mem[1]);
- frame->mem[1] = NULL;
- }
-
- if (frame->mem[2]) {
- 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;
@@ -155,15 +147,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();
@@ -300,18 +292,6 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
return &this->vo_driver;
}
-static char* get_identifier (video_driver_class_t *this_gen) {
- return "AA";
-}
-
-static char* get_description (video_driver_class_t *this_gen) {
- return _("xine video output plugin using the ascii-art library");
-}
-
-static void dispose_class (video_driver_class_t *this_gen) {
- aa_class_t *this = (aa_class_t *) this_gen;
- free(this);
-}
static void *init_class (xine_t *xine, void *visual_gen) {
/* aa_context *context = (aa_context*) visual_gen; */
aa_class_t *this;
@@ -319,9 +299,9 @@ static void *init_class (xine_t *xine, void *visual_gen) {
this = calloc(1, sizeof(aa_class_t));
this->driver_class.open_plugin = open_plugin;
- this->driver_class.get_identifier = get_identifier;
- this->driver_class.get_description = get_description;
- this->driver_class.dispose = dispose_class;
+ this->driver_class.identifier = "AA";
+ this->driver_class.description = N_("xine video output plugin using the ascii-art library");
+ this->driver_class.dispose = default_video_driver_class_dispose;
this->config = xine->config;
this->xine = xine;
@@ -336,6 +316,6 @@ static const vo_info_t vo_info_aa = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 21, "aa", XINE_VERSION_CODE, &vo_info_aa, init_class },
+ { PLUGIN_VIDEO_OUT, 22, "aa", XINE_VERSION_CODE, &vo_info_aa, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};