10 #include "vd_internal.h"
12 #include "loader/dmo/DMO_VideoDecoder.h"
14 static vd_info_t info
= {
18 "based on http://avifile.sf.net",
24 // to set/get/query special features/parameters
25 static int control(sh_video_t
*sh
,int cmd
,void* arg
,...){
26 return CONTROL_UNKNOWN
;
30 static int init(sh_video_t
*sh
){
32 if(!(sh
->context
=DMO_VideoDecoder_Open(sh
->codec
->dll
,&sh
->codec
->guid
, sh
->bih
, 0, 0))){
33 mp_msg(MSGT_DECVIDEO
,MSGL_ERR
,MSGTR_MissingDLLcodec
,sh
->codec
->dll
);
34 mp_msg(MSGT_DECVIDEO
,MSGL_HINT
,MSGTR_DownloadCodecPackage
);
37 if(!mpcodecs_config_vo(sh
,sh
->disp_w
,sh
->disp_h
,IMGFMT_YUY2
)) return 0;
38 out_fmt
=sh
->codec
->outfmt
[sh
->outfmtidx
];
42 DMO_VideoDecoder_SetDestFmt(sh
->context
,16,out_fmt
);break; // packed YUV
46 DMO_VideoDecoder_SetDestFmt(sh
->context
,12,out_fmt
);break; // planar YUV
48 DMO_VideoDecoder_SetDestFmt(sh
->context
,9,out_fmt
);break;
50 DMO_VideoDecoder_SetDestFmt(sh
->context
,out_fmt
&255,0); // RGB/BGR
52 DMO_VideoDecoder_StartInternal(sh
->context
);
53 mp_msg(MSGT_DECVIDEO
,MSGL_V
,MSGTR_DMOInitOK
);
58 static void uninit(sh_video_t
*sh
){
59 DMO_VideoDecoder_Destroy(sh
->context
);
62 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
65 static mp_image_t
* decode(sh_video_t
*sh
,void* data
,int len
,int flags
){
67 if(len
<=0) return NULL
; // skipped frame
71 DMO_VideoDecoder_DecodeInternal(sh
->context
, data
, len
, 0, 0);
75 mpi
=mpcodecs_get_image(sh
, MP_IMGTYPE_TEMP
, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/,
76 sh
->disp_w
, sh
->disp_h
);
78 if(!mpi
){ // temporary!
79 mp_msg(MSGT_DECVIDEO
,MSGL_WARN
,MSGTR_MPCODECS_CouldntAllocateImageForCinepakCodec
);
83 DMO_VideoDecoder_DecodeInternal(sh
->context
, data
, len
, 1, mpi
->planes
[0]);