diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2013-12-13 23:24:46 +0400 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2013-12-13 23:24:46 +0400 |
commit | 2b8b70df7415578248914910d22bdc5baeff5ded (patch) | |
tree | 69cad6f9e0e42bef3f439b1367cc4609e7f5fbfd /decoder | |
parent | 45cc793feb529c9371d1f89c8655a88656cd6d71 (diff) |
Always reduce the aspect ratio fraction to avoid reconnects
1920:1080 is the same as 16:9, but it would reconnect to change it.
Instead, always reduce to 16:9 immediately, and avoid a reconnect later.
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/LAVVideo/LAVPixFmtConverter.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/decoder/LAVVideo/LAVPixFmtConverter.cpp b/decoder/LAVVideo/LAVPixFmtConverter.cpp index d6a9731d..9acfbcb3 100644 --- a/decoder/LAVVideo/LAVPixFmtConverter.cpp +++ b/decoder/LAVVideo/LAVPixFmtConverter.cpp @@ -249,19 +249,19 @@ void CLAVPixFmtConverter::GetMediaType(CMediaType *mt, int index, LONG biWidth, // Validate the Aspect Ratio - an AR of 0 crashes VMR-9 if (dwAspectX == 0 || dwAspectY == 0) { - int dwX = 0; - int dwY = 0; - av_reduce(&dwX, &dwY, biWidth, biHeight, max(biWidth, biHeight)); - - dwAspectX = dwX; - dwAspectY = dwY; + dwAspectX = biWidth; + dwAspectY = biHeight; } + // Always reduce the AR to the smalles fraction + int dwX = 0, dwY = 0; + av_reduce(&dwX, &dwY, dwAspectX, dwAspectY, max(dwAspectX, dwAspectY)); + vih2->rcSource.right = vih2->rcTarget.right = biWidth; vih2->rcSource.bottom = vih2->rcTarget.bottom = biHeight; vih2->AvgTimePerFrame = rtAvgTime; - vih2->dwPictAspectRatioX = dwAspectX; - vih2->dwPictAspectRatioY = dwAspectY; + vih2->dwPictAspectRatioX = dwX; + vih2->dwPictAspectRatioY = dwY; if (bInterlaced) vih2->dwInterlaceFlags = AMINTERLACE_IsInterlaced | AMINTERLACE_DisplayModeBobOrWeave; |