[FFmpeg-trac] #315(avutil:new): AVPictureType enum misses the undefined type

FFmpeg trac at avcodec.org
Tue Jun 28 07:36:45 CEST 2011


#315: AVPictureType enum misses the undefined type
--------------------------+---------------------
  Reporter:  mm           |      Owner:  michael
      Type:  defect       |     Status:  new
  Priority:  important    |  Component:  avutil
   Version:  unspecified  |   Keywords:
Blocked By:               |   Blocking:
Reproduced:  0            |   Analyzed:  0
--------------------------+---------------------
 In commit bebe72f4a05d338e04ae9ca1e9c6b72749b488aa, the enum
 AV_PICTURE_TYPE_* was introduced. There are still places in the code where
 pict_type is used as an integer and there is a case where "pict_type = 0"
 with the explanation "let ffmpeg decide what to do". The new enum does not
 know a value of 0 and C++ will fail if compiling such programs anyway as
 it is refered as an int (and you cannot patch them properly).

 Examples:
 {{{
 ffmpeg.c:1290:                big_picture.pict_type = 0;
 libavfilter/libmpcodecs/vf_blackframe.c:89:    if (pict_type > 3 ||
 pict_type < 0) pict_type = 0;
 }}}

 This is very important for git-oldabi but also relevant for git-master.

 I suggest introducing a undefined type with a value of 0:

 {{{
 diff --git a/libavutil/avutil.h b/libavutil/avutil.h
 index 33eacc7..a046d5b 100644
 --- a/libavutil/avutil.h
 +++ b/libavutil/avutil.h
 @@ -104,7 +104,8 @@ enum AVMediaType {
  #define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}

  enum AVPictureType {
 -    AV_PICTURE_TYPE_I = 1, ///< Intra
 +    AV_PICTURE_TYPE_NONE = 0 ///< Undefined
 +    AV_PICTURE_TYPE_I,     ///< Intra
      AV_PICTURE_TYPE_P,     ///< Predicted
      AV_PICTURE_TYPE_B,     ///< Bi-dir predicted
      AV_PICTURE_TYPE_S,     ///< S(GMC)-VOP MPEG4
 }}}

 or fixing this problem in another way to preserve the compatibility with
 existing programs (oldabi).

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/315>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list