12 #include "img_format.h"
15 #include <libdv/dv_types.h>
21 #include "vd_internal.h"
23 static vd_info_t info
=
25 "Raw DV Video Decoder",
27 "Alexander Neundorf <neundorf@kde.org>",
28 "http://libdv.sf.net",
34 // to set/get/query special features/parameters
35 static int control(sh_video_t
*sh
,int cmd
,void* arg
,...){
36 return CONTROL_UNKNOWN
;
39 static dv_decoder_t
* global_rawdv_decoder
=NULL
;
41 dv_decoder_t
* init_global_rawdv_decoder()
43 if(!global_rawdv_decoder
){
44 global_rawdv_decoder
=dv_decoder_new(TRUE
,TRUE
,FALSE
);
45 global_rawdv_decoder
->quality
=DV_QUALITY_BEST
;
46 global_rawdv_decoder
->prev_frame_decoded
= 0;
48 return global_rawdv_decoder
;
52 static int init(sh_video_t
*sh
)
54 sh
->context
= (void *)init_global_rawdv_decoder();
55 return mpcodecs_config_vo(sh
,sh
->disp_w
,sh
->disp_h
,IMGFMT_YUY2
);
59 static void uninit(sh_video_t
*sh
){
63 static mp_image_t
* decode(sh_video_t
*sh
,void* data
,int len
,int flags
)
66 dv_decoder_t
*decoder
=sh
->context
;
68 if(len
<=0 || (flags
&3)){
69 // fprintf(stderr,"decode() (rawdv) SKIPPED\n");
70 return NULL
; // skipped frame
73 dv_parse_header(decoder
, data
);
75 mpi
=mpcodecs_get_image(sh
, MP_IMGTYPE_TEMP
, MP_IMGFLAG_ACCEPT_STRIDE
, sh
->disp_w
, sh
->disp_h
);
77 if(!mpi
){ // temporary!
78 fprintf(stderr
,"couldn't allocate image for stderr codec\n");
82 dv_decode_full_frame(decoder
, data
, e_dv_color_yuv
, mpi
->planes
, mpi
->stride
);