History

avutil/frame: make frame copy functions hwframe aware

Timo Rothenpieler committed 6 years ago

Commit 77d5ea11 parent b06ae062 files · +10 −2Browse files

Unified · Split

2 files
  1. libavutil/frame.c +9 −1
  2. libavutil/version.h +1 −1
libavutil/frame.c+9−1
@@ -25,6 +25,7 @@ · 24 unmodified lines
25#include "imgutils.h"25#include "imgutils.h"
26#include "mem.h"26#include "mem.h"
27#include "samplefmt.h"27#include "samplefmt.h"
28#include "hwcontext.h"
28 29
29#if FF_API_FRAME_GET_SET30#if FF_API_FRAME_GET_SET
30MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)31MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
@@ -626,7 +627,11 @@ int av_frame_make_writable(AVFrame *frame) · 595 unmodified lines
626 tmp.channels = frame->channels;627 tmp.channels = frame->channels;
627 tmp.channel_layout = frame->channel_layout;628 tmp.channel_layout = frame->channel_layout;
628 tmp.nb_samples = frame->nb_samples;629 tmp.nb_samples = frame->nb_samples;
629 ret = av_frame_get_buffer(&tmp, 32);630
631 if (frame->hw_frames_ctx)
632 ret = av_hwframe_get_buffer(frame->hw_frames_ctx, &tmp, 0);
633 else
634 ret = av_frame_get_buffer(&tmp, 32);
630 if (ret < 0)635 if (ret < 0)
631 return ret;636 return ret;
632 637
@@ -752,6 +757,9 @@ static int frame_copy_video(AVFrame *dst, const AVFrame *src) · 119 unmodified lines
752 dst->height < src->height)757 dst->height < src->height)
753 return AVERROR(EINVAL);758 return AVERROR(EINVAL);
754 759
760 if (src->hw_frames_ctx || dst->hw_frames_ctx)
761 return av_hwframe_transfer_data(dst, src, 0);
762
755 planes = av_pix_fmt_count_planes(dst->format);763 planes = av_pix_fmt_count_planes(dst->format);
756 for (i = 0; i < planes; i++)764 for (i = 0; i < planes; i++)
757 if (!dst->data[i] || !src->data[i])765 if (!dst->data[i] || !src->data[i])
libavutil/version.h+1−1
@@ -80,7 +80,7 @@ · 79 unmodified lines
80 80
81#define LIBAVUTIL_VERSION_MAJOR 5681#define LIBAVUTIL_VERSION_MAJOR 56
82#define LIBAVUTIL_VERSION_MINOR 4282#define LIBAVUTIL_VERSION_MINOR 42
83#define LIBAVUTIL_VERSION_MICRO 10183#define LIBAVUTIL_VERSION_MICRO 102
84 84
85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
86 LIBAVUTIL_VERSION_MINOR, \86 LIBAVUTIL_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t