// decode a frame static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ struct context *ctx = sh->context; uint8_t *buffer = ctx->buffer; int type = ctx->buffer ? MP_IMGTYPE_EXPORT : MP_IMGTYPE_TEMP; mp_image_t* mpi; if(len<=0) return NULL; // skipped frame if(flags&3){ // framedrop: DMO_VideoDecoder_DecodeInternal(ctx->decoder, data, len, 0, 0); return NULL; } mpi=mpcodecs_get_image(sh, type, MP_IMGFLAG_COMMON_PLANE, sh->disp_w, sh->disp_h); if (buffer) { mpi->planes[0] = buffer; mpi->stride[0] = ctx->stride; } else { buffer = mpi->planes[0]; } if(!mpi){ // temporary! mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n"); return NULL; } DMO_VideoDecoder_DecodeInternal(ctx->decoder, data, len, 1, buffer); return mpi; }
// decode a frame static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ mp_image_t* mpi; if(len<=0) return NULL; // skipped frame if(flags&3){ // framedrop: DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0); return NULL; } mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, sh->disp_w, sh->disp_h); if(!mpi){ // temporary! mp_msg(MSGT_DECVIDEO,MSGL_WARN,MSGTR_MPCODECS_CouldntAllocateImageForCinepakCodec); return NULL; } DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 1, mpi->planes[0]); return mpi; }