* 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
This commit is contained in:
Stephan Aßmus
2008-06-06 10:36:50 +00:00
parent df13386015
commit d39288b8d6
@@ -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);
}
}