[Ffmpeg-devel] Re: Broken decoding of mpeg2?

Joakim Plate elupus
Tue Mar 21 12:21:55 CET 2006

">> You are probably using some sort of direct rendering, it doesn't work 
>> some outputs in mplayer for example. mplayer reporting that lavc supports
>> aritrairy strides even thou mpeg12 decoder doesn't even support any 
>> change
>> in it.
> arbitrary != change
> to make a silly analogy, a car might support arbitrary tires but changing
> them while driving still would be tricky
> the buffers for direct rendering are the internal buffers used by ffmpeg
> theese have strict restrictions on alignment and unchanging stride, if
> the user app cant provide this then direct rendering should not be used
> [...]
> -- 
> Michael

Agreed, but my point is this.. mplayer overrides the default get_buffer 
function with it's own.

static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
    sh_video_t * sh = avctx->opaque;
    vd_ffmpeg_ctx *ctx = sh->context;
    mp_image_t* mpi=NULL;
    int type= MP_IMGTYPE_IPB;
    int width= avctx->width;
    int height= avctx->height;
    int align=15;

the flag MP_IMGFLAG_ACCEPT_STRIDE is passed to the next filter or output, 
wich in for example the directx renderer means it can return an arbitrary 
stride and alignment (depends on pitch of the d3d texture it allocates). A 
few other renderers assume the same about that flag, just that normally they 
have buffers with same stride as width and thus normally works. Either the 
accept_stride flag should be removed from vd_ffmpeg.c in mplayer or ffmpeg 
should pass some hint that it can or can not accept a stride different from 
width and with a specific alignment.


More information about the ffmpeg-devel mailing list