[Mplayer-cvslog] CVS: main/libmpcodecs vd_ffmpeg.c,1.8,1.9
pl
p_l at gmx.fr
Fri Apr 5 01:51:00 CEST 2002
Hi,
On Thu, Apr 04, 2002 at 01:59:57AM +0200, Arpi of Ize wrote:
> Update of /cvsroot/mplayer/main/libmpcodecs
> In directory mplayer:/var/tmp.root/cvs-serv7041
>
> Modified Files:
> vd_ffmpeg.c
> Log Message:
> libavcodec slices support
This seems to break something.
Now's cvs + old version of this file => OK
Now's cvs + current version => not OK (sig11) for divx/avi play back
through ffdivx with xv (nvidia in case you ask...) but it's fine with x11 or divxds
"Opening Video Decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec: CPU flags: mmx mmxext 3dnow
Detected video codec: [ffdivx] drv:5 prio:0 (FFmpeg DivX ;-) (MS MPEG-4
v3))
==========================================================================
MPlayer interrupted by signal 11 in module: init_vo_vaa "
If you're sure of your changes I'll try and send a better bugreport.
>
> Index: vd_ffmpeg.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_ffmpeg.c,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -r1.8 -r1.9
> --- vd_ffmpeg.c 1 Apr 2002 17:12:10 -0000 1.8
> +++ vd_ffmpeg.c 3 Apr 2002 23:59:54 -0000 1.9
> @@ -33,7 +33,9 @@
>
> typedef struct {
> AVCodecContext *avctx;
> - int last_aspect;
> + int last_aspect;
> + int do_slices;
> + int vo_inited;
> } vd_ffmpeg_ctx;
>
> //#ifdef FF_POSTPROCESS
> @@ -67,6 +69,10 @@
> mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh->codec->dll);
> return 0;
> }
> +
> +// currently buggy with B frames...
> +// if(vd_use_slices && lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)
> +// ctx->do_slices=1;
>
> ctx->avctx = malloc(sizeof(AVCodecContext));
> memset(ctx->avctx, 0, sizeof(AVCodecContext));
> @@ -83,7 +89,8 @@
> return 0;
> }
> mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n");
> - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12);
> + ctx->last_aspect=-3;
> + return 1; //mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
With the old version of this chunk it seems OK.
> }
>
> // uninit driver
> @@ -99,7 +106,20 @@
> free(ctx);
> }
>
> -//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
> +#include "libvo/video_out.h" // FIXME!!!
> +
> +static void draw_slice(struct AVCodecContext *s,
> + UINT8 **src, int linesize,
> + int y, int width, int height){
> + vo_functions_t * output = s->opaque;
> + int stride[3];
> +
> + stride[0]=linesize;
> + stride[1]=stride[2]=stride[0]/2;
> +
> + output->draw_slice (src, stride, width, height, 0, y);
> +
> +}
>
> // decode a frame
> static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
> @@ -108,17 +128,32 @@
> AVPicture lavc_picture;
> vd_ffmpeg_ctx *ctx = sh->context;
> AVCodecContext *avctx = ctx->avctx;
> - mp_image_t* mpi;
> + mp_image_t* mpi=NULL;
>
> if(len<=0) return NULL; // skipped frame
>
> + if(ctx->vo_inited){
> + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE |
> + (ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0),
> + sh->disp_w, sh->disp_h);
> + if(mpi && mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
> + // vd core likes slices!
> + avctx->draw_horiz_band=draw_slice;
> + avctx->opaque=sh->video_out;
> + } else
> + avctx->draw_horiz_band=NULL;
> + }
> +
> ret = avcodec_decode_video(avctx, &lavc_picture,
> &got_picture, data, len);
>
> if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n");
> if(!got_picture) return NULL; // skipped image
>
> - if (avctx->aspect_ratio_info != ctx->last_aspect)
> + if (avctx->aspect_ratio_info != ctx->last_aspect ||
> + avctx->width != sh->disp_w ||
> + avctx->height != sh->disp_h ||
> + !ctx->vo_inited)
> {
> ctx->last_aspect = avctx->aspect_ratio_info;
> switch(avctx->aspect_ratio_info)
> @@ -136,24 +171,14 @@
> sh->aspect = 0.0;
> break;
> }
> - /* config only if width && height isn't changed */
> - /* else it will config twice */
> - if ((sh->aspect > 0.01) && (avctx->width == sh->disp_w) &&
> - (avctx->height == sh->disp_h))
> - if (mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12))
> - return NULL;
> - }
> -
> - if ((avctx->width != sh->disp_w) ||
> - (avctx->height != sh->disp_h))
> - {
> - /* and what about the sh->bih (BitmapInfoHeader) width/height values? */
> sh->disp_w = avctx->width;
> sh->disp_h = avctx->height;
> - if (mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12))
> - return NULL;
> + ctx->vo_inited=1;
> + if (mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12))
> + return NULL;
> }
>
> + if(!mpi)
> mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE,
> avctx->width, avctx->height);
> if(!mpi){ // temporary!
--
Best regards,
pl
More information about the MPlayer-cvslog
mailing list