* VideoWindow.h: BeOS video window class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: VideoWindow.h,v 1.6 2001/09/12 01:30:07 tcastley Exp $
+ * $Id: VideoWindow.h,v 1.7 2001/10/21 06:06:20 tcastley Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au>
virtual void Zoom(BPoint origin, float width, float height);
// this is the hook controling direct screen connection
- int32 i_bytes_per_pixel;
- int32 i_screen_depth;
- int32 i_width;
- int32 i_height;
- struct vout_thread_s *p_vout;
-
+ int32 i_bytes_per_pixel;
+ int32 i_screen_depth;
+ int32 i_width;
+ int32 i_height;
int32 fRowBytes;
-
- uint32 fNumClipRects;
-
int i_buffer_index;
- bool fDirty;
- thread_id fDrawThreadID;
+
BBitmap *bitmap[2];
- BBitmap *drawthis;
VLCView *view;
+ thread_id fDrawThreadID;
+
bool teardownwindow;
bool is_zoomed;
- bool fUsingOverlay;
- BScreen *screen;
+
+ struct vout_thread_s *p_vout;
private:
- display_mode old_mode;
- BRect rect;
+// display_mode old_mode;
+ BRect rect;
};
* vout_beos.cpp: beos video output display method
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: vout_beos.cpp,v 1.30 2001/09/26 12:32:25 massiot Exp $
+ * $Id: vout_beos.cpp,v 1.31 2001/10/21 06:06:20 tcastley Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
*****************************************************************************/
VideoWindow::VideoWindow(BRect frame, const char *name, vout_thread_t *p_video_output )
- : BWindow(frame, name, B_TITLED_WINDOW, NULL)
+ : BWindow(frame, name, B_TITLED_WINDOW, B_OUTLINE_RESIZE)
{
/* set the VideoWindow variables */
teardownwindow = false;
is_zoomed = false;
- fUsingOverlay = false;
p_video_output->b_YCbr = false;
/* create the view to do the display */
fRowBytes = bitmap[0]->BytesPerRow();
i_screen_depth = 8 * i_bytes_per_pixel;
- fDirty = false;
Show();
}
*****************************************************************************/
void VideoWindow::FrameResized( float width, float height )
{
+ if (is_zoomed)
+ {
+ return;
+ }
+ float width_scale;
+ float height_scale;
+ float orig_width = bitmap[0]->Bounds().Width();
+ float orig_height = bitmap[0]->Bounds().Height();
+
+ width_scale = width / orig_width;
+ height_scale = height / orig_height;
+
+ /* if the width is proportionally smaller */
+ if (width_scale <= height_scale)
+ {
+ ResizeTo(width, orig_height * width_scale);
+ }
+ else /* if the height is proportionally smaller */
+ {
+ ResizeTo(orig_width * height_scale, height);
+ }
}
/*****************************************************************************
return( 1 );
}
- /* Set video window's size */
- p_vout->b_scale = true;
-
- intf_Msg("Initial Width: %d Height: %d",
- p_vout->i_width,
- p_vout->i_height);
+ p_vout->b_scale = false;
/* Open and initialize device */
if( BeosOpenDisplay( p_vout ) )
p_win->i_buffer_index = p_vout->i_buffer_index;
p_vout->i_buffer_index = ++p_vout->i_buffer_index & 1;
-
- p_win->fDrawThreadID = spawn_thread(Draw, "drawing_thread",
+ if (!p_win->teardownwindow)
+ {
+ p_win->fDrawThreadID = spawn_thread(Draw, "drawing_thread",
B_DISPLAY_PRIORITY, (void*) p_win);
- wait_for_thread(p_win->fDrawThreadID, &status);
-
-
+ wait_for_thread(p_win->fDrawThreadID, &status);
+ }
}
/* following functions are local */