[FFmpeg-devel] [PATCH v22 01/23] avcodec, avutil: Move enum AVSubtitleType to avutil, add new and deprecate old values

Soft Works softworkz at hotmail.com
Thu Dec 9 14:20:35 EET 2021



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of Andreas
> Rheinhardt
> Sent: Thursday, December 9, 2021 1:17 PM
> To: ffmpeg-devel at ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v22 01/23] avcodec, avutil: Move enum
> AVSubtitleType to avutil, add new and deprecate old values
> 
> Soft Works:
> > Signed-off-by: softworkz <softworkz at hotmail.com>
> > ---
> >  libavcodec/avcodec.h | 19 +------------
> >  libavutil/Makefile   |  1 +
> >  libavutil/subfmt.h   | 66 ++++++++++++++++++++++++++++++++++++++++++++
> >  libavutil/version.h  |  1 +
> >  4 files changed, 69 insertions(+), 18 deletions(-)
> >  create mode 100644 libavutil/subfmt.h
> >
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 7ee8bc2b7c..b05c12e47e 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -35,6 +35,7 @@
> >  #include "libavutil/frame.h"
> >  #include "libavutil/log.h"
> >  #include "libavutil/pixfmt.h"
> > +#include "libavutil/subfmt.h"
> >  #include "libavutil/rational.h"
> >
> >  #include "codec.h"
> > @@ -2238,24 +2239,6 @@ typedef struct AVHWAccel {
> >   * @}
> >   */
> >
> > -enum AVSubtitleType {
> > -    SUBTITLE_NONE,
> > -
> > -    SUBTITLE_BITMAP,                ///< A bitmap, pict will be set
> > -
> > -    /**
> > -     * Plain text, the text field must be set by the decoder and is
> > -     * authoritative. ass and pict fields may contain approximations.
> > -     */
> > -    SUBTITLE_TEXT,
> > -
> > -    /**
> > -     * Formatted text, the ass field must be set by the decoder and is
> > -     * authoritative. pict and text fields may contain approximations.
> > -     */
> > -    SUBTITLE_ASS,
> > -};
> > -
> >  #define AV_SUBTITLE_FLAG_FORCED 0x00000001
> >
> >  typedef struct AVSubtitleRect {
> > diff --git a/libavutil/Makefile b/libavutil/Makefile
> > index 529046dbc8..c7843db1e4 100644
> > --- a/libavutil/Makefile
> > +++ b/libavutil/Makefile
> > @@ -74,6 +74,7 @@ HEADERS = adler32.h
> \
> >            sha512.h                                                      \
> >            spherical.h                                                   \
> >            stereo3d.h                                                    \
> > +          subfmt.h                                                      \
> >            threadmessage.h                                               \
> >            time.h                                                        \
> >            timecode.h                                                    \
> > diff --git a/libavutil/subfmt.h b/libavutil/subfmt.h
> > new file mode 100644
> > index 0000000000..88078a0d14
> > --- /dev/null
> > +++ b/libavutil/subfmt.h
> > @@ -0,0 +1,66 @@
> > +/*
> > + * Copyright (c) 2021 softworkz
> > + *
> > + * This file is part of FFmpeg.
> > + *
> > + * FFmpeg is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU Lesser General Public
> > + * License as published by the Free Software Foundation; either
> > + * version 2.1 of the License, or (at your option) any later version.
> > + *
> > + * FFmpeg is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > + * Lesser General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU Lesser General Public
> > + * License along with FFmpeg; if not, write to the Free Software
> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-
> 1301 USA
> > + */
> > +
> > +#ifndef AVUTIL_SUBFMT_H
> > +#define AVUTIL_SUBFMT_H
> > +
> > +enum AVSubtitleType {
> > +
> > +    /**
> > +     * Subtitle format unknown.
> > +     */
> > +    AV_SUBTITLE_FMT_NONE = -1,
> > +
> > +    /**
> > +     * Subtitle format unknown.
> > +     */
> > +    AV_SUBTITLE_FMT_UNKNOWN = 0,
> > +#ifdef FF_API_OLD_SUBTITLES
> 
> You should include version.h and check via #if, not #ifdef.
> The way you are doing it here only works because avcodec.h already
> happened to indirectly include libavutil/version.h before this header.

I forgot this one. Anton already mentioned it.
Thanks!


More information about the ffmpeg-devel mailing list