void VideoView::DrawFrame() { // printf("VideoView::DrawFrame\n"); if (!fVideoActive) { fVideoActive = true; if (LockLooperWithTimeout(50000) != B_OK) return; Invalidate(); UnlockLooper(); } fLastFrame = system_time(); bool want_overlay = fVideoNode->IsOverlayActive(); if (!want_overlay && fOverlayActive) { if (LockLooperWithTimeout(50000) == B_OK) { ClearViewOverlay(); UnlockLooper(); fOverlayActive = false; } else { printf("can't ClearViewOverlay, as LockLooperWithTimeout " "failed\n"); } } if (want_overlay && !fOverlayActive) { fVideoNode->LockBitmap(); BBitmap *bmp = fVideoNode->Bitmap(); if (bmp && LockLooperWithTimeout(50000) == B_OK) { SetViewOverlay(bmp, bmp->Bounds(), Bounds(), &fOverlayKeyColor, B_FOLLOW_ALL, B_OVERLAY_FILTER_HORIZONTAL | B_OVERLAY_FILTER_VERTICAL); fOverlayActive = true; Invalidate(); UnlockLooper(); } fVideoNode->UnlockBitmap(); } if (!fOverlayActive) { if (LockLooperWithTimeout(50000) != B_OK) return; Invalidate(); UnlockLooper(); } }
void VideoView::RemoveOverlay() { printf("VideoView::RemoveOverlay\n"); if (LockLooperWithTimeout(50000) == B_OK) { ClearViewOverlay(); fOverlayActive = false; UnlockLooper(); } }
// SetValue void PopupSlider::SetValue(int32 value) { if (!fTracking) { /* if (fSlider->LockLooper()) { fSlider->SetValue(value); fSlider->UnlockLooper(); } else*/ if (value != Value()) { fSlider->SetValue(value); if (LockLooperWithTimeout(0) >= B_OK) { Invalidate(); UnlockLooper(); } } } else ValueChanged(value); }
// SetBitmap void VideoView::SetBitmap(const BBitmap* bitmap) { VCTarget::SetBitmap(bitmap); // Attention: Don't lock the window, if the bitmap is NULL. Otherwise // we're going to deadlock when the window tells the node manager to // stop the nodes (Window -> NodeManager -> VideoConsumer -> VideoView // -> Window). if (bitmap && LockLooperWithTimeout(10000) == B_OK) { if (LockBitmap()) { // if (fOverlayMode || bitmap->Flags() & B_BITMAP_WILL_OVERLAY) { if (fOverlayMode || bitmap->ColorSpace() == B_YCbCr422) { if (!fOverlayMode) { // init overlay rgb_color key; SetViewOverlay(bitmap, bitmap->Bounds(), Bounds(), &key, B_FOLLOW_ALL, B_OVERLAY_FILTER_HORIZONTAL | B_OVERLAY_FILTER_VERTICAL); SetViewColor(key); Invalidate(); // use overlay from here on fOverlayMode = true; } else { // transfer overlay channel rgb_color key; SetViewOverlay(bitmap, bitmap->Bounds(), Bounds(), &key, B_FOLLOW_ALL, B_OVERLAY_FILTER_HORIZONTAL | B_OVERLAY_FILTER_VERTICAL | B_OVERLAY_TRANSFER_CHANNEL); } } else { DrawBitmap(bitmap, bitmap->Bounds(), Bounds()); } UnlockBitmap(); } UnlockLooper(); } }