comparison libmpcodecs/vd_theora.c @ 14763:2c4e30f37773

Theora fixes: - do not use negative stride (fixes -vf pp crash) - pass true image dimensions to VO, not the aligned ones (fixes incorrect aspect ratio bug & black bar under video)
author henry
date Tue, 22 Feb 2005 19:18:45 +0000
parents 38572280e8e7
children 28e19750b448
comparison
equal deleted inserted replaced
14762:b2cb91b9b4e0 14763:2c4e30f37773
25 25
26 #define THEORA_NUM_HEADER_PACKETS 3 26 #define THEORA_NUM_HEADER_PACKETS 3
27 27
28 // to set/get/query special features/parameters 28 // to set/get/query special features/parameters
29 static int control(sh_video_t *sh,int cmd,void* arg,...){ 29 static int control(sh_video_t *sh,int cmd,void* arg,...){
30 switch(cmd) {
31 case VDCTRL_QUERY_FORMAT:
32 if ((*((int*)arg)) == IMGFMT_YV12)
33 return CONTROL_TRUE;
34 return CONTROL_FALSE;
35 }
36
30 return CONTROL_UNKNOWN; 37 return CONTROL_UNKNOWN;
31 } 38 }
32 39
33 typedef struct theora_struct_st { 40 typedef struct theora_struct_st {
34 theora_state st; 41 theora_state st;
102 return 0; 109 return 0;
103 } 110 }
104 111
105 if(sh->aspect==0.0 && context->inf.aspect_denominator!=0) 112 if(sh->aspect==0.0 && context->inf.aspect_denominator!=0)
106 { 113 {
107 sh->aspect = (float)(context->inf.aspect_numerator * context->inf.width)/ 114 sh->aspect = (float)(context->inf.aspect_numerator * context->inf.frame_width)/
108 (context->inf.aspect_denominator * context->inf.height); 115 (context->inf.aspect_denominator * context->inf.frame_height);
109 } 116 }
110 117
111 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Theora video init ok!\n"); 118 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Theora video init ok!\n");
112 119
113 return mpcodecs_config_vo (sh,sh->disp_w,sh->disp_h,IMGFMT_YV12); 120 return mpcodecs_config_vo (sh,context->inf.frame_width,context->inf.frame_height,IMGFMT_YV12);
114 } 121 }
115 122
116 /* 123 /*
117 * uninit driver 124 * uninit driver
118 */ 125 */
158 mp_msg(MSGT_DEMUX,MSGL_ERR,"Theora decode YUVout failed: %i \n", 165 mp_msg(MSGT_DEMUX,MSGL_ERR,"Theora decode YUVout failed: %i \n",
159 errorCode); 166 errorCode);
160 return 0; 167 return 0;
161 } 168 }
162 169
163 mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, sh->disp_w, sh->disp_h); 170 mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, yuv.y_stride, yuv.y_height);
164 if(!mpi) return NULL; 171 if(!mpi) return NULL;
165 172 mpi->planes[0]=yuv.y+yuv.y_stride*(context->inf.frame_height-1);
166 mpi->planes[0]=yuv.y; 173 mpi->stride[0]=-yuv.y_stride;
167 mpi->stride[0]=yuv.y_stride; 174 mpi->planes[1]=yuv.u+yuv.uv_stride*(context->inf.frame_height/2-1);
168 mpi->planes[1]=yuv.u; 175 mpi->stride[1]=-yuv.uv_stride;
169 mpi->stride[1]=yuv.uv_stride; 176 mpi->planes[2]=yuv.v+yuv.uv_stride*(context->inf.frame_height/2-1);
170 mpi->planes[2]=yuv.v; 177 mpi->stride[2]=-yuv.uv_stride;
171 mpi->stride[2]=yuv.uv_stride; 178
172
173 return mpi; 179 return mpi;
174 } 180 }
175 181
176 #endif 182 #endif