From b8e36690e8d9d60c36c4c9fa470073d58e96646f Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 23 Mar 2015 11:11:18 -0400 Subject: [PATCH] lavu/frame: move av_frame_copy_props() up in the file. Preparation for following patch. Signed-off-by: Michael Niedermayer --- libavutil/frame.c | 140 +++++++++++++++++++++++----------------------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/libavutil/frame.c b/libavutil/frame.c index 12fe0a6273..85f56373a1 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -275,6 +275,76 @@ int av_frame_get_buffer(AVFrame *frame, int align) return AVERROR(EINVAL); } +int av_frame_copy_props(AVFrame *dst, const AVFrame *src) +{ + 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; +#if FF_API_AVFRAME_LAVC + dst->type = src->type; +#endif + 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; + 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); + 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; @@ -460,76 +530,6 @@ int av_frame_make_writable(AVFrame *frame) return 0; } -int av_frame_copy_props(AVFrame *dst, const AVFrame *src) -{ - 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; -#if FF_API_AVFRAME_LAVC - dst->type = src->type; -#endif - 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; - 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); - 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; -} - AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane) { uint8_t *data;