video: copy the frame props

+ Save the frame props on Scale or Copy

Change-Id: I816de4400392da13d3068609bd432a6918bfc81d
This commit is contained in:
ayounes
2020-01-09 16:16:55 -05:00
committed by Adrien Béraud
parent 0bef03f191
commit 2b2412e45f
2 changed files with 5 additions and 1 deletions

View File

@ -67,8 +67,11 @@ void
MediaFrame::copyFrom(const MediaFrame& o)
{
reset();
if (o.frame_)
if (o.frame_) {
av_frame_ref(frame_.get(), o.frame_.get());
av_frame_copy_props(frame_.get(), o.frame_.get());
}
if (o.packet_) {
packet_.reset(av_packet_alloc());
av_packet_ref(packet_.get(), o.packet_.get());

View File

@ -150,6 +150,7 @@ VideoScaler::convertFormat(const VideoFrame& input, AVPixelFormat pix)
auto output = std::make_unique<VideoFrame>();
output->reserve(pix, input.width(), input.height());
scale(input, *output);
av_frame_copy_props(output->pointer(), input.pointer());
return output;
}