Root/mplayer/patches/040-fix-theora-framesize-not-x16.patch

Source at commit 1b3135c created 8 years 9 months ago.
By Xiangfu Liu, new package: SDL-widgets: a GUI toolkit on top of the SDL libraries
1Index: MPlayer-r33333/libmpcodecs/vd_theora.c
2===================================================================
3--- MPlayer-r33333.orig/libmpcodecs/vd_theora.c 2011-05-01 10:23:23.000000000 +0200
4+++ MPlayer-r33333/libmpcodecs/vd_theora.c 2011-05-01 14:09:52.000000000 +0200
5@@ -133,7 +133,7 @@
6     mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Theora video init ok!\n");
7     mp_msg(MSGT_DECVIDEO,MSGL_INFO,"Frame: %dx%d, Picture %dx%d, Offset [%d,%d]\n", context->inf.width, context->inf.height, context->inf.frame_width, context->inf.frame_height, context->inf.offset_x, context->inf.offset_y);
8 
9- return mpcodecs_config_vo (sh,context->inf.width,context->inf.height,theora_pixelformat2imgfmt(context->inf.pixelformat));
10+ return mpcodecs_config_vo (sh,context->inf.frame_width,context->inf.frame_height,theora_pixelformat2imgfmt(context->inf.pixelformat));
11 
12 err_out:
13     free(context);
14@@ -196,11 +196,17 @@
15     mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, yuv.y_width, yuv.y_height);
16     if(!mpi) return NULL;
17 
18- mpi->planes[0]=yuv.y;
19+ int y_offs = context->inf.offset_x + context->inf.offset_y*yuv.y_stride;
20+ int uv_h_sampling = mpi->width / mpi->chroma_width;
21+ int uv_v_sampling = mpi->height / mpi->chroma_height;
22+ int uv_offs = context->inf.offset_x/uv_h_sampling
23+ + context->inf.offset_y/uv_v_sampling * yuv.uv_stride;
24+
25+ mpi->planes[0]=yuv.y + y_offs;
26     mpi->stride[0]=yuv.y_stride;
27- mpi->planes[1]=yuv.u;
28+ mpi->planes[1]=yuv.u + uv_offs;
29     mpi->stride[1]=yuv.uv_stride;
30- mpi->planes[2]=yuv.v;
31+ mpi->planes[2]=yuv.v + uv_offs;
32     mpi->stride[2]=yuv.uv_stride;
33 
34     return mpi;
35

Archive Download this file



interactive