]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit '8f12ef9860d0e164e4647fd5d5cebdb3cfb34a79'
authorHendrik Leppkes <h.leppkes@gmail.com>
Sat, 5 Sep 2015 15:31:45 +0000 (17:31 +0200)
committerHendrik Leppkes <h.leppkes@gmail.com>
Sat, 5 Sep 2015 15:31:45 +0000 (17:31 +0200)
* commit '8f12ef9860d0e164e4647fd5d5cebdb3cfb34a79':
  lavu: Drop deprecated duplicated AVFrame/AVCodecContext parameters

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
1  2 
libavcodec/avcodec.h
libavcodec/utils.c
libavutil/frame.c
libavutil/frame.h
libavutil/version.h

Simple merge
index 18d86e3385d8979974596929d999216fecacf419,1d718b288c86ccd7270bf3775e2abf51e479735d..cfc561346f03d5f5fef670987f11d4b52bee1d9e
@@@ -1096,88 -818,6 +1096,63 @@@ int ff_get_format(AVCodecContext *avctx
      return ret;
  }
  
- #if FF_API_AVFRAME_LAVC
- void avcodec_get_frame_defaults(AVFrame *frame)
- {
- #if LIBAVCODEC_VERSION_MAJOR >= 55
-      // extended_data should explicitly be freed when needed, this code is unsafe currently
-      // also this is not compatible to the <55 ABI/API
-     if (frame->extended_data != frame->data && 0)
-         av_freep(&frame->extended_data);
- #endif
-     memset(frame, 0, sizeof(AVFrame));
-     av_frame_unref(frame);
- }
- AVFrame *avcodec_alloc_frame(void)
- {
-     return av_frame_alloc();
- }
- void avcodec_free_frame(AVFrame **frame)
- {
-     av_frame_free(frame);
- }
- #endif
 +MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase)
 +MAKE_ACCESSORS(AVCodecContext, codec, const AVCodecDescriptor *, codec_descriptor)
 +MAKE_ACCESSORS(AVCodecContext, codec, int, lowres)
 +MAKE_ACCESSORS(AVCodecContext, codec, int, seek_preroll)
 +MAKE_ACCESSORS(AVCodecContext, codec, uint16_t*, chroma_intra_matrix)
 +
 +unsigned av_codec_get_codec_properties(const AVCodecContext *codec)
 +{
 +    return codec->properties;
 +}
 +
 +int av_codec_get_max_lowres(const AVCodec *codec)
 +{
 +    return codec->max_lowres;
 +}
 +
 +static void get_subtitle_defaults(AVSubtitle *sub)
 +{
 +    memset(sub, 0, sizeof(*sub));
 +    sub->pts = AV_NOPTS_VALUE;
 +}
 +
 +static int get_bit_rate(AVCodecContext *ctx)
 +{
 +    int bit_rate;
 +    int bits_per_sample;
 +
 +    switch (ctx->codec_type) {
 +    case AVMEDIA_TYPE_VIDEO:
 +    case AVMEDIA_TYPE_DATA:
 +    case AVMEDIA_TYPE_SUBTITLE:
 +    case AVMEDIA_TYPE_ATTACHMENT:
 +        bit_rate = ctx->bit_rate;
 +        break;
 +    case AVMEDIA_TYPE_AUDIO:
 +        bits_per_sample = av_get_bits_per_sample(ctx->codec_id);
 +        bit_rate = bits_per_sample ? ctx->sample_rate * ctx->channels * bits_per_sample : ctx->bit_rate;
 +        break;
 +    default:
 +        bit_rate = 0;
 +        break;
 +    }
 +    return bit_rate;
 +}
 +
 +int attribute_align_arg ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
 +{
 +    int ret = 0;
 +
 +    ff_unlock_avcodec();
 +
 +    ret = avcodec_open2(avctx, codec, options);
 +
 +    ff_lock_avcodec(avctx, codec);
 +    return ret;
 +}
 +
  int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
  {
      int ret = 0;
index 3a84811b874bdc3a0c53576531dd90c42f0e66d3,32ec47066b90f08523220fa3695232ff7f0d3dc5..f403fd75ddfdf67a758daa911fb9fd6b5825e434
@@@ -275,93 -197,6 +275,88 @@@ int av_frame_get_buffer(AVFrame *frame
      return AVERROR(EINVAL);
  }
  
- #if FF_API_AVFRAME_LAVC
- FF_DISABLE_DEPRECATION_WARNINGS
-     dst->type                   = src->type;
- FF_ENABLE_DEPRECATION_WARNINGS
- #endif
 +static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
 +{
 +    int i;
 +
 +    dst->key_frame              = src->key_frame;
 +    dst->pict_type              = src->pict_type;
 +    dst->sample_aspect_ratio    = src->sample_aspect_ratio;
 +    dst->pts                    = src->pts;
 +    dst->repeat_pict            = src->repeat_pict;
 +    dst->interlaced_frame       = src->interlaced_frame;
 +    dst->top_field_first        = src->top_field_first;
 +    dst->palette_has_changed    = src->palette_has_changed;
 +    dst->sample_rate            = src->sample_rate;
 +    dst->opaque                 = src->opaque;
 +    dst->pkt_pts                = src->pkt_pts;
 +    dst->pkt_dts                = src->pkt_dts;
 +    dst->pkt_pos                = src->pkt_pos;
 +    dst->pkt_size               = src->pkt_size;
 +    dst->pkt_duration           = src->pkt_duration;
 +    dst->reordered_opaque       = src->reordered_opaque;
 +    dst->quality                = src->quality;
 +    dst->best_effort_timestamp  = src->best_effort_timestamp;
 +    dst->coded_picture_number   = src->coded_picture_number;
 +    dst->display_picture_number = src->display_picture_number;
 +    dst->flags                  = src->flags;
 +    dst->decode_error_flags     = src->decode_error_flags;
 +    dst->color_primaries        = src->color_primaries;
 +    dst->color_trc              = src->color_trc;
 +    dst->colorspace             = src->colorspace;
 +    dst->color_range            = src->color_range;
 +    dst->chroma_location        = src->chroma_location;
 +
 +    av_dict_copy(&dst->metadata, src->metadata, 0);
 +
 +    memcpy(dst->error, src->error, sizeof(dst->error));
 +
 +    for (i = 0; i < src->nb_side_data; i++) {
 +        const AVFrameSideData *sd_src = src->side_data[i];
 +        AVFrameSideData *sd_dst;
 +        if (   sd_src->type == AV_FRAME_DATA_PANSCAN
 +            && (src->width != dst->width || src->height != dst->height))
 +            continue;
 +        if (force_copy) {
 +            sd_dst = av_frame_new_side_data(dst, sd_src->type,
 +                                            sd_src->size);
 +            if (!sd_dst) {
 +                wipe_side_data(dst);
 +                return AVERROR(ENOMEM);
 +            }
 +            memcpy(sd_dst->data, sd_src->data, sd_src->size);
 +        } else {
 +            sd_dst = av_frame_new_side_data(dst, sd_src->type, 0);
 +            if (!sd_dst) {
 +                wipe_side_data(dst);
 +                return AVERROR(ENOMEM);
 +            }
 +            sd_dst->buf = av_buffer_ref(sd_src->buf);
 +            if (!sd_dst->buf) {
 +                wipe_side_data(dst);
 +                return AVERROR(ENOMEM);
 +            }
 +            sd_dst->data = sd_dst->buf->data;
 +            sd_dst->size = sd_dst->buf->size;
 +        }
 +        av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
 +    }
 +
 +    dst->qscale_table = NULL;
 +    dst->qstride      = 0;
 +    dst->qscale_type  = 0;
 +    if (src->qp_table_buf) {
 +        dst->qp_table_buf = av_buffer_ref(src->qp_table_buf);
 +        if (dst->qp_table_buf) {
 +            dst->qscale_table = dst->qp_table_buf->data;
 +            dst->qstride      = src->qstride;
 +            dst->qscale_type  = src->qscale_type;
 +        }
 +    }
 +
 +    return 0;
 +}
 +
  int av_frame_ref(AVFrame *dst, const AVFrame *src)
  {
      int i, ret = 0;
index 196b578af4c754a04a7983bd8a4f08fce52cd6c2,d231ff3966f38aa977846d2ff1f1c2415868333d..f5e89376badda882c2f0a21cc5b06fc935607865
@@@ -504,119 -351,8 +407,135 @@@ typedef struct AVFrame 
      enum AVColorSpace colorspace;
  
      enum AVChromaLocation chroma_location;
 +
 +    /**
 +     * frame timestamp estimated using various heuristics, in stream time base
 +     * Code outside libavutil should access this field using:
 +     * av_frame_get_best_effort_timestamp(frame)
 +     * - encoding: unused
 +     * - decoding: set by libavcodec, read by user.
 +     */
 +    int64_t best_effort_timestamp;
 +
 +    /**
 +     * reordered pos from the last AVPacket that has been input into the decoder
 +     * Code outside libavutil should access this field using:
 +     * av_frame_get_pkt_pos(frame)
 +     * - encoding: unused
 +     * - decoding: Read by user.
 +     */
 +    int64_t pkt_pos;
 +
 +    /**
 +     * duration of the corresponding packet, expressed in
 +     * AVStream->time_base units, 0 if unknown.
 +     * Code outside libavutil should access this field using:
 +     * av_frame_get_pkt_duration(frame)
 +     * - encoding: unused
 +     * - decoding: Read by user.
 +     */
 +    int64_t pkt_duration;
 +
 +    /**
 +     * metadata.
 +     * Code outside libavutil should access this field using:
 +     * av_frame_get_metadata(frame)
 +     * - encoding: Set by user.
 +     * - decoding: Set by libavcodec.
 +     */
 +    AVDictionary *metadata;
 +
 +    /**
 +     * decode error flags of the frame, set to a combination of
 +     * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
 +     * were errors during the decoding.
 +     * Code outside libavutil should access this field using:
 +     * av_frame_get_decode_error_flags(frame)
 +     * - encoding: unused
 +     * - decoding: set by libavcodec, read by user.
 +     */
 +    int decode_error_flags;
 +#define FF_DECODE_ERROR_INVALID_BITSTREAM   1
 +#define FF_DECODE_ERROR_MISSING_REFERENCE   2
 +
 +    /**
 +     * number of audio channels, only used for audio.
 +     * Code outside libavutil should access this field using:
 +     * av_frame_get_channels(frame)
 +     * - encoding: unused
 +     * - decoding: Read by user.
 +     */
 +    int channels;
 +
 +    /**
 +     * size of the corresponding packet containing the compressed
 +     * frame. It must be accessed using av_frame_get_pkt_size() and
 +     * av_frame_set_pkt_size().
 +     * It is set to a negative value if unknown.
 +     * - encoding: unused
 +     * - decoding: set by libavcodec, read by user.
 +     */
 +    int pkt_size;
 +
++    /**
++     * QP table
++     * Not to be accessed directly from outside libavutil
++     */
++    attribute_deprecated
++    int8_t *qscale_table;
++    /**
++     * QP store stride
++     * Not to be accessed directly from outside libavutil
++     */
++    attribute_deprecated
++    int qstride;
++
++    attribute_deprecated
++    int qscale_type;
++
 +    /**
 +     * Not to be accessed directly from outside libavutil
 +     */
 +    AVBufferRef *qp_table_buf;
  } AVFrame;
  
 +/**
 + * Accessors for some AVFrame fields.
 + * The position of these field in the structure is not part of the ABI,
 + * they should not be accessed directly outside libavutil.
 + */
 +int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
 +void    av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
 +int64_t av_frame_get_pkt_duration         (const AVFrame *frame);
 +void    av_frame_set_pkt_duration         (AVFrame *frame, int64_t val);
 +int64_t av_frame_get_pkt_pos              (const AVFrame *frame);
 +void    av_frame_set_pkt_pos              (AVFrame *frame, int64_t val);
 +int64_t av_frame_get_channel_layout       (const AVFrame *frame);
 +void    av_frame_set_channel_layout       (AVFrame *frame, int64_t val);
 +int     av_frame_get_channels             (const AVFrame *frame);
 +void    av_frame_set_channels             (AVFrame *frame, int     val);
 +int     av_frame_get_sample_rate          (const AVFrame *frame);
 +void    av_frame_set_sample_rate          (AVFrame *frame, int     val);
 +AVDictionary *av_frame_get_metadata       (const AVFrame *frame);
 +void          av_frame_set_metadata       (AVFrame *frame, AVDictionary *val);
 +int     av_frame_get_decode_error_flags   (const AVFrame *frame);
 +void    av_frame_set_decode_error_flags   (AVFrame *frame, int     val);
 +int     av_frame_get_pkt_size(const AVFrame *frame);
 +void    av_frame_set_pkt_size(AVFrame *frame, int val);
 +AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame);
 +int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
 +int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
 +enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
 +void    av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
 +enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
 +void    av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
 +
 +/**
 + * Get the name of a colorspace.
 + * @return a static string identifying the colorspace; can be NULL.
 + */
 +const char *av_get_colorspace_name(enum AVColorSpace val);
 +
  /**
   * Allocate an AVFrame and set its fields to default values.  The resulting
   * struct must be freed using av_frame_free().
Simple merge