2010-11-10 06:51:05 +01:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <libavcodec/avcodec.h>
|
|
|
|
#include <libavformat/avformat.h>
|
|
|
|
#include <libswscale/swscale.h>
|
2012-02-28 09:45:00 +01:00
|
|
|
#include <libavutil/imgutils.h>
|
|
|
|
#include "system.h"
|
2012-03-02 11:31:15 +01:00
|
|
|
#include "../winlib/winlib.h"
|
2012-02-13 23:34:36 +01:00
|
|
|
#include "sound.h"
|
2010-11-10 06:51:05 +01:00
|
|
|
#include "fplay.h"
|
2012-11-28 13:06:34 +01:00
|
|
|
#include <math.h>
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
extern int res_pause_btn[];
|
|
|
|
extern int res_pause_btn_pressed[];
|
|
|
|
|
|
|
|
extern int res_play_btn[];
|
|
|
|
extern int res_play_btn_pressed[];
|
|
|
|
|
2012-05-27 12:41:27 +02:00
|
|
|
extern int64_t stream_duration;
|
2012-11-28 13:06:34 +01:00
|
|
|
extern volatile int sound_level_0;
|
|
|
|
extern volatile int sound_level_1;
|
2012-03-02 11:31:15 +01:00
|
|
|
|
2010-11-10 06:51:05 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2012-02-13 23:34:36 +01:00
|
|
|
AVPicture picture;
|
2010-11-10 06:51:05 +01:00
|
|
|
double pts;
|
|
|
|
volatile int ready;
|
|
|
|
}vframe_t;
|
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
vframe_t frames[4];
|
2012-11-28 13:06:34 +01:00
|
|
|
volatile int frames_count = 0;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
struct SwsContext *cvt_ctx = NULL;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
|
|
|
int vfx = 0;
|
|
|
|
int dfx = 0;
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
render_t *main_render;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2010-11-10 06:51:05 +01:00
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
|
|
|
|
AVRational video_time_base;
|
|
|
|
AVFrame *Frame;
|
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
volatile uint32_t driver_lock;
|
|
|
|
|
|
|
|
void get_client_rect(rect_t *rc);
|
|
|
|
|
2012-05-27 12:41:27 +02:00
|
|
|
void flush_video()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0; i < 4; i++)
|
2013-02-17 16:27:33 +01:00
|
|
|
{
|
2012-05-27 12:41:27 +02:00
|
|
|
frames[i].pts = 0;
|
|
|
|
frames[i].ready = 0;
|
|
|
|
};
|
2012-11-28 13:06:34 +01:00
|
|
|
frames_count = 0;
|
2012-05-27 12:41:27 +02:00
|
|
|
vfx = 0;
|
|
|
|
dfx = 0;
|
|
|
|
};
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2010-11-10 06:51:05 +01:00
|
|
|
int init_video(AVCodecContext *ctx)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
width = ctx->width;
|
|
|
|
height = ctx->height;
|
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
printf("w = %d h = %d\n\r", ctx->width, ctx->height);
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
// __asm__ __volatile__("int3");
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
main_render = create_render(ctx->width, ctx->height,
|
2012-02-13 23:34:36 +01:00
|
|
|
ctx->pix_fmt, HW_BIT_BLIT|HW_TEX_BLIT);
|
2012-02-28 09:45:00 +01:00
|
|
|
if( main_render == NULL)
|
2010-11-10 06:51:05 +01:00
|
|
|
{
|
2012-02-13 23:34:36 +01:00
|
|
|
printf("Cannot create render\n\r");
|
2010-11-10 06:51:05 +01:00
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
Frame = avcodec_alloc_frame();
|
|
|
|
if ( Frame == NULL )
|
2010-11-10 06:51:05 +01:00
|
|
|
{
|
2012-02-13 23:34:36 +01:00
|
|
|
printf("Cannot alloc video frame\n\r");
|
|
|
|
return 0;
|
|
|
|
};
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
for( i=0; i < 4; i++)
|
2010-11-10 06:51:05 +01:00
|
|
|
{
|
2012-02-13 23:34:36 +01:00
|
|
|
int ret;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
// printf("alloc picture %d %d %x\n",
|
|
|
|
// ctx->width, ctx->height, ctx->pix_fmt );
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
ret = avpicture_alloc(&frames[i].picture, ctx->pix_fmt,
|
2010-11-10 06:51:05 +01:00
|
|
|
ctx->width, ctx->height);
|
2012-02-13 23:34:36 +01:00
|
|
|
if ( ret != 0 )
|
|
|
|
{
|
|
|
|
printf("Cannot alloc video buffer\n\r");
|
|
|
|
return 0;
|
2010-11-10 06:51:05 +01:00
|
|
|
};
|
2012-02-13 23:34:36 +01:00
|
|
|
|
|
|
|
frames[i].pts = 0;
|
|
|
|
frames[i].ready = 0;
|
2010-11-10 06:51:05 +01:00
|
|
|
};
|
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
create_thread(video_thread, ctx, 1024*1024);
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
delay(50);
|
2010-11-10 06:51:05 +01:00
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
int decode_video(AVCodecContext *ctx, queue_t *qv)
|
2010-11-10 06:51:05 +01:00
|
|
|
{
|
2012-02-13 23:34:36 +01:00
|
|
|
AVPacket pkt;
|
2010-11-10 06:51:05 +01:00
|
|
|
double pts;
|
2012-02-28 09:45:00 +01:00
|
|
|
int frameFinished;
|
2012-03-02 11:31:15 +01:00
|
|
|
double current_clock;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
if(frames[dfx].ready != 0 )
|
2012-11-28 13:06:34 +01:00
|
|
|
return -1;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
if( get_packet(qv, &pkt) == 0 )
|
|
|
|
return 0;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
/*
|
2012-05-27 12:41:27 +02:00
|
|
|
current_clock = -90.0 + get_master_clock();
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
if( pkt.dts == AV_NOPTS_VALUE &&
|
|
|
|
Frame->reordered_opaque != AV_NOPTS_VALUE)
|
2012-05-27 12:41:27 +02:00
|
|
|
pts = Frame->reordered_opaque;
|
|
|
|
else if(pkt.dts != AV_NOPTS_VALUE)
|
2012-03-02 11:31:15 +01:00
|
|
|
pts= pkt.dts;
|
|
|
|
else
|
|
|
|
pts= 0;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
pts *= av_q2d(video_time_base)*1000.0;
|
|
|
|
*/
|
2012-05-27 12:41:27 +02:00
|
|
|
if( 1 /*pts > current_clock*/)
|
2010-11-10 06:51:05 +01:00
|
|
|
{
|
2012-03-02 11:31:15 +01:00
|
|
|
frameFinished = 0;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
ctx->reordered_opaque = pkt.pts;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
if(avcodec_decode_video2(ctx, Frame, &frameFinished, &pkt) <= 0)
|
|
|
|
printf("video decoder error\n");
|
|
|
|
|
|
|
|
if(frameFinished)
|
|
|
|
{
|
|
|
|
AVPicture *dst_pic;
|
|
|
|
|
|
|
|
if( pkt.dts == AV_NOPTS_VALUE &&
|
|
|
|
Frame->reordered_opaque != AV_NOPTS_VALUE)
|
2012-05-27 12:41:27 +02:00
|
|
|
pts = Frame->reordered_opaque;
|
2012-03-02 11:31:15 +01:00
|
|
|
else if(pkt.dts != AV_NOPTS_VALUE)
|
|
|
|
pts= pkt.dts;
|
|
|
|
else
|
|
|
|
pts= 0;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
|
|
|
// pts = *(int64_t*)av_opt_ptr(avcodec_get_frame_class(),
|
|
|
|
// Frame, "best_effort_timestamp");
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
// if (pts == AV_NOPTS_VALUE)
|
|
|
|
// pts = 0;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
pts *= av_q2d(video_time_base);
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
dst_pic = &frames[dfx].picture;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
av_image_copy(dst_pic->data, dst_pic->linesize,
|
2012-02-28 09:45:00 +01:00
|
|
|
(const uint8_t**)Frame->data,
|
2012-02-13 23:34:36 +01:00
|
|
|
Frame->linesize, ctx->pix_fmt, ctx->width, ctx->height);
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
frames[dfx].pts = pts*1000.0;
|
2012-05-27 12:41:27 +02:00
|
|
|
// printf("pts %f\n", frames[dfx].pts);
|
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
frames[dfx].ready = 1;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
dfx++;
|
|
|
|
dfx&= 3;
|
2012-11-28 13:06:34 +01:00
|
|
|
frames_count++;
|
2012-03-02 11:31:15 +01:00
|
|
|
};
|
2010-11-10 06:51:05 +01:00
|
|
|
};
|
2012-02-13 23:34:36 +01:00
|
|
|
av_free_packet(&pkt);
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
return 1;
|
2010-11-10 06:51:05 +01:00
|
|
|
}
|
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
extern volatile enum player_state player_state;
|
2012-11-28 13:06:34 +01:00
|
|
|
extern volatile enum player_state decoder_state;
|
|
|
|
extern volatile enum player_state sound_state;
|
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
//rect_t win_rect;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-05-27 12:41:27 +02:00
|
|
|
extern int64_t rewind_pos;
|
2012-02-28 09:45:00 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
static void player_stop()
|
|
|
|
{
|
2013-02-17 16:27:33 +01:00
|
|
|
window_t *win;
|
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
win = main_render->win;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
rewind_pos = 0;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
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;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
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);
|
|
|
|
// printf("stop player\n");
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
};
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
int MainWindowProc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
|
2010-11-10 06:51:05 +01:00
|
|
|
{
|
2012-02-28 09:45:00 +01:00
|
|
|
window_t *win;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
win = (window_t*)ctrl;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
switch(msg)
|
2010-11-10 06:51:05 +01:00
|
|
|
{
|
2012-02-28 09:45:00 +01:00
|
|
|
case MSG_SIZE:
|
|
|
|
//printf("MSG_SIZE\n");
|
|
|
|
render_adjust_size(main_render, win);
|
2010-11-10 06:51:05 +01:00
|
|
|
break;
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
case MSG_DRAW_CLIENT:
|
|
|
|
render_draw_client(main_render);
|
2010-11-10 06:51:05 +01:00
|
|
|
break;
|
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
case MSG_LBTNDOWN:
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
if(player_state == PAUSE)
|
|
|
|
{
|
2012-05-27 12:41:27 +02:00
|
|
|
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;
|
2012-11-28 13:06:34 +01:00
|
|
|
send_message(&win->panel.play_btn->ctrl, MSG_PAINT, 0, 0);
|
|
|
|
player_state = PLAY;
|
|
|
|
sound_state = PAUSE_2_PLAY;
|
2012-03-02 11:31:15 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
else if(player_state == PLAY)
|
|
|
|
{
|
2012-05-27 12:41:27 +02:00
|
|
|
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;
|
2012-11-28 13:06:34 +01:00
|
|
|
send_message(&win->panel.play_btn->ctrl, MSG_PAINT, 0, 0);
|
2012-03-02 11:31:15 +01:00
|
|
|
player_state = PAUSE;
|
2012-11-28 13:06:34 +01:00
|
|
|
sound_state = PLAY_2_PAUSE;
|
2012-03-02 11:31:15 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
case MSG_COMMAND:
|
|
|
|
switch((short)arg1)
|
|
|
|
{
|
2012-03-02 11:31:15 +01:00
|
|
|
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;
|
2012-11-28 13:06:34 +01:00
|
|
|
player_state = PLAY;
|
|
|
|
sound_state = PAUSE_2_PLAY;
|
2012-05-27 12:41:27 +02:00
|
|
|
}
|
|
|
|
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;
|
2012-03-02 11:31:15 +01:00
|
|
|
player_state = PAUSE;
|
2012-11-28 13:06:34 +01:00
|
|
|
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;
|
2013-02-17 16:27:33 +01:00
|
|
|
rewind_pos = 0;
|
2012-11-28 13:06:34 +01:00
|
|
|
send_message(&win->panel.ctrl, MSG_PAINT, 0, 0);
|
|
|
|
player_state = PLAY;
|
|
|
|
decoder_state = PREPARE;
|
2012-03-02 11:31:15 +01:00
|
|
|
}
|
|
|
|
break;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
case ID_STOP:
|
|
|
|
player_stop();
|
|
|
|
break;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
case ID_PROGRESS:
|
2012-05-27 12:41:27 +02:00
|
|
|
if(player_state != REWIND)
|
|
|
|
{
|
|
|
|
progress_t *prg = (progress_t*)arg2;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
rewind_pos = (prg->max - prg->min)*prg->pos/prg->ctrl.w;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
// printf("progress action pos: %d time: %f\n", prg->pos, (double)rewind_pos);
|
|
|
|
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;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
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);
|
2012-05-27 12:41:27 +02:00
|
|
|
};
|
|
|
|
break;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
|
|
|
case ID_VOL_CTRL:
|
2012-11-28 13:06:34 +01:00
|
|
|
{
|
|
|
|
slider_t *sld = (slider_t*)arg2;
|
|
|
|
int peak;
|
|
|
|
int level;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
peak = sld->min + sld->pos * (sld->max - sld->min)/(96);
|
|
|
|
// level = (log2(peak+16384)*10000.0)/15 - 10000;
|
|
|
|
level = peak;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
// printf("level %d\n", level);
|
|
|
|
set_audio_volume(level, level);
|
|
|
|
send_message(&sld->ctrl, MSG_PAINT, 0, 0);
|
|
|
|
win->panel.lvl->vol = level;
|
|
|
|
}
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2012-02-28 09:45:00 +01:00
|
|
|
break;
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
default:
|
|
|
|
def_window_proc(ctrl,msg,arg1,arg2);
|
|
|
|
};
|
|
|
|
return 0;
|
|
|
|
};
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-05-27 12:41:27 +02:00
|
|
|
#define VERSION_A 1
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
void render_time(render_t *render)
|
2010-11-10 06:51:05 +01:00
|
|
|
{
|
2013-02-17 16:27:33 +01:00
|
|
|
progress_t *prg = main_render->win->panel.prg;
|
|
|
|
level_t *lvl = main_render->win->panel.lvl;
|
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
double ctime; /* milliseconds */
|
|
|
|
double fdelay; /* milliseconds */
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
//again:
|
|
|
|
|
|
|
|
if(player_state == CLOSED)
|
2010-11-10 06:51:05 +01:00
|
|
|
{
|
2012-02-28 09:45:00 +01:00
|
|
|
render->win->win_command = WIN_CLOSED;
|
|
|
|
return;
|
2012-03-02 11:31:15 +01:00
|
|
|
}
|
2012-11-28 13:06:34 +01:00
|
|
|
else if(player_state == REWIND)
|
|
|
|
{
|
|
|
|
yield();
|
2013-02-17 16:27:33 +01:00
|
|
|
return;
|
2012-11-28 13:06:34 +01:00
|
|
|
}
|
|
|
|
else if (decoder_state == STOP && frames_count == 0 &&
|
|
|
|
player_state != STOP)
|
2013-02-17 16:27:33 +01:00
|
|
|
{
|
2012-11-28 13:06:34 +01:00
|
|
|
player_stop();
|
|
|
|
}
|
2012-03-02 11:31:15 +01:00
|
|
|
else if(player_state != PLAY)
|
|
|
|
{
|
|
|
|
yield();
|
|
|
|
return;
|
2012-02-28 09:45:00 +01:00
|
|
|
};
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
|
2012-05-27 12:41:27 +02:00
|
|
|
#ifdef VERSION_A
|
2012-02-28 09:45:00 +01:00
|
|
|
if(frames[vfx].ready == 1 )
|
|
|
|
{
|
2012-05-27 12:41:27 +02:00
|
|
|
int sys_time;
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
ctime = get_master_clock();
|
|
|
|
fdelay = (frames[vfx].pts - ctime);
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
// printf("pts %f time %f delay %f\n",
|
2012-05-27 12:41:27 +02:00
|
|
|
// frames[vfx].pts, ctime, fdelay);
|
2010-11-10 06:51:05 +01:00
|
|
|
|
2012-05-27 12:41:27 +02:00
|
|
|
if(fdelay > 15.0)
|
2012-02-28 09:45:00 +01:00
|
|
|
{
|
2012-05-27 12:41:27 +02:00
|
|
|
delay(1);
|
2012-03-02 11:31:15 +01:00
|
|
|
// yield();
|
2012-02-29 14:48:42 +01:00
|
|
|
return;
|
2010-11-10 06:51:05 +01:00
|
|
|
};
|
2012-02-28 09:45:00 +01:00
|
|
|
|
2012-05-27 12:41:27 +02:00
|
|
|
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);
|
|
|
|
|
|
|
|
main_render->draw(main_render, &frames[vfx].picture);
|
2012-11-28 13:06:34 +01:00
|
|
|
prg->current = frames[vfx].pts*1000;
|
|
|
|
// printf("current %f\n", prg->current);
|
|
|
|
lvl->current = vfx & 1 ? sound_level_1 : sound_level_0;
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
send_message(&prg->ctrl, PRG_PROGRESS, 0, 0);
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
if(main_render->win->panel.layout)
|
|
|
|
send_message(&lvl->ctrl, MSG_PAINT, 0, 0);
|
2013-02-17 16:27:33 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
frames_count--;
|
2012-05-27 12:41:27 +02:00
|
|
|
frames[vfx].ready = 0;
|
|
|
|
vfx++;
|
|
|
|
vfx&= 3;
|
|
|
|
}
|
|
|
|
else yield();
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
if(frames[vfx].ready == 1 )
|
|
|
|
{
|
|
|
|
ctime = get_master_clock();
|
|
|
|
fdelay = (frames[vfx].pts - ctime);
|
|
|
|
|
|
|
|
// printf("pts %f time %f delay %f\n",
|
|
|
|
// frames[vfx].pts, ctime, fdelay);
|
|
|
|
|
|
|
|
if(fdelay < 0.0 )
|
|
|
|
{
|
|
|
|
int next_vfx;
|
|
|
|
fdelay = 0;
|
|
|
|
next_vfx = (vfx+1) & 3;
|
|
|
|
if( frames[next_vfx].ready == 1 )
|
|
|
|
{
|
|
|
|
if(frames[next_vfx].pts <= ctime)
|
|
|
|
{
|
|
|
|
frames[vfx].ready = 0; // skip this frame
|
|
|
|
vfx++;
|
|
|
|
vfx&= 3;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( (frames[next_vfx].pts - ctime) <
|
|
|
|
( ctime - frames[vfx].pts) )
|
|
|
|
{
|
|
|
|
frames[vfx].ready = 0; // skip this frame
|
|
|
|
vfx++;
|
|
|
|
vfx&= 3;
|
|
|
|
fdelay = (frames[next_vfx].pts - ctime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
if(fdelay > 10.0)
|
|
|
|
{
|
|
|
|
int val = fdelay;
|
|
|
|
printf("pts %f time %f delay %d\n",
|
|
|
|
frames[vfx].pts, ctime, val);
|
|
|
|
delay(val/10);
|
|
|
|
};
|
|
|
|
|
|
|
|
ctime = get_master_clock();
|
|
|
|
fdelay = (frames[vfx].pts - ctime);
|
|
|
|
|
|
|
|
printf("pts %f time %f delay %f\n",
|
|
|
|
frames[vfx].pts, ctime, fdelay);
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
main_render->draw(main_render, &frames[vfx].picture);
|
2012-05-27 12:41:27 +02:00
|
|
|
main_render->win->panel.prg->current = frames[vfx].pts;
|
|
|
|
// send_message(&render->win->panel.prg->ctrl, MSG_PAINT, 0, 0);
|
2012-02-28 09:45:00 +01:00
|
|
|
frames[vfx].ready = 0;
|
|
|
|
vfx++;
|
|
|
|
vfx&= 3;
|
2012-03-02 11:31:15 +01:00
|
|
|
}
|
|
|
|
else yield();
|
2012-05-27 12:41:27 +02:00
|
|
|
#endif
|
2012-03-02 11:31:15 +01:00
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
}
|
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
extern char *movie_file;
|
|
|
|
|
|
|
|
int video_thread(void *param)
|
|
|
|
{
|
|
|
|
window_t *MainWindow;
|
|
|
|
|
|
|
|
init_winlib();
|
|
|
|
|
|
|
|
MainWindow = create_window(movie_file,0,
|
2012-11-28 13:06:34 +01:00
|
|
|
10,10,width,height+CAPTION_HEIGHT+PANEL_HEIGHT,MainWindowProc);
|
2012-02-28 09:45:00 +01:00
|
|
|
|
2012-05-27 12:41:27 +02:00
|
|
|
MainWindow->panel.prg->max = stream_duration;
|
2012-02-28 09:45:00 +01:00
|
|
|
// printf("MainWindow %x\n", MainWindow);
|
|
|
|
|
|
|
|
main_render->win = MainWindow;
|
|
|
|
|
|
|
|
show_window(MainWindow, NORMAL);
|
2012-05-27 12:41:27 +02:00
|
|
|
|
|
|
|
render_draw_client(main_render);
|
2012-11-28 13:06:34 +01:00
|
|
|
player_state = PLAY;
|
2012-05-27 12:41:27 +02:00
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
run_render(MainWindow, main_render);
|
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
fini_winlib();
|
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
player_state = CLOSED;
|
2012-02-13 23:34:36 +01:00
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void draw_hw_picture(render_t *render, AVPicture *picture);
|
|
|
|
void draw_sw_picture(render_t *render, AVPicture *picture);
|
|
|
|
|
|
|
|
render_t *create_render(uint32_t width, uint32_t height,
|
|
|
|
uint32_t ctx_format, uint32_t flags)
|
|
|
|
{
|
2012-02-28 09:45:00 +01:00
|
|
|
render_t *render;
|
|
|
|
|
|
|
|
// __asm__ __volatile__("int3");
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
render = (render_t*)malloc(sizeof(render_t));
|
|
|
|
memset(render, 0, sizeof(render_t));
|
2012-02-13 23:34:36 +01:00
|
|
|
|
|
|
|
render->ctx_width = width;
|
|
|
|
render->ctx_height = height;
|
|
|
|
render->ctx_format = ctx_format;
|
|
|
|
|
|
|
|
mutex_lock(&driver_lock);
|
2013-02-17 16:27:33 +01:00
|
|
|
render->caps = init_pixlib(flags);
|
2012-02-13 23:34:36 +01:00
|
|
|
mutex_unlock(&driver_lock);
|
|
|
|
|
|
|
|
if(render->caps==0)
|
|
|
|
{
|
|
|
|
printf("FPlay render engine: Hardware acceleration disabled\n");
|
|
|
|
render->draw = draw_sw_picture;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
render->target = 0;
|
|
|
|
render->draw = draw_hw_picture;
|
|
|
|
};
|
|
|
|
|
|
|
|
render->state = EMPTY;
|
|
|
|
return render;
|
|
|
|
};
|
|
|
|
|
|
|
|
int render_set_size(render_t *render, int width, int height)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
render->layout = 0;
|
|
|
|
render->rcvideo.l = 0;
|
|
|
|
render->rcvideo.t = 0;
|
|
|
|
render->rcvideo.r = width;
|
|
|
|
render->rcvideo.b = height;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
// printf("render width %d height %d\n",width, height);
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
};
|
2012-02-13 23:34:36 +01:00
|
|
|
|
|
|
|
if(render->state == EMPTY)
|
|
|
|
{
|
|
|
|
if(render->caps & HW_TEX_BLIT)
|
|
|
|
{
|
|
|
|
for( i=0; i < 4; i++)
|
|
|
|
{
|
|
|
|
render->bitmap[i].width = render->ctx_width;
|
|
|
|
render->bitmap[i].height = render->ctx_height;
|
2013-02-17 16:27:33 +01:00
|
|
|
render->bitmap[i].flags = HW_TEX_BLIT;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
|
|
|
if( create_bitmap(&render->bitmap[i]) != 0 )
|
|
|
|
{
|
2012-03-02 11:31:15 +01:00
|
|
|
player_state = CLOSED;
|
2012-02-13 23:34:36 +01:00
|
|
|
/*
|
|
|
|
* Epic fail. Need exit_thread() here
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
render->bitmap[0].width = width;
|
|
|
|
render->bitmap[0].height = height;
|
2013-02-17 16:27:33 +01:00
|
|
|
render->bitmap[0].flags = HW_BIT_BLIT;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
|
|
|
if( create_bitmap(&render->bitmap[0]) != 0 )
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
render->state = INIT;
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
if(render->caps & HW_TEX_BLIT) /* hw scaler */
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
render->bitmap[0].width = width;
|
|
|
|
render->bitmap[0].height = height;
|
|
|
|
resize_bitmap(&render->bitmap[0]);
|
|
|
|
|
|
|
|
return 0;
|
2010-11-10 06:51:05 +01:00
|
|
|
};
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
void render_adjust_size(render_t *render, window_t *win)
|
2012-02-13 23:34:36 +01:00
|
|
|
{
|
|
|
|
uint32_t right, bottom, new_w, new_h;
|
|
|
|
uint32_t s, sw, sh;
|
|
|
|
uint8_t state;
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
right = win->w;
|
2012-11-28 13:06:34 +01:00
|
|
|
bottom = win->h-CAPTION_HEIGHT-PANEL_HEIGHT;
|
|
|
|
|
|
|
|
// printf("window width %d height %d\n",
|
|
|
|
// right, bottom);
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
render->win_state = win->win_state;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
if(render->win_state == MINIMIZED)
|
2012-02-13 23:34:36 +01:00
|
|
|
return;
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
if(render->win_state == ROLLED)
|
|
|
|
return;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
|
|
|
if( right == render->win_width &&
|
|
|
|
bottom == render->win_height)
|
|
|
|
return;
|
|
|
|
|
|
|
|
new_w = bottom*render->ctx_width/render->ctx_height;
|
|
|
|
new_h = right*render->ctx_height/render->ctx_width;
|
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
if(new_w > right)
|
|
|
|
{
|
2012-02-13 23:34:36 +01:00
|
|
|
new_w = right;
|
2012-11-28 13:06:34 +01:00
|
|
|
new_h = right*render->ctx_height/render->ctx_width;
|
|
|
|
};
|
|
|
|
if(new_h > bottom)
|
2012-02-13 23:34:36 +01:00
|
|
|
{
|
2012-11-28 13:06:34 +01:00
|
|
|
new_h = bottom;
|
|
|
|
new_w = bottom*render->ctx_width/render->ctx_height;
|
2012-02-13 23:34:36 +01:00
|
|
|
};
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
render->win_width = win->w;
|
2012-11-28 13:06:34 +01:00
|
|
|
render->win_height = win->h-CAPTION_HEIGHT-PANEL_HEIGHT;
|
2012-02-28 09:45:00 +01:00
|
|
|
render_set_size(render, new_w, new_h);
|
2012-02-13 23:34:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
void draw_hw_picture(render_t *render, AVPicture *picture)
|
|
|
|
{
|
|
|
|
int dst_width, dst_height;
|
2012-02-28 09:45:00 +01:00
|
|
|
bitmap_t *bitmap;
|
|
|
|
uint8_t *data[4];
|
2012-02-13 23:34:36 +01:00
|
|
|
int linesize[4];
|
2012-02-28 09:45:00 +01:00
|
|
|
int ret;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
if(render->win_state == MINIMIZED ||
|
|
|
|
render->win_state == ROLLED)
|
2012-02-13 23:34:36 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
if(render->caps & HW_TEX_BLIT)
|
|
|
|
{
|
|
|
|
dst_width = render->ctx_width;
|
|
|
|
dst_height = render->ctx_height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-28 13:06:34 +01:00
|
|
|
dst_width = render->rcvideo.r;
|
|
|
|
dst_height = render->rcvideo.b;
|
2012-02-13 23:34:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
cvt_ctx = sws_getCachedContext(cvt_ctx,
|
|
|
|
render->ctx_width, render->ctx_height, render->ctx_format,
|
|
|
|
dst_width, dst_height, PIX_FMT_BGRA,
|
|
|
|
SWS_FAST_BILINEAR, NULL, NULL, NULL);
|
|
|
|
if(cvt_ctx == NULL)
|
|
|
|
{
|
|
|
|
printf("Cannot initialize the conversion context!\n");
|
|
|
|
return ;
|
|
|
|
};
|
2012-02-28 09:45:00 +01:00
|
|
|
|
|
|
|
bitmap = &render->bitmap[render->target];
|
|
|
|
|
|
|
|
ret = lock_bitmap(bitmap);
|
|
|
|
if( ret != 0)
|
|
|
|
{
|
2012-11-28 13:06:34 +01:00
|
|
|
printf("Cannot lock bitmap!\n");
|
2012-02-28 09:45:00 +01:00
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2012-02-13 23:34:36 +01:00
|
|
|
// printf("sws_getCachedContext\n");
|
2012-02-28 09:45:00 +01:00
|
|
|
data[0] = bitmap->data;
|
|
|
|
data[1] = bitmap->data+1;
|
|
|
|
data[2] = bitmap->data+2;
|
|
|
|
data[3] = bitmap->data+3;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
linesize[0] = bitmap->pitch;
|
|
|
|
linesize[1] = bitmap->pitch;
|
|
|
|
linesize[2] = bitmap->pitch;
|
|
|
|
linesize[3] = bitmap->pitch;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
|
|
|
sws_scale(cvt_ctx, (const uint8_t* const *)picture->data,
|
|
|
|
picture->linesize, 0, render->ctx_height, data, linesize);
|
|
|
|
// printf("sws_scale\n");
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
blit_bitmap(bitmap, render->rcvideo.l,
|
2012-02-29 14:48:42 +01:00
|
|
|
CAPTION_HEIGHT+render->rcvideo.t,
|
2012-02-28 09:45:00 +01:00
|
|
|
render->rcvideo.r, render->rcvideo.b);
|
2012-11-28 13:06:34 +01:00
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
render->last_bitmap = bitmap;
|
2012-02-13 23:34:36 +01:00
|
|
|
// printf("blit_bitmap\n");
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
|
2012-11-28 13:06:34 +01:00
|
|
|
// render->target++;
|
|
|
|
// render->target&= 3;
|
2012-02-13 23:34:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void draw_sw_picture(render_t *render, AVPicture *picture)
|
|
|
|
{
|
|
|
|
uint8_t *data[4];
|
|
|
|
int linesize[4];
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
if(render->win_state == MINIMIZED ||
|
|
|
|
render->win_state == ROLLED)
|
2012-02-13 23:34:36 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
cvt_ctx = sws_getCachedContext(cvt_ctx,
|
|
|
|
render->ctx_width, render->ctx_height,
|
|
|
|
render->ctx_format,
|
2012-02-28 09:45:00 +01:00
|
|
|
render->rcvideo.r, render->rcvideo.b,
|
2012-02-13 23:34:36 +01:00
|
|
|
PIX_FMT_BGRA, SWS_FAST_BILINEAR, NULL, NULL, NULL);
|
|
|
|
if(cvt_ctx == NULL)
|
|
|
|
{
|
|
|
|
printf("Cannot initialize the conversion context!\n");
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
data[0] = render->bitmap[0].data;
|
|
|
|
data[1] = render->bitmap[0].data+1;
|
|
|
|
data[2] = render->bitmap[0].data+2;
|
|
|
|
data[3] = render->bitmap[0].data+3;
|
|
|
|
|
|
|
|
|
|
|
|
linesize[0] = render->bitmap[0].pitch;
|
|
|
|
linesize[1] = render->bitmap[0].pitch;
|
|
|
|
linesize[2] = render->bitmap[0].pitch;
|
|
|
|
linesize[3] = render->bitmap[0].pitch;
|
|
|
|
|
|
|
|
sws_scale(cvt_ctx, (const uint8_t* const *)picture->data,
|
|
|
|
picture->linesize, 0, render->ctx_height, data, linesize);
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
blit_bitmap(&render->bitmap[0], render->rcvideo.l,
|
2012-02-29 14:48:42 +01:00
|
|
|
render->rcvideo.t+CAPTION_HEIGHT,
|
2012-02-28 09:45:00 +01:00
|
|
|
render->rcvideo.r, render->rcvideo.b);
|
2012-03-02 11:31:15 +01:00
|
|
|
render->last_bitmap = &render->bitmap[0];
|
2012-02-13 23:34:36 +01:00
|
|
|
}
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
void render_draw_client(render_t *render)
|
|
|
|
{
|
|
|
|
if(render->win_state == MINIMIZED ||
|
|
|
|
render->win_state == ROLLED)
|
|
|
|
return;
|
2012-02-13 23:34:36 +01:00
|
|
|
|
2013-02-17 16:27:33 +01:00
|
|
|
if(player_state == PAUSE)
|
2012-03-02 11:31:15 +01:00
|
|
|
{
|
2012-05-27 12:41:27 +02:00
|
|
|
if(frames[vfx].ready == 1 )
|
|
|
|
main_render->draw(main_render, &frames[vfx].picture);
|
|
|
|
else
|
|
|
|
draw_bar(0, CAPTION_HEIGHT, render->win_width,
|
|
|
|
render->rcvideo.b, 0);
|
2012-11-28 13:06:34 +01:00
|
|
|
}
|
|
|
|
else if( player_state == STOP )
|
|
|
|
{
|
|
|
|
draw_bar(0, CAPTION_HEIGHT, render->win_width,
|
|
|
|
render->rcvideo.b, 0);
|
2012-03-02 11:31:15 +01:00
|
|
|
};
|
|
|
|
|
2012-02-28 09:45:00 +01:00
|
|
|
if(render->layout & HAS_TOP)
|
2012-02-29 14:48:42 +01:00
|
|
|
draw_bar(0, CAPTION_HEIGHT, render->win_width,
|
2012-02-28 09:45:00 +01:00
|
|
|
render->rctop.b, 0);
|
|
|
|
if(render->layout & HAS_LEFT)
|
2012-02-29 14:48:42 +01:00
|
|
|
draw_bar(0, render->rcvideo.t+CAPTION_HEIGHT, render->rcleft.r,
|
2012-02-28 09:45:00 +01:00
|
|
|
render->rcvideo.b, 0);
|
|
|
|
if(render->layout & HAS_RIGHT)
|
2012-02-29 14:48:42 +01:00
|
|
|
draw_bar(render->rcright.l, render->rcvideo.t+CAPTION_HEIGHT,
|
2012-02-28 09:45:00 +01:00
|
|
|
render->rcright.r, render->rcvideo.b, 0);
|
|
|
|
if(render->layout & HAS_BOTTOM)
|
2012-02-29 14:48:42 +01:00
|
|
|
draw_bar(0, render->rcbottom.t+CAPTION_HEIGHT,
|
2012-02-28 09:45:00 +01:00
|
|
|
render->win_width, render->rcbottom.b, 0);
|
|
|
|
}
|
2012-02-13 23:34:36 +01:00
|
|
|
|
|
|
|
|
2012-03-02 11:31:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
|