summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer/video_out_rockbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/mpegplayer/video_out_rockbox.c')
-rw-r--r--apps/plugins/mpegplayer/video_out_rockbox.c73
1 files changed, 58 insertions, 15 deletions
diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c
index fe3deafd01..214bdf3b5c 100644
--- a/apps/plugins/mpegplayer/video_out_rockbox.c
+++ b/apps/plugins/mpegplayer/video_out_rockbox.c
@@ -41,6 +41,7 @@ struct vo_data
41 unsigned flags; 41 unsigned flags;
42 struct vo_rect rc_vid; 42 struct vo_rect rc_vid;
43 struct vo_rect rc_clip; 43 struct vo_rect rc_clip;
44 void (*post_draw_callback)(void);
44}; 45};
45 46
46#if NUM_CORES > 1 47#if NUM_CORES > 1
@@ -80,9 +81,10 @@ static inline void video_unlock(void)
80 81
81 82
82/* Draw a black rectangle if no video frame is available */ 83/* Draw a black rectangle if no video frame is available */
83static void vo_draw_black(void) 84static void vo_draw_black(struct vo_rect *rc)
84{ 85{
85 int foreground; 86 int foreground;
87 int x, y, w, h;
86 88
87 video_lock(); 89 video_lock();
88 90
@@ -90,10 +92,30 @@ static void vo_draw_black(void)
90 92
91 mylcd_set_foreground(MYLCD_BLACK); 93 mylcd_set_foreground(MYLCD_BLACK);
92 94
93 mylcd_fillrect(vo.output_x, vo.output_y, vo.output_width, 95 if (rc)
94 vo.output_height); 96 {
95 mylcd_update_rect(vo.output_x, vo.output_y, vo.output_width, 97 x = rc->l;
96 vo.output_height); 98 y = rc->t;
99 w = rc->r - rc->l;
100 h = rc->b - rc->t;
101 }
102 else
103 {
104#if LCD_WIDTH >= LCD_HEIGHT
105 x = vo.output_x;
106 y = vo.output_y;
107 w = vo.output_width;
108 h = vo.output_height;
109#else
110 x = LCD_WIDTH - vo.output_height - vo.output_y;
111 y = vo.output_x;
112 w = vo.output_height;
113 h = vo.output_width;
114#endif
115 }
116
117 mylcd_fillrect(x, y, w, h);
118 mylcd_update_rect(x, y, w, h);
97 119
98 mylcd_set_foreground(foreground); 120 mylcd_set_foreground(foreground);
99 121
@@ -122,19 +144,22 @@ void vo_draw_frame(uint8_t * const * buf)
122 /* Frame is hidden - either by being set invisible or is clipped 144 /* Frame is hidden - either by being set invisible or is clipped
123 * away - copout */ 145 * away - copout */
124 DEBUGF("vo hidden\n"); 146 DEBUGF("vo hidden\n");
125 return;
126 } 147 }
127 else if (buf == NULL) 148 else if (buf == NULL)
128 { 149 {
129 /* No frame exists - draw black */ 150 /* No frame exists - draw black */
130 vo_draw_black(); 151 vo_draw_black(NULL);
131 DEBUGF("vo no frame\n"); 152 DEBUGF("vo no frame\n");
132 return; 153 }
154 else
155 {
156 yuv_blit(buf, 0, 0, vo.image_width,
157 vo.output_x, vo.output_y, vo.output_width,
158 vo.output_height);
133 } 159 }
134 160
135 yuv_blit(buf, 0, 0, vo.image_width, 161 if (vo.post_draw_callback)
136 vo.output_x, vo.output_y, vo.output_width, 162 vo.post_draw_callback();
137 vo.output_height);
138} 163}
139 164
140static inline void vo_rect_clear_inl(struct vo_rect *rc) 165static inline void vo_rect_clear_inl(struct vo_rect *rc)
@@ -348,14 +373,14 @@ bool vo_draw_frame_thumb(uint8_t * const * buf, const struct vo_rect *rc)
348 int thumb_width, thumb_height; 373 int thumb_width, thumb_height;
349 int thumb_uv_width, thumb_uv_height; 374 int thumb_uv_width, thumb_uv_height;
350 375
351 if (buf == NULL)
352 return false;
353
354 /* Obtain rectangle as clipped to the screen */ 376 /* Obtain rectangle as clipped to the screen */
355 vo_rect_set_ext(&thumb_rc, 0, 0, LCD_WIDTH, LCD_HEIGHT); 377 vo_rect_set_ext(&thumb_rc, 0, 0, LCD_WIDTH, LCD_HEIGHT);
356 if (!vo_rect_intersect(&thumb_rc, rc, &thumb_rc)) 378 if (!vo_rect_intersect(&thumb_rc, rc, &thumb_rc))
357 return true; 379 return true;
358 380
381 if (buf == NULL)
382 goto no_thumb_exit;
383
359 DEBUGF("thumb_rc: %d, %d, %d, %d\n", thumb_rc.l, thumb_rc.t, 384 DEBUGF("thumb_rc: %d, %d, %d, %d\n", thumb_rc.l, thumb_rc.t,
360 thumb_rc.r, thumb_rc.b); 385 thumb_rc.r, thumb_rc.b);
361 386
@@ -377,7 +402,7 @@ bool vo_draw_frame_thumb(uint8_t * const * buf, const struct vo_rect *rc)
377 ) 402 )
378 { 403 {
379 DEBUGF("thumb: insufficient buffer\n"); 404 DEBUGF("thumb: insufficient buffer\n");
380 return false; 405 goto no_thumb_exit;
381 } 406 }
382 407
383 yuv[0] = mem; 408 yuv[0] = mem;
@@ -411,6 +436,10 @@ bool vo_draw_frame_thumb(uint8_t * const * buf, const struct vo_rect *rc)
411#endif /* LCD_WIDTH >= LCD_HEIGHT */ 436#endif /* LCD_WIDTH >= LCD_HEIGHT */
412 437
413 return true; 438 return true;
439
440no_thumb_exit:
441 vo_draw_black(&thumb_rc);
442 return false;
414} 443}
415 444
416void vo_setup(const mpeg2_sequence_t * sequence) 445void vo_setup(const mpeg2_sequence_t * sequence)
@@ -512,6 +541,20 @@ void vo_set_clip_rect(const struct vo_rect *rc)
512 vo.output_height = rc_out.b - rc_out.t; 541 vo.output_height = rc_out.b - rc_out.t;
513} 542}
514 543
544bool vo_get_clip_rect(struct vo_rect *rc)
545{
546 rc->l = vo.output_x;
547 rc->t = vo.output_y;
548 rc->r = rc->l + vo.output_width;
549 rc->b = rc->t + vo.output_height;
550 return (vo.flags & VO_NON_NULL_RECT) != 0;
551}
552
553void vo_set_post_draw_callback(void (*cb)(void))
554{
555 vo.post_draw_callback = cb;
556}
557
515#if NUM_CORES > 1 558#if NUM_CORES > 1
516void vo_lock(void) 559void vo_lock(void)
517{ 560{