From 13030ad148c99d9c519e69955dd5abf99cc6fc84 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Tue, 5 Mar 2013 15:33:29 +0000 Subject: [PATCH] FPlay: fullscreen mode git-svn-id: svn://kolibrios.org@3334 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/media/Fplay/pixlib2.c | 11 ----- programs/media/Fplay/video.c | 65 ++++++++++++++++++--------- programs/media/Fplay/winlib/caption.c | 18 +++++++- programs/media/Fplay/winlib/frame.c | 3 ++ programs/media/Fplay/winlib/window.c | 6 +-- 5 files changed, 66 insertions(+), 37 deletions(-) diff --git a/programs/media/Fplay/pixlib2.c b/programs/media/Fplay/pixlib2.c index ffc0aab8e..5a467577e 100644 --- a/programs/media/Fplay/pixlib2.c +++ b/programs/media/Fplay/pixlib2.c @@ -64,17 +64,6 @@ typedef struct }; }hwcaps_t; -static inline uint32_t GetScreenSize() -{ - uint32_t retval; - - __asm__ __volatile__( - "int $0x40" - :"=a"(retval) - :"a"(61), "b"(1)); - return retval; -} - static uint32_t get_service(char *name) { uint32_t retval = 0; diff --git a/programs/media/Fplay/video.c b/programs/media/Fplay/video.c index 1b04e6e18..980c37e6a 100644 --- a/programs/media/Fplay/video.c +++ b/programs/media/Fplay/video.c @@ -403,14 +403,17 @@ void render_time(render_t *render) // sys_time*10, frames[vfx].pts, ctime, fdelay); main_render->draw(main_render, &frames[vfx].picture); - prg->current = frames[vfx].pts*1000; + if(main_render->win->win_state != FULLSCREEN) + { + prg->current = frames[vfx].pts*1000; // printf("current %f\n", prg->current); - lvl->current = vfx & 1 ? sound_level_1 : sound_level_0; + lvl->current = vfx & 1 ? sound_level_1 : sound_level_0; - send_message(&prg->ctrl, PRG_PROGRESS, 0, 0); + send_message(&prg->ctrl, PRG_PROGRESS, 0, 0); - if(main_render->win->panel.layout) - send_message(&lvl->ctrl, MSG_PAINT, 0, 0); + if(main_render->win->panel.layout) + send_message(&lvl->ctrl, MSG_PAINT, 0, 0); + } frames_count--; frames[vfx].ready = 0; @@ -707,8 +710,11 @@ void render_adjust_size(render_t *render, window_t *win) uint8_t state; right = win->w; - bottom = win->h-CAPTION_HEIGHT-PANEL_HEIGHT; + bottom = win->h; + if(win->win_state != FULLSCREEN) + bottom-= CAPTION_HEIGHT+PANEL_HEIGHT; + // printf("window width %d height %d\n", // right, bottom); @@ -724,6 +730,8 @@ void render_adjust_size(render_t *render, window_t *win) bottom == render->win_height) return; + printf("%s r: %d b: %d\n", __FUNCTION__, right, bottom); + new_w = bottom*render->ctx_width/render->ctx_height; new_h = right*render->ctx_height/render->ctx_width; @@ -738,8 +746,8 @@ void render_adjust_size(render_t *render, window_t *win) new_w = bottom*render->ctx_width/render->ctx_height; }; - render->win_width = win->w; - render->win_height = win->h-CAPTION_HEIGHT-PANEL_HEIGHT; + render->win_width = right; + render->win_height = bottom; render_set_size(render, new_w, new_h); if(render->caps & HW_TEX_BLIT) /* hw scaler */ @@ -815,10 +823,14 @@ void draw_hw_picture(render_t *render, AVPicture *picture) picture->linesize, 0, render->ctx_height, data, linesize); // printf("sws_scale\n"); - blit_bitmap(bitmap, render->rcvideo.l, + if(render->win->win_state == FULLSCREEN) + blit_bitmap(bitmap,render->rcvideo.l,render->rcvideo.t, + render->rcvideo.r, render->rcvideo.b); + else + blit_bitmap(bitmap, render->rcvideo.l, CAPTION_HEIGHT+render->rcvideo.t, render->rcvideo.r, render->rcvideo.b); - + render->last_bitmap = bitmap; // printf("blit_bitmap\n"); @@ -863,43 +875,54 @@ void draw_sw_picture(render_t *render, AVPicture *picture) sws_scale(cvt_ctx, (const uint8_t* const *)picture->data, picture->linesize, 0, render->ctx_height, data, linesize); - blit_bitmap(&render->bitmap[0], render->rcvideo.l, - render->rcvideo.t+CAPTION_HEIGHT, - render->rcvideo.r, render->rcvideo.b); + if(render->win->win_state == FULLSCREEN) + blit_bitmap(&render->bitmap[0],render->rcvideo.l,render->rcvideo.t, + render->rcvideo.r, render->rcvideo.b); + else + blit_bitmap(&render->bitmap[0], render->rcvideo.l, + CAPTION_HEIGHT+render->rcvideo.t, + render->rcvideo.r, render->rcvideo.b); + render->last_bitmap = &render->bitmap[0]; } void render_draw_client(render_t *render) { + int y; + if(render->win_state == MINIMIZED || - render->win_state == ROLLED) + render->win_state == ROLLED ) return; - + if(render->win_state == FULLSCREEN) + y = 0; + else + y = CAPTION_HEIGHT; + if(player_state == PAUSE) { if(frames[vfx].ready == 1 ) main_render->draw(main_render, &frames[vfx].picture); else - draw_bar(0, CAPTION_HEIGHT, render->win_width, + draw_bar(0, y, render->win_width, render->rcvideo.b, 0); } else if( player_state == STOP ) { - draw_bar(0, CAPTION_HEIGHT, render->win_width, + draw_bar(0,y, render->win_width, render->rcvideo.b, 0); }; if(render->layout & HAS_TOP) - draw_bar(0, CAPTION_HEIGHT, render->win_width, + draw_bar(0, y, render->win_width, render->rctop.b, 0); if(render->layout & HAS_LEFT) - draw_bar(0, render->rcvideo.t+CAPTION_HEIGHT, render->rcleft.r, + draw_bar(0, render->rcvideo.t+y, render->rcleft.r, render->rcvideo.b, 0); if(render->layout & HAS_RIGHT) - draw_bar(render->rcright.l, render->rcvideo.t+CAPTION_HEIGHT, + draw_bar(render->rcright.l, render->rcvideo.t+y, render->rcright.r, render->rcvideo.b, 0); if(render->layout & HAS_BOTTOM) - draw_bar(0, render->rcbottom.t+CAPTION_HEIGHT, + draw_bar(0, render->rcbottom.t+y, render->win_width, render->rcbottom.b, 0); } diff --git a/programs/media/Fplay/winlib/caption.c b/programs/media/Fplay/winlib/caption.c index 53dfd9ece..246a8df01 100644 --- a/programs/media/Fplay/winlib/caption.c +++ b/programs/media/Fplay/winlib/caption.c @@ -1,5 +1,5 @@ -#include "system.h" +#include #include #include #include @@ -77,7 +77,7 @@ int init_caption(window_t *win) btn->img_hilite = res_minimize_btn_hl; btn->img_pressed = res_minimize_btn_pressed; - btn = create_button(NULL, ID_FULL,0,5,18,18,(ctrl_t*)cpt); + btn = create_button(NULL, ID_FULLSCREEN,0,5,18,18,(ctrl_t*)cpt); cpt->full_btn = btn; btn->img_default = res_full_btn; @@ -243,6 +243,20 @@ int caption_proc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2) win->win_state = MINIMIZED; send_message((ctrl_t*)win, MSG_SIZE, 0, 0); break; + case ID_FULLSCREEN: + { + int screensize; + + screensize = GetScreenSize(); + __asm__ __volatile__( + "int $0x40" + ::"a"(67), "b"(0), "c"(0), + "d"((screensize >> 16)-1),"S"((screensize & 0xFFFF)-1) ); + win->win_state = FULLSCREEN; + window_update_layout(win); + }; + break; + default: break; }; diff --git a/programs/media/Fplay/winlib/frame.c b/programs/media/Fplay/winlib/frame.c index 24a574409..29dd93d5e 100644 --- a/programs/media/Fplay/winlib/frame.c +++ b/programs/media/Fplay/winlib/frame.c @@ -139,6 +139,9 @@ int frame_proc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2) rect_t *rc = NULL; int x, y; + if(win->win_state == FULLSCREEN) + return 0; + x = ((pos_t)arg2).x; y = ((pos_t)arg2).y; diff --git a/programs/media/Fplay/winlib/window.c b/programs/media/Fplay/winlib/window.c index 04ca66db8..0eab39215 100644 --- a/programs/media/Fplay/winlib/window.c +++ b/programs/media/Fplay/winlib/window.c @@ -252,7 +252,7 @@ void window_update_layout(window_t *win) win->win_state = ROLLED; return; }; - + if(state & 1) state = MAXIMIZED; else @@ -269,10 +269,10 @@ void window_update_layout(window_t *win) if( winw == win->w && winh == win->h && state == win->win_state) - return; - win->win_state = state; + if(win->win_state != FULLSCREEN) + win->win_state = state; #if 0 int old_size;