comparison libmpcodecs/vf_vo.c @ 18917:d9a75b26da6c

Add a new video pts tracking mode, enabled by option -correct-pts. This mode has the following differences: - Video timing is correct for streams with B frames, at least with some demuxers. - Video filters can modify frame timestamps and insert new frames, and removing frames is handled better than before. - Some things are known to break, it's not usable as the default yet. Things should work as before when the -correct-pts option is not used.
author uau
date Thu, 06 Jul 2006 06:58:17 +0000
parents 20aca9baf5d8
children ed2785b4dd48
comparison
equal deleted inserted replaced
18916:a95ed361d16b 18917:d9a75b26da6c
10 10
11 #include "libvo/video_out.h" 11 #include "libvo/video_out.h"
12 12
13 //===========================================================================// 13 //===========================================================================//
14 14
15 #define video_out ((vo_functions_t*)(vf->priv)) 15 struct priv_t {double pts; vo_functions_t *vo;};
16 #define video_out (((struct priv_t *)(vf->priv))->vo)
16 17
17 static int query_format(struct vf_instance_s* vf, unsigned int fmt); /* forward declaration */ 18 static int query_format(struct vf_instance_s* vf, unsigned int fmt); /* forward declaration */
18 19
19 static int config(struct vf_instance_s* vf, 20 static int config(struct vf_instance_s* vf,
20 int width, int height, int d_width, int d_height, 21 int width, int height, int d_width, int d_height,
100 } 101 }
101 102
102 static int put_image(struct vf_instance_s* vf, 103 static int put_image(struct vf_instance_s* vf,
103 mp_image_t *mpi, double pts){ 104 mp_image_t *mpi, double pts){
104 if(!vo_config_count) return 0; // vo not configured? 105 if(!vo_config_count) return 0; // vo not configured?
106 // record pts (potentially modified by filters) for main loop
107 ((struct priv_t *)vf->priv)->pts = pts;
105 // first check, maybe the vo/vf plugin implements draw_image using mpi: 108 // first check, maybe the vo/vf plugin implements draw_image using mpi:
106 if(video_out->control(VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return 1; // done. 109 if(video_out->control(VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return 1; // done.
107 // nope, fallback to old draw_frame/draw_slice: 110 // nope, fallback to old draw_frame/draw_slice:
108 if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))){ 111 if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))){
109 // blit frame: 112 // blit frame: