Ticket #191: vd_theora.c.diff
| File vd_theora.c.diff, 2.6 KB (added by , 22 years ago) |
|---|
-
libmpcodecs/vd_theora.c
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_theora.c,v retrieving revision 1.5 diff -u -u -r1.5 vd_theora.c
27 27 28 28 // to set/get/query special features/parameters 29 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 37 return CONTROL_UNKNOWN; 31 38 } 32 39 … … 104 111 105 112 if(sh->aspect==0.0 && context->inf.aspect_denominator!=0) 106 113 { 107 sh->aspect = (float)(context->inf.aspect_numerator * context->inf. width)/108 (context->inf.aspect_denominator * context->inf. height);114 sh->aspect = (float)(context->inf.aspect_numerator * context->inf.frame_width)/ 115 (context->inf.aspect_denominator * context->inf.frame_height); 109 116 } 110 117 111 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 /* … … 160 167 return 0; 161 168 } 162 169 163 mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, sh->disp_w, sh->disp_h); 164 if(!mpi) return NULL; 165 166 mpi->planes[0]=yuv.y; 167 mpi->stride[0]=yuv.y_stride; 168 mpi->planes[1]=yuv.u; 169 mpi->stride[1]=yuv.uv_stride; 170 mpi->planes[2]=yuv.v; 171 mpi->stride[2]=yuv.uv_stride; 172 170 if (yuv.y_stride > 0 || yuv.uv_stride > 0) { 171 mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, sh->disp_w, sh->disp_h); 172 if(!mpi) return NULL; 173 174 mpi->planes[0]=yuv.y; 175 mpi->stride[0]=yuv.y_stride; 176 mpi->planes[1]=yuv.u; 177 mpi->stride[1]=yuv.uv_stride; 178 mpi->planes[2]=yuv.v; 179 mpi->stride[2]=yuv.uv_stride; 180 } else { 181 mpi = mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE, yuv.y_width, yuv.y_height); 182 if(!mpi) return NULL; 183 184 for (i = 0; i < yuv.y_height; i++) 185 memcpy(mpi->planes[0]+i*mpi->stride[0], yuv.y+i*yuv.y_stride, yuv.y_width); 186 for (i = 0; i < yuv.uv_height; i++) 187 memcpy(mpi->planes[1]+i*mpi->stride[1], yuv.u+i*yuv.uv_stride, yuv.uv_width); 188 for (i = 0; i < yuv.uv_height; i++) 189 memcpy(mpi->planes[2]+i*mpi->stride[2], yuv.v+i*yuv.uv_stride, yuv.uv_width); 190 } 191 192 173 193 return mpi; 174 194 } 175 195
