/programs/media/Fplay/winlib/size_ns.cur |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/panelleft.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/clbn.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/control.h |
---|
File deleted |
/programs/media/Fplay/winlib/clbp.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/winlib.h |
---|
File deleted |
/programs/media/Fplay/winlib/clbhl.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/panel.c |
---|
File deleted |
/programs/media/Fplay/winlib/lborder.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/panelright.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/rborder.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/panel.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/window.c |
---|
File deleted |
/programs/media/Fplay/winlib/res2.asm |
---|
File deleted |
/programs/media/Fplay/winlib/size_we.cur |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/playbtn.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/minbhl.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/pausebtn.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/frame.c |
---|
File deleted |
/programs/media/Fplay/winlib/cptright.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/caption.c |
---|
File deleted |
/programs/media/Fplay/winlib/playbp.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/link.h |
---|
File deleted |
/programs/media/Fplay/winlib/pausebp.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/cptleft.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/types.h |
---|
File deleted |
/programs/media/Fplay/winlib/minbn.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/cptbody.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/button.c |
---|
File deleted |
/programs/media/Fplay/winlib/minbp.raw |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/size_nesw.cur |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib/size_nwse.cur |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/programs/media/Fplay/winlib |
---|
Property changes: |
Deleted: bugtraq:number |
-true |
\ No newline at end of property |
Deleted: tsvn:logminsize |
-5 |
\ No newline at end of property |
/programs/media/Fplay/audio.c |
---|
25,10 → 25,7 |
int sample_rate; |
static uint32_t samples_written = 0; |
double audio_base = -1.0; |
double get_audio_base(); |
int init_audio(int format) |
{ |
int err; |
107,13 → 104,6 |
if(len >= 0) |
{ |
// if(audio_base == -1.0) |
// { |
// if (pkt.pts != AV_NOPTS_VALUE) |
// audio_base = get_audio_base() * pkt.pts; |
// printf("audio base %f\n", audio_base); |
// }; |
pkt_tmp.data += len; |
pkt_tmp.size -= len; |
224,36 → 214,19 |
double event_stamp, wait_stamp; |
int too_late = 0; |
if((player_state == PAUSE) || |
(player_state == PLAY_INIT) ) |
if(player_state == PAUSE) |
{ |
if( active ) |
{ |
StopBuffer(hBuff); |
active = 0; |
}; |
delay(1); |
continue; |
} |
else if(player_state == REWIND) |
{ |
if( active ) |
{ |
StopBuffer(hBuff); |
active = 0; |
}; |
mutex_lock(&astream.lock); |
astream.count = 0; |
mutex_unlock(&astream.lock); |
delay(1); |
continue; |
} |
else if(player_state == PAUSE_2_PLAY) |
else if(player_state == PLAY_RESTART) |
{ |
// SetTimeBase(hBuff, audio_base); |
GetTimeStamp(hBuff, &last_time_stamp); |
// printf("last_time_stamp %f\n", last_time_stamp); |
if((err = PlayBuffer(hBuff, 0)) !=0 ) |
{ |
errstr = "Cannot play buffer\n\r"; |
262,28 → 235,8 |
active = 1; |
sync_audio(hBuff, buffsize); |
player_state = PLAY; |
printf("render: set audio latency to %f\n", audio_delta); |
} |
else if(player_state == REWIND_2_PLAY) |
{ |
while( (astream.count < buffsize*2) && |
(player_state != CLOSED) ) |
yield(); |
SetTimeBase(hBuff, audio_base); |
GetTimeStamp(hBuff, &last_time_stamp); |
printf("last audio time stamp %f\n", last_time_stamp); |
if((err = PlayBuffer(hBuff, 0)) !=0 ) |
{ |
errstr = "Cannot play buffer\n\r"; |
goto exit_whith_error; |
printf("audio delta %f\n", audio_delta); |
}; |
active = 1; |
sync_audio(hBuff, buffsize); |
player_state = PLAY; |
printf("render: set audio latency to %f\n", audio_delta); |
}; |
GetNotify(&evnt); |
/programs/media/Fplay/fplay.c |
---|
36,24 → 36,10 |
extern int sample_rate; |
char *movie_file; |
void flush_video(); |
queue_t q_video; |
queue_t q_audio; |
int64_t rewind_pos; |
int64_t stream_duration; |
extern double audio_base; |
double get_audio_base() |
{ |
return (double)av_q2d(pFormatCtx->streams[audioStream]->time_base)*1000; |
}; |
int main( int argc, char *argv[]) |
{ |
int i; |
78,7 → 64,7 |
return -1; // Couldn't open file |
}; |
pFormatCtx->flags |= AVFMT_FLAG_GENPTS; |
// printf("%s\n\r", __FUNCTION__); |
// Retrieve stream information |
if(avformat_find_stream_info(pFormatCtx, NULL)<0) |
91,27 → 77,16 |
// dump_format(pFormatCtx, 0, argv[1], 0); |
// stream_duration = 1000.0 * pFormatCtx->duration * av_q2d(AV_TIME_BASE_Q); |
stream_duration = pFormatCtx->duration; |
printf("duration %f\n", (double)stream_duration); |
// Find the first video stream |
videoStream=-1; |
audioStream=-1; |
for(i=0; i < pFormatCtx->nb_streams; i++) |
{ |
// pFormatCtx->streams[i]->discard = AVDISCARD_ALL; |
if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO |
&& videoStream < 0) |
{ |
videoStream=i; |
video_time_base = pFormatCtx->streams[i]->time_base; |
if(stream_duration == 0) |
// stream_duration = 1000.0 * |
// pFormatCtx->streams[i]->duration * |
// av_q2d(pFormatCtx->streams[i]->time_base); |
stream_duration = pFormatCtx->streams[i]->duration; |
} |
if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_AUDIO && |
118,12 → 93,6 |
audioStream < 0) |
{ |
audioStream=i; |
if(stream_duration == 0) |
// stream_duration = 1000.0 * |
// pFormatCtx->streams[i]->duration * |
// av_q2d(pFormatCtx->streams[i]->time_base); |
stream_duration = pFormatCtx->streams[i]->duration; |
} |
} |
133,7 → 102,7 |
return -1; // Didn't find a video stream |
} |
player_state = PLAY_INIT; |
player_state = PLAY_RESTART; |
// __asm__ __volatile__("int3"); |
231,64 → 200,12 |
return 0; |
} |
static int fill_queue() |
void decoder() |
{ |
int eof = 0; |
AVPacket packet; |
while( !eof) |
{ |
int err; |
// __asm__ __volatile__("int3"); |
if(q_video.size+q_audio.size < 2*1024*1024) |
{ |
err = av_read_frame(pFormatCtx, &packet); |
if( err < 0) |
{ |
eof = 1; |
if (err != AVERROR_EOF) |
printf("av_read_frame: error %x\n", err); |
break; |
} |
if(packet.stream_index==videoStream) |
{ |
put_packet(&q_video, &packet); |
} |
else if( (packet.stream_index == audioStream) && |
(have_sound != 0) ) |
{ |
put_packet(&q_audio, &packet); |
if(audio_base == -1.0) |
{ |
if (packet.dts != AV_NOPTS_VALUE) |
audio_base = get_audio_base() * packet.dts; |
// printf("audio base %f\n", audio_base); |
}; |
} |
else |
{ |
av_free_packet(&packet); |
}; |
} |
else break; |
}; |
return eof; |
}; |
void decoder() |
{ |
int eof; |
AVPacket packet; |
int ret; |
eof = fill_queue(); |
while( player_state != CLOSED && !eof) |
{ |
int err; |
301,56 → 218,8 |
continue; |
}; |
if( player_state == REWIND ) |
if(q_video.size+q_audio.size < 12*1024*1024) |
{ |
// int64_t timestamp = 0; |
// int stream_index = av_find_default_stream_index(pFormatCtx); |
// __asm__ __volatile__("int3"); |
if (pFormatCtx->start_time != AV_NOPTS_VALUE) |
rewind_pos += pFormatCtx->start_time; |
printf("rewind %8"PRId64"\n", rewind_pos); |
ret = avformat_seek_file(pFormatCtx, -1, INT64_MIN, |
rewind_pos, INT64_MAX, 0); |
// ret = avformat_seek_file(pFormatCtx, -1, 0, |
// 0, INT64_MAX, 0); |
// __asm__ __volatile__("int3"); |
if (ret < 0) |
{ |
printf("could not seek to position %f\n", |
(double)rewind_pos / AV_TIME_BASE); |
} |
else |
{ |
avcodec_flush_buffers(pCodecCtx); |
avcodec_flush_buffers(aCodecCtx); |
while( get_packet(&q_video, &packet) != 0) |
av_free_packet(&packet); |
while( get_packet(&q_audio, &packet)!= 0) |
av_free_packet(&packet); |
audio_base = -1.0; |
// __asm__ __volatile__("int3"); |
eof = fill_queue(); |
}; |
yield(); |
flush_video(); |
player_state = REWIND_2_PLAY; |
printf("restart\n"); |
continue; |
}; |
if(q_video.size+q_audio.size < 4*1024*1024) |
{ |
err = av_read_frame(pFormatCtx, &packet); |
if( err < 0) |
{ |
/programs/media/Fplay/fplay.h |
---|
52,13 → 52,10 |
}; |
enum player_state |
{ CLOSED=0,PLAY_INIT, |
STOP, PAUSE, PLAY, REWIND, |
PAUSE_2_PLAY, REWIND_2_PLAY |
}; |
{ CLOSED=0, STOP, PLAY_RESTART, PLAY, PAUSE, REWIND }; |
#define ID_PLAY 100 |
#define ID_PROGRESS 101 |
typedef struct |
{ |
volatile uint32_t lock; |
159,8 → 156,7 |
{ |
__asm__ __volatile__( |
"int $0x40" |
::"a"(5), "b"(time) |
:"memory"); |
::"a"(5), "b"(time)); |
}; |
/programs/media/Fplay/pixlib2.c |
---|
307,7 → 307,7 |
{ |
//bitmap->data = NULL; Not now, Serge |
// printf("blit done\n"); |
// delay(1); |
delay(1); |
return 0; |
}; |
return err; |
328,8 → 328,7 |
__asm__ __volatile__( |
"int $0x40" |
::"a"(73),"b"(0x00),"c"(&bc) |
:"memory"); |
::"a"(73),"b"(0),"c"(&bc)); |
return 0; |
}; |
341,7 → 340,7 |
__asm__ __volatile__( |
"int $0x40" |
:"=a"(val) |
:"a"(68),"b"(20),"c"(size),"d"(mem) |
:"a"(68),"b"(12),"c"(size),"d"(mem) |
:"memory"); |
return val; |
/programs/media/Fplay/video.c |
---|
17,7 → 17,6 |
extern int res_play_btn[]; |
extern int res_play_btn_pressed[]; |
extern int64_t stream_duration; |
typedef struct |
{ |
45,19 → 44,7 |
void get_client_rect(rect_t *rc); |
void flush_video() |
{ |
int i; |
for(i = 0; i < 4; i++) |
{ |
frames[i].pts = 0; |
frames[i].ready = 0; |
}; |
vfx = 0; |
dfx = 0; |
}; |
int init_video(AVCodecContext *ctx) |
{ |
int i; |
126,7 → 113,7 |
if( get_packet(qv, &pkt) == 0 ) |
return 0; |
current_clock = -90.0 + get_master_clock(); |
current_clock = -80.0 + get_master_clock(); |
if( pkt.dts == AV_NOPTS_VALUE && |
Frame->reordered_opaque != AV_NOPTS_VALUE) |
136,10 → 123,9 |
else |
pts= 0; |
pts *= av_q2d(video_time_base)*1000.0; |
if( 1 /*pts > current_clock*/) |
if( pts > current_clock) |
{ |
frameFinished = 0; |
175,8 → 161,6 |
Frame->linesize, ctx->pix_fmt, ctx->width, ctx->height); |
frames[dfx].pts = pts*1000.0; |
// printf("pts %f\n", frames[dfx].pts); |
frames[dfx].ready = 1; |
dfx++; |
191,7 → 175,6 |
extern volatile enum player_state player_state; |
//rect_t win_rect; |
extern int64_t rewind_pos; |
int MainWindowProc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2) |
{ |
213,18 → 196,18 |
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; |
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, MSG_PAINT, 0, 0); |
player_state = PAUSE_2_PLAY; |
player_state = PLAY_RESTART; |
} |
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; |
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, MSG_PAINT, 0, 0); |
player_state = PAUSE; |
} |
236,35 → 219,19 |
case ID_PLAY: |
if(player_state == PAUSE) |
{ |
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 = PLAY_RESTART; |
} |
else if(player_state == PLAY) |
{ |
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 = 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; |
} |
break; |
case 101: //ID_PROGRESS: |
if(player_state != REWIND) |
{ |
progress_t *prg = (progress_t*)arg2; |
rewind_pos = (int64_t)prg->pos * |
(prg->max - prg->min)/prg->ctrl.w; |
// printf("progress action %f\n", (double)rewind_pos); |
player_state = REWIND; |
main_render->win->panel.prg->current = rewind_pos; |
send_message(&main_render->win->panel.ctrl, MSG_PAINT, 0, 0); |
}; |
break; |
default: |
break; |
} |
276,8 → 243,6 |
return 0; |
}; |
#define VERSION_A 1 |
void render_time(render_t *render) |
{ |
double ctime; /* milliseconds */ |
296,11 → 261,8 |
return; |
}; |
#ifdef VERSION_A |
if(frames[vfx].ready == 1 ) |
{ |
int sys_time; |
ctime = get_master_clock(); |
fdelay = (frames[vfx].pts - ctime); |
307,25 → 269,14 |
// printf("pts %f time %f delay %f\n", |
// frames[vfx].pts, ctime, fdelay); |
if(fdelay > 15.0) |
if(fdelay > 20.0) |
{ |
delay(1); |
delay(2); |
// yield(); |
return; |
}; |
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); |
main_render->win->panel.prg->current = frames[vfx].pts*1000; |
send_message(&render->win->panel.prg->ctrl, MSG_PAINT, 0, 0); |
frames[vfx].ready = 0; |
vfx++; |
vfx&= 3; |
332,72 → 283,11 |
} |
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); |
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); |
frames[vfx].ready = 0; |
vfx++; |
vfx&= 3; |
} |
else yield(); |
#endif |
} |
extern char *movie_file; |
int video_thread(void *param) |
407,18 → 297,13 |
init_winlib(); |
MainWindow = create_window(movie_file,0, |
10,10,width,height+29+55,MainWindowProc); |
10,10,width,height+29+75,MainWindowProc); |
MainWindow->panel.prg->max = stream_duration; |
// printf("MainWindow %x\n", MainWindow); |
main_render->win = MainWindow; |
show_window(MainWindow, NORMAL); |
render_draw_client(main_render); |
player_state = PAUSE_2_PLAY; |
run_render(MainWindow, main_render); |
// printf("exit thread\n"); |
563,7 → 448,7 |
right = win->w; |
bottom = win->h-CAPTION_HEIGHT-55; |
bottom = win->h-CAPTION_HEIGHT-75; |
render->win_state = win->win_state; |
if(render->win_state == MINIMIZED) |
597,7 → 482,7 |
}; |
render->win_width = win->w; |
render->win_height = win->h-CAPTION_HEIGHT-55; |
render->win_height = win->h-CAPTION_HEIGHT-75; |
render_set_size(render, new_w, new_h); |
}; |
715,14 → 600,9 |
render->win_state == ROLLED) |
return; |
if((player_state == PAUSE) || |
(player_state == PLAY_INIT) ) |
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, |
render->rcvideo.b, 0); |
}; |
if(render->layout & HAS_TOP) |