/* */
#define VLC_UNUSED(x) (void)(x)
-/* Alignment of critical dynamic data structure
- *
- * Not all platforms support memalign so we provide a vlc_memalign wrapper
- * void *vlc_memalign( size_t align, size_t size, void **pp_orig )
- * *pp_orig is the pointer that has to be freed afterwards.
- */
-#if 0
-#ifdef HAVE_POSIX_MEMALIGN
-# define vlc_memalign(align,size,pp_orig) \
- ( !posix_memalign( pp_orig, align, size ) ? *(pp_orig) : NULL )
-#endif
-#endif
-#ifdef HAVE_MEMALIGN
- /* Some systems have memalign() but no declaration for it */
- void * memalign( size_t align, size_t size );
-
-# define vlc_memalign(pp_orig,align,size) \
- ( *(pp_orig) = memalign( align, size ) )
-
-#else /* We don't have any choice but to align manually */
-# define vlc_memalign(pp_orig,align,size) \
- (( *(pp_orig) = malloc( size + align - 1 )) \
- ? (void *)( (((unsigned long)*(pp_orig)) + (unsigned long)(align-1) ) \
- & (~(unsigned long)(align-1)) ) \
- : NULL )
-
-#endif
-
/* Stuff defined in src/extras/libc.c */
#ifndef HAVE_STRDUP
# define strdup vlc_strdup
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h>
+#include <assert.h>
#include <QuickTime/QuickTime.h>
p_pic->p_sys->i_size = p_vout->output.i_width * p_vout->output.i_height * 2;
/* Allocate the memory buffer */
- p_pic->p_data = vlc_memalign( &p_pic->p_data_orig,
- 16, p_pic->p_sys->i_size );
+ p_pic->p_orig_data =
+ p_pic->p_data = malloc( p_pic->p_sys->i_size );
+ /* Memory is always 16-bytes aligned on OSX, so it does not
+ * posix_memalign() */
+ assert( (((uintptr_t)p_pic->p_data) % 16) == 0 );
p_pic->p[0].p_pixels = p_pic->p_data;
p_pic->p[0].i_lines = p_vout->output.i_height;
p_pic->p_sys->i_size = sizeof(PlanarPixmapInfoYUV420);
/* Allocate the memory buffer */
- p_pic->p_data = vlc_memalign( &p_pic->p_data_orig,
- 16, p_vout->output.i_width * p_vout->output.i_height * 3 / 2 );
+ p_pic->p_orig_data =
+ p_pic->p_data = malloc( p_vout->output.i_width
+ * p_vout->output.i_height * 3 / 2 );
+ /* Memory is always 16-bytes aligned on OSX, so it does not
+ * posix_memalign() */
+ assert( (((uintptr_t)p_pic->p_data) % 16) == 0 );
/* Y buffer */
p_pic->Y_PIXELS = p_pic->p_data;
/* Planar 8-bit grayscale */
#define FOURCC_GREY VLC_FOURCC('G','R','E','Y')
+
+/* Alignment of critical dynamic data structure
+ *
+ * Not all platforms support memalign so we provide a vlc_memalign wrapper
+ * void *vlc_memalign( size_t align, size_t size, void **pp_orig )
+ * *pp_orig is the pointer that has to be freed afterwards.
+ */
+#if 0
+#ifdef HAVE_POSIX_MEMALIGN
+# define vlc_memalign(align,size,pp_orig) \
+ ( !posix_memalign( pp_orig, align, size ) ? *(pp_orig) : NULL )
+#endif
+#endif
+#ifdef HAVE_MEMALIGN
+ /* Some systems have memalign() but no declaration for it */
+ void * memalign( size_t align, size_t size );
+
+# define vlc_memalign(pp_orig,align,size) \
+ ( *(pp_orig) = memalign( align, size ) )
+
+#else /* We don't have any choice but to align manually */
+# define vlc_memalign(pp_orig,align,size) \
+ (( *(pp_orig) = malloc( size + align - 1 )) \
+ ? (void *)( (((unsigned long)*(pp_orig)) + (unsigned long)(align-1) ) \
+ & (~(unsigned long)(align-1)) ) \
+ : NULL )
+
+#endif
+