Skip to content

Commit

Permalink
Merge pull request #506 from vladyslav-arzhanov/viewport
Browse files Browse the repository at this point in the history
Set viewPort for QVideoFrameFormat
  • Loading branch information
valbok authored Dec 9, 2024
2 parents 60b9426 + b17c854 commit ea5be8e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/QtAVPlayer/qavvideoframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,14 @@ QAVVideoFrame::operator QVideoFrame() const
return QVideoFrame(new PlanarVideoBuffer(result, type), size(), format);
#else
QVideoFrameFormat videoFormat(size(), format);

QRect viewport(
frame()->crop_left,
frame()->crop_top,
frame()->width - frame()->crop_left - frame()->crop_right,
frame()->height - frame()->crop_top - frame()->crop_bottom
);
videoFormat.setViewport(viewport);
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
videoFormat.setColorSpace(PlanarVideoBuffer::colorSpace(frame()));
videoFormat.setColorTransfer(PlanarVideoBuffer::colorTransfer(frame()));
Expand Down

0 comments on commit ea5be8e

Please sign in to comment.