From d39288b8d671db3b68fb04445f877767da3488b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 6 Jun 2008 10:36:50 +0000 Subject: [PATCH] * Actually set the format to B_RGB32 when retrying for that format. * Do not exit in case of success to retry with B_RGB32, so the bytes per row check is performed. * Ignore if bytes per row is big enough. * Check the success for the last attempt to set DecodedFormat(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25821 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../supplier/MediaTrackVideoSupplier.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp b/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp index 60f4469ebe..8214ca1c89 100644 --- a/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp +++ b/src/apps/mediaplayer/supplier/MediaTrackVideoSupplier.cpp @@ -189,8 +189,10 @@ MediaTrackVideoSupplier::SeekToFrame(int64* frame) return B_OK; } -if (wantFrame != *frame) -printf("seeked by frame: %lld -> %lld\n", wantFrame, *frame); +if (wantFrame != *frame) { + printf("seeked by frame: %lld -> %lld, was %lld\n", wantFrame, *frame, + currentFrame); +} ret = fVideoTrack->SeekToFrame(frame); if (ret == B_OK) { @@ -357,6 +359,7 @@ MediaTrackVideoSupplier::_SwitchFormat(color_space format, int32 bytesPerRow) printf("MediaTrackVideoSupplier::_SwitchFormat() - " "fVideoTrack->DecodedFormat(): %s - retrying with B_RGB32\n", strerror(ret)); + format = B_RGB32; fFormat.u.raw_video.display.format = format; minBytesPerRow = width * 4; fFormat.u.raw_video.display.bytes_per_row = max_c(minBytesPerRow, @@ -367,15 +370,13 @@ MediaTrackVideoSupplier::_SwitchFormat(color_space format, int32 bytesPerRow) printf("MediaTrackVideoSupplier::_SwitchFormat() - " "fVideoTrack->DecodedFormat(): %s - giving up\n", strerror(ret)); + return ret; } - return ret; } if (fFormat.u.raw_video.display.format != format) { printf("MediaTrackVideoSupplier::_SwitchFormat() - " - " codec changed colorspace of decoded format (%s -> %s)!\n" - " this is bad for performance, since colorspace conversion\n" - " needs to happen during playback.\n", + " codec changed colorspace of decoded format (%s -> %s)!\n", string_for_color_space(format), string_for_color_space(fFormat.u.raw_video.display.format)); // check if the codec forgot to adjust bytes_per_row @@ -385,10 +386,10 @@ MediaTrackVideoSupplier::_SwitchFormat(color_space format, int32 bytesPerRow) minBPR = ((width * 2 + 3) / 4) * 4; else minBPR = width * 4; - if (minBPR != fFormat.u.raw_video.display.bytes_per_row) { + if (minBPR > fFormat.u.raw_video.display.bytes_per_row) { printf(" -> stupid codec forgot to adjust bytes_per_row!\n"); fFormat.u.raw_video.display.bytes_per_row = minBPR; - fVideoTrack->DecodedFormat(&fFormat); + ret = fVideoTrack->DecodedFormat(&fFormat); } }