2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <libavcodec/avcodec.h>
|
|
|
|
#include <libavformat/avformat.h>
|
|
|
|
#include <libswscale/swscale.h>
|
|
|
|
#include <libavutil/imgutils.h>
|
2016-01-27 15:43:42 +01:00
|
|
|
#include <math.h>
|
2014-01-10 14:47:21 +01:00
|
|
|
#include <kos32sys.h>
|
|
|
|
#include <sound.h>
|
2016-01-27 15:43:42 +01:00
|
|
|
|
|
|
|
#include "winlib/winlib.h"
|
2014-01-10 14:47:21 +01:00
|
|
|
#include "fplay.h"
|
|
|
|
|
|
|
|
int fplay_blit_bitmap(bitmap_t *bitmap, int dst_x, int dst_y,int w, int h);
|
|
|
|
|
|
|
|
extern int res_pause_btn[];
|
|
|
|
extern int res_pause_btn_pressed[];
|
|
|
|
|
|
|
|
extern int res_play_btn[];
|
|
|
|
extern int res_play_btn_pressed[];
|
|
|
|
|
|
|
|
extern int64_t stream_duration;
|
|
|
|
extern volatile int sound_level_0;
|
|
|
|
extern volatile int sound_level_1;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
AVPicture picture;
|
|
|
|
double pts;
|
|
|
|
volatile int ready;
|
|
|
|
}vframe_t;
|
|
|
|
|
|
|
|
vframe_t frames[4];
|
|
|
|
volatile int frames_count = 0;
|
|
|
|
|
|
|
|
struct SwsContext *cvt_ctx = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
render_t *main_render;
|
|
|
|
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
|
|
|
|
AVRational video_time_base;
|
|
|
|
AVFrame *Frame;
|
|
|
|
|
|
|
|
void get_client_rect(rect_t *rc);
|
|
|
|
|
2016-02-01 17:55:10 +01:00
|
|
|
void flush_video(vst_t *vst)
|
2014-01-10 14:47:21 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
frames[i].pts = 0;
|
|
|
|
frames[i].ready = 0;
|
|
|
|
};
|
2016-02-01 17:55:10 +01:00
|
|
|
vst->vfx = 0;
|
|
|
|
vst->dfx = 0;
|
2014-01-10 14:47:21 +01:00
|
|
|
frames_count = 0;
|
|
|
|
};
|
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
int init_video(vst_t *vst)
|
2014-01-10 14:47:21 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2016-02-01 17:55:10 +01:00
|
|
|
width = vst->vCtx->width;
|
2016-02-01 16:10:02 +01:00
|
|
|
height = vst->vCtx->height;
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
Frame = av_frame_alloc();
|
2014-01-10 14:47:21 +01:00
|
|
|
if ( Frame == NULL )
|
|
|
|
{
|
|
|
|
printf("Cannot alloc video frame\n\r");
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
for( i=0; i < 4; i++)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
ret = avpicture_alloc(&frames[i].picture, vst->vCtx->pix_fmt,
|
|
|
|
vst->vCtx->width, vst->vCtx->height);
|
2014-01-10 14:47:21 +01:00
|
|
|
if ( ret != 0 )
|
|
|
|
{
|
|
|
|
printf("Cannot alloc video buffer\n\r");
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
frames[i].pts = 0;
|
|
|
|
frames[i].ready = 0;
|
|
|
|
};
|
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
create_thread(video_thread, vst, 1024*1024);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
delay(50);
|
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
int decode_video(vst_t* vst)
|
2014-01-10 14:47:21 +01:00
|
|
|
{
|
|
|
|
AVPacket pkt;
|
|
|
|
double pts;
|
|
|
|
int frameFinished;
|
|
|
|
double current_clock;
|
|
|
|
|
2016-02-01 17:55:10 +01:00
|
|
|
if(frames[vst->dfx].ready != 0 )
|
2014-01-10 14:47:21 +01:00
|
|
|
return -1;
|
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
if( get_packet(&vst->q_video, &pkt) == 0 )
|
2014-01-10 14:47:21 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
current_clock = -90.0 + get_master_clock();
|
|
|
|
|
|
|
|
if( pkt.dts == AV_NOPTS_VALUE &&
|
|
|
|
Frame->reordered_opaque != AV_NOPTS_VALUE)
|
|
|
|
pts = Frame->reordered_opaque;
|
|
|
|
else if(pkt.dts != AV_NOPTS_VALUE)
|
|
|
|
pts= pkt.dts;
|
|
|
|
else
|
|
|
|
pts= 0;
|
|
|
|
|
|
|
|
|
|
|
|
pts *= av_q2d(video_time_base)*1000.0;
|
|
|
|
*/
|
|
|
|
if( 1 /*pts > current_clock*/)
|
|
|
|
{
|
|
|
|
frameFinished = 0;
|
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
vst->vCtx->reordered_opaque = pkt.pts;
|
|
|
|
|
|
|
|
mutex_lock(&vst->gpu_lock);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
if(avcodec_decode_video2(vst->vCtx, Frame, &frameFinished, &pkt) <= 0)
|
2014-01-10 14:47:21 +01:00
|
|
|
printf("video decoder error\n");
|
|
|
|
|
|
|
|
if(frameFinished)
|
|
|
|
{
|
|
|
|
AVPicture *dst_pic;
|
|
|
|
|
|
|
|
if( pkt.dts == AV_NOPTS_VALUE &&
|
|
|
|
Frame->reordered_opaque != AV_NOPTS_VALUE)
|
|
|
|
pts = Frame->reordered_opaque;
|
|
|
|
else if(pkt.dts != AV_NOPTS_VALUE)
|
2016-02-01 17:55:10 +01:00
|
|
|
pts = pkt.dts;
|
2014-01-10 14:47:21 +01:00
|
|
|
else
|
2016-02-01 17:55:10 +01:00
|
|
|
pts = 0;
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
pts *= av_q2d(video_time_base);
|
|
|
|
|
2016-02-01 17:55:10 +01:00
|
|
|
dst_pic = &frames[vst->dfx].picture;
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
av_image_copy(dst_pic->data, dst_pic->linesize,
|
|
|
|
(const uint8_t**)Frame->data,
|
2016-02-01 16:10:02 +01:00
|
|
|
Frame->linesize, vst->vCtx->pix_fmt, vst->vCtx->width, vst->vCtx->height);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2016-02-01 17:55:10 +01:00
|
|
|
frames[vst->dfx].pts = pts*1000.0;
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2016-02-01 17:55:10 +01:00
|
|
|
frames[vst->dfx].ready = 1;
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2016-02-01 17:55:10 +01:00
|
|
|
vst->dfx = (vst->dfx + 1) & 3;
|
2014-01-10 14:47:21 +01:00
|
|
|
frames_count++;
|
|
|
|
};
|
2016-02-01 16:10:02 +01:00
|
|
|
mutex_unlock(&vst->gpu_lock);
|
|
|
|
|
2014-01-10 14:47:21 +01:00
|
|
|
};
|
|
|
|
av_free_packet(&pkt);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern volatile enum player_state player_state;
|
|
|
|
extern volatile enum player_state decoder_state;
|
|
|
|
extern volatile enum player_state sound_state;
|
|
|
|
|
|
|
|
extern int64_t rewind_pos;
|
|
|
|
|
|
|
|
static void player_stop()
|
|
|
|
{
|
|
|
|
window_t *win;
|
|
|
|
|
|
|
|
win = main_render->win;
|
|
|
|
|
|
|
|
rewind_pos = 0;
|
|
|
|
|
|
|
|
win->panel.play_btn->img_default = res_play_btn;
|
|
|
|
win->panel.play_btn->img_hilite = res_play_btn;
|
|
|
|
win->panel.play_btn->img_pressed = res_play_btn_pressed;
|
|
|
|
win->panel.prg->current = rewind_pos;
|
|
|
|
|
|
|
|
send_message(&win->panel.ctrl, MSG_PAINT, 0, 0);
|
|
|
|
player_state = STOP;
|
|
|
|
decoder_state = PLAY_2_STOP;
|
|
|
|
sound_state = PLAY_2_STOP;
|
|
|
|
render_draw_client(main_render);
|
|
|
|
};
|
|
|
|
|
|
|
|
int MainWindowProc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
|
|
|
|
{
|
|
|
|
window_t *win = (window_t*)ctrl;
|
|
|
|
static int spc_down = 0;
|
|
|
|
static int ent_down = 0;
|
|
|
|
|
|
|
|
switch(msg)
|
|
|
|
{
|
|
|
|
case MSG_SIZE:
|
|
|
|
if(main_render)
|
|
|
|
{
|
|
|
|
render_adjust_size(main_render, win);
|
|
|
|
render_draw_client(main_render);
|
|
|
|
};
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSG_KEY:
|
|
|
|
switch((short)arg2)
|
|
|
|
{
|
|
|
|
case 0x39:
|
|
|
|
if(spc_down == 0)
|
|
|
|
{
|
|
|
|
spc_down = 1;
|
|
|
|
send_message(win, MSG_LBTNDOWN, 0, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0xB9:
|
|
|
|
spc_down = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x1C:
|
|
|
|
if(ent_down == 0)
|
|
|
|
{
|
|
|
|
int screensize;
|
|
|
|
if(win->win_state == NORMAL)
|
|
|
|
{
|
|
|
|
win->saved = win->rc;
|
|
|
|
win->saved_state = win->win_state;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else if(win->win_state == FULLSCREEN)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__(
|
|
|
|
"int $0x40"
|
|
|
|
::"a"(67), "b"(win->saved.l), "c"(win->saved.t),
|
|
|
|
"d"(win->saved.r-win->saved.l-1),"S"(win->saved.b-win->saved.t-1));
|
|
|
|
win->win_state = win->saved_state;
|
|
|
|
window_update_layout(win);
|
|
|
|
// if(win->saved_state == MAXIMIZED)
|
2015-01-15 06:51:37 +01:00
|
|
|
// {
|
|
|
|
// blit_caption(&win->caption);
|
|
|
|
// blit_panel(&win->panel);
|
|
|
|
// }
|
2014-01-10 14:47:21 +01:00
|
|
|
}
|
|
|
|
ent_down = 1;
|
|
|
|
};
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x9C:
|
|
|
|
ent_down = 0;
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
|
|
|
|
case MSG_DRAW_CLIENT:
|
|
|
|
if(main_render)
|
|
|
|
{
|
|
|
|
render_draw_client(main_render);
|
|
|
|
};
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSG_LBTNDOWN:
|
|
|
|
|
|
|
|
if(player_state == PAUSE)
|
|
|
|
{
|
|
|
|
win->panel.play_btn->img_default = res_pause_btn;
|
|
|
|
win->panel.play_btn->img_hilite = res_pause_btn;
|
|
|
|
win->panel.play_btn->img_pressed = res_pause_btn_pressed;
|
|
|
|
send_message(&win->panel.play_btn->ctrl, MSG_PAINT, 0, 0);
|
|
|
|
player_state = PLAY;
|
|
|
|
sound_state = PAUSE_2_PLAY;
|
|
|
|
|
|
|
|
}
|
|
|
|
else if(player_state == PLAY)
|
|
|
|
{
|
|
|
|
win->panel.play_btn->img_default = res_play_btn;
|
|
|
|
win->panel.play_btn->img_hilite = res_play_btn;
|
|
|
|
win->panel.play_btn->img_pressed = res_play_btn_pressed;
|
|
|
|
send_message(&win->panel.play_btn->ctrl, MSG_PAINT, 0, 0);
|
|
|
|
player_state = PAUSE;
|
|
|
|
sound_state = PLAY_2_PAUSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MSG_COMMAND:
|
|
|
|
switch((short)arg1)
|
|
|
|
{
|
|
|
|
case ID_PLAY:
|
|
|
|
if(player_state == PAUSE)
|
|
|
|
{
|
|
|
|
win->panel.play_btn->img_default = res_pause_btn;
|
|
|
|
win->panel.play_btn->img_hilite = res_pause_btn;
|
|
|
|
win->panel.play_btn->img_pressed = res_pause_btn_pressed;
|
|
|
|
player_state = PLAY;
|
|
|
|
sound_state = PAUSE_2_PLAY;
|
|
|
|
}
|
|
|
|
else if(player_state == PLAY)
|
|
|
|
{
|
|
|
|
win->panel.play_btn->img_default = res_play_btn;
|
|
|
|
win->panel.play_btn->img_hilite = res_play_btn;
|
|
|
|
win->panel.play_btn->img_pressed = res_play_btn_pressed;
|
|
|
|
player_state = PAUSE;
|
|
|
|
sound_state = PLAY_2_PAUSE;
|
|
|
|
}
|
|
|
|
else if(player_state == STOP)
|
|
|
|
{
|
|
|
|
win->panel.play_btn->img_default = res_pause_btn;
|
|
|
|
win->panel.play_btn->img_hilite = res_pause_btn;
|
|
|
|
win->panel.play_btn->img_pressed = res_pause_btn_pressed;
|
|
|
|
rewind_pos = 0;
|
|
|
|
send_message(&win->panel.ctrl, MSG_PAINT, 0, 0);
|
|
|
|
player_state = PLAY;
|
|
|
|
decoder_state = PREPARE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_STOP:
|
|
|
|
player_stop();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PROGRESS:
|
|
|
|
if(player_state != REWIND)
|
|
|
|
{
|
|
|
|
progress_t *prg = (progress_t*)arg2;
|
|
|
|
|
|
|
|
rewind_pos = (prg->max - prg->min)*prg->pos/prg->ctrl.w;
|
|
|
|
|
|
|
|
player_state = REWIND;
|
|
|
|
decoder_state = REWIND;
|
|
|
|
sound_state = PLAY_2_STOP;
|
|
|
|
if(rewind_pos < prg->current)
|
|
|
|
{
|
|
|
|
prg->current = rewind_pos;
|
|
|
|
rewind_pos = -rewind_pos;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
prg->current = rewind_pos;
|
|
|
|
|
|
|
|
win->panel.play_btn->img_default = res_pause_btn;
|
|
|
|
win->panel.play_btn->img_hilite = res_pause_btn;
|
|
|
|
win->panel.play_btn->img_pressed = res_pause_btn_pressed;
|
|
|
|
send_message(&prg->ctrl, MSG_PAINT, 0, 0);
|
|
|
|
};
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_VOL_CTRL:
|
|
|
|
{
|
|
|
|
slider_t *sld = (slider_t*)arg2;
|
|
|
|
int peak;
|
|
|
|
int level;
|
|
|
|
|
|
|
|
peak = sld->min + sld->pos * (sld->max - sld->min)/(96);
|
|
|
|
level = peak;
|
|
|
|
|
|
|
|
set_audio_volume(level, level);
|
|
|
|
send_message(&sld->ctrl, MSG_PAINT, 0, 0);
|
|
|
|
win->panel.lvl->vol = level;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
def_window_proc(ctrl,msg,arg1,arg2);
|
|
|
|
};
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define VERSION_A 1
|
|
|
|
|
|
|
|
void render_time(render_t *render)
|
|
|
|
{
|
2016-02-01 17:55:10 +01:00
|
|
|
progress_t *prg = main_render->win->panel.prg;
|
|
|
|
level_t *lvl = main_render->win->panel.lvl;
|
|
|
|
vst_t *vst = main_render->vst;
|
2014-01-10 14:47:21 +01:00
|
|
|
double ctime; /* milliseconds */
|
|
|
|
double fdelay; /* milliseconds */
|
|
|
|
|
|
|
|
//again:
|
|
|
|
|
|
|
|
if(player_state == CLOSED)
|
|
|
|
{
|
|
|
|
render->win->win_command = WIN_CLOSED;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if((player_state == PAUSE) || (player_state == REWIND))
|
|
|
|
{
|
|
|
|
delay(1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (decoder_state == STOP && frames_count == 0 &&
|
|
|
|
player_state != STOP)
|
|
|
|
{
|
|
|
|
player_stop();
|
|
|
|
}
|
|
|
|
else if(player_state != PLAY)
|
|
|
|
{
|
|
|
|
delay(1);
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef VERSION_A
|
2016-02-01 17:55:10 +01:00
|
|
|
if(frames[vst->vfx].ready == 1 )
|
2014-01-10 14:47:21 +01:00
|
|
|
{
|
|
|
|
int sys_time;
|
|
|
|
|
|
|
|
ctime = get_master_clock();
|
2016-02-01 17:55:10 +01:00
|
|
|
fdelay = (frames[vst->vfx].pts - ctime);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
// printf("pts %f time %f delay %f\n",
|
|
|
|
// frames[vfx].pts, ctime, fdelay);
|
|
|
|
|
|
|
|
if(fdelay > 15.0)
|
|
|
|
{
|
|
|
|
delay((int)fdelay/10);
|
|
|
|
// return;
|
|
|
|
};
|
|
|
|
#if 0
|
|
|
|
ctime = get_master_clock();
|
2016-02-01 17:55:10 +01:00
|
|
|
fdelay = (frames[vst->vfx].pts - ctime);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
// while(fdelay > 0)
|
|
|
|
// {
|
|
|
|
// yield();
|
|
|
|
// ctime = get_master_clock();
|
|
|
|
// fdelay = (frames[vfx].pts - ctime);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// sys_time = get_tick_count();
|
|
|
|
|
|
|
|
// if(fdelay < 0)
|
|
|
|
// printf("systime %d pts %f time %f delay %f\n",
|
|
|
|
// sys_time*10, frames[vfx].pts, ctime, fdelay);
|
|
|
|
|
|
|
|
printf("pts %f time %f delay %f\n",
|
|
|
|
frames[vfx].pts, ctime, fdelay);
|
|
|
|
printf("video cache %d audio cache %d\n", q_video.size/1024, q_audio.size/1024);
|
|
|
|
#endif
|
|
|
|
|
2016-02-01 17:55:10 +01:00
|
|
|
main_render->draw(main_render, &frames[vst->vfx].picture);
|
2014-01-10 14:47:21 +01:00
|
|
|
if(main_render->win->win_state != FULLSCREEN)
|
|
|
|
{
|
2016-02-01 17:55:10 +01:00
|
|
|
prg->current = frames[vst->vfx].pts*1000;
|
2014-01-10 14:47:21 +01:00
|
|
|
// printf("current %f\n", prg->current);
|
2016-02-01 17:55:10 +01:00
|
|
|
lvl->current = vst->vfx & 1 ? sound_level_1 : sound_level_0;
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
send_message(&prg->ctrl, PRG_PROGRESS, 0, 0);
|
|
|
|
|
|
|
|
if(main_render->win->panel.layout)
|
|
|
|
send_message(&lvl->ctrl, MSG_PAINT, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
frames_count--;
|
2016-02-01 17:55:10 +01:00
|
|
|
frames[vst->vfx].ready = 0;
|
|
|
|
vst->vfx = (vst->vfx + 1) & 3;
|
2014-01-10 14:47:21 +01:00
|
|
|
}
|
|
|
|
else delay(1);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
if(frames[vfx].ready == 1 )
|
|
|
|
{
|
|
|
|
ctime = get_master_clock();
|
2016-02-01 17:55:10 +01:00
|
|
|
fdelay = (frames[vst->vfx].pts - ctime);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
// printf("pts %f time %f delay %f\n",
|
|
|
|
// frames[vfx].pts, ctime, fdelay);
|
|
|
|
|
|
|
|
if(fdelay < 0.0 )
|
|
|
|
{
|
|
|
|
int next_vfx;
|
|
|
|
fdelay = 0;
|
2016-02-01 17:55:10 +01:00
|
|
|
next_vfx = (vst->vfx+1) & 3;
|
2014-01-10 14:47:21 +01:00
|
|
|
if( frames[next_vfx].ready == 1 )
|
|
|
|
{
|
|
|
|
if(frames[next_vfx].pts <= ctime)
|
|
|
|
{
|
2016-02-01 17:55:10 +01:00
|
|
|
frames[vst->vfx].ready = 0; // skip this frame
|
|
|
|
vst->vfx = (vst->vfx + 1) & 3;
|
2014-01-10 14:47:21 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( (frames[next_vfx].pts - ctime) <
|
2016-02-01 17:55:10 +01:00
|
|
|
( ctime - frames[vst->vfx].pts) )
|
2014-01-10 14:47:21 +01:00
|
|
|
{
|
2016-02-01 17:55:10 +01:00
|
|
|
frames[vst->vfx].ready = 0; // skip this frame
|
|
|
|
vst->vfx = (vst->vfx + 1) & 3;
|
2014-01-10 14:47:21 +01:00
|
|
|
fdelay = (frames[next_vfx].pts - ctime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
if(fdelay > 10.0)
|
|
|
|
{
|
|
|
|
int val = fdelay;
|
|
|
|
printf("pts %f time %f delay %d\n",
|
2016-02-01 17:55:10 +01:00
|
|
|
frames[vst->vfx].pts, ctime, val);
|
2014-01-10 14:47:21 +01:00
|
|
|
delay(val/10);
|
|
|
|
};
|
|
|
|
|
|
|
|
ctime = get_master_clock();
|
2016-02-01 17:55:10 +01:00
|
|
|
fdelay = (frames[vst->vfx].pts - ctime);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
printf("pts %f time %f delay %f\n",
|
2016-02-01 17:55:10 +01:00
|
|
|
frames[vst->vfx].pts, ctime, fdelay);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
main_render->draw(main_render, &frames[vfx].picture);
|
|
|
|
main_render->win->panel.prg->current = frames[vfx].pts;
|
|
|
|
// send_message(&render->win->panel.prg->ctrl, MSG_PAINT, 0, 0);
|
2016-02-01 17:55:10 +01:00
|
|
|
frames[vst->vfx].ready = 0;
|
|
|
|
vst->vfx = (vst->vfx + 1) & 3;
|
2014-01-10 14:47:21 +01:00
|
|
|
}
|
|
|
|
else yield();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern char *movie_file;
|
|
|
|
|
|
|
|
int video_thread(void *param)
|
|
|
|
{
|
2016-02-01 16:10:02 +01:00
|
|
|
vst_t *vst = param;
|
2014-01-10 14:47:21 +01:00
|
|
|
window_t *MainWindow;
|
|
|
|
|
|
|
|
init_winlib();
|
|
|
|
|
|
|
|
MainWindow = create_window(movie_file,0,
|
|
|
|
10,10,width,height+CAPTION_HEIGHT+PANEL_HEIGHT,MainWindowProc);
|
|
|
|
|
|
|
|
MainWindow->panel.prg->max = stream_duration;
|
|
|
|
|
|
|
|
show_window(MainWindow, NORMAL);
|
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
main_render = create_render(vst, MainWindow, HW_TEX_BLIT|HW_BIT_BLIT);
|
2014-01-10 14:47:21 +01:00
|
|
|
if( main_render == NULL)
|
|
|
|
{
|
|
|
|
printf("Cannot create render\n\r");
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2015-07-23 12:13:34 +02:00
|
|
|
__sync_or_and_fetch(&threads_running,VIDEO_THREAD);
|
|
|
|
|
2014-01-10 14:47:21 +01:00
|
|
|
render_draw_client(main_render);
|
|
|
|
player_state = PLAY;
|
|
|
|
|
|
|
|
run_render(MainWindow, main_render);
|
|
|
|
|
2015-07-23 12:13:34 +02:00
|
|
|
__sync_and_and_fetch(&threads_running,~VIDEO_THREAD);
|
|
|
|
|
2014-01-10 14:47:21 +01:00
|
|
|
destroy_render(main_render);
|
|
|
|
fini_winlib();
|
|
|
|
player_state = CLOSED;
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void draw_hw_picture(render_t *render, AVPicture *picture);
|
|
|
|
void draw_sw_picture(render_t *render, AVPicture *picture);
|
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
render_t *create_render(vst_t *vst, window_t *win, uint32_t flags)
|
2014-01-10 14:47:21 +01:00
|
|
|
{
|
|
|
|
render_t *render;
|
|
|
|
|
|
|
|
uint32_t right, bottom, draw_w, draw_h;
|
|
|
|
uint32_t s, sw, sh;
|
|
|
|
uint8_t state;
|
|
|
|
|
|
|
|
// __asm__ __volatile__("int3");
|
|
|
|
|
|
|
|
render = (render_t*)malloc(sizeof(render_t));
|
|
|
|
memset(render, 0, sizeof(render_t));
|
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
render->vst = vst;
|
2014-01-10 14:47:21 +01:00
|
|
|
render->win = win;
|
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
render->ctx_width = vst->vCtx->width;
|
|
|
|
render->ctx_height = vst->vCtx->height;
|
|
|
|
render->ctx_format = vst->vCtx->pix_fmt;
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
render->caps = pxInit(1);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
right = win->w;
|
|
|
|
bottom = win->h-CAPTION_HEIGHT-PANEL_HEIGHT;
|
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
printf("window width %d height %d\n",
|
|
|
|
right, bottom);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
render->win_state = win->win_state;
|
|
|
|
|
|
|
|
draw_w = bottom*render->ctx_width/render->ctx_height;
|
|
|
|
draw_h = right*render->ctx_height/render->ctx_width;
|
|
|
|
|
|
|
|
if(draw_w > right)
|
|
|
|
{
|
|
|
|
draw_w = right;
|
|
|
|
draw_h = right*render->ctx_height/render->ctx_width;
|
|
|
|
};
|
|
|
|
|
|
|
|
if(draw_h > bottom)
|
|
|
|
{
|
|
|
|
draw_h = bottom;
|
|
|
|
draw_w = bottom*render->ctx_width/render->ctx_height;
|
|
|
|
};
|
|
|
|
|
|
|
|
render->win_width = win->w;
|
|
|
|
render->win_height = win->h-CAPTION_HEIGHT-PANEL_HEIGHT;
|
|
|
|
|
|
|
|
render_set_size(render, draw_w, draw_h);
|
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
pxCreateClient(0, CAPTION_HEIGHT, right, bottom);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
if(render->caps==0)
|
|
|
|
{
|
2015-01-15 06:51:37 +01:00
|
|
|
render->bitmap[0] = pxCreateBitmap(draw_w, draw_h);
|
|
|
|
if(render->bitmap[0] == NULL)
|
2014-01-10 14:47:21 +01:00
|
|
|
{
|
|
|
|
free(render);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
render->draw = draw_sw_picture;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-01-15 06:51:37 +01:00
|
|
|
int width, height;
|
2014-01-10 14:47:21 +01:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if(render->caps & HW_TEX_BLIT)
|
|
|
|
{
|
|
|
|
width = render->ctx_width;
|
|
|
|
height = render->ctx_height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
width = draw_w;
|
|
|
|
height = draw_h;;
|
|
|
|
}
|
|
|
|
|
|
|
|
for( i=0; i < 2; i++)
|
|
|
|
{
|
2015-01-15 06:51:37 +01:00
|
|
|
render->bitmap[i] = pxCreateBitmap(width, height);
|
|
|
|
if( render->bitmap[i] == NULL )
|
2014-01-10 14:47:21 +01:00
|
|
|
{
|
|
|
|
player_state = CLOSED;
|
|
|
|
free(render);
|
|
|
|
return NULL;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
render->state = INIT;
|
|
|
|
render->target = 0;
|
|
|
|
render->draw = draw_hw_picture;
|
|
|
|
};
|
|
|
|
|
|
|
|
printf("FPlay %s render engine: context %dx%d picture %dx%d\n",
|
|
|
|
render->caps & HW_TEX_BLIT ? "hw_tex_blit":
|
|
|
|
render->caps & HW_BIT_BLIT ? "hw_bit_blit":"software",
|
|
|
|
render->ctx_width, render->ctx_height,
|
|
|
|
draw_w, draw_h);
|
|
|
|
|
|
|
|
return render;
|
|
|
|
};
|
|
|
|
|
|
|
|
void destroy_render(render_t *render)
|
|
|
|
{
|
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
pxDestroyBitmap(render->bitmap[0]);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
if(render->caps & (HW_BIT_BLIT|HW_TEX_BLIT)) /* hw blitter */
|
2015-01-15 06:51:37 +01:00
|
|
|
pxDestroyBitmap(render->bitmap[1]);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
pxFini();
|
2014-01-10 14:47:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
void render_set_size(render_t *render, int width, int height)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
render->layout = 0;
|
|
|
|
render->rcvideo.l = 0;
|
|
|
|
render->rcvideo.t = 0;
|
|
|
|
render->rcvideo.r = width;
|
|
|
|
render->rcvideo.b = height;
|
|
|
|
|
|
|
|
// printf("render width %d height %d\n",width, height);
|
|
|
|
|
|
|
|
if( render->win_height > height )
|
|
|
|
{
|
|
|
|
int yoffs;
|
|
|
|
yoffs = (render->win_height-height)/2;
|
|
|
|
if(yoffs)
|
|
|
|
{
|
|
|
|
render->rctop.t = 0;
|
|
|
|
render->rctop.b = yoffs;
|
|
|
|
render->rcvideo.t = yoffs;
|
|
|
|
render->layout |= HAS_TOP;
|
|
|
|
}
|
|
|
|
|
|
|
|
yoffs = render->win_height-(render->rcvideo.t+render->rcvideo.b);
|
|
|
|
if(yoffs)
|
|
|
|
{
|
|
|
|
render->rcbottom.t = render->rcvideo.t+render->rcvideo.b;
|
|
|
|
render->rcbottom.b = yoffs;
|
|
|
|
render->layout |= HAS_BOTTOM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( render->win_width > width )
|
|
|
|
{
|
|
|
|
int xoffs;
|
|
|
|
xoffs = (render->win_width-width)/2;
|
|
|
|
if(xoffs)
|
|
|
|
{
|
|
|
|
render->rcleft.r = xoffs;
|
|
|
|
render->rcvideo.l = xoffs;
|
|
|
|
render->layout |= HAS_LEFT;
|
|
|
|
}
|
|
|
|
xoffs = render->win_width-(render->rcvideo.l+render->rcvideo.r);
|
|
|
|
if(xoffs)
|
|
|
|
{
|
|
|
|
render->rcright.l = render->rcvideo.l+render->rcvideo.r;
|
|
|
|
render->rcright.r = xoffs;
|
|
|
|
render->layout |= HAS_RIGHT;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
void render_adjust_size(render_t *render, window_t *win)
|
|
|
|
{
|
|
|
|
uint32_t right, bottom, new_w, new_h;
|
|
|
|
uint32_t s, sw, sh;
|
|
|
|
uint8_t state;
|
|
|
|
|
|
|
|
right = win->w;
|
|
|
|
bottom = win->h;
|
|
|
|
|
|
|
|
if(win->win_state != FULLSCREEN)
|
|
|
|
bottom-= CAPTION_HEIGHT+PANEL_HEIGHT;
|
|
|
|
|
|
|
|
// printf("window width %d height %d\n",
|
|
|
|
// right, bottom);
|
|
|
|
|
|
|
|
render->win_state = win->win_state;
|
|
|
|
|
|
|
|
if(render->win_state == MINIMIZED)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(render->win_state == ROLLED)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( right == render->win_width &&
|
|
|
|
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;
|
|
|
|
|
|
|
|
if(new_w > right)
|
|
|
|
{
|
|
|
|
new_w = right;
|
|
|
|
new_h = right*render->ctx_height/render->ctx_width;
|
|
|
|
};
|
|
|
|
if(new_h > bottom)
|
|
|
|
{
|
|
|
|
new_h = bottom;
|
|
|
|
new_w = bottom*render->ctx_width/render->ctx_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 */
|
2015-01-15 06:51:37 +01:00
|
|
|
{
|
|
|
|
if(render->win->win_state == FULLSCREEN)
|
|
|
|
pxResizeClient(render->rcvideo.l, render->rcvideo.t, new_w, new_h);
|
|
|
|
else
|
|
|
|
pxResizeClient(render->rcvideo.l, render->rcvideo.t+CAPTION_HEIGHT, new_w, new_h);
|
|
|
|
|
2014-01-10 14:47:21 +01:00
|
|
|
return;
|
2015-01-15 06:51:37 +01:00
|
|
|
};
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
pxResizeBitmap(render->bitmap[0], new_w, new_h);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
if(render->caps & HW_BIT_BLIT) /* hw blitter */
|
2015-01-15 06:51:37 +01:00
|
|
|
pxResizeBitmap(render->bitmap[1], new_w, new_h);
|
|
|
|
|
2014-01-10 14:47:21 +01:00
|
|
|
return;
|
|
|
|
};
|
|
|
|
|
|
|
|
void draw_hw_picture(render_t *render, AVPicture *picture)
|
|
|
|
{
|
2015-01-15 06:51:37 +01:00
|
|
|
int dst_width;
|
|
|
|
int dst_height;
|
|
|
|
bitmap_t *bitmap;
|
|
|
|
uint8_t *bitmap_data;
|
|
|
|
uint32_t bitmap_pitch;
|
|
|
|
uint8_t *data[4];
|
|
|
|
int linesize[4];
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
if(render->win->win_state == MINIMIZED ||
|
|
|
|
render->win->win_state == ROLLED)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(render->caps & HW_TEX_BLIT)
|
|
|
|
{
|
|
|
|
dst_width = render->ctx_width;
|
|
|
|
dst_height = render->ctx_height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dst_width = render->rcvideo.r;
|
|
|
|
dst_height = render->rcvideo.b;
|
|
|
|
};
|
|
|
|
|
|
|
|
cvt_ctx = sws_getCachedContext(cvt_ctx,
|
|
|
|
render->ctx_width, render->ctx_height, render->ctx_format,
|
2016-02-01 16:10:02 +01:00
|
|
|
dst_width, dst_height, AV_PIX_FMT_BGRA,
|
2014-01-10 14:47:21 +01:00
|
|
|
SWS_FAST_BILINEAR, NULL, NULL, NULL);
|
|
|
|
if(cvt_ctx == NULL)
|
|
|
|
{
|
|
|
|
printf("Cannot initialize the conversion context!\n");
|
|
|
|
return ;
|
|
|
|
};
|
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
bitmap = render->bitmap[render->target];
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
bitmap_data = pxLockBitmap(bitmap, &bitmap_pitch);
|
|
|
|
if( bitmap_data == NULL)
|
2014-01-10 14:47:21 +01:00
|
|
|
{
|
|
|
|
printf("Cannot lock bitmap!\n");
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
// printf("sws_getCachedContext\n");
|
2015-01-15 06:51:37 +01:00
|
|
|
data[0] = bitmap_data;
|
|
|
|
data[1] = bitmap_data+1;
|
|
|
|
data[2] = bitmap_data+2;
|
|
|
|
data[3] = bitmap_data+3;
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
linesize[0] = bitmap_pitch;
|
|
|
|
linesize[1] = bitmap_pitch;
|
|
|
|
linesize[2] = bitmap_pitch;
|
|
|
|
linesize[3] = bitmap_pitch;
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
sws_scale(cvt_ctx, (const uint8_t* const *)picture->data,
|
|
|
|
picture->linesize, 0, render->ctx_height, data, linesize);
|
|
|
|
// printf("sws_scale\n");
|
|
|
|
|
2016-02-01 16:10:02 +01:00
|
|
|
mutex_lock(&render->vst->gpu_lock);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
if(render->caps & HW_TEX_BLIT)
|
|
|
|
{
|
|
|
|
|
|
|
|
if(render->win->win_state == FULLSCREEN)
|
2015-01-15 06:51:37 +01:00
|
|
|
pxBlitBitmap(bitmap,render->rcvideo.l,render->rcvideo.t,
|
|
|
|
render->rcvideo.r, render->rcvideo.b,0,0);
|
2014-01-10 14:47:21 +01:00
|
|
|
else
|
2015-01-15 06:51:37 +01:00
|
|
|
pxBlitBitmap(bitmap, render->rcvideo.l,
|
2014-01-10 14:47:21 +01:00
|
|
|
CAPTION_HEIGHT+render->rcvideo.t,
|
2015-01-15 06:51:37 +01:00
|
|
|
render->rcvideo.r, render->rcvideo.b,0,0);
|
2014-01-10 14:47:21 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(render->win->win_state == FULLSCREEN)
|
2015-01-15 06:51:37 +01:00
|
|
|
pxBlitBitmap(bitmap,render->rcvideo.l,render->rcvideo.t,
|
2014-01-10 14:47:21 +01:00
|
|
|
render->rcvideo.r, render->rcvideo.b, 0,0);
|
|
|
|
else
|
2015-01-15 06:51:37 +01:00
|
|
|
pxBlitBitmap(bitmap, render->rcvideo.l,
|
2014-01-10 14:47:21 +01:00
|
|
|
CAPTION_HEIGHT+render->rcvideo.t,
|
|
|
|
render->rcvideo.r, render->rcvideo.b, 0, 0);
|
|
|
|
};
|
2016-02-01 16:10:02 +01:00
|
|
|
mutex_unlock(&render->vst->gpu_lock);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
render->last_bitmap = bitmap;
|
|
|
|
render->target++;
|
|
|
|
render->target&= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void draw_sw_picture(render_t *render, AVPicture *picture)
|
|
|
|
{
|
2015-01-15 06:51:37 +01:00
|
|
|
uint8_t *bitmap_data;
|
|
|
|
uint32_t bitmap_pitch;
|
2016-02-01 17:55:10 +01:00
|
|
|
uint8_t *data[4];
|
2014-01-10 14:47:21 +01:00
|
|
|
int linesize[4];
|
|
|
|
|
|
|
|
if(render->win->win_state == MINIMIZED ||
|
|
|
|
render->win->win_state == ROLLED)
|
|
|
|
return;
|
|
|
|
|
|
|
|
cvt_ctx = sws_getCachedContext(cvt_ctx,
|
|
|
|
render->ctx_width, render->ctx_height,
|
|
|
|
render->ctx_format,
|
|
|
|
render->rcvideo.r, render->rcvideo.b,
|
2016-02-01 16:10:02 +01:00
|
|
|
AV_PIX_FMT_BGRA, SWS_FAST_BILINEAR, NULL, NULL, NULL);
|
2014-01-10 14:47:21 +01:00
|
|
|
if(cvt_ctx == NULL)
|
|
|
|
{
|
|
|
|
printf("Cannot initialize the conversion context!\n");
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
bitmap_data = pxLockBitmap(render->bitmap[0],&bitmap_pitch);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
data[0] = bitmap_data;
|
|
|
|
data[1] = bitmap_data+1;
|
|
|
|
data[2] = bitmap_data+2;
|
|
|
|
data[3] = bitmap_data+3;
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
linesize[0] = bitmap_pitch;
|
|
|
|
linesize[1] = bitmap_pitch;
|
|
|
|
linesize[2] = bitmap_pitch;
|
|
|
|
linesize[3] = bitmap_pitch;
|
2014-01-10 14:47:21 +01:00
|
|
|
|
|
|
|
sws_scale(cvt_ctx, (const uint8_t* const *)picture->data,
|
|
|
|
picture->linesize, 0, render->ctx_height, data, linesize);
|
|
|
|
|
|
|
|
if(render->win->win_state == FULLSCREEN)
|
2015-01-15 06:51:37 +01:00
|
|
|
pxBlitBitmap(render->bitmap[0],render->rcvideo.l,render->rcvideo.t,
|
|
|
|
render->rcvideo.r, render->rcvideo.b,0,0);
|
2014-01-10 14:47:21 +01:00
|
|
|
else
|
2015-01-15 06:51:37 +01:00
|
|
|
pxBlitBitmap(render->bitmap[0], render->rcvideo.l,
|
2014-01-10 14:47:21 +01:00
|
|
|
CAPTION_HEIGHT+render->rcvideo.t,
|
2015-01-15 06:51:37 +01:00
|
|
|
render->rcvideo.r, render->rcvideo.b,0,0);
|
2014-01-10 14:47:21 +01:00
|
|
|
|
2015-01-15 06:51:37 +01:00
|
|
|
render->last_bitmap = render->bitmap[0];
|
2014-01-10 14:47:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void render_draw_client(render_t *render)
|
|
|
|
{
|
2016-02-01 17:55:10 +01:00
|
|
|
vst_t *vst = render->vst;
|
2014-01-10 14:47:21 +01:00
|
|
|
int y;
|
|
|
|
|
|
|
|
if(render->win_state == MINIMIZED ||
|
|
|
|
render->win_state == ROLLED )
|
|
|
|
return;
|
|
|
|
if(render->win_state == FULLSCREEN)
|
|
|
|
y = 0;
|
|
|
|
else
|
|
|
|
y = CAPTION_HEIGHT;
|
|
|
|
|
|
|
|
if(player_state == PAUSE)
|
|
|
|
{
|
2016-02-01 17:55:10 +01:00
|
|
|
if(frames[vst->vfx].ready == 1 )
|
|
|
|
main_render->draw(main_render, &frames[vst->vfx].picture);
|
2014-01-10 14:47:21 +01:00
|
|
|
else
|
|
|
|
draw_bar(0, y, render->win_width,
|
|
|
|
render->rcvideo.b, 0);
|
|
|
|
}
|
|
|
|
else if( player_state == STOP )
|
|
|
|
{
|
|
|
|
draw_bar(0,y, render->win_width,
|
|
|
|
render->rcvideo.b, 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
if(render->layout & HAS_TOP)
|
|
|
|
draw_bar(0, y, render->win_width,
|
|
|
|
render->rctop.b, 0);
|
|
|
|
if(render->layout & HAS_LEFT)
|
|
|
|
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+y,
|
|
|
|
render->rcright.r, render->rcvideo.b, 0);
|
|
|
|
if(render->layout & HAS_BOTTOM)
|
|
|
|
draw_bar(0, render->rcbottom.t+y,
|
|
|
|
render->win_width, render->rcbottom.b, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|