[FFmpeg-devel] [PATCH 1/3] avfilter/ass: make sure the log level are in available range

Michael Niedermayer michaelni at gmx.at
Mon Sep 15 22:43:34 CEST 2014


On Mon, Sep 15, 2014 at 08:59:06PM +0200, Clément Bœsch wrote:
> On Thu, Sep 11, 2014 at 11:53:57PM +0200, Michael Niedermayer wrote:
> > On Thu, Sep 11, 2014 at 09:13:29PM +0200, Clément Bœsch wrote:
> > > ---
> > >  libavfilter/vf_subtitles.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
> > > index 4fa1174..44273cb 100644
> > > --- a/libavfilter/vf_subtitles.c
> > > +++ b/libavfilter/vf_subtitles.c
> > > @@ -80,7 +80,9 @@ static const int ass_libavfilter_log_level_map[] = {
> > >  
> > >  static void ass_log(int ass_level, const char *fmt, va_list args, void *ctx)
> > >  {
> > > -    int level = ass_libavfilter_log_level_map[ass_level];
> > > +    const int ass_level_clip = av_clip(ass_level, 0,
> > > +        FF_ARRAY_ELEMS(ass_libavfilter_log_level_map) - 1);
> > > +    const int level = ass_libavfilter_log_level_map[ass_level_clip];
> > 
> > LGTM
> > 
> > btw, in
> >     [2] = AV_LOG_WARNING,   /* MSGL_WARN */
> >     [3] = AV_LOG_WARNING,   /* <undefined> */
> >     [4] = AV_LOG_INFO,      /* MSGL_INFO */
> >     [5] = AV_LOG_INFO,      /* <undefined> */
> >     [6] = AV_LOG_VERBOSE,   /* MSGL_V */
> > 
> > AV_LOG levels have finer level values than the named identifers
> > so it would be possible to use different levels instead of using
> > info and warning twice
> > 
> 
> Right, but we don't really need that extra complexity with finer grain;
> the <undefined> entries are basically just unmapped & unused in libass so
> they won't be called.

ahh, ok, i did not know they where unused


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140915/129b1c34/attachment.asc>


More information about the ffmpeg-devel mailing list