Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
bb352cd5
Commit
bb352cd5
authored
Jan 25, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Privatize the memalign replacement
parent
03700214
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
33 deletions
+41
-33
include/vlc_common.h
include/vlc_common.h
+0
-28
modules/gui/macosx/voutqt.m
modules/gui/macosx/voutqt.m
+12
-5
src/video_output/vout_pictures.h
src/video_output/vout_pictures.h
+29
-0
No files found.
include/vlc_common.h
View file @
bb352cd5
...
...
@@ -818,34 +818,6 @@ static inline void _SetQWBE( uint8_t *p, uint64_t i_qw )
/* */
#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
...
...
modules/gui/macosx/voutqt.m
View file @
bb352cd5
...
...
@@ -29,9 +29,9 @@
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
/* ENOMEM */
#include <stdlib.h>
/* free() */
#include <string.h>
#include <assert.h>
#include <QuickTime/QuickTime.h>
...
...
@@ -704,8 +704,11 @@ static int QTNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
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
;
...
...
@@ -724,8 +727,12 @@ static int QTNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
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
;
...
...
src/video_output/vout_pictures.h
View file @
bb352cd5
...
...
@@ -102,3 +102,32 @@
/* 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment