Rev 6121 | Rev 6135 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6121 | Rev 6133 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | 26 | ||
Line 27... | Line 27... | ||
27 | 27 | ||
Line 28... | Line -... | ||
28 | render_t *main_render; |
- | |
29 | - | ||
30 | int width; |
- | |
31 | int height; |
28 | render_t *main_render; |
32 | 29 | ||
Line 33... | Line 30... | ||
33 | AVRational video_time_base; |
30 | AVRational video_time_base; |
- | 31 | AVFrame *Frame; |
|
- | 32 | ||
- | 33 | void get_client_rect(rect_t *rc); |
|
Line 34... | Line 34... | ||
34 | AVFrame *Frame; |
34 | void run_render(window_t *win, void *render); |
35 | 35 | void window_update_layout(window_t *win); |
|
36 | void get_client_rect(rect_t *rc); |
36 | int fini_winlib(); |
- | 37 | ||
- | 38 | void flush_video(vst_t *vst) |
|
- | 39 | { |
|
- | 40 | vframe_t *vframe, *tmp; |
|
- | 41 | ||
- | 42 | mutex_lock(&vst->output_lock); |
|
Line 37... | Line 43... | ||
37 | 43 | mutex_lock(&vst->input_lock); |
|
38 | void flush_video(vst_t *vst) |
44 | |
39 | { |
45 | list_for_each_entry_safe(vframe, tmp, &vst->output_list, list) |
40 | int i; |
46 | list_move_tail(&vframe->list, &vst->input_list); |
41 | 47 | ||
- | 48 | list_for_each_entry(vframe, &vst->output_list, list) |
|
42 | for(i = 0; i < 4; i++) |
49 | { |
43 | { |
50 | vframe->pts = 0; |
- | 51 | vframe->ready = 0; |
|
44 | vst->vframe[i].pts = 0; |
52 | } |
45 | vst->vframe[i].ready = 0; |
53 | |
Line 46... | Line 54... | ||
46 | }; |
54 | mutex_unlock(&vst->input_lock); |
47 | vst->vfx = 0; |
55 | mutex_unlock(&vst->output_lock); |
48 | vst->dfx = 0; |
- | |
49 | frames_count = 0; |
- | |
50 | }; |
- | |
51 | - | ||
52 | int init_video(vst_t *vst) |
- | |
53 | { |
56 | |
54 | int i; |
57 | frames_count = 0; |
55 | 58 | }; |
|
56 | width = vst->vCtx->width; |
59 | |
57 | height = vst->vCtx->height; |
60 | int init_video(vst_t *vst) |
58 | 61 | { |
|
Line -... | Line 62... | ||
- | 62 | Frame = av_frame_alloc(); |
|
- | 63 | if ( Frame == NULL ) |
|
59 | Frame = av_frame_alloc(); |
64 | { |
Line 60... | Line -... | ||
60 | if ( Frame == NULL ) |
- | |
61 | { |
65 | printf("Cannot alloc video frame\n\r"); |
62 | printf("Cannot alloc video frame\n\r"); |
66 | return 0; |
Line -... | Line 67... | ||
- | 67 | }; |
|
- | 68 | ||
63 | return 0; |
69 | mutex_lock(&vst->decoder_lock); |
64 | }; |
70 | |
65 | 71 | create_thread(video_thread, vst, 1024*1024); |
|
66 | create_thread(video_thread, vst, 1024*1024); |
72 | |
67 | 73 | return 1; |
|
68 | delay(50); |
- | |
Line 69... | Line 74... | ||
69 | return 1; |
74 | }; |
- | 75 | ||
- | 76 | static double dts = 0.0; |
|
- | 77 | ||
- | 78 | int decode_video(vst_t* vst) |
|
- | 79 | { |
|
70 | }; |
80 | AVPacket pkt; |
- | 81 | double pts; |
|
- | 82 | int frameFinished; |
|
- | 83 | ||
- | 84 | if(vst->decoder_frame == NULL) |
|
- | 85 | { |
|
- | 86 | mutex_lock(&vst->input_lock); |
|
- | 87 | if(list_empty(&vst->input_list)) |
|
Line 71... | Line 88... | ||
71 | 88 | { |
|
- | 89 | mutex_unlock(&vst->input_lock); |
|
72 | int decode_video(vst_t* vst) |
90 | return -1; |
- | 91 | } |
|
Line 73... | Line -... | ||
73 | { |
- | |
74 | AVPacket pkt; |
- | |
75 | double pts; |
- | |
76 | int frameFinished; |
- | |
77 | double current_clock; |
- | |
78 | - | ||
79 | if(vst->vframe[vst->dfx].ready != 0 ) |
- | |
80 | return -1; |
- | |
81 | - | ||
82 | if( get_packet(&vst->q_video, &pkt) == 0 ) |
- | |
83 | return 0; |
- | |
84 | - | ||
85 | /* |
- | |
86 | current_clock = -90.0 + get_master_clock(); |
- | |
87 | - | ||
88 | if( pkt.dts == AV_NOPTS_VALUE && |
- | |
89 | Frame->reordered_opaque != AV_NOPTS_VALUE) |
92 | vst->decoder_frame = list_first_entry(&vst->input_list, vframe_t, list); |
90 | pts = Frame->reordered_opaque; |
- | |
- | 93 | list_del(&vst->decoder_frame->list); |
|
91 | else if(pkt.dts != AV_NOPTS_VALUE) |
94 | mutex_unlock(&vst->input_lock); |
Line 92... | Line 95... | ||
92 | pts= pkt.dts; |
95 | |
Line 93... | Line 96... | ||
93 | else |
96 | vframe_t *vframe = vst->decoder_frame; |
94 | pts= 0; |
97 | }; |
Line 95... | Line 98... | ||
95 | 98 | ||
96 | 99 | if( get_packet(&vst->q_video, &pkt) == 0 ) |
|
- | 100 | { |
|
97 | pts *= av_q2d(video_time_base)*1000.0; |
101 | return 0; |
Line 98... | Line -... | ||
98 | */ |
- | |
99 | if( 1 /*pts > current_clock*/) |
102 | }; |
100 | { |
- | |
101 | frameFinished = 0; |
- | |
102 | - | ||
103 | vst->vCtx->reordered_opaque = pkt.pts; |
- | |
104 | - | ||
105 | mutex_lock(&vst->gpu_lock); |
- | |
106 | 103 | ||
Line -... | Line 104... | ||
- | 104 | frameFinished = 0; |
|
107 | if(avcodec_decode_video2(vst->vCtx, Frame, &frameFinished, &pkt) <= 0) |
105 | if(dts == 0) |
Line 108... | Line 106... | ||
108 | printf("video decoder error\n"); |
106 | dts = pkt.pts; |
109 | 107 | ||
110 | if(frameFinished) |
108 | mutex_lock(&vst->gpu_lock); |
111 | { |
109 | |
112 | AVPicture *dst_pic; |
110 | if(avcodec_decode_video2(vst->vCtx, Frame, &frameFinished, &pkt) <= 0) |
113 | 111 | printf("video decoder error\n"); |
|
Line 114... | Line 112... | ||
114 | if( pkt.dts == AV_NOPTS_VALUE && |
112 | |
- | 113 | if(frameFinished) |
|
- | 114 | { |
|
115 | Frame->reordered_opaque != AV_NOPTS_VALUE) |
115 | vframe_t *vframe; |
- | 116 | AVPicture *dst_pic; |
|
- | 117 | ||
- | 118 | pts = av_frame_get_best_effort_timestamp(Frame); |
|
- | 119 | pts *= av_q2d(video_time_base); |
|
- | 120 | ||
- | 121 | vframe = vst->decoder_frame; |
|
- | 122 | dst_pic = &vframe->picture; |
|
- | 123 | ||
- | 124 | if(vframe->is_hw_pic == 0) |
|
- | 125 | av_image_copy(dst_pic->data, dst_pic->linesize, |
|
- | 126 | (const uint8_t**)Frame->data, |
|
- | 127 | Frame->linesize, vst->vCtx->pix_fmt, vst->vCtx->width, vst->vCtx->height); |
|
- | 128 | else |
|
- | 129 | va_create_planar(vst, vframe); |
|
- | 130 | ||
- | 131 | vframe->pts = pts*1000.0; |
|
- | 132 | vframe->pkt_pts = pkt.pts*av_q2d(video_time_base)*1000.0; |
|
- | 133 | vframe->pkt_dts = dts*av_q2d(video_time_base)*1000.0; |
|
- | 134 | vframe->ready = 1; |
|
- | 135 | ||
- | 136 | ||
- | 137 | mutex_lock(&vst->output_lock); |
|
- | 138 | ||
- | 139 | if(list_empty(&vst->output_list)) |
|
- | 140 | list_add_tail(&vframe->list, &vst->output_list); |
|
- | 141 | else |
|
- | 142 | { |
|
- | 143 | vframe_t *cur; |
|
- | 144 | ||
- | 145 | cur = list_first_entry(&vst->output_list,vframe_t,list); |
|
- | 146 | if(vframe->pkt_pts < cur->pkt_pts) |
|
116 | pts = Frame->reordered_opaque; |
147 | { |
- | 148 | list_add_tail(&vframe->list, &vst->output_list); |
|
- | 149 | } |
|
- | 150 | else |
|
117 | else if(pkt.dts != AV_NOPTS_VALUE) |
151 | { |
- | 152 | list_for_each_entry_reverse(cur,&vst->output_list,list) |
|
118 | pts = pkt.dts; |
153 | { |
- | 154 | if(vframe->pkt_pts > cur->pkt_pts) |
|
119 | else |
155 | { |
Line 120... | Line -... | ||
120 | pts = 0; |
- | |
121 | 156 | list_add(&vframe->list, &cur->list); |
|
Line 122... | Line 157... | ||
122 | pts *= av_q2d(video_time_base); |
157 | break; |
123 | 158 | }; |
|
Line 355... | Line 390... | ||
355 | }; |
390 | }; |
356 | return 0; |
391 | return 0; |
357 | }; |
392 | }; |
358 | 393 | ||
Line 359... | Line -... | ||
359 | #define VERSION_A 1 |
- | |
360 | - | ||
361 | void render_time(render_t *render) |
394 | void render_time(render_t *render) |
362 | { |
395 | { |
363 | progress_t *prg = main_render->win->panel.prg; |
396 | progress_t *prg = main_render->win->panel.prg; |
364 | level_t *lvl = main_render->win->panel.lvl; |
397 | level_t *lvl = main_render->win->panel.lvl; |
365 | vst_t *vst = main_render->vst; |
398 | vst_t *vst = main_render->vst; |
366 | double ctime; /* milliseconds */ |
399 | double ctime; /* milliseconds */ |
367 | double fdelay; /* milliseconds */ |
400 | double fdelay; /* milliseconds */ |
Line 368... | Line -... | ||
368 | - | ||
369 | //again: |
- | |
370 | 401 | ||
371 | if(player_state == CLOSED) |
402 | if(player_state == CLOSED) |
372 | { |
403 | { |
373 | render->win->win_command = WIN_CLOSED; |
404 | render->win->win_command = WIN_CLOSED; |
374 | return; |
405 | return; |
Line 388... | Line 419... | ||
388 | delay(1); |
419 | delay(1); |
389 | return; |
420 | return; |
390 | }; |
421 | }; |
391 | 422 | ||
Line -... | Line 423... | ||
- | 423 | mutex_lock(&vst->output_lock); |
|
- | 424 | if(list_empty(&vst->output_list)) |
|
392 | 425 | { |
|
- | 426 | mutex_unlock(&vst->output_lock); |
|
393 | #ifdef VERSION_A |
427 | delay(1); |
- | 428 | } |
|
394 | if(vst->vframe[vst->vfx].ready == 1 ) |
429 | else |
395 | { |
430 | { |
- | 431 | vframe_t *vframe; |
|
396 | int sys_time; |
432 | int sys_time; |
Line -... | Line 433... | ||
- | 433 | ||
397 | 434 | vframe = list_first_entry(&vst->output_list, vframe_t, list); |
|
398 | ctime = get_master_clock(); |
435 | list_del(&vframe->list); |
Line 399... | Line 436... | ||
399 | fdelay = (vst->vframe[vst->vfx].pts - ctime); |
436 | mutex_unlock(&vst->output_lock); |
400 | 437 | ||
Line 401... | Line 438... | ||
401 | // printf("pts %f time %f delay %f\n", |
438 | ctime = get_master_clock(); |
402 | // frames[vfx].pts, ctime, fdelay); |
439 | fdelay = (vframe->pkt_pts - ctime); |
403 | 440 | ||
404 | if(fdelay > 15.0) |
- | |
405 | { |
441 | if(fdelay > 15.0) |
406 | delay((int)fdelay/10); |
- | |
407 | // return; |
- | |
408 | }; |
- | |
Line 409... | Line -... | ||
409 | #if 0 |
- | |
410 | ctime = get_master_clock(); |
- | |
411 | fdelay = (vst->vframe[vst->vfx].pts - ctime); |
- | |
412 | 442 | { |
|
413 | // while(fdelay > 0) |
443 | delay((int)fdelay/10); |
414 | // { |
- | |
415 | // yield(); |
- | |
416 | // ctime = get_master_clock(); |
- | |
Line 417... | Line -... | ||
417 | // fdelay = (frames[vfx].pts - ctime); |
- | |
418 | // } |
- | |
419 | - | ||
420 | // sys_time = get_tick_count(); |
- | |
421 | 444 | }; |
|
422 | // if(fdelay < 0) |
- | |
423 | // printf("systime %d pts %f time %f delay %f\n", |
- | |
424 | // sys_time*10, frames[vfx].pts, ctime, fdelay); |
- | |
Line 425... | Line -... | ||
425 | - | ||
426 | printf("pts %f time %f delay %f\n", |
445 | |
427 | vst->vframe[vst->vfx].pts, ctime, fdelay); |
446 | // printf("output index: %d pts: %f pkt_pts %f pkt_dts %f\n", |
428 | printf("video cache %d audio cache %d\n", q_video.size/1024, q_audio.size/1024); |
447 | // vframe->index,vframe->pts,vframe->pkt_pts,vframe->pkt_dts); |
429 | #endif |
- | |
430 | 448 | ||
Line 431... | Line 449... | ||
431 | main_render->draw(main_render, &vst->vframe[vst->vfx].picture); |
449 | main_render->draw(main_render, vframe); |
Line 432... | Line 450... | ||
432 | if(main_render->win->win_state != FULLSCREEN) |
450 | |
433 | { |
451 | if(main_render->win->win_state != FULLSCREEN) |
434 | prg->current = vst->vframe[vst->vfx].pts*1000; |
452 | { |
Line 435... | Line 453... | ||
435 | // printf("current %f\n", prg->current); |
453 | prg->current = vframe->pkt_pts * 1000; |
436 | lvl->current = vst->vfx & 1 ? sound_level_1 : sound_level_0; |
454 | lvl->current = vframe->index & 1 ? sound_level_1 : sound_level_0; |
437 | - | ||
438 | send_message(&prg->ctrl, PRG_PROGRESS, 0, 0); |
- | |
439 | - | ||
Line 440... | Line -... | ||
440 | if(main_render->win->panel.layout) |
- | |
441 | send_message(&lvl->ctrl, MSG_PAINT, 0, 0); |
- | |
442 | } |
- | |
443 | - | ||
444 | frames_count--; |
455 | |
445 | vst->vframe[vst->vfx].ready = 0; |
456 | send_message(&prg->ctrl, PRG_PROGRESS, 0, 0); |
446 | vst->vfx = (vst->vfx + 1) & 3; |
- | |
447 | } |
- | |
448 | else delay(1); |
- | |
449 | - | ||
450 | #else |
- | |
451 | - | ||
452 | if(vst->vframe[vfx].ready == 1 ) |
- | |
453 | { |
- | |
454 | ctime = get_master_clock(); |
457 | |
455 | fdelay = (vst->vrame[vst->vfx].pts - ctime); |
- | |
456 | - | ||
457 | // printf("pts %f time %f delay %f\n", |
- | |
458 | // frames[vfx].pts, ctime, fdelay); |
- | |
459 | - | ||
460 | if(fdelay < 0.0 ) |
- | |
461 | { |
458 | if(main_render->win->panel.layout) |
462 | int next_vfx; |
- | |
463 | fdelay = 0; |
- | |
464 | next_vfx = (vst->vfx+1) & 3; |
- | |
465 | if( vst->vrame[next_vfx].ready == 1 ) |
- | |
466 | { |
- | |
467 | if(vst->vrame[next_vfx].pts <= ctime) |
- | |
468 | { |
- | |
469 | vst->vrame[vst->vfx].ready = 0; // skip this frame |
- | |
470 | vst->vfx = (vst->vfx + 1) & 3; |
- | |
471 | } |
- | |
472 | else |
- | |
473 | { |
- | |
474 | if( (vst->vrame[next_vfx].pts - ctime) < |
- | |
475 | ( ctime - frames[vst->vfx].pts) ) |
- | |
476 | { |
- | |
477 | vst->vrame[vst->vfx].ready = 0; // skip this frame |
- | |
478 | vst->vfx = (vst->vfx + 1) & 3; |
- | |
479 | fdelay = (vst->vrame[next_vfx].pts - ctime); |
- | |
480 | } |
- | |
481 | } |
- | |
482 | }; |
- | |
483 | }; |
- | |
484 | - | ||
485 | if(fdelay > 10.0) |
- | |
486 | { |
- | |
487 | int val = fdelay; |
- | |
488 | printf("pts %f time %f delay %d\n", |
- | |
489 | vst->vrame[vst->vfx].pts, ctime, val); |
- | |
490 | delay(val/10); |
- | |
491 | }; |
- | |
492 | - | ||
493 | ctime = get_master_clock(); |
- | |
494 | fdelay = (vst->vrame[vst->vfx].pts - ctime); |
- | |
495 | - | ||
496 | printf("pts %f time %f delay %f\n", |
- | |
497 | vst->vrame[vst->vfx].pts, ctime, fdelay); |
- | |
498 | 459 | send_message(&lvl->ctrl, MSG_PAINT, 0, 0); |
|
Line 499... | Line 460... | ||
499 | main_render->draw(main_render, &vst->vrame[vfx].picture); |
460 | } |
Line 517... | Line 478... | ||
517 | 478 | ||
Line 518... | Line 479... | ||
518 | init_winlib(); |
479 | init_winlib(); |
Line 519... | Line 480... | ||
519 | 480 | ||
520 | MainWindow = create_window(movie_file,0, |
481 | MainWindow = create_window(movie_file,0, |
Line 521... | Line 482... | ||
521 | 10,10,width,height+CAPTION_HEIGHT+PANEL_HEIGHT,MainWindowProc); |
482 | 10,10,vst->vCtx->width,vst->vCtx->height+CAPTION_HEIGHT+PANEL_HEIGHT,MainWindowProc); |
Line 522... | Line 483... | ||
522 | 483 | ||
Line 523... | Line 484... | ||
523 | MainWindow->panel.prg->max = stream_duration; |
484 | MainWindow->panel.prg->max = stream_duration; |
524 | 485 | ||
525 | show_window(MainWindow, NORMAL); |
486 | show_window(MainWindow, NORMAL); |
- | 487 | ||
526 | 488 | main_render = create_render(vst, MainWindow, HW_TEX_BLIT|HW_BIT_BLIT); |
|
527 | main_render = create_render(vst, MainWindow, HW_TEX_BLIT|HW_BIT_BLIT); |
489 | if( main_render == NULL) |
528 | if( main_render == NULL) |
490 | { |
Line 529... | Line 491... | ||
529 | { |
491 | mutex_unlock(&vst->decoder_lock); |
Line 530... | Line 492... | ||
530 | printf("Cannot create render\n\r"); |
492 | printf("Cannot create render\n\r"); |
531 | return 0; |
493 | return 0; |
Line -... | Line 494... | ||
- | 494 | }; |
|
- | 495 | ||
532 | }; |
496 | __sync_or_and_fetch(&threads_running,VIDEO_THREAD); |
Line 533... | Line 497... | ||
533 | 497 | ||
Line 534... | Line 498... | ||
534 | __sync_or_and_fetch(&threads_running,VIDEO_THREAD); |
498 | render_draw_client(main_render); |
Line 546... | Line 510... | ||
546 | return 0; |
510 | return 0; |
547 | }; |
511 | }; |
548 | 512 | ||
Line 549... | Line 513... | ||
549 | 513 | ||
550 | void draw_hw_picture(render_t *render, AVPicture *picture); |
514 | void draw_hw_picture(render_t *render, vframe_t *vframe); |
Line 551... | Line 515... | ||
551 | void draw_sw_picture(render_t *render, AVPicture *picture); |
515 | void draw_sw_picture(render_t *render, vframe_t *vframe); |
552 | 516 | ||
553 | render_t *create_render(vst_t *vst, window_t *win, uint32_t flags) |
517 | render_t *create_render(vst_t *vst, window_t *win, uint32_t flags) |
Line 781... | Line 745... | ||
781 | 745 | ||
Line 782... | Line 746... | ||
782 | return; |
746 | return; |
783 | }; |
747 | }; |
Line 784... | Line 748... | ||
784 | 748 | ||
- | 749 | static void render_hw_planar(render_t *render, vframe_t *vframe) |
|
- | 750 | { |
|
- | 751 | vst_t *vst = render->vst; |
|
- | 752 | planar_t *planar = vframe->planar; |
|
- | 753 | ||
785 | void draw_hw_picture(render_t *render, AVPicture *picture) |
754 | if(vframe->is_hw_pic != 0 && vframe->format != AV_PIX_FMT_NONE) |
- | 755 | { |
|
- | 756 | mutex_lock(&render->vst->gpu_lock); |
|
- | 757 | ||
- | 758 | pxBlitPlanar(planar, render->rcvideo.l, |
|
- | 759 | CAPTION_HEIGHT+render->rcvideo.t, |
|
- | 760 | render->rcvideo.r, render->rcvideo.b,0,0); |
|
- | 761 | mutex_unlock(&render->vst->gpu_lock); |
|
- | 762 | ||
- | 763 | } |
|
- | 764 | }; |
|
- | 765 | ||
- | 766 | void draw_hw_picture(render_t *render, vframe_t *vframe) |
|
- | 767 | { |
|
786 | { |
768 | AVPicture *picture; |
787 | int dst_width; |
769 | int dst_width; |
788 | int dst_height; |
770 | int dst_height; |
789 | bitmap_t *bitmap; |
771 | bitmap_t *bitmap; |
790 | uint8_t *bitmap_data; |
772 | uint8_t *bitmap_data; |
791 | uint32_t bitmap_pitch; |
773 | uint32_t bitmap_pitch; |
792 | uint8_t *data[4]; |
774 | uint8_t *data[4]; |
793 | int linesize[4]; |
775 | int linesize[4]; |
Line -... | Line 776... | ||
- | 776 | enum AVPixelFormat format; |
|
- | 777 | ||
794 | enum AVPixelFormat format; |
778 | vst_t *vst = render->vst; |
795 | 779 | ||
796 | if(render->win->win_state == MINIMIZED || |
780 | if(render->win->win_state == MINIMIZED || |
Line 797... | Line 781... | ||
797 | render->win->win_state == ROLLED) |
781 | render->win->win_state == ROLLED) |
Line 807... | Line 791... | ||
807 | dst_width = render->rcvideo.r; |
791 | dst_width = render->rcvideo.r; |
808 | dst_height = render->rcvideo.b; |
792 | dst_height = render->rcvideo.b; |
809 | }; |
793 | }; |
810 | 794 | ||
Line -... | Line 795... | ||
- | 795 | if(vst->hwdec) |
|
- | 796 | { |
|
- | 797 | render_hw_planar(render, vframe); |
|
- | 798 | return; |
|
- | 799 | }; |
|
- | 800 | ||
- | 801 | picture = &vframe->picture; |
|
- | 802 | ||
811 | format = render->vst->hwdec == 0 ? render->ctx_format : AV_PIX_FMT_BGRA |
803 | format = render->vst->hwdec == 0 ? render->ctx_format : AV_PIX_FMT_BGRA; |
812 | cvt_ctx = sws_getCachedContext(cvt_ctx, |
- | |
813 | render->ctx_width, render->ctx_height, format, |
804 | cvt_ctx = sws_getCachedContext(cvt_ctx, render->ctx_width, render->ctx_height, format, |
814 | dst_width, dst_height, AV_PIX_FMT_BGRA, |
805 | dst_width, dst_height, AV_PIX_FMT_BGRA, |
815 | SWS_FAST_BILINEAR, NULL, NULL, NULL); |
806 | SWS_FAST_BILINEAR, NULL, NULL, NULL); |
816 | if(cvt_ctx == NULL) |
807 | if(cvt_ctx == NULL) |
817 | { |
808 | { |
818 | printf("Cannot initialize the conversion context!\n"); |
809 | printf("Cannot initialize the conversion context!\n"); |
Line 827... | Line 818... | ||
827 | printf("Cannot lock bitmap!\n"); |
818 | printf("Cannot lock bitmap!\n"); |
828 | return ; |
819 | return ; |
829 | } |
820 | } |
830 | 821 | ||
Line 831... | Line -... | ||
831 | // printf("sws_getCachedContext\n"); |
- | |
832 | data[0] = bitmap_data; |
822 | data[0] = bitmap_data; |
833 | data[1] = bitmap_data+1; |
823 | data[1] = bitmap_data+1; |
834 | data[2] = bitmap_data+2; |
824 | data[2] = bitmap_data+2; |
835 | data[3] = bitmap_data+3; |
825 | data[3] = bitmap_data+3; |
Line 872... | Line 862... | ||
872 | render->target++; |
862 | render->target++; |
873 | render->target&= 1; |
863 | render->target&= 1; |
874 | } |
864 | } |
875 | 865 | ||
Line 876... | Line 866... | ||
876 | void draw_sw_picture(render_t *render, AVPicture *picture) |
866 | void draw_sw_picture(render_t *render, vframe_t *vframe) |
877 | { |
867 | { |
- | 868 | AVPicture *picture; |
|
878 | uint8_t *bitmap_data; |
869 | uint8_t *bitmap_data; |
879 | uint32_t bitmap_pitch; |
870 | uint32_t bitmap_pitch; |
880 | uint8_t *data[4]; |
871 | uint8_t *data[4]; |
881 | int linesize[4]; |
872 | int linesize[4]; |
Line 882... | Line 873... | ||
882 | 873 | ||
883 | if(render->win->win_state == MINIMIZED || |
874 | if(render->win->win_state == MINIMIZED || |
884 | render->win->win_state == ROLLED) |
875 | render->win->win_state == ROLLED) |
Line -... | Line 876... | ||
- | 876 | return; |
|
- | 877 | ||
885 | return; |
878 | picture = &vframe->picture; |
886 | 879 | ||
887 | cvt_ctx = sws_getCachedContext(cvt_ctx, |
880 | cvt_ctx = sws_getCachedContext(cvt_ctx, |
888 | render->ctx_width, render->ctx_height, |
881 | render->ctx_width, render->ctx_height, |
889 | render->ctx_format, |
882 | render->ctx_format, |
Line 935... | Line 928... | ||
935 | y = CAPTION_HEIGHT; |
928 | y = CAPTION_HEIGHT; |
936 | 929 | ||
Line 937... | Line 930... | ||
937 | if(player_state == PAUSE) |
930 | if(player_state == PAUSE) |
938 | { |
931 | { |
939 | if(vst->vframe[vst->vfx].ready == 1 ) |
932 | // if(vst->vframe[vst->vfx].ready == 1 ) |
940 | main_render->draw(main_render, &vst->vframe[vst->vfx].picture); |
933 | // main_render->draw(main_render, &vst->vframe[vst->vfx].picture); |
941 | else |
934 | // else |
942 | draw_bar(0, y, render->win_width, |
935 | draw_bar(0, y, render->win_width, |
943 | render->rcvideo.b, 0); |
936 | render->rcvideo.b, 0); |
944 | } |
937 | } |
945 | else if( player_state == STOP ) |
938 | else if( player_state == STOP ) |
946 | { |
939 | { |