11 #include "vd_internal.h"
13 #include "loader/dmo/DMO_VideoDecoder.h"
15 static vd_info_t info
= {
19 "based on http://avifile.sf.net",
25 // to set/get/query special features/parameters
26 static int control(sh_video_t
*sh
,int cmd
,void* arg
,...){
27 return CONTROL_UNKNOWN
;
31 static int init(sh_video_t
*sh
){
33 if(!(sh
->context
=DMO_VideoDecoder_Open(sh
->codec
->dll
,&sh
->codec
->guid
, sh
->bih
, 0, 0))){
34 mp_msg(MSGT_DECVIDEO
,MSGL_ERR
,MSGTR_MissingDLLcodec
,sh
->codec
->dll
);
35 mp_msg(MSGT_DECVIDEO
,MSGL_HINT
,MSGTR_DownloadCodecPackage
);
38 if(!mpcodecs_config_vo(sh
,sh
->disp_w
,sh
->disp_h
,IMGFMT_YUY2
)) return 0;
39 out_fmt
=sh
->codec
->outfmt
[sh
->outfmtidx
];
43 DMO_VideoDecoder_SetDestFmt(sh
->context
,16,out_fmt
);break; // packed YUV
47 DMO_VideoDecoder_SetDestFmt(sh
->context
,12,out_fmt
);break; // planar YUV
49 DMO_VideoDecoder_SetDestFmt(sh
->context
,9,out_fmt
);break;
51 DMO_VideoDecoder_SetDestFmt(sh
->context
,out_fmt
&255,0); // RGB/BGR
53 DMO_VideoDecoder_StartInternal(sh
->context
);
54 mp_msg(MSGT_DECVIDEO
,MSGL_V
,MSGTR_DMOInitOK
);
59 static void uninit(sh_video_t
*sh
){
60 DMO_VideoDecoder_Destroy(sh
->context
);
63 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
66 static mp_image_t
* decode(sh_video_t
*sh
,void* data
,int len
,int flags
){
68 if(len
<=0) return NULL
; // skipped frame
72 DMO_VideoDecoder_DecodeInternal(sh
->context
, data
, len
, 0, 0);
76 mpi
=mpcodecs_get_image(sh
, MP_IMGTYPE_TEMP
, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/,
77 sh
->disp_w
, sh
->disp_h
);
79 if(!mpi
){ // temporary!
80 mp_msg(MSGT_DECVIDEO
,MSGL_WARN
,MSGTR_MPCODECS_CouldntAllocateImageForCinepakCodec
);
84 DMO_VideoDecoder_DecodeInternal(sh
->context
, data
, len
, 1, mpi
->planes
[0]);