diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2010-12-19 08:28:03 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2010-12-19 08:28:03 +0000 |
commit | 31af1a3ac21646c8f07b1b93e497d45a060ee36d (patch) | |
tree | 30b7541bd15a3291311c8d1b48b1b6a95d7a1ba5 /apps/plugins/mpegplayer/stream_mgr.c | |
parent | fd01bf3e4cfedf073824b1a98662932796b6cd32 (diff) | |
download | rockbox-31af1a3ac21646c8f07b1b93e497d45a060ee36d.tar.gz rockbox-31af1a3ac21646c8f07b1b93e497d45a060ee36d.zip |
MPEGPlayer: Move some code that's probably better situated in the stream manager rather than the parser. Fix visibility checking in video out. Extra message sending for new stream isn't needed; just do full decoder sequence reset when requesting dimensions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28855 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mpegplayer/stream_mgr.c')
-rw-r--r-- | apps/plugins/mpegplayer/stream_mgr.c | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c index b88c6d70c7..67ec16cbb6 100644 --- a/apps/plugins/mpegplayer/stream_mgr.c +++ b/apps/plugins/mpegplayer/stream_mgr.c | |||
@@ -668,13 +668,51 @@ void stream_clear_notify(struct stream *str, int for_msg) | |||
668 | } | 668 | } |
669 | } | 669 | } |
670 | 670 | ||
671 | /* Special handling for certain messages since they involve multiple | ||
672 | * operations behind the scenes */ | ||
673 | static intptr_t send_video_msg(long id, intptr_t data) | ||
674 | { | ||
675 | intptr_t retval = 0; | ||
676 | |||
677 | if (video_str.thread != 0 && disk_buf.in_file >= 0) | ||
678 | { | ||
679 | |||
680 | switch (id) | ||
681 | { | ||
682 | case VIDEO_DISPLAY_SHOW: | ||
683 | if (data != 0 && disk_buf_status() == STREAM_STOPPED) | ||
684 | { /* Only prepare image if showing and not playing */ | ||
685 | parser_prepare_image(str_parser.last_seek_time); | ||
686 | } | ||
687 | break; | ||
688 | |||
689 | case VIDEO_PRINT_FRAME: | ||
690 | if (data) | ||
691 | break; | ||
692 | case VIDEO_PRINT_THUMBNAIL: | ||
693 | if (disk_buf_status() != STREAM_STOPPED) | ||
694 | break; /* Prepare image if not playing */ | ||
695 | |||
696 | if (!parser_prepare_image(str_parser.last_seek_time)) | ||
697 | return false; /* Preparation failed */ | ||
698 | |||
699 | /* Image ready - pass message to video thread */ | ||
700 | break; | ||
701 | } | ||
702 | |||
703 | retval = str_send_msg(&video_str, id, data); | ||
704 | } | ||
705 | |||
706 | return retval; | ||
707 | } | ||
708 | |||
671 | /* Show/hide the video output */ | 709 | /* Show/hide the video output */ |
672 | bool stream_show_vo(bool show) | 710 | bool stream_show_vo(bool show) |
673 | { | 711 | { |
674 | bool vis; | 712 | bool vis; |
675 | stream_mgr_lock(); | 713 | stream_mgr_lock(); |
676 | 714 | ||
677 | vis = parser_send_video_msg(VIDEO_DISPLAY_SHOW, show); | 715 | vis = send_video_msg(VIDEO_DISPLAY_SHOW, show); |
678 | #ifndef HAVE_LCD_COLOR | 716 | #ifndef HAVE_LCD_COLOR |
679 | grey_show(show); | 717 | grey_show(show); |
680 | #endif | 718 | #endif |
@@ -688,7 +726,7 @@ bool stream_vo_is_visible(void) | |||
688 | { | 726 | { |
689 | bool vis; | 727 | bool vis; |
690 | stream_mgr_lock(); | 728 | stream_mgr_lock(); |
691 | vis = parser_send_video_msg(VIDEO_DISPLAY_IS_VISIBLE, 0); | 729 | vis = send_video_msg(VIDEO_DISPLAY_IS_VISIBLE, 0); |
692 | stream_mgr_unlock(); | 730 | stream_mgr_unlock(); |
693 | return vis; | 731 | return vis; |
694 | } | 732 | } |
@@ -721,7 +759,7 @@ void stream_vo_set_clip(const struct vo_rect *rc) | |||
721 | rc = &stream_mgr.parms.rc; | 759 | rc = &stream_mgr.parms.rc; |
722 | } | 760 | } |
723 | 761 | ||
724 | parser_send_video_msg(VIDEO_SET_CLIP_RECT, (intptr_t)rc); | 762 | send_video_msg(VIDEO_SET_CLIP_RECT, (intptr_t)rc); |
725 | 763 | ||
726 | stream_mgr_unlock(); | 764 | stream_mgr_unlock(); |
727 | } | 765 | } |
@@ -750,7 +788,7 @@ bool stream_display_thumb(const struct vo_rect *rc) | |||
750 | stream_mgr_lock(); | 788 | stream_mgr_lock(); |
751 | 789 | ||
752 | stream_mgr.parms.rc = *rc; | 790 | stream_mgr.parms.rc = *rc; |
753 | retval = parser_send_video_msg(VIDEO_PRINT_THUMBNAIL, | 791 | retval = send_video_msg(VIDEO_PRINT_THUMBNAIL, |
754 | (intptr_t)&stream_mgr.parms.rc); | 792 | (intptr_t)&stream_mgr.parms.rc); |
755 | 793 | ||
756 | stream_mgr_unlock(); | 794 | stream_mgr_unlock(); |
@@ -763,7 +801,7 @@ bool stream_draw_frame(bool no_prepare) | |||
763 | bool retval; | 801 | bool retval; |
764 | stream_mgr_lock(); | 802 | stream_mgr_lock(); |
765 | 803 | ||
766 | retval = parser_send_video_msg(VIDEO_PRINT_FRAME, no_prepare); | 804 | retval = send_video_msg(VIDEO_PRINT_FRAME, no_prepare); |
767 | 805 | ||
768 | stream_mgr_unlock(); | 806 | stream_mgr_unlock(); |
769 | 807 | ||