Rev 5021 | Rev 5592 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5021 | Rev 5372 | ||
---|---|---|---|
Line 182... | Line 182... | ||
182 | extern volatile enum player_state player_state; |
182 | extern volatile enum player_state player_state; |
183 | extern volatile enum player_state decoder_state; |
183 | extern volatile enum player_state decoder_state; |
184 | extern volatile enum player_state sound_state; |
184 | extern volatile enum player_state sound_state; |
Line 185... | Line -... | ||
185 | - | ||
186 | //rect_t win_rect; |
- | |
187 | 185 | ||
Line 188... | Line 186... | ||
188 | extern int64_t rewind_pos; |
186 | extern int64_t rewind_pos; |
189 | 187 | ||
190 | static void player_stop() |
188 | static void player_stop() |
Line 217... | Line 215... | ||
217 | 215 | ||
Line 218... | Line 216... | ||
218 | switch(msg) |
216 | switch(msg) |
219 | { |
217 | { |
220 | case MSG_SIZE: |
218 | case MSG_SIZE: |
221 | //printf("MSG_SIZE\n"); |
- | |
222 | if(main_render) |
219 | if(main_render) |
223 | { |
220 | { |
224 | render_adjust_size(main_render, win); |
221 | render_adjust_size(main_render, win); |
225 | render_draw_client(main_render); |
222 | render_draw_client(main_render); |
226 | }; |
223 | }; |
Line 266... | Line 263... | ||
266 | "d"(win->saved.r-win->saved.l-1),"S"(win->saved.b-win->saved.t-1)); |
263 | "d"(win->saved.r-win->saved.l-1),"S"(win->saved.b-win->saved.t-1)); |
267 | win->win_state = win->saved_state; |
264 | win->win_state = win->saved_state; |
268 | window_update_layout(win); |
265 | window_update_layout(win); |
269 | // if(win->saved_state == MAXIMIZED) |
266 | // if(win->saved_state == MAXIMIZED) |
270 | { |
267 | // { |
271 | blit_caption(&win->caption); |
268 | // blit_caption(&win->caption); |
272 | blit_panel(&win->panel); |
269 | // blit_panel(&win->panel); |
273 | } |
270 | // } |
274 | } |
271 | } |
275 | ent_down = 1; |
272 | ent_down = 1; |
276 | }; |
273 | }; |
277 | break; |
274 | break; |
278 | 275 | ||
Line 565... | Line 562... | ||
565 | { |
562 | { |
566 | AVCodecContext *ctx = param; |
563 | AVCodecContext *ctx = param; |
567 | window_t *MainWindow; |
564 | window_t *MainWindow; |
568 | 565 | ||
Line -... | Line 566... | ||
- | 566 | ||
- | 567 | printf("%s\n", __FUNCTION__); |
|
- | 568 | ||
569 | init_winlib(); |
569 | init_winlib(); |
Line 570... | Line 570... | ||
570 | 570 | ||
571 | MainWindow = create_window(movie_file,0, |
571 | MainWindow = create_window(movie_file,0, |
Line 620... | Line 620... | ||
620 | render->ctx_height = ctx->height; |
620 | render->ctx_height = ctx->height; |
621 | render->ctx_format = ctx->pix_fmt; |
621 | render->ctx_format = ctx->pix_fmt; |
622 | 622 | ||
Line 623... | Line 623... | ||
623 | mutex_lock(&driver_lock); |
623 | mutex_lock(&driver_lock); |
624 | render->caps = init_pixlib(flags); |
624 | render->caps = pxInit(1); |
625 | mutex_unlock(&driver_lock); |
625 | mutex_unlock(&driver_lock); |
Line 626... | Line 626... | ||
626 | 626 | ||
627 | right = win->w; |
627 | right = win->w; |
Line 628... | Line 628... | ||
628 | bottom = win->h-CAPTION_HEIGHT-PANEL_HEIGHT; |
628 | bottom = win->h-CAPTION_HEIGHT-PANEL_HEIGHT; |
629 | 629 | ||
Line 630... | Line 630... | ||
630 | // printf("window width %d height %d\n", |
630 | printf("window width %d height %d\n", |
Line 631... | Line 631... | ||
631 | // right, bottom); |
631 | right, bottom); |
632 | 632 | ||
Line 651... | Line 651... | ||
651 | render->win_height = win->h-CAPTION_HEIGHT-PANEL_HEIGHT; |
651 | render->win_height = win->h-CAPTION_HEIGHT-PANEL_HEIGHT; |
652 | 652 | ||
Line 653... | Line 653... | ||
653 | render_set_size(render, draw_w, draw_h); |
653 | render_set_size(render, draw_w, draw_h); |
Line -... | Line 654... | ||
- | 654 | ||
Line 654... | Line 655... | ||
654 | 655 | pxCreateClient(0, CAPTION_HEIGHT, right, bottom); |
|
655 | 656 | ||
656 | if(render->caps==0) |
657 | if(render->caps==0) |
657 | { |
658 | { |
658 | render->bitmap[0].width = draw_w; |
- | |
659 | render->bitmap[0].height = draw_h; |
- | |
660 | 659 | render->bitmap[0] = pxCreateBitmap(draw_w, draw_h); |
|
661 | if( create_bitmap(&render->bitmap[0]) != 0 ) |
660 | if(render->bitmap[0] == NULL) |
662 | { |
661 | { |
663 | free(render); |
662 | free(render); |
664 | return NULL; |
663 | return NULL; |
665 | } |
664 | } |
666 | render->draw = draw_sw_picture; |
665 | render->draw = draw_sw_picture; |
667 | } |
666 | } |
668 | else |
667 | else |
669 | { |
668 | { |
Line 670... | Line 669... | ||
670 | int width, height, flags; |
669 | int width, height; |
671 | int i; |
670 | int i; |
672 | - | ||
673 | if(render->caps & HW_TEX_BLIT) |
- | |
674 | { |
671 | |
675 | sna_create_mask(); |
672 | if(render->caps & HW_TEX_BLIT) |
676 | - | ||
677 | width = render->ctx_width; |
673 | { |
678 | height = render->ctx_height; |
674 | width = render->ctx_width; |
679 | flags = HW_TEX_BLIT; |
675 | height = render->ctx_height; |
680 | } |
676 | } |
681 | else |
677 | else |
682 | { |
- | |
683 | width = draw_w; |
678 | { |
Line 684... | Line 679... | ||
684 | height = draw_h;; |
679 | width = draw_w; |
685 | flags = HW_BIT_BLIT; |
680 | height = draw_h;; |
686 | } |
- | |
687 | 681 | } |
|
688 | for( i=0; i < 2; i++) |
682 | |
689 | { |
- | |
690 | render->bitmap[i].width = width; |
- | |
691 | render->bitmap[i].height = height; |
683 | for( i=0; i < 2; i++) |
692 | render->bitmap[i].flags = flags; |
684 | { |
693 | 685 | render->bitmap[i] = pxCreateBitmap(width, height); |
|
694 | if( create_bitmap(&render->bitmap[i]) != 0 ) |
686 | if( render->bitmap[i] == NULL ) |
695 | { |
687 | { |
Line 703... | Line 695... | ||
703 | render->target = 0; |
695 | render->target = 0; |
704 | render->draw = draw_hw_picture; |
696 | render->draw = draw_hw_picture; |
705 | }; |
697 | }; |
706 | 698 | ||
Line 707... | Line -... | ||
707 | - | ||
708 | printf("FPlay %s render engine: context %dx%d picture %dx%d\n", |
699 | printf("FPlay %s render engine: context %dx%d picture %dx%d\n", |
709 | render->caps & HW_TEX_BLIT ? "hw_tex_blit": |
700 | render->caps & HW_TEX_BLIT ? "hw_tex_blit": |
710 | render->caps & HW_BIT_BLIT ? "hw_bit_blit":"software", |
701 | render->caps & HW_BIT_BLIT ? "hw_bit_blit":"software", |
711 | render->ctx_width, render->ctx_height, |
702 | render->ctx_width, render->ctx_height, |
712 | draw_w, draw_h); |
703 | draw_w, draw_h); |
Line 713... | Line -... | ||
713 | - | ||
714 | // if(init_hw_context(ctx) == 0) |
- | |
715 | // printf("create hardware decoder context\n"); |
- | |
716 | 704 | ||
717 | return render; |
705 | return render; |
Line 718... | Line 706... | ||
718 | }; |
706 | }; |
719 | 707 | ||
Line 720... | Line 708... | ||
720 | void destroy_render(render_t *render) |
708 | void destroy_render(render_t *render) |
Line 721... | Line 709... | ||
721 | { |
709 | { |
722 | 710 | ||
Line 723... | Line 711... | ||
723 | destroy_bitmap(&render->bitmap[0]); |
711 | pxDestroyBitmap(render->bitmap[0]); |
724 | 712 | ||
Line 725... | Line 713... | ||
725 | if(render->caps & (HW_BIT_BLIT|HW_TEX_BLIT)) /* hw blitter */ |
713 | if(render->caps & (HW_BIT_BLIT|HW_TEX_BLIT)) /* hw blitter */ |
726 | destroy_bitmap(&render->bitmap[1]); |
714 | pxDestroyBitmap(render->bitmap[1]); |
727 | 715 | ||
Line 828... | Line 816... | ||
828 | render->win_height = bottom; |
816 | render->win_height = bottom; |
829 | render_set_size(render, new_w, new_h); |
817 | render_set_size(render, new_w, new_h); |
830 | 818 | ||
Line 831... | Line 819... | ||
831 | if(render->caps & HW_TEX_BLIT) /* hw scaler */ |
819 | if(render->caps & HW_TEX_BLIT) /* hw scaler */ |
- | 820 | { |
|
- | 821 | if(render->win->win_state == FULLSCREEN) |
|
- | 822 | pxResizeClient(render->rcvideo.l, render->rcvideo.t, new_w, new_h); |
|
- | 823 | else |
|
- | 824 | pxResizeClient(render->rcvideo.l, render->rcvideo.t+CAPTION_HEIGHT, new_w, new_h); |
|
- | 825 | ||
832 | return; |
826 | return; |
- | 827 | }; |
|
Line 833... | Line -... | ||
833 | - | ||
834 | render->bitmap[0].width = new_w; |
- | |
835 | render->bitmap[0].height = new_h; |
828 | |
Line 836... | Line 829... | ||
836 | resize_bitmap(&render->bitmap[0]); |
829 | pxResizeBitmap(render->bitmap[0], new_w, new_h); |
837 | - | ||
838 | if(render->caps & HW_BIT_BLIT) /* hw blitter */ |
- | |
839 | { |
- | |
840 | render->bitmap[1].width = new_w; |
830 | |
841 | render->bitmap[1].height = new_h; |
831 | if(render->caps & HW_BIT_BLIT) /* hw blitter */ |
842 | resize_bitmap(&render->bitmap[1]); |
832 | pxResizeBitmap(render->bitmap[1], new_w, new_h); |
843 | }; |
833 | |
Line 844... | Line 834... | ||
844 | return; |
834 | return; |
845 | }; |
835 | }; |
- | 836 | ||
846 | 837 | void draw_hw_picture(render_t *render, AVPicture *picture) |
|
847 | void draw_hw_picture(render_t *render, AVPicture *picture) |
838 | { |
- | 839 | int dst_width; |
|
- | 840 | int dst_height; |
|
848 | { |
841 | bitmap_t *bitmap; |
849 | int dst_width, dst_height; |
842 | uint8_t *bitmap_data; |
850 | bitmap_t *bitmap; |
- | |
Line 851... | Line 843... | ||
851 | uint8_t *data[4]; |
843 | uint32_t bitmap_pitch; |
852 | int linesize[4]; |
844 | uint8_t *data[4]; |
853 | int ret; |
845 | int linesize[4]; |
Line 876... | Line 868... | ||
876 | printf("Cannot initialize the conversion context!\n"); |
868 | printf("Cannot initialize the conversion context!\n"); |
877 | return ; |
869 | return ; |
878 | }; |
870 | }; |
879 | 871 | ||
Line 880... | Line 872... | ||
880 | bitmap = &render->bitmap[render->target]; |
872 | bitmap = render->bitmap[render->target]; |
Line 881... | Line 873... | ||
881 | 873 | ||
882 | ret = lock_bitmap(bitmap); |
874 | bitmap_data = pxLockBitmap(bitmap, &bitmap_pitch); |
883 | if( ret != 0) |
875 | if( bitmap_data == NULL) |
884 | { |
876 | { |
885 | printf("Cannot lock bitmap!\n"); |
877 | printf("Cannot lock bitmap!\n"); |
886 | return ; |
878 | return ; |
Line 887... | Line 879... | ||
887 | } |
879 | } |
888 | 880 | ||
889 | // printf("sws_getCachedContext\n"); |
881 | // printf("sws_getCachedContext\n"); |
890 | data[0] = bitmap->data; |
882 | data[0] = bitmap_data; |
891 | data[1] = bitmap->data+1; |
883 | data[1] = bitmap_data+1; |
892 | data[2] = bitmap->data+2; |
884 | data[2] = bitmap_data+2; |
893 | data[3] = bitmap->data+3; |
885 | data[3] = bitmap_data+3; |
894 | 886 | ||
895 | linesize[0] = bitmap->pitch; |
887 | linesize[0] = bitmap_pitch; |
896 | linesize[1] = bitmap->pitch; |
888 | linesize[1] = bitmap_pitch; |
Line 897... | Line 889... | ||
897 | linesize[2] = bitmap->pitch; |
889 | linesize[2] = bitmap_pitch; |
898 | linesize[3] = bitmap->pitch; |
890 | linesize[3] = bitmap_pitch; |
899 | 891 | ||
Line 900... | Line 892... | ||
900 | sws_scale(cvt_ctx, (const uint8_t* const *)picture->data, |
892 | sws_scale(cvt_ctx, (const uint8_t* const *)picture->data, |
901 | picture->linesize, 0, render->ctx_height, data, linesize); |
893 | picture->linesize, 0, render->ctx_height, data, linesize); |
Line 902... | Line 894... | ||
902 | // printf("sws_scale\n"); |
894 | // printf("sws_scale\n"); |
903 | 895 | ||
904 | 896 | ||
905 | if(render->caps & HW_TEX_BLIT) |
897 | if(render->caps & HW_TEX_BLIT) |
906 | { |
898 | { |
907 | 899 | ||
908 | if(render->win->win_state == FULLSCREEN) |
900 | if(render->win->win_state == FULLSCREEN) |
909 | fplay_blit_bitmap(bitmap,render->rcvideo.l,render->rcvideo.t, |
901 | pxBlitBitmap(bitmap,render->rcvideo.l,render->rcvideo.t, |
910 | render->rcvideo.r, render->rcvideo.b); |
902 | render->rcvideo.r, render->rcvideo.b,0,0); |
911 | else |
903 | else |
912 | fplay_blit_bitmap(bitmap, render->rcvideo.l, |
904 | pxBlitBitmap(bitmap, render->rcvideo.l, |
913 | CAPTION_HEIGHT+render->rcvideo.t, |
905 | CAPTION_HEIGHT+render->rcvideo.t, |
914 | render->rcvideo.r, render->rcvideo.b); |
906 | render->rcvideo.r, render->rcvideo.b,0,0); |
915 | } |
907 | } |
916 | else |
908 | else |
917 | { |
909 | { |
918 | if(render->win->win_state == FULLSCREEN) |
910 | if(render->win->win_state == FULLSCREEN) |
919 | blit_bitmap(bitmap,render->rcvideo.l,render->rcvideo.t, |
911 | pxBlitBitmap(bitmap,render->rcvideo.l,render->rcvideo.t, |
Line 920... | Line 912... | ||
920 | render->rcvideo.r, render->rcvideo.b, 0,0); |
912 | render->rcvideo.r, render->rcvideo.b, 0,0); |
Line 930... | Line 922... | ||
930 | } |
922 | } |
931 | 923 | ||
Line 932... | Line 924... | ||
932 | void draw_sw_picture(render_t *render, AVPicture *picture) |
924 | void draw_sw_picture(render_t *render, AVPicture *picture) |
933 | { |
925 | { |
- | 926 | uint8_t *bitmap_data; |
|
- | 927 | uint32_t bitmap_pitch; |
|
934 | uint8_t *data[4]; |
928 | uint8_t *data[4]; |
935 | int linesize[4]; |
929 | int linesize[4]; |
Line 936... | Line 930... | ||
936 | 930 | ||
937 | if(render->win->win_state == MINIMIZED || |
931 | if(render->win->win_state == MINIMIZED || |
Line 948... | Line 942... | ||
948 | printf("Cannot initialize the conversion context!\n"); |
942 | printf("Cannot initialize the conversion context!\n"); |
949 | return ; |
943 | return ; |
950 | } |
944 | } |
951 | 945 | ||
Line 952... | Line 946... | ||
952 | lock_bitmap(&render->bitmap[0]); |
946 | bitmap_data = pxLockBitmap(render->bitmap[0],&bitmap_pitch); |
Line 953... | Line 947... | ||
953 | 947 | ||
954 | data[0] = render->bitmap[0].data; |
948 | data[0] = bitmap_data; |
955 | data[1] = render->bitmap[0].data+1; |
949 | data[1] = bitmap_data+1; |
956 | data[2] = render->bitmap[0].data+2; |
950 | data[2] = bitmap_data+2; |
957 | data[3] = render->bitmap[0].data+3; |
951 | data[3] = bitmap_data+3; |
958 | 952 | ||
959 | linesize[0] = render->bitmap[0].pitch; |
953 | linesize[0] = bitmap_pitch; |
960 | linesize[1] = render->bitmap[0].pitch; |
954 | linesize[1] = bitmap_pitch; |
961 | linesize[2] = render->bitmap[0].pitch; |
955 | linesize[2] = bitmap_pitch; |
Line 962... | Line 956... | ||
962 | linesize[3] = render->bitmap[0].pitch; |
956 | linesize[3] = bitmap_pitch; |
963 | 957 | ||
Line 964... | Line 958... | ||
964 | sws_scale(cvt_ctx, (const uint8_t* const *)picture->data, |
958 | sws_scale(cvt_ctx, (const uint8_t* const *)picture->data, |
965 | picture->linesize, 0, render->ctx_height, data, linesize); |
959 | picture->linesize, 0, render->ctx_height, data, linesize); |
966 | 960 | ||
967 | if(render->win->win_state == FULLSCREEN) |
961 | if(render->win->win_state == FULLSCREEN) |
968 | fplay_blit_bitmap(&render->bitmap[0],render->rcvideo.l,render->rcvideo.t, |
962 | pxBlitBitmap(render->bitmap[0],render->rcvideo.l,render->rcvideo.t, |
969 | render->rcvideo.r, render->rcvideo.b); |
963 | render->rcvideo.r, render->rcvideo.b,0,0); |
970 | else |
964 | else |
Line 971... | Line 965... | ||
971 | fplay_blit_bitmap(&render->bitmap[0], render->rcvideo.l, |
965 | pxBlitBitmap(render->bitmap[0], render->rcvideo.l, |
972 | CAPTION_HEIGHT+render->rcvideo.t, |
966 | CAPTION_HEIGHT+render->rcvideo.t, |
Line 973... | Line 967... | ||
973 | render->rcvideo.r, render->rcvideo.b); |
967 | render->rcvideo.r, render->rcvideo.b,0,0); |
974 | 968 | ||
975 | render->last_bitmap = &render->bitmap[0]; |
969 | render->last_bitmap = render->bitmap[0]; |