ffmpeg: fixed bytes_per_row calcs: now B_YCbCr422 works OK (video overlay)

This commit is contained in:
RudolfC 2020-05-14 20:21:12 +00:00
parent 61c919f268
commit 64381a7b0f

View File

@ -177,13 +177,14 @@ CalculateBytesPerRowWithColorSpaceAndVideoWidth(color_space colorSpace, int vide
assert(videoWidth >= 0); assert(videoWidth >= 0);
const uint32 kBytesPerRowUnknown = 0; const uint32 kBytesPerRowUnknown = 0;
size_t bytesPerPixel; size_t pixelChunk;
size_t rowAlignment; size_t rowAlignment;
size_t pixelsPerChunk;
if (get_pixel_size_for(colorSpace, &bytesPerPixel, &rowAlignment, NULL) != B_OK) if (get_pixel_size_for(colorSpace, &pixelChunk, &rowAlignment, &pixelsPerChunk) != B_OK)
return kBytesPerRowUnknown; return kBytesPerRowUnknown;
uint32 bytesPerRow = bytesPerPixel * videoWidth; uint32 bytesPerRow = pixelChunk * videoWidth / pixelsPerChunk;
uint32 numberOfUnalignedBytes = bytesPerRow % rowAlignment; uint32 numberOfUnalignedBytes = bytesPerRow % rowAlignment;
if (numberOfUnalignedBytes == 0) if (numberOfUnalignedBytes == 0)