[vlc-devel] [PATCH] libmp4: add macro MP4_GET4or8BYTES

Robert Forsman bob.forsman at ericsson.com
Tue Mar 27 16:30:04 CEST 2012


On Tue, 27 Mar 2012 05:22:02 -0400
Frédéric Yhuel <fyhuel at viotech.net> wrote:

> ---
>  modules/demux/mp4/libmp4.c |  114 ++++++++++++++------------------------------
>  1 files changed, 36 insertions(+), 78 deletions(-)
> 
> diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
> index e921398..a25da8d 100644
> --- a/modules/demux/mp4/libmp4.c
> +++ b/modules/demux/mp4/libmp4.c
> @@ -61,6 +61,12 @@ static inline size_t mp4_box_headersize( MP4_Box_t *p_box )
>  #define MP4_GETFOURCC( dst ) MP4_GETX_PRIVATE( dst, \
>                  VLC_FOURCC(p_peek[0],p_peek[1],p_peek[2],p_peek[3]), 4)
> 
> +#define MP4_GET4or8BYTES( dst ) \
> +    if( (i_version) == 0 ) \
> +        MP4_GET4BYTES( dst ); \
> +    else \
> +        MP4_GET8BYTES( dst ); \
> +


While that patch makes the code more compact, I am concerned that it
affects readability of the code.  As sprawling as the previous version
was, it matched up better with ISO 14496-12 section 8.2.2.2's syntax
specification.

Different programmers, when faced with a choice between compactness and
"readability" will make different choices, so I'm not really objecting,
just illuminating the choice.



More information about the vlc-devel mailing list