On Mon, 30 Jun 2014 23:32:40 +0100, Kieran Kunhya <[email protected]> wrote:
> ---
>  doc/APIchanges         |    4 ++++
>  libavcodec/avcodec.h   |    5 ++++-
>  libavcodec/mpeg12dec.c |   21 ++++++++++++++++++++-
>  libavcodec/version.h   |    5 ++++-
>  libavutil/frame.h      |   12 ++++++++++++
>  libavutil/version.h    |    4 ++--
>  6 files changed, 46 insertions(+), 5 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 4714012..dd46d06 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,10 @@ libavutil:     2013-12-xx
>  
>  API changes, most recent first:
>  
> +2014-06-xx - xxxxxxx - lavc 55.57.0 - avcodec.h
> +2014-06-xx - xxxxxxx - lavu 53.18.0 - frame.h
> +  Deprecate AVCodecContext.dtg_active_format and use side-data instead
> +
>  2014-06-xx - xxxxxxx - lavu 53.17.0 - imgutils.h
>    Add av_image_check_sar().
>  
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index cc74aee..b48217c 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -1493,6 +1493,7 @@ typedef struct AVCodecContext {
>       */
>      int me_subpel_quality;
>  
> +#if FF_API_AFD
>      /**
>       * DTG active format information (additional aspect ratio
>       * information only used in DVB MPEG-2 transport streams)
> @@ -1500,8 +1501,9 @@ typedef struct AVCodecContext {
>       *
>       * - encoding: unused
>       * - decoding: Set by decoder.
> +     * @deprecated Deprecated in favour of AVSideData
>       */
> -    int dtg_active_format;
> +    attribute_deprecated int dtg_active_format;
>  #define FF_DTG_AFD_SAME         8
>  #define FF_DTG_AFD_4_3          9
>  #define FF_DTG_AFD_16_9         10
> @@ -1509,6 +1511,7 @@ typedef struct AVCodecContext {
>  #define FF_DTG_AFD_4_3_SP_14_9  13
>  #define FF_DTG_AFD_16_9_SP_14_9 14
>  #define FF_DTG_AFD_SP_4_3       15
> +#endif
>  
>      /**
>       * maximum motion estimation search range in subpel units
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 0bf3c20..a7a0fd2 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -54,6 +54,8 @@ typedef struct Mpeg1Context {
>      int has_stereo3d;
>      uint8_t *a53_caption;
>      int a53_caption_size;
> +    uint8_t afd;
> +    int has_afd;
>      int slice_count;
>      int save_aspect_info;
>      int save_width, save_height, save_progressive_seq;
> @@ -1631,6 +1633,18 @@ static int mpeg_field_start(MpegEncContext *s, const 
> uint8_t *buf, int buf_size)
>              *stereo = s1->stereo3d;
>              s1->has_stereo3d = 0;
>          }
> +        
> +        if (s1->has_afd) {
> +            AVFrameSideData *sd = av_frame_new_side_data(
> +                s->current_picture_ptr->f, AV_FRAME_DATA_AFD,
> +                1);
> +            if (!sd)
> +                return AVERROR(ENOMEM);
> +
> +            sd->data = s1->afd;
> +            s1->has_afd = 0;
> +        }
> +        
>          if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME))
>              ff_thread_finish_setup(avctx);
>      } else { // second field
> @@ -2221,6 +2235,7 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
>                                    const uint8_t *p, int buf_size)
>  {
>      const uint8_t *buf_end = p + buf_size;
> +    Mpeg1Context *s1   = avctx->priv_data;
>  
>      /* we parse the DTG active format information */
>      if (buf_end - p >= 5 &&
> @@ -2234,7 +2249,12 @@ static void mpeg_decode_user_data(AVCodecContext 
> *avctx,
>          if (flags & 0x40) {
>              if (buf_end - p < 1)
>                  return;
> +#if FF_API_AFD
>              avctx->dtg_active_format = p[0] & 0x0f;
> +#else
> +            s1->has_afd = 1;
> +            s1->afd = p[0] & 0x0f;
> +#endif
>          }
>      } else if (buf_end - p >= 6 &&
>                 p[0] == 'J' && p[1] == 'P' && p[2] == '3' && p[3] == 'D' &&
> @@ -2246,7 +2266,6 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
>              S3D_video_format_type == 0x04 ||
>              S3D_video_format_type == 0x08 ||
>              S3D_video_format_type == 0x23) {
> -            Mpeg1Context *s1   = avctx->priv_data;
>  
>              s1->has_stereo3d = 1;
>  
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index dee6615..0ac5cff 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -30,7 +30,7 @@
>  
>  #define LIBAVCODEC_VERSION_MAJOR 55
>  #define LIBAVCODEC_VERSION_MINOR 55
> -#define LIBAVCODEC_VERSION_MICRO  0
> +#define LIBAVCODEC_VERSION_MICRO  1
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>                                                 LIBAVCODEC_VERSION_MINOR, \
> @@ -144,5 +144,8 @@
>  #ifndef FF_API_CODEC_NAME
>  #define FF_API_CODEC_NAME        (LIBAVCODEC_VERSION_MAJOR < 57)
>  #endif
> +#ifndef FF_API_AFD
> +#define FF_API_AFD               (LIBAVCODEC_VERSION_MAJOR < 57)
> +#endif
>  
>  #endif /* AVCODEC_VERSION_H */
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index b2159d3..5f908ba 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -82,8 +82,20 @@ enum AVFrameSideDataType {
>       * See libavutil/display.h for a detailed description of the data.
>       */
>      AV_FRAME_DATA_DISPLAYMATRIX,
> +    /** 
> +     * Active Format Description data as specified in ETSI TS 101 154
> +     */

This should mention what layout does the data have (an uint8)

> +    AV_FRAME_DATA_AFD,    
>  };
>  
> +#define FF_DTG_AFD_SAME         8
> +#define FF_DTG_AFD_4_3          9
> +#define FF_DTG_AFD_16_9         10
> +#define FF_DTG_AFD_14_9         11
> +#define FF_DTG_AFD_4_3_SP_14_9  13
> +#define FF_DTG_AFD_16_9_SP_14_9 14
> +#define FF_DTG_AFD_SP_4_3       15
> +

Those will now be defined twice until the next bump, so you should move the
FF_API_ definition in lavu and put those under the inverse of the ifdef in
avcodec.h
Or alternatively we could use this opportunity to add proper AV prefices to
those constants.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to