Rev 5603 | Rev 6117 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5603 | Rev 6106 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | #include |
2 | #include |
3 | #include |
3 | #include |
4 | #include |
4 | #include |
5 | #include |
5 | #include |
6 | #include |
6 | #include |
- | 7 | #include |
|
7 | #include "winlib/winlib.h" |
8 | #include |
8 | #include |
- | |
9 | #include "fplay.h" |
9 | |
- | 10 | #include "winlib/winlib.h" |
|
- | 11 | #include "fplay.h" |
|
10 | #include |
12 | |
11 | - | ||
Line 12... | Line 13... | ||
12 | int fplay_blit_bitmap(bitmap_t *bitmap, int dst_x, int dst_y,int w, int h); |
13 | int fplay_blit_bitmap(bitmap_t *bitmap, int dst_x, int dst_y,int w, int h); |
13 | void draw_va_picture(render_t *render, AVPicture *picture); |
14 | void draw_va_picture(render_t *render, AVPicture *picture); |
Line 14... | Line 15... | ||
14 | 15 | ||
Line 69... | Line 70... | ||
69 | 70 | ||
Line 70... | Line 71... | ||
70 | width = ctx->width; |
71 | width = ctx->width; |
71 | height = ctx->height; |
72 | height = ctx->height; |
Line 72... | Line -... | ||
72 | - | ||
73 | 73 | ||
74 | Frame = avcodec_alloc_frame(); |
74 | Frame = avcodec_alloc_frame(); |
75 | if ( Frame == NULL ) |
75 | if ( Frame == NULL ) |
76 | { |
76 | { |
77 | printf("Cannot alloc video frame\n\r"); |
77 | printf("Cannot alloc video frame\n\r"); |
Line 81... | Line 81... | ||
81 | for( i=0; i < 4; i++) |
81 | for( i=0; i < 4; i++) |
82 | { |
82 | { |
83 | int ret; |
83 | int ret; |
Line 84... | Line -... | ||
84 | - | ||
85 | // printf("alloc picture %d %d %x\n", |
- | |
86 | // ctx->width, ctx->height, ctx->pix_fmt ); |
- | |
87 | 84 | ||
88 | ret = avpicture_alloc(&frames[i].picture, ctx->pix_fmt, |
85 | ret = avpicture_alloc(&frames[i].picture, ctx->pix_fmt, |
89 | ctx->width, ctx->height); |
86 | ctx->width, ctx->height); |
90 | if ( ret != 0 ) |
87 | if ( ret != 0 ) |
91 | { |
88 | { |
Line 150... | Line 147... | ||
150 | pts= pkt.dts; |
147 | pts= pkt.dts; |
151 | else |
148 | else |
152 | pts= 0; |
149 | pts= 0; |
153 | 150 | ||
Line 154... | Line -... | ||
154 | // pts = *(int64_t*)av_opt_ptr(avcodec_get_frame_class(), |
- | |
155 | // Frame, "best_effort_timestamp"); |
- | |
156 | - | ||
157 | // if (pts == AV_NOPTS_VALUE) |
- | |
158 | // pts = 0; |
- | |
159 | - | ||
160 | pts *= av_q2d(video_time_base); |
151 | pts *= av_q2d(video_time_base); |
Line 161... | Line 152... | ||
161 | 152 | ||
Line 162... | Line 153... | ||
162 | dst_pic = &frames[dfx].picture; |
153 | dst_pic = &frames[dfx].picture; |
163 | 154 | ||
164 | av_image_copy(dst_pic->data, dst_pic->linesize, |
155 | av_image_copy(dst_pic->data, dst_pic->linesize, |
Line 165... | Line 156... | ||
165 | (const uint8_t**)Frame->data, |
156 | (const uint8_t**)Frame->data, |
166 | Frame->linesize, ctx->pix_fmt, ctx->width, ctx->height); |
- | |
Line 167... | Line 157... | ||
167 | 157 | Frame->linesize, ctx->pix_fmt, ctx->width, ctx->height); |
|
Line 168... | Line 158... | ||
168 | frames[dfx].pts = pts*1000.0; |
158 | |
169 | // printf("pts %f\n", frames[dfx].pts); |
159 | frames[dfx].pts = pts*1000.0; |
Line 203... | Line 193... | ||
203 | player_state = STOP; |
193 | player_state = STOP; |
204 | decoder_state = PLAY_2_STOP; |
194 | decoder_state = PLAY_2_STOP; |
205 | sound_state = PLAY_2_STOP; |
195 | sound_state = PLAY_2_STOP; |
206 | render_draw_client(main_render); |
196 | render_draw_client(main_render); |
207 | // printf("stop player\n"); |
197 | }; |
208 | - | ||
209 | }; |
- | |
210 | 198 | ||
Line 211... | Line 199... | ||
211 | int MainWindowProc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2) |
199 | int MainWindowProc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2) |
212 | { |
200 | { |
213 | window_t *win = (window_t*)ctrl; |
201 | window_t *win = (window_t*)ctrl; |
Line 351... | Line 339... | ||
351 | progress_t *prg = (progress_t*)arg2; |
339 | progress_t *prg = (progress_t*)arg2; |
352 | 340 | ||
Line 353... | Line 341... | ||
353 | rewind_pos = (prg->max - prg->min)*prg->pos/prg->ctrl.w; |
341 | rewind_pos = (prg->max - prg->min)*prg->pos/prg->ctrl.w; |
Line 354... | Line -... | ||
354 | - | ||
355 | // printf("progress action pos: %d time: %f\n", prg->pos, (double)rewind_pos); |
342 | |
356 | player_state = REWIND; |
343 | player_state = REWIND; |
357 | decoder_state = REWIND; |
344 | decoder_state = REWIND; |
358 | sound_state = PLAY_2_STOP; |
345 | sound_state = PLAY_2_STOP; |
359 | if(rewind_pos < prg->current) |
346 | if(rewind_pos < prg->current) |
Line 377... | Line 364... | ||
377 | int peak; |
364 | int peak; |
378 | int level; |
365 | int level; |
379 | 366 | ||
Line 380... | Line 367... | ||
380 | peak = sld->min + sld->pos * (sld->max - sld->min)/(96); |
367 | peak = sld->min + sld->pos * (sld->max - sld->min)/(96); |
381 | // level = (log2(peak+16384)*10000.0)/15 - 10000; |
- | |
382 | level = peak; |
368 | level = peak; |
Line 383... | Line -... | ||
383 | - | ||
384 | // printf("level %d\n", level); |
369 | |
385 | set_audio_volume(level, level); |
370 | set_audio_volume(level, level); |
386 | send_message(&sld->ctrl, MSG_PAINT, 0, 0); |
371 | send_message(&sld->ctrl, MSG_PAINT, 0, 0); |
387 | win->panel.lvl->vol = level; |
372 | win->panel.lvl->vol = level; |
Line 619... | Line 604... | ||
619 | render->ctx_width = ctx->width; |
604 | render->ctx_width = ctx->width; |
620 | render->ctx_height = ctx->height; |
605 | render->ctx_height = ctx->height; |
621 | render->ctx_format = ctx->pix_fmt; |
606 | render->ctx_format = ctx->pix_fmt; |
Line 622... | Line -... | ||
622 | - | ||
623 | mutex_lock(&driver_lock); |
607 | |
624 | render->caps = pxInit(1); |
- | |
Line 625... | Line 608... | ||
625 | mutex_unlock(&driver_lock); |
608 | render->caps = pxInit(1); |
626 | 609 | ||
Line 627... | Line 610... | ||
627 | right = win->w; |
610 | right = win->w; |