[FFmpeg-devel] [PATCH] align pix_fmt list

Michael Niedermayer michaelni
Fri Sep 25 14:16:52 CEST 2009


On Thu, Sep 24, 2009 at 09:36:55PM -0400, Justin Ruggles wrote:
> Michael Niedermayer wrote:
> 
> > On Sun, Sep 20, 2009 at 01:00:26PM -0400, Justin Ruggles wrote:
> >> Justin Ruggles wrote:
> >>
> >>> Ramiro Polla wrote:
> >>>
> >>>> On Sun, Sep 20, 2009 at 11:52 AM, Justin Ruggles
> >>>> <justin.ruggles at gmail.com> wrote:
> >>>>> There are some pixel format names with more than 10 characters, so they
> >>>>> mess up the list alignment.  Patch attached.
> >>>> [...]
> >>>>
> >>>>> diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
> >>>>> index ecadd63..8e0490a 100644
> >>>>> --- a/libavcodec/imgconvert.c
> >>>>> +++ b/libavcodec/imgconvert.c
> >>>>> @@ -585,7 +585,7 @@ void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
> >>>>>          char is_alpha_char= info.is_alpha ? 'y' : 'n';
> >>>>>
> >>>>>          snprintf (buf, buf_size,
> >>>>> -                  "%-10s" "      %1d     " "   %2d " "     %c   ",
> >>>>> +                  "%-11s" "     %1d     " "   %2d " "     %c   ",
> >>>>>                    info.name,
> >>>>>                    info.nb_channels,
> >>>>>                    info.depth,
> >>>> That's a weird format string. Why isn't it simply "%-16s%-8s%-6s%c" ?
> >>>> It gets filled up with whitespace anyways.
> >>> It is weird... Your suggestion is not quite the same, but here is a new
> >>> patch that is equivalent except for the trailing spaces.
> >> or this patch, which allows for the pixel format name to grow some more.
> > 
> > i do not want it to grow further!
> > the +1 size is of course ok though
> 
> Applied the simple size increase.  Attached patch to simplify the format
> string.
> 
> -Justin
> 
> 

>  imgconvert.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> c076d2cf64c2917073d428beda342e880412a094  pix_fmt_list_align.patch

> Index: libavcodec/imgconvert.c
> ===================================================================
> --- libavcodec/imgconvert.c	(revision 20024)
> +++ libavcodec/imgconvert.c	(working copy)
> @@ -585,7 +585,7 @@
>          char is_alpha_char= info.is_alpha ? 'y' : 'n';
>  
>          snprintf (buf, buf_size,
> -                  "%-11s" "     %1d     " "   %2d " "     %c   ",
> +                  "%-11s%6d%10d%7c",

you need 1 space seperators between numbers at least

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090925/44a4c1ad/attachment.pgp>



More information about the ffmpeg-devel mailing list