[FFmpeg-devel] [RFC][PATCH] Move picture type definitions from libavcodec to libavutil
Michael Niedermayer
michaelni at gmx.at
Sat Apr 23 19:54:14 CEST 2011
On Sat, Apr 23, 2011 at 05:28:30PM +0200, Stefano Sabatini wrote:
> On date Saturday 2011-04-23 13:54:52 +0200, Nicolas George encoded:
> > Le quartidi 4 floréal, an CCXIX, Stefano Sabatini a écrit :
> > > This breaks ABI as it redefines the previous values (since the first
> > > symbol will have a value of 0 rather than 1, consistent with enum
> > > definitions and allows the AV_*_NB trick).
> >
> > Couldn't you add some sort of AV_PICTURE_TYPE_UNSPEC =0 to preserve the
> > values?
>
> Rethinking about it, I dropped the redefinition (which were causing
> regressions, since the literal pict_type values are used in MPEG
> video) and the *_NB trick.
>
> No ABI breaks anymore.
thx, ABI/API breakage should always be avoided.
> --
> FFmpeg = Free and Fascinating Most Philosophical Ecumenical Glue
> libavcodec/avcodec.h | 20 +++++++++++---------
> libavcodec/utils.c | 11 +----------
> libavfilter/avfilter.h | 2 +-
> libavutil/avutil.h | 19 +++++++++++++++++++
> libavutil/utils.c | 14 ++++++++++++++
> 5 files changed, 46 insertions(+), 20 deletions(-)
> 11d11b0cd7099328153fc1249a60d41b393f90d1 0001-lavu-deprecate-FF_-_TYPE-macros-in-favor-of-AV_PICTU.patch
> From 7547199e2833e94b316dbb3f411b5574aeb95533 Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Sat, 23 Apr 2011 13:38:50 +0200
> Subject: [PATCH] lavu: deprecate FF_*_TYPE macros in favor of AV_PICTURE_TYPE_* enums
>
> Also deprecate av_get_pict_type_char() in favor of
> av_get_picture_type_char().
>
> The new enums and av_get_picture_type_char() are defined in libavutil.
> This allows the use in libavfilter without the need to link against
> libavcodec.
>
> Signed-off-by: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> ---
> libavcodec/avcodec.h | 20 +++++++++++---------
> libavcodec/utils.c | 11 +----------
> libavfilter/avfilter.h | 2 +-
> libavutil/avutil.h | 19 +++++++++++++++++++
> libavutil/utils.c | 14 ++++++++++++++
> 5 files changed, 46 insertions(+), 20 deletions(-)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 10866a1..994a334 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -766,7 +766,7 @@ typedef struct AVPanScan{
> * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
> * - decoding: Set by libavcodec.\
> */\
> - int pict_type;\
> + enum AVPictureType pict_type;\
> \
> /**\
> * presentation timestamp in time_base units (time when frame should be shown to user)\
> @@ -1016,14 +1016,14 @@ typedef struct AVPanScan{
> #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
> #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
>
> -
> -#define FF_I_TYPE 1 ///< Intra
> -#define FF_P_TYPE 2 ///< Predicted
> -#define FF_B_TYPE 3 ///< Bi-dir predicted
> -#define FF_S_TYPE 4 ///< S(GMC)-VOP MPEG4
> -#define FF_SI_TYPE 5 ///< Switching Intra
> -#define FF_SP_TYPE 6 ///< Switching Predicted
> -#define FF_BI_TYPE 7
> +/* DEPRECATED, directly use AV_PICTURE_TYPE_* enums */
> +#define FF_I_TYPE AV_PICTURE_TYPE_I ///< Intra
> +#define FF_P_TYPE AV_PICTURE_TYPE_P ///< Predicted
> +#define FF_B_TYPE AV_PICTURE_TYPE_B ///< Bi-dir predicted
> +#define FF_S_TYPE AV_PICTURE_TYPE_S ///< S(GMC)-VOP MPEG4
> +#define FF_SI_TYPE AV_PICTURE_TYPE_SI ///< Switching Intra
> +#define FF_SP_TYPE AV_PICTURE_TYPE_SP ///< Switching Predicted
> +#define FF_BI_TYPE AV_PICTURE_TYPE_BI
>
> #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).
> #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
> @@ -3863,7 +3863,9 @@ void avcodec_default_free_buffers(AVCodecContext *s);
> *
> * @param[in] pict_type the picture type
> * @return A single character representing the picture type.
> + * @deprecated use av_get_picture_type_char() instead
> */
> +attribute_deprecated
> char av_get_pict_type_char(int pict_type);
this function looks fine to me, i see no need to change it
if one was picky then int could be changed to enum
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110423/30942b32/attachment.asc>
More information about the ffmpeg-devel
mailing list