typo fixes
[mplayer/greg.git] / libmpcodecs / vd_libdv.c
blob5d5713bb0bab47e135e2a849fe0ae49b5692f11f
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <sys/types.h>
5 #include <unistd.h>
6 #include <math.h>
8 #include "config.h"
10 #ifdef HAVE_LIBDV095
12 #include "img_format.h"
14 #include <libdv/dv.h>
15 #include <libdv/dv_types.h>
17 #include "stream.h"
18 #include "demuxer.h"
19 #include "stheader.h"
21 #include "vd_internal.h"
23 static vd_info_t info =
25 "Raw DV Video Decoder",
26 "libdv",
27 "Alexander Neundorf <neundorf@kde.org>",
28 "http://libdv.sf.net",
29 "native codec"
32 LIBVD_EXTERN(libdv)
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;
51 // init driver
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);
58 // uninit driver
59 static void uninit(sh_video_t *sh){
62 // decode a frame
63 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags)
65 mp_image_t* mpi;
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");
79 return NULL;
82 dv_decode_full_frame(decoder, data, e_dv_color_yuv, mpi->planes, mpi->stride);
84 return mpi;
86 #endif