Lines Matching refs:src

274 static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
278 dst->key_frame = src->key_frame;
279 dst->pict_type = src->pict_type;
280 dst->sample_aspect_ratio = src->sample_aspect_ratio;
281 dst->crop_top = src->crop_top;
282 dst->crop_bottom = src->crop_bottom;
283 dst->crop_left = src->crop_left;
284 dst->crop_right = src->crop_right;
285 dst->pts = src->pts;
286 dst->repeat_pict = src->repeat_pict;
287 dst->interlaced_frame = src->interlaced_frame;
288 dst->top_field_first = src->top_field_first;
289 dst->palette_has_changed = src->palette_has_changed;
290 dst->sample_rate = src->sample_rate;
291 dst->opaque = src->opaque;
292 dst->pkt_dts = src->pkt_dts;
293 dst->pkt_pos = src->pkt_pos;
294 dst->pkt_size = src->pkt_size;
295 dst->pkt_duration = src->pkt_duration;
296 dst->time_base = src->time_base;
297 dst->reordered_opaque = src->reordered_opaque;
298 dst->quality = src->quality;
299 dst->best_effort_timestamp = src->best_effort_timestamp;
300 dst->coded_picture_number = src->coded_picture_number;
301 dst->display_picture_number = src->display_picture_number;
302 dst->flags = src->flags;
303 dst->decode_error_flags = src->decode_error_flags;
304 dst->color_primaries = src->color_primaries;
305 dst->color_trc = src->color_trc;
306 dst->colorspace = src->colorspace;
307 dst->color_range = src->color_range;
308 dst->chroma_location = src->chroma_location;
310 av_dict_copy(&dst->metadata, src->metadata, 0);
312 for (i = 0; i < src->nb_side_data; i++) {
313 const AVFrameSideData *sd_src = src->side_data[i];
316 && (src->width != dst->width || src->height != dst->height))
338 ret = av_buffer_replace(&dst->opaque_ref, src->opaque_ref);
339 ret |= av_buffer_replace(&dst->private_ref, src->private_ref);
343 int av_frame_ref(AVFrame *dst, const AVFrame *src)
356 dst->format = src->format;
357 dst->width = src->width;
358 dst->height = src->height;
359 dst->nb_samples = src->nb_samples;
362 dst->channels = src->channels;
363 dst->channel_layout = src->channel_layout;
364 if (!av_channel_layout_check(&src->ch_layout)) {
365 if (src->channel_layout)
366 av_channel_layout_from_mask(&dst->ch_layout, src->channel_layout);
368 dst->ch_layout.nb_channels = src->channels;
375 ret = frame_copy_props(dst, src, 0);
380 if (av_channel_layout_check(&src->ch_layout)) {
381 ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout);
387 if (!src->buf[0]) {
392 ret = av_frame_copy(dst, src);
400 for (i = 0; i < FF_ARRAY_ELEMS(src->buf); i++) {
401 if (!src->buf[i])
403 dst->buf[i] = av_buffer_ref(src->buf[i]);
410 if (src->extended_buf) {
411 dst->extended_buf = av_calloc(src->nb_extended_buf,
417 dst->nb_extended_buf = src->nb_extended_buf;
419 for (i = 0; i < src->nb_extended_buf; i++) {
420 dst->extended_buf[i] = av_buffer_ref(src->extended_buf[i]);
428 if (src->hw_frames_ctx) {
429 dst->hw_frames_ctx = av_buffer_ref(src->hw_frames_ctx);
437 if (src->extended_data != src->data) {
450 memcpy(dst->extended_data, src->extended_data, sizeof(*src->extended_data) * ch);
454 memcpy(dst->data, src->data, sizeof(src->data));
455 memcpy(dst->linesize, src->linesize, sizeof(src->linesize));
464 AVFrame *av_frame_clone(const AVFrame *src)
471 if (av_frame_ref(ret, src) < 0)
506 void av_frame_move_ref(AVFrame *dst, AVFrame *src)
517 *dst = *src;
518 if (src->extended_data == src->data)
520 get_frame_defaults(src);
596 int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
598 return frame_copy_props(dst, src, 1);
696 static int frame_copy_video(AVFrame *dst, const AVFrame *src)
701 if (dst->width < src->width ||
702 dst->height < src->height)
705 if (src->hw_frames_ctx || dst->hw_frames_ctx)
706 return av_hwframe_transfer_data(dst, src, 0);
710 if (!dst->data[i] || !src->data[i])
713 memcpy(src_data, src->data, sizeof(src_data));
715 src_data, src->linesize,
716 dst->format, src->width, src->height);
721 static int frame_copy_audio(AVFrame *dst, const AVFrame *src)
730 if (!channels || !src->ch_layout.nb_channels) {
731 if (dst->channels != src->channels ||
732 dst->channel_layout != src->channel_layout)
734 CHECK_CHANNELS_CONSISTENCY(src);
743 if (dst->nb_samples != src->nb_samples ||
746 av_channel_layout_check(&src->ch_layout) &&
748 av_channel_layout_compare(&dst->ch_layout, &src->ch_layout))
755 if (!dst->extended_data[i] || !src->extended_data[i])
758 av_samples_copy(dst->extended_data, src->extended_data, 0, 0,
764 int av_frame_copy(AVFrame *dst, const AVFrame *src)
766 if (dst->format != src->format || dst->format < 0)
771 return frame_copy_video(dst, src);
778 return frame_copy_audio(dst, src);